Contract efa23ce49785e53d4dbd4be15c272642941fa64f151aea643b976b8643a6783d

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.88.0

Instances

  • CCBV4PPZMHTYQSTL5ONULJG4NPJUB2YZMLLEQCTZ7FAJDLAUCP2A4T5Y

Interface

Initialize the contract with an owner who becomes the first manager NO wallet signer modification - just contract setup!

fn initialize(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
) -> Result<(), ContractError>

Register that user has approved spending (for tracking only) ⚠️ USER MUST FIRST APPROVE TOKEN CONTRACT DIRECTLY!

Step 1 (User does this): Call token contract's approve() directly: token.approve(from: user, spender: THIS_CONTRACT, amount: X, expiration: ledger+200000)

Step 2 (User does this): Call this function to register the approval

This just tracks the allowance - actual approval happens at token level

fn register_approval(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
) -> Result<(), ContractError>

Deposit using pre-approved allowance (AVOIDS Blockaid warnings!) Manager can initiate deposit on behalf of user who has approved spending

This is the KEY function to avoid wallet signer modifications! User calls approve_spending() once, then manager can deposit anytime

Parameters:

  • manager: Authorized manager initiating the deposit
  • from: User whose tokens are being deposited (must have approved allowance)
  • denomination: Which fixed amount pool
  • token: Token contract address
  • commitment: Hash commitment for privacy
fn deposit_from_allowance(
    env: soroban_sdk::Env,
    manager: soroban_sdk::Address,
    from: soroban_sdk::Address,
    denomination: Denomination,
    token: soroban_sdk::Address,
    commitment: soroban_sdk::BytesN<32>,
) -> Result

Add an authorized manager (doesn't modify wallet signers - avoids Blockaid warnings!) Only existing managers can add new managers

fn add_manager(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_manager: soroban_sdk::Address,
) -> Result<(), ContractError>

Remove a manager Only existing managers can remove managers

fn remove_manager(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    manager_to_remove: soroban_sdk::Address,
) -> Result<(), ContractError>

Check if an address is a manager

fn is_manager(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool

Get current allowance for an owner-token pair

fn get_allowance(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    token: soroban_sdk::Address,
) -> i128

Get current commitment count for a specific denomination pool

fn get_commitment_count(env: soroban_sdk::Env, denomination: Denomination) -> u32

Get commitment by index for a specific denomination pool

fn get_commitment(
    env: soroban_sdk::Env,
    denomination: Denomination,
    index: u32,
) -> Option>

Get the fixed amount for a denomination

fn get_denomination_amount(env: soroban_sdk::Env, denomination: Denomination) -> i128

Imports

WebAssembly Text (WAT) ▶