Return the current admin address.
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.
asset – The SEP-41 token address to query.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.
Current admin must authorize this call.
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.
asset – The SEP-41 token address whose price is being set.price – PRECISION-scaled price. Must be > 0.Admin must authorize this call.
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.
assets – List of SEP-41 token addresses to query.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.
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.
OracleError::InvalidMaxAge] if max_age_ledgers == 0.fn set_max_age_ledgers(env: soroban_sdk::Env, max_age_ledgers: u32)