Oracle funding

Here we explain how oracle gas costs funding works

Overview of funding

Oracles require a constant stream of updates, thus gas costs reimbursement for updates is needed. To achieve this, all oracles deployed by DIA have a dedicated wallet which calls oracle contracts for updates. This is referred to as the "gas wallet".

How it works

Each oracle deployed by DIA has a gas wallet, which is the only entity capable of calling for an oracle update. The wallet initiates the transaction to import a new value into the oracle smart contract, based on the data feed's update parameters (that have been previously configured).

For the gas wallet to perform new oracle contract updates, it must have a sufficient balance of the blockchain's native token to cover the transaction's gas costs.

The gas wallet can be funded with a one-time lump sum, allowing it to keep updating for a while. However, monitoring the gas wallet's balance is necessary to ensure continuity in the oracle's operations.

DIA has set up internal gas wallet balance trackers. We recommend protocols to actively monitor them to ensure that the wallet balance remains sufficient for pushing new oracle updates.

Estimate Updates Count for Oracles

DIA has a dedicated endpoint for asset historical updates count to help you estimate the number of oracle updates. This allows to foresee potential gas costs that would be required for running the oracle.

Get historical Oracle updates count

GET https://api.diadata.org/v1/assetUpdates/:blockchain/:address/:deviation/:updateFreq

The endpoint returns information on the asset deviation and updates count if it was used in the oracle. It takes price change (deviation) and oracle's ticker frequency as the main parameters to determine estimated updates count based on historical data.

Example: https://api.diadata.org/v1/assetUpdates/Ethereum/0x0000000000000000000000000000000000000000/20/120

By default it will return data for the last 24h but you can configure the timeframe with starttime and endtime parameters. See example below: https://api.diadata.org/v1/assetUpdates/Ethereum/0x0000000000000000000000000000000000000000/20/120?starttime=1661736336&endtime=1661761536

Path Parameters

NameTypeDescription

blockchain*

String

A valid blockchain from GET /v1/blockchains, e.g., Bitcoin.

address*

String

A valid asset address from GET /v1/token/:symbol, e.g., 0x000000000000000000000000000000000000000 for BTC.

deviation*

Integer

Deviation measure in per mille, e.g. 20 will result in 2% deviation

updateFreq*

Integer

Oracle's price feed ticker frequency in seconds, e.g. 120 will calculate asset price in 2 minute trade blocks

starttime

Integer

Unix timestamp setting the start of the return array

endtime

Integer

Unix timestamp setting the end of the return array

{
    // Response
}