RPCRequestError while depositing WETH on aave v2 lending pool

164 Views Asked by At

while I am trying to use deposit() function from Aave v2 lending pool on goerli testnet, to deposit WETH token to the lending pool, the transaction is getting reverted and the error is following:

RPCRequestError: Accessing TransactionReceipt.revert_msg on a reverted transaction requires the debug_traceTransaction RPC endpoint, but the node client does not support it or has not made it available.

Everything works fine on the local mainnet-fork network.

Here is the relevant piece of code which I am using:

account = get_account()
erc20_address = config["networks"][network.show_active()]["weth_token"]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
    get_weth()
lending_pool = get_lending_pool_contract()
approve_erc20(
    amount, 
    lending_pool.address, 
    erc20_address, 
    account
)
print("Depositing...")
deposit_tx = lending_pool.deposit(
    erc20_address, 
    amount, 
    account.address, 
    0, 
    {"from": account, "gas_limit": 1000000, "allow_revert": True}
)
deposit_tx.wait(1)
print("Deposited!")

Worth mentioning that function approve_erc20() and related to it approve() transaction succeeds as it should. here is the code:

def approve_erc20(amount, spender, erc20_address, account):
    print("Approving ERC20 token...")
    erc20 = interface.IERC20(erc20_address)
    tx = erc20.approve(spender, amount, {"from": account})
    tx.wait(1)
    print("Approved!")
    return tx
  • Since Brownie, as a default node, uses Infura for the goerli testnet I changed the host to the Alchemy, thought that would help but it gave me a whole different error:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://eth-goerli.g.alchemy.com/v2/$WEB3_ALCHEMY_PROJECT_ID

Changed it as it was before and right now I am lost.

What can be done here?

1

There are 1 best solutions below

0
On

if it works on your local env and not on server and you have used waits, maybe that waits are not enough? have you tried different amount?
also I would suggest you to post question on NFT specific stacoverflow distro

https://ethereum.stackexchange.com/