Replaces the contract WASM. Storage is kept as is, not migrated.
e - Access to the Soroban environment.new_wasm_hash - The hash of an uploaded WASM blob.operator - The owner.OwnableError::OwnerNotSet - If ownership was renounced.OracleError::UpgradeNotOwner] - If operator is not the owner.operator must be the
owner.fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Returns the Chainlink verifier contract address.
env - Access to the Soroban environment.fn verifier(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns Some(Address) if ownership is set, or None if ownership has
been renounced.
e - Access to the Soroban environment.fn get_owner(env: soroban_sdk::Env) -> Option
Verifies a signed Data Streams report and returns the gated
PriceData for the caller's stream.
A still-cached verified report skips the verifier call.
env - Access to the Soroban environment.report - The signed report blob.feed_id - The caller's stream anchor. It must equal the report's
feedId.protective - Uses close_staleness instead of trade_staleness as
the age window.OracleError::InvalidData] - If the body fails decoding or the
feedId is not a V3 stream id.OracleError::FeedMismatch] - If the report prices another stream.OracleError::PriceAhead] - If the validity start or the
observation is over trade_staleness ahead of the ledger.OracleError::ReportExpired] - If the ledger has passed
expiresAt.OracleError::PriceStale] - If the observation is older than the
age window.OracleError::InvalidPrice] - If the benchmark or a side is not
positive, the book is crossed, or an int192 overflows i128.fn verify_price(
env: soroban_sdk::Env,
report: soroban_sdk::Bytes,
feed_id: soroban_sdk::BytesN<32>,
protective: bool,
) -> PriceData
Initializes the oracle.
env - Access to the Soroban environment.owner - The address that may update the staleness windows and the
spread reduction.verifier - Chainlink's deployed Data Streams verifier contract. No
entry point changes it. Only an owner upgrade can, and the upgrade
keeps the oracle address each market stores.trade_staleness - The maximum age of a price observation for
strict (fill) verifications (seconds).close_staleness - The maximum age for protective (gap-closing)
verifications (seconds). At least trade_staleness.spread_reduction_factor - Symmetric bid/ask narrowing toward their
midpoint, SCALAR_18-scaled. 0 is off, and SCALAR_18 collapses
both onto the mid.OracleError::InvalidStaleness] - If the staleness pair is out of
bounds.OracleError::InvalidSpreadReduction] - If the factor is outside
[0, SCALAR_18].fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
verifier: soroban_sdk::Address,
trade_staleness: u64,
close_staleness: u64,
spread_reduction_factor: i128,
)
Returns the protective (gap-closing) staleness window (seconds).
env - Access to the Soroban environment.fn close_staleness(env: soroban_sdk::Env) -> u64
Returns the strict (fill) staleness window (seconds).
env - Access to the Soroban environment.fn trade_staleness(env: soroban_sdk::Env) -> u64
Accepts a pending ownership transfer.
e - Access to the Soroban environment.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
there is no pending transfer to accept.["ownership_transfer_completed"][new_owner: Address]fn accept_ownership(env: soroban_sdk::Env)
Updates both staleness windows.
One call sets the pair atomically, so the trade <= close ordering
is always validated against the new pair.
env - Access to the Soroban environment.trade_staleness - The maximum report age for strict (fill)
verifications (seconds).close_staleness - The maximum report age for protective
(gap-closing) verifications (seconds). At least trade_staleness.OwnableError::OwnerNotSet - If ownership was renounced.OracleError::InvalidStaleness] - If the staleness pair is out of
bounds.["staleness_update"][trade_staleness: u64, close_staleness: u64]fn update_staleness(env: soroban_sdk::Env, trade_staleness: u64, close_staleness: u64)
Renounces ownership of the contract.
Permanently removes the owner, disabling all functions gated by
#[only_owner].
e - Access to the Soroban environment.OwnableError::TransferInProgress] - If there is a pending ownership
transfer.OwnableError::OwnerNotSet] - If the owner is not set.fn renounce_ownership(env: soroban_sdk::Env)
Initiates a 2-step ownership transfer to a new address.
Requires authorization from the current owner. The new owner must later
call accept_ownership() to complete the transfer.
e - Access to the Soroban environment.new_owner - The proposed new owner.live_until_ledger - Ledger number until which the new owner can
accept. A value of 0 cancels any pending transfer.OwnableError::OwnerNotSet] - If the owner is not set.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
trying to cancel a transfer that doesn't exist.crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] -
If the specified ledger is in the past.crate::role_transfer::RoleTransferError::InvalidPendingAccount] -
If the specified pending account is not the same as the provided new
address.fn transfer_ownership(
env: soroban_sdk::Env,
new_owner: soroban_sdk::Address,
live_until_ledger: u32,
)
Returns the current spread reduction factor (SCALAR_18-scaled).
env - Access to the Soroban environment.fn spread_reduction_factor(env: soroban_sdk::Env) -> i128
Updates the spread reduction factor.
env - Access to the Soroban environment.spread_reduction_factor - The SCALAR_18-scaled narrowing toward
the mid. 0 is off, and SCALAR_18 collapses both sides onto the
mid.OwnableError::OwnerNotSet - If ownership was renounced.OracleError::InvalidSpreadReduction] - If the factor is outside
[0, SCALAR_18].["spread_reduction_update"][spread_reduction_factor: i128]fn update_spread_reduction_factor(env: soroban_sdk::Env, spread_reduction_factor: i128)