PermissionedLendingPool
Last updated
Last updated
The PermissionedLendingPool
contract is the main contract adding the "permissions" layer to Aave Arc. It exposes all the user-oriented actions that can be invoked using either Solidity or Web3 libraries.
The source code can be found on Github here.
Pool methods deposit
, borrow
, withdraw
and repay
are only for ERC20. For ETH , use PermissionedWETHGateway
Allows whitelisted depositors to deposit amount
of an asset
into the market, minting the same amount
of corresponding aTokens, and transferring them to the onBehalfOf
address.
OnBehalfOf
must be whitelisted for DEPOSITOR
role.
permissionAdmin
that whitelisted onBehalfOf
must be still valid.
When depositing, the PermissionedLendingPool
contract must have allowance
to spend funds on behalf of msg.sender
at-least for amount
of the asset
being deposited. This can be done via the standard ERC20 approve()
method.
Params | Type | Description |
---|---|---|
Allows whitelisted depositors to withdraw amount
of the underlying asset
, i.e. burn aToken to redeem the underlying token.
msg.sender
must be whitelisted for DEPOSITOR role.
When withdrawing to
another address, msg.sender
should have aToken
that will be burned by lendingPool .
Allows whitelisted Borrowers amount
of asset
with interestRateMode
, sending the borrowed amount
to msg.sender
and the debt incurred by onBehalfOf
.
msg.sender
and onBehalfOf
must be whitelisted for BORROWER
role. permissionAdmin
that whitelisted onBehalfOf
must be still valid.
onBehalfOf
must have enough collateral supplied to the pool via deposit() or have delegated credit to msg.sender
via approveDelegation()
Repays onBehalfOf
's debtamount
of asset
which has a rateMode
.
OnBehalfOf
must be whitelisted for BORROWER role.
permissionAdmin
that whitelisted onBehalfOf
must be still valid.
Swaps the msg.sender
's borrow rate modes between stable and variable.
msg.sender
must be whitelisted for BORROWER role.
permissionAdmin
that whitelisted msg.sender
must be still valid.
Sets the asset
of msg.sender
to be used as collateral or not.
msg.sender
must be whitelisted for DEPOSITOR role.
permissionAdmin
that whitelisted msg.sender
must be still valid.
Allows, whitelisted liquidators to liquidate positions with health factor below 1.
msg.sender
must be whitelisted for LIQUIDATOR role.
permissionAdmin
that whitelisted msg.sender
must be still valid.
Also, see our Liquidations guide and LendingPool liquidationCall for more details.
In order to reduce gas usage and code size, Aave contracts return numbered errors. If you are making calls to the protocol and receive numbered errors, you can use our error code reference guide to know what the error number means. Alternatively, you can also find what the numbers represent by checking the Errors.sol
Params | Type | Description |
---|---|---|
Params | Type | Description |
---|---|---|
Params | Type | Description |
---|---|---|
Params | Type | |
---|---|---|
Params | Type | Description |
---|---|---|
asset
address of the underlying asset
amount
amount deposited, expressed in wei units
onBehalfOf
address whom will receive the aTokens. Use msg.sender when the aTokens should be sent to the caller.
referralCode
referral code for 3rd party referral program integration. Use 0 for no referral.
asset
address of the underlying asset, not the aToken
amount
amount deposited, expressed in wei units. Use type(uint).max to withdraw the entire balance.
to
address that will receive the asset
asset
address of the underlying asset
amount
amount to be borrowed, expressed in wei units
interestRateMode
the type of borrow debt. Stable: 1, Variable: 2
referralCode
referral code for our referral program. Use 0 for no referral code.
onBehalfOh
address of user who will incur the debt. Use msg.sender when not calling on behalf of a different user.
asset
address of the underlying asset
amount
amount to be borrowed, expressed in wei units. Use uint(-1) to repay the entire 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.
rateMode
the type of borrow debt. Stable: 1, Variable: 2
onBehalfOf
address of user who will incur the debt. Use msg.sender when not calling on behalf of a different user.
asset
address of the underlying asset
rateMode
the rate mode the user is swapping from. Stable: 1, Variable: 2
asset
address of the underlying asset
useAsCollateral
true
if the asset should be used as collateral