fn accrue(env: soroban_sdk::Env, price: soroban_sdk::Bytes) -> MarketData
fn get_adl(env: soroban_sdk::Env) -> AdlState
Replaces the contract WASM. Storage is kept as is, not migrated.
e - Access to the Soroban environment.new_wasm_hash - The hash of an uploaded WASM blob.operator - The owner.OwnableError::OwnerNotSet - If ownership was renounced.MarketError::UpgradeNotOwner] - If operator is not the owner.operator must be the
owner.fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
fn get_feed(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>
fn get_order(env: soroban_sdk::Env, user: soroban_sdk::Address, id: u32) -> Order
Returns Some(Address) if ownership is set, or None if ownership has
been renounced.
e - Access to the Soroban environment.fn get_owner(env: soroban_sdk::Env) -> Option
fn get_token(env: soroban_sdk::Env) -> soroban_sdk::Address
fn get_vault(env: soroban_sdk::Env) -> soroban_sdk::Address
fn get_config(env: soroban_sdk::Env) -> Config
fn get_oracle(env: soroban_sdk::Env) -> soroban_sdk::Address
fn get_status(env: soroban_sdk::Env) -> u32
fn set_config(env: soroban_sdk::Env, config: Config)
fn set_status(env: soroban_sdk::Env, status: u32)
fn execute_adl(
env: soroban_sdk::Env,
keeper: soroban_sdk::Address,
user: soroban_sdk::Address,
is_long: bool,
amount: i128,
price: soroban_sdk::Bytes,
) -> i128
fn cancel_order(env: soroban_sdk::Env, user: soroban_sdk::Address, id: u32) -> i128
fn claim_credit(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
fn create_order(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
is_long: bool,
kind: u32,
notional: i128,
margin: i128,
trigger_price: i128,
price_bound: i128,
expiration: u32,
) -> u32
fn get_position(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
is_long: bool,
) -> Position
fn get_treasury(env: soroban_sdk::Env) -> soroban_sdk::Address
Initializes the market contract.
MarketData starts zeroed with its accrual timestamp at now. The
status starts Status::Active.
e - Access to the Soroban environment.owner - The contract owner for the admin entries.token - The settlement token.vault - The strategy-vault contract.oracle - The oracle contract.treasury - The protocol fee sink.feed_id - The price stream id. Immutable.config - The initial global market configuration.MarketError::InvalidConfig] - If feed_id is not a V3 stream id
(0x0003 prefix), or a config bound or range check fails.MarketError::NegativeValueNotAllowed] - If a fee, margin,
borrowing, funding, ADL, or PnL field, min_order_margin,
min_deposit, or exec_fee is negative. Any other negative field
fails its own bound as [MarketError::InvalidConfig].owner as the contract owner.fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
token: soroban_sdk::Address,
vault: soroban_sdk::Address,
oracle: soroban_sdk::Address,
treasury: soroban_sdk::Address,
feed_id: soroban_sdk::BytesN<32>,
config: Config,
)
fn execute_order(
env: soroban_sdk::Env,
keeper: soroban_sdk::Address,
user: soroban_sdk::Address,
id: u32,
price: soroban_sdk::Bytes,
) -> i128
fn get_retirement(env: soroban_sdk::Env) -> Option<(i128, u64)>
fn get_market_data(env: soroban_sdk::Env) -> MarketData
fn get_vault_order(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
id: u32,
) -> VaultOrder
Accepts a pending ownership transfer.
e - Access to the Soroban environment.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
there is no pending transfer to accept.["ownership_transfer_completed"][new_owner: Address]fn accept_ownership(env: soroban_sdk::Env)
fn update_adl_state(env: soroban_sdk::Env, price: soroban_sdk::Bytes) -> AdlState
fn get_order_counter(env: soroban_sdk::Env, user: soroban_sdk::Address) -> u32
fn cancel_vault_order(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
id: u32,
) -> i128
fn create_vault_order(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
kind: u32,
amount: i128,
min_out: i128,
) -> u32
Renounces ownership of the contract.
Permanently removes the owner, disabling all functions gated by
#[only_owner].
e - Access to the Soroban environment.OwnableError::TransferInProgress] - If there is a pending ownership
transfer.OwnableError::OwnerNotSet] - If the owner is not set.fn renounce_ownership(env: soroban_sdk::Env)
fn set_terminal_price(env: soroban_sdk::Env, price: i128)
Initiates a 2-step ownership transfer to a new address.
Requires authorization from the current owner. The new owner must later
call accept_ownership() to complete the transfer.
e - Access to the Soroban environment.new_owner - The proposed new owner.live_until_ledger - Ledger number until which the new owner can
accept. A value of 0 cancels any pending transfer.OwnableError::OwnerNotSet] - If the owner is not set.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
trying to cancel a transfer that doesn't exist.crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] -
If the specified ledger is in the past.crate::role_transfer::RoleTransferError::InvalidPendingAccount] -
If the specified pending account is not the same as the provided new
address.fn transfer_ownership(
env: soroban_sdk::Env,
new_owner: soroban_sdk::Address,
live_until_ledger: u32,
)
fn execute_liquidation(
env: soroban_sdk::Env,
keeper: soroban_sdk::Address,
user: soroban_sdk::Address,
is_long: bool,
price: soroban_sdk::Bytes,
) -> i128
fn execute_vault_order(
env: soroban_sdk::Env,
keeper: soroban_sdk::Address,
user: soroban_sdk::Address,
id: u32,
price: soroban_sdk::Bytes,
) -> i128
fn get_claimable_credit(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128