The funds of LPs for a token can be stuck in the contract if said token is disallowed while the LPs haven't yet redeemed all of the liquidity the provided for this token
In src/protocol/ThunderLoan::setAllowedToken
or src/protocol/ThunderLoanUpgraded::setAllowedToken
, disallowing a token takes immediate effect regardless of whether there is still liquidity in the corresponding AssetToken
contract that was provided prior to the disallow. This can lead to a permanent loss of funds of the LPs as they will unable to redeem said funds after the token has been disallowed.
in the terminal, run `forge test --mt testPermanetLossOfFundsAfterDisallow -vvv`
LP funds can become forever unredeemable.
Manual review
in src/protocol/ThunderLoan
and src/upgradedProtocol/ThunderLoanUpgraded
update the setAllowedToken
method as shown below.
Note, we shouldn't verify if there's still liquidity in the token to be disallowed by checking the assetToken's balance of the token to be disabled.
require(token.balanceOf(address(assetToken)) == 0, "Cannot disallow ....");
this makes it vulnerable to an unexpected token balance attack if someone forcefully sends some liquidity to the assetToken address through routes other than the deposit method thereby, making it impossible to ever disallow this token as there isn't any means through which we can remove excess/undesired balance from the contract.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.