Pull asset, convert ALL of it into target in at most ONE swap, and
record the measured proceeds as a pending per-vault deposit plan. Deposits
nothing. Auth: owner.
The overflow path for deposits too large to fit one transaction: the user's cost is a single signature regardless of how many vaults they picked.
fn fund(
env: soroban_sdk::Env,
asset: soroban_sdk::Address,
total: i128,
swap: MaybeSwap,
target: soroban_sdk::Address,
plan: soroban_sdk::Vec,
deadline: u64,
) -> Result<(), soroban_sdk::Error>
fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
The NEXT step-wise rebalance op nonce.
Read by anything that assembles a rebalance op — the relay's manual flow and
the keeper's executor both need the LIVE value, not a mirrored one. Without
this view they would have to trust the indexer's strategies.nonce, and a
mirror that lags by one op makes every subsequent op fail BadNonce.
fn nonce(env: soroban_sdk::Env) -> u64
fn owner(env: soroban_sdk::Env) -> soroban_sdk::Address
Pause invest/rebalance (withdraw stays open). Auth: admin.
fn pause(env: soroban_sdk::Env)
The pending deposit intent, or None.
fn intent(env: soroban_sdk::Env) -> Option
Pull asset, deposit across allocations by weight, record positions —
atomically. Auth: owner.
swaps maps each vault UNDERLYING that differs from asset to the single
swap leg used to reach it: one router call per distinct underlying, not
per allocation. That is a hard budget constraint, not a preference — the
fourth router call in a transaction exceeds the memory limit regardless of
leg count (see invest.rs).
fn invest(
env: soroban_sdk::Env,
asset: soroban_sdk::Address,
total: i128,
allocations: soroban_sdk::Vec,
swaps: soroban_sdk::Map,
) -> Result<(), soroban_sdk::Error>
Emergency: pull a vault's funds to the Owner if its protocol bricks
redeem. Auth: admin. No fee; callable even when Paused.
fn rescue(
env: soroban_sdk::Env,
vault: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Lift the pause. Auth: admin.
fn unpause(env: soroban_sdk::Env)
Replace the contract Wasm. Auth: admin (checked BEFORE the swap).
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Withdraw amount (underlying; i128::MAX = whole position) from one vault
back to the owner. Auth: owner. Allowed even when Paused. Both WithdrawOut
variants are handled live (see withdraw.rs::deliver); a cross-asset
Normalize reverts AdapterError while the Router is unset (dormant), not
by shape.
fn withdraw(
env: soroban_sdk::Env,
vault: soroban_sdk::Address,
amount: i128,
out: WithdrawOut,
) -> Result<(), soroban_sdk::Error>
fn is_paused(env: soroban_sdk::Env) -> bool
Ledger state + raw shares_held per open vault. Display value is computed
off-chain (no on-chain value read).
fn positions(env: soroban_sdk::Env) -> soroban_sdk::Vec
Deposit the pending intent's leg for vault and remove that leg.
Auth: permissionless before Intent.deadline (the caller pays their own
fee and chooses nothing); owner-only afterwards. Idempotent — a filled leg
is gone, so a replay answers IntentLegNotFound.
fn fill_intent(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
intent_id: u64,
vault: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Accept a proposed admin rotation (step 2 of 2). Auth: the nominee.
fn accept_admin(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
Withdraw every position in full + drain caller-named idle assets. Skips a vault whose redeem reverts (exit-liveness). Auth: owner.
fn withdraw_all(
env: soroban_sdk::Env,
out: WithdrawOut,
extra_idle: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>
Deploy-time init (Protocol-22 __constructor, atomic with deploy). Writes
Owner/Admin/Registry/Paused + the IMMUTABLE auto_rebalance choice;
Nonce/IntentSeq follow the read-default rule.
auto_rebalance is set here and never again. It does two jobs: it gates the
keeper (keeper.rs::authorize) and it selects the fee rate (fee_bps for a
manual strategy, fee_bps + delta for an auto one). Making it immutable is
what removes the rate-change settle and banked_fee entirely (doc 13).
fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
admin: soroban_sdk::Address,
registry: soroban_sdk::Address,
auto_rebalance: bool,
)
Drop the pending intent; the funds stay as idle balance. Auth: owner.
fn cancel_intent(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
The IMMUTABLE create-time auto-rebalance choice. Never changes.
fn auto_rebalance(env: soroban_sdk::Env) -> bool
Drop the bookkeeping row for a vault holding ZERO shares. Auth: owner.
Refuses (PositionNotEmpty) while any share remains, and propagates a
trapping balance read rather than treating it as empty.
fn close_position(
env: soroban_sdk::Env,
vault: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Convert idle asset_in → asset_out via the whitelisted router (measured
output ≥ amount_out_min). Auth: owner or keeper. Nonce-guarded.
fn rebalance_swap(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
nonce: u64,
asset_in: soroban_sdk::Address,
asset_out: soroban_sdk::Address,
amount_in: i128,
swap: SwapLeg,
) -> Result<(), soroban_sdk::Error>
Propose an admin rotation (step 1 of 2). Auth: current admin. Takes effect
only once the nominee calls accept_admin.
fn transfer_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Emit a RebalanceNoOp receipt (target breached, no feasible move). Auth:
owner or keeper. No state change; consumes no nonce.
fn note_no_rebalance(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
reason: soroban_sdk::Symbol,
observed_bps: u32,
target_bps: u32,
) -> Result<(), soroban_sdk::Error>
Deposit idle asset into a whitelisted active vault (debt-free). Auth:
owner or keeper. Nonce-guarded.
fn rebalance_deposit(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
nonce: u64,
vault: soroban_sdk::Address,
asset: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>
Redeem from a vault → fee → keep proceeds idle. Auth: owner or Registry keeper (gated by the immutable AutoRebalance + keeper_enabled). Nonce-guarded.
fn rebalance_withdraw(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
nonce: u64,
vault: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>