Reya
  • Start Here
    • Why Reya?
  • REYA PRODUCTS
    • Reya DEX
      • Navigating Reya DEX
        • Dashboard: getting started
          • Creating your margin account
          • Moving funds
          • Checking your account
        • The Trading Screen
          • Trade form
          • Market Data Panel
        • LP Pool
      • Trading on Reya DEX
        • Perpetual Futures
        • Margin
        • Auto-exchange and Liquidations
        • Specifications
        • Conditional Orders
        • FlashSwap
        • Collateral liquidations
        • Settlement and cross-collateralization
      • Docs: Reya DEX REST API
      • Docs: Reya DEX WebSocket
    • Reya Network
      • The structure of Reya Network
      • The Liquidity Layer
        • Reya’s pool for perpetual futures
        • Offering liquidity in the passive pool
        • Deepdive into passive perps
        • Network Owned Liquidity
      • Derivatives Clearing
        • Automatic leveraging of PnL across instruments
        • Cross-collateralization
          • Haircuts
          • Auto-exchange conditions
          • Auto-exchange mechanism
        • Cross-margining
          • The margin system
        • The liquidation engine
          • Ranked liquidations
          • Dutch auction
          • Backstop LPs
          • Insurance Funds
          • Page 1
        • Spot markets
        • Reya Governance
      • What's the roadmap
      • Who's Behind Reya Network
    • rUSD / srUSD
      • rUSD
      • srUSD
      • srUSD How to and FAQs
  • COMMUNITY
    • Join the Reya Community
    • Incentives Overview
      • Experience (XP)
        • Technical details
      • Boosts
      • Ranks and Seasons
    • x.com
  • Technical Docs
    • Reya Python SDK
    • Contract Functions
      • Core
      • Passive Perp Instrument
      • Passive Pool
      • Oracle Adapter
    • Contract Addresses
    • Smart Contract Withdrawals
    • Audits
  • REYA RESOURCES
    • Blog
    • Beginner's Guide to Better Trading with Reya
    • Block Explorer
    • Glossary (coming soon)
    • FAQ (coming soon)
Powered by GitBook
On this page
  1. Technical Docs
  2. Contract Functions

Oracle Adapter

Receives and track the latest price updates given by a trusted off-chain source.

PreviousPassive PoolNextContract Addresses

Last updated 4 months ago

getLatestPricePayload

function getLatestPricePayload(string memory assetPairId) external view returns (StorkPricePayload memory)
StorkSignedPayload
struct StorkSignedPayload {
    address oraclePubKey;
    StorkPricePayload pricePayload;
    bytes32 r;
    bytes32 s;
    uint8 v;
}

struct StorkPricePayload {
    string assetPairId;
    uint256 timestamp;
    uint256 price;
}

Returns the latest price payload for the given Stork asset pair ID (e.g 'AAVEUSDMARK' for futures prices of Aave). This payload has been signed by a trusted source and gives the latest price used by the Perpetuals Instrument as the reference price for match orders.

fulfillOracleQuery

function fulfillOracleQuery(bytes calldata signedOffchainData) external payable override

Updates the latest reference price of the asset pair. The signedOffchainData is a bytes encoding of the StorkSignedPayload. This is a payload of the latest price details with a signature given by a trusted source. The signature is verified against the received data and must match for the new price to be accepted.

Anyone can update the prices at any point, the only constraint is that they have to be signed by a trusted source. One can subscribe to price updates from this source and send fulfillOracleQuery transactions with the latest prices. It is recommended to append updates for every market before executing a match order or a liquidation (e.g. by using a Multicall ), such that the Core operations use the latest prices.

Submit signed payload of price update.

contract