Aave.

帖子

分享您的知识。

0x4e7e...6911.
Feb 02, 2024
专家问答

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
0
0
分享
评论
.
0x8744...6532.
Mar 21 2024, 14:43

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.

0x8744...6532.
Mar 21 2024, 14:44

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

你知道答案吗?

请登录并分享。

我们使用 cookie 确保您在我们的网站上获得最佳体验。
更多信息