@paraswap/dex-lib 4.1.23 → 4.1.24-uni-v4.0

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 (340) hide show
  1. package/build/abi/integral/factory.json +333 -0
  2. package/build/abi/{angle-transmuter/ChainlinkEACAggregatorProxy.json → integral/oracle.json} +239 -247
  3. package/build/abi/{curve-v1/StableSwapUSDN.json → integral/pool.json} +487 -450
  4. package/build/abi/{RamsesV2Pool.abi.json → integral/relayer.json} +833 -851
  5. package/build/abi/uniswap-v4/pool-manager.abi.json +1367 -0
  6. package/build/abi/uniswap-v4/quoter.abi.json +461 -0
  7. package/build/abi/uniswap-v4/router.abi.json +230 -0
  8. package/build/abi/uniswap-v4/state-view.abi.json +365 -0
  9. package/build/dex/aave-v1/aave-v1.d.ts +1 -2
  10. package/build/dex/aave-v1/aave-v1.js +0 -22
  11. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  12. package/build/dex/bProtocol.d.ts +18 -0
  13. package/build/dex/bProtocol.js +39 -0
  14. package/build/dex/bProtocol.js.map +1 -0
  15. package/build/dex/bancor.d.ts +26 -0
  16. package/build/dex/bancor.js +58 -0
  17. package/build/dex/bancor.js.map +1 -0
  18. package/build/dex/compound.d.ts +18 -0
  19. package/build/dex/compound.js +46 -0
  20. package/build/dex/compound.js.map +1 -0
  21. package/build/dex/curve-v2.d.ts +58 -0
  22. package/build/dex/curve-v2.js +180 -0
  23. package/build/dex/curve-v2.js.map +1 -0
  24. package/build/dex/dodo-v1.d.ts +33 -0
  25. package/build/dex/dodo-v1.js +63 -0
  26. package/build/dex/dodo-v1.js.map +1 -0
  27. package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +49 -0
  28. package/build/dex/fluid-dex/fluid-dex-generate-pool.js +104 -0
  29. package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +1 -0
  30. package/build/dex/index.js +2 -0
  31. package/build/dex/index.js.map +1 -1
  32. package/build/dex/integral/config.d.ts +4 -0
  33. package/build/dex/integral/config.js +20 -0
  34. package/build/dex/integral/config.js.map +1 -0
  35. package/build/dex/integral/context.d.ts +40 -0
  36. package/build/dex/integral/context.js +158 -0
  37. package/build/dex/integral/context.js.map +1 -0
  38. package/build/dex/integral/integral-factory.d.ts +24 -0
  39. package/build/dex/integral/integral-factory.js +95 -0
  40. package/build/dex/integral/integral-factory.js.map +1 -0
  41. package/build/dex/integral/integral-pool.d.ts +50 -0
  42. package/build/dex/integral/integral-pool.js +149 -0
  43. package/build/dex/integral/integral-pool.js.map +1 -0
  44. package/build/dex/integral/integral-pricing.d.ts +18 -0
  45. package/build/dex/integral/integral-pricing.js +114 -0
  46. package/build/dex/integral/integral-pricing.js.map +1 -0
  47. package/build/dex/integral/integral-relayer.d.ts +42 -0
  48. package/build/dex/integral/integral-relayer.js +192 -0
  49. package/build/dex/integral/integral-relayer.js.map +1 -0
  50. package/build/dex/integral/integral-token.d.ts +27 -0
  51. package/build/dex/integral/integral-token.js +59 -0
  52. package/build/dex/integral/integral-token.js.map +1 -0
  53. package/build/dex/{inception/inception-native.d.ts → integral/integral.d.ts} +19 -21
  54. package/build/dex/integral/integral.js +376 -0
  55. package/build/dex/integral/integral.js.map +1 -0
  56. package/build/dex/integral/types.d.ts +85 -0
  57. package/build/dex/integral/types.js +9 -0
  58. package/build/dex/integral/types.js.map +1 -0
  59. package/build/dex/integral/utils-e2e.d.ts +9 -0
  60. package/build/dex/integral/utils-e2e.js +131 -0
  61. package/build/dex/integral/utils-e2e.js.map +1 -0
  62. package/build/dex/integral/utils.d.ts +17 -0
  63. package/build/dex/integral/utils.js +94 -0
  64. package/build/dex/integral/utils.js.map +1 -0
  65. package/build/dex/jarvis.d.ts +1 -2
  66. package/build/dex/jarvis.js +0 -58
  67. package/build/dex/jarvis.js.map +1 -1
  68. package/build/dex/lido.d.ts +19 -0
  69. package/build/dex/lido.js +42 -0
  70. package/build/dex/lido.js.map +1 -0
  71. package/build/dex/m-token/config.d.ts +3 -0
  72. package/build/dex/m-token/config.js +19 -0
  73. package/build/dex/m-token/config.js.map +1 -0
  74. package/build/dex/m-token/m-token.d.ts +29 -0
  75. package/build/dex/m-token/m-token.js +145 -0
  76. package/build/dex/m-token/m-token.js.map +1 -0
  77. package/build/dex/m-token/m-wrapped-m.d.ts +17 -0
  78. package/build/dex/m-token/m-wrapped-m.js +50 -0
  79. package/build/dex/m-token/m-wrapped-m.js.map +1 -0
  80. package/build/dex/m-token/types.d.ts +12 -0
  81. package/build/dex/{inception → m-token}/types.js.map +1 -1
  82. package/build/dex/onebit.d.ts +25 -0
  83. package/build/dex/onebit.js +42 -0
  84. package/build/dex/onebit.js.map +1 -0
  85. package/build/dex/platypus/platypus.d.ts +1 -2
  86. package/build/dex/platypus/platypus.js +0 -31
  87. package/build/dex/platypus/platypus.js.map +1 -1
  88. package/build/dex/smoothy.d.ts +26 -0
  89. package/build/dex/smoothy.js +48 -0
  90. package/build/dex/smoothy.js.map +1 -0
  91. package/build/dex/spark/susds-psm.d.ts +49 -0
  92. package/build/dex/spark/susds-psm.js +245 -0
  93. package/build/dex/spark/susds-psm.js.map +1 -0
  94. package/build/dex/stable-pool.d.ts +28 -0
  95. package/build/dex/stable-pool.js +62 -0
  96. package/build/dex/stable-pool.js.map +1 -0
  97. package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
  98. package/build/dex/swaap-v1/swaap-v1.js +0 -10
  99. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  100. package/build/dex/trader-joe-v2.1/optimizer.d.ts +2 -0
  101. package/build/dex/trader-joe-v2.1/optimizer.js +47 -0
  102. package/build/dex/trader-joe-v2.1/optimizer.js.map +1 -0
  103. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
  104. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
  105. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
  106. package/build/dex/trader-joe-v2.1.d.ts +43 -0
  107. package/build/dex/trader-joe-v2.1.js +79 -0
  108. package/build/dex/trader-joe-v2.1.js.map +1 -0
  109. package/build/dex/uniswap-v4/config.d.ts +3 -0
  110. package/build/dex/uniswap-v4/config.js +58 -0
  111. package/build/dex/uniswap-v4/config.js.map +1 -0
  112. package/build/dex/uniswap-v4/constants.d.ts +9 -0
  113. package/build/dex/uniswap-v4/constants.js +18 -0
  114. package/build/dex/uniswap-v4/constants.js.map +1 -0
  115. package/build/dex/uniswap-v4/contract-math/BalanceDelta.d.ts +6 -0
  116. package/build/dex/uniswap-v4/contract-math/BalanceDelta.js +22 -0
  117. package/build/dex/uniswap-v4/contract-math/BalanceDelta.js.map +1 -0
  118. package/build/dex/uniswap-v4/contract-math/BitMath.d.ts +4 -0
  119. package/build/dex/uniswap-v4/contract-math/BitMath.js +53 -0
  120. package/build/dex/uniswap-v4/contract-math/BitMath.js.map +1 -0
  121. package/build/dex/uniswap-v4/contract-math/FixedPoint128.d.ts +3 -0
  122. package/build/dex/uniswap-v4/contract-math/FixedPoint128.js +8 -0
  123. package/build/dex/uniswap-v4/contract-math/FixedPoint128.js.map +1 -0
  124. package/build/dex/uniswap-v4/contract-math/FixedPoint96.d.ts +4 -0
  125. package/build/dex/uniswap-v4/contract-math/FixedPoint96.js +9 -0
  126. package/build/dex/uniswap-v4/contract-math/FixedPoint96.js.map +1 -0
  127. package/build/dex/uniswap-v4/contract-math/FullMath.d.ts +4 -0
  128. package/build/dex/uniswap-v4/contract-math/FullMath.js +20 -0
  129. package/build/dex/uniswap-v4/contract-math/FullMath.js.map +1 -0
  130. package/build/dex/uniswap-v4/contract-math/LPFeeLibrary.d.ts +13 -0
  131. package/build/dex/uniswap-v4/contract-math/LPFeeLibrary.js +35 -0
  132. package/build/dex/uniswap-v4/contract-math/LPFeeLibrary.js.map +1 -0
  133. package/build/dex/uniswap-v4/contract-math/LiquidityMath.d.ts +3 -0
  134. package/build/dex/uniswap-v4/contract-math/LiquidityMath.js +16 -0
  135. package/build/dex/uniswap-v4/contract-math/LiquidityMath.js.map +1 -0
  136. package/build/dex/uniswap-v4/contract-math/Position.d.ts +9 -0
  137. package/build/dex/uniswap-v4/contract-math/Position.js +39 -0
  138. package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -0
  139. package/build/dex/uniswap-v4/contract-math/ProtocolFeeLibrary.d.ts +10 -0
  140. package/build/dex/uniswap-v4/contract-math/ProtocolFeeLibrary.js +28 -0
  141. package/build/dex/uniswap-v4/contract-math/ProtocolFeeLibrary.js.map +1 -0
  142. package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.d.ts +8 -0
  143. package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js +67 -0
  144. package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js.map +1 -0
  145. package/build/dex/uniswap-v4/contract-math/SwapMath.d.ts +10 -0
  146. package/build/dex/uniswap-v4/contract-math/SwapMath.js +63 -0
  147. package/build/dex/uniswap-v4/contract-math/SwapMath.js.map +1 -0
  148. package/build/dex/uniswap-v4/contract-math/Tick.d.ts +10 -0
  149. package/build/dex/uniswap-v4/contract-math/Tick.js +64 -0
  150. package/build/dex/uniswap-v4/contract-math/Tick.js.map +1 -0
  151. package/build/dex/uniswap-v4/contract-math/TickBitMap.d.ts +9 -0
  152. package/build/dex/uniswap-v4/contract-math/TickBitMap.js +64 -0
  153. package/build/dex/uniswap-v4/contract-math/TickBitMap.js.map +1 -0
  154. package/build/dex/uniswap-v4/contract-math/TickMath.d.ts +9 -0
  155. package/build/dex/uniswap-v4/contract-math/TickMath.js +83 -0
  156. package/build/dex/uniswap-v4/contract-math/TickMath.js.map +1 -0
  157. package/build/dex/uniswap-v4/contract-math/UnsafeMath.d.ts +4 -0
  158. package/build/dex/uniswap-v4/contract-math/UnsafeMath.js +17 -0
  159. package/build/dex/uniswap-v4/contract-math/UnsafeMath.js.map +1 -0
  160. package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.d.ts +8 -0
  161. package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js +11 -0
  162. package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js.map +1 -0
  163. package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.d.ts +29 -0
  164. package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js +419 -0
  165. package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js.map +1 -0
  166. package/build/dex/uniswap-v4/contract-math/utils.d.ts +3 -0
  167. package/build/dex/uniswap-v4/contract-math/utils.js +15 -0
  168. package/build/dex/uniswap-v4/contract-math/utils.js.map +1 -0
  169. package/build/dex/uniswap-v4/encoder.d.ts +17 -0
  170. package/build/dex/uniswap-v4/encoder.js +160 -0
  171. package/build/dex/uniswap-v4/encoder.js.map +1 -0
  172. package/build/dex/uniswap-v4/subgraph.d.ts +7 -0
  173. package/build/dex/uniswap-v4/subgraph.js +122 -0
  174. package/build/dex/uniswap-v4/subgraph.js.map +1 -0
  175. package/build/dex/uniswap-v4/types.d.ts +92 -0
  176. package/build/dex/uniswap-v4/types.js +3 -0
  177. package/build/dex/uniswap-v4/types.js.map +1 -0
  178. package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +31 -0
  179. package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +135 -0
  180. package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +1 -0
  181. package/build/dex/uniswap-v4/uniswap-v4-pool.d.ts +40 -0
  182. package/build/dex/uniswap-v4/uniswap-v4-pool.js +343 -0
  183. package/build/dex/uniswap-v4/uniswap-v4-pool.js.map +1 -0
  184. package/build/dex/uniswap-v4/uniswap-v4.d.ts +41 -0
  185. package/build/dex/uniswap-v4/uniswap-v4.js +205 -0
  186. package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -0
  187. package/build/dex/uniswap-v4/utils.d.ts +2 -0
  188. package/build/dex/uniswap-v4/utils.js +15 -0
  189. package/build/dex/uniswap-v4/utils.js.map +1 -0
  190. package/build/dex/zerox/index.d.ts +26 -4
  191. package/build/dex/zerox/index.js +42 -50
  192. package/build/dex/zerox/index.js.map +1 -1
  193. package/build/dex/zerox/types.d.ts +0 -29
  194. package/build/dex/zerox/types.js +1 -8
  195. package/build/dex/zerox/types.js.map +1 -1
  196. package/package.json +1 -1
  197. package/build/abi/Aave_GSM.json +0 -751
  198. package/build/abi/Balancer.json +0 -257
  199. package/build/abi/BalancerV2.json +0 -1179
  200. package/build/abi/RamsesV2Quoter.abi.json +0 -274
  201. package/build/abi/USDM.json +0 -807
  202. package/build/abi/UniswapV2Router.json +0 -397
  203. package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +0 -1246
  204. package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
  205. package/build/abi/curve-v1/CurveTokenV1.json +0 -305
  206. package/build/abi/curve-v1/CurveTokenV2.json +0 -318
  207. package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
  208. package/build/abi/curve-v1/CurveV2Swap.json +0 -700
  209. package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
  210. package/build/abi/curve-v1/FactoryRegistry.json +0 -508
  211. package/build/abi/curve-v1/StableSwapAave.json +0 -1152
  212. package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
  213. package/build/abi/curve-v1/StableSwapCompound.json +0 -814
  214. package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
  215. package/build/abi/curve-v1/StableSwapPax.json +0 -865
  216. package/build/abi/curve-v1/StableSwapSnow.json +0 -900
  217. package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
  218. package/build/abi/curve-v1/StableSwapY.json +0 -814
  219. package/build/abi/inception/inception-ineth-pool.json +0 -1062
  220. package/build/abi/inception/inception-ineth.json +0 -609
  221. package/build/abi/inception/inception-ratio-feed.json +0 -329
  222. package/build/abi/inception/inception-vault.json +0 -991
  223. package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
  224. package/build/abi/kyberdmm.abi.json +0 -1148
  225. package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
  226. package/build/abi/nerve/nerve-metapool.json +0 -790
  227. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  228. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
  229. package/build/dex/balancer-v1/balancer-pools.json +0 -33333
  230. package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
  231. package/build/dex/bebop/websocket-fetcher.js +0 -87
  232. package/build/dex/bebop/websocket-fetcher.js.map +0 -1
  233. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  234. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  235. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  236. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  237. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  238. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  239. package/build/dex/idle-dao/scripts.d.ts +0 -9
  240. package/build/dex/idle-dao/scripts.js +0 -552
  241. package/build/dex/idle-dao/scripts.js.map +0 -1
  242. package/build/dex/inception/config.d.ts +0 -4
  243. package/build/dex/inception/config.js +0 -109
  244. package/build/dex/inception/config.js.map +0 -1
  245. package/build/dex/inception/inception-event-pool.d.ts +0 -16
  246. package/build/dex/inception/inception-event-pool.js +0 -51
  247. package/build/dex/inception/inception-event-pool.js.map +0 -1
  248. package/build/dex/inception/inception-native.js +0 -131
  249. package/build/dex/inception/inception-native.js.map +0 -1
  250. package/build/dex/inception/inception-pool.d.ts +0 -18
  251. package/build/dex/inception/inception-pool.js +0 -32
  252. package/build/dex/inception/inception-pool.js.map +0 -1
  253. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  254. package/build/dex/inception/inception-price-feed.js +0 -51
  255. package/build/dex/inception/inception-price-feed.js.map +0 -1
  256. package/build/dex/inception/inception.d.ts +0 -43
  257. package/build/dex/inception/inception.js +0 -204
  258. package/build/dex/inception/inception.js.map +0 -1
  259. package/build/dex/inception/tokens.d.ts +0 -9
  260. package/build/dex/inception/tokens.js +0 -28
  261. package/build/dex/inception/tokens.js.map +0 -1
  262. package/build/dex/inception/types.d.ts +0 -22
  263. package/build/dex/inception/utils.d.ts +0 -6
  264. package/build/dex/inception/utils.js +0 -37
  265. package/build/dex/inception/utils.js.map +0 -1
  266. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
  267. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
  268. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
  269. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
  270. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
  271. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
  272. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
  273. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
  274. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
  275. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
  276. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
  277. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
  278. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
  279. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
  280. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
  281. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
  282. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
  283. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
  284. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
  285. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
  286. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
  287. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
  288. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
  289. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
  290. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
  291. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
  292. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
  293. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
  294. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
  295. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
  296. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
  297. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
  298. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
  299. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
  300. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
  301. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
  302. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
  303. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
  304. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
  305. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
  306. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
  307. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
  308. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
  309. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
  310. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
  311. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
  312. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
  313. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
  314. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
  315. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
  316. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
  317. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
  318. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
  319. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
  320. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
  321. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
  322. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
  323. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
  324. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
  325. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
  326. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
  327. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
  328. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
  329. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
  330. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
  331. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
  332. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
  333. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
  334. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
  335. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
  336. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
  337. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
  338. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
  339. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
  340. /package/build/dex/{inception → m-token}/types.js +0 -0
@@ -0,0 +1,343 @@
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
+ exports.UniswapV4Pool = void 0;
7
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
8
+ const utils_1 = require("ethers/lib/utils");
9
+ const state_view_abi_json_1 = __importDefault(require("../../abi/uniswap-v4/state-view.abi.json"));
10
+ const pool_manager_abi_json_1 = __importDefault(require("../../abi/uniswap-v4/pool-manager.abi.json"));
11
+ const lodash_1 = __importDefault(require("lodash"));
12
+ const utils_2 = require("../../utils");
13
+ const uniswap_v4_pool_math_1 = require("./contract-math/uniswap-v4-pool-math");
14
+ const Position_1 = require("./contract-math/Position");
15
+ const constants_1 = require("./constants");
16
+ const TickBitmap_1 = require("./contract-math/TickBitmap");
17
+ const decoders_1 = require("../../lib/decoders");
18
+ const LPFeeLibrary_1 = require("./contract-math/LPFeeLibrary");
19
+ const subgraph_1 = require("./subgraph");
20
+ class UniswapV4Pool extends stateful_event_subscriber_1.StatefulEventSubscriber {
21
+ dexHelper;
22
+ network;
23
+ config;
24
+ logger;
25
+ poolId;
26
+ token0;
27
+ token1;
28
+ fee;
29
+ hooks;
30
+ sqrtPriceX96;
31
+ tick;
32
+ tickSpacing;
33
+ handlers = {};
34
+ logDecoder;
35
+ stateViewIface;
36
+ poolManagerIface;
37
+ constructor(dexHelper, parentName, network, config, logger, mapKey = '', poolId, token0, token1, fee, hooks, sqrtPriceX96, tick, tickSpacing) {
38
+ super(parentName, `${parentName} Pool`, dexHelper, logger, true, mapKey);
39
+ this.dexHelper = dexHelper;
40
+ this.network = network;
41
+ this.config = config;
42
+ this.logger = logger;
43
+ this.poolId = poolId;
44
+ this.token0 = token0;
45
+ this.token1 = token1;
46
+ this.fee = fee;
47
+ this.hooks = hooks;
48
+ this.sqrtPriceX96 = sqrtPriceX96;
49
+ this.tick = tick;
50
+ this.tickSpacing = tickSpacing;
51
+ this.stateViewIface = new utils_1.Interface(state_view_abi_json_1.default);
52
+ this.poolManagerIface = new utils_1.Interface(pool_manager_abi_json_1.default);
53
+ this.addressesSubscribed = [this.config.poolManager];
54
+ this.logDecoder = (log) => this.poolManagerIface.parseLog(log);
55
+ // Add handlers
56
+ this.handlers['Swap'] = this.handleSwapEvent.bind(this);
57
+ this.handlers['Donate'] = this.handleDonateEvent.bind(this);
58
+ this.handlers['ProtocolFeeUpdated'] =
59
+ this.handleProtocolFeeUpdatedEvent.bind(this);
60
+ this.handlers['ModifyLiquidity'] =
61
+ this.handleModifyLiquidityEvent.bind(this);
62
+ }
63
+ async initialize(blockNumber, options) {
64
+ super.initialize(blockNumber, options);
65
+ // await super.initialize(blockNumber, {
66
+ // state: {
67
+ // id: this.poolId,
68
+ // token0: this.token0.toLowerCase(),
69
+ // token1: this.token1.toLowerCase(),
70
+ // fee: this.fee,
71
+ // hooks: this.hooks,
72
+ // tickSpacing: parseInt(this.tickSpacing),
73
+ // ticks: {},
74
+ // tickBitmap: {},
75
+ // positions: {},
76
+ // feeGrowthGlobal0X128: 0n,
77
+ // feeGrowthGlobal1X128: 0n,
78
+ // slot0: {
79
+ // sqrtPriceX96: this.sqrtPriceX96,
80
+ // tick: parseInt(this.tick),
81
+ // protocolFee: 0,
82
+ // lpFee: LPFeeLibrary.getInitialLPFee(parseInt(this.fee)),
83
+ // },
84
+ // } as PoolState,
85
+ // });
86
+ }
87
+ _getPositionInfoCallData(poolId, owner, tickLower, tickUpper, salt) {
88
+ const callData = {
89
+ target: this.config.stateView,
90
+ callData: this.stateViewIface.encodeFunctionData('getPositionInfo(bytes32, address, int24, int24, bytes32)', [poolId, owner, tickLower, tickUpper, salt]),
91
+ decodeFunction: (result) => {
92
+ const [, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
93
+ const decoded = this.stateViewIface.decodeFunctionResult('getPositionInfo(bytes32, address, int24, int24, bytes32)', toDecode);
94
+ return {
95
+ liquidity: BigInt(decoded[0]),
96
+ feeGrowthInside0LastX128: BigInt(decoded[1]),
97
+ feeGrowthInside1LastX128: BigInt(decoded[2]),
98
+ };
99
+ },
100
+ };
101
+ return callData;
102
+ }
103
+ _getStateRequestCallDataPerPool(poolId, tick, tickSpacing, ticks) {
104
+ let callData = [
105
+ {
106
+ target: this.config.stateView,
107
+ callData: this.stateViewIface.encodeFunctionData('getLiquidity', [
108
+ poolId,
109
+ ]),
110
+ decodeFunction: decoders_1.uint256ToBigInt,
111
+ },
112
+ {
113
+ target: this.config.stateView,
114
+ callData: this.stateViewIface.encodeFunctionData('getSlot0', [poolId]),
115
+ decodeFunction: (result) => {
116
+ const [, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
117
+ const decoded = this.stateViewIface.decodeFunctionResult('getSlot0', toDecode);
118
+ return {
119
+ sqrtPriceX96: BigInt(decoded[0]),
120
+ tick: BigInt(decoded[1]),
121
+ protocolFee: BigInt(decoded[2]),
122
+ lpFee: BigInt(decoded[3]),
123
+ };
124
+ },
125
+ },
126
+ {
127
+ target: this.config.stateView,
128
+ callData: this.stateViewIface.encodeFunctionData('getFeeGrowthGlobals', [poolId]),
129
+ decodeFunction: (result) => {
130
+ const [, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
131
+ const decoded = this.stateViewIface.decodeFunctionResult('getFeeGrowthGlobals', toDecode);
132
+ return {
133
+ feeGrowthGlobal0: BigInt(decoded[0]),
134
+ feeGrowthGlobal1: BigInt(decoded[1]),
135
+ };
136
+ },
137
+ },
138
+ ];
139
+ // get ticks calldata
140
+ ticks.map(tick => {
141
+ callData.push({
142
+ target: this.config.stateView,
143
+ callData: this.stateViewIface.encodeFunctionData('getTickInfo', [
144
+ poolId,
145
+ tick.tickIdx,
146
+ ]),
147
+ decodeFunction: (result) => {
148
+ const [, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
149
+ const decoded = this.stateViewIface.decodeFunctionResult('getTickInfo', toDecode);
150
+ return {
151
+ liquidityGross: BigInt(decoded[0]),
152
+ liquidityNet: BigInt(decoded[1]),
153
+ feeGrowthOutside0X128: BigInt(decoded[2]),
154
+ feeGrowthOutside1X128: BigInt(decoded[3]),
155
+ };
156
+ },
157
+ });
158
+ });
159
+ const [leftBitMapIndex, rightBitMapIndex] = this.getBitmapRangeToRequest(tick, tickSpacing);
160
+ // get tick bitmap calldata
161
+ for (let i = leftBitMapIndex; i <= rightBitMapIndex; i++) {
162
+ callData.push({
163
+ target: this.config.stateView,
164
+ callData: this.stateViewIface.encodeFunctionData('getTickBitmap', [
165
+ poolId,
166
+ i,
167
+ ]),
168
+ decodeFunction: (result) => {
169
+ const [, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
170
+ const decoded = this.stateViewIface.decodeFunctionResult('getTickBitmap', toDecode);
171
+ return [i, BigInt(decoded[0])];
172
+ },
173
+ });
174
+ }
175
+ ticks.map(tick => {
176
+ const compressed = TickBitmap_1.TickBitmap.compress(BigInt(tick.tickIdx), BigInt(tickSpacing));
177
+ const [wordPos] = TickBitmap_1.TickBitmap.position(compressed);
178
+ callData.push({
179
+ target: this.config.stateView,
180
+ callData: this.stateViewIface.encodeFunctionData('getTickBitmap', [
181
+ poolId,
182
+ wordPos,
183
+ ]),
184
+ decodeFunction: (result) => {
185
+ const [, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
186
+ const decoded = this.stateViewIface.decodeFunctionResult('getTickBitmap', toDecode);
187
+ return [wordPos, BigInt(decoded[0])];
188
+ },
189
+ });
190
+ });
191
+ return callData;
192
+ }
193
+ async getOrGenerateState(blockNumber) {
194
+ let state = this.getState(blockNumber);
195
+ if (!state) {
196
+ state = await this.generateState(blockNumber);
197
+ this.setState(state, blockNumber);
198
+ }
199
+ return state;
200
+ }
201
+ async generateState(blockNumber) {
202
+ const ticks = await (0, subgraph_1.queryTicksForPool)(this.dexHelper, this.logger, this.parentName, this.config.subgraphURL, blockNumber, this.poolId);
203
+ const callData = this._getStateRequestCallDataPerPool(this.poolId, this.tick, this.tickSpacing, ticks);
204
+ const results = await this.dexHelper.multiWrapper.tryAggregate(false, callData, blockNumber, this.dexHelper.multiWrapper.defaultBatchSize, false);
205
+ const liquidityResult = results[0].returnData;
206
+ const slot0Result = results[1].returnData;
207
+ const feeGrowthGlobalsResult = results[2].returnData;
208
+ let tickCounter = 0;
209
+ const ticksResults = ticks.reduce((memo, tick) => {
210
+ const curResults = results[3 + tickCounter];
211
+ memo[tick.tickIdx] = {
212
+ liquidityNet: curResults.returnData.liquidityNet,
213
+ liquidityGross: curResults.returnData.liquidityGross,
214
+ feeGrowthOutside0X128: curResults.returnData.feeGrowthOutside0X128,
215
+ feeGrowthOutside1X128: curResults.returnData.feeGrowthOutside1X128,
216
+ };
217
+ tickCounter++;
218
+ return memo;
219
+ }, {});
220
+ const tickBitMapMinIndex = 3 + tickCounter;
221
+ const [leftBitMapIndex, rightBitMapIndex] = this.getBitmapRangeToRequest(this.tick, this.tickSpacing);
222
+ let tickBitMapCounter = 0;
223
+ const tickBitMapResults = {};
224
+ for (let i = leftBitMapIndex; i <= Number(rightBitMapIndex) + ticks.length; i++) {
225
+ const curResults = results[tickBitMapMinIndex + tickBitMapCounter];
226
+ const [wordPos, tickBitMap] = curResults.returnData;
227
+ tickBitMapResults[wordPos.toString()] = tickBitMap;
228
+ tickBitMapCounter++;
229
+ }
230
+ return {
231
+ id: this.poolId,
232
+ token0: this.token0.toLowerCase(),
233
+ token1: this.token1.toLowerCase(),
234
+ fee: this.fee,
235
+ hooks: this.hooks,
236
+ feeGrowthGlobal0X128: feeGrowthGlobalsResult.feeGrowthGlobal0,
237
+ feeGrowthGlobal1X128: feeGrowthGlobalsResult.feeGrowthGlobal1,
238
+ liquidity: liquidityResult,
239
+ slot0: {
240
+ ...slot0Result,
241
+ tick: slot0Result.tick === 0n ? BigInt(this.tick) : slot0Result.tick,
242
+ lpFee: slot0Result.lpFee === 0n
243
+ ? LPFeeLibrary_1.LPFeeLibrary.getInitialLPFee(BigInt(this.fee))
244
+ : slot0Result.lpFee,
245
+ sqrtPriceX96: slot0Result.sqrtPriceX96 === 0n
246
+ ? this.sqrtPriceX96
247
+ : slot0Result.sqrtPriceX96,
248
+ },
249
+ tickSpacing: parseInt(this.tickSpacing),
250
+ ticks: ticksResults,
251
+ tickBitmap: tickBitMapResults,
252
+ positions: {},
253
+ };
254
+ }
255
+ getBitmapRangeToRequest(tick, tickSpacing) {
256
+ const networkId = this.dexHelper.config.data.network;
257
+ const tickBitMapToUse = constants_1.TICK_BITMAP_TO_USE_BY_CHAIN[networkId] ?? constants_1.TICK_BITMAP_TO_USE;
258
+ const tickBitMapBuffer = constants_1.TICK_BITMAP_BUFFER_BY_CHAIN[networkId] ?? constants_1.TICK_BITMAP_BUFFER;
259
+ const range = tickBitMapToUse + tickBitMapBuffer;
260
+ const compressedTick = TickBitmap_1.TickBitmap.compress(BigInt(tick), BigInt(tickSpacing));
261
+ const [currentBitMapIndex] = TickBitmap_1.TickBitmap.position(compressedTick);
262
+ const leftBitMapIndex = currentBitMapIndex - range;
263
+ const rightBitMapIndex = currentBitMapIndex + range;
264
+ return [leftBitMapIndex, rightBitMapIndex];
265
+ }
266
+ async processLog(state, log, blockHeader) {
267
+ try {
268
+ const event = this.logDecoder(log);
269
+ if (event.name in this.handlers) {
270
+ const _state = lodash_1.default.cloneDeep(state);
271
+ const id = event.args.id.toLowerCase();
272
+ if (id && id !== this.poolId.toLowerCase())
273
+ return null; // skip not relevant events
274
+ try {
275
+ const newState = await this.handlers[event.name](event, _state, log, blockHeader);
276
+ return newState;
277
+ }
278
+ catch (e) {
279
+ this.logger.error(`${this.parentName}: PoolManagr ${this.config.poolManager} (pool id ${this.poolId}), ` +
280
+ `network=${this.dexHelper.config.data.network}: Unexpected ` +
281
+ `error while handling event on blockNumber=${blockHeader.number}, ` +
282
+ `blockHash=${blockHeader.hash} and parentHash=${blockHeader.parentHash} for ${this.parentName}, ${JSON.stringify(event)}`, e);
283
+ }
284
+ }
285
+ }
286
+ catch (e) {
287
+ (0, utils_2.catchParseLogError)(e, this.logger);
288
+ }
289
+ return null;
290
+ }
291
+ handleProtocolFeeUpdatedEvent(event, poolState) {
292
+ const protocolFee = event.args.protocolFee;
293
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
294
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.setProtocolFee(poolState, protocolFee);
295
+ return poolState;
296
+ }
297
+ handleDonateEvent(event, poolState) {
298
+ const amount0 = BigInt(event.args.amount0);
299
+ const amount1 = BigInt(event.args.amount1);
300
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
301
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.donate(poolState, amount0, amount1);
302
+ return poolState;
303
+ }
304
+ handleSwapEvent(event, poolState) {
305
+ const amount0 = BigInt(event.args.amount0);
306
+ const amount1 = BigInt(event.args.amount1);
307
+ const resultSqrtPriceX96 = BigInt(event.args.sqrtPriceX96);
308
+ const resultLiquidity = BigInt(event.args.liquidity);
309
+ const resultTick = BigInt(event.args.tick);
310
+ const resultSwapFee = BigInt(event.args.fee);
311
+ const zeroForOne = amount0 < 0n;
312
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
313
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.swapFromEvent(poolState, zeroForOne, resultSqrtPriceX96, resultTick, resultLiquidity, resultSwapFee, amount0, amount1);
314
+ return poolState;
315
+ }
316
+ async handleModifyLiquidityEvent(event, poolState, log) {
317
+ const id = event.args.id.toLowerCase();
318
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
319
+ const owner = event.args.sender.toLowerCase();
320
+ const tickLower = BigInt(event.args.tickLower);
321
+ const tickUpper = BigInt(event.args.tickUpper);
322
+ const liquidityDelta = BigInt(event.args.liquidityDelta);
323
+ const salt = event.args.salt.toLowerCase();
324
+ const positionsInfoCallData = this._getPositionInfoCallData(id, owner, parseInt(event.args.tickLower), parseInt(event.args.tickUpper), salt);
325
+ const results = await this.dexHelper.multiWrapper.tryAggregate(false, [positionsInfoCallData], log.blockNumber, this.dexHelper.multiWrapper.defaultBatchSize, false);
326
+ if (!poolState.positions) {
327
+ poolState.positions = {};
328
+ }
329
+ poolState.positions[Position_1.Position.calculatePositionKey(owner, tickLower, tickUpper, salt)] = results[0].returnData;
330
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.modifyLiquidity(poolState, {
331
+ liquidityDelta,
332
+ tickUpper,
333
+ tickLower,
334
+ tickSpacing: BigInt(poolState.tickSpacing),
335
+ salt,
336
+ owner,
337
+ });
338
+ delete poolState.positions[Position_1.Position.calculatePositionKey(owner, tickLower, tickUpper, salt)];
339
+ return poolState;
340
+ }
341
+ }
342
+ exports.UniswapV4Pool = UniswapV4Pool;
343
+ //# sourceMappingURL=uniswap-v4-pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniswap-v4-pool.js","sourceRoot":"","sources":["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SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CACjE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,UAA2B,CAAC;QAE3C,wCAAiB,CAAC,eAAe,CAAC,SAAS,EAAE;YAC3C,cAAc;YACd,SAAS;YACT,SAAS;YACT,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;YAC1C,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC,SAAS,CACxB,mBAAQ,CAAC,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CACjE,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAhhBD,sCAghBC"}
@@ -0,0 +1,41 @@
1
+ import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, NumberAsString, PoolLiquidity, PoolPrices, Token } from '../../types';
2
+ import { Logger } from 'log4js';
3
+ import { Network } from '../../constants';
4
+ import { IDexHelper } from '../../dex-helper';
5
+ import { IDex } from '../idex';
6
+ import { SimpleExchange } from '../simple-exchange';
7
+ import { Pool, UniswapV4Data } from './types';
8
+ import { Interface } from '@ethersproject/abi';
9
+ import { DeepReadonly } from 'ts-essentials';
10
+ import { PoolState } from '../uniswap-v4/types';
11
+ import { SwapSide } from '@paraswap/core';
12
+ export declare class UniswapV4 extends SimpleExchange implements IDex<UniswapV4Data> {
13
+ protected network: Network;
14
+ protected dexHelper: IDexHelper;
15
+ protected routerAddress: string;
16
+ protected quoterAddress: string;
17
+ protected poolManagerAddress: string;
18
+ readonly hasConstantPriceLargeAmounts = false;
19
+ needWrapNative: boolean;
20
+ logger: Logger;
21
+ protected quoterIface: Interface;
22
+ private poolManager;
23
+ static dexKeysWithNetwork: {
24
+ key: string;
25
+ networks: Network[];
26
+ }[];
27
+ constructor(network: Network, dexKey: string, dexHelper: IDexHelper, routerAddress?: string, quoterAddress?: string, poolManagerAddress?: string);
28
+ initializePricing(blockNumber: number): Promise<void>;
29
+ getPoolIdentifiers(from: Token, to: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
30
+ protected _getOutputs(pool: Pool, state: DeepReadonly<PoolState>, amounts: bigint[], zeroForOne: boolean, side: SwapSide): bigint[] | null;
31
+ getPricesVolume(from: Token, to: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<ExchangePrices<UniswapV4Data> | null>;
32
+ getCalldataGasCost(poolPrices: PoolPrices<UniswapV4Data>): number | number[];
33
+ getAdapters(side: SwapSide): {
34
+ name: string;
35
+ index: number;
36
+ }[] | null;
37
+ getTopPoolsForToken(tokenAddress: Address, count: number): Promise<PoolLiquidity[]>;
38
+ queryPriceFromRpc(zeroForOne: boolean, amounts: bigint[], pool: Pool, side: SwapSide, blockNumber: number): Promise<bigint[]>;
39
+ getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UniswapV4Data, side: SwapSide): DexExchangeParam;
40
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UniswapV4Data, side: SwapSide): AdapterExchangeParam;
41
+ }
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.UniswapV4 = void 0;
40
+ const constants_1 = require("../../constants");
41
+ const utils_1 = require("../../utils");
42
+ const simple_exchange_1 = require("../simple-exchange");
43
+ const config_1 = require("./config");
44
+ const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
45
+ const quoter_abi_json_1 = __importDefault(require("../../abi/uniswap-v4/quoter.abi.json"));
46
+ const bigint_constants_1 = require("../../bigint-constants");
47
+ const abi_1 = require("@ethersproject/abi");
48
+ const decoders_1 = require("../../lib/decoders");
49
+ const encoder_1 = require("./encoder");
50
+ const uniswap_v4_pool_manager_1 = require("./uniswap-v4-pool-manager");
51
+ const uniswap_v4_pool_math_1 = require("./contract-math/uniswap-v4-pool-math");
52
+ const core_1 = require("@paraswap/core");
53
+ class UniswapV4 extends simple_exchange_1.SimpleExchange {
54
+ network;
55
+ dexHelper;
56
+ routerAddress;
57
+ quoterAddress;
58
+ poolManagerAddress;
59
+ hasConstantPriceLargeAmounts = false;
60
+ needWrapNative = false;
61
+ logger;
62
+ quoterIface;
63
+ poolManager;
64
+ static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.UniswapV4Config);
65
+ constructor(network, dexKey, dexHelper, routerAddress = config_1.UniswapV4Config[dexKey][network].router, quoterAddress = config_1.UniswapV4Config[dexKey][network].quoter, poolManagerAddress = config_1.UniswapV4Config[dexKey][network].poolManager) {
66
+ super(dexHelper, dexKey);
67
+ this.network = network;
68
+ this.dexHelper = dexHelper;
69
+ this.routerAddress = routerAddress;
70
+ this.quoterAddress = quoterAddress;
71
+ this.poolManagerAddress = poolManagerAddress;
72
+ this.logger = dexHelper.getLogger(dexKey);
73
+ this.quoterIface = new abi_1.Interface(quoter_abi_json_1.default);
74
+ this.poolManager = new uniswap_v4_pool_manager_1.UniswapV4PoolManager(dexHelper, dexKey, network, config_1.UniswapV4Config[dexKey][network], this.logger);
75
+ }
76
+ async initializePricing(blockNumber) {
77
+ await this.poolManager.initialize(blockNumber);
78
+ }
79
+ async getPoolIdentifiers(from, to, side, blockNumber) {
80
+ const pools = await this.poolManager.getAvailablePoolsForPair(from.address.toLowerCase(), to.address.toLowerCase(), blockNumber);
81
+ return pools.map(pool => pool.id);
82
+ }
83
+ _getOutputs(pool, state, amounts, zeroForOne, side) {
84
+ try {
85
+ const outputsResult = uniswap_v4_pool_math_1.uniswapV4PoolMath.queryOutputs(pool, state, amounts, zeroForOne, side);
86
+ return outputsResult;
87
+ }
88
+ catch (e) {
89
+ this.logger.debug(`${this.dexKey}: received error in _getOutputs while calculating outputs`, e);
90
+ return null;
91
+ }
92
+ }
93
+ async getPricesVolume(from, to, amounts, side, blockNumber, limitPools) {
94
+ const pools = await this.poolManager.getAvailablePoolsForPair(from.address.toLowerCase(), to.address.toLowerCase(), blockNumber);
95
+ let availablePools = limitPools?.filter(t => pools.find(p => p.id === t)) ??
96
+ pools.map(t => t.id);
97
+ // availablePools = availablePools.filter(
98
+ // poolId =>
99
+ // poolId.toLowerCase() ===
100
+ // '0xe87077fd043c1a6afa5256104acb1d1eb5ca5bc031ee57f9d96c8172ead4bef8'.toLowerCase(),
101
+ // );
102
+ const pricesPromises = availablePools.map(async (poolId) => {
103
+ const pool = pools.find(p => p.id === poolId);
104
+ const zeroForOne = from.address.toLowerCase() === pool.key.currency0.toLowerCase() ||
105
+ ((0, utils_1.isETHAddress)(from.address) && pool.key.currency0 === constants_1.NULL_ADDRESS);
106
+ // const prices = await this.queryPriceFromRpc(
107
+ // zeroForOne,
108
+ // amounts,
109
+ // pool,
110
+ // side,
111
+ // blockNumber,
112
+ // );
113
+ const eventPool = this.poolManager.eventPools[poolId];
114
+ const poolState = await eventPool.getOrGenerateState(blockNumber);
115
+ const prices = this._getOutputs(pool, poolState, amounts, zeroForOne, side);
116
+ if (prices === null) {
117
+ return null;
118
+ }
119
+ if (prices?.every(price => price === 0n || price === 1n)) {
120
+ return null;
121
+ }
122
+ return {
123
+ unit: bigint_constants_1.BI_POWS[to.decimals],
124
+ prices,
125
+ data: {
126
+ exchange: this.dexKey,
127
+ pool: {
128
+ id: pool.id,
129
+ key: pool.key,
130
+ },
131
+ zeroForOne,
132
+ },
133
+ poolAddresses: [this.poolManagerAddress],
134
+ exchange: this.dexKey,
135
+ gasCost: 100_000,
136
+ poolIdentifier: poolId,
137
+ };
138
+ });
139
+ const prices = await Promise.all(pricesPromises);
140
+ return prices.filter(res => res !== null);
141
+ }
142
+ // Returns estimated gas cost of calldata for this DEX in multiSwap
143
+ getCalldataGasCost(poolPrices) {
144
+ return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
145
+ }
146
+ getAdapters(side) {
147
+ return null;
148
+ }
149
+ async getTopPoolsForToken(tokenAddress, count) {
150
+ const _tokenAddress = tokenAddress.toLowerCase();
151
+ return [];
152
+ }
153
+ async queryPriceFromRpc(zeroForOne, amounts, pool, side, blockNumber) {
154
+ const funcName = side === core_1.SwapSide.SELL
155
+ ? 'quoteExactInputSingle'
156
+ : 'quoteExactOutputSingle';
157
+ const calls = amounts.map(amount => ({
158
+ target: this.quoterAddress,
159
+ callData: this.quoterIface.encodeFunctionData(funcName, [
160
+ {
161
+ poolKey: pool.key,
162
+ zeroForOne,
163
+ exactAmount: amount.toString(),
164
+ hookData: '0x',
165
+ },
166
+ ]),
167
+ decodeFunction: (result) => {
168
+ // amountOut, gasEstimate
169
+ return (0, decoders_1.generalDecoder)(result, ['uint256', 'uint256'], 0n, value => BigInt(value[0].toString()));
170
+ },
171
+ }));
172
+ const results = await this.dexHelper.multiWrapper.tryAggregate(false, calls, blockNumber);
173
+ return results.map(result => (result.success ? result.returnData : 0n));
174
+ }
175
+ getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
176
+ let exchangeData;
177
+ if (side === core_1.SwapSide.SELL) {
178
+ exchangeData = (0, encoder_1.swapExactInputSingleCalldata)(srcToken, destToken, data.pool.key, data.zeroForOne, BigInt(srcAmount),
179
+ // destMinAmount (can be 0 on dex level)
180
+ BigInt(0), recipient);
181
+ }
182
+ else {
183
+ exchangeData = (0, encoder_1.swapExactOutputSingleCalldata)(srcToken, destToken, data.pool.key, data.zeroForOne, BigInt(destAmount), BigInt(srcAmount), recipient);
184
+ }
185
+ return {
186
+ needWrapNative: this.needWrapNative,
187
+ dexFuncHasRecipient: true,
188
+ exchangeData,
189
+ targetExchange: this.routerAddress,
190
+ permit2Approval: true,
191
+ returnAmountPos: undefined,
192
+ };
193
+ }
194
+ getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
195
+ const { exchange } = data;
196
+ const payload = '';
197
+ return {
198
+ targetExchange: exchange,
199
+ payload,
200
+ networkFee: '0',
201
+ };
202
+ }
203
+ }
204
+ exports.UniswapV4 = UniswapV4;
205
+ //# sourceMappingURL=uniswap-v4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniswap-v4.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/uniswap-v4.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,+CAAwD;AAExD,uCAAkE;AAElE,wDAAoD;AACpD,qCAA2C;AAG3C,2EAA6D;AAC7D,2FAA6D;AAC7D,6DAAiD;AACjD,4CAA+C;AAC/C,iDAAoD;AAEpD,uCAGmB;AACnB,uEAAiE;AAGjE,+EAAyE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,CAAC;QAED,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,mBAAmB,EAAE,IAAI;YACzB,YAAY;YACZ,cAAc,EAAE,IAAI,CAAC,aAAa;YAClC,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,SAAS;SAC3B,CAAC;IACJ,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAE1B,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,OAAO;YACL,cAAc,EAAE,QAAQ;YACxB,OAAO;YACP,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;;AAjRH,8BAkRC"}
@@ -0,0 +1,2 @@
1
+ import { PoolState } from './types';
2
+ export declare function sortPools(a: PoolState, b: PoolState): 1 | 0 | -1;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortPools = sortPools;
4
+ function sortPools(a, b) {
5
+ const idA = a.id.toUpperCase();
6
+ const idB = b.id.toUpperCase();
7
+ if (idA < idB) {
8
+ return -1;
9
+ }
10
+ if (idA > idB) {
11
+ return 1;
12
+ }
13
+ return 0;
14
+ }
15
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/utils.ts"],"names":[],"mappings":";;AAEA,8BAUC;AAVD,SAAgB,SAAS,CAAC,CAAY,EAAE,CAAY;IAClD,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/B,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}