@gmx-io/sdk 0.2.0 → 1.0.0-alpha.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 (435) hide show
  1. package/README.md +28 -1
  2. package/build/cjs/scripts/prebuild/index.js +11 -0
  3. package/build/cjs/scripts/prebuild/prebuildKinkModelMarketRatesKeys.js +51 -0
  4. package/build/cjs/scripts/prebuild/prebuildMarketConfigKeys.js +25 -0
  5. package/build/cjs/scripts/prebuild/prebuildMarketValuesKeys.js +25 -0
  6. package/build/cjs/src/abis/CustomErrors.json +3254 -0
  7. package/build/cjs/src/abis/DataStore.json +1440 -0
  8. package/build/cjs/src/abis/ERC721.json +442 -0
  9. package/build/cjs/src/abis/EventEmitter.json +2065 -0
  10. package/build/cjs/src/abis/ExchangeRouter.json +1801 -0
  11. package/build/cjs/src/abis/GMT.json +522 -0
  12. package/build/cjs/src/abis/GlpManager.json +591 -0
  13. package/build/cjs/src/abis/GlvReader.json +1414 -0
  14. package/build/cjs/src/abis/GlvRouter.json +706 -0
  15. package/build/cjs/src/abis/GmxMigrator.json +657 -0
  16. package/build/cjs/src/abis/GovToken.json +1121 -0
  17. package/build/cjs/src/abis/MintableBaseToken.json +696 -0
  18. package/build/cjs/src/abis/Multicall.json +333 -0
  19. package/build/cjs/src/abis/OrderBook.json +1997 -0
  20. package/build/cjs/src/abis/OrderBookReader.json +111 -0
  21. package/build/cjs/src/abis/OrderExecutor.json +122 -0
  22. package/build/cjs/src/abis/PositionManager.json +1165 -0
  23. package/build/cjs/src/abis/PositionRouter.json +2030 -0
  24. package/build/cjs/src/abis/Reader.json +355 -0
  25. package/build/cjs/src/abis/ReaderV2.json +630 -0
  26. package/build/cjs/src/abis/ReferralStorage.json +507 -0
  27. package/build/cjs/src/abis/RewardReader.json +86 -0
  28. package/build/cjs/src/abis/RewardRouter.json +1024 -0
  29. package/build/cjs/src/abis/RewardTracker.json +918 -0
  30. package/build/cjs/src/abis/Router-v2.json +605 -0
  31. package/build/cjs/src/abis/Router.json +605 -0
  32. package/build/cjs/src/abis/SubaccountRouter.json +658 -0
  33. package/build/cjs/src/abis/SyntheticsReader.json +4706 -0
  34. package/build/cjs/src/abis/SyntheticsRouter.json +77 -0
  35. package/build/cjs/src/abis/Timelock.json +1737 -0
  36. package/build/cjs/src/abis/Token.json +345 -0
  37. package/build/cjs/src/abis/Treasury.json +411 -0
  38. package/build/cjs/src/abis/UniPool.json +89 -0
  39. package/build/cjs/src/abis/UniswapV2.json +1 -0
  40. package/build/cjs/src/abis/Vault.json +3220 -0
  41. package/build/cjs/src/abis/VaultReader.json +87 -0
  42. package/build/cjs/src/abis/VaultV2.json +3019 -0
  43. package/build/cjs/src/abis/VaultV2b.json +3220 -0
  44. package/build/cjs/src/abis/Vester.json +1031 -0
  45. package/build/cjs/src/abis/WETH.json +320 -0
  46. package/build/cjs/src/abis/YieldFarm.json +599 -0
  47. package/build/cjs/src/abis/YieldToken.json +560 -0
  48. package/build/cjs/src/abis/index.js +94 -0
  49. package/build/cjs/src/configs/__tests__/markets.spec.js +32 -0
  50. package/build/cjs/src/configs/__tests__/tokens.spec.js +40 -0
  51. package/build/cjs/src/configs/batch.js +42 -0
  52. package/build/cjs/src/configs/chains.js +98 -0
  53. package/build/cjs/src/configs/contracts.js +248 -0
  54. package/build/cjs/src/configs/dataStore.js +348 -0
  55. package/build/cjs/src/configs/factors.js +14 -0
  56. package/build/cjs/src/configs/markets.js +840 -0
  57. package/build/cjs/src/configs/oracleKeeper.js +45 -0
  58. package/build/cjs/src/configs/tokens.js +1635 -0
  59. package/build/cjs/src/index.js +75 -0
  60. package/build/cjs/src/modules/accounts/accounts.js +39 -0
  61. package/build/cjs/src/modules/accounts/accounts.spec.js +10 -0
  62. package/build/cjs/src/modules/base.js +19 -0
  63. package/build/cjs/src/modules/markets/index.js +334 -0
  64. package/build/cjs/src/modules/markets/markets.spec.js +40 -0
  65. package/build/cjs/src/modules/markets/query-builders.js +385 -0
  66. package/build/cjs/src/modules/markets/types.js +2 -0
  67. package/build/cjs/src/modules/oracle.js +45 -0
  68. package/build/cjs/src/modules/orders/helpers.js +225 -0
  69. package/build/cjs/src/modules/orders/helpers.spec.js +131 -0
  70. package/build/cjs/src/modules/orders/orders.js +293 -0
  71. package/build/cjs/src/modules/orders/orders.spec.js +19 -0
  72. package/build/cjs/src/modules/orders/transactions/cancelOrdersTxn.js +20 -0
  73. package/build/cjs/src/modules/orders/transactions/createDecreaseOrderTxn.js +104 -0
  74. package/build/cjs/src/modules/orders/transactions/createIncreaseOrderTxn.js +174 -0
  75. package/build/cjs/src/modules/orders/transactions/createSwapOrderTxn.js +84 -0
  76. package/build/cjs/src/modules/orders/transactions/createWrapOrUnwrapTxn.js +17 -0
  77. package/build/cjs/src/modules/orders/transactions/updateOrderTxn.js +51 -0
  78. package/build/cjs/src/modules/orders/utils.js +157 -0
  79. package/build/cjs/src/modules/positions/positions.js +501 -0
  80. package/build/cjs/src/modules/positions/positions.spec.js +28 -0
  81. package/build/cjs/src/modules/tokens/tokens.js +135 -0
  82. package/build/cjs/src/modules/tokens/tokens.spec.js +29 -0
  83. package/build/cjs/src/modules/trades/trades.js +395 -0
  84. package/build/cjs/src/modules/trades/trades.spec.js +17 -0
  85. package/build/cjs/src/modules/utils/utils.js +211 -0
  86. package/build/cjs/src/package.json +1 -0
  87. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +944 -0
  88. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +5858 -0
  89. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +1763 -0
  90. package/build/cjs/src/prebuilt/index.js +15 -0
  91. package/build/cjs/src/test/mock.js +246 -0
  92. package/build/cjs/src/types/common.js +2 -0
  93. package/build/cjs/src/types/fees.js +2 -0
  94. package/build/cjs/src/types/markets.js +2 -0
  95. package/build/cjs/src/types/orders.js +38 -0
  96. package/build/cjs/src/types/positions.js +2 -0
  97. package/build/cjs/src/types/referrals.js +12 -0
  98. package/build/cjs/src/types/sdk.js +2 -0
  99. package/build/cjs/src/types/sidecarOrders.js +2 -0
  100. package/build/cjs/src/types/tokens.js +2 -0
  101. package/build/cjs/src/types/trade.js +25 -0
  102. package/build/cjs/src/types/tradeHistory.js +11 -0
  103. package/build/cjs/src/utils/LruCache.js +49 -0
  104. package/build/cjs/src/utils/__tests__/LruCache.spec.js +45 -0
  105. package/build/cjs/src/utils/__tests__/bigmath.spec.js +40 -0
  106. package/build/cjs/src/utils/__tests__/fees.spec.js +64 -0
  107. package/build/cjs/src/utils/__tests__/hash.spec.js +43 -0
  108. package/build/cjs/src/utils/__tests__/markets.spec.js +267 -0
  109. package/build/cjs/src/utils/__tests__/numbers.spec.js +83 -0
  110. package/build/cjs/src/utils/__tests__/objects.spec.js +139 -0
  111. package/build/cjs/src/utils/__tests__/positions.spec.js +180 -0
  112. package/build/cjs/src/utils/__tests__/prices.spec.js +69 -0
  113. package/build/cjs/src/utils/__tests__/referrals.spec.js +20 -0
  114. package/build/cjs/src/utils/__tests__/subgraph.spec.js +165 -0
  115. package/build/cjs/src/utils/__tests__/tokens.spec.js +115 -0
  116. package/build/cjs/src/utils/__tests__/trade.spec.js +38 -0
  117. package/build/cjs/src/utils/bigmath.js +34 -0
  118. package/build/cjs/src/utils/buildUrl.js +12 -0
  119. package/build/cjs/src/utils/callContract.js +143 -0
  120. package/build/cjs/src/utils/common.js +14 -0
  121. package/build/cjs/src/utils/contracts.js +93 -0
  122. package/build/cjs/src/utils/fees/estimateOraclePriceCount.js +28 -0
  123. package/build/cjs/src/utils/fees/executionFee.js +113 -0
  124. package/build/cjs/src/utils/fees/executionFee.spec.js +66 -0
  125. package/build/cjs/src/utils/fees/getNaiveEstimatedGasBySwapCount.js +8 -0
  126. package/build/cjs/src/utils/fees/index.js +128 -0
  127. package/build/cjs/src/utils/fees/priceImpact.js +300 -0
  128. package/build/cjs/src/utils/graphqlFetcher.js +24 -0
  129. package/build/cjs/src/utils/hash.js +41 -0
  130. package/build/cjs/src/utils/marketKeysAndConfigs.js +262 -0
  131. package/build/cjs/src/utils/markets.js +169 -0
  132. package/build/cjs/src/utils/multicall.js +125 -0
  133. package/build/cjs/src/utils/numbers.js +73 -0
  134. package/build/cjs/src/utils/objects.js +47 -0
  135. package/build/cjs/src/utils/orders.js +210 -0
  136. package/build/cjs/src/utils/positions.js +145 -0
  137. package/build/cjs/src/utils/prices.js +141 -0
  138. package/build/cjs/src/utils/referrals.js +34 -0
  139. package/build/cjs/src/utils/simulateExecuteOrder.js +143 -0
  140. package/build/cjs/src/utils/subgraph.js +76 -0
  141. package/build/cjs/src/utils/swap/__tests__/buildMarketsAdjacencyGraph.spec.js +118 -0
  142. package/build/cjs/src/utils/swap/__tests__/findReachableTokens.spec.js +118 -0
  143. package/build/cjs/src/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.js +150 -0
  144. package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +429 -0
  145. package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +617 -0
  146. package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +388 -0
  147. package/build/cjs/src/utils/swap/buildMarketsAdjacencyGraph.js +25 -0
  148. package/build/cjs/src/utils/swap/constants.js +5 -0
  149. package/build/cjs/src/utils/swap/findReachableTokens.js +37 -0
  150. package/build/cjs/src/utils/swap/findSwapPathsBetweenTokens.js +75 -0
  151. package/build/cjs/src/utils/swap/index.js +18 -0
  152. package/build/cjs/src/utils/swap/preparedSwapData.js +28 -0
  153. package/build/cjs/src/utils/swap/swapPath.js +132 -0
  154. package/build/cjs/src/utils/swap/swapRouting.js +359 -0
  155. package/build/cjs/src/utils/swap/swapStats.js +258 -0
  156. package/build/cjs/src/utils/swap/swapValues.js +190 -0
  157. package/build/cjs/src/utils/testUtil.js +23 -0
  158. package/build/cjs/src/utils/tokens.js +144 -0
  159. package/build/cjs/src/utils/trade/amounts.js +317 -0
  160. package/build/cjs/src/utils/trade/index.js +17 -0
  161. package/build/cjs/src/utils/trade/trade.js +61 -0
  162. package/build/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  163. package/build/esm/src/abis/CustomErrors.json +3254 -0
  164. package/build/esm/src/abis/DataStore.json +1440 -0
  165. package/build/esm/src/abis/ERC721.json +442 -0
  166. package/build/esm/src/abis/EventEmitter.json +2065 -0
  167. package/build/esm/src/abis/ExchangeRouter.json +1801 -0
  168. package/build/esm/src/abis/GMT.json +522 -0
  169. package/build/esm/src/abis/GlpManager.json +591 -0
  170. package/build/esm/src/abis/GlvReader.json +1414 -0
  171. package/build/esm/src/abis/GlvRouter.json +706 -0
  172. package/build/esm/src/abis/GmxMigrator.json +657 -0
  173. package/build/esm/src/abis/GovToken.json +1121 -0
  174. package/build/esm/src/abis/MintableBaseToken.json +696 -0
  175. package/build/esm/src/abis/Multicall.json +333 -0
  176. package/build/esm/src/abis/OrderBook.json +1997 -0
  177. package/build/esm/src/abis/OrderBookReader.json +111 -0
  178. package/build/esm/src/abis/OrderExecutor.json +122 -0
  179. package/build/esm/src/abis/PositionManager.json +1165 -0
  180. package/build/esm/src/abis/PositionRouter.json +2030 -0
  181. package/build/esm/src/abis/Reader.json +355 -0
  182. package/build/esm/src/abis/ReaderV2.json +630 -0
  183. package/build/esm/src/abis/ReferralStorage.json +507 -0
  184. package/build/esm/src/abis/RewardReader.json +86 -0
  185. package/build/esm/src/abis/RewardRouter.json +1024 -0
  186. package/build/esm/src/abis/RewardTracker.json +918 -0
  187. package/build/esm/src/abis/Router-v2.json +605 -0
  188. package/build/esm/src/abis/Router.json +605 -0
  189. package/build/esm/src/abis/SubaccountRouter.json +658 -0
  190. package/build/esm/src/abis/SyntheticsReader.json +4706 -0
  191. package/build/esm/src/abis/SyntheticsRouter.json +77 -0
  192. package/build/esm/src/abis/Timelock.json +1737 -0
  193. package/build/esm/src/abis/Token.json +345 -0
  194. package/build/esm/src/abis/Treasury.json +411 -0
  195. package/build/esm/src/abis/UniPool.json +89 -0
  196. package/build/esm/src/abis/UniswapV2.json +1 -0
  197. package/build/esm/src/abis/Vault.json +3220 -0
  198. package/build/esm/src/abis/VaultReader.json +87 -0
  199. package/build/esm/src/abis/VaultV2.json +3019 -0
  200. package/build/esm/src/abis/VaultV2b.json +3220 -0
  201. package/build/esm/src/abis/Vester.json +1031 -0
  202. package/build/esm/src/abis/WETH.json +320 -0
  203. package/build/esm/src/abis/YieldFarm.json +599 -0
  204. package/build/esm/src/abis/YieldToken.json +560 -0
  205. package/build/esm/src/abis/index.js +88 -0
  206. package/build/esm/src/configs/__tests__/markets.spec.js +30 -0
  207. package/build/esm/src/configs/__tests__/tokens.spec.js +38 -0
  208. package/build/{src → esm/src}/configs/chains.js +1 -1
  209. package/build/{src → esm/src}/configs/contracts.js +10 -4
  210. package/build/{src → esm/src}/configs/factors.js +3 -1
  211. package/build/{src → esm/src}/configs/markets.js +92 -0
  212. package/build/esm/src/configs/oracleKeeper.js +36 -0
  213. package/build/{src → esm/src}/configs/tokens.js +154 -13
  214. package/build/{src → esm/src}/modules/accounts/accounts.js +1 -2
  215. package/build/{src → esm/src}/modules/markets/index.js +1 -2
  216. package/build/{src → esm/src}/modules/markets/query-builders.js +8 -10
  217. package/build/esm/src/modules/orders/helpers.js +220 -0
  218. package/build/esm/src/modules/orders/helpers.spec.js +106 -0
  219. package/build/{src → esm/src}/modules/orders/orders.js +20 -2
  220. package/build/{src → esm/src}/modules/orders/transactions/cancelOrdersTxn.js +3 -3
  221. package/build/{src → esm/src}/modules/orders/transactions/createDecreaseOrderTxn.js +5 -5
  222. package/build/{src → esm/src}/modules/orders/transactions/createIncreaseOrderTxn.js +8 -7
  223. package/build/{src → esm/src}/modules/orders/transactions/createSwapOrderTxn.js +5 -5
  224. package/build/{src → esm/src}/modules/orders/transactions/createWrapOrUnwrapTxn.js +3 -3
  225. package/build/{src → esm/src}/modules/orders/transactions/updateOrderTxn.js +4 -4
  226. package/build/{src → esm/src}/modules/orders/utils.js +4 -6
  227. package/build/{src → esm/src}/modules/positions/positions.js +11 -14
  228. package/build/{src → esm/src}/modules/tokens/tokens.js +4 -10
  229. package/build/{src → esm/src}/modules/trades/trades.js +3 -3
  230. package/build/{src → esm/src}/modules/utils/utils.js +27 -3
  231. package/build/esm/src/package.json +1 -0
  232. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +944 -0
  233. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +5858 -0
  234. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +1763 -0
  235. package/build/{src → esm/src}/prebuilt/index.js +3 -7
  236. package/build/esm/src/test/mock.js +238 -0
  237. package/build/{src → esm/src}/types/orders.js +2 -0
  238. package/build/{src → esm/src}/types/trade.js +5 -0
  239. package/build/{src → esm/src}/utils/__tests__/markets.spec.js +4 -4
  240. package/build/esm/src/utils/__tests__/objects.spec.js +137 -0
  241. package/build/{src → esm/src}/utils/__tests__/prices.spec.js +16 -8
  242. package/build/{src → esm/src}/utils/__tests__/tokens.spec.js +33 -3
  243. package/build/{src → esm/src}/utils/bigmath.js +3 -0
  244. package/build/{src → esm/src}/utils/fees/executionFee.js +3 -1
  245. package/build/esm/src/utils/fees/getNaiveEstimatedGasBySwapCount.js +4 -0
  246. package/build/{src → esm/src}/utils/markets.js +0 -3
  247. package/build/{src → esm/src}/utils/multicall.js +5 -3
  248. package/build/{src → esm/src}/utils/numbers.js +5 -1
  249. package/build/esm/src/utils/objects.js +36 -0
  250. package/build/{src → esm/src}/utils/orders.js +42 -13
  251. package/build/esm/src/utils/prices.js +132 -0
  252. package/build/{src → esm/src}/utils/simulateExecuteOrder.js +14 -10
  253. package/build/esm/src/utils/swap/__tests__/buildMarketsAdjacencyGraph.spec.js +116 -0
  254. package/build/esm/src/utils/swap/__tests__/findReachableTokens.spec.js +116 -0
  255. package/build/esm/src/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.js +148 -0
  256. package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +427 -0
  257. package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +615 -0
  258. package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +386 -0
  259. package/build/esm/src/utils/swap/buildMarketsAdjacencyGraph.js +21 -0
  260. package/build/esm/src/utils/swap/constants.js +2 -0
  261. package/build/esm/src/utils/swap/findReachableTokens.js +33 -0
  262. package/build/esm/src/utils/swap/findSwapPathsBetweenTokens.js +71 -0
  263. package/build/esm/src/utils/swap/index.js +2 -0
  264. package/build/esm/src/utils/swap/preparedSwapData.js +23 -0
  265. package/build/esm/src/utils/swap/swapPath.js +127 -0
  266. package/build/esm/src/utils/swap/swapRouting.js +341 -0
  267. package/build/{src/utils → esm/src/utils/swap}/swapStats.js +49 -7
  268. package/build/esm/src/utils/swap/swapValues.js +184 -0
  269. package/build/esm/src/utils/tokens.js +127 -0
  270. package/build/esm/src/utils/trade/amounts.js +310 -0
  271. package/build/esm/src/utils/trade/index.js +1 -0
  272. package/build/{src/utils → esm/src/utils/trade}/trade.js +26 -4
  273. package/build/esm/tsconfig.esm.tsbuildinfo +1 -0
  274. package/build/src/abis/index.d.ts +4 -0
  275. package/build/src/configs/__tests__/markets.spec.d.ts +1 -0
  276. package/build/src/configs/__tests__/tokens.spec.d.ts +1 -0
  277. package/build/src/configs/chains.d.ts +7 -22
  278. package/build/src/configs/contracts.d.ts +1 -220
  279. package/build/src/configs/factors.d.ts +3 -1
  280. package/build/src/configs/markets.d.ts +2 -1
  281. package/build/src/configs/oracleKeeper.d.ts +3 -0
  282. package/build/src/configs/tokens.d.ts +4 -4
  283. package/build/src/modules/markets/query-builders.d.ts +5 -4
  284. package/build/src/modules/oracle.d.ts +7 -3
  285. package/build/src/modules/orders/helpers.d.ts +50 -0
  286. package/build/src/modules/orders/helpers.spec.d.ts +1 -0
  287. package/build/src/modules/orders/orders.d.ts +6 -1
  288. package/build/src/modules/orders/transactions/createDecreaseOrderTxn.d.ts +1 -1
  289. package/build/src/modules/orders/transactions/createSwapOrderTxn.d.ts +1 -0
  290. package/build/src/modules/orders/transactions/updateOrderTxn.d.ts +2 -2
  291. package/build/src/modules/orders/utils.d.ts +5 -200
  292. package/build/src/modules/positions/positions.d.ts +1 -1
  293. package/build/src/modules/tokens/tokens.d.ts +2 -2
  294. package/build/src/modules/trades/trades.d.ts +2 -2
  295. package/build/src/modules/utils/utils.d.ts +4 -2
  296. package/build/src/prebuilt/index.d.ts +6 -2
  297. package/build/src/test/mock.d.ts +14 -0
  298. package/build/src/types/fees.d.ts +6 -0
  299. package/build/src/types/orders.d.ts +4 -3
  300. package/build/src/types/sdk.d.ts +4 -1
  301. package/build/src/types/tokens.d.ts +5 -0
  302. package/build/src/types/trade.d.ts +84 -9
  303. package/build/src/utils/bigmath.d.ts +1 -0
  304. package/build/src/utils/fees/executionFee.d.ts +1 -1
  305. package/build/src/utils/fees/getNaiveEstimatedGasBySwapCount.d.ts +2 -0
  306. package/build/src/utils/hash.d.ts +1 -1
  307. package/build/src/utils/multicall.d.ts +2 -1
  308. package/build/src/utils/numbers.d.ts +2 -0
  309. package/build/src/utils/objects.d.ts +6 -0
  310. package/build/src/utils/orders.d.ts +1 -0
  311. package/build/src/utils/positions.d.ts +1 -1
  312. package/build/src/utils/prices.d.ts +35 -1
  313. package/build/src/utils/swap/__tests__/buildMarketsAdjacencyGraph.spec.d.ts +1 -0
  314. package/build/src/utils/swap/__tests__/findReachableTokens.spec.d.ts +1 -0
  315. package/build/src/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.d.ts +1 -0
  316. package/build/src/utils/swap/__tests__/mockRouting.spec.d.ts +1 -0
  317. package/build/src/utils/swap/__tests__/swapRouting.spec.d.ts +1 -0
  318. package/build/src/utils/swap/__tests__/swapStats.spec.d.ts +1 -0
  319. package/build/src/utils/swap/buildMarketsAdjacencyGraph.d.ts +11 -0
  320. package/build/src/utils/swap/constants.d.ts +2 -0
  321. package/build/src/utils/swap/findReachableTokens.d.ts +2 -0
  322. package/build/src/utils/swap/findSwapPathsBetweenTokens.d.ts +3 -0
  323. package/build/src/utils/swap/index.d.ts +2 -0
  324. package/build/src/utils/swap/preparedSwapData.d.ts +14 -0
  325. package/build/src/utils/swap/swapPath.d.ts +23 -0
  326. package/build/src/utils/swap/swapRouting.d.ts +67 -0
  327. package/build/src/utils/{swapStats.d.ts → swap/swapStats.d.ts} +7 -2
  328. package/build/src/utils/swap/swapValues.d.ts +26 -0
  329. package/build/src/utils/testUtil.d.ts +2 -14560
  330. package/build/src/utils/tokens.d.ts +25 -1
  331. package/build/src/utils/trade/amounts.d.ts +70 -0
  332. package/build/src/utils/trade/index.d.ts +1 -0
  333. package/build/src/utils/{trade.d.ts → trade/trade.d.ts} +2 -1
  334. package/package.json +43 -12
  335. package/build/src/abis/CustomErrors.json +0 -3254
  336. package/build/src/abis/DataStore.json +0 -1440
  337. package/build/src/abis/ERC721.json +0 -442
  338. package/build/src/abis/EventEmitter.json +0 -2065
  339. package/build/src/abis/ExchangeRouter.json +0 -1801
  340. package/build/src/abis/GMT.json +0 -522
  341. package/build/src/abis/GlpManager.json +0 -592
  342. package/build/src/abis/GlvReader.json +0 -1415
  343. package/build/src/abis/GlvRouter.json +0 -707
  344. package/build/src/abis/GmxMigrator.json +0 -657
  345. package/build/src/abis/GovToken.json +0 -1121
  346. package/build/src/abis/MintableBaseToken.json +0 -696
  347. package/build/src/abis/Multicall.json +0 -333
  348. package/build/src/abis/OrderBook.json +0 -1997
  349. package/build/src/abis/OrderBookReader.json +0 -111
  350. package/build/src/abis/OrderExecutor.json +0 -122
  351. package/build/src/abis/PositionManager.json +0 -1165
  352. package/build/src/abis/PositionRouter.json +0 -2030
  353. package/build/src/abis/Reader.json +0 -355
  354. package/build/src/abis/ReaderV2.json +0 -630
  355. package/build/src/abis/ReferralStorage.json +0 -507
  356. package/build/src/abis/RewardReader.json +0 -86
  357. package/build/src/abis/RewardRouter.json +0 -1024
  358. package/build/src/abis/RewardTracker.json +0 -918
  359. package/build/src/abis/Router-v2.json +0 -605
  360. package/build/src/abis/Router.json +0 -605
  361. package/build/src/abis/SubaccountRouter.json +0 -658
  362. package/build/src/abis/SyntheticsReader.json +0 -4709
  363. package/build/src/abis/SyntheticsRouter.json +0 -77
  364. package/build/src/abis/Timelock.json +0 -1737
  365. package/build/src/abis/Token.json +0 -345
  366. package/build/src/abis/Treasury.json +0 -411
  367. package/build/src/abis/UniPool.json +0 -89
  368. package/build/src/abis/UniswapV2.json +0 -1
  369. package/build/src/abis/Vault.json +0 -3220
  370. package/build/src/abis/VaultReader.json +0 -87
  371. package/build/src/abis/VaultV2.json +0 -3019
  372. package/build/src/abis/VaultV2b.json +0 -3220
  373. package/build/src/abis/Vester.json +0 -1031
  374. package/build/src/abis/WETH.json +0 -320
  375. package/build/src/abis/YieldFarm.json +0 -599
  376. package/build/src/abis/YieldToken.json +0 -560
  377. package/build/src/prebuilt/hashedKinkModelMarketRatesKeys.json +0 -840
  378. package/build/src/prebuilt/hashedMarketConfigKeys.json +0 -5208
  379. package/build/src/prebuilt/hashedMarketValuesKeys.json +0 -1568
  380. package/build/src/prebuilt/index.ts +0 -45
  381. package/build/src/utils/__tests__/objects.spec.js +0 -59
  382. package/build/src/utils/objects.js +0 -13
  383. package/build/src/utils/prices.js +0 -25
  384. package/build/src/utils/tokens.js +0 -68
  385. package/build/tsconfig.tsbuildinfo +0 -1
  386. package/build/{scripts → esm/scripts}/prebuild/index.js +2 -2
  387. package/build/{scripts → esm/scripts}/prebuild/prebuildKinkModelMarketRatesKeys.js +1 -1
  388. package/build/{scripts → esm/scripts}/prebuild/prebuildMarketConfigKeys.js +1 -1
  389. package/build/{scripts → esm/scripts}/prebuild/prebuildMarketValuesKeys.js +0 -0
  390. package/build/{src → esm/src}/configs/batch.js +0 -0
  391. package/build/{src → esm/src}/configs/dataStore.js +0 -0
  392. package/build/{src → esm/src}/index.js +2 -2
  393. package/build/{src → esm/src}/modules/accounts/accounts.spec.js +0 -0
  394. package/build/{src → esm/src}/modules/base.js +0 -0
  395. package/build/{src → esm/src}/modules/markets/markets.spec.js +2 -2
  396. package/build/{src → esm/src}/modules/markets/types.js +0 -0
  397. package/build/{src → esm/src}/modules/oracle.js +0 -0
  398. package/build/{src → esm/src}/modules/orders/orders.spec.js +0 -0
  399. package/build/{src → esm/src}/modules/positions/positions.spec.js +1 -1
  400. package/build/{src → esm/src}/modules/tokens/tokens.spec.js +1 -1
  401. package/build/{src → esm/src}/modules/trades/trades.spec.js +0 -0
  402. package/build/{src → esm/src}/types/common.js +0 -0
  403. package/build/{src → esm/src}/types/fees.js +0 -0
  404. package/build/{src → esm/src}/types/markets.js +0 -0
  405. package/build/{src → esm/src}/types/positions.js +0 -0
  406. package/build/{src → esm/src}/types/referrals.js +0 -0
  407. package/build/{src → esm/src}/types/sdk.js +0 -0
  408. package/build/{src → esm/src}/types/sidecarOrders.js +0 -0
  409. package/build/{src → esm/src}/types/tokens.js +0 -0
  410. package/build/{src → esm/src}/types/tradeHistory.js +0 -0
  411. package/build/{src → esm/src}/utils/LruCache.js +0 -0
  412. package/build/{src → esm/src}/utils/__tests__/LruCache.spec.js +0 -0
  413. package/build/{src → esm/src}/utils/__tests__/bigmath.spec.js +1 -1
  414. package/build/{src → esm/src}/utils/__tests__/fees.spec.js +1 -1
  415. package/build/{src → esm/src}/utils/__tests__/hash.spec.js +1 -1
  416. package/build/{src → esm/src}/utils/__tests__/numbers.spec.js +0 -0
  417. package/build/{src → esm/src}/utils/__tests__/positions.spec.js +0 -0
  418. package/build/{src → esm/src}/utils/__tests__/referrals.spec.js +1 -1
  419. package/build/{src → esm/src}/utils/__tests__/subgraph.spec.js +0 -0
  420. package/build/{src → esm/src}/utils/__tests__/trade.spec.js +0 -0
  421. package/build/{src → esm/src}/utils/buildUrl.js +0 -0
  422. package/build/{src → esm/src}/utils/callContract.js +0 -0
  423. package/build/{src → esm/src}/utils/common.js +0 -0
  424. package/build/{src → esm/src}/utils/contracts.js +0 -0
  425. package/build/{src → esm/src}/utils/fees/estimateOraclePriceCount.js +0 -0
  426. package/build/{src → esm/src}/utils/fees/executionFee.spec.js +2 -2
  427. package/build/{src → esm/src}/utils/fees/index.js +0 -0
  428. package/build/{src → esm/src}/utils/fees/priceImpact.js +0 -0
  429. package/build/{src → esm/src}/utils/graphqlFetcher.js +0 -0
  430. package/build/{src → esm/src}/utils/hash.js +0 -0
  431. package/build/{src → esm/src}/utils/marketKeysAndConfigs.js +1 -1
  432. package/build/{src → esm/src}/utils/positions.js +3 -3
  433. /package/build/{src → esm/src}/utils/referrals.js +0 -0
  434. /package/build/{src → esm/src}/utils/subgraph.js +0 -0
  435. /package/build/{src → esm/src}/utils/testUtil.js +0 -0
