Contract 1cabf623f629c1687fb075706c1fa92a586fc04fdf9ee5b2297b00799d0100b1

← Back to Index 📥 Download WASM

Meta

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

Instances

  • CBC55AHWRJYDN2DYEGRIJECVTDCWC2GTRXNWYKJPLJKCVL7F2G26LUMK

Interface

fn debt(env: soroban_sdk::Env, position: u64) -> i128

The address holding the venue's admin role.

fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
fn owner(env: soroban_sdk::Env) -> soroban_sdk::Address
fn repay(
    env: soroban_sdk::Env,
    position: u64,
    amount: i128,
    refund_to: soroban_sdk::Address,
) -> i128

The bound configuration.

fn config(env: soroban_sdk::Env) -> Config
fn health(env: soroban_sdk::Env, position: u64) -> Wad
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn snapshot(env: soroban_sdk::Env, position: u64) -> VenueSnapshot

Transfer the admin role to new_admin (current admin only). Deployment hands the role to the governance timelock once the venue is wired, which is what puts set_aggregator, set_flash_receiver, set_account_wasm and both upgrades behind the Sensitive delay — governance classifies any unlisted method as Sensitive, so no per-setter code is needed here. Without this the venue would be stuck on its deployer key for good: no handover, and no rotation if it leaks.

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

The configured swap aggregator, if any.

fn aggregator(env: soroban_sdk::Env) -> Option
fn collateral(env: soroban_sdk::Env, position: u64) -> i128
fn get_version(env: soroban_sdk::Env) -> u32

Bind this venue to one Blend pool. owner is the broker (lock-borrow); every mutating entrypoint requires its auth. admin (deployer / gov) binds the swap aggregator and wires the flash receiver. account_wasm is the installed blend-borrow-account code new positions are deployed from.

fn __constructor(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    admin: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    account_wasm: soroban_sdk::BytesN<32>,
)
fn open_position(
    env: soroban_sdk::Env,
    collateral_asset: soroban_sdk::Address,
    debt_asset: soroban_sdk::Address,
) -> u64

The blend-borrow-account a handle maps to (also its collateral custodian).

fn subaccount_of(env: soroban_sdk::Env, position: u64) -> soroban_sdk::Address

The wired flash receiver, if any.

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

Leveraged open through Blend's flash: flash-borrow borrow_amount, have the receiver sell the stake for collateral through the swap aggregator along swap_xdr and forward the borrowed IRS margin to margin_to, then supply — the flash is left standing as the debt.

The whole flash dance lives here rather than in the broker: the venue owns its receiver and its aggregator, so the broker stays venue-agnostic and only carries the route through.

fn open_leveraged(
    env: soroban_sdk::Env,
    position: u64,
    borrow_amount: i128,
    irs_margin_amount: i128,
    margin_to: soroban_sdk::Address,
    equity_asset: soroban_sdk::Address,
    equity_amount: i128,
    min_collateral_out: i128,
    swap_xdr: soroban_sdk::Bytes,
    min_health: Wad,
) -> VenueSnapshot

Set the swap aggregator a leveraged open sells borrowed debt through (admin-gated).

One address for the whole venue, not one per asset pair: routing is the aggregator's job, and it takes the route with the call. What stays admin-gated is which contract is trusted to receive the stake — the route only chooses a path through it.

fn set_aggregator(env: soroban_sdk::Env, aggregator: soroban_sdk::Address)

Set the blend-borrow-account wasm hash future positions deploy from (admin-gated, like the other config setters). Existing subaccounts are upgraded separately via [Self::upgrade_subaccount].

fn set_account_wasm(env: soroban_sdk::Env, account_wasm: soroban_sdk::BytesN<32>)
fn upgrade_position(
    env: soroban_sdk::Env,
    position: u64,
    new_wasm_hash: soroban_sdk::BytesN<32>,
)
fn supply_and_borrow(
    env: soroban_sdk::Env,
    position: u64,
    collateral_amount: i128,
    borrow_amount: i128,
    to: soroban_sdk::Address,
    min_health: Wad,
) -> VenueSnapshot

Blend has a flash loan, which is what leverage here is built on — so, yes.

fn supports_leverage(env: soroban_sdk::Env) -> bool
fn position_custodian(env: soroban_sdk::Env, position: u64) -> soroban_sdk::Address

Wire the blend-flash-receiver this venue primes for leveraged opens (admin-gated). Set after construction because the receiver is deployed owned by this venue, so its address cannot be a constructor argument without a deployment cycle.

fn set_flash_receiver(env: soroban_sdk::Env, receiver: soroban_sdk::Address)
fn withdraw_collateral(
    env: soroban_sdk::Env,
    position: u64,
    amount: i128,
    to: soroban_sdk::Address,
) -> i128

Upgrade the venue-owned flash receiver through its only reachable authorization path.

The receiver requires this venue's contract address to authorize upgrade, while this relay is gated by the venue's admin (governance in production). Existing receivers need no migration because their stored owner is already this venue.

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

Imports

WebAssembly Text (WAT) ▶