Contract a9861b2c9631d7d5fabe43bf590e5d20b53299f98ecb6afbf9d0fb2ca0c9170a

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
rssdkver 26.0.0#e1bf74ba6c3ddb591593f5eb5dfb85458ff714c1
rsver 1.95.0

Instances

  • CDX6THURLR7KNL5PCJXLPHPI3ZD6NEY6AGNFTMYYDW4A6TQ2X724G3QZ

Interface

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

Admin-only: pause the handler. verify_xlm panics with LocalError::Paused (code 600) while paused; the envelope is NOT marked seen, so a re-submission after unpause will proceed normally.

fn pause(env: soroban_sdk::Env)

View: is the handler currently paused?

fn paused(env: soroban_sdk::Env) -> bool
fn payload(
    env: soroban_sdk::Env,
    event_id: soroban_sdk::BytesN<20>,
) -> Option

Admin-only: lift a pause.

fn unpause(env: soroban_sdk::Env)
fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    new_version: soroban_sdk::String,
)
fn version(env: soroban_sdk::Env) -> soroban_sdk::String
fn blend_pool(env: soroban_sdk::Env) -> soroban_sdk::Address

Quorum-signed entrypoint. Verifies the envelope, decodes a RebalanceAction, and dispatches forward or reverse.

fn verify_xlm(
    env: soroban_sdk::Env,
    envelope_bytes: soroban_sdk::Bytes,
    sig_data: Ed25519SignatureData,
) -> Result<(), HandlerError>

Dashboard-friendly aggregate view. Returns every config + runtime field in one read, eliminating ~18 separate cross-contract calls the dashboard would otherwise need. The shape is stable across upgrades; new fields are appended, never reordered or removed.

fn query_state(env: soroban_sdk::Env) -> HandlerState
fn accept_admin(env: soroban_sdk::Env)
fn blended_pool(env: soroban_sdk::Env) -> soroban_sdk::Address
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    verification_contract: soroban_sdk::Address,
    blended_pool: soroban_sdk::Address,
    blend_pool: soroban_sdk::Address,
    usdc: soroban_sdk::Address,
    xlm: soroban_sdk::Address,
    blnd_treasury: soroban_sdk::Address,
    usdc_reserve_token_id: u32,
    target_ratio_bps: u32,
    rebalance_band_bps: u32,
    min_total_usdc: i128,
    rebalance_cooldown_secs: u64,
    critical_liquid_floor_bps: u32,
)
fn blnd_treasury(env: soroban_sdk::Env) -> soroban_sdk::Address
fn pending_admin(env: soroban_sdk::Env) -> Option
fn propose_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
fn min_total_usdc(env: soroban_sdk::Env) -> i128
fn last_harvest_ts(env: soroban_sdk::Env) -> u64

Admin-only: push amount USDC from the blended pool to Blend out of band. Useful for the initial seeding right after deploy (when no swap events have fired) and for manual top-ups during operator downtime.

Bypasses cooldown, band, min-total, and scope-limit gates because the admin already exercised judgement. Still honours pause and the Blend-health gate (a Supply into a Frozen pool would revert anyway).

fn manual_to_blend(env: soroban_sdk::Env, amount: i128)

Admin-only: drain the entire Blend USDC position back to the pool's liquid balance, bypassing cooldown / band / scope-limit gating.

Operationally this is the off-ramp when Blend's status goes Frozen, when the operator network is paused but funds need to come home, or when migrating to a new handler.

Mechanic:

  1. Blend.submit(Withdraw, USDC, i128::MAX) → handler holds USDC.
  2. Deposit min(redeemed, principal_before) back via deposit_from_delegate; this matches the pool's delegated_out_* counter so the call doesn't underflow.
  3. Donate any excess (accrued interest) to the pool via donate.
  4. Reset principal_supplied = 0.
fn emergency_unwind(env: soroban_sdk::Env)
fn target_ratio_bps(env: soroban_sdk::Env) -> u32
fn last_rebalance_ts(env: soroban_sdk::Env) -> u64

Admin-only: pull amount USDC from Blend back to the blended pool out of band. The dual of manual_to_blend. emergency_unwind is the right tool for a full drain; this exists for partial unwinds where the admin wants tactical control over the amount.

fn manual_from_blend(env: soroban_sdk::Env, amount: i128)

Admin-only: address that receives BLND emissions on every harvest. The handler never holds BLND, so this is a pure routing knob.

fn set_blnd_treasury(env: soroban_sdk::Env, treasury: soroban_sdk::Address)
fn principal_supplied(env: soroban_sdk::Env) -> i128
fn rebalance_band_bps(env: soroban_sdk::Env) -> u32

Admin-only: floor on total pool USDC below which Rebalance is a no-op (does not consume cooldown).

fn set_min_total_usdc(env: soroban_sdk::Env, amount: i128)
fn max_rebalance_amount(env: soroban_sdk::Env) -> i128
fn min_rebalance_amount(env: soroban_sdk::Env) -> i128

Admin-only: tighten or relax the target liquid-USDC share of total USDC. Same range validation as the constructor (strictly within (0, 10000) bps).

fn set_target_ratio_bps(env: soroban_sdk::Env, bps: u32)

Admin-only: view of the current usdc_reserve_token_id (kept here since the constructor takes it but there was no view accessor).

fn usdc_reserve_token_id(env: soroban_sdk::Env) -> u32
fn verification_contract(env: soroban_sdk::Env) -> soroban_sdk::Address

Admin-only: widen or tighten the no-op band around the target. Same range as the constructor (< 10000 bps).

fn set_rebalance_band_bps(env: soroban_sdk::Env, bps: u32)
fn rebalance_cooldown_secs(env: soroban_sdk::Env) -> u64

Admin-only: clamp the per-tx USDC amount moved between pool and Blend. 0 is the "unlimited" sentinel. Emits a ConfigUpdated event so dashboards can react.

fn set_max_rebalance_amount(env: soroban_sdk::Env, amount: i128)

Admin-only: dust floor below which a Rebalance is a silent no-op (does not consume the cooldown window). 0 means "no floor".

fn set_min_rebalance_amount(env: soroban_sdk::Env, amount: i128)
fn critical_liquid_floor_bps(env: soroban_sdk::Env) -> u32

Admin-only: id of the (reserve, b-token) pair the handler claims BLND emissions against on Blend. Derived from reserve_index * 2 + 1 for the USDC reserve. Must be updated if Blend reconfigures the reserve set or the handler is repointed at a new Blend pool.

fn set_usdc_reserve_token_id(env: soroban_sdk::Env, id: u32)

Admin-only: minimum seconds between successful Rebalance actions. 0 disables the cooldown gate entirely.

fn set_rebalance_cooldown_secs(env: soroban_sdk::Env, secs: u64)

Admin-only: critical liquid-USDC ratio (bps) below which execute_rebalance bypasses the cooldown gate and pulls USDC from Blend immediately. 0 disables the bypass entirely (cooldown is the only rate-limit).

Bound: must be strictly less than the normal lower band (target_ratio_bps - rebalance_band_bps). Above that, the bypass would overlap with the normal cooldown-respecting rebalance window, effectively disabling the cooldown gate. An admin typo near 10_000 is the canonical failure this guard prevents. The bypass is only ever useful for ratios genuinely BELOW the lower band, so the bound rejects anything else.

fn set_critical_liquid_floor_bps(env: soroban_sdk::Env, bps: u32)

Imports

WebAssembly Text (WAT) ▶