Post
Share your knowledge.
Error when calling Aave lending pool's deposit function in Python using Brownie
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.
- Aave Protocol
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: 1. The `erc20_address` is wrong 2. You haven't called `approve` on your `erc20_address` for the `lending_pool` 3. Your `AMOUNT` is too high 4. You're working with a not supported ERC20
Do you know the answer?
Please log in and share it.
Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers.
- Marcador51Error "No matching key" when trying to unstake USDC on BNB chain32
- Aaveator138How to tell the code to, rather than "deposit 1 eth worth of WBTC" deposit "500$ worth of WBTC"?22
- Aaveator138How to interpret configuration field in a response from the getReserveData view function in Aave v2?21
- Aaveator138Getting a return value of '25 - INVALID BURN AMOUNT'21
- Aavenger45Is there any way to stake in the security module on Görli?23