AaveOracle

Contract to get asset prices and manage price sources.

The source code is available on GitHub.

This contract is owned by the Aave Governance.

Write Methods

setAssetSources

function setAssetSources(address[] calldata assets, address[] calldata sources) external override onlyAssetListingOrPoolAdmins

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:

NameTypeDescription
assetsaddress[]The addresses of the assets for which source is being set
sourcesaddress[]The address of the source of each asset. Length of assets and sources array should be same

setFallbackOracle

function setFallbackOracle(address fallbackOracle) external override onlyAssetListingOrPoolAdmins

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:

NameTypeDescription
fallbackOracleaddressThe address of the fallback oracle

View Methods

getAssetPrice

function getAssetPrice(address asset) public view override returns (uint256)

Returns the price of the supported asset in BASE_CURRENCY of the Aave Market in wei.

Input Parameters:

NameTypeDescription
assetaddressThe address of the asset

Return Values:

TypeDescription
uint256The price of the asset in BASE_CURRENCY of the Aave market in wei

getAssetsPrices

function getAssetsPrices(address[] calldata assets) external view override returns (uint256[] memory)

Returns a list of prices from a list of the supported assets addresses in BASE_CURRENCY of the Aave Market. All prices are in wei.

Input Parameters:

NameTypeDescription
assetsaddress[]The list of assets addresses for which price is being queried

Return Values:

TypeDescription
uint256[]The prices of the given assets in BASE_CURRENCY of the Aave market in wei

getSourceOfAsset

function getSourceOfAsset(address asset) external view override returns (address)

Returns the address of the price source for an asset address.

Input Parameters:

NameTypeDescription
assetaddressThe address of the asset

Return Values:

TypeDescription
addressThe address of the source

getFallbackOracle

function getFallbackOracle() external view returns (address)

Returns the address of the fallback oracle.

Return Values:

TypeDescription
addressThe 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

function setSequencerOracle(address newSequencerOracle) external onlyPoolAdmin

Updates the address of the sequencer oracle.

This method can only be called by PoolAdmin.

This method can only be called by the Role Admin, specified by Aave Governance, responsible for managing the POOL_ADMIN role.

Input Parameters:

NameTypeDescription
newSequencerOracleaddressThe address of the new Sequencer Oracle to be set

setGracePeriod

function setGracePeriod(uint256 newGracePeriod) public onlyRiskOrPoolAdmins

Updates the duration of the grace period.

Can only be called by PoolAdmin or RiskAdmin.

Input Parameters:

NameTypeDescription
newGracePerioduint256The duration of new grace period in seconds

View Methods

isBorrowAllowed

function isBorrowAllowed() external view override returns (bool)

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:

TypeDescription
boolReturns true if the borrow operation is allowed (the PriceOracle is up and grace period has passed), false otherwise

isLiquidationAllowed

function isLiquidationAllowed() external view override returns (bool)

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:

TypeDescription
boolReturns true if the liquidation operation is allowed (the PriceOracle is up and grace period has passed), false otherwise

getSequencerOracle

function getSequencerOracle() external view returns (address)

Returns the SequencerOracle.

Return Values:

TypeDescription
addressThe address of the sequencer oracle contract

getGracePeriod

function getGracePeriod() external view returns (uint256)

Returns the grace period.

Return Values:

TypeDescription
uint256The duration of the grace period in seconds

Aave.com provides information and resources about the fundamentals of the decentralised non-custodial liquidity protocol called the Aave Protocol, comprised of open-source self-executing smart contracts that are deployed on various permissionless public blockchains, such as Ethereum (the "Aave Protocol" or the "Protocol"). Aave Labs does not control or operate any version of the Aave Protocol on any blockchain network.