Ring Protocol
Search
K
Comment on page

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 RUSD 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
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 RUSD wher X is some underlying asset.

Governor-Only⚖️ State-Changing Functions

setOracle

function setOracle(address _oracle) external;
Sets the address of the referenced oracle to _oracle.
emits OracleUpdate

ABIs

oracleref.json
3KB
Code
OracleRef ABI
ioracleref.json
1KB
Code
OracleRef Interface ABI
Last modified 2yr ago