sherlock-audit / 2023-04-gmx-judging

2 stars 1 forks source link

J4de - Funding fee is still counted when the market is pause #266

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

J4de

high

Funding fee is still counted when the market is pause

Summary

Funding fees incentivise the balancing of long and short positions. The funding fee is related to the holding period of the position. When the market is pause, the user cannot be motivated to adjust the position but still needs to pay/profit the funding fee.

Vulnerability Detail

https://github.com/sherlock-audit/2023-04-gmx/blob/main/gmx-synthetics/contracts/market/MarketUtils.sol#L982

The timing of each update of the funding fee does not consider whether the duration has been paused for a period of time in the past.

Impact

Some users lose funds, some users gain

Code Snippet

https://github.com/sherlock-audit/2023-04-gmx/blob/main/gmx-synthetics/contracts/market/MarketUtils.sol#L982

Tool used

Manual Review

Recommendation

It is recommended that when the market is pause, the time for funding will not be accumulated