pool.sol
contract is the main user facing contract of the protocol. It exposes the liquidity management methods that can be invoked using either Solidity or Web3 libraries.mintUnbacked (asset, amount, onBehalfOf, referralCode)
BRIDGE
role permission, to mint unbacked aTokens to the onBehalfOf
address. This method is part of the V3 Portal feature.BRIDGE
role. Bridge addresses can be whitelisted by the governance.backUnbacked (asset, amount, fee)
BRIDGE
role permission, to back the currently unbacked aTokens with amount
of underlying asset and pay fee
. This method is part of the V3 Portal feature.BRIDGE
role. Bridge addresses can be whitelisted by the governance.function rescueTokens(address token, address to, uint256 amount)
.
POOL_ADMIN
role. Pool admin is selected by the governance.function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode)
referralCode
is emitted in Supply event and can be for third party referral integrations. To activate referral feature and obtain a unique referral code, integrators need to submit proposal to Aave Governance.function supplyWithPermit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode, uint256 deadline, uint8 permitV, permitR, bytes32 permitS)
msg.sender
with spender as Pool address.function withdraw(address asset, uint256 amount, address to)
amount
of the underlying asset
, i.e. redeems the underlying token and burns the aTokens.to
another address, msg.sender
should have aToken
that will be burned by lendingPool .type(uint).max
to withdraw the entire balance.asset
function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf)
amount
of asset
with interestRateMode
, sending the amount
to msg.sender
, with the debt being incurred by onBehalfOf
.onBehalfOf
is not same as msg.sender
, then onBehalfOf
must have supplied enough collateral via supply()
and have delegated credit to msg.sender
via approveDelegation()
.function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf)
onBehalfOf
's debt amount
of asset
which has a rateMode
.function repayWithPermit(address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf, uint256 deadline, uint8 permitV, permitR, bytes32 permitS)
msg.sender
with spender value as Pool
address.function repayWithATokens(address asset,uint256 amount,uint256 interestRateMode)
function swapBorrowRateMode(address asset, uint256 rateMode)
msg.sender
's borrow rate mode between stable and variable.function rebalanceStableBorrowRate(address asset, address user)
user
for given asset
. In case of liquidity crunches on the protocol, stable rate borrows might need to be rebalanced to bring back equilibrium between the borrow and supply rates.function setUserUseReserveAsCollateral(address asset, bool useAsCollateral)
asset
of msg.sender
to be used as collateral or not.HEALTH_FACTOR_LIQUIDATION_THRESHOLD
on disabling the given asset as collateral.function liquidationCall(address collateral, address debt, address user, uint256 debtToCover, bool receiveAToken)
user
position).debtToCover
parameter can be set to uint(-1)
and the protocol will proceed with the highest possible liquidation allowed by the close factor.function flashLoan( address receiverAddress, address[] calldata assets, uint256[] calldata amounts, uint256[] interestRateModes, address onBehalfOf, bytes calldata params, uint16 referralCode)
function flashLoanSimple( address receiverAddress, address asset, uint256 amount, bytes calldata params, uint16 referralCode)
function mintToTreasury(address[] calldata assets)
function setUserEMode(uint8 categoryId)
HEALTH_FACTOR_LIQUIDATION_THRESHOLD
function getReserveData(address asset)
function getUserAccountData(address user)
function getConfiguration(address asset)
function getUserConfiguration(address user)
function getReserveNormalizedIncome(address asset)
function getReserveNormalizedVariableDebt(address asset)
function getReservesList()
function getEModeCategoryData(uint8 id)
function getUserEMode(address user)
function FLASHLOAN_PREMIUM_TOTAL() public view returns (uint128)
function FLASHLOAN_PREMIUM_TO_PROTOCOL() public view returns (uint128)