@paraswap/dex-lib 5.0.1 → 5.0.2

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 (297) hide show
  1. package/build/abi/BProtocol.json +1155 -0
  2. package/build/abi/Jarvis.json +1172 -0
  3. package/build/abi/MStableAsset.json +1545 -0
  4. package/build/abi/OneInchLp.json +1304 -0
  5. package/build/abi/Onebit.json +736 -0
  6. package/build/abi/Shell.json +1294 -0
  7. package/build/abi/TraderJoeV2Router.json +50 -0
  8. package/build/abi/idle-dao/idle-cdo-factory.json +38 -0
  9. package/build/abi/idle-dao/idle-cdo.json +1245 -0
  10. package/build/abi/infusion/InfusionFactory.json +147 -0
  11. package/build/abi/infusion/InfusionPair.json +658 -0
  12. package/build/abi/infusion/InfusionRouter.json +442 -0
  13. package/build/abi/maker-psm/pot.json +322 -0
  14. package/build/abi/maker-psm/psm.json +243 -0
  15. package/build/abi/maker-psm/vat.json +363 -0
  16. package/build/abi/nomiswap-v2/nomiswap-v2-pool.json +773 -0
  17. package/build/abi/quick-perps/fast-price-events.json +70 -0
  18. package/build/abi/quick-perps/fast-price-feed.json +741 -0
  19. package/build/abi/quick-perps/reader.json +313 -0
  20. package/build/abi/quick-perps/vault-price-feed.json +323 -0
  21. package/build/abi/quick-perps/vault.json +1953 -0
  22. package/build/abi/uniswap-v2/excalibur-pool.json +881 -0
  23. package/build/abi/uniswap-v2/mdex-factory.json +759 -0
  24. package/build/abi/wUSDM.json +757 -0
  25. package/build/abi/zrx.v2.json +1967 -0
  26. package/build/abi/zrx.v3.json +3454 -0
  27. package/build/abi/zrx.v4.json +2193 -0
  28. package/build/config.js +24 -24
  29. package/build/dex/OneInchLp.d.ts +24 -0
  30. package/build/dex/OneInchLp.js +43 -0
  31. package/build/dex/OneInchLp.js.map +1 -0
  32. package/build/dex/bProtocol/bProtocol.d.ts +15 -0
  33. package/build/dex/bProtocol/bProtocol.js +56 -0
  34. package/build/dex/bProtocol/bProtocol.js.map +1 -0
  35. package/build/dex/bProtocol/types.d.ts +11 -0
  36. package/build/dex/bProtocol/types.js +8 -0
  37. package/build/dex/bProtocol/types.js.map +1 -0
  38. package/build/dex/ekubo/pools/base-pool.d.ts +47 -0
  39. package/build/dex/ekubo/pools/base-pool.js +184 -0
  40. package/build/dex/ekubo/pools/base-pool.js.map +1 -0
  41. package/build/dex/ekubo/pools/iface.d.ts +46 -0
  42. package/build/dex/ekubo/pools/iface.js +75 -0
  43. package/build/dex/ekubo/pools/iface.js.map +1 -0
  44. package/build/dex/ekubo/pools/math/price.d.ts +7 -0
  45. package/build/dex/ekubo/pools/math/price.js +112 -0
  46. package/build/dex/ekubo/pools/math/price.js.map +1 -0
  47. package/build/dex/ekubo/pools/oracle-pool.d.ts +10 -0
  48. package/build/dex/ekubo/pools/oracle-pool.js +19 -0
  49. package/build/dex/ekubo/pools/oracle-pool.js.map +1 -0
  50. package/build/dex/ekubo/pools/pool-utils.d.ts +44 -0
  51. package/build/dex/ekubo/pools/pool-utils.js +240 -0
  52. package/build/dex/ekubo/pools/pool-utils.js.map +1 -0
  53. package/build/dex/idle-dao/config.d.ts +5 -0
  54. package/build/dex/idle-dao/config.js +24 -0
  55. package/build/dex/idle-dao/config.js.map +1 -0
  56. package/build/dex/idle-dao/idle-dao.d.ts +42 -0
  57. package/build/dex/idle-dao/idle-dao.js +279 -0
  58. package/build/dex/idle-dao/idle-dao.js.map +1 -0
  59. package/build/dex/idle-dao/token_list.d.ts +4 -0
  60. package/build/dex/idle-dao/token_list.js +289 -0
  61. package/build/dex/idle-dao/token_list.js.map +1 -0
  62. package/build/dex/idle-dao/tokens.d.ts +9 -0
  63. package/build/dex/idle-dao/tokens.js +68 -0
  64. package/build/dex/idle-dao/tokens.js.map +1 -0
  65. package/build/dex/idle-dao/types.d.ts +35 -0
  66. package/build/dex/idle-dao/types.js +11 -0
  67. package/build/dex/idle-dao/types.js.map +1 -0
  68. package/build/dex/idle-dao/utils.d.ts +8 -0
  69. package/build/dex/idle-dao/utils.js +149 -0
  70. package/build/dex/idle-dao/utils.js.map +1 -0
  71. package/build/dex/infusion/config.d.ts +3 -0
  72. package/build/dex/infusion/config.js +20 -0
  73. package/build/dex/infusion/config.js.map +1 -0
  74. package/build/dex/infusion/infusion-stable-pool.d.ts +4 -0
  75. package/build/dex/infusion/infusion-stable-pool.js +74 -0
  76. package/build/dex/infusion/infusion-stable-pool.js.map +1 -0
  77. package/build/dex/infusion/infusion.d.ts +51 -0
  78. package/build/dex/infusion/infusion.js +500 -0
  79. package/build/dex/infusion/infusion.js.map +1 -0
  80. package/build/dex/infusion/types.d.ts +45 -0
  81. package/build/dex/infusion/types.js.map +1 -0
  82. package/build/dex/infusion/utils/isStablePair.d.ts +2 -0
  83. package/build/dex/infusion/utils/isStablePair.js +18 -0
  84. package/build/dex/infusion/utils/isStablePair.js.map +1 -0
  85. package/build/dex/jarvis.d.ts +56 -0
  86. package/build/dex/jarvis.js +163 -0
  87. package/build/dex/jarvis.js.map +1 -0
  88. package/build/dex/mStable.d.ts +44 -0
  89. package/build/dex/mStable.js +75 -0
  90. package/build/dex/mStable.js.map +1 -0
  91. package/build/dex/maker-psm/config.d.ts +11 -0
  92. package/build/dex/maker-psm/config.js +53 -0
  93. package/build/dex/maker-psm/config.js.map +1 -0
  94. package/build/dex/maker-psm/maker-psm.d.ts +103 -0
  95. package/build/dex/maker-psm/maker-psm.js +493 -0
  96. package/build/dex/maker-psm/maker-psm.js.map +1 -0
  97. package/build/dex/maker-psm/types.d.ts +39 -0
  98. package/build/{generic-swap-transaction-builder/dex-encoder/ports.js → dex/maker-psm/types.js} +1 -1
  99. package/build/dex/maker-psm/types.js.map +1 -0
  100. package/build/dex/onebit/onebit.d.ts +16 -0
  101. package/build/dex/onebit/onebit.js +61 -0
  102. package/build/dex/onebit/onebit.js.map +1 -0
  103. package/build/dex/onebit/types.d.ts +14 -0
  104. package/build/dex/onebit/types.js +8 -0
  105. package/build/dex/onebit/types.js.map +1 -0
  106. package/build/dex/quick-perps/config.d.ts +11 -0
  107. package/build/dex/quick-perps/config.js +27 -0
  108. package/build/dex/quick-perps/config.js.map +1 -0
  109. package/build/dex/quick-perps/fast-price-feed.d.ts +26 -0
  110. package/build/dex/quick-perps/fast-price-feed.js +184 -0
  111. package/build/dex/quick-perps/fast-price-feed.js.map +1 -0
  112. package/build/dex/quick-perps/pool.d.ts +21 -0
  113. package/build/dex/quick-perps/pool.js +229 -0
  114. package/build/dex/quick-perps/pool.js.map +1 -0
  115. package/build/dex/quick-perps/quick-perps.d.ts +53 -0
  116. package/build/dex/quick-perps/quick-perps.js +247 -0
  117. package/build/dex/quick-perps/quick-perps.js.map +1 -0
  118. package/build/dex/quick-perps/types.d.ts +98 -0
  119. package/build/{executor/encoding-types.js → dex/quick-perps/types.js} +1 -1
  120. package/build/dex/quick-perps/types.js.map +1 -0
  121. package/build/dex/quick-perps/usdq.d.ts +15 -0
  122. package/build/dex/quick-perps/usdq.js +62 -0
  123. package/build/dex/quick-perps/usdq.js.map +1 -0
  124. package/build/dex/quick-perps/vault-price-feed.d.ts +43 -0
  125. package/build/dex/quick-perps/vault-price-feed.js +203 -0
  126. package/build/dex/quick-perps/vault-price-feed.js.map +1 -0
  127. package/build/dex/quick-perps/vault-utils.d.ts +8 -0
  128. package/build/dex/quick-perps/vault-utils.js +42 -0
  129. package/build/dex/quick-perps/vault-utils.js.map +1 -0
  130. package/build/dex/quick-perps/vault.d.ts +46 -0
  131. package/build/dex/quick-perps/vault.js +182 -0
  132. package/build/dex/quick-perps/vault.js.map +1 -0
  133. package/build/dex/se-vlr/config.d.ts +3 -0
  134. package/build/dex/se-vlr/config.js +24 -0
  135. package/build/dex/se-vlr/config.js.map +1 -0
  136. package/build/dex/se-vlr/se-vlr-pool.d.ts +39 -0
  137. package/build/dex/se-vlr/se-vlr-pool.js +70 -0
  138. package/build/dex/se-vlr/se-vlr-pool.js.map +1 -0
  139. package/build/dex/se-vlr/se-vlr.d.ts +35 -0
  140. package/build/dex/se-vlr/se-vlr.js +131 -0
  141. package/build/dex/se-vlr/se-vlr.js.map +1 -0
  142. package/build/dex/se-vlr/types.d.ts +6 -0
  143. package/build/dex/se-vlr/types.js +3 -0
  144. package/build/dex/se-vlr/types.js.map +1 -0
  145. package/build/dex/shell.d.ts +25 -0
  146. package/build/dex/shell.js +41 -0
  147. package/build/dex/shell.js.map +1 -0
  148. package/build/dex/solidly/forks-override/aerodrome.d.ts +14 -0
  149. package/build/dex/solidly/forks-override/aerodrome.js +46 -0
  150. package/build/dex/solidly/forks-override/aerodrome.js.map +1 -0
  151. package/build/dex/solidly/forks-override/chronos.d.ts +23 -0
  152. package/build/dex/solidly/forks-override/chronos.js +141 -0
  153. package/build/dex/solidly/forks-override/chronos.js.map +1 -0
  154. package/build/dex/solidly/forks-override/usdfi.d.ts +8 -0
  155. package/build/dex/solidly/forks-override/usdfi.js +15 -0
  156. package/build/dex/solidly/forks-override/usdfi.js.map +1 -0
  157. package/build/dex/solidly/forks-override/velocimeter.d.ts +23 -0
  158. package/build/dex/solidly/forks-override/velocimeter.js +77 -0
  159. package/build/dex/solidly/forks-override/velocimeter.js.map +1 -0
  160. package/build/dex/tessera/types.d.ts +3 -0
  161. package/build/dex/tessera/types.js +3 -0
  162. package/build/dex/tessera/types.js.map +1 -0
  163. package/build/dex/trader-joe-v2.d.ts +40 -0
  164. package/build/dex/trader-joe-v2.js +74 -0
  165. package/build/dex/trader-joe-v2.js.map +1 -0
  166. package/build/dex/uniswap-v2/dfyn.d.ts +19 -0
  167. package/build/dex/uniswap-v2/dfyn.js +61 -0
  168. package/build/dex/uniswap-v2/dfyn.js.map +1 -0
  169. package/build/dex/uniswap-v2/excalibur.d.ts +24 -0
  170. package/build/dex/uniswap-v2/excalibur.js +47 -0
  171. package/build/dex/uniswap-v2/excalibur.js.map +1 -0
  172. package/build/dex/uniswap-v2/mdex.d.ts +24 -0
  173. package/build/dex/uniswap-v2/mdex.js +50 -0
  174. package/build/dex/uniswap-v2/mdex.js.map +1 -0
  175. package/build/dex/uniswap-v2/nomiswap-v2.d.ts +24 -0
  176. package/build/dex/uniswap-v2/nomiswap-v2.js +57 -0
  177. package/build/dex/uniswap-v2/nomiswap-v2.js.map +1 -0
  178. package/build/dex/uniswap-v3/scripts/bench-all-dexes.js +160 -0
  179. package/build/dex/uniswap-v3/scripts/bench-all-dexes.js.map +1 -0
  180. package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +94 -0
  181. package/build/dex/uniswap-v3/uniswap-v3-new.js +923 -0
  182. package/build/dex/uniswap-v3/uniswap-v3-new.js.map +1 -0
  183. package/build/dex/uniswap-v4/contract-math/Position.d.ts +3 -0
  184. package/build/dex/uniswap-v4/contract-math/Position.js +10 -0
  185. package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -0
  186. package/build/dex/usual-bond/config.d.ts +3 -0
  187. package/build/dex/usual-bond/config.js +13 -0
  188. package/build/dex/usual-bond/config.js.map +1 -0
  189. package/build/dex/usual-bond/types.d.ts +7 -0
  190. package/build/dex/usual-bond/types.js +3 -0
  191. package/build/dex/usual-bond/types.js.map +1 -0
  192. package/build/dex/usual-bond/usual-bond.d.ts +35 -0
  193. package/build/dex/usual-bond/usual-bond.js +176 -0
  194. package/build/dex/usual-bond/usual-bond.js.map +1 -0
  195. package/build/dex/wusdm/config.d.ts +3 -0
  196. package/build/dex/wusdm/config.js +43 -0
  197. package/build/dex/wusdm/config.js.map +1 -0
  198. package/build/dex/wusdm/constants.d.ts +2 -0
  199. package/build/dex/wusdm/constants.js +6 -0
  200. package/build/dex/wusdm/constants.js.map +1 -0
  201. package/build/dex/wusdm/types.d.ts +18 -0
  202. package/build/dex/wusdm/types.js +11 -0
  203. package/build/dex/wusdm/types.js.map +1 -0
  204. package/build/dex/wusdm/wusdm-pool.d.ts +21 -0
  205. package/build/dex/wusdm/wusdm-pool.js +74 -0
  206. package/build/dex/wusdm/wusdm-pool.js.map +1 -0
  207. package/build/dex/wusdm/wusdm.d.ts +46 -0
  208. package/build/dex/wusdm/wusdm.js +243 -0
  209. package/build/dex/wusdm/wusdm.js.map +1 -0
  210. package/build/dex/zerox/config.d.ts +2 -0
  211. package/build/dex/zerox/config.js +33 -0
  212. package/build/dex/zerox/config.js.map +1 -0
  213. package/build/dex/zerox/index.d.ts +22 -0
  214. package/build/dex/zerox/index.js +225 -0
  215. package/build/dex/zerox/index.js.map +1 -0
  216. package/build/dex/zerox/order.d.ts +88 -0
  217. package/build/dex/zerox/order.js +53 -0
  218. package/build/dex/zerox/order.js.map +1 -0
  219. package/build/dex/zerox/types.d.ts +73 -0
  220. package/build/dex/zerox/types.js +21 -0
  221. package/build/dex/zerox/types.js.map +1 -0
  222. package/build/executor/Executor01BytecodeBuilder.js +4 -4
  223. package/build/executor/Executor01BytecodeBuilder.js.map +1 -1
  224. package/build/executor/Executor02BytecodeBuilder.js +4 -4
  225. package/build/executor/Executor02BytecodeBuilder.js.map +1 -1
  226. package/build/executor/Executor03BytecodeBuilder.d.ts +0 -15
  227. package/build/executor/Executor03BytecodeBuilder.js +1 -61
  228. package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
  229. package/build/executor/ExecutorBytecodeBuilder.d.ts +4 -0
  230. package/build/executor/ExecutorBytecodeBuilder.js +39 -0
  231. package/build/executor/ExecutorBytecodeBuilder.js.map +1 -1
  232. package/package.json +1 -1
  233. package/build/abi/pancakeswap-infinity/cl-pool-manager.json +0 -80
  234. package/build/dex/fluid-dex/scripts/measure-calc-time.js +0 -178
  235. package/build/dex/fluid-dex/scripts/measure-calc-time.js.map +0 -1
  236. package/build/dex/uniswap-v4/api-go/compare-pricing.d.ts +0 -1
  237. package/build/dex/uniswap-v4/api-go/compare-pricing.js +0 -187
  238. package/build/dex/uniswap-v4/api-go/compare-pricing.js.map +0 -1
  239. package/build/dex/uniswap-v4/api-go/compare-states.d.ts +0 -1
  240. package/build/dex/uniswap-v4/api-go/compare-states.js +0 -149
  241. package/build/dex/uniswap-v4/api-go/compare-states.js.map +0 -1
  242. package/build/dex/uniswap-v4/api-go/fetch-pool-key.d.ts +0 -0
  243. package/build/dex/uniswap-v4/api-go/fetch-pool-key.js +0 -140
  244. package/build/dex/uniswap-v4/api-go/fetch-pool-key.js.map +0 -1
  245. package/build/executor/__test-utils__/snapshot-test-helpers.d.ts +0 -10
  246. package/build/executor/__test-utils__/snapshot-test-helpers.js +0 -72
  247. package/build/executor/__test-utils__/snapshot-test-helpers.js.map +0 -1
  248. package/build/executor/address-utils.d.ts +0 -2
  249. package/build/executor/address-utils.js +0 -7
  250. package/build/executor/address-utils.js.map +0 -1
  251. package/build/executor/approval.d.ts +0 -9
  252. package/build/executor/approval.js +0 -29
  253. package/build/executor/approval.js.map +0 -1
  254. package/build/executor/encoding-context.d.ts +0 -4
  255. package/build/executor/encoding-context.js +0 -54
  256. package/build/executor/encoding-context.js.map +0 -1
  257. package/build/executor/encoding-types.d.ts +0 -75
  258. package/build/executor/encoding-types.js.map +0 -1
  259. package/build/executor/factory.d.ts +0 -4
  260. package/build/executor/factory.js +0 -23
  261. package/build/executor/factory.js.map +0 -1
  262. package/build/executor/route-plan.d.ts +0 -8
  263. package/build/executor/route-plan.js +0 -109
  264. package/build/executor/route-plan.js.map +0 -1
  265. package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.d.ts +0 -6
  266. package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.js +0 -39
  267. package/build/generic-swap-transaction-builder/dex-encoder/direct-methods.js.map +0 -1
  268. package/build/generic-swap-transaction-builder/dex-encoder/index.d.ts +0 -4
  269. package/build/generic-swap-transaction-builder/dex-encoder/index.js +0 -21
  270. package/build/generic-swap-transaction-builder/dex-encoder/index.js.map +0 -1
  271. package/build/generic-swap-transaction-builder/dex-encoder/ports.d.ts +0 -26
  272. package/build/generic-swap-transaction-builder/dex-encoder/ports.js.map +0 -1
  273. package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.d.ts +0 -22
  274. package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.js +0 -299
  275. package/build/generic-swap-transaction-builder/dex-encoder/ts-adapter.js.map +0 -1
  276. package/build/generic-swap-transaction-builder/dex-encoder/types.d.ts +0 -207
  277. package/build/generic-swap-transaction-builder/dex-encoder/types.js +0 -194
  278. package/build/generic-swap-transaction-builder/dex-encoder/types.js.map +0 -1
  279. package/build/generic-swap-transaction-builder/orchestration.d.ts +0 -65
  280. package/build/generic-swap-transaction-builder/orchestration.js +0 -198
  281. package/build/generic-swap-transaction-builder/orchestration.js.map +0 -1
  282. package/build/generic-swap-transaction-builder/resolved/build-transaction.d.ts +0 -13
  283. package/build/generic-swap-transaction-builder/resolved/build-transaction.js +0 -343
  284. package/build/generic-swap-transaction-builder/resolved/build-transaction.js.map +0 -1
  285. package/build/generic-swap-transaction-builder/resolved/index.d.ts +0 -4
  286. package/build/generic-swap-transaction-builder/resolved/index.js +0 -21
  287. package/build/generic-swap-transaction-builder/resolved/index.js.map +0 -1
  288. package/build/generic-swap-transaction-builder/resolved/route-plan.d.ts +0 -2
  289. package/build/generic-swap-transaction-builder/resolved/route-plan.js +0 -11
  290. package/build/generic-swap-transaction-builder/resolved/route-plan.js.map +0 -1
  291. package/build/generic-swap-transaction-builder/resolved/types.d.ts +0 -67
  292. package/build/generic-swap-transaction-builder/resolved/types.js.map +0 -1
  293. package/build/generic-swap-transaction-builder/resolved/validation.d.ts +0 -10
  294. package/build/generic-swap-transaction-builder/resolved/validation.js +0 -69
  295. package/build/generic-swap-transaction-builder/resolved/validation.js.map +0 -1
  296. /package/build/{generic-swap-transaction-builder/resolved → dex/infusion}/types.js +0 -0
  297. /package/build/dex/{fluid-dex/scripts/measure-calc-time.d.ts → uniswap-v3/scripts/bench-all-dexes.d.ts} +0 -0
