The Standard

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

The remaining EUROs tokens after executing the distributeFees function are frozen in the contract

Summary

The remaining EUROs tokens after executing the distributeFees function are frozen in the contract

Vulnerability Details

When calling the distributeFees function for EUROs token distribution, if there are any _amount * positions[_holder].TST / tstTotal and _amount * pendingStakes[i].TST / tstTotal due to the loss of calculation accuracy, the calculation result is: 0. Then the _amount of EUROs tokens will not be fully distributed. The remaining portion will be frozen in the LiquidationPool contract.

##Impact
When the distributeFees function is called to distribute EUROs tokens, the remaining parts will be frozen in the LiquidationPool contract.

Tools Used

Recommendations

function distributeFees(uint256 _amount) external onlyManager {
uint256 tstTotal = getTstTotal();
uint256 Total = 0;
if (tstTotal > 0) {
IERC20(EUROs).safeTransferFrom(msg.sender, address(this), _amount);
for (uint256 i = 0; i < holders.length; i++) {
address _holder = holders[i];
positions[_holder].EUROs += _amount * positions[_holder].TST / tstTotal;
Total += positions[_holder].EUROs;
}
for (uint256 i = 0; i < pendingStakes.length; i++) {
pendingStakes[i].EUROs += _amount * pendingStakes[i].TST / tstTotal;
Total += pendingStakes[i].EUROs;
}
if (Total > _amount)
IERC20(EUROs).safeTransferFrom(address(this), msg.sender, Total - _amount);
}
}
Updates

Lead Judging Commences

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

precision-distributeFees

Support

FAQs

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