The source code can be found on Github here.

Example code

For example code interacting with LendingPool methods, checkout integration guides 👇🏻

Asset / Debt Management

Flash Loan

Liquidations

Contract API reference

Write Methods

deposit()

function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode)

Deposits amount of an asset into the protocol, minting the same amount of corresponding aTokens, and transferring them to the onBehalfOf address.

The referralCode is emitted in deposit event and can be for third party referral integrations.

<aside> 💡 When depositing, the LendingPool contract must have**allowance()to spend funds on behalf ofmsg.sender** for at-least**amount** for the asset being deposited. This can be done via the standard ERC20 approve() method.

</aside>

call params

withdraw()

function withdraw(address asset, uint256 amount, address to)

Withdraws amount of the underlying asset, i.e. redeems the underlying token and burns the aTokens.

<aside> 💡 When withdrawing toanother address,**msg.sender**should haveaToken that will be burned by lendingPool .

</aside>

Parameter Name Type Description
asset address address of the underlying asset, not the aToken
amount uint256 amount deposited, expressed in wei units. Use type(uint).max to withdraw the entire balance.
to address address that will receive the asset