跳到主要内容

Prices

Git Source

Mainnet: 0xa9537Cc42555564206D4E57c0eb6943d56E83A30

Inherits: IPrices, Ownable

Manage and normalizes ETH price feeds.

State Variables

targetDecimals

The target number of decimals the price feed results have.

uint256 public constant override targetDecimals = 18;

feedDecimalAdjuster

The number to multiply each price feed by to get to the target decimals.

mapping(uint256 => uint256) public override feedDecimalAdjuster;

feedFor

The available price feeds that can be used to get the price of ETH.

mapping(uint256 => AggregatorV3Interface) public override feedFor;

Functions

getETHPriceFor

Gets the current price of ETH for the provided currency.

function getETHPriceFor(uint256 _currency) external view override returns (uint256);

Parameters

NameTypeDescription
_currencyuint256The currency to get a price for.

Returns

NameTypeDescription
<none>uint256price The price of ETH with 18 decimals.

addFeed

Add a price feed for the price of ETH.

Current feeds can't be modified.

function addFeed(AggregatorV3Interface _feed, uint256 _currency) external override onlyOwner;

Parameters

NameTypeDescription
_feedAggregatorV3InterfaceThe price feed being added.
_currencyuint256The currency that the price feed is for.