IOracleRegistry
Last updated
Last updated
Inherits: IOracle
Interface for an Oracle Registry
Adds an oracle for the provided base and quote assets
MUST REVERT if not called by the authorized address
MUST REVERT if the oracle is already set
function addOracle(address base, address quote, IOracle oracle) external;
Parameters
base
address
Base asset address
quote
address
Quote asset address
oracle
IOracle
Oracle to add
Schedules an oracle update for the base/quote asset pair The update process is a two-step process: first, the new oracle data is set using this function; second, the update is committed using the commitOracleUpdate function
MUST REVERT if not called by the authorized address
MUST REVERT if the oracle data is already scheduled for an update
MUST REVERT if the oracle data is the same as the current oracle
function scheduleOracleUpdate(address base, address quote, IOracle oracle) external;
Parameters
base
address
Base asset address
quote
address
Quote asset address
oracle
IOracle
Oracle to schedule
Commits the oracle update for the base/quote asset pair Can be called by anyone after the update process is initiated using scheduleOracleUpdate
and the update delay has passed
MUST REVERT if the update is not initiated
MUST REVERT if the update delay has not passed
function commitOracleUpdate(address base, address quote) external;
Parameters
base
address
Base asset address
quote
address
Quote asset address
Cancels the scheduled update for the base/quote asset pair
MUST REVERT if not called by the authorized address
MUST REVERT if the update is not initiated
function cancelScheduledOracleUpdate(address base, address quote) external;
Parameters
base
address
Base asset address
quote
address
Quote asset address
Disables the oracle for the base/quote asset pair
Performs a soft delete to forbid calling addOracle
with the same base and quote assets and avoid front-running attack
MUST REVERT if not called by the authorized address
MUST REVERT if the oracle data is not set
MUST REVERT if the oracle data is already disabled
function disableOracle(address base, address quote, IOracle oracle) external;
Parameters
base
address
Base asset address
quote
address
Quote asset address
oracle
IOracle
Oracle that is to be disabled
Allows a user to accept the pending oracle for a given base/quote pair during the delay period Can be called by the user to use the new oracle early
MUST REVERT if the caller is not the user or its owner
MUST REVERT if the oracle is not set
MUST REVERT if current pending oracle doesn't match the oracle to be accepted
function acceptPendingOracle(address base, address quote, address user, IOracle oracle) external;
Parameters
base
address
Base asset address
quote
address
Quote asset address
user
address
Vault that is accepting the pending oracle
oracle
IOracle
Oracle that is to be accepted
Allows a user to remove the oracle override for a given base/quote pair
MUST REVERT if the caller is not the user or its owner
function removeOracleOverride(address base, address quote, address user) external;
Parameters
base
address
Base asset address
quote
address
Quote asset address
user
address
The vault address removing the override
Returns the value of the base asset in terms of the quote asset with using the provided oracle data for the provided user (respects user-specific overrides)
function getQuoteForUser(uint256 baseAmount, address base, address quote, address user)
external
view
returns (uint256);
Parameters
baseAmount
uint256
Amount of base asset
base
address
Base asset address
quote
address
Quote asset address
user
address
Vault address
Returns
<none>
uint256
value of the base asset in terms of the quote asset
Return oracle metadata for base/quote
function getOracleData(address base, address quote) external view returns (OracleData memory data);
Parameters
base
address
Base asset address
quote
address
Quote asset address
Returns
data
OracleData
Oracle data
Emitted when an oracle is added
event OracleSet(address indexed base, address indexed quote, IOracle indexed oracle);
Parameters
base
address
Base asset address
quote
address
Quote asset address
oracle
IOracle
Added oracle
Emitted when an oracle update is scheduled
event OracleScheduled(
address indexed base, address indexed quote, IOracle indexed pendingOracle, uint32 commitTimestamp
);
Parameters
base
address
Base asset address
quote
address
Quote asset address
pendingOracle
IOracle
Pending oracle
commitTimestamp
uint32
The timestamp when the oracle data can be commited
Emitted when an oracle update is cancelled
event OracleUpdateCancelled(address indexed base, address indexed quote);
Parameters
base
address
Base asset address
quote
address
Quote asset address
Emitted when an oracle is disabled
event OracleDisabled(address indexed base, address indexed quote, IOracle indexed oracle);
Parameters
base
address
Base asset address
quote
address
Quote asset address
oracle
IOracle
Oracle that is disabled
Emitted when a user accepts an oracle update early
event PendingOracleAccepted(address indexed user, address indexed base, address indexed quote, IOracle oracle);
Parameters
user
address
Address of the user which accepted the oracle data
base
address
Base asset address
quote
address
Quote asset address
oracle
IOracle
Oracle which was accepted
Emitted when an oracle override is removed
event OracleOverrideRemoved(address indexed user, address indexed base, address indexed quote);
Parameters
user
address
Address of the user which removed the oracle override
base
address
Base asset address
quote
address
Quote asset address
error AeraPeriphery__CallerIsNotAuthorized();
error AeraPeriphery__OracleMismatch();
error AeraPeriphery__CommitTimestampNotReached();
error AeraPeriphery__OracleUpdateDelayTooLong();
error AeraPeriphery__OracleConvertsOneBaseTokenToZeroQuoteTokens(address base, address quote);
error AeraPeriphery__NoPendingOracleUpdate();
error AeraPeriphery__OracleIsDisabled(address base, address quote, IOracle oracle);
error AeraPeriphery__CannotScheduleOracleUpdateForTheSameOracle();
error AeraPeriphery__OracleUpdateAlreadyScheduled();
error AeraPeriphery__ZeroAddressOracle();
error AeraPeriphery__OracleNotSet();
error AeraPeriphery__OracleAlreadySet();
error AeraPeriphery__OracleAlreadyDisabled();
error AeraPeriphery__ZeroAddressOwner();