aave-oracle

Overview

The Aave Oracle is a contract that manages asset prices and price sources for the Aave Protocol on Aptos. It allows authorized administrators to set, update, and remove price feeds for assets, and provides functions to query asset prices.

Write Methods

set_asset_feed_id

public entry fun set_asset_feed_id(account: &signer, asset: address, feed_id: vector<u8>)

Sets the price feed ID for a given asset.

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
account&signerThe signer with admin privileges
assetaddressThe address of the asset for which feed is set
feed_idvector<u8>The ID of the Chainlink price feed for the asset

batch_set_asset_feed_ids

public entry fun batch_set_asset_feed_ids(account: &signer, assets: vector<address>, feed_ids: vector<vector<u8>>)

Sets the price feed IDs for multiple assets in a single transaction.

This method can only be called by a POOL_ADMIN or ASSET_LISTING_ADMIN. Please look at the acl_manage contract for further details on system roles.

Input Parameters:

NameTypeDescription
account&signerThe signer with admin privileges
assetsvector<address>The addresses of the assets for which feeds are being set
feed_idsvector<vector<u8>>The IDs of the Chainlink price feeds for each asset. Length must match the assets vector

remove_asset_feed_id

public entry fun remove_asset_feed_id(account: &signer, asset: address)

Removes the price feed for a given asset.

This method can only be called by a POOL_ADMIN or ASSET_LISTING_ADMIN. Please look at the acl_manage contract for further details on system roles.

Input Parameters:

NameTypeDescription
account&signerThe signer with admin privileges
assetaddressThe address of the asset to remove the feed for

batch_remove_asset_feed_ids

public entry fun batch_remove_asset_feed_ids(account: &signer, assets: vector<address>)

Removes the price feeds for multiple assets in a single transaction.

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
account&signerThe signer with admin privileges
assetsvector<address>The addresses of the assets to remove feeds for

View Methods

get_asset_price

#[view]public fun get_asset_price(asset: address): u256

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
u256The price of the asset in BASE_CURRENCY of the Aave market to its smallest unit

get_assets_prices

#[view]public fun get_assets_prices(assets: vector<address>): vector<u256>

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

Input Parameters:

NameTypeDescription
assetsvector<address>The list of assets addresses for which price is being queried

Return Values:

TypeDescription
vector<u256>The prices of the given assets in BASE_CURRENCY of the Aave market in wei

get_asset_price_decimals

#[view]public fun get_asset_price_decimals(): u8

Returns the number of decimals used for asset prices.

Return Values:

TypeDescription
u8The number of decimals for asset prices (18)

oracle_address

#[view]public fun oracle_address(): address

Returns the address of the oracle resource account.

Return Values:

TypeDescription
addressThe address of the oracle account

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.