Re-extend the TTL of the oracle instance storage.
This is a permissionless function — anyone can call it and the caller pays the transaction fees.
The ledgers parameter specifies the desired TTL extension in
ledgers (clamped to the network's max_ttl). For long-maturity
oracles where the network max TTL (~6 months) is shorter than
the time to maturity, callers should invoke bump() periodically.
Soroban's extend_ttl is monotonic (it never shrinks a TTL), so
calling this when TTLs are already healthy is a safe no-op.
NotInitialized - Contract has not been initializedfn bump(env: soroban_sdk::Env, ledgers: u32) -> Result<(), OracleError>
Get price at a specific timestamp.
Returns None if:
fn price(env: soroban_sdk::Env, timestamp: u64) -> Option
Get the PT token address.
fn get_pt(env: soroban_sdk::Env) -> soroban_sdk::Address
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Return the number of decimals for the price output.
NotInitialized - Contract has not been initializedfn decimals(env: soroban_sdk::Env) -> Result
Get the owner address. Returns None if ownership has been renounced.
fn get_owner(env: soroban_sdk::Env) -> Option
Get the most recent price.
The asset parameter is ignored. It exists solely for interface
compatibility. Each oracle instance is bound to a single PT at
initialization and always prices that PT regardless of what is
passed here.
Returns None if the oracle is not initialized.
fn lastprice(env: soroban_sdk::Env, asset: Asset) -> Option
Initialize the oracle with the required parameters.
owner - The owner address (can update config and transfer ownership)upgrader - The upgrader address (can upgrade the contract WASM)pt - The PT token address being pricedmaturity - The maturity timestamp (Unix timestamp)initial_implied_apy - The initial implied APY (18 decimals, e.g., 0.1e18 = 10%)future_pt_value - The future PT value at maturity (in decimals precision)decimals - The number of decimals for the price outputAlreadyInitialized - Contract has already been initializedInvalidMaturity - Maturity timestamp is not in the futureInvalidApy - APY is not between 0 and 100%InvalidFuturePtValue - Future PT value is not positivefn initialize(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
upgrader: soroban_sdk::Address,
pt: soroban_sdk::Address,
maturity: u64,
initial_implied_apy: i128,
future_pt_value: i128,
decimals: u32,
) -> Result<(), OracleError>
Get the maturity timestamp.
NotInitialized - Contract has not been initializedfn get_maturity(env: soroban_sdk::Env) -> Result
Get the upgrader address. Returns None if not initialized.
fn get_upgrader(env: soroban_sdk::Env) -> Option
Set a new upgrader address. Only callable by the current upgrader.
The upgrader role is independent from ownership — the owner cannot change the upgrader, and the upgrader cannot perform owner actions.
NotInitialized - Contract has not been initializedNoUpgraderSet - No upgrader has been setUnauthorized - Caller is not the current upgraderfn set_upgrader(
env: soroban_sdk::Env,
new_upgrader: soroban_sdk::Address,
) -> Result<(), OracleError>
Get the start time timestamp.
NotInitialized - Contract has not been initializedfn get_start_time(env: soroban_sdk::Env) -> Result
Get a description of this oracle.
fn get_description(env: soroban_sdk::Env) -> soroban_sdk::String
Accept ownership transfer. Must be called by the pending owner.
fn accept_ownership(env: soroban_sdk::Env)
Renounce ownership permanently. Only callable by the owner. WARNING: This is irreversible and will lock all owner-only functions. The upgrader role is unaffected — the upgrader can still upgrade the contract.
fn renounce_ownership(env: soroban_sdk::Env)
Transfer ownership to a new address. Only callable by the current owner. Uses OpenZeppelin's two-step transfer process.
fn transfer_ownership(
env: soroban_sdk::Env,
new_owner: soroban_sdk::Address,
live_until_ledger: u32,
)
Get the future PT value.
NotInitialized - Contract has not been initializedfn get_future_pt_value(env: soroban_sdk::Env) -> Result
Update the future PT value. Only callable by the owner.
NotInitialized - Contract has not been initializedInvalidFuturePtValue - New value is not positivefn set_future_pt_value(
env: soroban_sdk::Env,
new_value: i128,
) -> Result<(), OracleError>
Get the initial implied APY.
NotInitialized - Contract has not been initializedfn get_initial_implied_apy(env: soroban_sdk::Env) -> Result