Skip to content
This repository was archived by the owner on Sep 24, 2023. It is now read-only.

Latest commit

 

History

History
32 lines (20 loc) · 1.01 KB

File metadata and controls

32 lines (20 loc) · 1.01 KB

bin2chen

medium

cancelOrder() It does not unset the referralCode

Summary

cancelOrder() It does not unset the referralCode,maybe Loss Rewards

Vulnerability Detail

When the user submits an order via createOrder(), the referralCode is set if available But at this time the order has not yet been executed, it is possible that the execution failed or the user canceled the order cancel an order does not unset the referralCode There is a problem, if a user is referred to an order once submitted, but the order is invalid, the protocol will also record the referrer. After a long time, if the user executes any other order, the referrer will become him, but this is not related to the referrer, because the first order was not successful. So it is recommended to set referralCode in executeOrder()

Impact

Loss Rewards

Code Snippet

https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/order/OrderUtils.sol#L58

Tool used

Manual Review

Recommendation

set referralCode in executeOrder()