Inadequate checks on withdrawAVAX()
and redeemAVAX()
in TokenggAVAX.sol
#202
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-65
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/TokenggAVAX.sol#L180-L189
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/TokenggAVAX.sol#L191-L203
Vulnerability details
Impact
As denoted in ggAVAX via ERC4626:
"When a user redeems their ggAVAX for AVAX, there has to be funds available that are not being staked by the minipools.
If there is no AVAX that has been unstaked yet, the redemtion call will fail and the user will have to come back another time."
With
protocolDAO.getTargetGGAVAXReserveRate() == 0.1 ether
, i.e. a tenth oftotalAssets()
, it could impose a tight limit in situations when there is a rush for the liquid stakers to withdraw or redeem their deposited AVAX. When these were to happen, a great multitude of stakers would be disappointed with repeated function reverts mostly due to transactions being front run by others.Proof of Concept
File: TokenggAVAX.sol#L180-L203
As can be seen from the code block above,
withdrawAVAX()
andredeemAVAX()
would only revert on the last code line of execution when the funds available dropped belowassets
.This could have been maximally mitigated from the beginning of the function logic by incorporating
maxWithdraw()
andmaxRedeem()
that had been implemented in the same contract, TokenggAVAX.sol.Tools Used
Manual inspection
Recommended Mitigation Steps
Consider having
withrawAVAX()
andredeemAVAX()
refactored as follows:The text was updated successfully, but these errors were encountered: