Oracles
Contract to get asset prices and manage price sources.
The source code is available on GitHub.
This contract is owned by the Nexus Governance.
Write Methods
setAssetSources
Sets the price sources for given list of assets.
This method can only be called by a POOL_ADMIN
or ASSET_LISTING_ADMIN
. Please look at the ACLManager
contract for further details on system roles.
Input Parameters:
assets
address[]
The addresses of the assets for which source is being set
sources
address[]
The address of the source of each asset. Length of assets and sources array should be same
setFallbackOracle
Sets/updates the fallbackOracle.
This method can only be called by a POOL_ADMIN
or ASSET_LISTING_ADMIN
. Please look at the ACLManager contract for further details on system roles.
Input Parameters:
fallbackOracle
address
The address of the fallback oracle
View Methods
getAssetPrice
Returns the price of the supported asset in BASE_CURRENCY
of the Nexus Market in wei.
Input Parameters:
asset
address
The address of the asset
Return Values:
uint256
The price of the asset in BASE_CURRENCY
of the Nexus market in wei
getAssetsPrices
Returns a list of prices from a list of the supported assets addresses in BASE_CURRENCY
of the Nexus Market. All prices are in wei.
Input Parameters:
assets
address[]
The list of assets addresses for which price is being queried
Return Values:
uint256[]
The prices of the given assets in BASE_CURRENCY
of the Nexus market in wei
getSourceOfAsset
Returns the address of the price source for an asset address.
Input Parameters:
asset
address
The address of the asset
Return Values:
address
The address of the source
getFallbackOracle
Returns the address of the fallback oracle.
Return Values:
address
The address of the fallback oracle
PriceOracleSentinel
The PriceOracleSentinel contract validates if the operations are allowed depending on the PriceOracle health.
This feature introduces a grace period for liquidations and disables borrowing under specific circumstances.
This feature has been specifically designed for L2s to handle eventual downtime of the sequencer (but can be extended to handle other cases, even on L1s, in the future).
Once the PriceOracle gets up after an outage or downtime, users can make their positions healthy during a grace period. The PriceOracle is considered healthy once its completely up and the grace period has passed.
The source code is available on GitHub.
Write Methods
setSequencerOracle
Updates the address of the sequencer oracle.
This method can only be called by PoolAdmin.
Input Parameters:
newSequencerOracle
address
The address of the new Sequencer Oracle to be set
setGracePeriod
Updates the duration of the grace period.
Can only be called by PoolAdmin or RiskAdmin.
Input Parameters:
newGracePeriod
uint256
The duration of new grace period in seconds
View Methods
isBorrowAllowed
Returns true if the borrow operation is allowed. The operation is not allowed when PriceOracle is down or the grace period has not passed.
Return Values:
bool
Returns true
if the borrow operation is allowed (the PriceOracle
is up and grace period has passed), false
otherwise
isLiquidationAllowed
Returns true if the liquidation operation is allowed. The operation is not allowed when PriceOracle
is down or the grace period has not passed.
Return Values:
bool
Returns true
if the liquidation operation is allowed (the PriceOracle is up and grace period has passed), false
otherwise
getSequencerOracle
Returns the SequencerOracle.
Return Values:
address
The address of the sequencer oracle contract
getGracePeriod
Returns the grace period.
Return Values:
uint256
The duration of the grace period in seconds
Last updated
Was this helpful?