Aave.

Publication

Partagez vos connaissances.

Aaveator.
Mar 07, 2023
Questions et Réponses avec des Experts

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
Partager
Commentaires
.

Réponses

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
Commentaires
.

Connaissez-vous la réponse ?

Veuillez vous connecter et la partager.

Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers.

213Publications230Réponses
Sui.X.Peera.

Gagne ta part de 1000 Sui

Gagne des points de réputation et obtiens des récompenses pour avoir aidé la communauté Sui à se développer.