OracleRef

A reference to an oracle contract

Contract

OracleRef.sol implements IOracleRef, CoreRef

Description

OracleRef is an abstract contract which references an oracle. It defines some basic utilities useful for contracts referencing an oracle.

The contract allows for updating or reading from the oracle. The oracle price is reported as FEI per X where X is some other asset like ETH, USDC, or USD depending on the oracle needs.

It allows Governor⚖️to change the referenced Oracle

Events

OracleUpdate
OracleUpdate

Referenced oracle contract update

type

param

description

address indexed

_oracle

new oracle

Read-Only Functions

oracle

function oracle() external view returns (IOracle);

Returns the address of the referenced oracle as an interface.

peg

function peg() external view returns (Decimal.D256 memory);

Returns the output of oracle().read(), reverts if the oracle is invalid.

invert

function invert(Decimal.D256 calldata price)
external
pure
returns (Decimal.D256 memory);

Inverts a price to be reported in the reverse direction. When applied to peg it reports X per FEI wher X is some underlying asset.

Public State-Changing Functions

updateOracle

function updateOracle() external returns (bool);

Pass-through updates the referenced oracle.

Governor-Only⚖️ State-Changing Functions

setOracle

function setOracle(address _oracle) external;

Sets the address of the referenced oracle to _oracle.

emits OracleUpdate

ABIs