@@ -1,149 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const dotenv_1 = __importDefault(require("dotenv"));
7
- dotenv_1.default.config();
8
- const axios_1 = __importDefault(require("axios"));
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
11
- // eslint-disable-next-line @typescript-eslint/no-var-requires
12
- const { diffString } = require('json-diff');
13
- const constants_1 = require("../../../constants");
14
- const config_1 = require("../config");
15
- const uniswap_v4_pool_1 = require("../uniswap-v4-pool");
16
- const dex_helper_1 = require("../../../dex-helper");
17
- const POOL_ID = '0x54c72c46df32f2cc455e84e41e191b26ed73a29452cdd3d82f511097af9f427e';
18
- const CHAIN_ID = constants_1.Network.MAINNET;
19
- const DEX_KEY = 'UniswapV4';
20
- const API_DEX_KEY = 'uniswapv4'; // cspell:disable-line
21
- const CONFIG = config_1.UniswapV4Config[DEX_KEY][CHAIN_ID];
22
- const POOL_KEY_CACHE_FILE = path_1.default.join(__dirname, 'pool_key_cache.json');
23
- function loadPoolKeyFromCache() {
24
- try {
25
- const raw = fs_1.default.readFileSync(POOL_KEY_CACHE_FILE, 'utf-8');
26
- const cache = JSON.parse(raw);
27
- return cache[CHAIN_ID]?.[POOL_ID] ?? null;
28
- }
29
- catch {
30
- return null;
31
- }
32
- }
33
- async function generatePoolState(poolKey, blockNumber) {
34
- const dexHelper = new dex_helper_1.DummyDexHelper(CHAIN_ID);
35
- const logger = dexHelper.getLogger(DEX_KEY);
36
- const pool = new uniswap_v4_pool_1.UniswapV4Pool(dexHelper, DEX_KEY, CHAIN_ID, CONFIG, logger, '', POOL_ID, poolKey.token0.id.toLowerCase(), poolKey.token1.id.toLowerCase(), poolKey.feeTier, poolKey.hooks, poolKey.tickSpacing);
37
- return pool.generateState(blockNumber);
38
- }
39
- function serializePoolState(state) {
40
- const ticks = {};
41
- for (const [idx, tick] of Object.entries(state.ticks)) {
42
- ticks[idx] = {
43
- liquidityGross: tick.liquidityGross.toString(),
44
- liquidityNet: tick.liquidityNet.toString(),
45
- };
46
- }
47
- const tickBitmap = {};
48
- for (const [idx, val] of Object.entries(state.tickBitmap)) {
49
- tickBitmap[idx] = val.toString();
50
- }
51
- return {
52
- id: state.id,
53
- token0: state.token0,
54
- token1: state.token1,
55
- fee: state.fee,
56
- hooks: state.hooks,
57
- liquidity: state.liquidity.toString(),
58
- slot0: {
59
- sqrtPriceX96: state.slot0.sqrtPriceX96.toString(),
60
- tick: state.slot0.tick.toString(),
61
- protocolFee: state.slot0.protocolFee.toString(),
62
- lpFee: state.slot0.lpFee.toString(),
63
- },
64
- tickSpacing: state.tickSpacing,
65
- ticks,
66
- tickBitmap,
67
- };
68
- }
69
- function adaptApiToSerializedState(api) {
70
- const ticks = {};
71
- for (const [idx, tick] of Object.entries(api.dexData.ticks)) {
72
- ticks[idx] = {
73
- liquidityGross: tick.liquidityGross,
74
- liquidityNet: tick.liquidityNet,
75
- };
76
- }
77
- // Filter tickBitmap: only keep non-zero entries
78
- const tickBitmap = {};
79
- for (const [idx, val] of Object.entries(api.dexData.tickBitmap)) {
80
- if (val !== '0') {
81
- tickBitmap[idx] = val;
82
- }
83
- }
84
- return {
85
- id: api.poolId,
86
- token0: api.tokens[0],
87
- token1: api.tokens[1],
88
- fee: String(api.swapFee),
89
- hooks: api.dexData.hooks,
90
- liquidity: String(api.liquidity),
91
- slot0: {
92
- sqrtPriceX96: String(api.dexData.sqrtPriceX96),
93
- tick: String(api.dexData.tick),
94
- protocolFee: String(api.dexData.protocolFee),
95
- lpFee: String(api.swapFee),
96
- },
97
- tickSpacing: api.dexData.tickSpacing,
98
- ticks,
99
- tickBitmap,
100
- };
101
- }
102
- /* eslint-disable no-console */
103
- async function main() {
104
- const poolKey = loadPoolKeyFromCache();
105
- if (!poolKey) {
106
- console.error('Pool key not found in cache. Run fetch-pool-key.ts first to populate the cache.');
107
- process.exit(1);
108
- }
109
- console.log('Loaded pool key from cache');
110
- const dexHelper = new dex_helper_1.DummyDexHelper(CHAIN_ID);
111
- const latestBlock = await dexHelper.provider.getBlockNumber();
112
- console.log(`Latest block: ${latestBlock}`);
113
- const apiPoolId = `${CHAIN_ID}:${API_DEX_KEY}:${POOL_ID}`;
114
- const apiGenerateUrl = `http://api-go.staging.paraswap.io/api/v1/pool/generate-state?poolId=${apiPoolId}`;
115
- const apiCachedUrl = `http://api-go.staging.paraswap.io/api/v1/pool/state?poolId=${apiPoolId}`;
116
- console.log('\nFetching all states...');
117
- const [apiGenResp, apiCachedResp, rpcState] = await Promise.all([
118
- axios_1.default.get(apiGenerateUrl, { timeout: 30_000 }),
119
- axios_1.default.get(apiCachedUrl, { timeout: 30_000 }),
120
- generatePoolState(poolKey, latestBlock),
121
- ]);
122
- const apiGenData = apiGenResp.data;
123
- const apiCachedData = apiCachedResp.data;
124
- console.log(`Blocks — RPC: ${latestBlock}, API generate: ${apiGenData.blockNumber}, API cached: ${apiCachedData.blockNumber}`);
125
- const serializedRpc = serializePoolState(rpcState);
126
- const serializedApiGen = adaptApiToSerializedState(apiGenData);
127
- const serializedApiCached = adaptApiToSerializedState(apiCachedData);
128
- // RPC vs API generated
129
- console.log('\n=== RPC state vs API generated state ===\n');
130
- const diff1 = diffString(serializedRpc, serializedApiGen, { color: true });
131
- console.log(diff1 || 'States are identical.');
132
- // RPC vs API cached
133
- console.log('\n=== RPC state vs API cached state ===\n');
134
- const diff2 = diffString(serializedRpc, serializedApiCached, { color: true });
135
- console.log(diff2 || 'States are identical.');
136
- // API generated vs API cached
137
- console.log('\n=== API generated vs API cached ===\n');
138
- const diff3 = diffString(serializedApiGen, serializedApiCached, {
139
- color: true,
140
- });
141
- console.log(diff3 || 'States are identical.');
142
- }
143
- /* eslint-enable no-console */
144
- main().catch(err => {
145
- // eslint-disable-next-line no-console
146
- console.error('Error:', err.message);
147
- process.exit(1);
148
- });
149
- //# sourceMappingURL=compare-states.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compare-states.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/api-go/compare-states.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,kDAA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K,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
File without changes
@@ -1,140 +0,0 @@
1
- "use strict";
2
- // import dotenv from 'dotenv';
3
- // dotenv.config();
4
- // import axios from 'axios';
5
- // import fs from 'fs';
6
- // import path from 'path';
7
- // import { UniswapV4Config } from '../config';
8
- // import { Network } from '../../../constants';
9
- // import { UniswapV4Pool } from '../uniswap-v4-pool';
10
- // import { DummyDexHelper } from '../../../dex-helper';
11
- // import { PoolState } from '../types';
12
- // const POOL_ID =
13
- // '0x54c72c46df32f2cc455e84e41e191b26ed73a29452cdd3d82f511097af9f427e';
14
- // const CHAIN_ID = Network.MAINNET;
15
- // const DEX_KEY = 'UniswapV4';
16
- // const CONFIG = UniswapV4Config[DEX_KEY][CHAIN_ID];
17
- // const SUBGRAPH_ID = CONFIG.subgraphURL;
18
- // const POOL_KEY_CACHE_FILE = path.join(__dirname, 'pool_key_cache.json');
19
- // interface PoolKey {
20
- // id: string;
21
- // token0: { id: string };
22
- // token1: { id: string };
23
- // feeTier: string;
24
- // tickSpacing: string;
25
- // hooks: string;
26
- // }
27
- // type PoolKeyCache = Record<string, Record<string, PoolKey>>;
28
- // interface GraphQLResponse {
29
- // data: { pool: PoolKey | null };
30
- // errors?: { message: string }[];
31
- // }
32
- // function loadCache(): PoolKeyCache {
33
- // try {
34
- // const raw = fs.readFileSync(POOL_KEY_CACHE_FILE, 'utf-8');
35
- // return JSON.parse(raw) as PoolKeyCache;
36
- // } catch {
37
- // return {};
38
- // }
39
- // }
40
- // function loadPoolKeyFromCache(): PoolKey | null {
41
- // const cache = loadCache();
42
- // return cache[CHAIN_ID]?.[POOL_ID] ?? null;
43
- // }
44
- // function savePoolKeyToCache(pool: PoolKey): void {
45
- // const cache = loadCache();
46
- // if (!cache[CHAIN_ID]) {
47
- // cache[CHAIN_ID] = {};
48
- // }
49
- // cache[CHAIN_ID][POOL_ID] = pool;
50
- // fs.writeFileSync(POOL_KEY_CACHE_FILE, JSON.stringify(cache, null, 2));
51
- // }
52
- // async function fetchPoolKey(apiKey: string): Promise<PoolKey> {
53
- // const url = `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/${SUBGRAPH_ID}`;
54
- // const query = `{
55
- // pool(id: "${POOL_ID}") {
56
- // id
57
- // token0 {
58
- // id
59
- // }
60
- // token1 {
61
- // id
62
- // }
63
- // feeTier
64
- // tickSpacing
65
- // hooks
66
- // }
67
- // }`;
68
- // const resp = await axios.post<GraphQLResponse>(
69
- // url,
70
- // { query },
71
- // { timeout: 30_000 },
72
- // );
73
- // if (resp.data.errors?.length) {
74
- // throw new Error(`Subgraph error: ${resp.data.errors[0].message}`);
75
- // }
76
- // if (!resp.data.data.pool) {
77
- // throw new Error(`Pool ${POOL_ID} not found`);
78
- // }
79
- // return resp.data.data.pool;
80
- // }
81
- // function bigintReplacer(_key: string, value: unknown): unknown {
82
- // return typeof value === 'bigint' ? value.toString() : value;
83
- // }
84
- // function saveState(state: PoolState, blockNumber: number): void {
85
- // const filename = `${CHAIN_ID}-${POOL_ID}-${blockNumber}.json`;
86
- // const filepath = path.join(__dirname, filename);
87
- // fs.writeFileSync(filepath, JSON.stringify(state, bigintReplacer, 2));
88
- // console.log('State saved to:', filepath);
89
- // }
90
- // async function generatePoolState(
91
- // poolKey: PoolKey,
92
- // blockNumber: number,
93
- // ): Promise<PoolState> {
94
- // const dexHelper = new DummyDexHelper(CHAIN_ID);
95
- // const logger = dexHelper.getLogger(DEX_KEY);
96
- // const pool = new UniswapV4Pool(
97
- // dexHelper,
98
- // DEX_KEY,
99
- // CHAIN_ID,
100
- // CONFIG,
101
- // logger,
102
- // '',
103
- // POOL_ID,
104
- // poolKey.token0.id.toLowerCase(),
105
- // poolKey.token1.id.toLowerCase(),
106
- // poolKey.feeTier,
107
- // poolKey.hooks,
108
- // poolKey.tickSpacing,
109
- // );
110
- // return pool.generateState(blockNumber);
111
- // }
112
- // async function main() {
113
- // const apiKey = 'b2f021e3ecdb7de925add6d3563e753e';
114
- // if (!apiKey) {
115
- // console.error('Error: THEGRAPH_API_KEY environment variable is required');
116
- // process.exit(1);
117
- // }
118
- // // Step 1: Get pool key (from cache or subgraph)
119
- // let poolKey = loadPoolKeyFromCache();
120
- // if (poolKey) {
121
- // console.log('Loaded pool key from cache:', POOL_KEY_CACHE_FILE);
122
- // } else {
123
- // console.log(`Fetching pool key for ${POOL_ID} from subgraph...`);
124
- // poolKey = await fetchPoolKey(apiKey);
125
- // savePoolKeyToCache(poolKey);
126
- // console.log('Pool key cached to:', POOL_KEY_CACHE_FILE);
127
- // }
128
- // console.log(poolKey);
129
- // // Step 2: Get latest block number and generate state
130
- // const dexHelper = new DummyDexHelper(CHAIN_ID);
131
- // const latestBlock = await dexHelper.provider.getBlockNumber();
132
- // console.log(`\nGenerating state at block ${latestBlock}...`);
133
- // const state = await generatePoolState(poolKey, latestBlock);
134
- // saveState(state, latestBlock);
135
- // }
136
- // main().catch(err => {
137
- // console.error('Error:', err.message);
138
- // process.exit(1);
139
- // });
140
- //# sourceMappingURL=fetch-pool-key.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-pool-key.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/api-go/fetch-pool-key.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,mBAAmB;AAEnB,6BAA6B;AAC7B,uBAAuB;AACvB,2BAA2B;AAC3B,+CAA+C;AAC/C,gDAAgD;AAChD,sDAAsD;AACtD,wDAAwD;AACxD,wCAAwC;AAExC,kBAAkB;AAClB,0EAA0E;AAE1E,oCAAoC;AACpC,+BAA+B;AAC/B,qDAAqD;AACrD,0CAA0C;AAE1C,2EAA2E;AAE3E,sBAAsB;AACtB,gBAAgB;AAChB,4BAA4B;AAC5B,4BAA4B;AAC5B,qBAAqB;AACrB,yBAAyB;AACzB,mBAAmB;AACnB,IAAI;AAEJ,+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AAM;AAEN,qDAAqD;AACrD,0CAA0C;AAC1C,mBAAmB;AACnB,uEAAuE;AACvE,aAAa;AACb,wEAAwE;AACxE,4CAA4C;AAC5C,mCAAmC;AACnC,+DAA+D;AAC/D,MAAM;AACN,0BAA0B;AAE1B,0DAA0D;AAC1D,oDAAoD;AACpD,mEAAmE;AACnE,kEAAkE;AAElE,iEAAiE;AACjE,mCAAmC;AACnC,IAAI;AAEJ,wBAAwB;AACxB,0CAA0C;AAC1C,qBAAqB;AACrB,MAAM"}
@@ -1,10 +0,0 @@
1
- import type { IDexHelper } from '../../dex-helper';
2
- import { Network } from '../../constants';
3
- import { Address, DexExchangeBuildParam } from '../../types';
4
- import type { DepositWithdrawReturn } from '../../dex/weth/types';
5
- import type { ExecutorBytecodeBuildInput, ExecutorEncodingContext } from '../encoding-types';
6
- import type { OptimalRate } from '@paraswap/core';
7
- export declare function asDexExchangeBuildParams(exchangeParams: unknown): DexExchangeBuildParam[];
8
- export declare function createExecutorDexHelper(network: Network): IDexHelper;
9
- export declare function createExecutorSnapshotContext(network: Network): ExecutorEncodingContext;
10
- export declare function buildExecutorSnapshotInput(priceRoute: OptimalRate, exchangeParams: DexExchangeBuildParam[], sender: Address, wethPlan?: DepositWithdrawReturn): ExecutorBytecodeBuildInput;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asDexExchangeBuildParams = asDexExchangeBuildParams;
4
- exports.createExecutorDexHelper = createExecutorDexHelper;
5
- exports.createExecutorSnapshotContext = createExecutorSnapshotContext;
6
- exports.buildExecutorSnapshotInput = buildExecutorSnapshotInput;
7
- const config_1 = require("../../config");
8
- const encoding_context_1 = require("../encoding-context");
9
- const route_plan_1 = require("../route-plan");
10
- const SNAPSHOT_TEST_MASTER_CACHE_PREFIX = 'snapshot-tests';
11
- function asDexExchangeBuildParams(exchangeParams) {
12
- if (!Array.isArray(exchangeParams)) {
13
- throw new Error('Expected executor snapshot exchange params to be an array');
14
- }
15
- exchangeParams.forEach((exchangeParam, index) => {
16
- if (typeof exchangeParam.needWrapNative !==
17
- 'boolean') {
18
- throw new Error(`Expected executor snapshot exchange param ${index} to have boolean needWrapNative`);
19
- }
20
- });
21
- return exchangeParams;
22
- }
23
- function createNoOpLogger() {
24
- return {
25
- debug: () => undefined,
26
- info: () => undefined,
27
- warn: () => undefined,
28
- error: () => undefined,
29
- };
30
- }
31
- function createExecutorDexHelper(network) {
32
- // Snapshot tests use generated network config so encoded addresses match the
33
- // executor fixtures they lock.
34
- return {
35
- config: new config_1.ConfigHelper(false, (0, config_1.generateConfig)(network),
36
- // masterCachePrefix is unused by these snapshot tests.
37
- SNAPSHOT_TEST_MASTER_CACHE_PREFIX),
38
- getLogger: () => createNoOpLogger(),
39
- };
40
- }
41
- function createExecutorSnapshotContext(network) {
42
- return (0, encoding_context_1.createExecutorEncodingContextFromDexHelper)(createExecutorDexHelper(network));
43
- }
44
- function buildExecutorSnapshotInput(priceRoute, exchangeParams, sender, wethPlan) {
45
- const routePlan = (0, route_plan_1.buildRoutePlan)(priceRoute);
46
- const routePositions = (0, route_plan_1.walkRoutePlan)(routePlan);
47
- if (exchangeParams.length !== routePositions.length) {
48
- throw new Error('exchange params length must match route positions');
49
- }
50
- return {
51
- routePlan,
52
- resolvedLegs: routePositions.map((routePosition, index) => ({
53
- routeIndex: routePosition.routeIndex,
54
- swapIndex: routePosition.swapIndex,
55
- swapExchangeIndex: routePosition.swapExchangeIndex,
56
- exchangeParam: exchangeParams[index],
57
- // Executor bytecode snapshots only consume route positions and
58
- // exchangeParam; these resolved fields are placeholders.
59
- normalizedSrcToken: routePosition.swap.srcToken,
60
- normalizedDestToken: routePosition.swap.destToken,
61
- normalizedSrcAmount: routePosition.swapExchange.srcAmount,
62
- normalizedDestAmount: routePosition.swapExchange.destAmount,
63
- recipient: sender.toLowerCase(),
64
- })),
65
- sender,
66
- srcToken: priceRoute.srcToken.toLowerCase(),
67
- destToken: priceRoute.destToken.toLowerCase(),
68
- destAmount: priceRoute.destAmount,
69
- wethPlan,
70
- };
71
- }
72
- //# sourceMappingURL=snapshot-test-helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot-test-helpers.js","sourceRoot":"","sources":["../../../src/executor/__test-utils__/snapshot-test-helpers.ts"],"names":[],"mappings":";;AAeA,4DAqBC;AAWD,0DAYC;AAED,sEAMC;AAED,gEAkCC;AAtGD,yCAA4D;AAI5D,0DAAiF;AAKjF,8CAA8D;AAG9D,MAAM,iCAAiC,GAAG,gBAAgB,CAAC;AAE3D,SAAgB,wBAAwB,CACtC,cAAuB;IAEvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,KAAK,EAAE,EAAE;QAC9C,IACE,OAAQ,aAA8C,CAAC,cAAc;YACrE,SAAS,EACT,CAAC;YACD,MAAM,IAAI,KAAK,CACb,6CAA6C,KAAK,iCAAiC,CACpF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,cAAyC,CAAC;AACnD,CAAC;AAED,SAAS,gBAAgB;IACvB,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;QACtB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;KAC2B,CAAC;AACtD,CAAC;AAED,SAAgB,uBAAuB,CAAC,OAAgB;IACtD,6EAA6E;IAC7E,+BAA+B;IAC/B,OAAO;QACL,MAAM,EAAE,IAAI,qBAAY,CACtB,KAAK,EACL,IAAA,uBAAc,EAAC,OAAO,CAAC;QACvB,uDAAuD;QACvD,iCAAiC,CAClC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE;K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 -1,2 +0,0 @@
1
- import type { Address } from '../types';
2
- export declare function isWrappedNativeTokenAddress(address: Address, wrappedNativeTokenAddress: Address): boolean;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isWrappedNativeTokenAddress = isWrappedNativeTokenAddress;
4
- function isWrappedNativeTokenAddress(address, wrappedNativeTokenAddress) {
5
- return address.toLowerCase() === wrappedNativeTokenAddress.toLowerCase();
6
- }
7
- //# sourceMappingURL=address-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"address-utils.js","sourceRoot":"","sources":["../../src/executor/address-utils.ts"],"names":[],"mappings":";;AAEA,kEAKC;AALD,SAAgB,2BAA2B,CACzC,OAAgB,EAChB,yBAAkC;IAElC,OAAO,OAAO,CAAC,WAAW,EAAE,KAAK,yBAAyB,CAAC,WAAW,EAAE,CAAC;AAC3E,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { Address, DexExchangeBuildParam } from '../types';
2
- import type { ExecutorEncodingContext } from './encoding-types';
3
- export type ApprovalTokenAndTarget = {
4
- target: string;
5
- token: Address;
6
- };
7
- export declare function getApprovalTokenAndTarget(swap: {
8
- srcToken: Address;
9
- }, exchangeParam: DexExchangeBuildParam, context: Pick<ExecutorEncodingContext, 'wrappedNativeTokenAddress'>): ApprovalTokenAndTarget | null;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getApprovalTokenAndTarget = getApprovalTokenAndTarget;
4
- const utils_1 = require("../utils");
5
- const address_utils_1 = require("./address-utils");
6
- function getApprovalTokenAndTarget(swap, exchangeParam, context) {
7
- if (exchangeParam.skipApproval)
8
- return null;
9
- const target = exchangeParam.spender || exchangeParam.targetExchange;
10
- if (exchangeParam.needUnwrapNative &&
11
- (0, address_utils_1.isWrappedNativeTokenAddress)(swap.srcToken, context.wrappedNativeTokenAddress)) {
12
- return null;
13
- }
14
- if (!(0, utils_1.isETHAddress)(swap.srcToken) &&
15
- !exchangeParam.transferSrcTokenBeforeSwap) {
16
- return {
17
- token: swap.srcToken,
18
- target,
19
- };
20
- }
21
- if (exchangeParam.needWrapNative && (0, utils_1.isETHAddress)(swap.srcToken)) {
22
- return {
23
- token: exchangeParam.wethAddress || context.wrappedNativeTokenAddress,
24
- target,
25
- };
26
- }
27
- return null;
28
- }
29
- //# sourceMappingURL=approval.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"approval.js","sourceRoot":"","sources":["../../src/executor/approval.ts"],"names":[],"mappings":";;AAUA,8DAqCC;AA7CD,oCAAwC;AACxC,mDAA8D;AAO9D,SAAgB,yBAAyB,CACvC,IAA2B,EAC3B,aAAoC,EACpC,OAAmE;IAEnE,IAAI,aAAa,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAE5C,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC,cAAc,CAAC;IAErE,IACE,aAAa,CAAC,gBAAgB;QAC9B,IAAA,2CAA2B,EACzB,IAAI,CAAC,QAAQ,EACb,OAAO,CAAC,yBAAyB,CAClC,EACD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IACE,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC;QAC5B,CAAC,aAAa,CAAC,0BAA0B,EACzC,CAAC;QACD,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,QAAQ;YACpB,MAAM;SACP,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,CAAC,cAAc,IAAI,IAAA,oBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChE,OAAO;YACL,KAAK,EAAE,aAAa,CAAC,WAAW,IAAI,OAAO,CAAC,yBAAyB;YACrE,MAAM;SACP,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { IDexHelper } from '../dex-helper';
2
- import type { ExecutorEncodingContext, ExecutorEncodingLogger } from './encoding-types';
3
- export declare function createNoopExecutorEncodingLogger(): ExecutorEncodingLogger;
4
- export declare function createExecutorEncodingContextFromDexHelper(dexHelper: IDexHelper): ExecutorEncodingContext;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNoopExecutorEncodingLogger = createNoopExecutorEncodingLogger;
4
- exports.createExecutorEncodingContextFromDexHelper = createExecutorEncodingContextFromDexHelper;
5
- const types_1 = require("./types");
6
- function createNoopExecutorEncodingLogger() {
7
- return {
8
- debug: () => undefined,
9
- info: () => undefined,
10
- warn: () => undefined,
11
- error: () => undefined,
12
- };
13
- }
14
- function createExecutorEncodingContextFromDexHelper(dexHelper) {
15
- const logger = dexHelper.getLogger('ExecutorBytecodeBuilder');
16
- const wrappedNativeTokenAddress = normalizeRequiredAddress(dexHelper.config.data.wrappedNativeTokenAddress, 'wrappedNativeTokenAddress');
17
- assertConfiguredWethExecutorAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.WETH], wrappedNativeTokenAddress);
18
- const augustusV6Address = normalizeRequiredAddress(dexHelper.config.data.augustusV6Address, 'augustusV6Address');
19
- return {
20
- network: dexHelper.config.data.network,
21
- augustusV6Address,
22
- wrappedNativeTokenAddress,
23
- executorsAddresses: {
24
- [types_1.Executors.ONE]: normalizeRequiredAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.ONE], `executorsAddresses.${types_1.Executors.ONE}`),
25
- [types_1.Executors.TWO]: normalizeRequiredAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.TWO], `executorsAddresses.${types_1.Executors.TWO}`),
26
- [types_1.Executors.THREE]: normalizeRequiredAddress(dexHelper.config.data.executorsAddresses?.[types_1.Executors.THREE], `executorsAddresses.${types_1.Executors.THREE}`),
27
- [types_1.Executors.WETH]: wrappedNativeTokenAddress,
28
- },
29
- // Keep method bindings: some logger implementations depend on `this`.
30
- logger: {
31
- debug: logger.debug.bind(logger),
32
- info: logger.info.bind(logger),
33
- warn: logger.warn.bind(logger),
34
- error: logger.error.bind(logger),
35
- },
36
- };
37
- }
38
- function normalizeRequiredAddress(address, fieldName) {
39
- if (!address) {
40
- throw new Error(`${fieldName} is required`);
41
- }
42
- return normalizeAddress(address);
43
- }
44
- function assertConfiguredWethExecutorAddress(configuredWethExecutorAddress, wrappedNativeTokenAddress) {
45
- if (configuredWethExecutorAddress &&
46
- normalizeAddress(configuredWethExecutorAddress) !==
47
- normalizeAddress(wrappedNativeTokenAddress)) {
48
- throw new Error(`executorsAddresses.${types_1.Executors.WETH} must match wrappedNativeTokenAddress`);
49
- }
50
- }
51
- function normalizeAddress(address) {
52
- return address.toLowerCase();
53
- }
54
- //# sourceMappingURL=encoding-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoding-context.js","sourceRoot":"","sources":["../../src/executor/encoding-context.ts"],"names":[],"mappings":";;AAQA,4EAOC;AAED,gGA4CC;AAvDD,mCAAoC;AAEpC,SAAgB,gCAAgC;IAC9C,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;QACtB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;KACvB,CAAC;AACJ,CAAC;AAED,SAAgB,0CAA0C,CACxD,SAAqB;IAErB,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,wBAAwB,CACxD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAC/C,2BAA2B,CAC5B,CAAC;IACF,mCAAmC,CACjC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,iBAAS,CAAC,IAAI,CAAC,EAC1D,yBAAyB,CAC1B,CAAC;IACF,MAAM,iBAAiB,GAAG,wBAAwB,CAChD,SAAS,CAAC,MAAM,CAAC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,cAAc,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,mCAAmC,CAC1C,6BAAkD,EAClD,yBAAkC;IAElC,IACE,6BAA6B;QAC7B,gBAAgB,CAAC,6BAA6B,CAAC;YAC7C,gBAAgB,CAAC,yBAAyB,CAAC,EAC7C,CAAC;QACD,MAAM,IAAI,KAAK,CACb,sBAAsB,iBAAS,CAAC,IAAI,uCAAuC,CAC5E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgB;IACxC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC"}
@@ -1,75 +0,0 @@
1
- import type { DepositWithdrawReturn } from '../dex/weth/types';
2
- import type { Address, DexExchangeBuildParam } from '../types';
3
- import type { Executors } from './types';
4
- export type ExecutorEncodingLogger = {
5
- debug: (message: unknown, ...args: unknown[]) => void;
6
- info: (message: unknown, ...args: unknown[]) => void;
7
- warn: (message: unknown, ...args: unknown[]) => void;
8
- error: (message: unknown, ...args: unknown[]) => void;
9
- };
10
- export type ExecutorEncodingContext = {
11
- network: number;
12
- augustusV6Address: Address;
13
- wrappedNativeTokenAddress: Address;
14
- executorsAddresses: Record<Executors, Address>;
15
- logger: ExecutorEncodingLogger;
16
- };
17
- export type RoutePlan = {
18
- routes: RoutePlanRoute[];
19
- };
20
- export type RoutePlanRoute = {
21
- percent: number;
22
- swaps: RoutePlanSwap[];
23
- };
24
- export type RoutePlanSwap = {
25
- srcToken: Address;
26
- destToken: Address;
27
- srcAmount: string;
28
- destAmount: string;
29
- swapExchanges: RoutePlanSwapExchange[];
30
- };
31
- export type RoutePlanSwapExchange = {
32
- exchange: string;
33
- percent: number;
34
- srcAmount: string;
35
- destAmount: string;
36
- };
37
- export type ExecutorRoute = {
38
- srcToken: Address;
39
- destToken: Address;
40
- destAmount: string;
41
- bestRoute: RoutePlanRoute[];
42
- };
43
- export type ExecutorRouteRoute = RoutePlanRoute;
44
- export type ExecutorRouteSwap = RoutePlanSwap;
45
- export type ExecutorRouteSwapExchange = RoutePlanSwapExchange;
46
- export type RoutePosition = {
47
- routeIndex: number;
48
- swapIndex: number;
49
- swapExchangeIndex: number;
50
- };
51
- export type ResolvedLeg = RoutePosition & {
52
- exchangeParam: DexExchangeBuildParam;
53
- normalizedSrcToken: Address;
54
- normalizedDestToken: Address;
55
- normalizedSrcAmount: string;
56
- normalizedDestAmount: string;
57
- recipient: Address;
58
- };
59
- export type RoutePlanExchange = RoutePosition & {
60
- route: RoutePlanRoute;
61
- swap: RoutePlanSwap;
62
- swapExchange: RoutePlanSwapExchange;
63
- };
64
- export type OrderedExecutorLeg = RoutePlanExchange & {
65
- resolvedLeg: ResolvedLeg;
66
- };
67
- export type ExecutorBytecodeBuildInput = {
68
- routePlan: RoutePlan;
69
- resolvedLegs: ResolvedLeg[];
70
- sender: Address;
71
- srcToken: Address;
72
- destToken: Address;
73
- destAmount: string;
74
- wethPlan?: DepositWithdrawReturn;
75
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoding-types.js","sourceRoot":"","sources":["../../src/executor/encoding-types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import { ExecutorBytecodeBuilder } from './ExecutorBytecodeBuilder';
2
- import type { ExecutorEncodingContext } from './encoding-types';
3
- import { Executors } from './types';
4
- export declare function createExecutorBytecodeBuilder(executorType: Executors, context: ExecutorEncodingContext): ExecutorBytecodeBuilder;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createExecutorBytecodeBuilder = createExecutorBytecodeBuilder;
4
- const Executor01BytecodeBuilder_1 = require("./Executor01BytecodeBuilder");
5
- const Executor02BytecodeBuilder_1 = require("./Executor02BytecodeBuilder");
6
- const Executor03BytecodeBuilder_1 = require("./Executor03BytecodeBuilder");
7
- const WETHBytecodeBuilder_1 = require("./WETHBytecodeBuilder");
8
- const types_1 = require("./types");
9
- function createExecutorBytecodeBuilder(executorType, context) {
10
- switch (executorType) {
11
- case types_1.Executors.ONE:
12
- return new Executor01BytecodeBuilder_1.Executor01BytecodeBuilder(context);
13
- case types_1.Executors.TWO:
14
- return new Executor02BytecodeBuilder_1.Executor02BytecodeBuilder(context);
15
- case types_1.Executors.THREE:
16
- return new Executor03BytecodeBuilder_1.Executor03BytecodeBuilder(context);
17
- case types_1.Executors.WETH:
18
- return new WETHBytecodeBuilder_1.WETHBytecodeBuilder(context);
19
- default:
20
- throw new Error(`${executorType} is not supported`);
21
- }
22
- }
23
- //# sourceMappingURL=factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/executor/factory.ts"],"names":[],"mappings":";;AAQA,sEAgBC;AAxBD,2EAAwE;AACxE,2EAAwE;AACxE,2EAAwE;AACxE,+DAA4D;AAG5D,mCAAoC;AAEpC,SAAgB,6BAA6B,CAC3C,YAAuB,EACvB,OAAgC;IAEhC,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,iBAAS,CAAC,GAAG;YAChB,OAAO,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;QAChD,KAAK,iBAAS,CAAC,GAAG;YAChB,OAAO,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;QAChD,KAAK,iBAAS,CAAC,KAAK;YAClB,OAAO,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;QAChD,KAAK,iBAAS,CAAC,IAAI;YACjB,OAAO,IAAI,yCAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C;YACE,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,mBAAmB,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}