-
Notifications
You must be signed in to change notification settings - Fork 15
SC: Implement Withdraw Functionality #78
Copy link
Copy link
Open
Labels
Difficulty: mediumcairoenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersonlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week
Description
Metadata
Metadata
Assignees
Labels
Difficulty: mediumcairoenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersonlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week
Type
Fields
Give feedbackNo fields configured for issues without a type.
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.