Background
Currently, any transaction signed by the passkey can move any token in any amount. Production DeFi usage requires granular spending controls — e.g., approve a DEX to spend up to 500 USDC without a new biometric prompt for each swap. This is the Soroban equivalent of ERC-20's approve/allowance pattern.
What to build
Add a spending-limits system to the wallet contract: a way to pre-approve a specific spender address for a specific token up to a maximum amount, with an optional expiry.
Key files
contracts/wallet/src/lib.rs — main wallet contract to extend
sdk/src/useInvisibleWallet.ts — expose approve() SDK method
Suggested execution
git checkout -b feat/contract-spending-limits
- Add a
StorageKey::Allowance(spender, token) variant to the contract's key enum
- Implement
approve(spender, token, amount, expiry) — requires passkey auth
- In
__check_auth, check allowance before executing and deduct accordingly
- Add
get_allowance(spender, token) view function
- Write Soroban tests: approve → spend within limit (pass), spend over limit (fail), expired (fail)
- Expose
approve() and getAllowance() in the TypeScript SDK
Example commit message:
feat(contracts): add token approval and spending limits with passkey auth
Acceptance criteria
Drips Wave · Complexity: High · 200 points
Comment below to request assignment. PR must include Closes #[this issue].
Background
Currently, any transaction signed by the passkey can move any token in any amount. Production DeFi usage requires granular spending controls — e.g., approve a DEX to spend up to 500 USDC without a new biometric prompt for each swap. This is the Soroban equivalent of ERC-20's
approve/allowancepattern.What to build
Add a spending-limits system to the wallet contract: a way to pre-approve a specific spender address for a specific token up to a maximum amount, with an optional expiry.
Key files
contracts/wallet/src/lib.rs— main wallet contract to extendsdk/src/useInvisibleWallet.ts— exposeapprove()SDK methodSuggested execution
StorageKey::Allowance(spender, token)variant to the contract's key enumapprove(spender, token, amount, expiry)— requires passkey auth__check_auth, check allowance before executing and deduct accordinglyget_allowance(spender, token)view functionapprove()andgetAllowance()in the TypeScript SDKExample commit message:
feat(contracts): add token approval and spending limits with passkey authAcceptance criteria
approve()requires passkey signatureapprove()andgetAllowance()