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>
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>
Sets a manual price override for emergency situations. Requires an expiry timestamp to prevent permanent mispricing.
caller - Admin address (must be authorized)asset - Asset to override price forprice - 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>
fn add_asset_by_address(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
asset_address: soroban_sdk::Address,
) -> 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_redstone_adapter(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
asset: Asset,
adapter: Option,
) -> Result<(), OracleError>
Get RedStone adapter address for a specific asset
fn get_redstone_adapter(
env: soroban_sdk::Env,
asset: Asset,
) -> Option
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_oracle_config(env: soroban_sdk::Env) -> Result
fn set_oracle_config(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
config: OracleConfig,
) -> Result<(), OracleError>
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
Check if a position is liquidatable based on LTV ratio. Returns true if LTV >= liquidation_threshold.
fn is_liquidatable(
env: soroban_sdk::Env,
collateral_asset: Asset,
collateral_amount: u128,
debt_asset: Asset,
debt_amount: u128,
liquidation_threshold: u32,
) -> Result
Check if a position is liquidatable based on collateralization ratio.
Returns true if collateralization_ratio >= liquidation_threshold.
Both is_liquidatable and check_liquidation use consistent semantics (>=).
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 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
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.
caller - Current admin address (must be authorized)pending_admin - Proposed new admin addressUnauthorized - Caller is not current adminfn propose_admin(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
pending_admin: soroban_sdk::Address,
) -> Result<(), OracleError>
Accept admin role (two-step transfer, step 2). Only the pending admin can call this to finalize the transfer.
caller - Pending admin address (must be authorized)InvalidCalculation - No pending admin proposal or caller is not the pending adminfn accept_admin(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), OracleError>
Cancel a pending admin proposal. Only the current admin can cancel a pending proposal.
caller - Current admin address (must be authorized)Unauthorized - Caller is not current adminInvalidCalculation - No pending admin proposal existsfn cancel_admin_proposal(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), OracleError>
Get the pending admin address, if any.
Ok(Address) - Pending admin addressErr(InvalidCalculation) - No pending admin proposal existsfn get_pending_admin(
env: soroban_sdk::Env,
) -> Result