Contract 90e0f43192ac14389c7721b67b5f5a3ca92b24f0a5c677241e303084b9c38f55

← Back to Index 📥 Download WASM

Meta

cliver 27.1.0#8e402ea28202950b272fbabc34caad4d2f64fe87
rssdk_spec_shaking 2
rssdkver 26.1.1#8ac18efb681a1c0b4b85a38c5a380300344e3f39
rsver 1.98.1
source_commit 26b0f4577a17dfa365e463577f312a5ede34adc3

Instances

  • CBQP3O5NW6S4ZRE4SZAUO3VDOR32OMO22FLLMP3DJMO3TXJEPNW65XXU

Interface

Replaces the contract WASM. Storage is kept as is, not migrated.

Arguments

  • e - Access to the Soroban environment.
  • new_wasm_hash - The hash of an uploaded WASM blob.
  • operator - The owner.

Errors

  • OwnableError::OwnerNotSet - If ownership was renounced.
  • [OracleError::UpgradeNotOwner] - If operator is not the owner.

Notes

  • Authorization for the owner is required, and 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • 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.

Errors

  • [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.

Arguments

  • 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.

Errors

  • [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).

Arguments

  • env - Access to the Soroban environment.
fn close_staleness(env: soroban_sdk::Env) -> u64

Returns the strict (fill) staleness window (seconds).

Arguments

  • env - Access to the Soroban environment.
fn trade_staleness(env: soroban_sdk::Env) -> u64

Accepts a pending ownership transfer.

Arguments

  • e - Access to the Soroban environment.

Errors

  • [crate::role_transfer::RoleTransferError::NoPendingTransfer] - If there is no pending transfer to accept.

Events

  • topics - ["ownership_transfer_completed"]
  • data - [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.

Arguments

  • 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.

Errors

  • OwnableError::OwnerNotSet - If ownership was renounced.
  • [OracleError::InvalidStaleness] - If the staleness pair is out of bounds.

Events

  • topics - ["staleness_update"]
  • data - [trade_staleness: u64, close_staleness: u64]

Notes

  • Authorization for the owner is required.
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].

Arguments

  • e - Access to the Soroban environment.

Errors

  • [OwnableError::TransferInProgress] - If there is a pending ownership transfer.
  • [OwnableError::OwnerNotSet] - If the owner is not set.

Notes

  • Authorization for the current owner is required.
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.

Arguments

  • 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.

Errors

  • [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.

Notes

  • Authorization for the current owner is required.
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).

Arguments

  • env - Access to the Soroban environment.
fn spread_reduction_factor(env: soroban_sdk::Env) -> i128

Updates the spread reduction factor.

Arguments

  • 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.

Errors

  • OwnableError::OwnerNotSet - If ownership was renounced.
  • [OracleError::InvalidSpreadReduction] - If the factor is outside [0, SCALAR_18].

Events

  • topics - ["spread_reduction_update"]
  • data - [spread_reduction_factor: i128]

Notes

  • Authorization for the owner is required.
fn update_spread_reduction_factor(env: soroban_sdk::Env, spread_reduction_factor: i128)

Imports

WebAssembly Text (WAT) ▶