My goal: AAVE v3, deposit ETH, and borrow DAI

I played around with AAVE in lesson 10 of the Solidity, Blockchain, and Smart Contract Course, and as long as I stick to the course and use the v2 code provided in the lesson and repo it works just fine. So, I am trying to switch to v3 and here I got stuck.

Trying to deposit some ETH

from brownie import config, network, interface
from scripts.helpful_scripts import get_account

def get_weth(amount_in_eth):
    account = get_account()
    weth_gateway_address = config["networks"][network.show_active()]["WETHGateway"]
    pool_implementation = config["networks"][network.show_active()]["Pool-Implementation"]
    weth_gateway = interface.IWETHGateway(weth_gateway_address, account)
    tx = weth_gateway.depositETH(
        {"from": account, "value": amount_in_eth * 10**18},
    return tx

The script is called either using console or run with

(py39brown) AAVE>brownie run .\scripts\get_weth.py --network rinkeby

The interfaces are nicely converted into ABIs, so this should be OK.

This fails with the message:

ValueError: Gas estimation failed: 'execution reverted'. 
This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.

Here is the relevant part of my configuration, the addresses coming from here: AAVE docs, testnet addresses I am using Rinkeby.

  default: development
    WETHGateway: '0xD1DECc6502cc690Bc85fAf618Da487d886E54Abe'
    Pool-Implementation: '0x87530ED4bd0ee0e79661D65f8Dd37538F693afD5'
    PoolAddressesProvider-Aave: '0xBA6378f1c1D046e9EB0F538560BA7558546edF3C'
dotenv: .env
  from_key: ${PRIVATE_KEY}

My (probably wrong) understanding

The workflow should be like this:

  1. To get some collateral into the system I can use rinkeby ETH. Since ETH is not an ERC20 token, I have to use a wrapper. This will be provided by the WETHGateway.
  2. I am using the interface IWETHGateway.sol from the aave v3 repo like so weth_gateway = interface.IWETHGateway(weth_gateway_address, account) . I am using the rinkeby WETHGateway address from here and my own account.
  3. Having the WETHGateway contract object now, I (try to) deposit some ETH to the lending pool (right?) and in return will receive some aWETH on my account.
  4. Now I am supplying aWETH to an asset-specific pool address I am getting from the PoolAddressesProvider.
  5. the last step, I can now borrow another asset using the supplied aWETH.


  1. Is that generally correct or am I missing a step or mixing things up?
  2. What would be the address of the 'targeted pool' when using the depositETH function for rinkeby?

2 Answers 2


Can't say for sure, but "ValueError: Gas estimation failed: 'execution reverted'" may be an indication of depositiong account having insufficient ETH (0 to be precise).

You're sending pool_implementation as an address of the pool when depositing and it might be a problem as well. I suggest getting pool address via PoolAddressesProvider just to be sure.

I tried to use aaveV3 contracts for lesson 10 as well but chose more straightforward approach: aaveV3 core contracts (Pool and PoolAddressesProvider) instead of their V2 versions from the video + mintable tokens addresses for WETH and DAI. My config for rinkeby looks like this:

  weth_token: '0xd74047010D77c5901df5b0f9ca518aED56C85e8D'
  pool_addresses_provider: '0xBA6378f1c1D046e9EB0F538560BA7558546edF3C'
  dai_eth_price_feed: '0x74825DbC8BF76CC4e9494d0ecB210f676Efa001D'
  dai_token: '0x4aAded56bd7c69861E8654719195fCA9C670EB45'

This approach let me to supply with WETH and to borrow and repay some DAI. Unfortunately, current amounts of supplied in this manner testnet WETH and borrowed DAI can't be seen on dashboard, so my method is probably flawed in some way.

Please, let me know if you cracked the case of supplying with WETHGateway.

  • Thanks, I will try this and let you know, when I managed to solve this. Apr 7, 2022 at 14:31

if it useful, I was able to deposit eth using wethgateway. It is in Js, but can be implemented using brownie. https://github.com/cito-lito/thesis_dapp/blob/ba7b146e4b7a8ab85521c514345e334fd01f7970/lendingPoolAaveV3.js#L259

hope it helps : )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.