Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honour - Usual dust buildup from distributing to usual* will be stuck in the Distribution module #270

Open
sherlock-admin2 opened this issue Nov 13, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Nov 13, 2024

Honour

Medium

Usual dust buildup from distributing to usual* will be stuck in the Distribution module

Summary

The amount of Usual tokens minted by the distributionModule to distribute to UsualSP will always be slightly higher than the actual amount of Usual token taken by the UsualSP contract. The reason for this is that UualSP adjusts the amount before transferring the tokens from the distribution module.
Hence , there'll be a dust buildup of minted Usual tokens in the distribution module.

Root Cause

In RewardAccrualBase::_startRewardDistribution we see that the rewardAmount is adjusted (i.e. adjustedAmount = amount / duration * duration) before transferring the tokens into the contract. Due to this adjustment not all the Usual tokens minted by the distributionModule will be distributed by UsualSP.
The Usual token is a standard ERC20 so the dust(rewardAmount - adjustedAmount) will be little for a single ddistribution, however, given the distribution frequency(daily) this amount can accumulate over time and will be stuck in the distribution module.

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

Medium - dust buildup of Usual tokens will be stuck in the distribution module

PoC

No response

Mitigation

  1. Amount should be adjusted in the DistributionModule in _distributeToUsualStarBucket before minting the Usual tokens
  2. There can be a sweep functionality to sweep the dust.
  3. After minting the tokens startRewardDistribution can be called with usual.balanceOf(address(this)) as the rewardAmount to account for previously undistributed tokens. This approach will also distribute donations though
@sherlock-admin4 sherlock-admin4 changed the title Lively Coffee Fish - Usual dust buildup from distributing to usual* will be stuck in the Distribution module Honour - Usual dust buildup from distributing to usual* will be stuck in the Distribution module Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant