IOracleRegistry

Inherits: IOracle

Interface for an Oracle Registry

Functions

addOracle

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

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

oracle

IOracle

Oracle to add

scheduleOracleUpdate

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

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

oracle

IOracle

Oracle to schedule

commitOracleUpdate

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

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

cancelScheduledOracleUpdate

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

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

disableOracle

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

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

oracle

IOracle

Oracle that is to be disabled

acceptPendingOracle

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

Name
Type
Description

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

removeOracleOverride

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

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

user

address

The vault address removing the override

getQuoteForUser

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

Name
Type
Description

baseAmount

uint256

Amount of base asset

base

address

Base asset address

quote

address

Quote asset address

user

address

Vault address

Returns

Name
Type
Description

<none>

uint256

value of the base asset in terms of the quote asset

getOracleData

Return oracle metadata for base/quote

function getOracleData(address base, address quote) external view returns (OracleData memory data);

Parameters

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

Returns

Name
Type
Description

data

OracleData

Oracle data

Events

OracleSet

Emitted when an oracle is added

event OracleSet(address indexed base, address indexed quote, IOracle indexed oracle);

Parameters

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

oracle

IOracle

Added oracle

OracleScheduled

Emitted when an oracle update is scheduled

event OracleScheduled(
    address indexed base, address indexed quote, IOracle indexed pendingOracle, uint32 commitTimestamp
);

Parameters

Name
Type
Description

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

OracleUpdateCancelled

Emitted when an oracle update is cancelled

event OracleUpdateCancelled(address indexed base, address indexed quote);

Parameters

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

OracleDisabled

Emitted when an oracle is disabled

event OracleDisabled(address indexed base, address indexed quote, IOracle indexed oracle);

Parameters

Name
Type
Description

base

address

Base asset address

quote

address

Quote asset address

oracle

IOracle

Oracle that is disabled

PendingOracleAccepted

Emitted when a user accepts an oracle update early

event PendingOracleAccepted(address indexed user, address indexed base, address indexed quote, IOracle oracle);

Parameters

Name
Type
Description

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

OracleOverrideRemoved

Emitted when an oracle override is removed

event OracleOverrideRemoved(address indexed user, address indexed base, address indexed quote);

Parameters

Name
Type
Description

user

address

Address of the user which removed the oracle override

base

address

Base asset address

quote

address

Quote asset address

Errors

AeraPeriphery__CallerIsNotAuthorized

error AeraPeriphery__CallerIsNotAuthorized();

AeraPeriphery__OracleMismatch

error AeraPeriphery__OracleMismatch();

AeraPeriphery__CommitTimestampNotReached

error AeraPeriphery__CommitTimestampNotReached();

AeraPeriphery__OracleUpdateDelayTooLong

error AeraPeriphery__OracleUpdateDelayTooLong();

AeraPeriphery__OracleConvertsOneBaseTokenToZeroQuoteTokens

error AeraPeriphery__OracleConvertsOneBaseTokenToZeroQuoteTokens(address base, address quote);

AeraPeriphery__NoPendingOracleUpdate

error AeraPeriphery__NoPendingOracleUpdate();

AeraPeriphery__OracleIsDisabled

error AeraPeriphery__OracleIsDisabled(address base, address quote, IOracle oracle);

AeraPeriphery__CannotScheduleOracleUpdateForTheSameOracle

error AeraPeriphery__CannotScheduleOracleUpdateForTheSameOracle();

AeraPeriphery__OracleUpdateAlreadyScheduled

error AeraPeriphery__OracleUpdateAlreadyScheduled();

AeraPeriphery__ZeroAddressOracle

error AeraPeriphery__ZeroAddressOracle();

AeraPeriphery__OracleNotSet

error AeraPeriphery__OracleNotSet();

AeraPeriphery__OracleAlreadySet

error AeraPeriphery__OracleAlreadySet();

AeraPeriphery__OracleAlreadyDisabled

error AeraPeriphery__OracleAlreadyDisabled();

AeraPeriphery__ZeroAddressOwner

error AeraPeriphery__ZeroAddressOwner();

Last updated