Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

Recommendation for tokenWeights to sum up to SAFE_MULTIPLIER

Summary

Sum of token weights may not add up to SAFE_MULTIPLIER

Vulnerability Details

Sum of token weights will be <= SAFE_MULTIPLIER. Ideally, token weights should add up to SAFE_MULTIPLIER.
However since division in Solidity results in numbers getting rounded down, sum of token weights will be <= SAFE_MULTIPLIER

Impact

Tools Used

Recommendations

Return the remaining weight subtracted from the first.

uint256 aWeight = _tokenAValue * SAFE_MULTIPLIER / _totalLpValue;
/*
uint256 bWeight = _tokenBValue * SAFE_MULTIPLIER / _totalLpValue
= (_totalLpValue - _tokenAValue) * SAFE_MULTIPLIER / _totalLpValue
= SAFE_MULTIPLIER - aWeight
*/
uint256 bWeight = SAFE_MULTIPLIER - aWeight;
return (
aWeight, bWeight
);
``
Updates

Lead Judging Commences

hans Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

INFO: Make token weights to sum up to 1

Support

FAQs

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