Aave.

Пост

Поделитесь своими знаниями.

Aaveator.
Mar 07, 2023
Экспертные Вопросы и Ответы

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
Поделиться
Комментарии
.

Ответы

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
Комментарии
.

Знаете ответ?

Пожалуйста, войдите в систему и поделитесь им.

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

213Посты230Ответы
Sui.X.Peera.

Заработай свою долю из 1000 Sui

Зарабатывай очки репутации и получай награды за помощь в развитии сообщества Sui.