Background & current state
SEP-41 token mode (NEW-009) introduces transfers, but delegated spending (a dApp/operator spending a user's tokens with consent) needs allowances. This is distinct from claim-rights delegation (#323). Without approve/transfer_from, integrators can't build spend-on-behalf flows.
Goal
Implement SEP-41 allowance semantics — approve, allowance, transfer_from, burn_from — with ledger-based expiration.
Technical design
fn approve(env: Env, from: Address, spender: Address, amount: i128, expiration_ledger: u32);
fn allowance(env: Env, from: Address, spender: Address) -> i128;
fn transfer_from(env: Env, spender: Address, from: Address, to: Address, amount: i128);
fn burn_from(env: Env, spender: Address, from: Address, amount: i128);
- Store
(from, spender) -> (amount, expiration_ledger). transfer_from checks ledger ≤ expiration_ledger and decrements allowance.
- Standard
approve/transfer events.
Edge cases
- Spend after
expiration_ledger → revert.
- Over-spend beyond allowance → revert.
- Re-approve resets amount + expiration (per spec).
- Allowance to self / zero amount handling.
- Interaction with confidential mode (NEW-003) → document mutual exclusivity.
Task breakdown
Acceptance criteria
Testing & verification
- Unit tests incl. expiry edge cases; conformance with SEP-41 allowance section.
Out of scope
Dependencies / related
- Depends on NEW-009 (SEP-41 token mode).
References
- SEP-41 allowance semantics.
Difficulty: medium · Effort: M
Background & current state
SEP-41 token mode (NEW-009) introduces transfers, but delegated spending (a dApp/operator spending a user's tokens with consent) needs allowances. This is distinct from claim-rights delegation (#323). Without
approve/transfer_from, integrators can't build spend-on-behalf flows.Goal
Implement SEP-41 allowance semantics —
approve,allowance,transfer_from,burn_from— with ledger-based expiration.Technical design
(from, spender) -> (amount, expiration_ledger).transfer_fromchecksledger ≤ expiration_ledgerand decrements allowance.approve/transferevents.Edge cases
expiration_ledger→ revert.Task breakdown
transfer_from/burn_fromwith checks + events.docs/CONTRACTS_API.md).Acceptance criteria
Testing & verification
Out of scope
Dependencies / related
References
Difficulty: medium · Effort: M