Skip to main content

OracleRouterBase

OracleRouterBase​

MIN_DRIFT​

uint256 MIN_DRIFT

MAX_DRIFT​

uint256 MAX_DRIFT

FIXED_PRICE​

address FIXED_PRICE

STALENESS_BUFFER​

uint256 STALENESS_BUFFER

decimalsCache​

mapping(address => uint8) decimalsCache

feedMetadata​

function feedMetadata(address asset) internal view virtual returns (address feedAddress, uint256 maxStaleness)

The price feed contract to use for a particular asset along with maximum data staleness

Parameters​

NameTypeDescription
assetaddressaddress of the asset

Return Values​

NameTypeDescription
feedAddressaddressaddress of the price feed for the asset
maxStalenessuint256maximum acceptable data staleness duration

price​

function price(address asset) external view virtual returns (uint256)

Returns the total price in 18 digit unit for a given asset.

Parameters​

NameTypeDescription
assetaddressaddress of the asset

Return Values​

NameTypeDescription
[0]uint256uint256 unit price for 1 asset unit, in 18 decimal fixed

getDecimals​

function getDecimals(address _feed) internal view virtual returns (uint8)

cacheDecimals​

function cacheDecimals(address asset) external returns (uint8)

Before an asset/feed price is fetches for the first time the decimals need to be cached. This is a gas optimization

Parameters​

NameTypeDescription
assetaddressaddress of the asset

Return Values​

NameTypeDescription
[0]uint8uint8 corresponding asset decimals

shouldBePegged​

function shouldBePegged(address _asset) internal view returns (bool)