Closed sherlock-admin closed 7 months ago
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
Makes no difference
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
Makes no difference
Invalid, checks are correct, no issue here
Bauchibred
medium
Slippage check in
redeemDollar
is wrongly appliedProof of Concept
Here is how an attempt on redemption need to be queried: UbiquityPoolFacet.sol#L92-L104
Now, take a look at LibUbiquityPool.sol#L399-L466
Evidently, this function is used to burn the redeemable Ubiquity Dollars and send back the collateral token for every Ubiquity Dollar burned, now as tagged by the "@audit", during the execution there is a slippage check
Now, issue is that right before this line there is a different slippage check (or a check to ensure that enough collateral exists), but this check uses the wrong value for collaterals, i.e
collateralOut
instead ofcollateralOutMin
, what this essentially leads to is that whenevercollateralOutMin
<=(IERC20(poolStorage.collateralAddresses[collateralIndex])).balanceOf(address(this)).sub(poolStorage.unclaimedPoolCollateral[collateralIndex])
<collateralOut
the transaction reverts, where as it shouldn't since there is available collateral to redeem as much ascollateralOutMin
which is user's accepted slippage valueImpact
Asides what's been explained in Proof of Concept Slippage is not user provided value, so in the case where the collateral token is dropping in USD price and user wants to sell off their tokens, they can't do that cause the execution would revert leading to users to lose assets in
US$
value.Code Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol#L399-L466
Recommended Mitigation Steps
Modify the checks, first check that
collateralOut >= collateralOutMin
then check to see if there is enough pool collateral forcollateralOut
, if no, then check if there is enough pool collateral forcollateralOutMin