the mathematical formula is incorrect, which will lead to protocol insolvency
the original code is :
uint256 slope = amount / boostDuration;
uint256 bias = slope * boostDuration;
// Rewards are set in the Pledge as reward/veToken/sec
// To find the total amount of veToken delegated through the whole Boost duration
// based on the Boost bias & the Boost duration, to take in account that the delegated amount decreases
// each second of the Boost duration
uint256 totalDelegatedAmount = ((bias * boostDuration) + bias) / 2;
but according to the name of the variable and the code context, the bias should be amount - slope*boostDuration rather than slope * boostDuration, the latter one is nonsense.
On top of that, the total delegatedAmount shouldn’t be ((bias * boostDuration) + bias) / 2, it should be ((slope * boostDuration) + bias) / 2
fix the code as previous mentioned way
The text was updated successfully, but these errors were encountered:
👎 1 trust1995 reacted with thumbs down emoji
All reactions