Aave V3 Pool Contract
This contract is the main user-facing contract. Most user interactions with the Aave Protocol occur via the Pool contract. It exposes the liquidity management methods that can be invoked using either Solidity or Web3 libraries.
Pool. allows users to:
- Supply
- Withdraw
- Borrow
- Repay
- Enable/disable supplied assets as collateral
- Liquidate positions
- Execute Flash Loans
Pool is covered by a proxy contract and is owned by the Pool of the specific market. All admin functions are callable by the Pool contract defined in the Pool.
The source code is available on GitHub.
Write Methods
initialize
function initialize(IPoolAddressesProvider provider) external virtual
Initializes the Pool.
Function is invoked by the proxy contract when the Pool contract is added to the Pool of the market.
Caches the address of the Pool in order to reduce gas consumption on subsequent operations.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| provider | address | The address of the PoolAddressesProvider |
supply
function supply(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) public virtual override
Supplies a certain amount of an asset into the protocol, minting the same amount of corresponding aTokens and transferring them to the on address. For example, if a user supplies 100 USDC and onBehalfOf address is the same as msg., they will get 100 aUSDC in return.
The referral is emitted in Supply event and can be for third-party referral integrations. To activate the referral feature and obtain a unique referral code, integrators need to submit a proposal to Aave Governance.
The Pool needs an allowance() from msg. of at least the supply
amount. Set it with ERC-20 approve() on the underlying token.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset being supplied to the pool |
| amount | uint256 | The amount of asset to be supplied |
| onBehalfOf | address | The address that will receive the corresponding aTokens. This is the only address that will be able to withdraw the asset from the pool. This will be the same as msg.sender if the user wants to receive aTokens into their own wallet, or use a different address if the beneficiary of aTokens is a different wallet |
| referralCode | uint16 | Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men |
supplyWithPermit
function supplyWithPermit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) public virtual override
Supply with transfer approval of the asset to be supplied via permit function. This method removes the need for separate approval tx before supplying asset to the pool. See EIP-2612.
Permit signature must be signed by msg. with spender as Pool address.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of underlying asset being supplied. The same asset as used in permit v, s, and r |
| amount | uint256 | The amount of asset to be supplied and signed for approval. The same amount as used in permit v, s, and r |
| onBehalfOf | address | The address that will receive the aTokens. This will be the same as msg.sender if the user wants to receive aTokens into their own wallet, or use a different address if the beneficiary of aTokens is a different wallet |
| referralCode | uint16 | Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men |
| deadline | uint256 | The unix timestamp up until which the permit signature is valid |
| permitV | uint8 | The v parameter of the EIP-712 permit signature |
| permitR | bytes32 | The r parameter of the EIP-712 permit signature |
| permitS | bytes32 | The s parameter of the EIP-712 permit signature |
withdraw
function withdraw(address asset, uint256 amount, address to) public virtual override returns (uint256)
Withdraws an amount of underlying asset from the reserve, burning the equivalent aTokens owned. For example, if a user has 100 aUSDC and calls withdraw(), they will receive 100 USDC, burning the 100 aUSDC.
If user has any existing debt backed by the underlying token, then the maximum amount available to withdraw is the amount that will not leave user’s health factor < 1 after withdrawal.
When withdrawing to another address, msg. must hold the a
that Pool burns. Before withdrawing other assets, disable 0% LTV reserves as
collateral (with Pool. or a full withdrawal).
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset to withdraw, not the aToken |
| amount | uint256 | The underlying amount to be withdrawn (the amount supplied), expressed in wei units. Use type(uint256). to withdraw the entire aToken balance |
| to | address | The address that will receive the underlying asset. This will be the same as msg.sender if the user wants to receive the tokens into their own wallet, or use a different address if the beneficiary is a different wallet |
Return Values:
| Type | Description |
|---|---|
uint256 | The final amount withdrawn |
borrow
function borrow(
address asset,
uint256 amount,
uint256 interestRateMode,
uint16 referralCode,
address onBehalfOf
) public virtual override
Allows users to borrow a specific amount of the reserve underlying asset, provided the borrower has already supplied enough collateral, or they were given enough allowance by a credit delegator on the corresponding debt token (VariableDebtToken). For example, if a user borrows 100 USDC passing their own address as on, they will receive 100 USDC into their wallet and 100 variable debt tokens.
If on differs from msg., on must have enough
collateral via supply() and must delegate credit to msg. via
approve.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset to borrow |
| amount | uint256 | The amount to be borrowed, expressed in wei units |
| interestRateMode | uint256 | Should always be passed a value of 2 (variable rate mode) |
| referralCode | uint16 | Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men |
| onBehalfOf | address | This should be the address of the borrower calling the function if they want to borrow against their own collateral, or the address of the credit delegator if the caller has been given credit delegation allowance |
repay
function repay(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf
) public virtual override returns (uint256)
Repays a borrowed amount on a specific reserve, burning the equivalent debt tokens owned. For example, if a user repays 100 USDC, the 100 variable debt tokens owned by the on address will be burned.
msg. must first approve() the Pool on the underlying ERC-20 token
for at least the repay amount.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the borrowed underlying asset previously borrowed |
| amount | uint256 | The amount to repay, expressed in wei units. Use type(uint256). in order to repay the whole debt, ONLY when the repayment is not executed on behalf of a 3rd party. In case of repayments on behalf of another user, it’s recommended to send an amount slightly higher than the current borrowed amount |
| interestRateMode | uint256 | Only available option is 2 (variableRateMode) |
| onBehalfOf | address | The address of the user who will get their debt reduced/removed. This should be the address of the user calling the function if they want to reduce/remove their own debt, or the address of any other borrower whose debt should be removed |
repayWithPermit
function repayWithPermit(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) public virtual override returns (uint256)
Repay with transfer approval of the borrowed asset to be repaid, done via permit function. This method removes the need for separate approval tx before repaying asset to the pool. See EIP-2612.
Permit signature must be signed by msg. with spender value as Pool
address.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the borrowed underlying asset previously borrowed. The same asset as used in permit v, r, and s |
| amount | uint256 | The amount to repay, expressed in wei units. Use type(uint256). to repay the whole debt (only when repaying your own debt). The same amount as used in permit v, r, s |
| interestRateMode | uint256 | Only available option is 2 (variableRateMode) |
| onBehalfOf | address | The address of the user who will get their debt reduced/removed. This should be the address of the user calling the function if they want to reduce/remove their own debt, or the address of any other borrower whose debt should be removed |
| deadline | uint256 | The unix timestamp up until which the permit signature is valid |
| permitV | uint8 | The v parameter of the EIP-712 permit signature |
| permitR | bytes32 | The r parameter of the EIP-712 permit signature |
| permitS | bytes32 | The s parameter of the EIP-712 permit signature |
Return Values:
| Type | Description |
|---|---|
uint256 | The final amount repaid |
repayWithATokens
function repayWithATokens(address asset, uint256 amount, uint256 interestRateMode
) public virtual override returns (uint256)
Allows a user to repay a borrowed amount on a specific reserve using the reserve aTokens, burning the equivalent debt tokens. For example, a user repays 100 USDC using 100 aUSDC, burning 100 variable debt tokens. Passing type(uint256). as the amount will clean up any residual aToken dust balance, if the user aToken balance is not enough to cover the whole debt.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the borrowed underlying asset previously borrowed |
| amount | uint256 | The amount to repay. Use type(uint256). in order to repay the whole debt for asset to pay without leaving aToken dust |
| interestRateMode | uint256 | Only available option is 2 (variableRateMode) |
Return Values:
| Type | Description |
|---|---|
uint256 | The final amount repaid |
setUserUseReserveAsCollateral
function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) public virtual override
Allows suppliers to enable/disable a specific supplied asset as collateral. Sets the asset of msg. to be used as collateral or not.
- In an isolated E-Mode category, only assets in its collateral bitmap can be enabled as collateral.
- Assets with 0% LTV can’t be enabled as collateral.
- With open debt, you can’t disable collateral if that drops the Health Factor below
HEALTH_.FACTOR_ LIQUIDATION_ THRESHOLD
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset supplied |
| useAsCollateral | bool | true if the user wants to use the supply as collateral, false otherwise |
liquidationCall
function liquidationCall(
address collateralAsset,
address debtAsset,
address user,
uint256 debtToCover,
bool receiveAToken
) public virtual override
Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1.
When the health factor of a position is below 1, the caller (liquidator) repays the debt amount of debt of the user getting liquidated. This is part or all of the outstanding borrowed amount on behalf of the borrower. The caller then receives a proportional amount of the collateral (discounted amount of collateral) plus a liquidation bonus to cover market risk.
Liquidators can decide if they want to receive an equivalent amount of collateral aTokens instead of the underlying asset. When the liquidation is completed successfully, the health factor of the position is increased, bringing the health factor above 1.
Liquidators can repay up to 50% of the user’s total debt. The full debt of the reserve can be liquidated when the health factor is at or below 0.95, or when the user’s collateral or debt in the reserve is worth less than 2,000 base currency units (USD on most markets). The liquidation discount applies to this amount. See Liquidations.
- In most scenarios, profitable liquidators will choose to liquidate as much as they can.
debtparameter can be set toTo Cover type(uint256).and the protocol will proceed with the highest possible liquidation allowed by the close factor.max - To check a user’s health factor, use
get.User Account Data()
Liquidators must approve() the Pool contract to use debt of the
underlying ERC-20 of the asset used for the liquidation.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| collateralAsset | address | The address of the underlying asset used as collateral, to receive as result of the liquidation |
| debtAsset | address | The address of the underlying borrowed asset to be repaid with the liquidation |
| user | address | The address of the borrower getting liquidated |
| debtToCover | uint256 | The debt amount of borrowed asset the liquidator will repay |
| receiveAToken | bool | true if the liquidator wants to receive the aTokens equivalent of the purchased collateral, false if they want to receive the underlying collateral asset directly |
flashLoan
function flashLoan(
address receiverAddress,
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata interestRateModes,
address onBehalfOf,
bytes calldata params,
uint16 referralCode
) public virtual override
Allows users to access liquidity of the pool for a given list of assets within one transaction, as long as the amount taken plus a fee is returned. The receiver must approve the Pool contract for at least the amount borrowed + fee, otherwise the transaction will revert.
The flash loan fee is waived for approved FLASH_.
Flash loan receiver contracts carry security risks. Read the Flash Loan Developers Guide first.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| receiverAddress | address | The address of the contract receiving the flash-borrowed funds, implementing the IFlashLoanReceiver interface |
| assets | address[] | The addresses of the assets being flash-borrowed |
| amounts | uint256[] | The amounts of the assets being flash-borrowed. This needs to contain the same number of entries as assets |
| interestRateModes | uint256[] | The types of the debt position to open if the flash loan is not returned: 0 -> Don’t open any debt, the amount + fee must be paid in this case or just revert if the funds can’t be transferred from the receiver. 2 -> Open variable rate borrow position for the value of the amount flash-borrowed to the on address |
| onBehalfOf | address | The address that will receive the debt if the associated interest is 2. on must already have approved sufficient borrow allowance of the associated asset to msg. |
| params | bytes | Variadic packed params to pass to the receiver as extra information |
| referralCode | uint16 | Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men |
flashLoanSimple
function flashLoanSimple(
address receiverAddress,
address asset,
uint256 amount,
bytes calldata params,
uint16 referralCode
) public virtual override
Allows users to access liquidity of the pool for a given asset within one transaction, as long as the amount taken plus a fee is returned. The receiver must approve the Pool contract for at least the amount borrowed + fee, otherwise the transaction will revert.
This function does not waive the fee for approved FLASH_, nor does it allow for opening a debt position instead of repaying.
Flash loan receiver contracts carry security risks. Read the Flash Loan Developers Guide first.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| receiverAddress | address | The address of the contract receiving the flash-borrowed funds, implementing the IFlashLoanReceiver interface |
| asset | address | The address of the asset being flash-borrowed |
| amount | uint256 | The amount of the asset being flash-borrowed |
| params | bytes | Variadic packed params to pass to the receiver as extra information |
| referralCode | uint16 | Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men |
mintToTreasury
function mintToTreasury(address[] calldata assets) external virtual override
Mints the assets accrued through the reserve factor to the treasury in the form of aTokens for the given list of assets.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| assets | address[] | The list of reserves for which the minting needs to be executed |
finalizeTransfer
function finalizeTransfer(
address asset,
address from,
address to,
uint256 scaledAmount,
uint256 scaledBalanceFromBefore
) external virtual override
Validates and finalizes an aToken transfer. It is only callable by the overlying aToken of the asset.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset of the aToken |
| from | address | The user from which the aTokens are transferred |
| to | address | The user receiving the aTokens |
| scaledAmount | uint256 | The scaled amount being transferred/withdrawn |
| scaledBalanceFromBefore | uint256 | The aToken scaled balance of the from user before the transfer |
setUserEMode
function setUserEMode(uint8 categoryId) external virtual override
Allows a user to use the protocol in efficiency mode. The category id must be a valid id already defined by Pool or Risk Admins.
Reverts if the user borrows an incompatible asset or if the change drops the
Health Factor below HEALTH_.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| categoryId | uint8 | The eMode category id (0 - 255) defined by Risk or Pool Admins. category set to 0 is a non eMode category |
initReserve
function initReserve(
address asset,
address aTokenAddress,
address variableDebtAddress
) external virtual override onlyPoolConfigurator
Initializes a reserve, activating it, assigning an aToken and debt tokens. All reserves share the interest rate strategy returned by RESERVE_.
Only callable by the Pool contract.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset of the reserve |
| aTokenAddress | address | The address of the aToken that will be assigned to the reserve |
| variableDebtAddress | address | The address of the VariableDebtToken that will be assigned to the reserve |
setConfiguration
function setConfiguration(address asset, DataTypes.ReserveConfigurationMap calldata configuration) external virtual override onlyPoolConfigurator
Sets the configuration bitmap of the reserve as a whole.
Only callable by the Pool contract.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset of the reserve |
| configuration | Data | The new configuration bitmap |
See the bit layout under getConfiguration.
updateFlashloanPremium
function updateFlashloanPremium(uint128 flashLoanPremium) external virtual override onlyPoolConfigurator
Updates the flash loan premium. The protocol treasury collects the whole premium, which is calculated on the total borrowed amount.
Only callable by the Pool contract.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| flashLoanPremium | uint128 | The flash loan premium, expressed in bps |
configureEModeCategory
function configureEModeCategory(uint8 id, DataTypes.EModeCategoryBaseConfiguration calldata category) external virtual override onlyPoolConfigurator
Configures a new eMode category or alters an existing one. In eMode, the protocol allows very high borrowing power to borrow assets of the same category. The category 0 is reserved for volatile heterogeneous assets and it’s always disabled.
Only callable by the Pool contract.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| id | uint8 | The id of the category |
| category | Data | The configuration of the category |
The DataTypes.EModeCategoryBaseConfiguration struct is composed of the following fields:
| Name | Type | Description |
|---|---|---|
| ltv | uint16 | The custom Loan to Value for the eMode category |
| liquidationThreshold | uint16 | The custom liquidation threshold for the eMode category |
| liquidationBonus | uint16 | The liquidation bonus for the eMode category |
| isolated | bool | If true, only assets in the category’s collateral bitmap contribute LTV (Aave V3.7) |
| label | string | The custom label describing the eMode category |
configureEModeCategoryIsolated
function configureEModeCategoryIsolated(uint8 id, bool isolated) external virtual override onlyPoolConfigurator
Sets the isolated flag of an eMode category. When a category is isolated, users with collateral enabled on assets outside the category cannot enter it, and assets outside the category’s collateral bitmap are treated as LTV 0. Added in Aave V3.7.
Only callable by the Pool contract.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| id | uint8 | The id of the category |
| isolated | bool | true if the eMode category is isolated |
rescueTokens
function rescueTokens(address token, address to, uint256 amount) external virtual override onlyPoolAdmin
Rescue and transfer tokens locked in this contract.
Only callable by the POOL_ role, which
governance selects.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| token | address | The address of the token |
| to | address | The address of the recipient |
| amount | uint256 | The amount of token to transfer |
eliminateReserveDeficit
function eliminateReserveDeficit(address asset, uint256 amount) external override onlyUmbrella returns (uint256)
Covers the deficit of a specified reserve by burning the equivalent aToken amount for assets with virtual accounting enabled or the equivalent amount of underlying for assets with virtual accounting disabled (e.g. GHO). Only callable by address with only modifier.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | Underlying token address |
| amount | uint256 | The amount to be covered, in aToken or underlying on non-virtual accounted assets |
Return Values:
| Type | Description |
|---|---|
uint256 | The amount of tokens burned |
View Methods
getUserAccountData
function getUserAccountData(address user) external view virtual override returns (
uint256 totalCollateralBase,
uint256 totalDebtBase,
uint256 availableBorrowsBase,
uint256 currentLiquidationThreshold,
uint256 ltv,
uint256 healthFactor
)
Returns the user account data across all the reserves.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| user | address | The address of the user |
Return Values:
| Name | Type | Description |
|---|---|---|
| totalCollateralBase | uint256 | The total collateral of the user in the base currency used by the price feed |
| totalDebtBase | uint256 | The total debt of the user in the base currency used by the price feed |
| availableBorrowsBase | uint256 | The borrowing power left of the user in the base currency used by the price feed |
| currentLiquidationThreshold | uint256 | The liquidation threshold of the user |
| ltv | uint256 | The loan to value of the user |
| healthFactor | uint256 | The current health factor of the user |
getConfiguration
function getConfiguration(address asset) external view virtual override returns (DataTypes.ReserveConfigurationMap memory)
Returns the configuration of the reserve.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset of the reserve |
Return Values:
| Type | Description |
|---|---|
Data | The configuration of the reserve |
The DataTypes.ReserveConfigurationMap struct is composed of the following fields:
| bit | Description |
|---|---|
0-15 | LTV |
16-31 | Liquidation threshold |
32-47 | Liquidation bonus |
48-55 | Decimals |
56 | Reserve is active |
57 | Reserve is frozen |
58 | Borrowing is enabled |
59 | Deprecated Stable rate borrowing enabled |
60 | Asset is paused |
61 | Deprecated Borrowing in isolation mode is enabled |
62 | Deprecated Siloed borrowing is enabled |
63 | Flashloaning enabled |
64-79 | Reserve factor |
80-115 | Borrow cap in whole tokens, borrowCap == 0 => no cap |
116-151 | Supply cap in whole tokens, supplyCap == 0 => no cap |
152-167 | Liquidation protocol fee |
168-175 | Deprecated EMode category |
176-211 | Deprecated Unbacked mint cap |
212-251 | Deprecated Debt ceiling for isolation mode |
252 | Deprecated Virtual accounting is enabled |
253-255 | Unused |
getUserConfiguration
function getUserConfiguration(address user) external view virtual override returns (DataTypes.UserConfigurationMap memory)
Returns the configuration of the user across all the reserves.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| user | address | The user address |
Return Values:
| Type | Description |
|---|---|
Data | The configuration of the user |
The DataTypes.UserConfigurationMap struct is composed of the following fields:
| Name | Type | Description |
|---|---|---|
| data | uint256 | Bitmap of the user’s collaterals and borrows, two bits per reserve in get order. For reserve index i, bit 2*i is set if the user borrows the reserve and bit 2*i+1 is set if the user uses it as collateral |
For example, 0x40020 (binary 1000000000000100000) sets bit 5 and bit 18: bit 5 = 3rd reserve used as collateral, bit 18 = 10th reserve borrowed.
getReserveNormalizedIncome
function getReserveNormalizedIncome(address asset) external view virtual override returns (uint256)
Returns the ongoing normalized income for the reserve.
A value of 1e27 means there is no income. As time passes, the yield is accrued. A value of 2*1e27 means for each unit of asset, one unit of income has been accrued.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset of the reserve |
Return Values:
| Type | Description |
|---|---|
uint256 | The reserve’s normalized income |
getReserveNormalizedVariableDebt
function getReserveNormalizedVariableDebt(address asset) external view virtual override returns (uint256)
Returns the normalized variable debt per unit of asset.
A value of 1e27 means there is no debt. As time passes, the debt is accrued. A value of 2*1e27 means that for each unit of debt, one unit worth of interest has been accumulated.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset of the reserve |
Return Values:
| Type | Description |
|---|---|
uint256 | The reserve normalized variable debt |
getReservesList
function getReservesList() external view virtual override returns (address[] memory)
Returns the list of the underlying assets of all the initialized reserves. It does not include dropped reserves.
Return Values:
| Type | Description |
|---|---|
address[] | The addresses of the underlying assets of the initialized reserves |
getReserveAddressById
function getReserveAddressById(uint16 id) external view returns (address)
Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| id | uint16 | The id of the reserve as stored in the DataTypes.ReserveData struct |
Return Values:
| Type | Description |
|---|---|
address | The address of the reserve associated with id |
getEModeCategoryData
function getEModeCategoryData(uint8 id) external view virtual override returns (DataTypes.EModeCategoryLegacy memory)
Returns the data of an eMode category.
Deprecated. Use the independent getters instead, such as
get, get and
get.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| id | uint8 | The id of the category |
Return Values:
| Type | Description |
|---|---|
Data | The configuration data of the category |
The DataTypes.EModeCategoryLegacy struct is composed of the following fields:
| Name | Type | Description |
|---|---|---|
| ltv | uint16 | The custom Loan to Value for the eMode category |
| liquidationThreshold | uint16 | The custom liquidation threshold for the eMode category |
| liquidationBonus | uint16 | The liquidation bonus for the eMode category |
| priceSource | address | Deprecated |
| label | string | The custom label describing the eMode category |
getIsEModeCategoryIsolated
function getIsEModeCategoryIsolated(uint8 id) external view returns (bool)
Returns whether an eMode category is isolated. Added in Aave V3.7.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| id | uint8 | The id of the category |
Return Values:
| Type | Description |
|---|---|
bool | true if the eMode category is isolated |
getReserveData
function getReserveData(address asset) external view virtual override returns (DataTypes.ReserveDataLegacy memory)
Returns the state and configuration of the reserve.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the underlying asset of the reserve |
Return Values:
| Type | Description |
|---|---|
Data | The state and configuration data of the reserve |
The DataTypes.ReserveDataLegacy struct is composed of the following fields:
| Name | Type | Description |
|---|---|---|
| configuration | Reserve | Stores the reserve configuration |
| liquidityIndex | uint128 | The yield generated by the reserve during time interval since lastUpdatedTimestamp. Expressed in ray |
| currentLiquidityRate | uint128 | The current supply rate. Expressed in ray |
| variableBorrowIndex | uint128 | The yield accrued by reserve during time interval since lastUpdatedTimestamp. Expressed in ray |
| currentVariableBorrowRate | uint128 | The current variable borrow rate. Expressed in ray |
| currentStableBorrowRate | uint128 | Deprecated in Aave V3.2 |
| lastUpdateTimestamp | uint40 | The timestamp of when reserve data was last updated. Used for yield calculation |
| id | uint16 | The id of the reserve. It represents the reserve’s position in the list of active reserves |
| aTokenAddress | address | The address of associated aToken |
| stableDebtTokenAddress | address | Deprecated in Aave V3.2 |
| variableDebtTokenAddress | address | The address of associated variable debt token |
| interestRateStrategyAddress | address | Deprecated in Aave V3.4. Use RESERVE_ on the Pool |
| accruedToTreasury | uint128 | The current treasury balance (scaled) |
| unbacked | uint128 | Deprecated in Aave V3.4 |
| isolationModeTotalDebt | uint128 | Deprecated in Aave V3.7 |
getUserEMode
function getUserEMode(address user) external view virtual override returns (uint256)
Returns eMode the user is using. 0 is a non eMode category.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| user | address | The address of the user |
Return Values:
| Type | Description |
|---|---|
uint256 | The eMode id |
FLASHLOAN_PREMIUM_TOTAL
function FLASHLOAN_PREMIUM_TOTAL() public view virtual override returns (uint128)
Returns the percent of total flashloan premium paid by the borrower. The whole premium is accrued to the treasury.
Return Values:
| Type | Description |
|---|---|
uint128 | The total fee on flashloans |
FLASHLOAN_PREMIUM_TO_PROTOCOL
function FLASHLOAN_PREMIUM_TO_PROTOCOL() public view virtual override returns (uint128)
Returns the share of the flash loan premium sent to the treasury. Always 100_ (100%) since Aave V3.4.
Return Values:
| Type | Description |
|---|---|
uint128 | The share of the premium sent to the treasury, in bps |
MAX_NUMBER_RESERVES
function MAX_NUMBER_RESERVES() public view virtual override returns (uint16)
Returns the maximum number of reserves supported to be listed in this Pool.
Return Values:
| Type | Description |
|---|---|
uint16 | The maximum number of reserves supported |
getLiquidationGracePeriod
function getLiquidationGracePeriod(address asset) external view virtual override returns (uint40)
Returns the liquidation grace period of the given asset
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | Underlying token address |
Return Values:
| Type | Description |
|---|---|
uint40 | Timestamp when the liquidation grace period will end |
getReserveDeficit
function getReserveDeficit(address asset) external view returns (uint256);
Returns the current deficit of a reserve.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | Underlying token address |
Return Values:
| Type | Description |
|---|---|
uint256 | Current reserve deficit from undercollateralized borrow positions |
getReserveAToken
function getReserveAToken(address asset) external view returns (address);
Returns the aToken address of a reserve.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | Underlying token address |
Return Values:
| Type | Description |
|---|---|
address | The address of the AToken |
getReserveVariableDebtToken
function getReserveVariableDebtToken(address asset) external view returns (address);
Returns the variableDebtToken address of a reserve.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| asset | address | Underlying token address |
Return Values:
| Type | Description |
|---|---|
address | The address of the VariableDebtToken |