Ring Protocol
Search…
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

1
function oracle() external view returns (IOracle);
Copied!
Returns the address of the referenced oracle as an interface.

peg

1
function peg() external view returns (Decimal.D256 memory);
Copied!
Returns the output of oracle().read(), reverts if the oracle is invalid.

invert

1
function invert(Decimal.D256 calldata price)
2
external
3
pure
4
returns (Decimal.D256 memory);
Copied!
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

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

ABIs

oracleref.json
3KB
Binary
OracleRef ABI
ioracleref.json
1KB
Binary
OracleRef Interface ABI
Last modified 4mo ago