Skip to content

Instantly share code, notes, and snippets.

@cwhinfrey
Last active January 8, 2019 01:14
Show Gist options
  • Save cwhinfrey/9b57e7763f9137d548fe67ba4cb13f0c to your computer and use it in GitHub Desktop.
Save cwhinfrey/9b57e7763f9137d548fe67ba4cb13f0c to your computer and use it in GitHub Desktop.
OracleInterfaces.sol
interface Oracle {
function isResultSetFor(uint256 id) external view returns (bool isSet);
function resultFor(uint256 id) external view returns (bytes32 result);
}
// Optional, OraclePrimary must implement Oracle
interface OraclePrimary {
event ResultSet(bytes32 _result, uint256 _id);
}
interface DataFeedOracle {
function isResultSetFor(uint256 id, uint256 date) external view returns (bool isSet);
function doesNonceExistFor(uint256 id, uint256 nonce) external view returns (bool exists);
function resultByDateFor(uint256 id, uint256 date) external view returns (bytes32 result, uint256 nonce);
function resultByNonceFor(uint256 id, uint256 nonce) external view returns (bytes32 result, uint256 date);
function lastUpdated(uint256 id) external view returns (uint256 date, uint256 nonce);
}
// Optional, DataFeedOraclePrimary must implement DataFeedOracle
interface DataFeedOraclePrimary {
event ResultSet(bytes32 _result, uint256 date, uint256 nonce, uint256 _id);
}
// Optional, TypedOracle must implement Oracle or DataFeedOracle
interface TypedOracle {
// returns 0: bytes32, 1: bool, 2: uint256, 3: int256
function dataType(uint256 _id) external view returns (uint8 typeEnum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment