Regarding depositWTH/withdrawETH of aave, I've faced to an issue.
Withdraw is failed with error 5 (VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE) sometimes on Kovan testnet.
No problem on hardhat(mainnet fork).
While repeating depositETH/withdrawETH, I was able to see withdrawing is failed randomly.
AAVE validates the amount and user balance before withdrawing as follows.
userBalance is gotten by following code in aave.
uint256 userBalance = IAToken(aToken).balanceOf(msg.sender);
I think msg.sender must be WETH GATEWAY.
So it means aTokens are not sent to WETH GATEWAY or delayed or spent by others, etc?
I confirmed my contract receives aTokens correctly after deposit and it has enough amount of aTokens before withdrawing.
By using following code.
Regarding depositWTH/withdrawETH of aave, I've faced to an issue. Withdraw is failed with error 5 (VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE) sometimes on Kovan testnet. No problem on hardhat(mainnet fork).
While repeating depositETH/withdrawETH, I was able to see withdrawing is failed randomly.
AAVE validates the amount and user balance before withdrawing as follows.
userBalance is gotten by following code in aave.
uint256 userBalance = IAToken(aToken).balanceOf(msg.sender);
I think msg.sender must be WETH GATEWAY. So it means aTokens are not sent to WETH GATEWAY or delayed or spent by others, etc?I confirmed my contract receives aTokens correctly after deposit and it has enough amount of aTokens before withdrawing. By using following code.
To summarize what I experienced:
Any ideas why this is happening?
Here is example of transaction which is failed. https://kovan.etherscan.io/tx/0x4fafd5770b768a38d9185b8304955d580dd8c3bb236e8145b4e354722d64b86b