@@ -0,0 +1,4706 @@
1
+ {
2
+ "address": "0x23D4Da5C7C6902D4C86d551CaE60d5755820df9E",
3
+ "abi": [
4
+ {
5
+ "inputs": [
6
+ {
7
+ "internalType": "contract DataStore",
8
+ "name": "dataStore",
9
+ "type": "address"
10
+ },
11
+ {
12
+ "internalType": "address",
13
+ "name": "account",
14
+ "type": "address"
15
+ },
16
+ {
17
+ "internalType": "uint256",
18
+ "name": "start",
19
+ "type": "uint256"
20
+ },
21
+ {
22
+ "internalType": "uint256",
23
+ "name": "end",
24
+ "type": "uint256"
25
+ }
26
+ ],
27
+ "name": "getAccountOrders",
28
+ "outputs": [
29
+ {
30
+ "components": [
31
+ {
32
+ "components": [
33
+ {
34
+ "internalType": "address",
35
+ "name": "account",
36
+ "type": "address"
37
+ },
38
+ {
39
+ "internalType": "address",
40
+ "name": "receiver",
41
+ "type": "address"
42
+ },
43
+ {
44
+ "internalType": "address",
45
+ "name": "cancellationReceiver",
46
+ "type": "address"
47
+ },
48
+ {
49
+ "internalType": "address",
50
+ "name": "callbackContract",
51
+ "type": "address"
52
+ },
53
+ {
54
+ "internalType": "address",
55
+ "name": "uiFeeReceiver",
56
+ "type": "address"
57
+ },
58
+ {
59
+ "internalType": "address",
60
+ "name": "market",
61
+ "type": "address"
62
+ },
63
+ {
64
+ "internalType": "address",
65
+ "name": "initialCollateralToken",
66
+ "type": "address"
67
+ },
68
+ {
69
+ "internalType": "address[]",
70
+ "name": "swapPath",
71
+ "type": "address[]"
72
+ }
73
+ ],
74
+ "internalType": "struct Order.Addresses",
75
+ "name": "addresses",
76
+ "type": "tuple"
77
+ },
78
+ {
79
+ "components": [
80
+ {
81
+ "internalType": "enum Order.OrderType",
82
+ "name": "orderType",
83
+ "type": "uint8"
84
+ },
85
+ {
86
+ "internalType": "enum Order.DecreasePositionSwapType",
87
+ "name": "decreasePositionSwapType",
88
+ "type": "uint8"
89
+ },
90
+ {
91
+ "internalType": "uint256",
92
+ "name": "sizeDeltaUsd",
93
+ "type": "uint256"
94
+ },
95
+ {
96
+ "internalType": "uint256",
97
+ "name": "initialCollateralDeltaAmount",
98
+ "type": "uint256"
99
+ },
100
+ {
101
+ "internalType": "uint256",
102
+ "name": "triggerPrice",
103
+ "type": "uint256"
104
+ },
105
+ {
106
+ "internalType": "uint256",
107
+ "name": "acceptablePrice",
108
+ "type": "uint256"
109
+ },
110
+ {
111
+ "internalType": "uint256",
112
+ "name": "executionFee",
113
+ "type": "uint256"
114
+ },
115
+ {
116
+ "internalType": "uint256",
117
+ "name": "callbackGasLimit",
118
+ "type": "uint256"
119
+ },
120
+ {
121
+ "internalType": "uint256",
122
+ "name": "minOutputAmount",
123
+ "type": "uint256"
124
+ },
125
+ {
126
+ "internalType": "uint256",
127
+ "name": "updatedAtTime",
128
+ "type": "uint256"
129
+ },
130
+ {
131
+ "internalType": "uint256",
132
+ "name": "validFromTime",
133
+ "type": "uint256"
134
+ }
135
+ ],
136
+ "internalType": "struct Order.Numbers",
137
+ "name": "numbers",
138
+ "type": "tuple"
139
+ },
140
+ {
141
+ "components": [
142
+ {
143
+ "internalType": "bool",
144
+ "name": "isLong",
145
+ "type": "bool"
146
+ },
147
+ {
148
+ "internalType": "bool",
149
+ "name": "shouldUnwrapNativeToken",
150
+ "type": "bool"
151
+ },
152
+ {
153
+ "internalType": "bool",
154
+ "name": "isFrozen",
155
+ "type": "bool"
156
+ },
157
+ {
158
+ "internalType": "bool",
159
+ "name": "autoCancel",
160
+ "type": "bool"
161
+ }
162
+ ],
163
+ "internalType": "struct Order.Flags",
164
+ "name": "flags",
165
+ "type": "tuple"
166
+ }
167
+ ],
168
+ "internalType": "struct Order.Props[]",
169
+ "name": "",
170
+ "type": "tuple[]"
171
+ }
172
+ ],
173
+ "stateMutability": "view",
174
+ "type": "function"
175
+ },
176
+ {
177
+ "inputs": [
178
+ {
179
+ "internalType": "contract DataStore",
180
+ "name": "dataStore",
181
+ "type": "address"
182
+ },
183
+ {
184
+ "internalType": "contract IReferralStorage",
185
+ "name": "referralStorage",
186
+ "type": "address"
187
+ },
188
+ {
189
+ "internalType": "address",
190
+ "name": "account",
191
+ "type": "address"
192
+ },
193
+ {
194
+ "internalType": "address[]",
195
+ "name": "markets",
196
+ "type": "address[]"
197
+ },
198
+ {
199
+ "components": [
200
+ {
201
+ "components": [
202
+ {
203
+ "internalType": "uint256",
204
+ "name": "min",
205
+ "type": "uint256"
206
+ },
207
+ {
208
+ "internalType": "uint256",
209
+ "name": "max",
210
+ "type": "uint256"
211
+ }
212
+ ],
213
+ "internalType": "struct Price.Props",
214
+ "name": "indexTokenPrice",
215
+ "type": "tuple"
216
+ },
217
+ {
218
+ "components": [
219
+ {
220
+ "internalType": "uint256",
221
+ "name": "min",
222
+ "type": "uint256"
223
+ },
224
+ {
225
+ "internalType": "uint256",
226
+ "name": "max",
227
+ "type": "uint256"
228
+ }
229
+ ],
230
+ "internalType": "struct Price.Props",
231
+ "name": "longTokenPrice",
232
+ "type": "tuple"
233
+ },
234
+ {
235
+ "components": [
236
+ {
237
+ "internalType": "uint256",
238
+ "name": "min",
239
+ "type": "uint256"
240
+ },
241
+ {
242
+ "internalType": "uint256",
243
+ "name": "max",
244
+ "type": "uint256"
245
+ }
246
+ ],
247
+ "internalType": "struct Price.Props",
248
+ "name": "shortTokenPrice",
249
+ "type": "tuple"
250
+ }
251
+ ],
252
+ "internalType": "struct MarketUtils.MarketPrices[]",
253
+ "name": "marketPrices",
254
+ "type": "tuple[]"
255
+ },
256
+ {
257
+ "internalType": "address",
258
+ "name": "uiFeeReceiver",
259
+ "type": "address"
260
+ },
261
+ {
262
+ "internalType": "uint256",
263
+ "name": "start",
264
+ "type": "uint256"
265
+ },
266
+ {
267
+ "internalType": "uint256",
268
+ "name": "end",
269
+ "type": "uint256"
270
+ }
271
+ ],
272
+ "name": "getAccountPositionInfoList",
273
+ "outputs": [
274
+ {
275
+ "components": [
276
+ {
277
+ "components": [
278
+ {
279
+ "components": [
280
+ {
281
+ "internalType": "address",
282
+ "name": "account",
283
+ "type": "address"
284
+ },
285
+ {
286
+ "internalType": "address",
287
+ "name": "market",
288
+ "type": "address"
289
+ },
290
+ {
291
+ "internalType": "address",
292
+ "name": "collateralToken",
293
+ "type": "address"
294
+ }
295
+ ],
296
+ "internalType": "struct Position.Addresses",
297
+ "name": "addresses",
298
+ "type": "tuple"
299
+ },
300
+ {
301
+ "components": [
302
+ {
303
+ "internalType": "uint256",
304
+ "name": "sizeInUsd",
305
+ "type": "uint256"
306
+ },
307
+ {
308
+ "internalType": "uint256",
309
+ "name": "sizeInTokens",
310
+ "type": "uint256"
311
+ },
312
+ {
313
+ "internalType": "uint256",
314
+ "name": "collateralAmount",
315
+ "type": "uint256"
316
+ },
317
+ {
318
+ "internalType": "uint256",
319
+ "name": "borrowingFactor",
320
+ "type": "uint256"
321
+ },
322
+ {
323
+ "internalType": "uint256",
324
+ "name": "fundingFeeAmountPerSize",
325
+ "type": "uint256"
326
+ },
327
+ {
328
+ "internalType": "uint256",
329
+ "name": "longTokenClaimableFundingAmountPerSize",
330
+ "type": "uint256"
331
+ },
332
+ {
333
+ "internalType": "uint256",
334
+ "name": "shortTokenClaimableFundingAmountPerSize",
335
+ "type": "uint256"
336
+ },
337
+ {
338
+ "internalType": "uint256",
339
+ "name": "increasedAtTime",
340
+ "type": "uint256"
341
+ },
342
+ {
343
+ "internalType": "uint256",
344
+ "name": "decreasedAtTime",
345
+ "type": "uint256"
346
+ }
347
+ ],
348
+ "internalType": "struct Position.Numbers",
349
+ "name": "numbers",
350
+ "type": "tuple"
351
+ },
352
+ {
353
+ "components": [
354
+ {
355
+ "internalType": "bool",
356
+ "name": "isLong",
357
+ "type": "bool"
358
+ }
359
+ ],
360
+ "internalType": "struct Position.Flags",
361
+ "name": "flags",
362
+ "type": "tuple"
363
+ }
364
+ ],
365
+ "internalType": "struct Position.Props",
366
+ "name": "position",
367
+ "type": "tuple"
368
+ },
369
+ {
370
+ "components": [
371
+ {
372
+ "components": [
373
+ {
374
+ "internalType": "bytes32",
375
+ "name": "referralCode",
376
+ "type": "bytes32"
377
+ },
378
+ {
379
+ "internalType": "address",
380
+ "name": "affiliate",
381
+ "type": "address"
382
+ },
383
+ {
384
+ "internalType": "address",
385
+ "name": "trader",
386
+ "type": "address"
387
+ },
388
+ {
389
+ "internalType": "uint256",
390
+ "name": "totalRebateFactor",
391
+ "type": "uint256"
392
+ },
393
+ {
394
+ "internalType": "uint256",
395
+ "name": "affiliateRewardFactor",
396
+ "type": "uint256"
397
+ },
398
+ {
399
+ "internalType": "uint256",
400
+ "name": "adjustedAffiliateRewardFactor",
401
+ "type": "uint256"
402
+ },
403
+ {
404
+ "internalType": "uint256",
405
+ "name": "traderDiscountFactor",
406
+ "type": "uint256"
407
+ },
408
+ {
409
+ "internalType": "uint256",
410
+ "name": "totalRebateAmount",
411
+ "type": "uint256"
412
+ },
413
+ {
414
+ "internalType": "uint256",
415
+ "name": "traderDiscountAmount",
416
+ "type": "uint256"
417
+ },
418
+ {
419
+ "internalType": "uint256",
420
+ "name": "affiliateRewardAmount",
421
+ "type": "uint256"
422
+ }
423
+ ],
424
+ "internalType": "struct PositionPricingUtils.PositionReferralFees",
425
+ "name": "referral",
426
+ "type": "tuple"
427
+ },
428
+ {
429
+ "components": [
430
+ {
431
+ "internalType": "uint256",
432
+ "name": "traderTier",
433
+ "type": "uint256"
434
+ },
435
+ {
436
+ "internalType": "uint256",
437
+ "name": "traderDiscountFactor",
438
+ "type": "uint256"
439
+ },
440
+ {
441
+ "internalType": "uint256",
442
+ "name": "traderDiscountAmount",
443
+ "type": "uint256"
444
+ }
445
+ ],
446
+ "internalType": "struct PositionPricingUtils.PositionProFees",
447
+ "name": "pro",
448
+ "type": "tuple"
449
+ },
450
+ {
451
+ "components": [
452
+ {
453
+ "internalType": "uint256",
454
+ "name": "fundingFeeAmount",
455
+ "type": "uint256"
456
+ },
457
+ {
458
+ "internalType": "uint256",
459
+ "name": "claimableLongTokenAmount",
460
+ "type": "uint256"
461
+ },
462
+ {
463
+ "internalType": "uint256",
464
+ "name": "claimableShortTokenAmount",
465
+ "type": "uint256"
466
+ },
467
+ {
468
+ "internalType": "uint256",
469
+ "name": "latestFundingFeeAmountPerSize",
470
+ "type": "uint256"
471
+ },
472
+ {
473
+ "internalType": "uint256",
474
+ "name": "latestLongTokenClaimableFundingAmountPerSize",
475
+ "type": "uint256"
476
+ },
477
+ {
478
+ "internalType": "uint256",
479
+ "name": "latestShortTokenClaimableFundingAmountPerSize",
480
+ "type": "uint256"
481
+ }
482
+ ],
483
+ "internalType": "struct PositionPricingUtils.PositionFundingFees",
484
+ "name": "funding",
485
+ "type": "tuple"
486
+ },
487
+ {
488
+ "components": [
489
+ {
490
+ "internalType": "uint256",
491
+ "name": "borrowingFeeUsd",
492
+ "type": "uint256"
493
+ },
494
+ {
495
+ "internalType": "uint256",
496
+ "name": "borrowingFeeAmount",
497
+ "type": "uint256"
498
+ },
499
+ {
500
+ "internalType": "uint256",
501
+ "name": "borrowingFeeReceiverFactor",
502
+ "type": "uint256"
503
+ },
504
+ {
505
+ "internalType": "uint256",
506
+ "name": "borrowingFeeAmountForFeeReceiver",
507
+ "type": "uint256"
508
+ }
509
+ ],
510
+ "internalType": "struct PositionPricingUtils.PositionBorrowingFees",
511
+ "name": "borrowing",
512
+ "type": "tuple"
513
+ },
514
+ {
515
+ "components": [
516
+ {
517
+ "internalType": "address",
518
+ "name": "uiFeeReceiver",
519
+ "type": "address"
520
+ },
521
+ {
522
+ "internalType": "uint256",
523
+ "name": "uiFeeReceiverFactor",
524
+ "type": "uint256"
525
+ },
526
+ {
527
+ "internalType": "uint256",
528
+ "name": "uiFeeAmount",
529
+ "type": "uint256"
530
+ }
531
+ ],
532
+ "internalType": "struct PositionPricingUtils.PositionUiFees",
533
+ "name": "ui",
534
+ "type": "tuple"
535
+ },
536
+ {
537
+ "components": [
538
+ {
539
+ "internalType": "uint256",
540
+ "name": "liquidationFeeUsd",
541
+ "type": "uint256"
542
+ },
543
+ {
544
+ "internalType": "uint256",
545
+ "name": "liquidationFeeAmount",
546
+ "type": "uint256"
547
+ },
548
+ {
549
+ "internalType": "uint256",
550
+ "name": "liquidationFeeReceiverFactor",
551
+ "type": "uint256"
552
+ },
553
+ {
554
+ "internalType": "uint256",
555
+ "name": "liquidationFeeAmountForFeeReceiver",
556
+ "type": "uint256"
557
+ }
558
+ ],
559
+ "internalType": "struct PositionPricingUtils.PositionLiquidationFees",
560
+ "name": "liquidation",
561
+ "type": "tuple"
562
+ },
563
+ {
564
+ "components": [
565
+ {
566
+ "internalType": "uint256",
567
+ "name": "min",
568
+ "type": "uint256"
569
+ },
570
+ {
571
+ "internalType": "uint256",
572
+ "name": "max",
573
+ "type": "uint256"
574
+ }
575
+ ],
576
+ "internalType": "struct Price.Props",
577
+ "name": "collateralTokenPrice",
578
+ "type": "tuple"
579
+ },
580
+ {
581
+ "internalType": "uint256",
582
+ "name": "positionFeeFactor",
583
+ "type": "uint256"
584
+ },
585
+ {
586
+ "internalType": "uint256",
587
+ "name": "protocolFeeAmount",
588
+ "type": "uint256"
589
+ },
590
+ {
591
+ "internalType": "uint256",
592
+ "name": "positionFeeReceiverFactor",
593
+ "type": "uint256"
594
+ },
595
+ {
596
+ "internalType": "uint256",
597
+ "name": "feeReceiverAmount",
598
+ "type": "uint256"
599
+ },
600
+ {
601
+ "internalType": "uint256",
602
+ "name": "feeAmountForPool",
603
+ "type": "uint256"
604
+ },
605
+ {
606
+ "internalType": "uint256",
607
+ "name": "positionFeeAmountForPool",
608
+ "type": "uint256"
609
+ },
610
+ {
611
+ "internalType": "uint256",
612
+ "name": "positionFeeAmount",
613
+ "type": "uint256"
614
+ },
615
+ {
616
+ "internalType": "uint256",
617
+ "name": "totalCostAmountExcludingFunding",
618
+ "type": "uint256"
619
+ },
620
+ {
621
+ "internalType": "uint256",
622
+ "name": "totalCostAmount",
623
+ "type": "uint256"
624
+ },
625
+ {
626
+ "internalType": "uint256",
627
+ "name": "totalDiscountAmount",
628
+ "type": "uint256"
629
+ }
630
+ ],
631
+ "internalType": "struct PositionPricingUtils.PositionFees",
632
+ "name": "fees",
633
+ "type": "tuple"
634
+ },
635
+ {
636
+ "components": [
637
+ {
638
+ "internalType": "int256",
639
+ "name": "priceImpactUsd",
640
+ "type": "int256"
641
+ },
642
+ {
643
+ "internalType": "uint256",
644
+ "name": "priceImpactDiffUsd",
645
+ "type": "uint256"
646
+ },
647
+ {
648
+ "internalType": "uint256",
649
+ "name": "executionPrice",
650
+ "type": "uint256"
651
+ }
652
+ ],
653
+ "internalType": "struct ReaderPricingUtils.ExecutionPriceResult",
654
+ "name": "executionPriceResult",
655
+ "type": "tuple"
656
+ },
657
+ {
658
+ "internalType": "int256",
659
+ "name": "basePnlUsd",
660
+ "type": "int256"
661
+ },
662
+ {
663
+ "internalType": "int256",
664
+ "name": "uncappedBasePnlUsd",
665
+ "type": "int256"
666
+ },
667
+ {
668
+ "internalType": "int256",
669
+ "name": "pnlAfterPriceImpactUsd",
670
+ "type": "int256"
671
+ }
672
+ ],
673
+ "internalType": "struct ReaderPositionUtils.PositionInfo[]",
674
+ "name": "",
675
+ "type": "tuple[]"
676
+ }
677
+ ],
678
+ "stateMutability": "view",
679
+ "type": "function"
680
+ },
681
+ {
682
+ "inputs": [
683
+ {
684
+ "internalType": "contract DataStore",
685
+ "name": "dataStore",
686
+ "type": "address"
687
+ },
688
+ {
689
+ "internalType": "address",
690
+ "name": "account",
691
+ "type": "address"
692
+ },
693
+ {
694
+ "internalType": "uint256",
695
+ "name": "start",
696
+ "type": "uint256"
697
+ },
698
+ {
699
+ "internalType": "uint256",
700
+ "name": "end",
701
+ "type": "uint256"
702
+ }
703
+ ],
704
+ "name": "getAccountPositions",
705
+ "outputs": [
706
+ {
707
+ "components": [
708
+ {
709
+ "components": [
710
+ {
711
+ "internalType": "address",
712
+ "name": "account",
713
+ "type": "address"
714
+ },
715
+ {
716
+ "internalType": "address",
717
+ "name": "market",
718
+ "type": "address"
719
+ },
720
+ {
721
+ "internalType": "address",
722
+ "name": "collateralToken",
723
+ "type": "address"
724
+ }
725
+ ],
726
+ "internalType": "struct Position.Addresses",
727
+ "name": "addresses",
728
+ "type": "tuple"
729
+ },
730
+ {
731
+ "components": [
732
+ {
733
+ "internalType": "uint256",
734
+ "name": "sizeInUsd",
735
+ "type": "uint256"
736
+ },
737
+ {
738
+ "internalType": "uint256",
739
+ "name": "sizeInTokens",
740
+ "type": "uint256"
741
+ },
742
+ {
743
+ "internalType": "uint256",
744
+ "name": "collateralAmount",
745
+ "type": "uint256"
746
+ },
747
+ {
748
+ "internalType": "uint256",
749
+ "name": "borrowingFactor",
750
+ "type": "uint256"
751
+ },
752
+ {
753
+ "internalType": "uint256",
754
+ "name": "fundingFeeAmountPerSize",
755
+ "type": "uint256"
756
+ },
757
+ {
758
+ "internalType": "uint256",
759
+ "name": "longTokenClaimableFundingAmountPerSize",
760
+ "type": "uint256"
761
+ },
762
+ {
763
+ "internalType": "uint256",
764
+ "name": "shortTokenClaimableFundingAmountPerSize",
765
+ "type": "uint256"
766
+ },
767
+ {
768
+ "internalType": "uint256",
769
+ "name": "increasedAtTime",
770
+ "type": "uint256"
771
+ },
772
+ {
773
+ "internalType": "uint256",
774
+ "name": "decreasedAtTime",
775
+ "type": "uint256"
776
+ }
777
+ ],
778
+ "internalType": "struct Position.Numbers",
779
+ "name": "numbers",
780
+ "type": "tuple"
781
+ },
782
+ {
783
+ "components": [
784
+ {
785
+ "internalType": "bool",
786
+ "name": "isLong",
787
+ "type": "bool"
788
+ }
789
+ ],
790
+ "internalType": "struct Position.Flags",
791
+ "name": "flags",
792
+ "type": "tuple"
793
+ }
794
+ ],
795
+ "internalType": "struct Position.Props[]",
796
+ "name": "",
797
+ "type": "tuple[]"
798
+ }
799
+ ],
800
+ "stateMutability": "view",
801
+ "type": "function"
802
+ },
803
+ {
804
+ "inputs": [
805
+ {
806
+ "internalType": "contract DataStore",
807
+ "name": "dataStore",
808
+ "type": "address"
809
+ },
810
+ {
811
+ "internalType": "address",
812
+ "name": "market",
813
+ "type": "address"
814
+ },
815
+ {
816
+ "internalType": "bool",
817
+ "name": "isLong",
818
+ "type": "bool"
819
+ },
820
+ {
821
+ "components": [
822
+ {
823
+ "components": [
824
+ {
825
+ "internalType": "uint256",
826
+ "name": "min",
827
+ "type": "uint256"
828
+ },
829
+ {
830
+ "internalType": "uint256",
831
+ "name": "max",
832
+ "type": "uint256"
833
+ }
834
+ ],
835
+ "internalType": "struct Price.Props",
836
+ "name": "indexTokenPrice",
837
+ "type": "tuple"
838
+ },
839
+ {
840
+ "components": [
841
+ {
842
+ "internalType": "uint256",
843
+ "name": "min",
844
+ "type": "uint256"
845
+ },
846
+ {
847
+ "internalType": "uint256",
848
+ "name": "max",
849
+ "type": "uint256"
850
+ }
851
+ ],
852
+ "internalType": "struct Price.Props",
853
+ "name": "longTokenPrice",
854
+ "type": "tuple"
855
+ },
856
+ {
857
+ "components": [
858
+ {
859
+ "internalType": "uint256",
860
+ "name": "min",
861
+ "type": "uint256"
862
+ },
863
+ {
864
+ "internalType": "uint256",
865
+ "name": "max",
866
+ "type": "uint256"
867
+ }
868
+ ],
869
+ "internalType": "struct Price.Props",
870
+ "name": "shortTokenPrice",
871
+ "type": "tuple"
872
+ }
873
+ ],
874
+ "internalType": "struct MarketUtils.MarketPrices",
875
+ "name": "prices",
876
+ "type": "tuple"
877
+ }
878
+ ],
879
+ "name": "getAdlState",
880
+ "outputs": [
881
+ {
882
+ "internalType": "uint256",
883
+ "name": "",
884
+ "type": "uint256"
885
+ },
886
+ {
887
+ "internalType": "bool",
888
+ "name": "",
889
+ "type": "bool"
890
+ },
891
+ {
892
+ "internalType": "int256",
893
+ "name": "",
894
+ "type": "int256"
895
+ },
896
+ {
897
+ "internalType": "uint256",
898
+ "name": "",
899
+ "type": "uint256"
900
+ }
901
+ ],
902
+ "stateMutability": "view",
903
+ "type": "function"
904
+ },
905
+ {
906
+ "inputs": [
907
+ {
908
+ "internalType": "contract DataStore",
909
+ "name": "dataStore",
910
+ "type": "address"
911
+ },
912
+ {
913
+ "internalType": "bytes32",
914
+ "name": "key",
915
+ "type": "bytes32"
916
+ }
917
+ ],
918
+ "name": "getDeposit",
919
+ "outputs": [
920
+ {
921
+ "components": [
922
+ {
923
+ "components": [
924
+ {
925
+ "internalType": "address",
926
+ "name": "account",
927
+ "type": "address"
928
+ },
929
+ {
930
+ "internalType": "address",
931
+ "name": "receiver",
932
+ "type": "address"
933
+ },
934
+ {
935
+ "internalType": "address",
936
+ "name": "callbackContract",
937
+ "type": "address"
938
+ },
939
+ {
940
+ "internalType": "address",
941
+ "name": "uiFeeReceiver",
942
+ "type": "address"
943
+ },
944
+ {
945
+ "internalType": "address",
946
+ "name": "market",
947
+ "type": "address"
948
+ },
949
+ {
950
+ "internalType": "address",
951
+ "name": "initialLongToken",
952
+ "type": "address"
953
+ },
954
+ {
955
+ "internalType": "address",
956
+ "name": "initialShortToken",
957
+ "type": "address"
958
+ },
959
+ {
960
+ "internalType": "address[]",
961
+ "name": "longTokenSwapPath",
962
+ "type": "address[]"
963
+ },
964
+ {
965
+ "internalType": "address[]",
966
+ "name": "shortTokenSwapPath",
967
+ "type": "address[]"
968
+ }
969
+ ],
970
+ "internalType": "struct Deposit.Addresses",
971
+ "name": "addresses",
972
+ "type": "tuple"
973
+ },
974
+ {
975
+ "components": [
976
+ {
977
+ "internalType": "uint256",
978
+ "name": "initialLongTokenAmount",
979
+ "type": "uint256"
980
+ },
981
+ {
982
+ "internalType": "uint256",
983
+ "name": "initialShortTokenAmount",
984
+ "type": "uint256"
985
+ },
986
+ {
987
+ "internalType": "uint256",
988
+ "name": "minMarketTokens",
989
+ "type": "uint256"
990
+ },
991
+ {
992
+ "internalType": "uint256",
993
+ "name": "updatedAtTime",
994
+ "type": "uint256"
995
+ },
996
+ {
997
+ "internalType": "uint256",
998
+ "name": "executionFee",
999
+ "type": "uint256"
1000
+ },
1001
+ {
1002
+ "internalType": "uint256",
1003
+ "name": "callbackGasLimit",
1004
+ "type": "uint256"
1005
+ }
1006
+ ],
1007
+ "internalType": "struct Deposit.Numbers",
1008
+ "name": "numbers",
1009
+ "type": "tuple"
1010
+ },
1011
+ {
1012
+ "components": [
1013
+ {
1014
+ "internalType": "bool",
1015
+ "name": "shouldUnwrapNativeToken",
1016
+ "type": "bool"
1017
+ }
1018
+ ],
1019
+ "internalType": "struct Deposit.Flags",
1020
+ "name": "flags",
1021
+ "type": "tuple"
1022
+ }
1023
+ ],
1024
+ "internalType": "struct Deposit.Props",
1025
+ "name": "",
1026
+ "type": "tuple"
1027
+ }
1028
+ ],
1029
+ "stateMutability": "view",
1030
+ "type": "function"
1031
+ },
1032
+ {
1033
+ "inputs": [
1034
+ {
1035
+ "internalType": "contract DataStore",
1036
+ "name": "dataStore",
1037
+ "type": "address"
1038
+ },
1039
+ {
1040
+ "components": [
1041
+ {
1042
+ "internalType": "address",
1043
+ "name": "marketToken",
1044
+ "type": "address"
1045
+ },
1046
+ {
1047
+ "internalType": "address",
1048
+ "name": "indexToken",
1049
+ "type": "address"
1050
+ },
1051
+ {
1052
+ "internalType": "address",
1053
+ "name": "longToken",
1054
+ "type": "address"
1055
+ },
1056
+ {
1057
+ "internalType": "address",
1058
+ "name": "shortToken",
1059
+ "type": "address"
1060
+ }
1061
+ ],
1062
+ "internalType": "struct Market.Props",
1063
+ "name": "market",
1064
+ "type": "tuple"
1065
+ },
1066
+ {
1067
+ "components": [
1068
+ {
1069
+ "components": [
1070
+ {
1071
+ "internalType": "uint256",
1072
+ "name": "min",
1073
+ "type": "uint256"
1074
+ },
1075
+ {
1076
+ "internalType": "uint256",
1077
+ "name": "max",
1078
+ "type": "uint256"
1079
+ }
1080
+ ],
1081
+ "internalType": "struct Price.Props",
1082
+ "name": "indexTokenPrice",
1083
+ "type": "tuple"
1084
+ },
1085
+ {
1086
+ "components": [
1087
+ {
1088
+ "internalType": "uint256",
1089
+ "name": "min",
1090
+ "type": "uint256"
1091
+ },
1092
+ {
1093
+ "internalType": "uint256",
1094
+ "name": "max",
1095
+ "type": "uint256"
1096
+ }
1097
+ ],
1098
+ "internalType": "struct Price.Props",
1099
+ "name": "longTokenPrice",
1100
+ "type": "tuple"
1101
+ },
1102
+ {
1103
+ "components": [
1104
+ {
1105
+ "internalType": "uint256",
1106
+ "name": "min",
1107
+ "type": "uint256"
1108
+ },
1109
+ {
1110
+ "internalType": "uint256",
1111
+ "name": "max",
1112
+ "type": "uint256"
1113
+ }
1114
+ ],
1115
+ "internalType": "struct Price.Props",
1116
+ "name": "shortTokenPrice",
1117
+ "type": "tuple"
1118
+ }
1119
+ ],
1120
+ "internalType": "struct MarketUtils.MarketPrices",
1121
+ "name": "prices",
1122
+ "type": "tuple"
1123
+ },
1124
+ {
1125
+ "internalType": "uint256",
1126
+ "name": "longTokenAmount",
1127
+ "type": "uint256"
1128
+ },
1129
+ {
1130
+ "internalType": "uint256",
1131
+ "name": "shortTokenAmount",
1132
+ "type": "uint256"
1133
+ },
1134
+ {
1135
+ "internalType": "address",
1136
+ "name": "uiFeeReceiver",
1137
+ "type": "address"
1138
+ },
1139
+ {
1140
+ "internalType": "enum ISwapPricingUtils.SwapPricingType",
1141
+ "name": "swapPricingType",
1142
+ "type": "uint8"
1143
+ },
1144
+ {
1145
+ "internalType": "bool",
1146
+ "name": "includeVirtualInventoryImpact",
1147
+ "type": "bool"
1148
+ }
1149
+ ],
1150
+ "name": "getDepositAmountOut",
1151
+ "outputs": [
1152
+ {
1153
+ "internalType": "uint256",
1154
+ "name": "",
1155
+ "type": "uint256"
1156
+ }
1157
+ ],
1158
+ "stateMutability": "view",
1159
+ "type": "function"
1160
+ },
1161
+ {
1162
+ "inputs": [
1163
+ {
1164
+ "internalType": "contract DataStore",
1165
+ "name": "dataStore",
1166
+ "type": "address"
1167
+ },
1168
+ {
1169
+ "internalType": "address",
1170
+ "name": "marketKey",
1171
+ "type": "address"
1172
+ },
1173
+ {
1174
+ "components": [
1175
+ {
1176
+ "internalType": "uint256",
1177
+ "name": "min",
1178
+ "type": "uint256"
1179
+ },
1180
+ {
1181
+ "internalType": "uint256",
1182
+ "name": "max",
1183
+ "type": "uint256"
1184
+ }
1185
+ ],
1186
+ "internalType": "struct Price.Props",
1187
+ "name": "indexTokenPrice",
1188
+ "type": "tuple"
1189
+ },
1190
+ {
1191
+ "internalType": "uint256",
1192
+ "name": "positionSizeInUsd",
1193
+ "type": "uint256"
1194
+ },
1195
+ {
1196
+ "internalType": "uint256",
1197
+ "name": "positionSizeInTokens",
1198
+ "type": "uint256"
1199
+ },
1200
+ {
1201
+ "internalType": "int256",
1202
+ "name": "sizeDeltaUsd",
1203
+ "type": "int256"
1204
+ },
1205
+ {
1206
+ "internalType": "bool",
1207
+ "name": "isLong",
1208
+ "type": "bool"
1209
+ }
1210
+ ],
1211
+ "name": "getExecutionPrice",
1212
+ "outputs": [
1213
+ {
1214
+ "components": [
1215
+ {
1216
+ "internalType": "int256",
1217
+ "name": "priceImpactUsd",
1218
+ "type": "int256"
1219
+ },
1220
+ {
1221
+ "internalType": "uint256",
1222
+ "name": "priceImpactDiffUsd",
1223
+ "type": "uint256"
1224
+ },
1225
+ {
1226
+ "internalType": "uint256",
1227
+ "name": "executionPrice",
1228
+ "type": "uint256"
1229
+ }
1230
+ ],
1231
+ "internalType": "struct ReaderPricingUtils.ExecutionPriceResult",
1232
+ "name": "",
1233
+ "type": "tuple"
1234
+ }
1235
+ ],
1236
+ "stateMutability": "view",
1237
+ "type": "function"
1238
+ },
1239
+ {
1240
+ "inputs": [
1241
+ {
1242
+ "internalType": "contract DataStore",
1243
+ "name": "dataStore",
1244
+ "type": "address"
1245
+ },
1246
+ {
1247
+ "internalType": "address",
1248
+ "name": "key",
1249
+ "type": "address"
1250
+ }
1251
+ ],
1252
+ "name": "getMarket",
1253
+ "outputs": [
1254
+ {
1255
+ "components": [
1256
+ {
1257
+ "internalType": "address",
1258
+ "name": "marketToken",
1259
+ "type": "address"
1260
+ },
1261
+ {
1262
+ "internalType": "address",
1263
+ "name": "indexToken",
1264
+ "type": "address"
1265
+ },
1266
+ {
1267
+ "internalType": "address",
1268
+ "name": "longToken",
1269
+ "type": "address"
1270
+ },
1271
+ {
1272
+ "internalType": "address",
1273
+ "name": "shortToken",
1274
+ "type": "address"
1275
+ }
1276
+ ],
1277
+ "internalType": "struct Market.Props",
1278
+ "name": "",
1279
+ "type": "tuple"
1280
+ }
1281
+ ],
1282
+ "stateMutability": "view",
1283
+ "type": "function"
1284
+ },
1285
+ {
1286
+ "inputs": [
1287
+ {
1288
+ "internalType": "contract DataStore",
1289
+ "name": "dataStore",
1290
+ "type": "address"
1291
+ },
1292
+ {
1293
+ "internalType": "bytes32",
1294
+ "name": "salt",
1295
+ "type": "bytes32"
1296
+ }
1297
+ ],
1298
+ "name": "getMarketBySalt",
1299
+ "outputs": [
1300
+ {
1301
+ "components": [
1302
+ {
1303
+ "internalType": "address",
1304
+ "name": "marketToken",
1305
+ "type": "address"
1306
+ },
1307
+ {
1308
+ "internalType": "address",
1309
+ "name": "indexToken",
1310
+ "type": "address"
1311
+ },
1312
+ {
1313
+ "internalType": "address",
1314
+ "name": "longToken",
1315
+ "type": "address"
1316
+ },
1317
+ {
1318
+ "internalType": "address",
1319
+ "name": "shortToken",
1320
+ "type": "address"
1321
+ }
1322
+ ],
1323
+ "internalType": "struct Market.Props",
1324
+ "name": "",
1325
+ "type": "tuple"
1326
+ }
1327
+ ],
1328
+ "stateMutability": "view",
1329
+ "type": "function"
1330
+ },
1331
+ {
1332
+ "inputs": [
1333
+ {
1334
+ "internalType": "contract DataStore",
1335
+ "name": "dataStore",
1336
+ "type": "address"
1337
+ },
1338
+ {
1339
+ "components": [
1340
+ {
1341
+ "components": [
1342
+ {
1343
+ "internalType": "uint256",
1344
+ "name": "min",
1345
+ "type": "uint256"
1346
+ },
1347
+ {
1348
+ "internalType": "uint256",
1349
+ "name": "max",
1350
+ "type": "uint256"
1351
+ }
1352
+ ],
1353
+ "internalType": "struct Price.Props",
1354
+ "name": "indexTokenPrice",
1355
+ "type": "tuple"
1356
+ },
1357
+ {
1358
+ "components": [
1359
+ {
1360
+ "internalType": "uint256",
1361
+ "name": "min",
1362
+ "type": "uint256"
1363
+ },
1364
+ {
1365
+ "internalType": "uint256",
1366
+ "name": "max",
1367
+ "type": "uint256"
1368
+ }
1369
+ ],
1370
+ "internalType": "struct Price.Props",
1371
+ "name": "longTokenPrice",
1372
+ "type": "tuple"
1373
+ },
1374
+ {
1375
+ "components": [
1376
+ {
1377
+ "internalType": "uint256",
1378
+ "name": "min",
1379
+ "type": "uint256"
1380
+ },
1381
+ {
1382
+ "internalType": "uint256",
1383
+ "name": "max",
1384
+ "type": "uint256"
1385
+ }
1386
+ ],
1387
+ "internalType": "struct Price.Props",
1388
+ "name": "shortTokenPrice",
1389
+ "type": "tuple"
1390
+ }
1391
+ ],
1392
+ "internalType": "struct MarketUtils.MarketPrices",
1393
+ "name": "prices",
1394
+ "type": "tuple"
1395
+ },
1396
+ {
1397
+ "internalType": "address",
1398
+ "name": "marketKey",
1399
+ "type": "address"
1400
+ }
1401
+ ],
1402
+ "name": "getMarketInfo",
1403
+ "outputs": [
1404
+ {
1405
+ "components": [
1406
+ {
1407
+ "components": [
1408
+ {
1409
+ "internalType": "address",
1410
+ "name": "marketToken",
1411
+ "type": "address"
1412
+ },
1413
+ {
1414
+ "internalType": "address",
1415
+ "name": "indexToken",
1416
+ "type": "address"
1417
+ },
1418
+ {
1419
+ "internalType": "address",
1420
+ "name": "longToken",
1421
+ "type": "address"
1422
+ },
1423
+ {
1424
+ "internalType": "address",
1425
+ "name": "shortToken",
1426
+ "type": "address"
1427
+ }
1428
+ ],
1429
+ "internalType": "struct Market.Props",
1430
+ "name": "market",
1431
+ "type": "tuple"
1432
+ },
1433
+ {
1434
+ "internalType": "uint256",
1435
+ "name": "borrowingFactorPerSecondForLongs",
1436
+ "type": "uint256"
1437
+ },
1438
+ {
1439
+ "internalType": "uint256",
1440
+ "name": "borrowingFactorPerSecondForShorts",
1441
+ "type": "uint256"
1442
+ },
1443
+ {
1444
+ "components": [
1445
+ {
1446
+ "components": [
1447
+ {
1448
+ "components": [
1449
+ {
1450
+ "internalType": "uint256",
1451
+ "name": "longToken",
1452
+ "type": "uint256"
1453
+ },
1454
+ {
1455
+ "internalType": "uint256",
1456
+ "name": "shortToken",
1457
+ "type": "uint256"
1458
+ }
1459
+ ],
1460
+ "internalType": "struct MarketUtils.CollateralType",
1461
+ "name": "long",
1462
+ "type": "tuple"
1463
+ },
1464
+ {
1465
+ "components": [
1466
+ {
1467
+ "internalType": "uint256",
1468
+ "name": "longToken",
1469
+ "type": "uint256"
1470
+ },
1471
+ {
1472
+ "internalType": "uint256",
1473
+ "name": "shortToken",
1474
+ "type": "uint256"
1475
+ }
1476
+ ],
1477
+ "internalType": "struct MarketUtils.CollateralType",
1478
+ "name": "short",
1479
+ "type": "tuple"
1480
+ }
1481
+ ],
1482
+ "internalType": "struct MarketUtils.PositionType",
1483
+ "name": "fundingFeeAmountPerSize",
1484
+ "type": "tuple"
1485
+ },
1486
+ {
1487
+ "components": [
1488
+ {
1489
+ "components": [
1490
+ {
1491
+ "internalType": "uint256",
1492
+ "name": "longToken",
1493
+ "type": "uint256"
1494
+ },
1495
+ {
1496
+ "internalType": "uint256",
1497
+ "name": "shortToken",
1498
+ "type": "uint256"
1499
+ }
1500
+ ],
1501
+ "internalType": "struct MarketUtils.CollateralType",
1502
+ "name": "long",
1503
+ "type": "tuple"
1504
+ },
1505
+ {
1506
+ "components": [
1507
+ {
1508
+ "internalType": "uint256",
1509
+ "name": "longToken",
1510
+ "type": "uint256"
1511
+ },
1512
+ {
1513
+ "internalType": "uint256",
1514
+ "name": "shortToken",
1515
+ "type": "uint256"
1516
+ }
1517
+ ],
1518
+ "internalType": "struct MarketUtils.CollateralType",
1519
+ "name": "short",
1520
+ "type": "tuple"
1521
+ }
1522
+ ],
1523
+ "internalType": "struct MarketUtils.PositionType",
1524
+ "name": "claimableFundingAmountPerSize",
1525
+ "type": "tuple"
1526
+ }
1527
+ ],
1528
+ "internalType": "struct ReaderUtils.BaseFundingValues",
1529
+ "name": "baseFunding",
1530
+ "type": "tuple"
1531
+ },
1532
+ {
1533
+ "components": [
1534
+ {
1535
+ "internalType": "bool",
1536
+ "name": "longsPayShorts",
1537
+ "type": "bool"
1538
+ },
1539
+ {
1540
+ "internalType": "uint256",
1541
+ "name": "fundingFactorPerSecond",
1542
+ "type": "uint256"
1543
+ },
1544
+ {
1545
+ "internalType": "int256",
1546
+ "name": "nextSavedFundingFactorPerSecond",
1547
+ "type": "int256"
1548
+ },
1549
+ {
1550
+ "components": [
1551
+ {
1552
+ "components": [
1553
+ {
1554
+ "internalType": "uint256",
1555
+ "name": "longToken",
1556
+ "type": "uint256"
1557
+ },
1558
+ {
1559
+ "internalType": "uint256",
1560
+ "name": "shortToken",
1561
+ "type": "uint256"
1562
+ }
1563
+ ],
1564
+ "internalType": "struct MarketUtils.CollateralType",
1565
+ "name": "long",
1566
+ "type": "tuple"
1567
+ },
1568
+ {
1569
+ "components": [
1570
+ {
1571
+ "internalType": "uint256",
1572
+ "name": "longToken",
1573
+ "type": "uint256"
1574
+ },
1575
+ {
1576
+ "internalType": "uint256",
1577
+ "name": "shortToken",
1578
+ "type": "uint256"
1579
+ }
1580
+ ],
1581
+ "internalType": "struct MarketUtils.CollateralType",
1582
+ "name": "short",
1583
+ "type": "tuple"
1584
+ }
1585
+ ],
1586
+ "internalType": "struct MarketUtils.PositionType",
1587
+ "name": "fundingFeeAmountPerSizeDelta",
1588
+ "type": "tuple"
1589
+ },
1590
+ {
1591
+ "components": [
1592
+ {
1593
+ "components": [
1594
+ {
1595
+ "internalType": "uint256",
1596
+ "name": "longToken",
1597
+ "type": "uint256"
1598
+ },
1599
+ {
1600
+ "internalType": "uint256",
1601
+ "name": "shortToken",
1602
+ "type": "uint256"
1603
+ }
1604
+ ],
1605
+ "internalType": "struct MarketUtils.CollateralType",
1606
+ "name": "long",
1607
+ "type": "tuple"
1608
+ },
1609
+ {
1610
+ "components": [
1611
+ {
1612
+ "internalType": "uint256",
1613
+ "name": "longToken",
1614
+ "type": "uint256"
1615
+ },
1616
+ {
1617
+ "internalType": "uint256",
1618
+ "name": "shortToken",
1619
+ "type": "uint256"
1620
+ }
1621
+ ],
1622
+ "internalType": "struct MarketUtils.CollateralType",
1623
+ "name": "short",
1624
+ "type": "tuple"
1625
+ }
1626
+ ],
1627
+ "internalType": "struct MarketUtils.PositionType",
1628
+ "name": "claimableFundingAmountPerSizeDelta",
1629
+ "type": "tuple"
1630
+ }
1631
+ ],
1632
+ "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult",
1633
+ "name": "nextFunding",
1634
+ "type": "tuple"
1635
+ },
1636
+ {
1637
+ "components": [
1638
+ {
1639
+ "internalType": "uint256",
1640
+ "name": "virtualPoolAmountForLongToken",
1641
+ "type": "uint256"
1642
+ },
1643
+ {
1644
+ "internalType": "uint256",
1645
+ "name": "virtualPoolAmountForShortToken",
1646
+ "type": "uint256"
1647
+ },
1648
+ {
1649
+ "internalType": "int256",
1650
+ "name": "virtualInventoryForPositions",
1651
+ "type": "int256"
1652
+ }
1653
+ ],
1654
+ "internalType": "struct ReaderUtils.VirtualInventory",
1655
+ "name": "virtualInventory",
1656
+ "type": "tuple"
1657
+ },
1658
+ {
1659
+ "internalType": "bool",
1660
+ "name": "isDisabled",
1661
+ "type": "bool"
1662
+ }
1663
+ ],
1664
+ "internalType": "struct ReaderUtils.MarketInfo",
1665
+ "name": "",
1666
+ "type": "tuple"
1667
+ }
1668
+ ],
1669
+ "stateMutability": "view",
1670
+ "type": "function"
1671
+ },
1672
+ {
1673
+ "inputs": [
1674
+ {
1675
+ "internalType": "contract DataStore",
1676
+ "name": "dataStore",
1677
+ "type": "address"
1678
+ },
1679
+ {
1680
+ "components": [
1681
+ {
1682
+ "components": [
1683
+ {
1684
+ "internalType": "uint256",
1685
+ "name": "min",
1686
+ "type": "uint256"
1687
+ },
1688
+ {
1689
+ "internalType": "uint256",
1690
+ "name": "max",
1691
+ "type": "uint256"
1692
+ }
1693
+ ],
1694
+ "internalType": "struct Price.Props",
1695
+ "name": "indexTokenPrice",
1696
+ "type": "tuple"
1697
+ },
1698
+ {
1699
+ "components": [
1700
+ {
1701
+ "internalType": "uint256",
1702
+ "name": "min",
1703
+ "type": "uint256"
1704
+ },
1705
+ {
1706
+ "internalType": "uint256",
1707
+ "name": "max",
1708
+ "type": "uint256"
1709
+ }
1710
+ ],
1711
+ "internalType": "struct Price.Props",
1712
+ "name": "longTokenPrice",
1713
+ "type": "tuple"
1714
+ },
1715
+ {
1716
+ "components": [
1717
+ {
1718
+ "internalType": "uint256",
1719
+ "name": "min",
1720
+ "type": "uint256"
1721
+ },
1722
+ {
1723
+ "internalType": "uint256",
1724
+ "name": "max",
1725
+ "type": "uint256"
1726
+ }
1727
+ ],
1728
+ "internalType": "struct Price.Props",
1729
+ "name": "shortTokenPrice",
1730
+ "type": "tuple"
1731
+ }
1732
+ ],
1733
+ "internalType": "struct MarketUtils.MarketPrices[]",
1734
+ "name": "marketPricesList",
1735
+ "type": "tuple[]"
1736
+ },
1737
+ {
1738
+ "internalType": "uint256",
1739
+ "name": "start",
1740
+ "type": "uint256"
1741
+ },
1742
+ {
1743
+ "internalType": "uint256",
1744
+ "name": "end",
1745
+ "type": "uint256"
1746
+ }
1747
+ ],
1748
+ "name": "getMarketInfoList",
1749
+ "outputs": [
1750
+ {
1751
+ "components": [
1752
+ {
1753
+ "components": [
1754
+ {
1755
+ "internalType": "address",
1756
+ "name": "marketToken",
1757
+ "type": "address"
1758
+ },
1759
+ {
1760
+ "internalType": "address",
1761
+ "name": "indexToken",
1762
+ "type": "address"
1763
+ },
1764
+ {
1765
+ "internalType": "address",
1766
+ "name": "longToken",
1767
+ "type": "address"
1768
+ },
1769
+ {
1770
+ "internalType": "address",
1771
+ "name": "shortToken",
1772
+ "type": "address"
1773
+ }
1774
+ ],
1775
+ "internalType": "struct Market.Props",
1776
+ "name": "market",
1777
+ "type": "tuple"
1778
+ },
1779
+ {
1780
+ "internalType": "uint256",
1781
+ "name": "borrowingFactorPerSecondForLongs",
1782
+ "type": "uint256"
1783
+ },
1784
+ {
1785
+ "internalType": "uint256",
1786
+ "name": "borrowingFactorPerSecondForShorts",
1787
+ "type": "uint256"
1788
+ },
1789
+ {
1790
+ "components": [
1791
+ {
1792
+ "components": [
1793
+ {
1794
+ "components": [
1795
+ {
1796
+ "internalType": "uint256",
1797
+ "name": "longToken",
1798
+ "type": "uint256"
1799
+ },
1800
+ {
1801
+ "internalType": "uint256",
1802
+ "name": "shortToken",
1803
+ "type": "uint256"
1804
+ }
1805
+ ],
1806
+ "internalType": "struct MarketUtils.CollateralType",
1807
+ "name": "long",
1808
+ "type": "tuple"
1809
+ },
1810
+ {
1811
+ "components": [
1812
+ {
1813
+ "internalType": "uint256",
1814
+ "name": "longToken",
1815
+ "type": "uint256"
1816
+ },
1817
+ {
1818
+ "internalType": "uint256",
1819
+ "name": "shortToken",
1820
+ "type": "uint256"
1821
+ }
1822
+ ],
1823
+ "internalType": "struct MarketUtils.CollateralType",
1824
+ "name": "short",
1825
+ "type": "tuple"
1826
+ }
1827
+ ],
1828
+ "internalType": "struct MarketUtils.PositionType",
1829
+ "name": "fundingFeeAmountPerSize",
1830
+ "type": "tuple"
1831
+ },
1832
+ {
1833
+ "components": [
1834
+ {
1835
+ "components": [
1836
+ {
1837
+ "internalType": "uint256",
1838
+ "name": "longToken",
1839
+ "type": "uint256"
1840
+ },
1841
+ {
1842
+ "internalType": "uint256",
1843
+ "name": "shortToken",
1844
+ "type": "uint256"
1845
+ }
1846
+ ],
1847
+ "internalType": "struct MarketUtils.CollateralType",
1848
+ "name": "long",
1849
+ "type": "tuple"
1850
+ },
1851
+ {
1852
+ "components": [
1853
+ {
1854
+ "internalType": "uint256",
1855
+ "name": "longToken",
1856
+ "type": "uint256"
1857
+ },
1858
+ {
1859
+ "internalType": "uint256",
1860
+ "name": "shortToken",
1861
+ "type": "uint256"
1862
+ }
1863
+ ],
1864
+ "internalType": "struct MarketUtils.CollateralType",
1865
+ "name": "short",
1866
+ "type": "tuple"
1867
+ }
1868
+ ],
1869
+ "internalType": "struct MarketUtils.PositionType",
1870
+ "name": "claimableFundingAmountPerSize",
1871
+ "type": "tuple"
1872
+ }
1873
+ ],
1874
+ "internalType": "struct ReaderUtils.BaseFundingValues",
1875
+ "name": "baseFunding",
1876
+ "type": "tuple"
1877
+ },
1878
+ {
1879
+ "components": [
1880
+ {
1881
+ "internalType": "bool",
1882
+ "name": "longsPayShorts",
1883
+ "type": "bool"
1884
+ },
1885
+ {
1886
+ "internalType": "uint256",
1887
+ "name": "fundingFactorPerSecond",
1888
+ "type": "uint256"
1889
+ },
1890
+ {
1891
+ "internalType": "int256",
1892
+ "name": "nextSavedFundingFactorPerSecond",
1893
+ "type": "int256"
1894
+ },
1895
+ {
1896
+ "components": [
1897
+ {
1898
+ "components": [
1899
+ {
1900
+ "internalType": "uint256",
1901
+ "name": "longToken",
1902
+ "type": "uint256"
1903
+ },
1904
+ {
1905
+ "internalType": "uint256",
1906
+ "name": "shortToken",
1907
+ "type": "uint256"
1908
+ }
1909
+ ],
1910
+ "internalType": "struct MarketUtils.CollateralType",
1911
+ "name": "long",
1912
+ "type": "tuple"
1913
+ },
1914
+ {
1915
+ "components": [
1916
+ {
1917
+ "internalType": "uint256",
1918
+ "name": "longToken",
1919
+ "type": "uint256"
1920
+ },
1921
+ {
1922
+ "internalType": "uint256",
1923
+ "name": "shortToken",
1924
+ "type": "uint256"
1925
+ }
1926
+ ],
1927
+ "internalType": "struct MarketUtils.CollateralType",
1928
+ "name": "short",
1929
+ "type": "tuple"
1930
+ }
1931
+ ],
1932
+ "internalType": "struct MarketUtils.PositionType",
1933
+ "name": "fundingFeeAmountPerSizeDelta",
1934
+ "type": "tuple"
1935
+ },
1936
+ {
1937
+ "components": [
1938
+ {
1939
+ "components": [
1940
+ {
1941
+ "internalType": "uint256",
1942
+ "name": "longToken",
1943
+ "type": "uint256"
1944
+ },
1945
+ {
1946
+ "internalType": "uint256",
1947
+ "name": "shortToken",
1948
+ "type": "uint256"
1949
+ }
1950
+ ],
1951
+ "internalType": "struct MarketUtils.CollateralType",
1952
+ "name": "long",
1953
+ "type": "tuple"
1954
+ },
1955
+ {
1956
+ "components": [
1957
+ {
1958
+ "internalType": "uint256",
1959
+ "name": "longToken",
1960
+ "type": "uint256"
1961
+ },
1962
+ {
1963
+ "internalType": "uint256",
1964
+ "name": "shortToken",
1965
+ "type": "uint256"
1966
+ }
1967
+ ],
1968
+ "internalType": "struct MarketUtils.CollateralType",
1969
+ "name": "short",
1970
+ "type": "tuple"
1971
+ }
1972
+ ],
1973
+ "internalType": "struct MarketUtils.PositionType",
1974
+ "name": "claimableFundingAmountPerSizeDelta",
1975
+ "type": "tuple"
1976
+ }
1977
+ ],
1978
+ "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult",
1979
+ "name": "nextFunding",
1980
+ "type": "tuple"
1981
+ },
1982
+ {
1983
+ "components": [
1984
+ {
1985
+ "internalType": "uint256",
1986
+ "name": "virtualPoolAmountForLongToken",
1987
+ "type": "uint256"
1988
+ },
1989
+ {
1990
+ "internalType": "uint256",
1991
+ "name": "virtualPoolAmountForShortToken",
1992
+ "type": "uint256"
1993
+ },
1994
+ {
1995
+ "internalType": "int256",
1996
+ "name": "virtualInventoryForPositions",
1997
+ "type": "int256"
1998
+ }
1999
+ ],
2000
+ "internalType": "struct ReaderUtils.VirtualInventory",
2001
+ "name": "virtualInventory",
2002
+ "type": "tuple"
2003
+ },
2004
+ {
2005
+ "internalType": "bool",
2006
+ "name": "isDisabled",
2007
+ "type": "bool"
2008
+ }
2009
+ ],
2010
+ "internalType": "struct ReaderUtils.MarketInfo[]",
2011
+ "name": "",
2012
+ "type": "tuple[]"
2013
+ }
2014
+ ],
2015
+ "stateMutability": "view",
2016
+ "type": "function"
2017
+ },
2018
+ {
2019
+ "inputs": [
2020
+ {
2021
+ "internalType": "contract DataStore",
2022
+ "name": "dataStore",
2023
+ "type": "address"
2024
+ },
2025
+ {
2026
+ "components": [
2027
+ {
2028
+ "internalType": "address",
2029
+ "name": "marketToken",
2030
+ "type": "address"
2031
+ },
2032
+ {
2033
+ "internalType": "address",
2034
+ "name": "indexToken",
2035
+ "type": "address"
2036
+ },
2037
+ {
2038
+ "internalType": "address",
2039
+ "name": "longToken",
2040
+ "type": "address"
2041
+ },
2042
+ {
2043
+ "internalType": "address",
2044
+ "name": "shortToken",
2045
+ "type": "address"
2046
+ }
2047
+ ],
2048
+ "internalType": "struct Market.Props",
2049
+ "name": "market",
2050
+ "type": "tuple"
2051
+ },
2052
+ {
2053
+ "components": [
2054
+ {
2055
+ "internalType": "uint256",
2056
+ "name": "min",
2057
+ "type": "uint256"
2058
+ },
2059
+ {
2060
+ "internalType": "uint256",
2061
+ "name": "max",
2062
+ "type": "uint256"
2063
+ }
2064
+ ],
2065
+ "internalType": "struct Price.Props",
2066
+ "name": "indexTokenPrice",
2067
+ "type": "tuple"
2068
+ },
2069
+ {
2070
+ "components": [
2071
+ {
2072
+ "internalType": "uint256",
2073
+ "name": "min",
2074
+ "type": "uint256"
2075
+ },
2076
+ {
2077
+ "internalType": "uint256",
2078
+ "name": "max",
2079
+ "type": "uint256"
2080
+ }
2081
+ ],
2082
+ "internalType": "struct Price.Props",
2083
+ "name": "longTokenPrice",
2084
+ "type": "tuple"
2085
+ },
2086
+ {
2087
+ "components": [
2088
+ {
2089
+ "internalType": "uint256",
2090
+ "name": "min",
2091
+ "type": "uint256"
2092
+ },
2093
+ {
2094
+ "internalType": "uint256",
2095
+ "name": "max",
2096
+ "type": "uint256"
2097
+ }
2098
+ ],
2099
+ "internalType": "struct Price.Props",
2100
+ "name": "shortTokenPrice",
2101
+ "type": "tuple"
2102
+ },
2103
+ {
2104
+ "internalType": "bytes32",
2105
+ "name": "pnlFactorType",
2106
+ "type": "bytes32"
2107
+ },
2108
+ {
2109
+ "internalType": "bool",
2110
+ "name": "maximize",
2111
+ "type": "bool"
2112
+ }
2113
+ ],
2114
+ "name": "getMarketTokenPrice",
2115
+ "outputs": [
2116
+ {
2117
+ "internalType": "int256",
2118
+ "name": "",
2119
+ "type": "int256"
2120
+ },
2121
+ {
2122
+ "components": [
2123
+ {
2124
+ "internalType": "int256",
2125
+ "name": "poolValue",
2126
+ "type": "int256"
2127
+ },
2128
+ {
2129
+ "internalType": "int256",
2130
+ "name": "longPnl",
2131
+ "type": "int256"
2132
+ },
2133
+ {
2134
+ "internalType": "int256",
2135
+ "name": "shortPnl",
2136
+ "type": "int256"
2137
+ },
2138
+ {
2139
+ "internalType": "int256",
2140
+ "name": "netPnl",
2141
+ "type": "int256"
2142
+ },
2143
+ {
2144
+ "internalType": "uint256",
2145
+ "name": "longTokenAmount",
2146
+ "type": "uint256"
2147
+ },
2148
+ {
2149
+ "internalType": "uint256",
2150
+ "name": "shortTokenAmount",
2151
+ "type": "uint256"
2152
+ },
2153
+ {
2154
+ "internalType": "uint256",
2155
+ "name": "longTokenUsd",
2156
+ "type": "uint256"
2157
+ },
2158
+ {
2159
+ "internalType": "uint256",
2160
+ "name": "shortTokenUsd",
2161
+ "type": "uint256"
2162
+ },
2163
+ {
2164
+ "internalType": "uint256",
2165
+ "name": "totalBorrowingFees",
2166
+ "type": "uint256"
2167
+ },
2168
+ {
2169
+ "internalType": "uint256",
2170
+ "name": "borrowingFeePoolFactor",
2171
+ "type": "uint256"
2172
+ },
2173
+ {
2174
+ "internalType": "uint256",
2175
+ "name": "impactPoolAmount",
2176
+ "type": "uint256"
2177
+ }
2178
+ ],
2179
+ "internalType": "struct MarketPoolValueInfo.Props",
2180
+ "name": "",
2181
+ "type": "tuple"
2182
+ }
2183
+ ],
2184
+ "stateMutability": "view",
2185
+ "type": "function"
2186
+ },
2187
+ {
2188
+ "inputs": [
2189
+ {
2190
+ "internalType": "contract DataStore",
2191
+ "name": "dataStore",
2192
+ "type": "address"
2193
+ },
2194
+ {
2195
+ "internalType": "uint256",
2196
+ "name": "start",
2197
+ "type": "uint256"
2198
+ },
2199
+ {
2200
+ "internalType": "uint256",
2201
+ "name": "end",
2202
+ "type": "uint256"
2203
+ }
2204
+ ],
2205
+ "name": "getMarkets",
2206
+ "outputs": [
2207
+ {
2208
+ "components": [
2209
+ {
2210
+ "internalType": "address",
2211
+ "name": "marketToken",
2212
+ "type": "address"
2213
+ },
2214
+ {
2215
+ "internalType": "address",
2216
+ "name": "indexToken",
2217
+ "type": "address"
2218
+ },
2219
+ {
2220
+ "internalType": "address",
2221
+ "name": "longToken",
2222
+ "type": "address"
2223
+ },
2224
+ {
2225
+ "internalType": "address",
2226
+ "name": "shortToken",
2227
+ "type": "address"
2228
+ }
2229
+ ],
2230
+ "internalType": "struct Market.Props[]",
2231
+ "name": "",
2232
+ "type": "tuple[]"
2233
+ }
2234
+ ],
2235
+ "stateMutability": "view",
2236
+ "type": "function"
2237
+ },
2238
+ {
2239
+ "inputs": [
2240
+ {
2241
+ "internalType": "contract DataStore",
2242
+ "name": "dataStore",
2243
+ "type": "address"
2244
+ },
2245
+ {
2246
+ "components": [
2247
+ {
2248
+ "internalType": "address",
2249
+ "name": "marketToken",
2250
+ "type": "address"
2251
+ },
2252
+ {
2253
+ "internalType": "address",
2254
+ "name": "indexToken",
2255
+ "type": "address"
2256
+ },
2257
+ {
2258
+ "internalType": "address",
2259
+ "name": "longToken",
2260
+ "type": "address"
2261
+ },
2262
+ {
2263
+ "internalType": "address",
2264
+ "name": "shortToken",
2265
+ "type": "address"
2266
+ }
2267
+ ],
2268
+ "internalType": "struct Market.Props",
2269
+ "name": "market",
2270
+ "type": "tuple"
2271
+ },
2272
+ {
2273
+ "components": [
2274
+ {
2275
+ "internalType": "uint256",
2276
+ "name": "min",
2277
+ "type": "uint256"
2278
+ },
2279
+ {
2280
+ "internalType": "uint256",
2281
+ "name": "max",
2282
+ "type": "uint256"
2283
+ }
2284
+ ],
2285
+ "internalType": "struct Price.Props",
2286
+ "name": "indexTokenPrice",
2287
+ "type": "tuple"
2288
+ },
2289
+ {
2290
+ "internalType": "bool",
2291
+ "name": "maximize",
2292
+ "type": "bool"
2293
+ }
2294
+ ],
2295
+ "name": "getNetPnl",
2296
+ "outputs": [
2297
+ {
2298
+ "internalType": "int256",
2299
+ "name": "",
2300
+ "type": "int256"
2301
+ }
2302
+ ],
2303
+ "stateMutability": "view",
2304
+ "type": "function"
2305
+ },
2306
+ {
2307
+ "inputs": [
2308
+ {
2309
+ "internalType": "contract DataStore",
2310
+ "name": "dataStore",
2311
+ "type": "address"
2312
+ },
2313
+ {
2314
+ "components": [
2315
+ {
2316
+ "internalType": "address",
2317
+ "name": "marketToken",
2318
+ "type": "address"
2319
+ },
2320
+ {
2321
+ "internalType": "address",
2322
+ "name": "indexToken",
2323
+ "type": "address"
2324
+ },
2325
+ {
2326
+ "internalType": "address",
2327
+ "name": "longToken",
2328
+ "type": "address"
2329
+ },
2330
+ {
2331
+ "internalType": "address",
2332
+ "name": "shortToken",
2333
+ "type": "address"
2334
+ }
2335
+ ],
2336
+ "internalType": "struct Market.Props",
2337
+ "name": "market",
2338
+ "type": "tuple"
2339
+ },
2340
+ {
2341
+ "components": [
2342
+ {
2343
+ "internalType": "uint256",
2344
+ "name": "min",
2345
+ "type": "uint256"
2346
+ },
2347
+ {
2348
+ "internalType": "uint256",
2349
+ "name": "max",
2350
+ "type": "uint256"
2351
+ }
2352
+ ],
2353
+ "internalType": "struct Price.Props",
2354
+ "name": "indexTokenPrice",
2355
+ "type": "tuple"
2356
+ },
2357
+ {
2358
+ "internalType": "bool",
2359
+ "name": "isLong",
2360
+ "type": "bool"
2361
+ },
2362
+ {
2363
+ "internalType": "bool",
2364
+ "name": "maximize",
2365
+ "type": "bool"
2366
+ }
2367
+ ],
2368
+ "name": "getOpenInterestWithPnl",
2369
+ "outputs": [
2370
+ {
2371
+ "internalType": "int256",
2372
+ "name": "",
2373
+ "type": "int256"
2374
+ }
2375
+ ],
2376
+ "stateMutability": "view",
2377
+ "type": "function"
2378
+ },
2379
+ {
2380
+ "inputs": [
2381
+ {
2382
+ "internalType": "contract DataStore",
2383
+ "name": "dataStore",
2384
+ "type": "address"
2385
+ },
2386
+ {
2387
+ "internalType": "bytes32",
2388
+ "name": "key",
2389
+ "type": "bytes32"
2390
+ }
2391
+ ],
2392
+ "name": "getOrder",
2393
+ "outputs": [
2394
+ {
2395
+ "components": [
2396
+ {
2397
+ "components": [
2398
+ {
2399
+ "internalType": "address",
2400
+ "name": "account",
2401
+ "type": "address"
2402
+ },
2403
+ {
2404
+ "internalType": "address",
2405
+ "name": "receiver",
2406
+ "type": "address"
2407
+ },
2408
+ {
2409
+ "internalType": "address",
2410
+ "name": "cancellationReceiver",
2411
+ "type": "address"
2412
+ },
2413
+ {
2414
+ "internalType": "address",
2415
+ "name": "callbackContract",
2416
+ "type": "address"
2417
+ },
2418
+ {
2419
+ "internalType": "address",
2420
+ "name": "uiFeeReceiver",
2421
+ "type": "address"
2422
+ },
2423
+ {
2424
+ "internalType": "address",
2425
+ "name": "market",
2426
+ "type": "address"
2427
+ },
2428
+ {
2429
+ "internalType": "address",
2430
+ "name": "initialCollateralToken",
2431
+ "type": "address"
2432
+ },
2433
+ {
2434
+ "internalType": "address[]",
2435
+ "name": "swapPath",
2436
+ "type": "address[]"
2437
+ }
2438
+ ],
2439
+ "internalType": "struct Order.Addresses",
2440
+ "name": "addresses",
2441
+ "type": "tuple"
2442
+ },
2443
+ {
2444
+ "components": [
2445
+ {
2446
+ "internalType": "enum Order.OrderType",
2447
+ "name": "orderType",
2448
+ "type": "uint8"
2449
+ },
2450
+ {
2451
+ "internalType": "enum Order.DecreasePositionSwapType",
2452
+ "name": "decreasePositionSwapType",
2453
+ "type": "uint8"
2454
+ },
2455
+ {
2456
+ "internalType": "uint256",
2457
+ "name": "sizeDeltaUsd",
2458
+ "type": "uint256"
2459
+ },
2460
+ {
2461
+ "internalType": "uint256",
2462
+ "name": "initialCollateralDeltaAmount",
2463
+ "type": "uint256"
2464
+ },
2465
+ {
2466
+ "internalType": "uint256",
2467
+ "name": "triggerPrice",
2468
+ "type": "uint256"
2469
+ },
2470
+ {
2471
+ "internalType": "uint256",
2472
+ "name": "acceptablePrice",
2473
+ "type": "uint256"
2474
+ },
2475
+ {
2476
+ "internalType": "uint256",
2477
+ "name": "executionFee",
2478
+ "type": "uint256"
2479
+ },
2480
+ {
2481
+ "internalType": "uint256",
2482
+ "name": "callbackGasLimit",
2483
+ "type": "uint256"
2484
+ },
2485
+ {
2486
+ "internalType": "uint256",
2487
+ "name": "minOutputAmount",
2488
+ "type": "uint256"
2489
+ },
2490
+ {
2491
+ "internalType": "uint256",
2492
+ "name": "updatedAtTime",
2493
+ "type": "uint256"
2494
+ },
2495
+ {
2496
+ "internalType": "uint256",
2497
+ "name": "validFromTime",
2498
+ "type": "uint256"
2499
+ }
2500
+ ],
2501
+ "internalType": "struct Order.Numbers",
2502
+ "name": "numbers",
2503
+ "type": "tuple"
2504
+ },
2505
+ {
2506
+ "components": [
2507
+ {
2508
+ "internalType": "bool",
2509
+ "name": "isLong",
2510
+ "type": "bool"
2511
+ },
2512
+ {
2513
+ "internalType": "bool",
2514
+ "name": "shouldUnwrapNativeToken",
2515
+ "type": "bool"
2516
+ },
2517
+ {
2518
+ "internalType": "bool",
2519
+ "name": "isFrozen",
2520
+ "type": "bool"
2521
+ },
2522
+ {
2523
+ "internalType": "bool",
2524
+ "name": "autoCancel",
2525
+ "type": "bool"
2526
+ }
2527
+ ],
2528
+ "internalType": "struct Order.Flags",
2529
+ "name": "flags",
2530
+ "type": "tuple"
2531
+ }
2532
+ ],
2533
+ "internalType": "struct Order.Props",
2534
+ "name": "",
2535
+ "type": "tuple"
2536
+ }
2537
+ ],
2538
+ "stateMutability": "view",
2539
+ "type": "function"
2540
+ },
2541
+ {
2542
+ "inputs": [
2543
+ {
2544
+ "internalType": "contract DataStore",
2545
+ "name": "dataStore",
2546
+ "type": "address"
2547
+ },
2548
+ {
2549
+ "components": [
2550
+ {
2551
+ "internalType": "address",
2552
+ "name": "marketToken",
2553
+ "type": "address"
2554
+ },
2555
+ {
2556
+ "internalType": "address",
2557
+ "name": "indexToken",
2558
+ "type": "address"
2559
+ },
2560
+ {
2561
+ "internalType": "address",
2562
+ "name": "longToken",
2563
+ "type": "address"
2564
+ },
2565
+ {
2566
+ "internalType": "address",
2567
+ "name": "shortToken",
2568
+ "type": "address"
2569
+ }
2570
+ ],
2571
+ "internalType": "struct Market.Props",
2572
+ "name": "market",
2573
+ "type": "tuple"
2574
+ },
2575
+ {
2576
+ "components": [
2577
+ {
2578
+ "internalType": "uint256",
2579
+ "name": "min",
2580
+ "type": "uint256"
2581
+ },
2582
+ {
2583
+ "internalType": "uint256",
2584
+ "name": "max",
2585
+ "type": "uint256"
2586
+ }
2587
+ ],
2588
+ "internalType": "struct Price.Props",
2589
+ "name": "indexTokenPrice",
2590
+ "type": "tuple"
2591
+ },
2592
+ {
2593
+ "internalType": "bool",
2594
+ "name": "isLong",
2595
+ "type": "bool"
2596
+ },
2597
+ {
2598
+ "internalType": "bool",
2599
+ "name": "maximize",
2600
+ "type": "bool"
2601
+ }
2602
+ ],
2603
+ "name": "getPnl",
2604
+ "outputs": [
2605
+ {
2606
+ "internalType": "int256",
2607
+ "name": "",
2608
+ "type": "int256"
2609
+ }
2610
+ ],
2611
+ "stateMutability": "view",
2612
+ "type": "function"
2613
+ },
2614
+ {
2615
+ "inputs": [
2616
+ {
2617
+ "internalType": "contract DataStore",
2618
+ "name": "dataStore",
2619
+ "type": "address"
2620
+ },
2621
+ {
2622
+ "internalType": "address",
2623
+ "name": "marketAddress",
2624
+ "type": "address"
2625
+ },
2626
+ {
2627
+ "components": [
2628
+ {
2629
+ "components": [
2630
+ {
2631
+ "internalType": "uint256",
2632
+ "name": "min",
2633
+ "type": "uint256"
2634
+ },
2635
+ {
2636
+ "internalType": "uint256",
2637
+ "name": "max",
2638
+ "type": "uint256"
2639
+ }
2640
+ ],
2641
+ "internalType": "struct Price.Props",
2642
+ "name": "indexTokenPrice",
2643
+ "type": "tuple"
2644
+ },
2645
+ {
2646
+ "components": [
2647
+ {
2648
+ "internalType": "uint256",
2649
+ "name": "min",
2650
+ "type": "uint256"
2651
+ },
2652
+ {
2653
+ "internalType": "uint256",
2654
+ "name": "max",
2655
+ "type": "uint256"
2656
+ }
2657
+ ],
2658
+ "internalType": "struct Price.Props",
2659
+ "name": "longTokenPrice",
2660
+ "type": "tuple"
2661
+ },
2662
+ {
2663
+ "components": [
2664
+ {
2665
+ "internalType": "uint256",
2666
+ "name": "min",
2667
+ "type": "uint256"
2668
+ },
2669
+ {
2670
+ "internalType": "uint256",
2671
+ "name": "max",
2672
+ "type": "uint256"
2673
+ }
2674
+ ],
2675
+ "internalType": "struct Price.Props",
2676
+ "name": "shortTokenPrice",
2677
+ "type": "tuple"
2678
+ }
2679
+ ],
2680
+ "internalType": "struct MarketUtils.MarketPrices",
2681
+ "name": "prices",
2682
+ "type": "tuple"
2683
+ },
2684
+ {
2685
+ "internalType": "bool",
2686
+ "name": "isLong",
2687
+ "type": "bool"
2688
+ },
2689
+ {
2690
+ "internalType": "bool",
2691
+ "name": "maximize",
2692
+ "type": "bool"
2693
+ }
2694
+ ],
2695
+ "name": "getPnlToPoolFactor",
2696
+ "outputs": [
2697
+ {
2698
+ "internalType": "int256",
2699
+ "name": "",
2700
+ "type": "int256"
2701
+ }
2702
+ ],
2703
+ "stateMutability": "view",
2704
+ "type": "function"
2705
+ },
2706
+ {
2707
+ "inputs": [
2708
+ {
2709
+ "internalType": "contract DataStore",
2710
+ "name": "dataStore",
2711
+ "type": "address"
2712
+ },
2713
+ {
2714
+ "internalType": "bytes32",
2715
+ "name": "key",
2716
+ "type": "bytes32"
2717
+ }
2718
+ ],
2719
+ "name": "getPosition",
2720
+ "outputs": [
2721
+ {
2722
+ "components": [
2723
+ {
2724
+ "components": [
2725
+ {
2726
+ "internalType": "address",
2727
+ "name": "account",
2728
+ "type": "address"
2729
+ },
2730
+ {
2731
+ "internalType": "address",
2732
+ "name": "market",
2733
+ "type": "address"
2734
+ },
2735
+ {
2736
+ "internalType": "address",
2737
+ "name": "collateralToken",
2738
+ "type": "address"
2739
+ }
2740
+ ],
2741
+ "internalType": "struct Position.Addresses",
2742
+ "name": "addresses",
2743
+ "type": "tuple"
2744
+ },
2745
+ {
2746
+ "components": [
2747
+ {
2748
+ "internalType": "uint256",
2749
+ "name": "sizeInUsd",
2750
+ "type": "uint256"
2751
+ },
2752
+ {
2753
+ "internalType": "uint256",
2754
+ "name": "sizeInTokens",
2755
+ "type": "uint256"
2756
+ },
2757
+ {
2758
+ "internalType": "uint256",
2759
+ "name": "collateralAmount",
2760
+ "type": "uint256"
2761
+ },
2762
+ {
2763
+ "internalType": "uint256",
2764
+ "name": "borrowingFactor",
2765
+ "type": "uint256"
2766
+ },
2767
+ {
2768
+ "internalType": "uint256",
2769
+ "name": "fundingFeeAmountPerSize",
2770
+ "type": "uint256"
2771
+ },
2772
+ {
2773
+ "internalType": "uint256",
2774
+ "name": "longTokenClaimableFundingAmountPerSize",
2775
+ "type": "uint256"
2776
+ },
2777
+ {
2778
+ "internalType": "uint256",
2779
+ "name": "shortTokenClaimableFundingAmountPerSize",
2780
+ "type": "uint256"
2781
+ },
2782
+ {
2783
+ "internalType": "uint256",
2784
+ "name": "increasedAtTime",
2785
+ "type": "uint256"
2786
+ },
2787
+ {
2788
+ "internalType": "uint256",
2789
+ "name": "decreasedAtTime",
2790
+ "type": "uint256"
2791
+ }
2792
+ ],
2793
+ "internalType": "struct Position.Numbers",
2794
+ "name": "numbers",
2795
+ "type": "tuple"
2796
+ },
2797
+ {
2798
+ "components": [
2799
+ {
2800
+ "internalType": "bool",
2801
+ "name": "isLong",
2802
+ "type": "bool"
2803
+ }
2804
+ ],
2805
+ "internalType": "struct Position.Flags",
2806
+ "name": "flags",
2807
+ "type": "tuple"
2808
+ }
2809
+ ],
2810
+ "internalType": "struct Position.Props",
2811
+ "name": "",
2812
+ "type": "tuple"
2813
+ }
2814
+ ],
2815
+ "stateMutability": "view",
2816
+ "type": "function"
2817
+ },
2818
+ {
2819
+ "inputs": [
2820
+ {
2821
+ "internalType": "contract DataStore",
2822
+ "name": "dataStore",
2823
+ "type": "address"
2824
+ },
2825
+ {
2826
+ "internalType": "contract IReferralStorage",
2827
+ "name": "referralStorage",
2828
+ "type": "address"
2829
+ },
2830
+ {
2831
+ "internalType": "bytes32",
2832
+ "name": "positionKey",
2833
+ "type": "bytes32"
2834
+ },
2835
+ {
2836
+ "components": [
2837
+ {
2838
+ "components": [
2839
+ {
2840
+ "internalType": "uint256",
2841
+ "name": "min",
2842
+ "type": "uint256"
2843
+ },
2844
+ {
2845
+ "internalType": "uint256",
2846
+ "name": "max",
2847
+ "type": "uint256"
2848
+ }
2849
+ ],
2850
+ "internalType": "struct Price.Props",
2851
+ "name": "indexTokenPrice",
2852
+ "type": "tuple"
2853
+ },
2854
+ {
2855
+ "components": [
2856
+ {
2857
+ "internalType": "uint256",
2858
+ "name": "min",
2859
+ "type": "uint256"
2860
+ },
2861
+ {
2862
+ "internalType": "uint256",
2863
+ "name": "max",
2864
+ "type": "uint256"
2865
+ }
2866
+ ],
2867
+ "internalType": "struct Price.Props",
2868
+ "name": "longTokenPrice",
2869
+ "type": "tuple"
2870
+ },
2871
+ {
2872
+ "components": [
2873
+ {
2874
+ "internalType": "uint256",
2875
+ "name": "min",
2876
+ "type": "uint256"
2877
+ },
2878
+ {
2879
+ "internalType": "uint256",
2880
+ "name": "max",
2881
+ "type": "uint256"
2882
+ }
2883
+ ],
2884
+ "internalType": "struct Price.Props",
2885
+ "name": "shortTokenPrice",
2886
+ "type": "tuple"
2887
+ }
2888
+ ],
2889
+ "internalType": "struct MarketUtils.MarketPrices",
2890
+ "name": "prices",
2891
+ "type": "tuple"
2892
+ },
2893
+ {
2894
+ "internalType": "uint256",
2895
+ "name": "sizeDeltaUsd",
2896
+ "type": "uint256"
2897
+ },
2898
+ {
2899
+ "internalType": "address",
2900
+ "name": "uiFeeReceiver",
2901
+ "type": "address"
2902
+ },
2903
+ {
2904
+ "internalType": "bool",
2905
+ "name": "usePositionSizeAsSizeDeltaUsd",
2906
+ "type": "bool"
2907
+ }
2908
+ ],
2909
+ "name": "getPositionInfo",
2910
+ "outputs": [
2911
+ {
2912
+ "components": [
2913
+ {
2914
+ "components": [
2915
+ {
2916
+ "components": [
2917
+ {
2918
+ "internalType": "address",
2919
+ "name": "account",
2920
+ "type": "address"
2921
+ },
2922
+ {
2923
+ "internalType": "address",
2924
+ "name": "market",
2925
+ "type": "address"
2926
+ },
2927
+ {
2928
+ "internalType": "address",
2929
+ "name": "collateralToken",
2930
+ "type": "address"
2931
+ }
2932
+ ],
2933
+ "internalType": "struct Position.Addresses",
2934
+ "name": "addresses",
2935
+ "type": "tuple"
2936
+ },
2937
+ {
2938
+ "components": [
2939
+ {
2940
+ "internalType": "uint256",
2941
+ "name": "sizeInUsd",
2942
+ "type": "uint256"
2943
+ },
2944
+ {
2945
+ "internalType": "uint256",
2946
+ "name": "sizeInTokens",
2947
+ "type": "uint256"
2948
+ },
2949
+ {
2950
+ "internalType": "uint256",
2951
+ "name": "collateralAmount",
2952
+ "type": "uint256"
2953
+ },
2954
+ {
2955
+ "internalType": "uint256",
2956
+ "name": "borrowingFactor",
2957
+ "type": "uint256"
2958
+ },
2959
+ {
2960
+ "internalType": "uint256",
2961
+ "name": "fundingFeeAmountPerSize",
2962
+ "type": "uint256"
2963
+ },
2964
+ {
2965
+ "internalType": "uint256",
2966
+ "name": "longTokenClaimableFundingAmountPerSize",
2967
+ "type": "uint256"
2968
+ },
2969
+ {
2970
+ "internalType": "uint256",
2971
+ "name": "shortTokenClaimableFundingAmountPerSize",
2972
+ "type": "uint256"
2973
+ },
2974
+ {
2975
+ "internalType": "uint256",
2976
+ "name": "increasedAtTime",
2977
+ "type": "uint256"
2978
+ },
2979
+ {
2980
+ "internalType": "uint256",
2981
+ "name": "decreasedAtTime",
2982
+ "type": "uint256"
2983
+ }
2984
+ ],
2985
+ "internalType": "struct Position.Numbers",
2986
+ "name": "numbers",
2987
+ "type": "tuple"
2988
+ },
2989
+ {
2990
+ "components": [
2991
+ {
2992
+ "internalType": "bool",
2993
+ "name": "isLong",
2994
+ "type": "bool"
2995
+ }
2996
+ ],
2997
+ "internalType": "struct Position.Flags",
2998
+ "name": "flags",
2999
+ "type": "tuple"
3000
+ }
3001
+ ],
3002
+ "internalType": "struct Position.Props",
3003
+ "name": "position",
3004
+ "type": "tuple"
3005
+ },
3006
+ {
3007
+ "components": [
3008
+ {
3009
+ "components": [
3010
+ {
3011
+ "internalType": "bytes32",
3012
+ "name": "referralCode",
3013
+ "type": "bytes32"
3014
+ },
3015
+ {
3016
+ "internalType": "address",
3017
+ "name": "affiliate",
3018
+ "type": "address"
3019
+ },
3020
+ {
3021
+ "internalType": "address",
3022
+ "name": "trader",
3023
+ "type": "address"
3024
+ },
3025
+ {
3026
+ "internalType": "uint256",
3027
+ "name": "totalRebateFactor",
3028
+ "type": "uint256"
3029
+ },
3030
+ {
3031
+ "internalType": "uint256",
3032
+ "name": "affiliateRewardFactor",
3033
+ "type": "uint256"
3034
+ },
3035
+ {
3036
+ "internalType": "uint256",
3037
+ "name": "adjustedAffiliateRewardFactor",
3038
+ "type": "uint256"
3039
+ },
3040
+ {
3041
+ "internalType": "uint256",
3042
+ "name": "traderDiscountFactor",
3043
+ "type": "uint256"
3044
+ },
3045
+ {
3046
+ "internalType": "uint256",
3047
+ "name": "totalRebateAmount",
3048
+ "type": "uint256"
3049
+ },
3050
+ {
3051
+ "internalType": "uint256",
3052
+ "name": "traderDiscountAmount",
3053
+ "type": "uint256"
3054
+ },
3055
+ {
3056
+ "internalType": "uint256",
3057
+ "name": "affiliateRewardAmount",
3058
+ "type": "uint256"
3059
+ }
3060
+ ],
3061
+ "internalType": "struct PositionPricingUtils.PositionReferralFees",
3062
+ "name": "referral",
3063
+ "type": "tuple"
3064
+ },
3065
+ {
3066
+ "components": [
3067
+ {
3068
+ "internalType": "uint256",
3069
+ "name": "traderTier",
3070
+ "type": "uint256"
3071
+ },
3072
+ {
3073
+ "internalType": "uint256",
3074
+ "name": "traderDiscountFactor",
3075
+ "type": "uint256"
3076
+ },
3077
+ {
3078
+ "internalType": "uint256",
3079
+ "name": "traderDiscountAmount",
3080
+ "type": "uint256"
3081
+ }
3082
+ ],
3083
+ "internalType": "struct PositionPricingUtils.PositionProFees",
3084
+ "name": "pro",
3085
+ "type": "tuple"
3086
+ },
3087
+ {
3088
+ "components": [
3089
+ {
3090
+ "internalType": "uint256",
3091
+ "name": "fundingFeeAmount",
3092
+ "type": "uint256"
3093
+ },
3094
+ {
3095
+ "internalType": "uint256",
3096
+ "name": "claimableLongTokenAmount",
3097
+ "type": "uint256"
3098
+ },
3099
+ {
3100
+ "internalType": "uint256",
3101
+ "name": "claimableShortTokenAmount",
3102
+ "type": "uint256"
3103
+ },
3104
+ {
3105
+ "internalType": "uint256",
3106
+ "name": "latestFundingFeeAmountPerSize",
3107
+ "type": "uint256"
3108
+ },
3109
+ {
3110
+ "internalType": "uint256",
3111
+ "name": "latestLongTokenClaimableFundingAmountPerSize",
3112
+ "type": "uint256"
3113
+ },
3114
+ {
3115
+ "internalType": "uint256",
3116
+ "name": "latestShortTokenClaimableFundingAmountPerSize",
3117
+ "type": "uint256"
3118
+ }
3119
+ ],
3120
+ "internalType": "struct PositionPricingUtils.PositionFundingFees",
3121
+ "name": "funding",
3122
+ "type": "tuple"
3123
+ },
3124
+ {
3125
+ "components": [
3126
+ {
3127
+ "internalType": "uint256",
3128
+ "name": "borrowingFeeUsd",
3129
+ "type": "uint256"
3130
+ },
3131
+ {
3132
+ "internalType": "uint256",
3133
+ "name": "borrowingFeeAmount",
3134
+ "type": "uint256"
3135
+ },
3136
+ {
3137
+ "internalType": "uint256",
3138
+ "name": "borrowingFeeReceiverFactor",
3139
+ "type": "uint256"
3140
+ },
3141
+ {
3142
+ "internalType": "uint256",
3143
+ "name": "borrowingFeeAmountForFeeReceiver",
3144
+ "type": "uint256"
3145
+ }
3146
+ ],
3147
+ "internalType": "struct PositionPricingUtils.PositionBorrowingFees",
3148
+ "name": "borrowing",
3149
+ "type": "tuple"
3150
+ },
3151
+ {
3152
+ "components": [
3153
+ {
3154
+ "internalType": "address",
3155
+ "name": "uiFeeReceiver",
3156
+ "type": "address"
3157
+ },
3158
+ {
3159
+ "internalType": "uint256",
3160
+ "name": "uiFeeReceiverFactor",
3161
+ "type": "uint256"
3162
+ },
3163
+ {
3164
+ "internalType": "uint256",
3165
+ "name": "uiFeeAmount",
3166
+ "type": "uint256"
3167
+ }
3168
+ ],
3169
+ "internalType": "struct PositionPricingUtils.PositionUiFees",
3170
+ "name": "ui",
3171
+ "type": "tuple"
3172
+ },
3173
+ {
3174
+ "components": [
3175
+ {
3176
+ "internalType": "uint256",
3177
+ "name": "liquidationFeeUsd",
3178
+ "type": "uint256"
3179
+ },
3180
+ {
3181
+ "internalType": "uint256",
3182
+ "name": "liquidationFeeAmount",
3183
+ "type": "uint256"
3184
+ },
3185
+ {
3186
+ "internalType": "uint256",
3187
+ "name": "liquidationFeeReceiverFactor",
3188
+ "type": "uint256"
3189
+ },
3190
+ {
3191
+ "internalType": "uint256",
3192
+ "name": "liquidationFeeAmountForFeeReceiver",
3193
+ "type": "uint256"
3194
+ }
3195
+ ],
3196
+ "internalType": "struct PositionPricingUtils.PositionLiquidationFees",
3197
+ "name": "liquidation",
3198
+ "type": "tuple"
3199
+ },
3200
+ {
3201
+ "components": [
3202
+ {
3203
+ "internalType": "uint256",
3204
+ "name": "min",
3205
+ "type": "uint256"
3206
+ },
3207
+ {
3208
+ "internalType": "uint256",
3209
+ "name": "max",
3210
+ "type": "uint256"
3211
+ }
3212
+ ],
3213
+ "internalType": "struct Price.Props",
3214
+ "name": "collateralTokenPrice",
3215
+ "type": "tuple"
3216
+ },
3217
+ {
3218
+ "internalType": "uint256",
3219
+ "name": "positionFeeFactor",
3220
+ "type": "uint256"
3221
+ },
3222
+ {
3223
+ "internalType": "uint256",
3224
+ "name": "protocolFeeAmount",
3225
+ "type": "uint256"
3226
+ },
3227
+ {
3228
+ "internalType": "uint256",
3229
+ "name": "positionFeeReceiverFactor",
3230
+ "type": "uint256"
3231
+ },
3232
+ {
3233
+ "internalType": "uint256",
3234
+ "name": "feeReceiverAmount",
3235
+ "type": "uint256"
3236
+ },
3237
+ {
3238
+ "internalType": "uint256",
3239
+ "name": "feeAmountForPool",
3240
+ "type": "uint256"
3241
+ },
3242
+ {
3243
+ "internalType": "uint256",
3244
+ "name": "positionFeeAmountForPool",
3245
+ "type": "uint256"
3246
+ },
3247
+ {
3248
+ "internalType": "uint256",
3249
+ "name": "positionFeeAmount",
3250
+ "type": "uint256"
3251
+ },
3252
+ {
3253
+ "internalType": "uint256",
3254
+ "name": "totalCostAmountExcludingFunding",
3255
+ "type": "uint256"
3256
+ },
3257
+ {
3258
+ "internalType": "uint256",
3259
+ "name": "totalCostAmount",
3260
+ "type": "uint256"
3261
+ },
3262
+ {
3263
+ "internalType": "uint256",
3264
+ "name": "totalDiscountAmount",
3265
+ "type": "uint256"
3266
+ }
3267
+ ],
3268
+ "internalType": "struct PositionPricingUtils.PositionFees",
3269
+ "name": "fees",
3270
+ "type": "tuple"
3271
+ },
3272
+ {
3273
+ "components": [
3274
+ {
3275
+ "internalType": "int256",
3276
+ "name": "priceImpactUsd",
3277
+ "type": "int256"
3278
+ },
3279
+ {
3280
+ "internalType": "uint256",
3281
+ "name": "priceImpactDiffUsd",
3282
+ "type": "uint256"
3283
+ },
3284
+ {
3285
+ "internalType": "uint256",
3286
+ "name": "executionPrice",
3287
+ "type": "uint256"
3288
+ }
3289
+ ],
3290
+ "internalType": "struct ReaderPricingUtils.ExecutionPriceResult",
3291
+ "name": "executionPriceResult",
3292
+ "type": "tuple"
3293
+ },
3294
+ {
3295
+ "internalType": "int256",
3296
+ "name": "basePnlUsd",
3297
+ "type": "int256"
3298
+ },
3299
+ {
3300
+ "internalType": "int256",
3301
+ "name": "uncappedBasePnlUsd",
3302
+ "type": "int256"
3303
+ },
3304
+ {
3305
+ "internalType": "int256",
3306
+ "name": "pnlAfterPriceImpactUsd",
3307
+ "type": "int256"
3308
+ }
3309
+ ],
3310
+ "internalType": "struct ReaderPositionUtils.PositionInfo",
3311
+ "name": "",
3312
+ "type": "tuple"
3313
+ }
3314
+ ],
3315
+ "stateMutability": "view",
3316
+ "type": "function"
3317
+ },
3318
+ {
3319
+ "inputs": [
3320
+ {
3321
+ "internalType": "contract DataStore",
3322
+ "name": "dataStore",
3323
+ "type": "address"
3324
+ },
3325
+ {
3326
+ "internalType": "contract IReferralStorage",
3327
+ "name": "referralStorage",
3328
+ "type": "address"
3329
+ },
3330
+ {
3331
+ "internalType": "bytes32[]",
3332
+ "name": "positionKeys",
3333
+ "type": "bytes32[]"
3334
+ },
3335
+ {
3336
+ "components": [
3337
+ {
3338
+ "components": [
3339
+ {
3340
+ "internalType": "uint256",
3341
+ "name": "min",
3342
+ "type": "uint256"
3343
+ },
3344
+ {
3345
+ "internalType": "uint256",
3346
+ "name": "max",
3347
+ "type": "uint256"
3348
+ }
3349
+ ],
3350
+ "internalType": "struct Price.Props",
3351
+ "name": "indexTokenPrice",
3352
+ "type": "tuple"
3353
+ },
3354
+ {
3355
+ "components": [
3356
+ {
3357
+ "internalType": "uint256",
3358
+ "name": "min",
3359
+ "type": "uint256"
3360
+ },
3361
+ {
3362
+ "internalType": "uint256",
3363
+ "name": "max",
3364
+ "type": "uint256"
3365
+ }
3366
+ ],
3367
+ "internalType": "struct Price.Props",
3368
+ "name": "longTokenPrice",
3369
+ "type": "tuple"
3370
+ },
3371
+ {
3372
+ "components": [
3373
+ {
3374
+ "internalType": "uint256",
3375
+ "name": "min",
3376
+ "type": "uint256"
3377
+ },
3378
+ {
3379
+ "internalType": "uint256",
3380
+ "name": "max",
3381
+ "type": "uint256"
3382
+ }
3383
+ ],
3384
+ "internalType": "struct Price.Props",
3385
+ "name": "shortTokenPrice",
3386
+ "type": "tuple"
3387
+ }
3388
+ ],
3389
+ "internalType": "struct MarketUtils.MarketPrices[]",
3390
+ "name": "prices",
3391
+ "type": "tuple[]"
3392
+ },
3393
+ {
3394
+ "internalType": "address",
3395
+ "name": "uiFeeReceiver",
3396
+ "type": "address"
3397
+ }
3398
+ ],
3399
+ "name": "getPositionInfoList",
3400
+ "outputs": [
3401
+ {
3402
+ "components": [
3403
+ {
3404
+ "components": [
3405
+ {
3406
+ "components": [
3407
+ {
3408
+ "internalType": "address",
3409
+ "name": "account",
3410
+ "type": "address"
3411
+ },
3412
+ {
3413
+ "internalType": "address",
3414
+ "name": "market",
3415
+ "type": "address"
3416
+ },
3417
+ {
3418
+ "internalType": "address",
3419
+ "name": "collateralToken",
3420
+ "type": "address"
3421
+ }
3422
+ ],
3423
+ "internalType": "struct Position.Addresses",
3424
+ "name": "addresses",
3425
+ "type": "tuple"
3426
+ },
3427
+ {
3428
+ "components": [
3429
+ {
3430
+ "internalType": "uint256",
3431
+ "name": "sizeInUsd",
3432
+ "type": "uint256"
3433
+ },
3434
+ {
3435
+ "internalType": "uint256",
3436
+ "name": "sizeInTokens",
3437
+ "type": "uint256"
3438
+ },
3439
+ {
3440
+ "internalType": "uint256",
3441
+ "name": "collateralAmount",
3442
+ "type": "uint256"
3443
+ },
3444
+ {
3445
+ "internalType": "uint256",
3446
+ "name": "borrowingFactor",
3447
+ "type": "uint256"
3448
+ },
3449
+ {
3450
+ "internalType": "uint256",
3451
+ "name": "fundingFeeAmountPerSize",
3452
+ "type": "uint256"
3453
+ },
3454
+ {
3455
+ "internalType": "uint256",
3456
+ "name": "longTokenClaimableFundingAmountPerSize",
3457
+ "type": "uint256"
3458
+ },
3459
+ {
3460
+ "internalType": "uint256",
3461
+ "name": "shortTokenClaimableFundingAmountPerSize",
3462
+ "type": "uint256"
3463
+ },
3464
+ {
3465
+ "internalType": "uint256",
3466
+ "name": "increasedAtTime",
3467
+ "type": "uint256"
3468
+ },
3469
+ {
3470
+ "internalType": "uint256",
3471
+ "name": "decreasedAtTime",
3472
+ "type": "uint256"
3473
+ }
3474
+ ],
3475
+ "internalType": "struct Position.Numbers",
3476
+ "name": "numbers",
3477
+ "type": "tuple"
3478
+ },
3479
+ {
3480
+ "components": [
3481
+ {
3482
+ "internalType": "bool",
3483
+ "name": "isLong",
3484
+ "type": "bool"
3485
+ }
3486
+ ],
3487
+ "internalType": "struct Position.Flags",
3488
+ "name": "flags",
3489
+ "type": "tuple"
3490
+ }
3491
+ ],
3492
+ "internalType": "struct Position.Props",
3493
+ "name": "position",
3494
+ "type": "tuple"
3495
+ },
3496
+ {
3497
+ "components": [
3498
+ {
3499
+ "components": [
3500
+ {
3501
+ "internalType": "bytes32",
3502
+ "name": "referralCode",
3503
+ "type": "bytes32"
3504
+ },
3505
+ {
3506
+ "internalType": "address",
3507
+ "name": "affiliate",
3508
+ "type": "address"
3509
+ },
3510
+ {
3511
+ "internalType": "address",
3512
+ "name": "trader",
3513
+ "type": "address"
3514
+ },
3515
+ {
3516
+ "internalType": "uint256",
3517
+ "name": "totalRebateFactor",
3518
+ "type": "uint256"
3519
+ },
3520
+ {
3521
+ "internalType": "uint256",
3522
+ "name": "affiliateRewardFactor",
3523
+ "type": "uint256"
3524
+ },
3525
+ {
3526
+ "internalType": "uint256",
3527
+ "name": "adjustedAffiliateRewardFactor",
3528
+ "type": "uint256"
3529
+ },
3530
+ {
3531
+ "internalType": "uint256",
3532
+ "name": "traderDiscountFactor",
3533
+ "type": "uint256"
3534
+ },
3535
+ {
3536
+ "internalType": "uint256",
3537
+ "name": "totalRebateAmount",
3538
+ "type": "uint256"
3539
+ },
3540
+ {
3541
+ "internalType": "uint256",
3542
+ "name": "traderDiscountAmount",
3543
+ "type": "uint256"
3544
+ },
3545
+ {
3546
+ "internalType": "uint256",
3547
+ "name": "affiliateRewardAmount",
3548
+ "type": "uint256"
3549
+ }
3550
+ ],
3551
+ "internalType": "struct PositionPricingUtils.PositionReferralFees",
3552
+ "name": "referral",
3553
+ "type": "tuple"
3554
+ },
3555
+ {
3556
+ "components": [
3557
+ {
3558
+ "internalType": "uint256",
3559
+ "name": "traderTier",
3560
+ "type": "uint256"
3561
+ },
3562
+ {
3563
+ "internalType": "uint256",
3564
+ "name": "traderDiscountFactor",
3565
+ "type": "uint256"
3566
+ },
3567
+ {
3568
+ "internalType": "uint256",
3569
+ "name": "traderDiscountAmount",
3570
+ "type": "uint256"
3571
+ }
3572
+ ],
3573
+ "internalType": "struct PositionPricingUtils.PositionProFees",
3574
+ "name": "pro",
3575
+ "type": "tuple"
3576
+ },
3577
+ {
3578
+ "components": [
3579
+ {
3580
+ "internalType": "uint256",
3581
+ "name": "fundingFeeAmount",
3582
+ "type": "uint256"
3583
+ },
3584
+ {
3585
+ "internalType": "uint256",
3586
+ "name": "claimableLongTokenAmount",
3587
+ "type": "uint256"
3588
+ },
3589
+ {
3590
+ "internalType": "uint256",
3591
+ "name": "claimableShortTokenAmount",
3592
+ "type": "uint256"
3593
+ },
3594
+ {
3595
+ "internalType": "uint256",
3596
+ "name": "latestFundingFeeAmountPerSize",
3597
+ "type": "uint256"
3598
+ },
3599
+ {
3600
+ "internalType": "uint256",
3601
+ "name": "latestLongTokenClaimableFundingAmountPerSize",
3602
+ "type": "uint256"
3603
+ },
3604
+ {
3605
+ "internalType": "uint256",
3606
+ "name": "latestShortTokenClaimableFundingAmountPerSize",
3607
+ "type": "uint256"
3608
+ }
3609
+ ],
3610
+ "internalType": "struct PositionPricingUtils.PositionFundingFees",
3611
+ "name": "funding",
3612
+ "type": "tuple"
3613
+ },
3614
+ {
3615
+ "components": [
3616
+ {
3617
+ "internalType": "uint256",
3618
+ "name": "borrowingFeeUsd",
3619
+ "type": "uint256"
3620
+ },
3621
+ {
3622
+ "internalType": "uint256",
3623
+ "name": "borrowingFeeAmount",
3624
+ "type": "uint256"
3625
+ },
3626
+ {
3627
+ "internalType": "uint256",
3628
+ "name": "borrowingFeeReceiverFactor",
3629
+ "type": "uint256"
3630
+ },
3631
+ {
3632
+ "internalType": "uint256",
3633
+ "name": "borrowingFeeAmountForFeeReceiver",
3634
+ "type": "uint256"
3635
+ }
3636
+ ],
3637
+ "internalType": "struct PositionPricingUtils.PositionBorrowingFees",
3638
+ "name": "borrowing",
3639
+ "type": "tuple"
3640
+ },
3641
+ {
3642
+ "components": [
3643
+ {
3644
+ "internalType": "address",
3645
+ "name": "uiFeeReceiver",
3646
+ "type": "address"
3647
+ },
3648
+ {
3649
+ "internalType": "uint256",
3650
+ "name": "uiFeeReceiverFactor",
3651
+ "type": "uint256"
3652
+ },
3653
+ {
3654
+ "internalType": "uint256",
3655
+ "name": "uiFeeAmount",
3656
+ "type": "uint256"
3657
+ }
3658
+ ],
3659
+ "internalType": "struct PositionPricingUtils.PositionUiFees",
3660
+ "name": "ui",
3661
+ "type": "tuple"
3662
+ },
3663
+ {
3664
+ "components": [
3665
+ {
3666
+ "internalType": "uint256",
3667
+ "name": "liquidationFeeUsd",
3668
+ "type": "uint256"
3669
+ },
3670
+ {
3671
+ "internalType": "uint256",
3672
+ "name": "liquidationFeeAmount",
3673
+ "type": "uint256"
3674
+ },
3675
+ {
3676
+ "internalType": "uint256",
3677
+ "name": "liquidationFeeReceiverFactor",
3678
+ "type": "uint256"
3679
+ },
3680
+ {
3681
+ "internalType": "uint256",
3682
+ "name": "liquidationFeeAmountForFeeReceiver",
3683
+ "type": "uint256"
3684
+ }
3685
+ ],
3686
+ "internalType": "struct PositionPricingUtils.PositionLiquidationFees",
3687
+ "name": "liquidation",
3688
+ "type": "tuple"
3689
+ },
3690
+ {
3691
+ "components": [
3692
+ {
3693
+ "internalType": "uint256",
3694
+ "name": "min",
3695
+ "type": "uint256"
3696
+ },
3697
+ {
3698
+ "internalType": "uint256",
3699
+ "name": "max",
3700
+ "type": "uint256"
3701
+ }
3702
+ ],
3703
+ "internalType": "struct Price.Props",
3704
+ "name": "collateralTokenPrice",
3705
+ "type": "tuple"
3706
+ },
3707
+ {
3708
+ "internalType": "uint256",
3709
+ "name": "positionFeeFactor",
3710
+ "type": "uint256"
3711
+ },
3712
+ {
3713
+ "internalType": "uint256",
3714
+ "name": "protocolFeeAmount",
3715
+ "type": "uint256"
3716
+ },
3717
+ {
3718
+ "internalType": "uint256",
3719
+ "name": "positionFeeReceiverFactor",
3720
+ "type": "uint256"
3721
+ },
3722
+ {
3723
+ "internalType": "uint256",
3724
+ "name": "feeReceiverAmount",
3725
+ "type": "uint256"
3726
+ },
3727
+ {
3728
+ "internalType": "uint256",
3729
+ "name": "feeAmountForPool",
3730
+ "type": "uint256"
3731
+ },
3732
+ {
3733
+ "internalType": "uint256",
3734
+ "name": "positionFeeAmountForPool",
3735
+ "type": "uint256"
3736
+ },
3737
+ {
3738
+ "internalType": "uint256",
3739
+ "name": "positionFeeAmount",
3740
+ "type": "uint256"
3741
+ },
3742
+ {
3743
+ "internalType": "uint256",
3744
+ "name": "totalCostAmountExcludingFunding",
3745
+ "type": "uint256"
3746
+ },
3747
+ {
3748
+ "internalType": "uint256",
3749
+ "name": "totalCostAmount",
3750
+ "type": "uint256"
3751
+ },
3752
+ {
3753
+ "internalType": "uint256",
3754
+ "name": "totalDiscountAmount",
3755
+ "type": "uint256"
3756
+ }
3757
+ ],
3758
+ "internalType": "struct PositionPricingUtils.PositionFees",
3759
+ "name": "fees",
3760
+ "type": "tuple"
3761
+ },
3762
+ {
3763
+ "components": [
3764
+ {
3765
+ "internalType": "int256",
3766
+ "name": "priceImpactUsd",
3767
+ "type": "int256"
3768
+ },
3769
+ {
3770
+ "internalType": "uint256",
3771
+ "name": "priceImpactDiffUsd",
3772
+ "type": "uint256"
3773
+ },
3774
+ {
3775
+ "internalType": "uint256",
3776
+ "name": "executionPrice",
3777
+ "type": "uint256"
3778
+ }
3779
+ ],
3780
+ "internalType": "struct ReaderPricingUtils.ExecutionPriceResult",
3781
+ "name": "executionPriceResult",
3782
+ "type": "tuple"
3783
+ },
3784
+ {
3785
+ "internalType": "int256",
3786
+ "name": "basePnlUsd",
3787
+ "type": "int256"
3788
+ },
3789
+ {
3790
+ "internalType": "int256",
3791
+ "name": "uncappedBasePnlUsd",
3792
+ "type": "int256"
3793
+ },
3794
+ {
3795
+ "internalType": "int256",
3796
+ "name": "pnlAfterPriceImpactUsd",
3797
+ "type": "int256"
3798
+ }
3799
+ ],
3800
+ "internalType": "struct ReaderPositionUtils.PositionInfo[]",
3801
+ "name": "",
3802
+ "type": "tuple[]"
3803
+ }
3804
+ ],
3805
+ "stateMutability": "view",
3806
+ "type": "function"
3807
+ },
3808
+ {
3809
+ "inputs": [
3810
+ {
3811
+ "internalType": "contract DataStore",
3812
+ "name": "dataStore",
3813
+ "type": "address"
3814
+ },
3815
+ {
3816
+ "components": [
3817
+ {
3818
+ "internalType": "address",
3819
+ "name": "marketToken",
3820
+ "type": "address"
3821
+ },
3822
+ {
3823
+ "internalType": "address",
3824
+ "name": "indexToken",
3825
+ "type": "address"
3826
+ },
3827
+ {
3828
+ "internalType": "address",
3829
+ "name": "longToken",
3830
+ "type": "address"
3831
+ },
3832
+ {
3833
+ "internalType": "address",
3834
+ "name": "shortToken",
3835
+ "type": "address"
3836
+ }
3837
+ ],
3838
+ "internalType": "struct Market.Props",
3839
+ "name": "market",
3840
+ "type": "tuple"
3841
+ },
3842
+ {
3843
+ "components": [
3844
+ {
3845
+ "components": [
3846
+ {
3847
+ "internalType": "uint256",
3848
+ "name": "min",
3849
+ "type": "uint256"
3850
+ },
3851
+ {
3852
+ "internalType": "uint256",
3853
+ "name": "max",
3854
+ "type": "uint256"
3855
+ }
3856
+ ],
3857
+ "internalType": "struct Price.Props",
3858
+ "name": "indexTokenPrice",
3859
+ "type": "tuple"
3860
+ },
3861
+ {
3862
+ "components": [
3863
+ {
3864
+ "internalType": "uint256",
3865
+ "name": "min",
3866
+ "type": "uint256"
3867
+ },
3868
+ {
3869
+ "internalType": "uint256",
3870
+ "name": "max",
3871
+ "type": "uint256"
3872
+ }
3873
+ ],
3874
+ "internalType": "struct Price.Props",
3875
+ "name": "longTokenPrice",
3876
+ "type": "tuple"
3877
+ },
3878
+ {
3879
+ "components": [
3880
+ {
3881
+ "internalType": "uint256",
3882
+ "name": "min",
3883
+ "type": "uint256"
3884
+ },
3885
+ {
3886
+ "internalType": "uint256",
3887
+ "name": "max",
3888
+ "type": "uint256"
3889
+ }
3890
+ ],
3891
+ "internalType": "struct Price.Props",
3892
+ "name": "shortTokenPrice",
3893
+ "type": "tuple"
3894
+ }
3895
+ ],
3896
+ "internalType": "struct MarketUtils.MarketPrices",
3897
+ "name": "prices",
3898
+ "type": "tuple"
3899
+ },
3900
+ {
3901
+ "internalType": "bytes32",
3902
+ "name": "positionKey",
3903
+ "type": "bytes32"
3904
+ },
3905
+ {
3906
+ "internalType": "uint256",
3907
+ "name": "sizeDeltaUsd",
3908
+ "type": "uint256"
3909
+ }
3910
+ ],
3911
+ "name": "getPositionPnlUsd",
3912
+ "outputs": [
3913
+ {
3914
+ "internalType": "int256",
3915
+ "name": "",
3916
+ "type": "int256"
3917
+ },
3918
+ {
3919
+ "internalType": "int256",
3920
+ "name": "",
3921
+ "type": "int256"
3922
+ },
3923
+ {
3924
+ "internalType": "uint256",
3925
+ "name": "",
3926
+ "type": "uint256"
3927
+ }
3928
+ ],
3929
+ "stateMutability": "view",
3930
+ "type": "function"
3931
+ },
3932
+ {
3933
+ "inputs": [
3934
+ {
3935
+ "internalType": "contract DataStore",
3936
+ "name": "dataStore",
3937
+ "type": "address"
3938
+ },
3939
+ {
3940
+ "internalType": "bytes32",
3941
+ "name": "key",
3942
+ "type": "bytes32"
3943
+ }
3944
+ ],
3945
+ "name": "getShift",
3946
+ "outputs": [
3947
+ {
3948
+ "components": [
3949
+ {
3950
+ "components": [
3951
+ {
3952
+ "internalType": "address",
3953
+ "name": "account",
3954
+ "type": "address"
3955
+ },
3956
+ {
3957
+ "internalType": "address",
3958
+ "name": "receiver",
3959
+ "type": "address"
3960
+ },
3961
+ {
3962
+ "internalType": "address",
3963
+ "name": "callbackContract",
3964
+ "type": "address"
3965
+ },
3966
+ {
3967
+ "internalType": "address",
3968
+ "name": "uiFeeReceiver",
3969
+ "type": "address"
3970
+ },
3971
+ {
3972
+ "internalType": "address",
3973
+ "name": "fromMarket",
3974
+ "type": "address"
3975
+ },
3976
+ {
3977
+ "internalType": "address",
3978
+ "name": "toMarket",
3979
+ "type": "address"
3980
+ }
3981
+ ],
3982
+ "internalType": "struct Shift.Addresses",
3983
+ "name": "addresses",
3984
+ "type": "tuple"
3985
+ },
3986
+ {
3987
+ "components": [
3988
+ {
3989
+ "internalType": "uint256",
3990
+ "name": "marketTokenAmount",
3991
+ "type": "uint256"
3992
+ },
3993
+ {
3994
+ "internalType": "uint256",
3995
+ "name": "minMarketTokens",
3996
+ "type": "uint256"
3997
+ },
3998
+ {
3999
+ "internalType": "uint256",
4000
+ "name": "updatedAtTime",
4001
+ "type": "uint256"
4002
+ },
4003
+ {
4004
+ "internalType": "uint256",
4005
+ "name": "executionFee",
4006
+ "type": "uint256"
4007
+ },
4008
+ {
4009
+ "internalType": "uint256",
4010
+ "name": "callbackGasLimit",
4011
+ "type": "uint256"
4012
+ }
4013
+ ],
4014
+ "internalType": "struct Shift.Numbers",
4015
+ "name": "numbers",
4016
+ "type": "tuple"
4017
+ }
4018
+ ],
4019
+ "internalType": "struct Shift.Props",
4020
+ "name": "",
4021
+ "type": "tuple"
4022
+ }
4023
+ ],
4024
+ "stateMutability": "view",
4025
+ "type": "function"
4026
+ },
4027
+ {
4028
+ "inputs": [
4029
+ {
4030
+ "internalType": "contract DataStore",
4031
+ "name": "dataStore",
4032
+ "type": "address"
4033
+ },
4034
+ {
4035
+ "components": [
4036
+ {
4037
+ "internalType": "address",
4038
+ "name": "marketToken",
4039
+ "type": "address"
4040
+ },
4041
+ {
4042
+ "internalType": "address",
4043
+ "name": "indexToken",
4044
+ "type": "address"
4045
+ },
4046
+ {
4047
+ "internalType": "address",
4048
+ "name": "longToken",
4049
+ "type": "address"
4050
+ },
4051
+ {
4052
+ "internalType": "address",
4053
+ "name": "shortToken",
4054
+ "type": "address"
4055
+ }
4056
+ ],
4057
+ "internalType": "struct Market.Props",
4058
+ "name": "market",
4059
+ "type": "tuple"
4060
+ },
4061
+ {
4062
+ "components": [
4063
+ {
4064
+ "components": [
4065
+ {
4066
+ "internalType": "uint256",
4067
+ "name": "min",
4068
+ "type": "uint256"
4069
+ },
4070
+ {
4071
+ "internalType": "uint256",
4072
+ "name": "max",
4073
+ "type": "uint256"
4074
+ }
4075
+ ],
4076
+ "internalType": "struct Price.Props",
4077
+ "name": "indexTokenPrice",
4078
+ "type": "tuple"
4079
+ },
4080
+ {
4081
+ "components": [
4082
+ {
4083
+ "internalType": "uint256",
4084
+ "name": "min",
4085
+ "type": "uint256"
4086
+ },
4087
+ {
4088
+ "internalType": "uint256",
4089
+ "name": "max",
4090
+ "type": "uint256"
4091
+ }
4092
+ ],
4093
+ "internalType": "struct Price.Props",
4094
+ "name": "longTokenPrice",
4095
+ "type": "tuple"
4096
+ },
4097
+ {
4098
+ "components": [
4099
+ {
4100
+ "internalType": "uint256",
4101
+ "name": "min",
4102
+ "type": "uint256"
4103
+ },
4104
+ {
4105
+ "internalType": "uint256",
4106
+ "name": "max",
4107
+ "type": "uint256"
4108
+ }
4109
+ ],
4110
+ "internalType": "struct Price.Props",
4111
+ "name": "shortTokenPrice",
4112
+ "type": "tuple"
4113
+ }
4114
+ ],
4115
+ "internalType": "struct MarketUtils.MarketPrices",
4116
+ "name": "prices",
4117
+ "type": "tuple"
4118
+ },
4119
+ {
4120
+ "internalType": "address",
4121
+ "name": "tokenIn",
4122
+ "type": "address"
4123
+ },
4124
+ {
4125
+ "internalType": "uint256",
4126
+ "name": "amountIn",
4127
+ "type": "uint256"
4128
+ },
4129
+ {
4130
+ "internalType": "address",
4131
+ "name": "uiFeeReceiver",
4132
+ "type": "address"
4133
+ }
4134
+ ],
4135
+ "name": "getSwapAmountOut",
4136
+ "outputs": [
4137
+ {
4138
+ "internalType": "uint256",
4139
+ "name": "",
4140
+ "type": "uint256"
4141
+ },
4142
+ {
4143
+ "internalType": "int256",
4144
+ "name": "",
4145
+ "type": "int256"
4146
+ },
4147
+ {
4148
+ "components": [
4149
+ {
4150
+ "internalType": "uint256",
4151
+ "name": "feeReceiverAmount",
4152
+ "type": "uint256"
4153
+ },
4154
+ {
4155
+ "internalType": "uint256",
4156
+ "name": "feeAmountForPool",
4157
+ "type": "uint256"
4158
+ },
4159
+ {
4160
+ "internalType": "uint256",
4161
+ "name": "amountAfterFees",
4162
+ "type": "uint256"
4163
+ },
4164
+ {
4165
+ "internalType": "address",
4166
+ "name": "uiFeeReceiver",
4167
+ "type": "address"
4168
+ },
4169
+ {
4170
+ "internalType": "uint256",
4171
+ "name": "uiFeeReceiverFactor",
4172
+ "type": "uint256"
4173
+ },
4174
+ {
4175
+ "internalType": "uint256",
4176
+ "name": "uiFeeAmount",
4177
+ "type": "uint256"
4178
+ }
4179
+ ],
4180
+ "internalType": "struct SwapPricingUtils.SwapFees",
4181
+ "name": "fees",
4182
+ "type": "tuple"
4183
+ }
4184
+ ],
4185
+ "stateMutability": "view",
4186
+ "type": "function"
4187
+ },
4188
+ {
4189
+ "inputs": [
4190
+ {
4191
+ "internalType": "contract DataStore",
4192
+ "name": "dataStore",
4193
+ "type": "address"
4194
+ },
4195
+ {
4196
+ "internalType": "address",
4197
+ "name": "marketKey",
4198
+ "type": "address"
4199
+ },
4200
+ {
4201
+ "internalType": "address",
4202
+ "name": "tokenIn",
4203
+ "type": "address"
4204
+ },
4205
+ {
4206
+ "internalType": "address",
4207
+ "name": "tokenOut",
4208
+ "type": "address"
4209
+ },
4210
+ {
4211
+ "internalType": "uint256",
4212
+ "name": "amountIn",
4213
+ "type": "uint256"
4214
+ },
4215
+ {
4216
+ "components": [
4217
+ {
4218
+ "internalType": "uint256",
4219
+ "name": "min",
4220
+ "type": "uint256"
4221
+ },
4222
+ {
4223
+ "internalType": "uint256",
4224
+ "name": "max",
4225
+ "type": "uint256"
4226
+ }
4227
+ ],
4228
+ "internalType": "struct Price.Props",
4229
+ "name": "tokenInPrice",
4230
+ "type": "tuple"
4231
+ },
4232
+ {
4233
+ "components": [
4234
+ {
4235
+ "internalType": "uint256",
4236
+ "name": "min",
4237
+ "type": "uint256"
4238
+ },
4239
+ {
4240
+ "internalType": "uint256",
4241
+ "name": "max",
4242
+ "type": "uint256"
4243
+ }
4244
+ ],
4245
+ "internalType": "struct Price.Props",
4246
+ "name": "tokenOutPrice",
4247
+ "type": "tuple"
4248
+ }
4249
+ ],
4250
+ "name": "getSwapPriceImpact",
4251
+ "outputs": [
4252
+ {
4253
+ "internalType": "int256",
4254
+ "name": "",
4255
+ "type": "int256"
4256
+ },
4257
+ {
4258
+ "internalType": "int256",
4259
+ "name": "",
4260
+ "type": "int256"
4261
+ },
4262
+ {
4263
+ "internalType": "int256",
4264
+ "name": "",
4265
+ "type": "int256"
4266
+ }
4267
+ ],
4268
+ "stateMutability": "view",
4269
+ "type": "function"
4270
+ },
4271
+ {
4272
+ "inputs": [
4273
+ {
4274
+ "internalType": "contract DataStore",
4275
+ "name": "dataStore",
4276
+ "type": "address"
4277
+ },
4278
+ {
4279
+ "internalType": "bytes32",
4280
+ "name": "key",
4281
+ "type": "bytes32"
4282
+ }
4283
+ ],
4284
+ "name": "getWithdrawal",
4285
+ "outputs": [
4286
+ {
4287
+ "components": [
4288
+ {
4289
+ "components": [
4290
+ {
4291
+ "internalType": "address",
4292
+ "name": "account",
4293
+ "type": "address"
4294
+ },
4295
+ {
4296
+ "internalType": "address",
4297
+ "name": "receiver",
4298
+ "type": "address"
4299
+ },
4300
+ {
4301
+ "internalType": "address",
4302
+ "name": "callbackContract",
4303
+ "type": "address"
4304
+ },
4305
+ {
4306
+ "internalType": "address",
4307
+ "name": "uiFeeReceiver",
4308
+ "type": "address"
4309
+ },
4310
+ {
4311
+ "internalType": "address",
4312
+ "name": "market",
4313
+ "type": "address"
4314
+ },
4315
+ {
4316
+ "internalType": "address[]",
4317
+ "name": "longTokenSwapPath",
4318
+ "type": "address[]"
4319
+ },
4320
+ {
4321
+ "internalType": "address[]",
4322
+ "name": "shortTokenSwapPath",
4323
+ "type": "address[]"
4324
+ }
4325
+ ],
4326
+ "internalType": "struct Withdrawal.Addresses",
4327
+ "name": "addresses",
4328
+ "type": "tuple"
4329
+ },
4330
+ {
4331
+ "components": [
4332
+ {
4333
+ "internalType": "uint256",
4334
+ "name": "marketTokenAmount",
4335
+ "type": "uint256"
4336
+ },
4337
+ {
4338
+ "internalType": "uint256",
4339
+ "name": "minLongTokenAmount",
4340
+ "type": "uint256"
4341
+ },
4342
+ {
4343
+ "internalType": "uint256",
4344
+ "name": "minShortTokenAmount",
4345
+ "type": "uint256"
4346
+ },
4347
+ {
4348
+ "internalType": "uint256",
4349
+ "name": "updatedAtTime",
4350
+ "type": "uint256"
4351
+ },
4352
+ {
4353
+ "internalType": "uint256",
4354
+ "name": "executionFee",
4355
+ "type": "uint256"
4356
+ },
4357
+ {
4358
+ "internalType": "uint256",
4359
+ "name": "callbackGasLimit",
4360
+ "type": "uint256"
4361
+ }
4362
+ ],
4363
+ "internalType": "struct Withdrawal.Numbers",
4364
+ "name": "numbers",
4365
+ "type": "tuple"
4366
+ },
4367
+ {
4368
+ "components": [
4369
+ {
4370
+ "internalType": "bool",
4371
+ "name": "shouldUnwrapNativeToken",
4372
+ "type": "bool"
4373
+ }
4374
+ ],
4375
+ "internalType": "struct Withdrawal.Flags",
4376
+ "name": "flags",
4377
+ "type": "tuple"
4378
+ }
4379
+ ],
4380
+ "internalType": "struct Withdrawal.Props",
4381
+ "name": "",
4382
+ "type": "tuple"
4383
+ }
4384
+ ],
4385
+ "stateMutability": "view",
4386
+ "type": "function"
4387
+ },
4388
+ {
4389
+ "inputs": [
4390
+ {
4391
+ "internalType": "contract DataStore",
4392
+ "name": "dataStore",
4393
+ "type": "address"
4394
+ },
4395
+ {
4396
+ "components": [
4397
+ {
4398
+ "internalType": "address",
4399
+ "name": "marketToken",
4400
+ "type": "address"
4401
+ },
4402
+ {
4403
+ "internalType": "address",
4404
+ "name": "indexToken",
4405
+ "type": "address"
4406
+ },
4407
+ {
4408
+ "internalType": "address",
4409
+ "name": "longToken",
4410
+ "type": "address"
4411
+ },
4412
+ {
4413
+ "internalType": "address",
4414
+ "name": "shortToken",
4415
+ "type": "address"
4416
+ }
4417
+ ],
4418
+ "internalType": "struct Market.Props",
4419
+ "name": "market",
4420
+ "type": "tuple"
4421
+ },
4422
+ {
4423
+ "components": [
4424
+ {
4425
+ "components": [
4426
+ {
4427
+ "internalType": "uint256",
4428
+ "name": "min",
4429
+ "type": "uint256"
4430
+ },
4431
+ {
4432
+ "internalType": "uint256",
4433
+ "name": "max",
4434
+ "type": "uint256"
4435
+ }
4436
+ ],
4437
+ "internalType": "struct Price.Props",
4438
+ "name": "indexTokenPrice",
4439
+ "type": "tuple"
4440
+ },
4441
+ {
4442
+ "components": [
4443
+ {
4444
+ "internalType": "uint256",
4445
+ "name": "min",
4446
+ "type": "uint256"
4447
+ },
4448
+ {
4449
+ "internalType": "uint256",
4450
+ "name": "max",
4451
+ "type": "uint256"
4452
+ }
4453
+ ],
4454
+ "internalType": "struct Price.Props",
4455
+ "name": "longTokenPrice",
4456
+ "type": "tuple"
4457
+ },
4458
+ {
4459
+ "components": [
4460
+ {
4461
+ "internalType": "uint256",
4462
+ "name": "min",
4463
+ "type": "uint256"
4464
+ },
4465
+ {
4466
+ "internalType": "uint256",
4467
+ "name": "max",
4468
+ "type": "uint256"
4469
+ }
4470
+ ],
4471
+ "internalType": "struct Price.Props",
4472
+ "name": "shortTokenPrice",
4473
+ "type": "tuple"
4474
+ }
4475
+ ],
4476
+ "internalType": "struct MarketUtils.MarketPrices",
4477
+ "name": "prices",
4478
+ "type": "tuple"
4479
+ },
4480
+ {
4481
+ "internalType": "uint256",
4482
+ "name": "marketTokenAmount",
4483
+ "type": "uint256"
4484
+ },
4485
+ {
4486
+ "internalType": "address",
4487
+ "name": "uiFeeReceiver",
4488
+ "type": "address"
4489
+ },
4490
+ {
4491
+ "internalType": "enum ISwapPricingUtils.SwapPricingType",
4492
+ "name": "swapPricingType",
4493
+ "type": "uint8"
4494
+ }
4495
+ ],
4496
+ "name": "getWithdrawalAmountOut",
4497
+ "outputs": [
4498
+ {
4499
+ "internalType": "uint256",
4500
+ "name": "",
4501
+ "type": "uint256"
4502
+ },
4503
+ {
4504
+ "internalType": "uint256",
4505
+ "name": "",
4506
+ "type": "uint256"
4507
+ }
4508
+ ],
4509
+ "stateMutability": "view",
4510
+ "type": "function"
4511
+ },
4512
+ {
4513
+ "inputs": [
4514
+ {
4515
+ "internalType": "contract DataStore",
4516
+ "name": "dataStore",
4517
+ "type": "address"
4518
+ },
4519
+ {
4520
+ "internalType": "contract IReferralStorage",
4521
+ "name": "referralStorage",
4522
+ "type": "address"
4523
+ },
4524
+ {
4525
+ "internalType": "bytes32",
4526
+ "name": "positionKey",
4527
+ "type": "bytes32"
4528
+ },
4529
+ {
4530
+ "components": [
4531
+ {
4532
+ "internalType": "address",
4533
+ "name": "marketToken",
4534
+ "type": "address"
4535
+ },
4536
+ {
4537
+ "internalType": "address",
4538
+ "name": "indexToken",
4539
+ "type": "address"
4540
+ },
4541
+ {
4542
+ "internalType": "address",
4543
+ "name": "longToken",
4544
+ "type": "address"
4545
+ },
4546
+ {
4547
+ "internalType": "address",
4548
+ "name": "shortToken",
4549
+ "type": "address"
4550
+ }
4551
+ ],
4552
+ "internalType": "struct Market.Props",
4553
+ "name": "market",
4554
+ "type": "tuple"
4555
+ },
4556
+ {
4557
+ "components": [
4558
+ {
4559
+ "components": [
4560
+ {
4561
+ "internalType": "uint256",
4562
+ "name": "min",
4563
+ "type": "uint256"
4564
+ },
4565
+ {
4566
+ "internalType": "uint256",
4567
+ "name": "max",
4568
+ "type": "uint256"
4569
+ }
4570
+ ],
4571
+ "internalType": "struct Price.Props",
4572
+ "name": "indexTokenPrice",
4573
+ "type": "tuple"
4574
+ },
4575
+ {
4576
+ "components": [
4577
+ {
4578
+ "internalType": "uint256",
4579
+ "name": "min",
4580
+ "type": "uint256"
4581
+ },
4582
+ {
4583
+ "internalType": "uint256",
4584
+ "name": "max",
4585
+ "type": "uint256"
4586
+ }
4587
+ ],
4588
+ "internalType": "struct Price.Props",
4589
+ "name": "longTokenPrice",
4590
+ "type": "tuple"
4591
+ },
4592
+ {
4593
+ "components": [
4594
+ {
4595
+ "internalType": "uint256",
4596
+ "name": "min",
4597
+ "type": "uint256"
4598
+ },
4599
+ {
4600
+ "internalType": "uint256",
4601
+ "name": "max",
4602
+ "type": "uint256"
4603
+ }
4604
+ ],
4605
+ "internalType": "struct Price.Props",
4606
+ "name": "shortTokenPrice",
4607
+ "type": "tuple"
4608
+ }
4609
+ ],
4610
+ "internalType": "struct MarketUtils.MarketPrices",
4611
+ "name": "prices",
4612
+ "type": "tuple"
4613
+ },
4614
+ {
4615
+ "internalType": "bool",
4616
+ "name": "shouldValidateMinCollateralUsd",
4617
+ "type": "bool"
4618
+ }
4619
+ ],
4620
+ "name": "isPositionLiquidatable",
4621
+ "outputs": [
4622
+ {
4623
+ "internalType": "bool",
4624
+ "name": "",
4625
+ "type": "bool"
4626
+ },
4627
+ {
4628
+ "internalType": "string",
4629
+ "name": "",
4630
+ "type": "string"
4631
+ },
4632
+ {
4633
+ "components": [
4634
+ {
4635
+ "internalType": "int256",
4636
+ "name": "remainingCollateralUsd",
4637
+ "type": "int256"
4638
+ },
4639
+ {
4640
+ "internalType": "int256",
4641
+ "name": "minCollateralUsd",
4642
+ "type": "int256"
4643
+ },
4644
+ {
4645
+ "internalType": "int256",
4646
+ "name": "minCollateralUsdForLeverage",
4647
+ "type": "int256"
4648
+ }
4649
+ ],
4650
+ "internalType": "struct PositionUtils.IsPositionLiquidatableInfo",
4651
+ "name": "",
4652
+ "type": "tuple"
4653
+ }
4654
+ ],
4655
+ "stateMutability": "view",
4656
+ "type": "function"
4657
+ }
4658
+ ],
4659
+ "transactionHash": "0xb058c26493408e1ec30b17ac5872c1c322a9d4243e75d434099d15a9e4ccea76",
4660
+ "receipt": {
4661
+ "to": null,
4662
+ "from": "0xE7BfFf2aB721264887230037940490351700a068",
4663
+ "contractAddress": "0x23D4Da5C7C6902D4C86d551CaE60d5755820df9E",
4664
+ "transactionIndex": 5,
4665
+ "gasUsed": "5375288",
4666
+ "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
4667
+ "blockHash": "0xec6a71487f45632fdf9f6c8e7c2f3efe0c7d4093f90f28a8468bd2b7b23c3395",
4668
+ "transactionHash": "0xb058c26493408e1ec30b17ac5872c1c322a9d4243e75d434099d15a9e4ccea76",
4669
+ "logs": [],
4670
+ "blockNumber": 252698175,
4671
+ "cumulativeGasUsed": "5964774",
4672
+ "status": 1,
4673
+ "byzantium": true
4674
+ },
4675
+ "args": [],
4676
+ "numDeployments": 10,
4677
+ "solcInputHash": "be316035eac2019d87590bce566bb2c5",
4678
+ "libraries": {
4679
+ "DepositStoreUtils": "0x5E4A532E53359b0BeAa21e41ccC9B35042e8051C",
4680
+ "MarketStoreUtils": "0xDEBC0b5DADF3F88d9f00B0d8545B61e67eF3aBEa",
4681
+ "MarketUtils": "0xB6426e70E7efc43aEf14a1D963A4F740c2356467",
4682
+ "PositionStoreUtils": "0x3a4F71855554552f024E936E673eDb6E5C25535C",
4683
+ "PositionUtils": "0xA3D091e23FEc66D843D3Fc8a83F1C8996d32f6a4",
4684
+ "ReaderDepositUtils": "0x6023f1452C85aA2f5C77f6814651d3ED2FD19654",
4685
+ "ReaderPositionUtils": "0xa7Bb93C5361BD6fe66408dCc0a9d98a25a1b2d88",
4686
+ "ReaderPricingUtils": "0x4eA13E6926bF984B4c8853A8fbc9AbC149A0b445",
4687
+ "ReaderUtils": "0x0597FB70fF1b3081c9B27a9eFFD1407DF1B4035f",
4688
+ "ReaderWithdrawalUtils": "0xa0452ae9b77d384b45816A086Bd474104fAD32a4",
4689
+ "ShiftStoreUtils": "0xb30a8d551Bd51fC1493DA195289665cBcDB6EB98",
4690
+ "WithdrawalStoreUtils": "0xB57Cb5eafCd367D0C4D7ecd04d170e48A6145138"
4691
+ },
4692
+ "devdoc": {
4693
+ "kind": "dev",
4694
+ "methods": {},
4695
+ "version": 1
4696
+ },
4697
+ "userdoc": {
4698
+ "kind": "user",
4699
+ "methods": {},
4700
+ "version": 1
4701
+ },
4702
+ "storageLayout": {
4703
+ "storage": [],
4704
+ "types": null
4705
+ }
4706
+ }