You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.
sherlock-admin opened this issue
May 23, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
J4de
medium
USSDRebalancer.sol#BuyUSSDSellCollateral
has a loss of precisionSummary
The
BuyUSSDSellCollateral
has a loss of precision causing collateral sells less than expectedVulnerability Detail
If the
collateralval
is large and theamountToBuyLeftUSD
is small, the result of((amountToBuyLeftUSD * 1e18 / collateralval) / 1e18)
is0
.Impact
Collateral sells less than expected causing may depeg of USSD prices.
Code Snippet
https://github.com/USSDofficial/ussd-contracts/blob/f44c726371f3152634bcf0a3e630802e39dec49c/contracts/USSDRebalancer.sol#L121
Tool used
Manual Review
Recommendation
It is recommended to change the order of calculation
Duplicate of #656
The text was updated successfully, but these errors were encountered: