hats-finance / Tokemak-0x4a2d708ea6b0c04186ecb774cfad1e50fb5efc0b

0 stars 0 forks source link

Return value no considered #6

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

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

Github username: @https://github.com/Pavel2202 Twitter username: https://twitter.com/timenov_pavel Submission hash (on-chain): 0xba140e5818ab14119cba829e8804bc9b480ed1be54d8cd40ae6bdc9728b98ef6 Severity: low

Description: Description\ In LMPStrategy::navUpdate the internal function clearExpiredPause is called. This function returns true/false. However the return value is not taken in consideration. If we take a look at rebalanceSuccessfullyExecuted(), the return value is taken into consideration and if it returns false, _swapCostOffsetPeriod = swapCostOffsetPeriodInDays(); is performed.

https://github.com/hats-finance/Tokemak-0x4a2d708ea6b0c04186ecb774cfad1e50fb5efc0b/blob/74b397ce988a418a1bd02a45716cfc964922be26/src/strategy/LMPStrategy.sol#L895

To fix this, do the same as rebalanceSuccessfullyExecuted()

if (!clearExpiredPause()) _swapCostOffsetPeriod = swapCostOffsetPeriodInDays();
ahuja88 commented 5 months ago

We want to clear expired pause state asap, while the swap cost offset period value update should occur only on rebalances.