The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Valid

Division Before Multiplication

Summary

The function distributeAssets performs division before multiplication, which can result in a loss of value of the variable costInEuros

Vulnerability Details

In the function distributeAssets, first the value of the variable _portion is calculated as:
uint256 _portion = asset.amount * _positionStake / stakeTotal;

This variable is then used to calculate costInEuros. But, this value will be smaller than the value had it performed this calculation with multiplication before division.

Hence, a smaller value of costInEuros is calculated.

Impact

Incorrect value of costInEuros is used.

Tools Used

Manual review

Recommendations

Perform multiplication before division.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

precision

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.