@gmx-io/sdk 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/build/cjs/src/abis/ClaimHandler.json +1 -16
  2. package/build/cjs/src/abis/CustomErrors.json +642 -61
  3. package/build/cjs/src/abis/DataStore.json +25 -6
  4. package/build/cjs/src/abis/EventEmitter.json +1 -6
  5. package/build/cjs/src/abis/ExchangeRouter.json +195 -290
  6. package/build/cjs/src/abis/GelatoRelayRouter.json +251 -98
  7. package/build/cjs/src/abis/GlvReader.json +60 -3
  8. package/build/cjs/src/abis/GlvRouter.json +144 -86
  9. package/build/cjs/src/abis/GovToken.json +1 -354
  10. package/build/cjs/src/abis/LayerZeroProvider.json +372 -0
  11. package/build/cjs/src/abis/Multicall.json +134 -38
  12. package/build/cjs/src/abis/MultichainClaimsRouter.json +1266 -0
  13. package/build/cjs/src/abis/MultichainGlvRouter.json +1150 -0
  14. package/build/cjs/src/abis/MultichainGmRouter.json +1449 -0
  15. package/build/cjs/src/abis/MultichainOrderRouter.json +1820 -0
  16. package/build/cjs/src/abis/MultichainSubaccountRouter.json +2069 -0
  17. package/build/cjs/src/abis/MultichainTransferRouter.json +915 -0
  18. package/build/cjs/src/abis/MultichainUtils.json +133 -0
  19. package/build/cjs/src/abis/MultichainVault.json +275 -0
  20. package/build/cjs/src/abis/ReferralStorage.json +69 -19
  21. package/build/cjs/src/abis/RelayParams.json +85 -48
  22. package/build/cjs/src/abis/SmartAccount.json +28 -0
  23. package/build/cjs/src/abis/SubaccountGelatoRelayRouter.json +282 -148
  24. package/build/cjs/src/abis/SubaccountRouter.json +62 -118
  25. package/build/cjs/src/abis/SyntheticsReader.json +342 -474
  26. package/build/cjs/src/abis/SyntheticsRouter.json +1 -6
  27. package/build/cjs/src/abis/index.js +51 -7
  28. package/build/cjs/src/configs/__tests__/markets.spec.js +1 -1
  29. package/build/cjs/src/configs/__tests__/permits.spec.js +1 -1
  30. package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -1
  31. package/build/cjs/src/configs/batch.js +48 -0
  32. package/build/cjs/src/configs/chains.js +41 -8
  33. package/build/cjs/src/configs/contracts.js +151 -41
  34. package/build/cjs/src/configs/dataStore.js +39 -5
  35. package/build/cjs/src/configs/express.js +4 -0
  36. package/build/cjs/src/configs/factors.js +1 -1
  37. package/build/cjs/src/configs/markets.js +128 -0
  38. package/build/cjs/src/configs/oracleKeeper.js +2 -0
  39. package/build/cjs/src/configs/tokens.js +217 -2
  40. package/build/cjs/src/modules/markets/index.js +9 -4
  41. package/build/cjs/src/modules/markets/query-builders.js +28 -8
  42. package/build/cjs/src/modules/orders/helpers.js +2 -2
  43. package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
  44. package/build/cjs/src/modules/orders/transactions/createDecreaseOrderTxn.js +1 -0
  45. package/build/cjs/src/modules/orders/transactions/createIncreaseOrderTxn.js +1 -0
  46. package/build/cjs/src/modules/orders/transactions/createSwapOrderTxn.js +1 -0
  47. package/build/cjs/src/modules/orders/utils.js +4 -5
  48. package/build/cjs/src/modules/positions/positions.js +38 -5
  49. package/build/cjs/src/modules/utils/utils.js +1 -0
  50. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +146 -0
  51. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +2207 -532
  52. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +272 -0
  53. package/build/cjs/src/test/mock.js +9 -4
  54. package/build/cjs/src/types/subsquid.js +507 -1
  55. package/build/cjs/src/utils/LruCache.js +4 -0
  56. package/build/cjs/src/utils/__tests__/LruCache.spec.js +18 -0
  57. package/build/cjs/src/utils/__tests__/numbers.spec.js +18 -16
  58. package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +0 -1
  59. package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +8 -0
  60. package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +38 -30
  61. package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +10 -0
  62. package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +6 -0
  63. package/build/cjs/src/utils/__tests__/positions.spec.js +23 -6
  64. package/build/cjs/src/utils/bigmath.js +9 -2
  65. package/build/cjs/src/utils/errors/parseError.js +35 -1
  66. package/build/cjs/src/utils/fees/executionFee.js +5 -3
  67. package/build/cjs/src/utils/fees/index.js +8 -6
  68. package/build/cjs/src/utils/fees/priceImpact.js +94 -32
  69. package/build/cjs/src/utils/gelatoRelay.js +5 -0
  70. package/build/cjs/src/utils/marketKeysAndConfigs.js +24 -4
  71. package/build/cjs/src/utils/markets.js +10 -3
  72. package/build/cjs/src/utils/numbers.js +18 -17
  73. package/build/cjs/src/utils/orderTransactions.js +5 -1
  74. package/build/cjs/src/utils/positions.js +77 -9
  75. package/build/cjs/src/utils/prices.js +19 -13
  76. package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +1 -0
  77. package/build/cjs/src/utils/swap/swapStats.js +6 -3
  78. package/build/cjs/src/utils/trade/decrease.js +470 -0
  79. package/build/cjs/src/utils/trade/{amounts.js → increase.js} +86 -31
  80. package/build/cjs/src/utils/tradeHistory.js +3 -0
  81. package/build/esm/src/abis/ClaimHandler.json +1 -16
  82. package/build/esm/src/abis/CustomErrors.json +642 -61
  83. package/build/esm/src/abis/DataStore.json +25 -6
  84. package/build/esm/src/abis/EventEmitter.json +1 -6
  85. package/build/esm/src/abis/ExchangeRouter.json +195 -290
  86. package/build/esm/src/abis/GelatoRelayRouter.json +251 -98
  87. package/build/esm/src/abis/GlvReader.json +60 -3
  88. package/build/esm/src/abis/GlvRouter.json +144 -86
  89. package/build/esm/src/abis/GovToken.json +1 -354
  90. package/build/esm/src/abis/LayerZeroProvider.json +372 -0
  91. package/build/esm/src/abis/Multicall.json +134 -38
  92. package/build/esm/src/abis/MultichainClaimsRouter.json +1266 -0
  93. package/build/esm/src/abis/MultichainGlvRouter.json +1150 -0
  94. package/build/esm/src/abis/MultichainGmRouter.json +1449 -0
  95. package/build/esm/src/abis/MultichainOrderRouter.json +1820 -0
  96. package/build/esm/src/abis/MultichainSubaccountRouter.json +2069 -0
  97. package/build/esm/src/abis/MultichainTransferRouter.json +915 -0
  98. package/build/esm/src/abis/MultichainUtils.json +133 -0
  99. package/build/esm/src/abis/MultichainVault.json +275 -0
  100. package/build/esm/src/abis/ReferralStorage.json +69 -19
  101. package/build/esm/src/abis/RelayParams.json +85 -48
  102. package/build/esm/src/abis/SmartAccount.json +28 -0
  103. package/build/esm/src/abis/SubaccountGelatoRelayRouter.json +282 -148
  104. package/build/esm/src/abis/SubaccountRouter.json +62 -118
  105. package/build/esm/src/abis/SyntheticsReader.json +342 -474
  106. package/build/esm/src/abis/SyntheticsRouter.json +1 -6
  107. package/build/esm/src/abis/index.js +51 -7
  108. package/build/esm/src/configs/__tests__/markets.spec.js +3 -3
  109. package/build/esm/src/configs/__tests__/permits.spec.js +2 -2
  110. package/build/esm/src/configs/__tests__/tokens.spec.js +2 -2
  111. package/build/esm/src/configs/batch.js +49 -1
  112. package/build/esm/src/configs/chains.js +40 -7
  113. package/build/esm/src/configs/contracts.js +152 -42
  114. package/build/esm/src/configs/dataStore.js +29 -1
  115. package/build/esm/src/configs/express.js +5 -1
  116. package/build/esm/src/configs/factors.js +1 -1
  117. package/build/esm/src/configs/markets.js +129 -1
  118. package/build/esm/src/configs/oracleKeeper.js +3 -1
  119. package/build/esm/src/configs/tokens.js +216 -2
  120. package/build/esm/src/modules/markets/index.js +9 -4
  121. package/build/esm/src/modules/markets/query-builders.js +28 -8
  122. package/build/esm/src/modules/orders/helpers.js +1 -1
  123. package/build/esm/src/modules/orders/helpers.spec.js +1 -1
  124. package/build/esm/src/modules/orders/transactions/createDecreaseOrderTxn.js +1 -0
  125. package/build/esm/src/modules/orders/transactions/createIncreaseOrderTxn.js +1 -0
  126. package/build/esm/src/modules/orders/transactions/createSwapOrderTxn.js +1 -0
  127. package/build/esm/src/modules/orders/utils.js +4 -5
  128. package/build/esm/src/modules/positions/positions.js +40 -7
  129. package/build/esm/src/modules/utils/utils.js +1 -0
  130. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +146 -0
  131. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +2207 -532
  132. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +272 -0
  133. package/build/esm/src/test/mock.js +9 -4
  134. package/build/esm/src/types/subsquid.js +506 -0
  135. package/build/esm/src/utils/LruCache.js +4 -0
  136. package/build/esm/src/utils/__tests__/LruCache.spec.js +18 -0
  137. package/build/esm/src/utils/__tests__/numbers.spec.js +18 -16
  138. package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +0 -1
  139. package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +8 -0
  140. package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +38 -30
  141. package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +10 -0
  142. package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +7 -1
  143. package/build/esm/src/utils/__tests__/positions.spec.js +23 -6
  144. package/build/esm/src/utils/bigmath.js +9 -2
  145. package/build/esm/src/utils/errors/parseError.js +31 -0
  146. package/build/esm/src/utils/fees/executionFee.js +5 -3
  147. package/build/esm/src/utils/fees/index.js +8 -6
  148. package/build/esm/src/utils/fees/priceImpact.js +88 -30
  149. package/build/esm/src/utils/gelatoRelay.js +2 -0
  150. package/build/esm/src/utils/marketKeysAndConfigs.js +25 -5
  151. package/build/esm/src/utils/markets.js +7 -1
  152. package/build/esm/src/utils/numbers.js +18 -17
  153. package/build/esm/src/utils/orderTransactions.js +5 -1
  154. package/build/esm/src/utils/positions.js +75 -11
  155. package/build/esm/src/utils/prices.js +20 -14
  156. package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +1 -0
  157. package/build/esm/src/utils/swap/swapStats.js +6 -3
  158. package/build/esm/src/utils/trade/decrease.js +460 -0
  159. package/build/esm/src/utils/trade/{amounts.js → increase.js} +87 -33
  160. package/build/esm/src/utils/tradeHistory.js +3 -0
  161. package/build/types/src/abis/index.d.ts +1 -1
  162. package/build/types/src/configs/batch.d.ts +2 -2
  163. package/build/types/src/configs/chains.d.ts +25 -20
  164. package/build/types/src/configs/contracts.d.ts +118 -10
  165. package/build/types/src/configs/dataStore.d.ts +16 -0
  166. package/build/types/src/configs/factors.d.ts +1 -1
  167. package/build/types/src/configs/markets.d.ts +2 -2
  168. package/build/types/src/configs/tokens.d.ts +1 -0
  169. package/build/types/src/index.d.ts +1 -1
  170. package/build/types/src/modules/base.d.ts +1 -1
  171. package/build/types/src/modules/markets/query-builders.d.ts +3 -2
  172. package/build/types/src/modules/markets/types.d.ts +2 -2
  173. package/build/types/src/modules/orders/transactions/createDecreaseOrderTxn.d.ts +1 -0
  174. package/build/types/src/modules/orders/transactions/createIncreaseOrderTxn.d.ts +1 -0
  175. package/build/types/src/modules/orders/transactions/createSwapOrderTxn.d.ts +1 -0
  176. package/build/types/src/modules/orders/utils.d.ts +6 -5
  177. package/build/types/src/types/fees.d.ts +1 -0
  178. package/build/types/src/types/markets.d.ts +10 -5
  179. package/build/types/src/types/orders.d.ts +1 -1
  180. package/build/types/src/types/positions.d.ts +26 -2
  181. package/build/types/src/types/sdk.d.ts +2 -2
  182. package/build/types/src/types/subsquid.d.ts +1259 -9
  183. package/build/types/src/types/tokens.d.ts +7 -0
  184. package/build/types/src/types/trade.d.ts +14 -3
  185. package/build/types/src/types/tradeHistory.d.ts +3 -0
  186. package/build/types/src/utils/LruCache.d.ts +1 -0
  187. package/build/types/src/utils/bigmath.d.ts +2 -1
  188. package/build/types/src/utils/errors/parseError.d.ts +11 -0
  189. package/build/types/src/utils/fees/executionFee.d.ts +6 -3
  190. package/build/types/src/utils/fees/index.d.ts +2 -2
  191. package/build/types/src/utils/fees/priceImpact.d.ts +33 -5
  192. package/build/types/src/utils/marketKeysAndConfigs.d.ts +9 -4
  193. package/build/types/src/utils/markets.d.ts +7 -0
  194. package/build/types/src/utils/multicall.d.ts +1 -1
  195. package/build/types/src/utils/numbers.d.ts +6 -3
  196. package/build/types/src/utils/orderTransactions.d.ts +6 -4
  197. package/build/types/src/utils/positions.d.ts +30 -0
  198. package/build/types/src/utils/prices.d.ts +4 -0
  199. package/build/types/src/utils/swap/swapValues.d.ts +1 -1
  200. package/build/types/src/utils/trade/decrease.d.ts +77 -0
  201. package/build/types/src/utils/trade/{amounts.d.ts → increase.d.ts} +16 -1
  202. package/package.json +2 -2
