Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ChainlinkCompositeOracleProvider

Git Source

State Variables

PRECISION

Fixed-point precision for internal calculations

uint256 private constant PRECISION = 1e36;

GRACE_PERIOD_TIME

Grace period time after the sequencer is back up

uint256 private constant GRACE_PERIOD_TIME = 3600;

sequencerUptimeFeed

Chainlink feed for the sequencer uptime

AggregatorV3Interface public immutable sequencerUptimeFeed;

configs

Array of 3 configs

Config[] public configs;

Functions

constructor

Contract constructor

constructor(AggregatorV3Interface _sequencerUptimeFeed, Config[] memory _configs);

Parameters

NameTypeDescription
_sequencerUptimeFeedAggregatorV3InterfaceL2 Sequencer uptime feed
_configsConfig[]Array of configs for feeds

price

Get the price of the asset

function price() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Price of the asset

decimals

Get the decimals of the price

function decimals() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Decimals of the price

_getCurrentDecimals

Get the current decimals of a config

function _getCurrentDecimals(Config memory config) internal view returns (uint256);

Parameters

NameTypeDescription
configConfigThe config to get decimals for

Returns

NameTypeDescription
<none>uint256The current decimals value

_validateSequencerStatus

Validate the sequencer status

function _validateSequencerStatus() internal view;

Errors

InvalidFeed

Error emitted when feed is invalid

error InvalidFeed();

InvalidStalePeriod

Error emitted when stale period is invalid

error InvalidStalePeriod();

StalePrice

Error emitted when price is stale

error StalePrice();

SequencerDown

Error emitted when sequencer is down

error SequencerDown();

GracePeriodNotOver

Error emitted when grace period is not over

error GracePeriodNotOver();

InvalidFeedPrice

Error emitted when price from feed is invalid

error InvalidFeedPrice();

Structs

Config

struct Config {
    AggregatorV3Interface feed;
    uint256 maxStalePeriod;
    uint256 assetDecimals;
    bool isInverted;
}