Contract 4a4441814cc6beb69692b0d11fe7bf83761146d0ab98a6f06750c2f4c37a12cd

← Back to Index 📥 Download WASM

Meta

binver 0.1.0
rssdkver 23.5.1#59fcef437260ed4da42d1efb357137a5c166c02e
rsver 1.93.1

Instances

  • CC4VF5DWLP7BITBPT4VMXP3SZ3FSTVMHG2B73Q4ZACAL7DMNVUX3EGL4
  • CCUBVDF4BWTPG4Y7YU2AAUL76NUZPLM67F26U2GXPTO7NOBEVURKGV6U

Interface

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.

Errors

  • NotInitialized - Contract has not been initialized
fn bump(env: soroban_sdk::Env, ledgers: u32) -> Result<(), OracleError>

Get price at a specific timestamp.

Returns None if:

  • The oracle is not initialized
  • The timestamp is before the oracle start time
  • The price computation overflows
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.

Errors

  • NotInitialized - Contract has not been initialized
fn 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.

Warning

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.

Arguments

  • 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 priced
  • maturity - 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 output

Errors

  • AlreadyInitialized - Contract has already been initialized
  • InvalidMaturity - Maturity timestamp is not in the future
  • InvalidApy - APY is not between 0 and 100%
  • InvalidFuturePtValue - Future PT value is not positive
fn 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.

Errors

  • NotInitialized - Contract has not been initialized
fn 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.

Errors

  • NotInitialized - Contract has not been initialized
  • NoUpgraderSet - No upgrader has been set
  • Unauthorized - Caller is not the current upgrader
fn set_upgrader(
    env: soroban_sdk::Env,
    new_upgrader: soroban_sdk::Address,
) -> Result<(), OracleError>

Get the start time timestamp.

Errors

  • NotInitialized - Contract has not been initialized
fn 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.

Errors

  • NotInitialized - Contract has not been initialized
fn get_future_pt_value(env: soroban_sdk::Env) -> Result

Update the future PT value. Only callable by the owner.

Errors

  • NotInitialized - Contract has not been initialized
  • InvalidFuturePtValue - New value is not positive
fn set_future_pt_value(
    env: soroban_sdk::Env,
    new_value: i128,
) -> Result<(), OracleError>

Get the initial implied APY.

Errors

  • NotInitialized - Contract has not been initialized
fn get_initial_implied_apy(env: soroban_sdk::Env) -> Result

Imports

WebAssembly Text (WAT) ▶