@@ -1,5 +1,4 @@
1
1
  {
2
- "address": "0x69C527fC77291722b52649E45c838e41be8Bf5d5",
3
2
  "abi": [
4
3
  {
5
4
  "inputs": [
@@ -142,22 +141,6 @@
142
141
  "name": "EmptyTokenTranferGasLimit",
143
142
  "type": "error"
144
143
  },
145
- {
146
- "inputs": [
147
- {
148
- "internalType": "uint256",
149
- "name": "marketsLength",
150
- "type": "uint256"
151
- },
152
- {
153
- "internalType": "uint256",
154
- "name": "tokensLength",
155
- "type": "uint256"
156
- }
157
- ],
158
- "name": "InvalidClaimAffiliateRewardsInput",
159
- "type": "error"
160
- },
161
144
  {
162
145
  "inputs": [
163
146
  {
@@ -179,38 +162,6 @@
179
162
  "name": "InvalidClaimCollateralInput",
180
163
  "type": "error"
181
164
  },
182
- {
183
- "inputs": [
184
- {
185
- "internalType": "uint256",
186
- "name": "marketsLength",
187
- "type": "uint256"
188
- },
189
- {
190
- "internalType": "uint256",
191
- "name": "tokensLength",
192
- "type": "uint256"
193
- }
194
- ],
195
- "name": "InvalidClaimFundingFeesInput",
196
- "type": "error"
197
- },
198
- {
199
- "inputs": [
200
- {
201
- "internalType": "uint256",
202
- "name": "marketsLength",
203
- "type": "uint256"
204
- },
205
- {
206
- "internalType": "uint256",
207
- "name": "tokensLength",
208
- "type": "uint256"
209
- }
210
- ],
211
- "name": "InvalidClaimUiFeesInput",
212
- "type": "error"
213
- },
214
165
  {
215
166
  "inputs": [
216
167
  {
@@ -353,6 +304,25 @@
353
304
  "name": "Unauthorized",
354
305
  "type": "error"
355
306
  },
307
+ {
308
+ "anonymous": false,
309
+ "inputs": [
310
+ {
311
+ "indexed": false,
312
+ "internalType": "string",
313
+ "name": "reason",
314
+ "type": "string"
315
+ },
316
+ {
317
+ "indexed": false,
318
+ "internalType": "bytes",
319
+ "name": "returndata",
320
+ "type": "bytes"
321
+ }
322
+ ],
323
+ "name": "TokenTransferReverted",
324
+ "type": "event"
325
+ },
356
326
  {
357
327
  "inputs": [
358
328
  {
@@ -531,44 +501,51 @@
531
501
  {
532
502
  "components": [
533
503
  {
534
- "internalType": "address",
535
- "name": "receiver",
536
- "type": "address"
537
- },
538
- {
539
- "internalType": "address",
540
- "name": "callbackContract",
541
- "type": "address"
542
- },
543
- {
544
- "internalType": "address",
545
- "name": "uiFeeReceiver",
546
- "type": "address"
547
- },
548
- {
549
- "internalType": "address",
550
- "name": "market",
551
- "type": "address"
552
- },
553
- {
554
- "internalType": "address",
555
- "name": "initialLongToken",
556
- "type": "address"
557
- },
558
- {
559
- "internalType": "address",
560
- "name": "initialShortToken",
561
- "type": "address"
562
- },
563
- {
564
- "internalType": "address[]",
565
- "name": "longTokenSwapPath",
566
- "type": "address[]"
567
- },
568
- {
569
- "internalType": "address[]",
570
- "name": "shortTokenSwapPath",
571
- "type": "address[]"
504
+ "components": [
505
+ {
506
+ "internalType": "address",
507
+ "name": "receiver",
508
+ "type": "address"
509
+ },
510
+ {
511
+ "internalType": "address",
512
+ "name": "callbackContract",
513
+ "type": "address"
514
+ },
515
+ {
516
+ "internalType": "address",
517
+ "name": "uiFeeReceiver",
518
+ "type": "address"
519
+ },
520
+ {
521
+ "internalType": "address",
522
+ "name": "market",
523
+ "type": "address"
524
+ },
525
+ {
526
+ "internalType": "address",
527
+ "name": "initialLongToken",
528
+ "type": "address"
529
+ },
530
+ {
531
+ "internalType": "address",
532
+ "name": "initialShortToken",
533
+ "type": "address"
534
+ },
535
+ {
536
+ "internalType": "address[]",
537
+ "name": "longTokenSwapPath",
538
+ "type": "address[]"
539
+ },
540
+ {
541
+ "internalType": "address[]",
542
+ "name": "shortTokenSwapPath",
543
+ "type": "address[]"
544
+ }
545
+ ],
546
+ "internalType": "struct IDepositUtils.CreateDepositParamsAddresses",
547
+ "name": "addresses",
548
+ "type": "tuple"
572
549
  },
573
550
  {
574
551
  "internalType": "uint256",
@@ -589,9 +566,14 @@
589
566
  "internalType": "uint256",
590
567
  "name": "callbackGasLimit",
591
568
  "type": "uint256"
569
+ },
570
+ {
571
+ "internalType": "bytes32[]",
572
+ "name": "dataList",
573
+ "type": "bytes32[]"
592
574
  }
593
575
  ],
594
- "internalType": "struct DepositUtils.CreateDepositParams",
576
+ "internalType": "struct IDepositUtils.CreateDepositParams",
595
577
  "name": "params",
596
578
  "type": "tuple"
597
579
  }
@@ -729,6 +711,11 @@
729
711
  "internalType": "bytes32",
730
712
  "name": "referralCode",
731
713
  "type": "bytes32"
714
+ },
715
+ {
716
+ "internalType": "bytes32[]",
717
+ "name": "dataList",
718
+ "type": "bytes32[]"
732
719
  }
733
720
  ],
734
721
  "internalType": "struct IBaseOrderUtils.CreateOrderParams",
@@ -752,29 +739,36 @@
752
739
  {
753
740
  "components": [
754
741
  {
755
- "internalType": "address",
756
- "name": "receiver",
757
- "type": "address"
758
- },
759
- {
760
- "internalType": "address",
761
- "name": "callbackContract",
762
- "type": "address"
763
- },
764
- {
765
- "internalType": "address",
766
- "name": "uiFeeReceiver",
767
- "type": "address"
768
- },
769
- {
770
- "internalType": "address",
771
- "name": "fromMarket",
772
- "type": "address"
773
- },
774
- {
775
- "internalType": "address",
776
- "name": "toMarket",
777
- "type": "address"
742
+ "components": [
743
+ {
744
+ "internalType": "address",
745
+ "name": "receiver",
746
+ "type": "address"
747
+ },
748
+ {
749
+ "internalType": "address",
750
+ "name": "callbackContract",
751
+ "type": "address"
752
+ },
753
+ {
754
+ "internalType": "address",
755
+ "name": "uiFeeReceiver",
756
+ "type": "address"
757
+ },
758
+ {
759
+ "internalType": "address",
760
+ "name": "fromMarket",
761
+ "type": "address"
762
+ },
763
+ {
764
+ "internalType": "address",
765
+ "name": "toMarket",
766
+ "type": "address"
767
+ }
768
+ ],
769
+ "internalType": "struct IShiftUtils.CreateShiftParamsAddresses",
770
+ "name": "addresses",
771
+ "type": "tuple"
778
772
  },
779
773
  {
780
774
  "internalType": "uint256",
@@ -790,9 +784,14 @@
790
784
  "internalType": "uint256",
791
785
  "name": "callbackGasLimit",
792
786
  "type": "uint256"
787
+ },
788
+ {
789
+ "internalType": "bytes32[]",
790
+ "name": "dataList",
791
+ "type": "bytes32[]"
793
792
  }
794
793
  ],
795
- "internalType": "struct ShiftUtils.CreateShiftParams",
794
+ "internalType": "struct IShiftUtils.CreateShiftParams",
796
795
  "name": "params",
797
796
  "type": "tuple"
798
797
  }
@@ -813,34 +812,41 @@
813
812
  {
814
813
  "components": [
815
814
  {
816
- "internalType": "address",
817
- "name": "receiver",
818
- "type": "address"
819
- },
820
- {
821
- "internalType": "address",
822
- "name": "callbackContract",
823
- "type": "address"
824
- },
825
- {
826
- "internalType": "address",
827
- "name": "uiFeeReceiver",
828
- "type": "address"
829
- },
830
- {
831
- "internalType": "address",
832
- "name": "market",
833
- "type": "address"
834
- },
835
- {
836
- "internalType": "address[]",
837
- "name": "longTokenSwapPath",
838
- "type": "address[]"
839
- },
840
- {
841
- "internalType": "address[]",
842
- "name": "shortTokenSwapPath",
843
- "type": "address[]"
815
+ "components": [
816
+ {
817
+ "internalType": "address",
818
+ "name": "receiver",
819
+ "type": "address"
820
+ },
821
+ {
822
+ "internalType": "address",
823
+ "name": "callbackContract",
824
+ "type": "address"
825
+ },
826
+ {
827
+ "internalType": "address",
828
+ "name": "uiFeeReceiver",
829
+ "type": "address"
830
+ },
831
+ {
832
+ "internalType": "address",
833
+ "name": "market",
834
+ "type": "address"
835
+ },
836
+ {
837
+ "internalType": "address[]",
838
+ "name": "longTokenSwapPath",
839
+ "type": "address[]"
840
+ },
841
+ {
842
+ "internalType": "address[]",
843
+ "name": "shortTokenSwapPath",
844
+ "type": "address[]"
845
+ }
846
+ ],
847
+ "internalType": "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses",
848
+ "name": "addresses",
849
+ "type": "tuple"
844
850
  },
845
851
  {
846
852
  "internalType": "uint256",
@@ -866,9 +872,14 @@
866
872
  "internalType": "uint256",
867
873
  "name": "callbackGasLimit",
868
874
  "type": "uint256"
875
+ },
876
+ {
877
+ "internalType": "bytes32[]",
878
+ "name": "dataList",
879
+ "type": "bytes32[]"
869
880
  }
870
881
  ],
871
- "internalType": "struct WithdrawalUtils.CreateWithdrawalParams",
882
+ "internalType": "struct IWithdrawalUtils.CreateWithdrawalParams",
872
883
  "name": "params",
873
884
  "type": "tuple"
874
885
  }
@@ -928,34 +939,41 @@
928
939
  {
929
940
  "components": [
930
941
  {
931
- "internalType": "address",
932
- "name": "receiver",
933
- "type": "address"
934
- },
935
- {
936
- "internalType": "address",
937
- "name": "callbackContract",
938
- "type": "address"
939
- },
940
- {
941
- "internalType": "address",
942
- "name": "uiFeeReceiver",
943
- "type": "address"
944
- },
945
- {
946
- "internalType": "address",
947
- "name": "market",
948
- "type": "address"
949
- },
950
- {
951
- "internalType": "address[]",
952
- "name": "longTokenSwapPath",
953
- "type": "address[]"
954
- },
955
- {
956
- "internalType": "address[]",
957
- "name": "shortTokenSwapPath",
958
- "type": "address[]"
942
+ "components": [
943
+ {
944
+ "internalType": "address",
945
+ "name": "receiver",
946
+ "type": "address"
947
+ },
948
+ {
949
+ "internalType": "address",
950
+ "name": "callbackContract",
951
+ "type": "address"
952
+ },
953
+ {
954
+ "internalType": "address",
955
+ "name": "uiFeeReceiver",
956
+ "type": "address"
957
+ },
958
+ {
959
+ "internalType": "address",
960
+ "name": "market",
961
+ "type": "address"
962
+ },
963
+ {
964
+ "internalType": "address[]",
965
+ "name": "longTokenSwapPath",
966
+ "type": "address[]"
967
+ },
968
+ {
969
+ "internalType": "address[]",
970
+ "name": "shortTokenSwapPath",
971
+ "type": "address[]"
972
+ }
973
+ ],
974
+ "internalType": "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses",
975
+ "name": "addresses",
976
+ "type": "tuple"
959
977
  },
960
978
  {
961
979
  "internalType": "uint256",
@@ -981,9 +999,14 @@
981
999
  "internalType": "uint256",
982
1000
  "name": "callbackGasLimit",
983
1001
  "type": "uint256"
1002
+ },
1003
+ {
1004
+ "internalType": "bytes32[]",
1005
+ "name": "dataList",
1006
+ "type": "bytes32[]"
984
1007
  }
985
1008
  ],
986
- "internalType": "struct WithdrawalUtils.CreateWithdrawalParams",
1009
+ "internalType": "struct IWithdrawalUtils.CreateWithdrawalParams",
987
1010
  "name": "params",
988
1011
  "type": "tuple"
989
1012
  },
@@ -1053,7 +1076,7 @@
1053
1076
  ],
1054
1077
  "name": "makeExternalCalls",
1055
1078
  "outputs": [],
1056
- "stateMutability": "nonpayable",
1079
+ "stateMutability": "payable",
1057
1080
  "type": "function"
1058
1081
  },
1059
1082
  {
@@ -1679,123 +1702,5 @@
1679
1702
  "stateMutability": "view",
1680
1703
  "type": "function"
1681
1704
  }
1682
- ],
1683
- "transactionHash": "0x723bba33993a46238da285f8900a6c411564432b8af409c3dc8d3b1f6d5c7167",
1684
- "receipt": {
1685
- "to": null,
1686
- "from": "0xE7BfFf2aB721264887230037940490351700a068",
1687
- "contractAddress": "0x69C527fC77291722b52649E45c838e41be8Bf5d5",
1688
- "transactionIndex": 6,
1689
- "gasUsed": "6362339",
1690
- "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
1691
- "blockHash": "0xd18c90532e420963f4dc93793b032a792fdde7171138710bc41c4088e2aa5d59",
1692
- "transactionHash": "0x723bba33993a46238da285f8900a6c411564432b8af409c3dc8d3b1f6d5c7167",
1693
- "logs": [],
1694
- "blockNumber": 222747030,
1695
- "cumulativeGasUsed": "6942059",
1696
- "status": 1,
1697
- "byzantium": true
1698
- },
1699
- "args": [
1700
- "0x7452c558d45f8afC8c83dAe62C3f8A5BE19c71f6",
1701
- "0x3c3d99FD298f679DBC2CEcd132b4eC4d0F5e6e72",
1702
- "0xFD70de6b91282D8017aA4E741e9Ae325CAb992d8",
1703
- "0xC8ee91A54287DB53897056e12D9819156D3822Fb",
1704
- "0x321f3739983CC3E911fd67a83d1ee76238894Bd0",
1705
- "0xA19fA3F0D8E7b7A8963420De504b624167e709B2",
1706
- "0xEa90EC1228F7D1b3D47D84d1c9D46dBDFEfF7709",
1707
- "0xB0Fc2a48b873da40e7bc25658e5E6137616AC2Ee",
1708
- "0x389CEf541397e872dC04421f166B5Bc2E0b374a5"
1709
- ],
1710
- "numDeployments": 6,
1711
- "solcInputHash": "292dd15f99d7c1e4e4b27476672071d7",
1712
- "libraries": {
1713
- "CallbackUtils": "0x501e34E31f1594ffbd3D0C17634D6de6C6C5c7A3",
1714
- "DepositStoreUtils": "0x3063A99D2df2A871068D47041eB8d089E5DE1Cdc",
1715
- "FeeUtils": "0x7Fd8d13A778a22F5c2acB67226A193C7d0b0a336",
1716
- "MarketEventUtils": "0x1F493E17bcF5390d3e5E49eE0bce17d4d068f90b",
1717
- "MarketStoreUtils": "0xbbf05cF8e1c6548092A6a02c4c5330E76BF0fE2D",
1718
- "OrderStoreUtils": "0x67040c411C1b3195361801E9Ad8a91D1Fe9C0BC2",
1719
- "ReferralUtils": "0x27346Fdab142e2b8B6C6d2ecFe73e75B5e249A57",
1720
- "ShiftStoreUtils": "0xCfad9CB2a681b63884AEf98af28458692137c9E3",
1721
- "WithdrawalStoreUtils": "0xD521Cb31B14bB9F70D9a59b47D8763336CAD0395"
1722
- },
1723
- "devdoc": {
1724
- "details": "Router for exchange functions, supports functions which require token transfers from the user IMPORTANT: PayableMulticall uses delegatecall, msg.value will be the same for each delegatecall extra care should be taken when using msg.value in any of the functions in this contract To avoid front-running issues, most actions require two steps to execute: - User sends transaction with request details, e.g. deposit / withdraw liquidity, swap, increase / decrease position - Keepers listen for the transactions, include the prices for the request then send a transaction to execute the request Prices are provided by an off-chain oracle system: - Oracle keepers continually check the latest blocks - When there is a new block, oracle keepers fetch the latest prices from reference exchanges - Oracle keepers then sign the median price for each token together with the block hash - Oracle keepers then send the data and signature to archive nodes - Archive nodes display this information for anyone to query Example: - Block 100 is finalized on the blockchain - Oracle keepers observe this block - Oracle keepers pull the latest prices from reference exchanges, token A: price 20,000, token B: price 80,000 - Oracle keepers sign [chainId, blockhash(100), 20,000], [chainId, blockhash(100), 80,000] - If in block 100, there was a market order to open a long position for token A, the market order would have a block number of 100 - The prices signed at block 100 can be used to execute this order - Order keepers would bundle the signature and price data for token A then execute the order",
1725
- "kind": "dev",
1726
- "methods": {
1727
- "cancelOrder(bytes32)": {
1728
- "details": "Cancels the given order. The `cancelOrder()` feature must be enabled for the given order type. The caller must be the owner of the order, and the order must not be a market order. The order is cancelled by calling the `cancelOrder()` function in the `OrderUtils` contract. This function also records the starting gas amount and the reason for cancellation, which is passed to the `cancelOrder()` function.",
1729
- "params": {
1730
- "key": "The unique ID of the order to be cancelled"
1731
- }
1732
- },
1733
- "claimAffiliateRewards(address[],address[],address)": {
1734
- "details": "Claims affiliate rewards for the given markets and tokens on behalf of the caller, and sends the rewards to the specified receiver. The length of the `markets` and `tokens` arrays must be the same. For each market-token pair, the `claimAffiliateReward()` function in the `ReferralUtils` contract is called to claim the rewards for the caller.",
1735
- "params": {
1736
- "markets": "An array of market addresses",
1737
- "receiver": "The address to which the claimed rewards should be sent",
1738
- "tokens": "An array of token addresses, corresponding to the given markets"
1739
- }
1740
- },
1741
- "claimFundingFees(address[],address[],address)": {
1742
- "details": "Claims funding fees for the given markets and tokens on behalf of the caller, and sends the fees to the specified receiver. The length of the `markets` and `tokens` arrays must be the same. For each market-token pair, the `claimFundingFees()` function in the `MarketUtils` contract is called to claim the fees for the caller.",
1743
- "params": {
1744
- "markets": "An array of market addresses",
1745
- "receiver": "The address to which the claimed fees should be sent",
1746
- "tokens": "An array of token addresses, corresponding to the given markets"
1747
- }
1748
- },
1749
- "createDeposit((address,address,address,address,address,address,address[],address[],uint256,bool,uint256,uint256))": {
1750
- "details": "Creates a new deposit with the given long token, short token, long token amount, short token amount, and deposit parameters. The deposit is created by transferring the specified amounts of long and short tokens from the caller's account to the deposit store, and then calling the `createDeposit()` function on the deposit handler contract.",
1751
- "params": {
1752
- "params": "The deposit parameters, as specified in the `DepositUtils.CreateDepositParams` struct"
1753
- },
1754
- "returns": {
1755
- "_0": "The unique ID of the newly created deposit"
1756
- }
1757
- },
1758
- "createOrder(((address,address,address,address,address,address,address[]),(uint256,uint256,uint256,uint256,uint256,uint256,uint256),uint8,uint8,bool,bool,bool,bytes32))": {
1759
- "details": "Creates a new order with the given amount, order parameters. The order is created by transferring the specified amount of collateral tokens from the caller's account to the order store, and then calling the `createOrder()` function on the order handler contract. The referral code is also set on the caller's account using the referral storage contract."
1760
- },
1761
- "multicall(bytes[])": {
1762
- "details": "Receives and executes a batch of function calls on this contract."
1763
- },
1764
- "updateOrder(bytes32,uint256,uint256,uint256,uint256,bool)": {
1765
- "details": "Updates the given order with the specified size delta, acceptable price, and trigger price. The `updateOrder()` feature must be enabled for the given order type. The caller must be the owner of the order, and the order must not be a market order. The size delta, trigger price, and acceptable price are updated on the order, and the order is unfrozen. Any additional WNT that is transferred to the contract is added to the order's execution fee. The updated order is then saved in the order store, and an `OrderUpdated` event is emitted.",
1766
- "params": {
1767
- "acceptablePrice": "The new acceptable price for the order",
1768
- "key": "The unique ID of the order to be updated",
1769
- "sizeDeltaUsd": "The new size delta for the order",
1770
- "triggerPrice": "The new trigger price for the order"
1771
- }
1772
- }
1773
- },
1774
- "title": "ExchangeRouter",
1775
- "version": 1
1776
- },
1777
- "userdoc": {
1778
- "kind": "user",
1779
- "methods": {},
1780
- "version": 1
1781
- },
1782
- "storageLayout": {
1783
- "storage": [
1784
- {
1785
- "astId": 115,
1786
- "contract": "contracts/router/ExchangeRouter.sol:ExchangeRouter",
1787
- "label": "_status",
1788
- "offset": 0,
1789
- "slot": "0",
1790
- "type": "t_uint256"
1791
- }
1792
- ],
1793
- "types": {
1794
- "t_uint256": {
1795
- "encoding": "inplace",
1796
- "label": "uint256",
1797
- "numberOfBytes": "32"
1798
- }
1799
- }
1800
- }
1705
+ ]
1801
1706
  }