#41272 [SC-Insight] Unnecessary precision loss due to division before multiplication in `getDistribution()`
Description
Brief/Intro
Vulnerability Details
function getDistribution(uint256 yeetAmount) public view returns (uint256, uint256, uint256, uint256, uint256) {
uint256 scale = gameSettings.SCALE();
@> uint256 valueAfterTax = (yeetAmount / scale) * (scale - TAX_PER_YEET);
@> uint256 valueToYeetBack = (yeetAmount / scale) * (YEETBACK_PERCENTAGE);
@> uint256 valueToPot = (yeetAmount / scale) * (scale - YEETBACK_PERCENTAGE - TAX_PER_YEET);
uint256 tax = yeetAmount - valueAfterTax;
@> uint256 valueToStakers = (tax / scale) * TAX_TO_STAKERS;
@> uint256 publicGoods = (tax / scale) * TAX_TO_PUBLIC_GOODS;
@> uint256 teamRevenue = (tax / scale) * TAX_TO_TREASURY;
return (valueToPot, valueToYeetBack, valueToStakers, publicGoods, teamRevenue);
}Impact Details
References
Proof of Concept
Proof of Concept
Previous#41256 [SC-Insight] Contradictory Documentation and actual functionNext#41270 [SC-Medium] Harvest timing exploit enables theft of unclaimed yield
Was this helpful?