BondingCurveOracle

An oracle which references a bonding curve price

Contract

โ€‹BondingCurveOracle.sol implements IBondingCurveOracle, CoreRef, Timedโ€‹

Description

The BondingCurveOracle contract pegs to a linked bonding curve price pre Scale and to a normal UniswapOracle post Scale.

The contract stores the bonding curve (pre-Scale) and Uniswap (post-scale) oracle contracts to reference.

Updates to the bonding curve oracle update the linked uniswap oracle.

Thawing

Additionally, the contract includes the "thawing" process. Thawing implements the initial pegged price lower than the target uniswap/bonding curve price. The reported peg linearly converges on the target peg over a preset duration window. The duration window d is 2 weeks. At the beginning of the window it reports the peg at the initial price I and at the end it will report the peg at the target price T. Let t be the timestamp between [0,d]. The reported oracle price O during the thawing period is:

Events

Update
Update

new reported peg

type

param

description

uint256

_peg

new peg value

Read-Only Functions

read

function read() external view returns (Decimal.D256 memory, bool);

Reads the oracle value and reports the peg as FEI per underlying. The boolean value returned informs whether the reported oracle value is valid. Invalid value means the oracle is uninitialized or the contract is paused.

This method is pausable. If paused, it won't revert but it will return valid as false

isOutdated

function isOutdated() external view returns (bool);

Pass through calls uniswapOracle.isOutdated(), if false, then multiple read functions relying on the oracle would be inaccurate.

uniswapOracle

function uniswapOracle() external returns (IOracle);

The referenced Uniswap Oracleโ€‹

bondingCurve

function bondingCurve() external returns (IBondingCurve);

The referenced Bonding Curveโ€‹

initialUSDPrice

function initialUSDPrice() external returns (Decimal.D256 memory);

The initial price to thaw from during the thawing period reported as USD per FEI.

This is capped at $1 even if the genesis group pays more than $1 due to the buffer

Public State-Changing Functions

update

function update() external returns (bool);

Pass-through updates uniswapOracle

GenesisGroup-Only๐Ÿš€ State-Changing Functions

init

function init(Decimal.D256 calldata initialPrice) external;

called by the GenesisGroup with the initial price to thaw from

ABIs