Contract 6c23f6ffb33a207b54043a9b255313be228702dea4b82a76b57d292272f335cf

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.90.0

Instances

  • CCKOF5MFSFK3FA6UIRPJHSALWNBBRIJAJ7K2QL6P3TZWNXO2N2RL3EJO

Interface

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    reflector_contract: soroban_sdk::Address,
    base_currency_address: soroban_sdk::Address,
) -> Result<(), OracleError>
fn add_asset(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
) -> Result<(), OracleError>
fn remove_asset(env: soroban_sdk::Env, asset: Asset) -> Result<(), OracleError>

TODO: Remove manual override functionality when production oracle is stable

fn set_manual_override(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
    price: Option,
) -> Result<(), OracleError>
fn add_asset_by_address(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset_address: soroban_sdk::Address,
) -> Result<(), OracleError>

TODO: Remove manual price setting when production oracle is stable

fn set_asset_price(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset_address: soroban_sdk::Address,
    price: u128,
) -> Result<(), OracleError>
fn set_asset_enabled(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
    enabled: bool,
) -> Result<(), OracleError>
fn update_reflector_contract(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_contract: soroban_sdk::Address,
) -> Result<(), OracleError>
fn set_fallback_oracle(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    fallback_contract: Option,
) -> Result<(), OracleError>
fn pause(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), OracleError>
fn unpause(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), OracleError>
fn is_paused(env: soroban_sdk::Env) -> bool
fn get_asset_price(env: soroban_sdk::Env, asset: Asset) -> Result
fn get_asset_price_data(
    env: soroban_sdk::Env,
    asset: Asset,
) -> Result
fn get_asset_prices_vec(
    env: soroban_sdk::Env,
    assets: soroban_sdk::Vec,
) -> Result, OracleError>
fn get_asset_prices(
    env: soroban_sdk::Env,
    assets: soroban_sdk::Vec,
) -> Result, OracleError>
fn get_twap(
    env: soroban_sdk::Env,
    asset: Asset,
    periods: u32,
) -> Result
fn get_oracle_config(env: soroban_sdk::Env) -> Result
fn set_oracle_config(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    config: OracleConfig,
) -> Result<(), OracleError>

Check price deviation between spot and TWAP prices Returns deviation in basis points (e.g., 500 = 5%)

fn check_price_deviation(
    env: soroban_sdk::Env,
    asset: Asset,
    periods: u32,
) -> Result
fn calculate_collateral_value(
    env: soroban_sdk::Env,
    collateral_asset: Asset,
    collateral_amount: u128,
    base_asset: Asset,
) -> Result
fn calculate_ltv(
    env: soroban_sdk::Env,
    collateral_asset: Asset,
    collateral_amount: u128,
    debt_asset: Asset,
    debt_amount: u128,
) -> Result
fn is_liquidatable(
    env: soroban_sdk::Env,
    collateral_asset: Asset,
    collateral_amount: u128,
    debt_asset: Asset,
    debt_amount: u128,
    liquidation_threshold: u32,
) -> Result
fn check_liquidation(
    env: soroban_sdk::Env,
    collateral_asset: Asset,
    collateral_amount: u128,
    debt_asset: Asset,
    debt_amount: u128,
    liquidation_threshold: u32,
) -> Result
fn get_base_currency(env: soroban_sdk::Env) -> Asset
fn set_base_currency(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    base_currency: Asset,
) -> Result<(), OracleError>
fn get_asset_value_in_base(
    env: soroban_sdk::Env,
    asset: Asset,
    amount: u128,
) -> Result
fn get_asset_price_in_asset(
    env: soroban_sdk::Env,
    base_asset: Asset,
    quote_asset: Asset,
) -> Result
fn get_whitelisted_assets(env: soroban_sdk::Env) -> soroban_sdk::Vec
fn get_asset_config(env: soroban_sdk::Env, asset: Asset) -> Option
fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
fn set_admin(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_admin: soroban_sdk::Address,
) -> Result<(), OracleError>
fn get_reflector_contract(env: soroban_sdk::Env) -> Option

Reset circuit breaker for a specific asset (admin only).

Clears the stored last known price, allowing the next price query to bypass the circuit breaker check. Use this when legitimate large price movements occur (e.g., major market events, token migrations, or oracle upgrades).

fn reset_circuit_breaker(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
) -> Result<(), OracleError>

Reset circuit breaker for all assets (admin only).

Emergency function to clear all stored last known prices. Use sparingly and only when necessary, as it temporarily disables circuit breaker protection for all assets until new prices are queried.

fn reset_all_circuit_breakers(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), OracleError>

Get last known price for an asset (for debugging and monitoring).

Returns the stored price used for circuit breaker validation, or None if no price has been recorded yet for this asset.

fn get_last_price(env: soroban_sdk::Env, asset: Asset) -> Option
fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), OracleError>
fn version(env: soroban_sdk::Env) -> u32

Get current admin address

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

Transfer admin to a new address (current admin only)

This allows assigning a multisig as admin for enhanced security.

Arguments

  • caller - Current admin address (must be authorized)
  • new_admin - New admin address (can be a multisig contract)

Errors

  • Unauthorized - Caller is not current admin
fn transfer_admin(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_admin: soroban_sdk::Address,
) -> Result<(), OracleError>

Imports

WebAssembly Text (WAT) ▶