The TempleGoldStaking contract allows the admin to change the vestingPeriod
at any time. This can lead to unexpected changes in the vesting rates for existing stakes, potentially benefiting some users while disadvantaging others. In extreme cases, it could lead to contract malfunctions.
The vesting rate is calculated using the formula:
When the vestingPeriod is changed, this directly affects the vesting rate for all existing stakes. This can result in:
Accelerated vesting if the period is shortened
Delayed vesting if the period is extended
Inconsistent vesting rates for stakes made at different times
Potential division by zero if vestingPeriod is set to 0
Examples:
30-day stake, changed to 20 days after 15 days:
Before: 50% vested
After: 75% vested
30-day stake, changed to 40 days after 25 days:
Before: 83.33% vested
After: 62.5% vested
Users may receive more or fewer rewards than initially expected
Inconsistent vesting rates across different stakes
Potential for admin to manipulate vesting rates to benefit or harm specific users
Risk of contract malfunction if vestingPeriod is set to 0
Manual code review
Implement a vesting schedule that is immutable for each stake:
When changing the vestingPeriod, only apply it to new stakes:
Implement a minimum value check for vestingPeriod to prevent it from being set to 0:
Consider implementing a time-delay or governance vote for changing vesting parameters to allow users to react to upcoming changes.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.