Error when calling Aave lending pool's deposit function in Python using Brownie

Expert

I'm encountering an issue while calling the deposit function on the Aave lending pool in my Python code using Brownie. I've already approved the ERC20 token and am attempting to make a deposit, but the transaction is failing with the following error:

File "brownie/_cli/run.py", line 51, in main
    ...
ValueError: Execution reverted during call: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, include `allow_revert:True` as a transaction parameter.

Here is my python code:

def main():
    account = get_account()
    erc20_address = config['networks'][network.show_active()]['weth_token']

    lending_pool_addresses_provider = interface.IPoolAddressesProvider(
        config['networks'][network.show_active()]['pool_addresses_provider']
    )
    lending_pool_address = lending_pool_addresses_provider.getPool()
    lending_pool = interface.IPool(lending_pool_address)
    
    approve_erc20(lending_pool.address, AMOUNT, erc20_address, account)
    
    tx = lending_pool.deposit(
        erc20_address,
        AMOUNT,
        account.address,
        0,
        {'from': account, 'gas_limit': 500000, 'allow_revert': True}
    )

The error suggests that the execution reverted during the call, and it advises including allow_revert: True as a transaction parameter. However, I'm still facing the issue even after adding this parameter.

What could be causing this error? Any insights or guidance on resolving this error would be greatly appreciated.

Answers 0