Contract 522f7d3da5a8e67012f4d8117892b215258fb29067d1b004d60a7506e5d3427e

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CCLT42BFIS6FX6V7KYDJV7Y4G2JAY7KKA65NABN7FBXNEQBJHW4PQTZJ

Interface

Return the current admin address.

Errors

  • [OracleError::NotInitialized] if the contract has not been set up.
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Return the [PRICE_PRECISION]-scaled price of asset.

Arguments

  • asset – The SEP-41 token address to query.

Errors

  • [OracleError::NotInitialized] if the contract has not been set up.
  • [OracleError::PriceNotFound] if no price has been set for asset.
fn get_price(env: soroban_sdk::Env, asset: soroban_sdk::Address) -> i128

Transfer admin rights to new_admin.

Auth

Current admin must authorize this call.

Errors

  • [OracleError::NotInitialized] if the contract has not been set up.
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Set (or update) the price of asset.

The price must be expressed in [PRICE_PRECISION]-scaled units. To set "1 USDC = 1.0 base unit" pass price = 10_000_000.

Arguments

  • asset – The SEP-41 token address whose price is being set.
  • price – PRECISION-scaled price. Must be > 0.

Auth

Admin must authorize this call.

Errors

  • [OracleError::NotInitialized] if the contract has not been set up.
  • [OracleError::NotAuthorized] if caller is not the admin.
  • [OracleError::NonPositivePrice] if price <= 0.
fn set_price(env: soroban_sdk::Env, asset: soroban_sdk::Address, price: i128)

Return a map of prices for all requested assets in a single call.

This is a convenience batch-read that avoids multiple round-trips.

Arguments

  • assets – List of SEP-41 token addresses to query.

Errors

  • [OracleError::PriceNotFound] if any asset in the list has no price.
fn get_prices(
    env: soroban_sdk::Env,
    assets: soroban_sdk::Vec,
) -> soroban_sdk::Map

Constructor — runs atomically with CreateContract, cannot be front-run.

The deployer supplies the initial admin address. Because this executes in the same transaction as contract creation, no attacker can race ahead and claim admin rights.

Arguments

  • admin – The address that will be permitted to call [set_price].
fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Return the configured maximum allowed price age in ledgers.

fn get_max_age_ledgers(env: soroban_sdk::Env) -> u32

Set the maximum allowed age of stored prices in ledgers.

max_age_ledgers must be ≥ 1; zero would permanently disable the staleness guard, accepting arbitrarily old prices.

Errors

  • [OracleError::InvalidMaxAge] if max_age_ledgers == 0.
fn set_max_age_ledgers(env: soroban_sdk::Env, max_age_ledgers: u32)

Imports

WebAssembly Text (WAT) ▶