Submitted by Matin, also found by preslavxyz, JuggerNaut63, samuraii77, the_hunter, stanchev, swapnaliss, inzinko, Udsen, nikhil840096, and Abhan
The function calculateAge() computes the age of a token ID based on the current and creation time difference. This token age is then used to determine the nuke factor to calculate the possible claim amount.
The problem here is that when calculating the age of a token, it first divides the time difference to 1 day in seconds, and then multiplies the result to the other variables.
With having this pattern, users will face significant losses. Especially, in the case of small differences (less than 1 day), the daysOld variable becomes 0, making the age zero respectively.
The function below illustrates the significant discrepancies between the results:
For these results we will have:
This will lead to ~ 11% of errors which is a significant error here. This huge difference will also increase the nuke factor (even more) and affect the results.
Consider multiplying the numerator variables first and then divide by the denominator:
Math
TForge1 (TraitForge) acknowledged and commented:
Koolex (judge) commented:
dimulski (warden) commented:
Kalogerone (warden) commented:
Koolex (judge) commented:
