/contracts/farm-manager/src/position/helpers.rs#L15-L17
The code snippet located here defines constants for a day and a month in seconds:
The protocol intends for 12 months to equal one year. However, the defined MONTH_IN_SECONDS value leads to an inaccurate year calculation.
Current Calculation:
Using the current MONTH_IN_SECONDS:
Expected Calculation:
A more accurate calculation for the number of seconds in a year considers the average length of a year, including leap years, which is approximately 365.25 days.
Difference:
The difference between the current calculation and the expected value is:
Over the course of a year, this difference amounts to 648 seconds or approximately 10.8 minutes.
Percentage Difference:
To better understand the magnitude of the error, we can calculate the percentage difference:
While the percentage difference is small, it can still accumulate over longer periods and impact time-sensitive calculations.
This discrepancy, while seemingly minor, can lead to measurable inaccuracies in time-sensitive operations within the AMM. This is particularly relevant for:
Update the MONTH_IN_SECONDS constant to a more accurate representation. The simplest approach is to divide the accurate seconds in a year by 12:
