Contract 033072f62a2f22fd8a94c78190ec74117df00b4d83845c2df2503c821d8020ee

← Back to Index 📥 Download WASM

Meta

cliver 23.2.0#8c559e832fd969aa469784b66e70891fadf94f0a
rssdkver 23.1.0#7456be9d91fe1f4cb070fc2732bac78244ce6c3f
rsver 1.94.0

Instances

  • CCSF5GUAK42Q3CV7LNZ6CQ4CNBH7RROLQMXW4CJXEETHGBBZCYNHJ32J

Interface

fn pause(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn unpause(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn has_role(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
) -> Option
fn get_admin(env: soroban_sdk::Env) -> Option
fn is_paused(env: soroban_sdk::Env) -> bool

Whitelist a forwarding target. the target only becomes eligible for forward_funds once the target activation timelock has elapsed (see TargetConfig::eligible_at), so a compromised manager cannot register a custody address and drain to it in the same block. Removal/deactivation stay instant — the fail-safe direction.

fn add_target(
    env: soroban_sdk::Env,
    target_contract: soroban_sdk::Address,
    target_custody: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn get_target(
    env: soroban_sdk::Env,
    target_contract: soroban_sdk::Address,
) -> Option
fn grant_role(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
)

the seed vault is validated against the vault's live config (see the registry seeding below), so config.vault must already be an initialized SToken naming this proxy as its asset_manager. Deploy order: deploy proxy → initialize vault (with the proxy address) → initialize proxy.

fn initialize(
    env: soroban_sdk::Env,
    config: ProxyInitConfig,
    limits: ProxyInitLimits,
) -> Result<(), ProxyAssetManagerError>
fn force_pause(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn revoke_role(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
)

Current address holding the upgrader role (if any).

fn get_upgrader(env: soroban_sdk::Env) -> Option

Return funds from proxy custody to a registered stoken vault. Allowed even when paused (returning liquidity is always beneficial).

the destination vault is caller-supplied and must be present in the registry. This lets the (trusted) processor return liquidity to the correct creditor among swap-sibling vaults sharing this proxy, rather than being hardwired to a single construction-time vault. The proxy holds no per-vault accounting, so routing the correct amount to the correct vault remains a processor responsibility; the vault side still guards its own balance (InsufficientBalance) against over-crediting.

fn return_funds(
    env: soroban_sdk::Env,
    amount: u64,
    vault: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn accept_limits(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn cancel_limits(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn force_unpause(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Forward funds from proxy custody to a whitelisted target's custody. Callable by manager or processor with respective limit enforcement.

fn forward_funds(
    env: soroban_sdk::Env,
    target_contract: soroban_sdk::Address,
    amount: u64,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn remove_target(
    env: soroban_sdk::Env,
    target_contract: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn renounce_role(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
)
fn accept_manager(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Apply the pending WASM upgrade after the upgrade timelock expires.

Applies exactly the hash recorded by propose_upgrade; the caller cannot substitute a different hash here.

fn accept_upgrade(
    env: soroban_sdk::Env,
    operator: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerUpgradeError>
fn cancel_manager(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Cancel a pending WASM upgrade before it is applied.

fn cancel_upgrade(
    env: soroban_sdk::Env,
    operator: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerUpgradeError>
fn get_role_admin(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
) -> Option
fn propose_limits(
    env: soroban_sdk::Env,
    new_processor_daily_limit: Option,
    new_processor_max_per_tx: Option,
    new_manager_daily_limit: Option,
    new_manager_max_per_tx: Option,
    new_processor_cooldown: Option,
    new_emergency_cooldown: Option,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Admit a vault to the registry so the proxy may return liquidity to it.

swap_tokens forces swap-sibling vaults to share one asset_manager address. When that shared manager is this proxy, it must be able to return funds to either sibling — not just the vault bound at construction — otherwise a sibling's deployed capital is permanently stranded. Registration is validated so the entry is actually usable:

  • the vault must use this proxy's underlying_asset (the proxy custodies a single token; routing any other token would silently misfire), and
  • the vault must already name this proxy as its asset_manager (otherwise SToken::return_funds rejects the proxy as Unauthorized, making the registry entry inert).

Unlike add_target (timelocked since), registration takes effect immediately: admitting a wrong vault cannot extract funds — return_funds/emergency_sweep only ever credit a vault, and the vault-side authorization check fails closed.

fn register_vault(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn renounce_admin(env: soroban_sdk::Env)
fn set_role_admin(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    admin_role: soroban_sdk::Symbol,
)

Accept a pending upgrader change after the cooldown (admin-gated).

fn accept_upgrader(env: soroban_sdk::Env) -> Result<(), ProxyAssetManagerError>

Re-enable a deactivated target. reactivation restarts the eligibility timelock — every transition into a forwardable state must carry the same monitoring window as a fresh registration, otherwise a dormant entry would be an instant drain destination.

fn activate_target(
    env: soroban_sdk::Env,
    target_contract: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Emergency sweep tokens from a paused proxy to a registered vault, crediting the vault's total_idle via stoken.return_funds. Requires proxy to be paused and emergency cooldown period elapsed. If amount is 0, sweeps the entire balance.

the destination vault is caller-supplied and must be registered. Because the proxy commingles the liquidity of every vault it serves, this is a break-glass path: a full sweep (amount == 0) sends the entire pooled balance to the single supplied vault, so when the proxy serves multiple vaults the manager must sweep per-vault amounts and reconcile the remainder off-chain rather than dumping everything to one creditor.

fn emergency_sweep(
    env: soroban_sdk::Env,
    amount: u64,
    vault: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn get_role_member(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    index: u32,
) -> soroban_sdk::Address
fn is_force_paused(env: soroban_sdk::Env) -> bool
fn propose_manager(
    env: soroban_sdk::Env,
    new_manager: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Propose a WASM upgrade. Starts the fixed upgrade timelock ([UPGRADE_COOLDOWN_SECS]) before the new code can be applied.

WASM replacement is the most powerful operation in the proxy, so it is split into a timelocked propose/accept flow. The proposed hash is recorded and bound: accept_upgrade applies exactly this hash, so the timelock cannot be bypassed by proposing a benign hash and later applying a different one.

fn propose_upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerUpgradeError>
fn accept_processor(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn cancel_processor(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Remove a vault from the registry (manager-gated). After removal the proxy can no longer route return_funds/emergency_sweep to that vault.

fn deregister_vault(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>

Propose a new upgrader (admin-gated). Starts the cooldown timelock. The upgrader controls WASM replacement, so rotation is restricted to the admin (the role-admin of upgrader), never the operational manager.

fn propose_upgrader(
    env: soroban_sdk::Env,
    new_upgrader: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn deactivate_target(
    env: soroban_sdk::Env,
    target_contract: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn propose_processor(
    env: soroban_sdk::Env,
    new_processor: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), ProxyAssetManagerError>
fn get_manager_limits(env: soroban_sdk::Env) -> (u64, u64)

Pending WASM upgrade awaiting the upgrade timelock (if any).

fn get_pending_upgrade(env: soroban_sdk::Env) -> Option

Whether vault is registered as a return-funds destination.

fn is_vault_registered(env: soroban_sdk::Env, vault: soroban_sdk::Address) -> bool
fn transfer_admin_role(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
    live_until_ledger: u32,
)

Pending upgrader change awaiting cooldown (if any).

fn get_pending_upgrader(env: soroban_sdk::Env) -> Option
fn get_processor_limits(env: soroban_sdk::Env) -> (u64, u64, u64)
fn get_underlying_asset(env: soroban_sdk::Env) -> soroban_sdk::Address
fn accept_admin_transfer(env: soroban_sdk::Env)
fn get_role_member_count(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32

delay before an added/reactivated target may receive forward_funds.

fn get_target_change_cooldown(env: soroban_sdk::Env) -> u64

Imports

WebAssembly Text (WAT) ▶