Aave.

Bài viết

Chia sẻ kiến thức của bạn.

Aaveator.
Mar 07, 2023
Hỏi đáp Chuyên Gia

Getting a execution reverted message: code: -32000 calling a new function

I'm banging my head against the wall with this problem:

When I supplyLiquidity and using the contract's address for onBehalfOf, I can later approve the contract address on the WETH gateway and withdrawLiquidity no problem. Works every time.

function supplyLiquidityContract() external payable{
       address onBehalfOf = address(this);
       WETHGateway.depositETH{value: msg.value}(pool, onBehalfOf, 0);
   }
   function withdrawlLiquidity() external{
       uint256 balance = AaveWMatic.balanceOf(address(this));

       AaveWMatic.approve(address(WETHGateway), balance);
       WETHGateway.withdrawETH(pool, balance, address(this));
   }

If instead I supplyLiquidity using msg.sender as onBehalfOf, and later transfer that aToken to the contract, I should then be able to withdrawLiquidty from the contract the same as before, but it consistently reverts, even though everything from approvals to aToken balance on the contract appear to be right.

revert message is 
"code": -32000,
"message": "execution reverted"

am I missing something? why would it matter if the contract's Aave tokens came from a transfer from another account first instead of directly with supply liquidity?

  • Aave Protocol
  • aTokens
0
1
Chia sẻ
Bình luận
.

Câu trả lời

1
Aaveator.
Mar 9 2023, 13:54

1 is a really bad number to use and just doesn't work, were 2 or higher might if there's any native tokens in the contract so you can burn your aTokens.

The withdrawETH function will not work on testnet markets. All reserves on Aave testnet markets are custom mintable tokens, so the WETH or WMATIC on testnet markets (like kovan testnet) is not backed by real ETH/MATIC, so there is nothing to withdraw.

0
Bình luận
.

Bạn có biết câu trả lời không?

Hãy đăng nhập và chia sẻ nó.

Chúng tôi sử dụng cookie để đảm bảo bạn có trải nghiệm tốt nhất trên trang web của chúng tôi.
Thêm thông tin