ChainlinkOracleAdapter.sol

ChainlinkOracleAdapter

Adapted from the official implementation.

feedRegistry

contract IFeedRegistry feedRegistry

The feed registry

Chainlink feed registry contract. See https://docs.chain.link/docs/data-feeds/feed-registry/

MAX_ACCEPTABLE_STALENESS

uint256 MAX_ACCEPTABLE_STALENESS

The maximum time allowed after the price update has happened. If the price was updated in more seconds than the maximum time, getPrice function returns zero.

weth

address weth

The address of the wrapped native asset.

wbtc

address wbtc

The address of the wrapped asset.

disabledAssets

mapping(address => bool) disabledAssets

Assets which are temporarily stopped.

constructor

constructor(address _feedRegistry, address _weth, address _wbtc) public

Constructor that sets the Chainlink feed registry and wrapped native contract.

Parameters

setAssetStatus

function setAssetStatus(address baseAsset, bool isEnabled) external

Function that disables and enables particular assets.

Parameters

supportsAsset

function supportsAsset(address _baseAsset, address _quoteAsset) external view returns (bool)

Checks if a token is supported.

Only the native token is supported as a quote.

Parameters

Return Values

getPrice

function getPrice(address _baseAsset, address _quoteAsset) external view returns (bool, uint256)

Returns the price of an asset denominated in the base asset.

Does not throw an error on failure but returns success = false.

Return Values

Last updated