-
Notifications
You must be signed in to change notification settings - Fork 6
novaman33 - Wrong amount is used when calculation avgDuration in MlumStaking.sol #17
Comments
Escalate, |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
This issue occurs with tokens with a fee-on-transfer. Such tokens charge a fee during the transfer and the amount sent may differ from the amount received. The Grouping the category in this way allows auditors and sponsors to better understand the general problems caused by non-standard ERC20 tokens. This way, the report is presented within a consistent theme. This perspective is resolutely maintained during the entire project audit, if we were to evaluate it in this way, issue number 545 would need to be divided into 33 separate parts. As a result, Duplicate is correct clearly |
@novaman33 I see you also escalated #545 itself to change the duplications. Hence, I believe it would be fair to reject this escalation and change the duplication if needed under #545 escalation, so the lead judge doesn't suffer several penalties for almost the same escalations. Hope for your understanding, planning to reject this escalation. |
Result: |
Escalations have been resolved successfully! Escalation status:
|
novaman33
High
Wrong amount is used when calculation avgDuration in MlumStaking.sol
Summary
In the MlumStaking the wrong amount is used when calculating the avgDuration for the lock in
addToPosition
function. The right amount would be the amountToAdd after the _transferSupportingFeeOnTransfer function is called.Vulnerability Detail
When a fee-on-transfer token is used there is a fee when the users send tokens to the contract. The actual amount that the user has sent is being calculated in _transferSupportingFeeOnTransfer. However when calculating the new lock duration the amount before the fees is taken which means that the duration will be longer than it should be.
Impact
Everytime when a fee-on-transfer token is used, the duration calculated will be longer it should be. This leads to systematical error causing lock times to be longer than they should be.
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/MlumStaking.sol#L410
Tool used
Manual Review
Recommendation
Use the amountToAdd after
_transferSupportingFeeOnTransfer
is called.Duplicate of #545
The text was updated successfully, but these errors were encountered: