Price Oracle

Throughout the Aave Protocol, we require reliable, up to date, and secure price feeds. Our proxy price provider contract provides this capability and works by:

  1. First checking for a price from a Chainlink aggregator.

  2. If the price is below or equal to zero, we call our fallback price oracle.

    1. In the future, Aave governance mechanisms will manage the selection of sources and the fallback price oracle.

The source code can be found on the verified Etherscan contract.

If you need development support, join the #developers channel on our Aave community Discord server.

Always get the latest price oracle address by calling getPriceOracle() on the LendingPoolAddressProvider contract.

View Methods

getAssetPrice**()**

function getAssetPrice(address _asset) public view returns(uint256)

Returns the price of the supported _asset in market base currency. The Aave V2 Ethereum market uses ETH based oracles which return values in wei units. All other V2 markets use USD based oracles which return values with 8 decimals.

Parameter NameTypeDescription

_asset

address

address of the underlying asset

getAssetsPrices**()**

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

Returns array of prices for designated _assets in market base currency. The Aave V2 Ethereum market uses ETH based oracles which return values in wei units. All other V2 markets use USD based oracles which return values with 8 decimals.

Parameter NameTypeDescription

_assets

address[ ]

an array of addresses of the underlying assets

getSourceOfAsset()

function getSourceOfAsset(address _asset) external view returns(uint256)

Returns the address of the price source for _asset.

Parameter NameTypeDescription

_asset

address

address of the underlying asset

getFallbackOracle**()**

function getFallbackOracle() external view returns(uint256)

Returns the address of the fallback oracle.

ABI

Price Oracle ABIs

[ { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address[]", "name": "sources", "type": "address[]" }, { "internalType": "address", "name": "fallbackOracle", "type": "address" }, { "internalType": "address", "name": "weth", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": true, "internalType": "address", "name": "source", "type": "address" } ], "name": "AssetSourceUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "fallbackOracle", "type": "address" } ], "name": "FallbackOracleUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "weth", "type": "address" } ], "name": "WethSet", "type": "event" }, { "inputs": [], "name": "WETH", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "asset", "type": "address" } ], "name": "getAssetPrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" } ], "name": "getAssetsPrices", "outputs": [ { "internalType": "uint256[]", "name": "", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getFallbackOracle", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "asset", "type": "address" } ], "name": "getSourceOfAsset", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address[]", "name": "sources", "type": "address[]" } ], "name": "setAssetSources", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "fallbackOracle", "type": "address" } ], "name": "setFallbackOracle", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }][ { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address[]", "name": "sources", "type": "address[]" }, { "internalType": "address", "name": "fallbackOracle", "type": "address" }, { "internalType": "address", "name": "weth", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": true, "internalType": "address", "name": "source", "type": "address" } ], "name": "AssetSourceUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "fallbackOracle", "type": "address" } ], "name": "FallbackOracleUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "weth", "type": "address" } ], "name": "WethSet", "type": "event" }, { "inputs": [], "name": "WETH", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "asset", "type": "address" } ], "name": "getAssetPrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" } ], "name": "getAssetsPrices", "outputs": [ { "internalType": "uint256[]", "name": "", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getFallbackOracle", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "asset", "type": "address" } ], "name": "getSourceOfAsset", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address[]", "name": "sources", "type": "address[]" } ], "name": "setAssetSources", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "fallbackOracle", "type": "address" } ], "name": "setFallbackOracle", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }][ { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address[]", "name": "sources", "type": "address[]" }, { "internalType": "address", "name": "fallbackOracle", "type": "address" }, { "internalType": "address", "name": "baseCurrency", "type": "address" }, { "internalType": "uint256", "name": "baseCurrencyUnit", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, { "indexed": true, "internalType": "address", "name": "source", "type": "address" } ], "name": "AssetSourceUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "baseCurrency", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "baseCurrencyUnit", "type": "uint256" } ], "name": "BaseCurrencySet", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "fallbackOracle", "type": "address" } ], "name": "FallbackOracleUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "BASE_CURRENCY", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "BASE_CURRENCY_UNIT", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "asset", "type": "address" } ], "name": "getAssetPrice", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" } ], "name": "getAssetsPrices", "outputs": [ { "internalType": "uint256[]", "name": "", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getFallbackOracle", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "asset", "type": "address" } ], "name": "getSourceOfAsset", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address[]", "name": "sources", "type": "address[]" } ], "name": "setAssetSources", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "fallbackOracle", "type": "address" } ], "name": "setFallbackOracle", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }]

Last updated