Skip to content

Commit

Permalink
Update EIP-7412: Remove oracleQuery from fulfillOracleQuery funct…
Browse files Browse the repository at this point in the history
…ion signature

Merged by EIP-Bot.
  • Loading branch information
noahlitvin committed Sep 6, 2023
1 parent e143af4 commit db33cf4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions EIPS/eip-7412.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ error OracleDataRequired(address oracleContract, bytes oracleQuery)
```solidity
interface IERC7412 {
function oracleId() view external returns (bytes32 oracleId);
function fulfillOracleQuery(bytes oracleQuery, bytes signedOffchainData) payable external;
function fulfillOracleQuery(bytes signedOffchainData) payable external;
}
```

`oracleId` is a unique identifier that references the decentralized oracle network that generates the desired signed off-chain data. Oracle IDs would be analogous to Chain IDs in the Ethereum ecosystem. Clients are expected to resolve a gateway that corresponds to an Oracle ID, similar to how clients are expected to resolve an RPC endpoint based on a Chain ID.

The contract implementing the `IOracleContract` interface MUST revert with the following error message if it requires payment to fulfill the oracle data query:
It should be possible to derive the `oracleQuery` from the `signedOffchainData`, such that the oracle contract is able to provide the verified offchain data based on the `oracleQuery`.

The contract implementing the `IERC7412` interface MUST revert with the following error message if it requires payment to fulfill the oracle data query:

```solidity
error FeeRequired(uint amount)
Expand Down Expand Up @@ -111,8 +113,8 @@ contract OracleContract is IERC7412 {
return bytes32(abi.encodePacked("MY_ORACLE_ID"));
}
function fulfillOracleQuery(bytes calldata oracleQuery, bytes calldata signedOffchainData) payable external {
_verify(signedOffchainData);
function fulfillOracleQuery(bytes calldata signedOffchainData) payable external {
bytes memory oracleQuery = _verify(signedOffchainData);
latestVerifiedData[keccak256(oracleQuery)] = signedOffchainData;
}
Expand All @@ -127,7 +129,7 @@ contract OracleContract is IERC7412 {
return response;
}
function _verify(bytes memory signedOffchainData) payable internal {
function _verify(bytes memory signedOffchainData) payable internal returns (bytes oracleQuery) {
// Insert verification code here
// This may revert with error FeeRequired(uint amount)
}
Expand Down

0 comments on commit db33cf4

Please sign in to comment.