Overview
Utilities for encoding Aave v3 Pool function calls and decoding responses. Supports repayment, withdrawal, and account data queries.Functions
encodeAaveRepay
Encodes calldata for the Aave Poolrepay() function.
The address of the reserve asset to repay
The amount to repay (in asset’s smallest unit). Use
MAX_UINT256 to repay entire debtThe interest rate mode:
1n for stable rate, 2n for variable rateThe address of the user whose debt will be repaid
Encoded calldata for Pool.repay()
encodeAaveWithdraw
Encodes calldata for the Aave Poolwithdraw() function.
The address of the reserve asset to withdraw
The amount to withdraw (in asset’s smallest unit)
The address that will receive the withdrawn assets
Encoded calldata for Pool.withdraw()
encodeAaveGetUserAccountData
Encodes calldata for the Aave PoolgetUserAccountData() view function.
The address of the user to query
Encoded calldata for Pool.getUserAccountData()
decodeAaveGetUserAccountData
Decodes the result fromgetUserAccountData() view function.
The raw return data from Pool.getUserAccountData()
Decoded user account data object
encodeAaveGetReserveTokensAddresses
Encodes calldata for the Aave PoolgetReserveTokensAddresses() view function.
The address of the reserve asset
Encoded calldata for Pool.getReserveTokensAddresses()
decodeAaveGetReserveTokensAddresses
Decodes the result fromgetReserveTokensAddresses() view function.
The raw return data from Pool.getReserveTokensAddresses()
Object containing the three token addresses for the reserve
Type Definitions
AaveUserAccountData
User’s account summary data from Aave v3.Total collateral in base currency units (e.g., USD with 8 decimals)
Total debt in base currency units
Available borrowing capacity in base currency units
Weighted average liquidation threshold (in basis points, e.g., 8500 = 85%)
Weighted average loan-to-value ratio (in basis points)
Health factor with 18 decimals (e.g., 1.5 = 1500000000000000000n). Below 1.0 means liquidatable
Constants
MAX_UINT256
amount parameter to repay or withdraw the entire balance.
Example: