Incorrect assumption on call reverting when DAI is not purchased
Summary
Incorrect assumption on call reverting when DAI is not purchased leads to execution continuing when DAI has not been purchased
Vulnerability Detail
In L170 and L174 the previous DAI balance is stored in daibought and then subtracted from the current DAI balance. This subtraction will not revert if no DAI has been bought as assumed by the comments, it will result in a value of 0
Impact
An attempt to rebalance and sell USSD which does not result in DAI being purchased will be valid and not revert as desired
m4ttm
medium
Incorrect assumption on call reverting when DAI is not purchased
Summary
Incorrect assumption on call reverting when DAI is not purchased leads to execution continuing when DAI has not been purchased
Vulnerability Detail
In L170 and L174 the previous DAI balance is stored in
daibought
and then subtracted from the current DAI balance. This subtraction will not revert if no DAI has been bought as assumed by the comments, it will result in a value of 0Impact
An attempt to rebalance and sell USSD which does not result in DAI being purchased will be valid and not revert as desired
Code Snippet
https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/USSDRebalancer.sol#L167
Tool used
Manual Review
Recommendation
Check that the DAI balance has increased, ideally by at least a desired amount