Contract 98316857f24db59a6604d3f2d188314829821b77d58d240735c2f65bdb86c052

← Back to Index 📥 Download WASM

Meta

cliver 28.1.0#c0f4d0da891bbf214c08b8c5035ae6db80e9a3bd
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.99.0

Instances

  • CBOZIS2FLQXJZH2NC5UKLOFZ4KYGOX2X6Y7OELEKQLKWXCGAJJCCNZLW

Interface

Owner-only: stop future orders. Funds stay escrowed until withdrawn.

fn cancel(env: soroban_sdk::Env, id: u64) -> Result<(), DcaError>

One-time setup. fee_bps is taken once, upfront, at create_strategy time (not per order — cheaper on gas than Elysium's design needed to be, and simpler than Stellar's per-order 0.1% treasury payment).

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    keeper: soroban_sdk::Address,
    treasury: soroban_sdk::Address,
    router: soroban_sdk::Address,
    fee_bps: u32,
) -> Result<(), DcaError>
fn set_keeper(
    env: soroban_sdk::Env,
    new_keeper: soroban_sdk::Address,
) -> Result<(), DcaError>
fn set_fee_bps(env: soroban_sdk::Env, new_fee_bps: u32) -> Result<(), DcaError>
fn get_strategy(env: soroban_sdk::Env, id: u64) -> Option
fn set_treasury(
    env: soroban_sdk::Env,
    new_treasury: soroban_sdk::Address,
) -> Result<(), DcaError>

Only the keeper can call this, and it can only ever do exactly what's baked into this function: swap this strategy's fixed amount_per_order through the router and send the proceeds straight to owner — the contract never custodies the swap output. min_amount_out is computed off-chain by the bot (reference price minus a slippage tolerance) and re-checked here implicitly: the router call reverts if it can't meet it.

fn execute_order(
    env: soroban_sdk::Env,
    id: u64,
    min_amount_out: i128,
) -> Result
fn get_active_ids(env: soroban_sdk::Env) -> soroban_sdk::Vec
fn transfer_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), DcaError>

Creates a strategy and pulls amount_per_order * orders_total worth of sell_asset from owner into the contract's own balance, plus the upfront fee straight to treasury. These are plain transfers out of owner, so no prior approve is needed: the owner's single signature on this call authorizes exactly those two transfers (Soroban auth entries cover the nested token calls).

fn create_strategy(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    sell_asset: soroban_sdk::Address,
    buy_asset: soroban_sdk::Address,
    amount_per_order: i128,
    orders_total: u32,
    interval_seconds: u64,
) -> Result

Owner-only: pull back whatever budget hasn't been swapped yet. No co-signer dance, no account-merge — this is the Soroban equivalent of the Stellar "Withdraw & close" flow.

fn withdraw_remaining(env: soroban_sdk::Env, id: u64) -> Result

Imports

WebAssembly Text (WAT) ▶