LendingPool
contract is the main contract of the protocol. It exposes all the user-oriented actions that can be invoked using either Solidity or web3 libraries. The source code can be found here.function deposit( address _reserve, uint256 _amount, uint16 _referralCode)
_amount
of an asset specified by the _reserve
parameter._referralCode
input explanations, please refer to the referral program section of this documentation. During testing, you can use the referral code: 0
.LendingPoolCore
contract (which is different from the LendingPool
contract) will need to have the relevant allowance via approve()
of _amount
for the underlying ERC20 of the _reserve
asset you are depositing._amount
deposit()
method must match the msg.value
parameter of the transaction, and be included in your deposit()
call. lendingPool.deposit{ value: msg.value }(reserve, msg.value, referralCode)
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
_reserve
parameter corresponds to the ERC20 contract address of the underlying asset.function setUserUseReserveAsCollateral(address _reserve, bool _useAsCollateral)
_useAsCollateral
function borrow(address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode)
_reserve
parameter to the msg.sender
, provided that the caller has preemptively deposited enough collateral to cover the borrow._referralCode
input explanations, please refer to the referral program section of this documentation. During testing, you can use the referral code: 0
._amount
_interestRateMode
uint
2 representing variable rate and uint
1 representing stable ratefunction repay( address _reserve, uint256 _amount, address payable _onBehalfOf)
_onBehalfOf
parameter can be used to repay the debt of a different user.user
debt on their behalf, the third-party address needs to approve()
the LendingPoolCore
contract (which is different from the LendingPool
contract) with _amount
of the underlying ERC20 of the _reserve
contract._amount
uint(-1)
as a value for _amount
, ONLY when the repayment is not executed on behalf of a 3rd party. _amount
slightly higher than the current borrowed amount._onBehalfOf
msg.sender
function swapBorrowRateMode(address _reserve)
msg.sender
's borrow rate modes between stable and variable.function rebalanceStableBorrowRate(address _reserve, address _user)
_user
. If the user is not borrowing at a stable rate or the conditions for the rebalance are not satisfied, the transaction gets reverted. _user
user
to rebalancefunction liquidationCall(address _collateral, address _reserve, address _user, uint256 _purchaseAmount, bool _receiveaToken)
approve()
the LendingPoolCore
contract (which is different from the LendingPool
contract) to use _purchaseAmount
of the underlying ERC20 of the _reserve
asset used for the liquidation._user
position)._purchaseAmount
parameter can be set to uint(-1)
and the protocol will proceed with the highest possible liquidation allowed by the close factor.msg.value
of the transaction should be equal to the _purchaseAmount
parameter._collateral
_user
_purchaseAmount
_receiveaToken
function flashLoan(address payable _receiver, address _reserve, uint _amount, bytes memory _params) external
_reserve
pool, a certain _amount
of liquidity, that must be returned before the end of the transaction._receiver
receiver
of the borrowed assets_amount
_params
executeOperation()
functionfunction getReserveConfigurationData(address _reserve)
return
nametrue
, reserve asset can be used as collateral for borrowingtrue
, reserve asset can be borrowedtrue
, reserve asset can be borrowed with stable rate modetrue
, users can interact with reserve assetfunction getReserveData(address _reserve)
reserve
poolreturn
namereserve
total liquidityreserve
available liquidity for borrowing_reserve
reserve
datafunction getUserAccountData(address _user)
user
addressreturn
nameuser
aggregated deposits across all the reserves. In Weiuser
aggregated collateral across all the reserves. In Weiuser
aggregated outstanding borrows across all the reserves. In Weiuser
aggregated current outstanding fees in ETH. In Weiuser
available amount to borrow in ETHuser
current average liquidation threshold across all the collaterals depositeduser
average Loan-to-Value between all the collateralsuser
current Health Factorfunction getUserReserveData(address _reserve, address _user)
user
data on a specific reservereturn
nameuser
current reserve
aToken balanceuser
current reserve
outstanding borrow balanceuser
balance of borrowed assetuser
borrow rate mode either Stable or Variableuser
current earn rate on _reserve
user
outstanding loan origination feeuser
variable cumulative indexfunction getReserves()
LendingPool
contract produces events that can be monitored on the Ethereum blockchain. For more information on emitted events and filters, refer to the official solidity documentation.reserve
is defined by the smart-contract of the asset used for the method interaction. 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
return
nameuser
ReferralCode
for referral programsreturn
nameuser
return
nameuser
0
for None, 1
for stable and 2
for variableReferralCode
for referral programsreturn
nameuser
repayer
return
nameuser
0
for None, 1
for stable and 2
for variablereturn
name