AssetHandler

Functions:

  • initialize(struct IAssetHandler.Asset[] assets)

  • getUSDPrice(address asset)

  • setChainlinkTimeout(uint256 newTimeoutPeriod)

  • addAsset(address asset, uint16 assetType, address aggregator)

  • addAssets(struct IAssetHandler.Asset[] assets)

  • removeAsset(address asset)

Events:

  • SetChainlinkTimeout(uint256 _chainlinkTimeout)

Function initialize(struct IAssetHandler.Asset[] assets)

initialisation for the contract

Parameters:

  • assets: An array of assets to initialise

Function getUSDPrice(address asset) → uint256 price

Currenly only use chainlink price feed.

Parameters:

  • asset: the asset address

Return Values:

  • price Returns the latest price of a given asset (decimal: 18)

Function setChainlinkTimeout(uint256 newTimeoutPeriod)

Setting the timeout for the Chainlink price feed

Parameters:

  • newTimeoutPeriod: A new time in seconds for the timeout

Function addAsset(address asset, uint16 assetType, address aggregator)

Add valid asset with price aggregator

Parameters:

  • asset: Address of the asset to add

  • assetType: Type of the asset

  • aggregator: Address of the aggregator

Function addAssets(struct IAssetHandler.Asset[] assets)

Add valid assets with price aggregator

Parameters:

  • assets: An array of assets to add

Function removeAsset(address asset)

Remove valid asset

Parameters:

  • asset: Address of the asset to remove

Last updated