TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: medium
Invalid

Stakers may lose some expected rewards in the process of migration

Summary

When migrating to a new staking contract, and we're in one staking period, stakers may lose some expected rewards.

Vulnerability Details

In staking contract, we can migrate to one new staking contract considering that TGLD changes. The migrator will withdraw the staking amount for stakers and claim the rewards.
The vulnerability is that if we're in one active distribution period, most stakers want to stake in the whole distribution period to earn the maximum rewards. Stakes may be forced to be withdrawn by the migrator. The stakers may lose some expected rewards.

function migrateWithdraw(address staker, uint256 index) external override onlyMigrator returns (uint256) {
if (staker == address(0)) { revert CommonEventsAndErrors.InvalidAddress(); }
StakeInfo storage _stakeInfo = _stakeInfos[staker][index];
uint256 stakerBalance = _stakeInfo.amount;
_withdrawFor(_stakeInfo, staker, msg.sender, index, _stakeInfo.amount, true, staker);
return stakerBalance;
}

Impact

Stakers may lose some rewards.

Tools Used

Manual

Recommendations

Migrator should make the migration when there is not one active distribution period.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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