Contract 692890fd7e74d3ac8cfecf65690afe9d403a6b8f89b91a86483c5f714c8df300

← Back to Index 📥 Download WASM

Meta

rssdkver 27.0.5#ea54f95d3f2f49e0487b29fd1a9f469638f09aba
rsver 1.95.0

Instances

  • CAMZXFZCGAQNVEMNV56W4ZTCY3ELUGQROXVXFWGCECUNQ3ZA3AQT3Q2Z

Interface

fn get_order(env: soroban_sdk::Env, order_id: u64) -> Result
fn get_venue(
    env: soroban_sdk::Env,
    venue_id: u32,
) -> Result

Place a TWAP order. Escrows total_in of token_in.

Pricing: pass limit_num/limit_den > 0 for a fixed floor (min token_out per token_in). Pass 0/0 to bound each slice by the SwapBook oracle instead — requires max_slippage_bps in 1..=1000 and a FRESH oracle price for the pair at placement time.

fn place_twap(
    env: soroban_sdk::Env,
    maker: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    total_in: i128,
    end_ledger: u32,
    limit_num: i128,
    limit_den: i128,
    max_slippage_bps: u32,
    max_slice_in: i128,
    min_slice_gap: u32,
    pace_tolerance_bps: u32,
) -> Result

Cancel an active TWAP order — maker only. Refunds the unfilled remainder immediately; proceeds already streamed stay with the maker.

fn cancel_twap(env: soroban_sdk::Env, order_id: u64) -> Result<(), TwapError>

Permissionless cleanup after end_ledger: refund the unfilled remainder to the maker and close the order.

fn expire_twap(env: soroban_sdk::Env, order_id: u64) -> Result<(), TwapError>

Remove a venue. Admin only.

fn remove_venue(env: soroban_sdk::Env, venue_id: u32) -> Result<(), TwapError>

Deploy-time constructor — atomic with deployment, cannot be front-run.

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    fee_vault: soroban_sdk::Address,
    swap_book: soroban_sdk::Address,
)

Execute one slice of a TWAP order. PERMISSIONLESS — the contract enforces pace, price, and cadence; the caller only chooses timing, size (within caps), and the route.

fn execute_slice(
    env: soroban_sdk::Env,
    order_id: u64,
    amount_in: i128,
    segments: soroban_sdk::Vec,
) -> Result

Register a venue adapter (same push-funds interface as the Router's). Admin only.

fn register_venue(
    env: soroban_sdk::Env,
    venue_id: u32,
    contract_address: soroban_sdk::Address,
) -> Result<(), TwapError>
fn get_active_orders(env: soroban_sdk::Env) -> soroban_sdk::Vec

Imports

WebAssembly Text (WAT) ▶