ERC-7412

A standard for using oracle data on Ethereum

ERC-7412 Sequence Diagram

Build protocols that use data from oracles

Write and deploy smart contracts that call oracle contracts to reference off-chain data.

Example Code

function ethPrice() public view returns (uint256) { IPythERC7412Wrapper pyth = IPythERC7412Wrapper("0xEb38e347F24ea04ffA945a475BdD949E0c383A0F"); bytes32 priceId = "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace"; uint stalenessTolerance = 60; // in seconds return pyth.getLatestPrice(priceId, stalenessTolerance); // also see getBenchmarkPrice() }

Build apps with protocols that connect to oracles

The client library automatically adds oracle data to transactions when necessary.

// Under Development import { withRequiredOracleData, PythAdapter } from "erc7412"; // Call View Functions // This automatically resolves `OracleDataRequired` and `FeeRequired` errors. // TODO // Prepare Transactions for Signing // This returns an array that includes `fulfillOracleQuery()` calls when necessary. const transactionsWithOracleData = await withRequiredOracleData( transactions, [new PythAdapter('https://hermes.pyth.network')] ); return await client.sendTransactions({ transactions: transactionsWithOracleData });

See the full example using permissionless.js.

Compatible Account Abstraction Solutions

SafeBiconomyZeroDev

Protocols that integrate with the trusted multicall forwarder are also compatible with EOAs.

ERC-7412

 powers  Synthetix  on  Base

Build something awesome that integrates with Synthetix Perps V3.