Error when calling Aave lending pool's deposit function in Python using Brownie
- Aave Protocol Aave
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.
-
It could be a number of things. The token address could be bad, you could have not approved your token on the
lending_pool
contract address, or you could be trying to deposit more tokens than you have. -
It could be a number of things you'll have to spend some time debugging:
- The
erc20_address
is wrong - You haven't called
approve
on yourerc20_address
for thelending_pool
- Your
AMOUNT
is too high - You're working with a not supported ERC2
- The