Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-7412: Remove oracleQuery from fulfillOracleQuery function signature #7663

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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