Skip to content

SC: Implement Withdraw Functionality #78

@Pvsaint

Description

@Pvsaint

Description
Implement the withdraw function, allowing users to withdraw their tokens anonymously using a zero-knowledge proof.

Tasks

Validate that:

Contract is not paused.

Nullifier has not been used before.

Amount matches allowed denominations.

Call verifier with proof inputs (root, nullifier_hash, amount, recipient, relayer, fee).

If proof is valid:

Transfer amount to recipient.

Transfer relayer fee (if any).

Mark nullifier as used.

Update totals (total_withdrawals).

Emit Withdrawal event.

Acceptance Criteria

Withdrawals only succeed with valid proof.

Double-spend attempts fail.

Relayer receives correct fee.

Events emitted correctly.

Unit tests cover both success and failure paths.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions