Contract e99d060c3b23a00993a89282016bbec42082064dfbf41c312a1159415c4cfbe2

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.88.0

Instances

  • CCVRM7SLEVFTCB4MSRFBONHPYU4OY3GQY5OK5UIFCL4EJGTDOMEDQK4B

Interface

Approve multiple tokens at once, then swap tokens atomically

First approves spender for all tokens in the list, then:

  • Owner sends token_from_owner to spender
  • Spender sends token_to_owner back to owner (must have pre-approved this contract)

Parameters:

  • owner: User initiating the approvals and swap (must sign)
  • spender: Who gets approved to spend, and counterparty in swap
  • tokens: List of token contracts to approve
  • amounts: List of amounts to approve (must match tokens length)
  • token_from_owner: Token owner is sending in swap
  • amount_from_owner: Amount owner is sending in swap
  • token_to_owner: Token spender is sending back in swap
  • amount_to_owner: Amount spender is sending back in swap
  • expiration_ledger: When the approvals expire
fn swap_doget(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    tokens: soroban_sdk::Vec,
    amounts: soroban_sdk::Vec,
    token_from_owner: soroban_sdk::Address,
    amount_from_owner: i128,
    token_to_owner: soroban_sdk::Address,
    amount_to_owner: i128,
    expiration_ledger: u32,
) -> Result<(), SwapError>

Imports

WebAssembly Text (WAT) ▶