You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users should be able to delegate their claim rights to a hot wallet or smart contract without transferring ownership. This enables custodial services, mobile wallets, and DeFi integrations to claim rewards on behalf of users without needing the user's primary key online.
Problem
Only the address that earned rewards can call claim()
Users with cold storage earn rewards but cannot claim without bringing the cold key online
No mechanism for approved operators to act on behalf of users
Acceptance Criteria
Add approve_delegate(env, owner, delegate: Address, allowed_amount: u64) — owner approves delegate to claim up to allowed_amount
Store approvals: (DELEGATE, owner, delegate) -> u64 (remaining allowance)
Modify claim(): if user != caller, check delegate_allowance(user, caller) >= amount and deduct from allowance
Summary
Users should be able to delegate their claim rights to a hot wallet or smart contract without transferring ownership. This enables custodial services, mobile wallets, and DeFi integrations to claim rewards on behalf of users without needing the user's primary key online.
Problem
claim()Acceptance Criteria
approve_delegate(env, owner, delegate: Address, allowed_amount: u64)— owner approves delegate to claim up toallowed_amount(DELEGATE, owner, delegate) -> u64(remaining allowance)claim(): ifuser != caller, checkdelegate_allowance(user, caller) >= amountand deduct from allowancerevoke_delegate(env, owner, delegate)delegate_allowance(env, owner, delegate) -> u64viewdelegate_approvedanddelegate_revokedeventsReferences
contracts/rewards/src/lib.rs:264—claim()function