The source code can be found on Github here.
For example code interacting with LendingPool methods, checkout integration guides 👇🏻
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>
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 to
another address,**msg.sender
**should haveaToken
that will be burned by lendingPool .
</aside>
Parameter Name | Type | Description |
---|---|---|
asset | address | address of the notion://www.notion.so/developers/deployed-contracts/deployed-contracts#supported-assets, 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 |