All supply and borrow actions are done via LendingPool.
<aside> 💡 Always get latest LendingPool from the AddressProvider
</aside>
<aside>
💡 On deposit, LendingPool
pulls funds from the msg.sender
and transfers aTokens
to onBehalf
address.
</aside>
Only ERC20
tokens can be deposited into the LendingPool. If you want to use your native ETH (or MATIC in case of polygon), you can use wethGateway contract to easily wrap.
web3/ethers
solidity
<aside>
💡 onBehalfOf
must have enough collateral via deposit()
or have delegated credit to msg.sender
via approveDelegation()
. See the Credit Delegation guide for more details.
</aside>