Lumia - The RWA Chain
  • What is Lumia Chain?
  • Polygon
    • CDK
    • AggLayer
    • Miden
    • Passport
  • ⛓️Lumia
    • Architecture
    • Roadmap
    • LUMIA Token
      • Token Swap Guide (UI)
      • Token Swap Guide (SmartContract)
    • 普通话 - LUMIA 代币
    • rwaUSD
    • HyperNodes
    • zkProvers
      • zkProver Network (zkN) via Gevolut
    • Sequencer
      • Decentralised Sequencer Network (DCN)
    • Data Availability
      • Validium
      • Volition (Enhanced Validium)
      • What is Avail DA?
        • How does AvailDA Scale?
        • Benefits of AvailDA
      • Lumia DA - Lightclient Nodes
    • Lumia Stream
      • Node Owned Liquidity
      • Liquidity Restaking
    • Interoperability
      • Polygon AggLayer
      • HyperLane
    • KYC
    • Chain & Account Abstraction with Intents
      • Particle Connect on Lumia
    • Real World Assets (RWA) on Lumia
  • 🛠️Build
    • Introduction
      • Accounts and Wallets
      • Setup Metamask with Lumia Chain
      • Bridge to/ from Lumia L2
      • Setup FoxWallet with Lumia Chain
    • Explorers
    • Build Environment
      • RPC
        • RPC Guide
      • Add Lumia Network to MetaMask
      • Testnet Tokens
    • SmartContracts
      • Deployment
        • Hardhat
        • Truffle
      • Verify
        • Hardhat
        • Truffle
      • Interact
      • Relay
      • Web3 Functions
    • On-Chain KYC
    • Oracles
      • API3
      • Supra
      • Commodity Prices
    • Indexers
      • Indexing with TheGraph
      • Indexing with Goldsky
    • zkNode
      • Run Local Validium Node
      • Run an RPC
        • JSON RPC Endpoints
      • Gas Fees
    • DA Lightclient
    • CDK Repos
    • rwaUSD
      • rwaUSD: Overcollateralizing
      • rwaUSD: Bridging
    • FAQs
Powered by GitBook
On this page
  • Using dAPIs - API3 datafeeds
  • Resources

Was this helpful?

  1. Build
  2. Oracles

API3

PreviousOraclesNextSupra

Last updated 5 months ago

Was this helpful?

is a collaborative project to deliver traditional API services to smart contract platforms in a decentralized and trust-minimized way. Its primary focus is to bring cryptocurrency price data to smart contracts in a secure and reliable manner. API3 price feeds have (Oracle Extractable Value) built in to the price feeds by default, this allows dapps to monetize the update of the price feeds they are using. It is governed by a decentralized autonomous organization (DAO).

Read more about how The API3 DAO works.

Using dAPIs - API3 datafeeds

are continuously updated streams of offchain cryptocurrency price data. They can power various decentralized applications such as DeFi lending, synthetic assets, stablecoins, derivatives, NFTs and more.

The data feeds are continuously updated by first party oracles using signed data. Dapp owners can read the onchain value of any dAPI in real-time.

Due to being composed of first-party data feeds, dAPIs offer security, transparency, cost-efficiency and scalability in a turn-key package.

Apart from relying on deviation threshold and heartbeat configuration updates, unlike traditional data feeds, enables dapps using dAPIs to auction off the right to update the data feeds to searcher bots. Searcher bots can bid for price updates through the OEV Network to update the data feeds. All the OEV proceeds go back to the dapp.

The enables users to connect to a dAPI and access the associated data feed services.

dapi-main

Subscribe to dAPIs

Explore, select and configure your dAPI

The current supported configurations for dAPIs are:

Deviation

Heartbeat

0.25%

24 hours

0.5%

24 hours

1%

24 hours

5%

24 hours

Activate your dAPI

If a dAPI is already activated, make sure to check the expiration date and update parameters. You can update the parameters and extend the subscription by purchasing a new configuration.

After selecting the dAPI and the configuration, you will be presented with an option to purchase the dAPI and activate it. Make sure to check the time and amount of the subscription. If everything looks good, click "Purchase".

You can then connect your wallet and confirm the transaction. Once it's confirmed, you will be able to see the updated configuration for the dAPI.

Get the proxy address

Once you are done configuring and activating the dAPI, you can now integrate it. To do so, click on the "Integrate" button on the dAPI details page.

You can now see the deployed proxy contract address. You can now use this to read from the configured dAPI.

Read from a dAPI

Here's an example of a basic contract that reads from a dAPI.

// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@openzeppelin/contracts@4.9.5/access/Ownable.sol";
import "@api3/contracts/api3-server-v1/proxies/interfaces/IProxy.sol";

contract DataFeedReaderExample is Ownable {
    // The proxy contract address obtained from the API3 Market UI.
    address public proxyAddress;

    // Updating the proxy contract address is a security-critical
    // action. In this example, only the owner is allowed to do so.
    function setProxyAddress(address _proxyAddress) public onlyOwner {
        proxyAddress = _proxyAddress;
    }

    function readDataFeed()
        external
        view
        returns (int224 value, uint256 timestamp)
    {
        // Use the IProxy interface to read a dAPI via its proxy contract .
        (value, timestamp) = IProxy(proxyAddress).read();
        // If you have any assumptions about `value` and `timestamp`,
        // make sure to validate them after reading from the proxy.
    }
}
  • setProxyAddress() is used to set the address of the dAPI Proxy Contract.

  • readDataFeed() is a view function that returns the latest price of the set dAPI.

Resources

Here are some additional developer resources:

.

The lets users access dAPIs on both and .

The provides a list of all the dAPIs available across multiple chains including testnets. You can filter the list by mainnet or testnet chains. After selecting the chain, you can search for a specific dAPI by name. Once selected, you will land on the details page (eg ETH/USD on Lumia Testnet) where you can find more information about the dAPI.

dapi-1
dapi-2
dapi-5

.

🛠️
Learn more about how dAPIs work
API3 Market
Lumia Mainnet
testnet
API3 Market
Read more about dAPIs
Try deploying it on Remix!
API3 docs
API3 Market
dAPI docs
OEV docs
Github
Medium
YouTube
API3
OEV
Click here
dAPIs
OEV Network
API3 Market