-
Notifications
You must be signed in to change notification settings - Fork 18
/
IOracleProvider.sol
28 lines (24 loc) · 1.63 KB
/
IOracleProvider.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.13;
import "../types/OracleVersion.sol";
/// @dev OracleVersion Invariants
/// - Each newly requested version must be increasing, but does not need to incrementing
/// - We recommend using something like timestamps or blocks for versions so that intermediary non-requested
/// versions may be posted for the purpose of expedient liquidations
/// - Versions are allowed to "fail" and will be marked as .valid = false
/// - Versions must be committed in order, i.e. all requested versions prior to latestVersion must be available
/// - Non-requested versions may be committed, but will not receive a keeper reward
/// - This is useful for immediately liquidating an account with a valid off-chain price in between orders
/// - Satisfying the above constraints, only versions more recent than the latest version may be committed
/// - Current must always be greater than Latest, never equal
/// - Request must register the same current version that was returned by Current within the same transaction
interface IOracleProvider {
error OracleProviderUnauthorizedError();
event OracleProviderVersionRequested(uint256 indexed version);
event OracleProviderVersionFulfilled(uint256 indexed version);
function request(address account) external;
function status() external view returns (OracleVersion memory, uint256);
function latest() external view returns (OracleVersion memory);
function current() external view returns (uint256);
function at(uint256 timestamp) external view returns (OracleVersion memory);
}