ParaSpaceOracle
Contract to get asset prices, manage price sources and update the fallback oracle
Use of Chainlink Aggregators as first source of price
If the returned price by a Chainlink aggregator is <= 0, the call is forwarded to a fallback oracle
Owned by the ParaSpace governance
ADDRESSES_PROVIDER
Returns the PoolAddressesProvider
Return Values
assetsSources
_fallbackOracle
BASE_CURRENCY
Returns the base currency address
Address 0x0 is reserved for USD as base currency.
Return Values
BASE_CURRENCY_UNIT
Returns the base currency unit
1 ether for ETH, 1e8 for USD.
Return Values
onlyAssetListingOrPoolAdmins
Only asset listing or pool admin can call functions marked by this modifier.
constructor
Constructor
Parameters
provider
contract IPoolAddressesProvider
The address of the new PoolAddressesProvider
assets
address[]
The addresses of the assets
sources
address[]
The address of the source of each asset
fallbackOracle
address
The address of the fallback oracle to use if the data of an aggregator is not consistent
baseCurrency
address
The base currency used for the price quotes. If USD is used, base currency is 0x0
baseCurrencyUnit
uint256
The unit of the base currency
setAssetSources
Sets or replaces price sources of assets
Parameters
assets
address[]
The addresses of the assets
sources
address[]
The addresses of the price sources
setFallbackOracle
Sets the fallback oracle
Parameters
fallbackOracle
address
The address of the fallback oracle
_setAssetsSources
Internal function to set the sources for each asset
Parameters
assets
address[]
The addresses of the assets
sources
address[]
The address of the source of each asset
_setFallbackOracle
Internal function to set the fallback oracle
Parameters
fallbackOracle
address
The address of the fallback oracle
getAssetPrice
Returns the asset price in the base currency
Parameters
asset
address
The address of the asset
Return Values
[0]
uint256
The price of the asset
getTokenPrice
Returns the price of a token
Parameters
asset
address
the asset address
tokenId
uint256
the token id
Return Values
[0]
uint256
The price of the given token
getTokensPrices
Returns a list of prices from a list of tokenIds
Parameters
asset
address
the asset address
tokenIds
uint256[]
The list of token ids
Return Values
[0]
uint256[]
The prices of the given tokens
getTokensPricesSum
Returns the sum of prices for list of tokenIds
Parameters
asset
address
the asset address
tokenIds
uint256[]
The list of token ids
Return Values
[0]
uint256
The prices of the given tokens
getAssetsPrices
Returns a list of prices from a list of assets addresses
Parameters
assets
address[]
The list of assets addresses
Return Values
[0]
uint256[]
The prices of the given assets
getSourceOfAsset
Returns the address of the source for an asset address
Parameters
asset
address
The address of the asset
Return Values
[0]
address
The address of the source
getFallbackOracle
Returns the address of the fallback oracle
Return Values
[0]
address
The address of the fallback oracle