Contract 1eb13ee69272807a012b722ba6acceb9aa8c93ce8c2793feaed5bddc49fc3d09

← Back to Index 📥 Download WASM

Meta

rssdkver 23.1.0#7456be9d91fe1f4cb070fc2732bac78244ce6c3f
rsver 1.89.0

Instances

  • CBLY5WTS7XNPSL3ZLPK7GLMQWWUXHKSTDVJSJ5UYA5OVVYWPG5KBEF6U

Interface

Initialize the contract with admin and validator setup. Must be called first after deployment.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    oracle: soroban_sdk::Address,
    fee_distributor: soroban_sdk::Address,
    rebalancing_min: i128,
) -> Result<(), ContractError>

Update the contract administrator. Only callable by the current admin.

fn update_admin(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Update the contract oracle. Only callable by the current admin.

fn update_oracle(env: soroban_sdk::Env, oracle: soroban_sdk::Address)

Upgrade the contract WASM to a new version. Only callable by the admin.

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Setup initial bridge fee parameters.

fn setup_bridge_fee(
    env: soroban_sdk::Env,
    payment_token: soroban_sdk::Address,
    rate: i128,
)

Set the fee distribution for the bridge. Validates that all components sum to FEE_TOTAL.

fn set_fee_distribution(
    env: soroban_sdk::Env,
    v: soroban_sdk::Vec,
) -> Result<(), ContractError>

Update minimum amount for rebalance operations.

fn update_rebalance_min(env: soroban_sdk::Env, rebalancing_min: i128)

Add a new bridge token for cross-chain operations.

fn add_bridge_token(
    env: soroban_sdk::Env,
    token_id: soroban_sdk::Address,
    fixed_fee: i128,
    rate_fee: u32,
) -> Result<(), ContractError>

Update fee configuration for a specific bridge token.

fn update_bridge_token_fee(
    env: soroban_sdk::Env,
    token_id: soroban_sdk::Address,
    fixed_fee: i128,
    rate_fee: u32,
) -> Result<(), ContractError>

Get the current bridge fee for a token.

fn get_bridge_fee(env: soroban_sdk::Env) -> BridgeFee

Retrieve the current fee distribution configuration.

fn get_fee_distribution(env: soroban_sdk::Env) -> LiquidityFeeDistribution

Add a new chain to the bridge support list.

fn add_chain_support(
    env: soroban_sdk::Env,
    chain_id: u64,
    dest_client: soroban_sdk::String,
) -> Result<(), ContractError>

Add a token for a specific destination chain.

fn add_token_dest_support(
    env: soroban_sdk::Env,
    token_id: soroban_sdk::Address,
    chain_id: u64,
    dest_token: soroban_sdk::String,
) -> Result<(), ContractError>

Add liquidity to the bridge pool.

fn add_liquidity(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token_id: soroban_sdk::Address,
    amount: i128,
) -> Result<(), ContractError>

Remove liquidity from the bridge pool.

fn remove_liquidity(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token_id: soroban_sdk::Address,
    amount: i128,
) -> Result<(), ContractError>

Get the LP token balance for a user.

fn get_lp_token(
    env: soroban_sdk::Env,
    token_id: soroban_sdk::Address,
) -> Result

Get total liquidity available for a token in the bridge.

fn get_bridge_liquidity(
    env: soroban_sdk::Env,
    token_id: soroban_sdk::Address,
) -> Result

Calculate the recipient amount after fees for a transfer.

fn get_recipient_amount(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
    amount: i128,
) -> i128

Get total liquidity available for a token on remote bridge

fn get_remote_token_liquidity(
    env: soroban_sdk::Env,
    chain_id: u64,
    token_id: soroban_sdk::Address,
) -> Result

Get total deposits of all tokens on remote bridge

fn get_remote_tokens_deposits(
    env: soroban_sdk::Env,
    chain_id: u64,
) -> Result, ContractError>

Get total balances of all tokens on remote bridge

fn get_remote_tokens_balance(
    env: soroban_sdk::Env,
    chain_id: u64,
) -> Result, ContractError>

Initiate a rebalance operation between chains.

fn initiate_rebalance(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token_id: soroban_sdk::Address,
    amount: i128,
) -> Result<(), ContractError>

Bridge assets to an EVM-compatible chain.

fn bridge_to_evm(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    dest_chain_id: u64,
    recipient: soroban_sdk::String,
    token_id: soroban_sdk::Address,
    amount: i128,
    is_rebalance: bool,
) -> Result, ContractError>

Callback function for oracle data processing.

fn on_oracle_data(
    env: soroban_sdk::Env,
    tx_id: soroban_sdk::Val,
    origin_chain_id: u64,
    origin_client: soroban_sdk::String,
    data: soroban_sdk::Vec,
) -> Result, ContractError>

Imports

WebAssembly Text (WAT) ▶