Post
Share your knowledge.
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
Answers
11 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.
Do you know the answer?
Please log in and share it.
Aave is a decentralized non-custodial liquidity protocol where users can participate as depositors or borrowers.
- Error "No matching key" when trying to unstake USDC on BNB chain32
- How to tell the code to, rather than "deposit 1 eth worth of WBTC" deposit "500$ worth of WBTC"?22
- How to interpret configuration field in a response from the getReserveData view function in Aave v2?21
- Getting a return value of '25 - INVALID BURN AMOUNT'21
- Is there any way to stake in the security module on Görli?23