Contract 345d9418a57a2526959be1928d379578a1214b4bec90261f029e4eb16f1fbf74

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdkver 26.1.0#175aa41306f383057a8cdfc84b68d931664fc34e
rsver 1.97.1

Instances

  • CAX6V7IDH3QRUFAXOER32EUVHECNJEICZPC6BZO6KK2LKYOL7XSRCPTU

Interface

fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Replace the Factory Wasm. Auth: admin (checked BEFORE the swap).

Added alongside Registry::upgrade (2026-08-01): the Factory permanently holds every owner→strategy mapping and anchors each strategy's deterministic address, so a redeploy loses the index AND breaks predict_address continuity — it must be patchable in place.

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

The owner's deployed slot numbers (sparse, e.g. {0, 5, 42}) in deploy order. Lets the indexer/api recover the true slot for each strategy (paired with strategy_at) and compute the next free slot — never assume dense 0..count.

fn owner_slots(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
) -> soroban_sdk::Vec

The strategy at (owner, index), or None if that slot is free.

fn strategy_at(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    index: u32,
) -> Option

All of the owner's deployed strategies (empty for a not-yet-deployed owner). Iterates the sparse OwnerSlots — never 0..count.

fn strategy_of(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
) -> soroban_sdk::Vec

Accept a proposed admin rotation, step 2 of 2. Auth: the NOMINEE.

fn accept_admin(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    strategy_wasm: soroban_sdk::BytesN<32>,
    registry: soroban_sdk::Address,
)
fn strategy_wasm(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>
fn strategy_count(env: soroban_sdk::Env) -> u32

Rotate the admin, step 1 of 2. Auth: current admin. Nothing changes until the nominee calls accept_admin.

Two-step for the same reason as the Registry, and it matters more here: the Factory admin owns set_strategy_wasm, which decides the CODE every future strategy deploys with. Losing it means the template can never be updated again — and require_admin gates upgrade too, so there is no path back. The nominee signing step 2 proves the key can sign before it takes effect.

fn transfer_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Deploy the owner's Strategy at index and fund a deposit intent in one signed tx — the first-deposit path for a selection too large to invest atomically. Auth: owner (whole tree).

fn deploy_and_fund(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    index: u32,
    auto_rebalance: bool,
    asset: soroban_sdk::Address,
    total: i128,
    swap: MaybeSwap,
    target: soroban_sdk::Address,
    plan: soroban_sdk::Vec,
    deadline: u64,
) -> Result

Deploy the owner's Strategy at slot index, at its deterministic address. Auth: owner. One per (owner, index) (AlreadyDeployed otherwise); refuses past OWNER_SLOT_CAP slots per owner (TooManyStrategies).

auto_rebalance is the strategy's IMMUTABLE lifetime choice (doc 13): a strategy is born keeper-managed or manual, and pays fee_bps + delta or fee_bps accordingly, until it is closed. There is no setter afterwards.

fn deploy_strategy(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    index: u32,
    auto_rebalance: bool,
) -> Result

Deterministic Strategy address for (owner, index) (computable pre-deploy).

fn predict_address(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    index: u32,
) -> soroban_sdk::Address

Deploy the owner's Strategy at index and run the first invest in one signed tx (the default first-investment path). Auth: owner (whole tree).

fn deploy_and_invest(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    index: u32,
    auto_rebalance: bool,
    asset: soroban_sdk::Address,
    total: i128,
    allocations: soroban_sdk::Vec,
    swaps: soroban_sdk::Map,
) -> Result

Set the template Wasm hash used by FUTURE deploys. Auth: admin.

fn set_strategy_wasm(env: soroban_sdk::Env, new_wasm: soroban_sdk::BytesN<32>)
fn strategy_by_index(env: soroban_sdk::Env, index: u32) -> Option

How many slots the owner has deployed (a count, not a max index).

fn strategy_count_of(env: soroban_sdk::Env, owner: soroban_sdk::Address) -> u32

Upgrade many Strategies in ONE admin-signed envelope. Auth: admin.

Why this exists. Every Strategy is constructed with the Factory's admin as its own admin (see deploy_strategy), and Strategy::upgrade is gated on that address. Soroban permits one InvokeHostFunction per transaction, so rolling a new template across the fleet was one full 2-of-3 ceremony PER INSTANCE — and the instance count only grows. The admin's single root authorization covers the sub-invocations, collapsing a batch into one envelope. Same shape deploy_and_invest already uses to reach into a freshly deployed Strategy under one owner-signed tree.

The Factory does NOT need to be each Strategy's admin: the auth that satisfies Strategy::upgrade is the admin's, carried down the tree from this call. The Factory only supplies the invocation.

Addresses are taken as an argument rather than read from the Factory's own index on purpose — the caller decides the batch, so a partially-completed roll is resumed by passing the remainde

fn upgrade_strategies(
    env: soroban_sdk::Env,
    strategies: soroban_sdk::Vec,
    new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