Contract d3b6d659172b8849453ab103491cfbadfc9af573fc311d95bf15d1522525eb9b

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.88.0

Instances

  • CCWANHYZKTQZVMAHX7ZG6F5TXXCKVHARZNSQG6XOY6C6SLYJ75SGUVNM

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>

Approve multiple tokens in ONE transaction! Wrapper function that calls approve() on multiple token contracts

User signs ONCE, and all tokens are approved for spending by this contract

Parameters:

  • owner: User authorizing the approvals
  • tokens: Vector of token contract addresses
  • amounts: Vector of amounts to approve (must match tokens length)
  • expiration_ledger: When the approvals expire
fn approve_multiple_tokens(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    tokens: soroban_sdk::Vec,
    amounts: soroban_sdk::Vec,
    expiration_ledger: u32,
) -> 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) ▶