Contract 50a4e415a7f2e851604db17e33bae36f6b8165471754c6aeb3778ea9ebe44dd4

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.94.1

Instances

  • CCHRZE2K5TCERZLDO5IXDUWUKLRPVE72DI3TDF2RP6EQKEW6BNOMQRMU

Interface

fn admin(env: soroban_sdk::Env) -> Result
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 upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), OracleError>
fn version(env: soroban_sdk::Env) -> u32
fn add_asset(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
) -> Result<(), OracleError>

Get current admin address

fn get_admin(env: soroban_sdk::Env) -> Result
fn is_paused(env: soroban_sdk::Env) -> bool
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    reflector_contract: soroban_sdk::Address,
    base_currency_address: soroban_sdk::Address,
    native_xlm_address: soroban_sdk::Address,
) -> Result<(), OracleError>

Accept admin role (two-step transfer, step 2). Only the pending admin can call this to finalize the transfer.

Arguments

  • caller - Pending admin address (must be authorized)

Errors

  • InvalidCalculation - No pending admin proposal or caller is not the pending admin
fn accept_admin(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), OracleError>
fn remove_asset(env: soroban_sdk::Env, asset: Asset) -> Result<(), OracleError>

Propose a new admin address (two-step transfer, step 1). Only the current admin can propose a new admin. The proposed admin must call accept_admin to complete the transfer.

Arguments

  • caller - Current admin address (must be authorized)
  • pending_admin - Proposed new admin address

Errors

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

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

Returns a public mirror of the stored price, or None if no price has been recorded yet for this asset.

fn get_last_price(env: soroban_sdk::Env, asset: Asset) -> Option

Force-refresh cached prices for specific assets. Clears cached price data and fetches fresh prices from external sources. Use this before budget-sensitive operations (liquidation, swap_collateral) to ensure the cache is warm and subsequent calls hit the cache.

fn refresh_prices(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    assets: soroban_sdk::Vec,
) -> Result, OracleError>
fn get_asset_price(env: soroban_sdk::Env, asset: Asset) -> Result
fn get_asset_config(env: soroban_sdk::Env, asset: Asset) -> Option

Configure a batch-capable oracle adapter for direct queries. The adapter must implement: read_price_data_for_feed(String) and read_price_data(Vec<String>) returning {price: U256, package_timestamp: u64, write_timestamp: u64}.

fn set_batch_oracle(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
    adapter: Option,
    feed_id: Option,
    decimals: Option,
    max_age_seconds: Option,
) -> Result<(), OracleError>

Get custom oracle address for a specific asset

fn get_custom_oracle(
    env: soroban_sdk::Env,
    asset: Asset,
) -> Option
fn get_oracle_config(env: soroban_sdk::Env) -> Result

Get the pending admin address, if any.

Returns

  • Ok(Address) - Pending admin address
  • Err(InvalidCalculation) - No pending admin proposal exists
fn get_pending_admin(
    env: soroban_sdk::Env,
) -> Result
fn set_asset_enabled(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
    enabled: bool,
) -> Result<(), OracleError>

Set a custom oracle for an asset. The oracle must implement:

  • lastprice(asset: Asset) -> Option<PriceData>
  • decimals() -> u32 (decimals param, when provided, must match live value)
fn set_custom_oracle(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
    oracle: Option,
    max_age_seconds: Option,
    decimals: Option,
) -> Result<(), OracleError>
fn set_oracle_config(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    config: OracleConfig,
) -> Result<(), OracleError>
fn add_asset_as_admin(env: soroban_sdk::Env, asset: Asset) -> Result<(), OracleError>
fn set_fallback_oracle(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    fallback_contract: Option,
) -> Result<(), OracleError>

Sets a manual price override for emergency situations. Requires an expiry timestamp to prevent permanent mispricing.

Arguments

  • caller - Admin address (must be authorized)
  • asset - Asset to override price for
  • price - Override price (None to remove override)
  • expiry_timestamp - Expiry timestamp in seconds (None to remove override, required when setting price)
fn set_manual_override(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset: Asset,
    price: Option,
    expiry_timestamp: Option,
) -> Result<(), OracleError>

Set the TTL (in seconds) for the price cache. 0 = disabled.

fn set_price_cache_ttl(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    ttl: u64,
) -> Result<(), OracleError>
fn add_asset_by_address(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    asset_address: soroban_sdk::Address,
) -> Result<(), OracleError>
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>

Cancel a pending admin proposal. Only the current admin can cancel a pending proposal.

Arguments

  • caller - Current admin address (must be authorized)

Errors

  • Unauthorized - Caller is not current admin
  • InvalidCalculation - No pending admin proposal exists
fn cancel_admin_proposal(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
) -> Result<(), OracleError>
fn remove_asset_as_admin(
    env: soroban_sdk::Env,
    asset: Asset,
) -> Result<(), OracleError>

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>
fn get_reflector_contract(env: soroban_sdk::Env) -> Option
fn get_whitelisted_assets(env: soroban_sdk::Env) -> soroban_sdk::Vec
fn update_reflector_contract(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_contract: soroban_sdk::Address,
) -> Result<(), OracleError>
fn get_asset_prices_vec_fresh(
    env: soroban_sdk::Env,
    assets: soroban_sdk::Vec,
) -> 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>
fn set_asset_enabled_as_admin(
    env: soroban_sdk::Env,
    asset: Asset,
    enabled: bool,
) -> Result<(), OracleError>
fn set_manual_override_as_admin(
    env: soroban_sdk::Env,
    asset: Asset,
    price: Option,
    expiry_timestamp: Option,
) -> Result<(), OracleError>

Imports

WebAssembly Text (WAT) ▶