Contract e40426841d1343e5914c4eb0b5ec6697fca0dce2a47c0104062cad169368b8c4

← Back to Index 📥 Download WASM

Meta

rssdkver 25.0.2#59a2e01a26f9330f8d516690911cb2ca87a6f1b3
rsver 1.89.0

Interface

Initialize the pool contract

Arguments

  • admin - Address authorized to trigger settlements
  • seller - Address that receives settlement payouts
  • fee_percent - Fee percentage in basis points (200 = 2%)
  • usdc_token - USDC token contract address
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    seller: soroban_sdk::Address,
    fee_percent: u32,
    usdc_token: soroban_sdk::Address,
)

Set Blend pool addresses (admin only)

fn set_blend_pools(
    env: soroban_sdk::Env,
    blend_pool_usdc: soroban_sdk::Address,
    blend_pool_xlm: soroban_sdk::Address,
)

Deposit funds for an order (buyer calls directly) Transfers tokens from buyer to contract and tracks deposit

fn deposit(
    env: soroban_sdk::Env,
    buyer: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
    order_id: u64,
)

Withdraw collateral from Blend pool back to contract (admin only) Uses Blend SDK request_type 3 (WithdrawCollateral)

Arguments

  • amount_usdc - Amount of Blend USDC to withdraw (stroops). Use i128::MAX for all.
  • amount_xlm - Amount of XLM to withdraw (stroops). Use i128::MAX for all.
fn withdraw_from_blend(env: soroban_sdk::Env, amount_usdc: i128, amount_xlm: i128)

Settle deposits to seller — only the product price is withdrawn. Fees (1% buyer + 1% seller = FeePercent) and all accrued yield stay in the Blend pool, compounding until withdrawn via withdraw_yield.

Formula: seller_payout = total_deposits × (10000 - half_fee) / (10000 + half_fee) where half_fee = FeePercent / 2 (each side's share)

Example (FeePercent=200, deposit=$10.10): seller = 10.10 × 9900 / 10100 = $9.90 $0.20 (2% of product price) stays in Blend + yield

fn settle(env: soroban_sdk::Env) -> (i128, i128)

Get current pool status Returns (total_deposits_usdc, total_deposits_xlm, supplied_to_blend)

fn get_status(env: soroban_sdk::Env) -> (i128, i128, bool)

Get yield information: deposited totals vs what Blend holds Returns (deposited_usdc, deposited_xlm) Compare with /blend-position Real Value for actual yield earned

fn get_yield_info(env: soroban_sdk::Env) -> (i128, i128)

Withdraw accumulated platform yield from Blend (admin only) Extracts all remaining Blend collateral (fees + accrued interest) and transfers to the specified recipient.

This should only be called after settle() has paid the seller, so the remaining Blend position is pure platform revenue.

fn withdraw_yield(
    env: soroban_sdk::Env,
    recipient: soroban_sdk::Address,
) -> (i128, i128)

Update seller address (admin only)

fn set_seller(env: soroban_sdk::Env, new_seller: soroban_sdk::Address)

Update fee percentage (admin only)

fn set_fee_percent(env: soroban_sdk::Env, new_fee_percent: u32)

Update Blend USDC token address (admin only) This is the USDC variant that gets supplied to the Blend pool

fn set_blend_usdc_token(
    env: soroban_sdk::Env,
    new_blend_usdc_token: soroban_sdk::Address,
)

Claim BLND emissions from the Blend pool (admin only)

Calls the Blend pool's claim function to collect accrued BLND emissions for this contract's supply/collateral positions.

Arguments

  • reserve_token_ids - Vec of emission indices to claim (e.g., 6 = USDC supply emissions. Formula: reserve_index * 2 for supply)
fn claim_emissions(
    env: soroban_sdk::Env,
    reserve_token_ids: soroban_sdk::Vec,
) -> i128

Upgrade contract WASM (admin only)

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

Imports

WebAssembly Text (WAT) ▶