Aave - Lending and Borrowing
Last updated
Last updated
Swap some ETH for WETH.
Deposit some WETH into Aave.
Borrow some asset against the collateral(deposit).
Challenge: Sell that borrowed asset (short selling)
Repay everything back.
aave testnet v2 is on kovan: aave testnet v3 is on rinkeby:
Integration test: Kovan (v2) / Rinkeby (v3)
Unit tests: Mainnet-fork
If you are not working with oracles and don't need to mock off-chain responses, use a mainnet fork to run unit tests.
When you deposit ETH into AAVE, it gets swapped to WEth (ERC20 version of ETH) and then deposited.
You will receive aETH which is the interest bearing token, reflective of your deposit and the interest it accrues.
The Aave deposit function will handle all the necessary conversions from ETH. However, we can save on gas by locking our ETH for WETH directly with the WETHGateway contract.
Objective: Get WETH by depositing ETH [call deposit function on WEth contract].
To interact with the contract, we need ABI + Address.
For ABI, use interface, IWEth.sol, from https://github.com/PatrickAlphaC/aave_brownie_py_freecode/tree/main/interfaces
create IWeth.sol in interfaces folder -> copy and paste github code into it.
On running get_weth.py successfully, you should see 0.1 WEth in your Metamask wallet.