hats-finance / Tokemak-0x4a2d708ea6b0c04186ecb774cfad1e50fb5efc0b

0 stars 0 forks source link

LMPStrategy.sol#verifyRebalance() - predictedGainAtOffsetEnd doesn't account for leap years #9

Open hats-bug-reporter[bot] opened 5 months ago

hats-bug-reporter[bot] commented 5 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xad5802d85b4cede920ed2b6c485b0858bc708b554cd91ddcceaa9bf9cfc02b0f Severity: low

Description: Description\ When calculating predictedGainAtOffsetEnd we divide by 365, which doesn't account for leap years.

Through time predictedGainAtOffsetEnd will be slightly incorrect.

Attack Scenario\

Attachments

  1. Proof of Concept (PoC) File

  2. Revised Code File (Optional) Instead of hardcoding 365, a state variable can be created which the protocol can change to correctly calculate predictedGainAtOffsetEnd

codenutt commented 5 months ago

These are all estimated values based on smoothed/averaged/etc values. Leap year wouldn't have a material effect.