# Oracle Adapter

#### getLatestPricePayload <a href="#getlatestpricepayload" id="getlatestpricepayload"></a>

```
function getLatestPricePayload(string memory assetPairId) external view returns (StorkPricePayload memory)
```

<details>

<summary>StorkSignedPayload</summary>

```
struct StorkSignedPayload {
    address oraclePubKey;
    StorkPricePayload pricePayload;
    bytes32 r;
    bytes32 s;
    uint8 v;
}

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

</details>

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 <a href="#fulfilloraclequery" id="fulfilloraclequery"></a>

```
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 [contract](broken://spaces/b3btfuLSfJJJXBJGFc5f/pages/QY1O5dn64uLbu9VCelNy)), such that the Core operations use the latest prices.

Submit signed payload of price update.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.reya.xyz/technical-docs/contract-functions/oracle-adapter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
