API3 is a collaborative project delivers traditional API services to smart contract platforms in a decentralized and trust-minimized way. Unlike traditional data feeds, accessing API3 price feeds (opens in a new tab) allows dApps to auction off the right to update the feeds to searcher bots, improving the efficiency of liquidation processes for users and LPs in DeFi money markets. The recaptured OEV is returned to the dApp.
Quick Start
Head over to the quickstart section (opens in a new tab) for an introduction how to get a price feed to your smart contract. Here is a video option (opens in a new tab) that you can go through in less than 10 minutes to get integrated.
In just a few lines of code, you can get our price feeds integrated to your contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@api3/contracts/interfaces/IApi3ReaderProxy.sol";
contract DataFeedReaderExample is Ownable {
address public proxy;
constructor(address _proxy) {
setProxy(_proxy);
}
function setProxy(address _proxy) public onlyOwner {
proxy = _proxy;
}
function readDataFeed() external view returns (int224 value, uint256 timestamp)
{
(value, timestamp) = IApi3ReaderProxy(proxy).read();
require(value > 0, "Value not positive");
require(
timestamp + 1 days > block.timestamp,
"Timestamp older than one day"
);
// After validation, you can implement your contract logic here.
// Refer to https://docs.api3.org/dapps/integration/contract-integration.html
// for more information about how to integrate your contract securely.
}
}
Migrating over but using a different oracle?
API3 has an adaptor contract (opens in a new tab) that will allow you to use your existing repo with API3 price feeds data structure.
Oracle Extractable Value
Oracles that pay you
Oracles play an important role in the health of a platform. When an oracle updates the data onchain, opportunities can present themselves to searchers. API3 allows anyone to bid in an auction for the right to update the oracle to the most exact current value. A majority of the bidding amount is returned to the platform to help recapture the loss in TVL. This feature is built into the oracle, there are no additional costs or code refactoring needed to use this feature.
To find out more details about OEV, please check here (opens in a new tab)