DIA Nexus Documentation
  • Nexus Overview
  • Intro to Nexus
    • How it works
    • Nexus vs. Lumina
    • Integrated Chains
  • Data products
    • Token Price Feeds
    • RWA Price Feeds
    • Randomness
    • Fair-value Feeds
  • How-to Guides
    • Fetch Price Data
      • Solidity
      • Vyper
      • Demo Oracles
      • Chain-specific Guide
        • Aleph Zero
        • Alephium
        • Edu Chain
        • Hydration
        • Kadena
        • LUKSO
        • Somnia
        • Stacks
        • Superseed
        • XRP Ledger (XRPL)
    • Generate Randomness
      • Solidity
      • WASM
      • Demo Oracles
      • Chain-specific Guide
        • Alephium
    • Migrate to DIA
    • Fund the Oracle
    • Build a Scraper
      • Development Cluster Stack
      • DIA Test‐Space with Docker Compose
      • DIA Test‐Space with Minikube
      • Add a new exchange scraper
      • Add a new foreign scraper
      • Add a new liquidity scraper
      • Additional notes
  • Request a Custom Oracle
  • Reference
    • Architecture
      • Data sourcing
      • Data computation
      • Data delivery
    • APIs
      • Token prices
        • RestAPI
          • Request Samples
        • GraphQL
          • Request Samples
      • RWA prices
    • Pricing Methodologies
      • IR: Interquartile Range Filter
      • MAIR: Moving Average with Interquartile Range Filter
      • VWAP: Volume Weighted Average Price
      • VWAPIR: Volume Weighted Average Price with Interquartile Range Filter
      • LST fair price
    • Data Sources
      • CEXes Data
      • DEXes Data
    • Smart Contracts
      • DIAOracleV2.sol
      • DIARandomOracle.sol
    • Randomness Protocol
  • Resources
    • Audits
    • Community & Support
    • Security Bounty Program
    • Research
      • Return Rates in Crypto Farming
      • Crypto Volatility Index
      • Compounded Rates
      • Polkadot Medianizer
    • T&C
      • Licence Agreement
      • Contributor Covenant Code of Conduct
      • Disclaimer
Powered by GitBook
On this page
  • How it works
  • Estimate Updates Count for Oracles
  • Get historical Oracle updates count
Export as PDF
  1. How-to Guides

Fund the Oracle

PreviousMigrate to DIANextBuild a Scraper

Last updated 2 months ago

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 (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:

By default it will return data for the last 24h but you can configure the timeframe with starttime and endtime parameters. See example below:

Path Parameters

Name
Type
Description

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

data feed's update parameters
https://api.diadata.org/v1/assetUpdates/Ethereum/0x0000000000000000000000000000000000000000/20/120
https://api.diadata.org/v1/assetUpdates/Ethereum/0x0000000000000000000000000000000000000000/20/120?starttime=1661736336&endtime=1661761536