sherlock-audit / 2024-08-flayer-judging

0 stars 0 forks source link

Raspy Azure Dragonfly - Unfair Fee Accrual Due to Locker Pause in Protected Listing Unlock Process #730

Open sherlock-admin3 opened 4 days ago

sherlock-admin3 commented 4 days ago

Raspy Azure Dragonfly

Medium

Unfair Fee Accrual Due to Locker Pause in Protected Listing Unlock Process

Summary

The unlockProtectedListing function calculates an unlock fee based on a compounded interest formula tied to the duration of the lock. However, if the locker is paused for an extended period (e.g., 24 hours), users are unfairly charged additional fees for that period, even though they cannot unlock their listings while the locker is paused. This creates a discrepancy, leading to higher fees than expected.

Vulnerability Detail

The unlock fee is calculated using the function unlockPrice, which compounds the interest based on the listing’s tokenTaken and the time difference between the initialCheckpoint and _currentCheckpoint. The _currentCheckpoint is updated based on the time elapsed and the utilization rate of the collection.

However, if the locker is paused (e.g., for 24 hours), users are unable to unlock their listings during the paused period. Despite this, the compounded interest continues to accrue for the paused period, resulting in higher fees. This unfairly penalizes users who could not interact with the protocol during the pause.

Impact

A user lists an NFT with tokenTaken = 1 ether at a time when the locker is functioning normally.


## Tool used

Manual Review

## Recommendation
To resolve this issue, the protocol should avoid compounding interest or increasing the fee during periods when the locker is paused. This can be achieved by implementing a mechanism that tracks the pause period and excludes it from the fee calculation. For example, the following steps could be taken:

- Track Pause Periods: Introduce a variable to track the last time the locker was paused and the total duration of the pause.
- Adjust Fee Calculation: When calculating the unlock fee, subtract the total paused duration from the time difference used to calculate compounded interest.
- Implement a Modifier: Ensure that when the locker is paused, any attempt to calculate the unlock fee does not penalize users for the paused duration.