1.0.0-alpha.44 • Published 6 days ago

@rabbitholegg/questdk-plugin-gmx v1.0.0-alpha.44

Weekly downloads
-
License
ISC
Repository
-
Last release
6 days ago

Currently we only support swaps on Arbitrum and do not support derivatives.

Limitations with V2 swap filtering

We've identified some limitations in the current version of the GMX swap filter:

  1. Protocol Fee with Raw Ether Transactions:

    • There is a small protocol fee of approximately 0.001 ETH included in the payable amount for transactions using raw Ether as the input token.
    • This additional fee may lead to discrepancies when comparing amounts, especially in cases where exact equality (==) or less-than-or-equal-to (<=) operators are used.
  2. Behavior with amountIn and tokenIn Parameters:

    • When amountIn is specified and tokenIn is set to any, transactions involving any token will pass the filter, but ETH will not. This is due to the way the amount is compared when using ETH vs tokens. When amountIn is set to any, and tokenIn is set to any, both ETH and tokens will pass the filter.
  3. Token Filtering with tokenOut Parameter:

    • If tokenIn is set to any and tokenOut is specified as USDC, transactions involving any token (excluding ETH) as input will pass the filter. This occurs because the MarketToken for USDC check depends on the tokenIn being explicitly provided.

V2 Notes

MultiCall calls several functions - the main one we're concerned with is createOrder.

This function takes this struct as a param: https://github.com/gmx-io/gmx-synthetics/blob/77a2ff39f1414a105e8589d622bdb09ac3dd97d8/contracts/order/BaseOrderUtils.sol#L36

    struct CreateOrderParams {
        CreateOrderParamsAddresses addresses;
        CreateOrderParamsNumbers numbers;
        Order.OrderType orderType;
        Order.DecreasePositionSwapType decreasePositionSwapType;
        bool isLong;
        bool shouldUnwrapNativeToken;
        bytes32 referralCode;
    }

We want to confirm swapPath inside of the CreateOrderParamsAddresses matches our expected tokens and received in that same struct matches recipient.

We want to make sure that minOutputAmount and either triggerPrice or acceptablePrice match amountOut and amountIn respectively

We want to confirm orderType is a MarketSwap

    enum OrderType {
        // @dev MarketSwap: swap token A to token B at the current market price
        // the order will be cancelled if the minOutputAmount cannot be fulfilled
        MarketSwap,
        // @dev LimitSwap: swap token A to token B if the minOutputAmount can be fulfilled
        LimitSwap,
        // @dev MarketIncrease: increase position at the current market price
        // the order will be cancelled if the position cannot be increased at the acceptablePrice
        MarketIncrease,
        // @dev LimitIncrease: increase position if the triggerPrice is reached and the acceptablePrice can be fulfilled
        LimitIncrease,
        // @dev MarketDecrease: decrease position at the current market price
        // the order will be cancelled if the position cannot be decreased at the acceptablePrice
        MarketDecrease,
        // @dev LimitDecrease: decrease position if the triggerPrice is reached and the acceptablePrice can be fulfilled
        LimitDecrease,
        // @dev StopLossDecrease: decrease position if the triggerPrice is reached and the acceptablePrice can be fulfilled
        StopLossDecrease,
        // @dev Liquidation: allows liquidation of positions if the criteria for liquidation are met
        Liquidation
    }

Options Transaction Info

1.0.0-alpha.43

6 days ago

1.0.0-alpha.42

7 days ago

1.0.0-alpha.44

6 days ago

1.0.0-alpha.41

8 days ago

1.0.0-alpha.40

15 days ago

1.0.0-alpha.39

1 month ago

1.0.0-alpha.38

1 month ago

1.0.0-alpha.37

2 months ago

1.0.0-alpha.36

2 months ago

1.0.0-alpha.35

2 months ago

1.0.0-alpha.34

2 months ago

1.0.0-alpha.33

2 months ago

1.0.0-alpha.30

2 months ago

1.0.0-alpha.32

2 months ago

1.0.0-alpha.31

2 months ago

1.0.0-alpha.29

2 months ago

1.0.0-alpha.28

2 months ago

1.0.0-alpha.27

2 months ago

1.0.0-alpha.26

2 months ago

1.0.0-alpha.25

2 months ago

1.0.0-alpha.24

3 months ago

1.0.0-alpha.23

3 months ago

1.0.0-alpha.22

3 months ago

1.0.0-alpha.21

3 months ago

1.0.0-alpha.20

3 months ago

1.0.0-alpha.19

4 months ago

1.0.0-alpha.18

4 months ago

1.0.0-alpha.16

4 months ago

1.0.0-alpha.15

4 months ago

1.0.0-alpha.14

4 months ago

1.0.0-alpha.13

5 months ago

1.0.0-alpha.12

6 months ago

1.0.0-alpha.11

6 months ago

1.0.0-alpha.10

6 months ago

1.0.0-alpha.9

7 months ago

1.0.0-alpha.8

7 months ago

1.0.0-alpha.7

7 months ago

1.0.0-alpha.6

8 months ago

1.0.0-alpha.5

8 months ago

1.0.0-alpha.4

8 months ago