@paraswap/dex-lib 4.0.24 → 4.0.25

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 (251) hide show
  1. package/build/abi/Aave_GSM.json +751 -0
  2. package/build/abi/Balancer.json +257 -0
  3. package/build/abi/BalancerV2.json +1179 -0
  4. package/build/abi/{integral/relayer.json → RamsesV2Pool.abi.json} +850 -832
  5. package/build/abi/RamsesV2Quoter.abi.json +274 -0
  6. package/build/abi/USDM.json +807 -0
  7. package/build/abi/UniswapV2Router.json +397 -0
  8. package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +1246 -0
  9. package/build/abi/{integral/oracle.json → angle-transmuter/ChainlinkEACAggregatorProxy.json} +247 -239
  10. package/build/abi/curve-v1/CurveBUSDv2.abi.json +1356 -0
  11. package/build/abi/curve-v1/CurveTokenV1.json +305 -0
  12. package/build/abi/curve-v1/CurveTokenV2.json +318 -0
  13. package/build/abi/curve-v1/CurveV1StableNg.json +1452 -0
  14. package/build/abi/curve-v1/CurveV2Swap.json +700 -0
  15. package/build/abi/curve-v1/FactoryCryptoRegistry.json +316 -0
  16. package/build/abi/curve-v1/FactoryRegistry.json +508 -0
  17. package/build/abi/curve-v1/StableSwapAave.json +1152 -0
  18. package/build/abi/curve-v1/StableSwapBUSD.json +814 -0
  19. package/build/abi/curve-v1/StableSwapCompound.json +814 -0
  20. package/build/abi/curve-v1/StableSwapIDLE.json +1253 -0
  21. package/build/abi/curve-v1/StableSwapPax.json +865 -0
  22. package/build/abi/curve-v1/StableSwapSnow.json +900 -0
  23. package/build/abi/{integral/pool.json → curve-v1/StableSwapUSDN.json} +450 -487
  24. package/build/abi/curve-v1/StableSwapUSDT.json +814 -0
  25. package/build/abi/curve-v1/StableSwapY.json +814 -0
  26. package/build/abi/inception/inception-ineth-pool.json +1062 -0
  27. package/build/abi/inception/inception-ineth.json +609 -0
  28. package/build/abi/inception/inception-ratio-feed.json +329 -0
  29. package/build/abi/inception/inception-vault.json +991 -0
  30. package/build/abi/kyberdmm/kyber-storage.abi.json +824 -0
  31. package/build/abi/kyberdmm.abi.json +1148 -0
  32. package/build/abi/maverick-v2/MaverickV2Quoter.json +278 -0
  33. package/build/abi/nerve/nerve-metapool.json +790 -0
  34. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
  35. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +267 -0
  36. package/build/dex/aave-v1/aave-v1.d.ts +2 -1
  37. package/build/dex/aave-v1/aave-v1.js +22 -0
  38. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  39. package/build/dex/algebra/config.js +1 -1
  40. package/build/dex/algebra/config.js.map +1 -1
  41. package/build/dex/balancer-v1/balancer-pools.json +33333 -0
  42. package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
  43. package/build/dex/bebop/websocket-fetcher.js +87 -0
  44. package/build/dex/bebop/websocket-fetcher.js.map +1 -0
  45. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  46. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  47. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  48. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  49. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  50. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  51. package/build/dex/idle-dao/scripts.d.ts +9 -0
  52. package/build/dex/idle-dao/scripts.js +552 -0
  53. package/build/dex/idle-dao/scripts.js.map +1 -0
  54. package/build/dex/inception/config.d.ts +4 -0
  55. package/build/dex/inception/config.js +109 -0
  56. package/build/dex/inception/config.js.map +1 -0
  57. package/build/dex/inception/inception-event-pool.d.ts +16 -0
  58. package/build/dex/inception/inception-event-pool.js +51 -0
  59. package/build/dex/inception/inception-event-pool.js.map +1 -0
  60. package/build/dex/{integral/integral.d.ts → inception/inception-native.d.ts} +21 -19
  61. package/build/dex/inception/inception-native.js +131 -0
  62. package/build/dex/inception/inception-native.js.map +1 -0
  63. package/build/dex/inception/inception-pool.d.ts +18 -0
  64. package/build/dex/inception/inception-pool.js +32 -0
  65. package/build/dex/inception/inception-pool.js.map +1 -0
  66. package/build/dex/inception/inception-price-feed.d.ts +19 -0
  67. package/build/dex/inception/inception-price-feed.js +51 -0
  68. package/build/dex/inception/inception-price-feed.js.map +1 -0
  69. package/build/dex/inception/inception.d.ts +43 -0
  70. package/build/dex/inception/inception.js +204 -0
  71. package/build/dex/inception/inception.js.map +1 -0
  72. package/build/dex/inception/tokens.d.ts +9 -0
  73. package/build/dex/inception/tokens.js +28 -0
  74. package/build/dex/inception/tokens.js.map +1 -0
  75. package/build/dex/inception/types.d.ts +22 -0
  76. package/build/dex/inception/types.js +3 -0
  77. package/build/dex/inception/types.js.map +1 -0
  78. package/build/dex/inception/utils.d.ts +6 -0
  79. package/build/dex/inception/utils.js +37 -0
  80. package/build/dex/inception/utils.js.map +1 -0
  81. package/build/dex/jarvis.d.ts +2 -1
  82. package/build/dex/jarvis.js +58 -0
  83. package/build/dex/jarvis.js.map +1 -1
  84. package/build/dex/platypus/platypus.d.ts +2 -1
  85. package/build/dex/platypus/platypus.js +31 -0
  86. package/build/dex/platypus/platypus.js.map +1 -1
  87. package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
  88. package/build/dex/swaap-v1/swaap-v1.js +10 -0
  89. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  90. package/build/dex/zerox/index.d.ts +4 -26
  91. package/build/dex/zerox/index.js +50 -42
  92. package/build/dex/zerox/index.js.map +1 -1
  93. package/build/dex/zerox/types.d.ts +29 -0
  94. package/build/dex/zerox/types.js +8 -1
  95. package/build/dex/zerox/types.js.map +1 -1
  96. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
  97. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
  98. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
  99. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
  100. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
  101. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
  102. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
  103. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
  104. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
  105. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
  106. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
  107. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
  108. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
  109. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
  110. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
  111. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
  112. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
  113. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
  114. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
  115. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
  116. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
  117. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
  118. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
  119. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
  120. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
  121. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
  122. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
  123. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
  124. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
  125. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
  126. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
  127. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
  128. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
  129. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
  130. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
  131. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
  132. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
  133. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
  134. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
  135. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
  136. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
  137. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
  138. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
  139. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
  140. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
  141. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
  142. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
  143. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
  144. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
  145. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
  146. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
  147. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
  148. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
  149. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
  150. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
  151. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
  152. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
  153. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
  154. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
  155. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
  156. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
  157. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
  158. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
  159. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
  160. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
  161. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
  162. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
  163. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
  164. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
  165. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
  166. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
  167. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
  168. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
  169. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
  170. package/package.json +1 -1
  171. package/src/dex/algebra/config.ts +1 -1
  172. package/.idea/aws.xml +0 -17
  173. package/.idea/codeStyles/Project.xml +0 -19
  174. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  175. package/.idea/misc.xml +0 -6
  176. package/.idea/modules.xml +0 -8
  177. package/.idea/paraswap-dex-lib.iml +0 -9
  178. package/.idea/prettier.xml +0 -7
  179. package/.idea/vcs.xml +0 -6
  180. package/build/abi/integral/factory.json +0 -333
  181. package/build/dex/bProtocol.d.ts +0 -18
  182. package/build/dex/bProtocol.js +0 -39
  183. package/build/dex/bProtocol.js.map +0 -1
  184. package/build/dex/bancor.d.ts +0 -26
  185. package/build/dex/bancor.js +0 -58
  186. package/build/dex/bancor.js.map +0 -1
  187. package/build/dex/compound.d.ts +0 -18
  188. package/build/dex/compound.js +0 -46
  189. package/build/dex/compound.js.map +0 -1
  190. package/build/dex/curve-v2.d.ts +0 -58
  191. package/build/dex/curve-v2.js +0 -180
  192. package/build/dex/curve-v2.js.map +0 -1
  193. package/build/dex/dodo-v1.d.ts +0 -33
  194. package/build/dex/dodo-v1.js +0 -63
  195. package/build/dex/dodo-v1.js.map +0 -1
  196. package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +0 -49
  197. package/build/dex/fluid-dex/fluid-dex-generate-pool.js +0 -104
  198. package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +0 -1
  199. package/build/dex/integral/config.d.ts +0 -4
  200. package/build/dex/integral/config.js +0 -20
  201. package/build/dex/integral/config.js.map +0 -1
  202. package/build/dex/integral/context.d.ts +0 -40
  203. package/build/dex/integral/context.js +0 -158
  204. package/build/dex/integral/context.js.map +0 -1
  205. package/build/dex/integral/integral-factory.d.ts +0 -24
  206. package/build/dex/integral/integral-factory.js +0 -95
  207. package/build/dex/integral/integral-factory.js.map +0 -1
  208. package/build/dex/integral/integral-pool.d.ts +0 -50
  209. package/build/dex/integral/integral-pool.js +0 -149
  210. package/build/dex/integral/integral-pool.js.map +0 -1
  211. package/build/dex/integral/integral-pricing.d.ts +0 -18
  212. package/build/dex/integral/integral-pricing.js +0 -114
  213. package/build/dex/integral/integral-pricing.js.map +0 -1
  214. package/build/dex/integral/integral-relayer.d.ts +0 -42
  215. package/build/dex/integral/integral-relayer.js +0 -192
  216. package/build/dex/integral/integral-relayer.js.map +0 -1
  217. package/build/dex/integral/integral-token.d.ts +0 -27
  218. package/build/dex/integral/integral-token.js +0 -59
  219. package/build/dex/integral/integral-token.js.map +0 -1
  220. package/build/dex/integral/integral.js +0 -376
  221. package/build/dex/integral/integral.js.map +0 -1
  222. package/build/dex/integral/types.d.ts +0 -85
  223. package/build/dex/integral/types.js +0 -9
  224. package/build/dex/integral/types.js.map +0 -1
  225. package/build/dex/integral/utils-e2e.d.ts +0 -9
  226. package/build/dex/integral/utils-e2e.js +0 -131
  227. package/build/dex/integral/utils-e2e.js.map +0 -1
  228. package/build/dex/integral/utils.d.ts +0 -17
  229. package/build/dex/integral/utils.js +0 -94
  230. package/build/dex/integral/utils.js.map +0 -1
  231. package/build/dex/lido.d.ts +0 -19
  232. package/build/dex/lido.js +0 -42
  233. package/build/dex/lido.js.map +0 -1
  234. package/build/dex/onebit.d.ts +0 -25
  235. package/build/dex/onebit.js +0 -42
  236. package/build/dex/onebit.js.map +0 -1
  237. package/build/dex/smoothy.d.ts +0 -26
  238. package/build/dex/smoothy.js +0 -48
  239. package/build/dex/smoothy.js.map +0 -1
  240. package/build/dex/stable-pool.d.ts +0 -28
  241. package/build/dex/stable-pool.js +0 -62
  242. package/build/dex/stable-pool.js.map +0 -1
  243. package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
  244. package/build/dex/trader-joe-v2.1/optimizer.js +0 -47
  245. package/build/dex/trader-joe-v2.1/optimizer.js.map +0 -1
  246. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
  247. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
  248. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
  249. package/build/dex/trader-joe-v2.1.d.ts +0 -43
  250. package/build/dex/trader-joe-v2.1.js +0 -79
  251. package/build/dex/trader-joe-v2.1.js.map +0 -1
@@ -1,58 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { SwapSide } from '../constants';
3
- import { AdapterExchangeParam, Address, ExchangeTxInfo, NumberAsString, PreprocessTransactionOptions, SimpleExchangeParam, Token, TxInfo } from '../types';
4
- import { IDexTxBuilder } from './idex';
5
- import { SimpleExchange } from './simple-exchange';
6
- import { IDexHelper } from '../dex-helper';
7
- import { Logger } from 'log4js';
8
- import { OptimalSwapExchange } from '@paraswap/core';
9
- export declare enum CurveV2SwapType {
10
- EXCHANGE = 0,
11
- EXCHANGE_UNDERLYING = 1,
12
- EXCHANGE_GENERIC_FACTORY_ZAP = 2
13
- }
14
- declare type CurveV2Data = {
15
- i: number;
16
- j: number;
17
- exchange: string;
18
- originalPoolAddress: Address;
19
- swapType: CurveV2SwapType;
20
- isApproved?: boolean;
21
- };
22
- export declare type DirectCurveV2Param = [
23
- fromToken: Address,
24
- toToken: Address,
25
- exchange: Address,
26
- poolAddress: Address,
27
- fromAmount: NumberAsString,
28
- toAmount: NumberAsString,
29
- expectedAmount: NumberAsString,
30
- feePercent: NumberAsString,
31
- i: NumberAsString,
32
- j: NumberAsString,
33
- partner: Address,
34
- isApproved: boolean,
35
- swapType: CurveV2SwapType,
36
- beneficiary: Address,
37
- needWrapNative: boolean,
38
- permit: string,
39
- uuid: string
40
- ];
41
- export declare class CurveV2 extends SimpleExchange implements IDexTxBuilder<CurveV2Data, DirectCurveV2Param> {
42
- readonly dexHelper: IDexHelper;
43
- static dexKeys: string[];
44
- exchangeRouterInterface: Interface;
45
- genericFactoryZapIface: Interface;
46
- minConversionRate: string;
47
- needWrapNative: boolean;
48
- logger: Logger;
49
- readonly directSwapIface: Interface;
50
- constructor(dexHelper: IDexHelper);
51
- getAdapterParam(_0: string, _1: string, _2: string, _3: string, data: CurveV2Data, side: SwapSide): AdapterExchangeParam;
52
- getTokenFromAddress(address: Address): Token;
53
- preProcessTransaction(optimalSwapExchange: OptimalSwapExchange<CurveV2Data>, srcToken: Token, _0: Token, _1: SwapSide, options: PreprocessTransactionOptions): Promise<[OptimalSwapExchange<CurveV2Data>, ExchangeTxInfo]>;
54
- getDirectParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, expectedAmount: NumberAsString, data: CurveV2Data, side: SwapSide, permit: string, uuid: string, feePercent: NumberAsString, _0: NumberAsString, partner: string, beneficiary: string, contractMethod?: string): TxInfo<DirectCurveV2Param>;
55
- static getDirectFunctionName(): string[];
56
- getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: CurveV2Data, side: SwapSide): Promise<SimpleExchangeParam>;
57
- }
58
- export {};
@@ -1,180 +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
- exports.CurveV2 = exports.CurveV2SwapType = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const constants_1 = require("../constants");
9
- const simple_exchange_1 = require("./simple-exchange");
10
- const GenericFactoryZap_json_1 = __importDefault(require("../abi/curve-v2/GenericFactoryZap.json"));
11
- const DirectSwap_json_1 = __importDefault(require("../abi/DirectSwap.json"));
12
- const CurveV2_json_1 = __importDefault(require("../abi/CurveV2.json"));
13
- const ts_essentials_1 = require("ts-essentials");
14
- const utils_1 = require("../utils");
15
- var CurveV2SwapType;
16
- (function (CurveV2SwapType) {
17
- CurveV2SwapType[CurveV2SwapType["EXCHANGE"] = 0] = "EXCHANGE";
18
- CurveV2SwapType[CurveV2SwapType["EXCHANGE_UNDERLYING"] = 1] = "EXCHANGE_UNDERLYING";
19
- CurveV2SwapType[CurveV2SwapType["EXCHANGE_GENERIC_FACTORY_ZAP"] = 2] = "EXCHANGE_GENERIC_FACTORY_ZAP";
20
- })(CurveV2SwapType = exports.CurveV2SwapType || (exports.CurveV2SwapType = {}));
21
- const DIRECT_METHOD_NAME = 'directCurveV2Swap';
22
- var CurveV2SwapFunctions;
23
- (function (CurveV2SwapFunctions) {
24
- CurveV2SwapFunctions["exchange"] = "exchange(uint256 i, uint256 j, uint256 dx, uint256 minDy)";
25
- CurveV2SwapFunctions["exchange_underlying"] = "exchange_underlying(uint256 i, uint256 j, uint256 dx, uint256 minDy)";
26
- CurveV2SwapFunctions["exchange_in_generic_factory_zap"] = "exchange(address _pool, uint256 i, uint256 j, uint256 _dx, uint256 _min_dy)";
27
- })(CurveV2SwapFunctions || (CurveV2SwapFunctions = {}));
28
- class CurveV2 extends simple_exchange_1.SimpleExchange {
29
- constructor(dexHelper) {
30
- super(dexHelper, 'curvev2');
31
- this.dexHelper = dexHelper;
32
- this.minConversionRate = '1';
33
- this.needWrapNative = true;
34
- this.directSwapIface = new abi_1.Interface(DirectSwap_json_1.default);
35
- this.exchangeRouterInterface = new abi_1.Interface(CurveV2_json_1.default);
36
- this.genericFactoryZapIface = new abi_1.Interface(GenericFactoryZap_json_1.default);
37
- this.logger = dexHelper.getLogger(`CurveV2_${dexHelper.config.data.network}`);
38
- }
39
- getAdapterParam(_0, _1, _2, _3, data, side) {
40
- if (side === constants_1.SwapSide.BUY)
41
- throw new Error(`Buy not supported`);
42
- const { i, j, originalPoolAddress, swapType } = data;
43
- const payload = this.abiCoder.encodeParameter({
44
- ParentStruct: {
45
- i: 'uint256',
46
- j: 'uint256',
47
- originalPoolAddress: 'address',
48
- swapType: 'uint8',
49
- },
50
- }, {
51
- i,
52
- j,
53
- originalPoolAddress,
54
- swapType,
55
- });
56
- return {
57
- targetExchange: data.exchange,
58
- payload,
59
- networkFee: '0',
60
- };
61
- }
62
- getTokenFromAddress(address) {
63
- // In this Dex decimals are not used
64
- return { address, decimals: 0 };
65
- }
66
- async preProcessTransaction(optimalSwapExchange, srcToken, _0, _1, options) {
67
- if (!options.isDirectMethod) {
68
- return [
69
- optimalSwapExchange,
70
- {
71
- deadline: BigInt((0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)()),
72
- },
73
- ];
74
- }
75
- (0, ts_essentials_1.assert)(optimalSwapExchange.data !== undefined, `preProcessTransaction: data field is missing`);
76
- let isApproved;
77
- try {
78
- this.erc20Contract.options.address =
79
- this.dexHelper.config.wrapETH(srcToken).address;
80
- const allowance = await this.erc20Contract.methods
81
- .allowance(this.augustusAddress, optimalSwapExchange.data.exchange)
82
- .call(undefined, 'latest');
83
- isApproved =
84
- BigInt(allowance.toString()) >= BigInt(optimalSwapExchange.srcAmount);
85
- }
86
- catch (e) {
87
- this.logger.error(`preProcessTransaction failed to retrieve allowance info: `, e);
88
- }
89
- return [
90
- {
91
- ...optimalSwapExchange,
92
- data: {
93
- ...optimalSwapExchange.data,
94
- isApproved,
95
- },
96
- },
97
- {
98
- deadline: BigInt((0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)()),
99
- },
100
- ];
101
- }
102
- getDirectParam(srcToken, destToken, srcAmount, destAmount, expectedAmount, data, side, permit, uuid, feePercent, _0, partner, beneficiary, contractMethod) {
103
- if (contractMethod !== DIRECT_METHOD_NAME) {
104
- throw new Error(`Invalid contract method ${contractMethod}`);
105
- }
106
- (0, ts_essentials_1.assert)(side === constants_1.SwapSide.SELL, 'Buy not supported');
107
- let isApproved = !!data.isApproved;
108
- if (data.isApproved === undefined) {
109
- this.logger.warn(`isApproved is undefined, defaulting to false`);
110
- }
111
- const swapParams = [
112
- srcToken,
113
- destToken,
114
- data.exchange,
115
- data.originalPoolAddress,
116
- srcAmount,
117
- destAmount,
118
- expectedAmount,
119
- feePercent,
120
- data.i.toString(),
121
- data.j.toString(),
122
- partner,
123
- isApproved,
124
- data.swapType,
125
- beneficiary,
126
- // For now we always wrap native. We don't support non native trade
127
- true,
128
- permit,
129
- (0, utils_1.uuidToBytes16)(uuid),
130
- ];
131
- const encoder = (...params) => {
132
- return this.directSwapIface.encodeFunctionData(DIRECT_METHOD_NAME, [
133
- params,
134
- ]);
135
- };
136
- return {
137
- params: swapParams,
138
- encoder,
139
- networkFee: '0',
140
- };
141
- }
142
- static getDirectFunctionName() {
143
- return [DIRECT_METHOD_NAME];
144
- }
145
- async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
146
- if (side === constants_1.SwapSide.BUY)
147
- throw new Error(`Buy not supported`);
148
- const { exchange, i, j, originalPoolAddress, swapType } = data;
149
- const args = swapType === CurveV2SwapType.EXCHANGE_GENERIC_FACTORY_ZAP
150
- ? [
151
- originalPoolAddress,
152
- i.toString(),
153
- j.toString(),
154
- srcAmount,
155
- this.minConversionRate,
156
- ]
157
- : [i.toString(), j.toString(), srcAmount, this.minConversionRate];
158
- let swapMethod;
159
- switch (swapType) {
160
- case CurveV2SwapType.EXCHANGE:
161
- swapMethod = CurveV2SwapFunctions.exchange;
162
- break;
163
- case CurveV2SwapType.EXCHANGE_UNDERLYING:
164
- swapMethod = CurveV2SwapFunctions.exchange_underlying;
165
- break;
166
- case CurveV2SwapType.EXCHANGE_GENERIC_FACTORY_ZAP:
167
- swapMethod = CurveV2SwapFunctions.exchange_in_generic_factory_zap;
168
- break;
169
- default:
170
- throw new Error(`getSimpleParam: not all cases covered for CurveV2SwapTypes`);
171
- }
172
- const swapData = swapMethod === CurveV2SwapFunctions.exchange_in_generic_factory_zap
173
- ? this.genericFactoryZapIface.encodeFunctionData(swapMethod, args)
174
- : this.exchangeRouterInterface.encodeFunctionData(swapMethod, args);
175
- return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, exchange);
176
- }
177
- }
178
- exports.CurveV2 = CurveV2;
179
- CurveV2.dexKeys = ['curvev2'];
180
- //# sourceMappingURL=curve-v2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"curve-v2.js","sourceRoot":"","sources":["../../src/dex/curve-v2.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAwC;AAYxC,uDAG2B;AAC3B,oGAA0E;AAC1E,6EAAmD;AACnD,uEAA6C;AAE7C,iDAAuC;AAGvC,oCAAyC;AAEzC,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,6DAAQ,CAAA;IACR,mFAAmB,CAAA;IACnB,qGAA4B,CAAA;AAC9B,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAED,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AA+C/C,IAAK,oBAIJ;AAJD,WAAK,oBAAoB;IACvB,8FAAsE,CAAA;IACtE,oHAA4F,CAAA;IAC5F,uIAA+G,CAAA;AACjH,CAAC,EAJI,oBAAoB,KAApB,oBAAoB,QAIxB;AAED,MAAa,OACX,SAAQ,gCAAc;IAYtB,YAAqB,SAAqB;QACxC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QADT,cAAS,GAAT,SAAS,CAAY;QAN1C,sBAAiB,GAAG,GAAG,CAAC;QACxB,mBAAc,GAAG,IAAI,CAAC;QAGb,oBAAe,GAAG,IAAI,eAAS,CAAC,yBAAa,CAAC,CAAC;QAItD,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAS,CAAC,sBAA4B,CAAC,CAAC;QAC3E,IAAI,CAAC,sBAAsB,GAAG,IAAI,eAAS,CAAC,gCAAoB,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,SAAS,CAC/B,WAAW,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAC3C,CAAC;IACJ,CAA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EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAEtE,IAAI,UAAkB,CAAC;QACvB,QAAQ,QAAQ,EAAE;YAChB,KAAK,eAAe,CAAC,QAAQ;gBAC3B,UAAU,GAAG,oBAAoB,CAAC,QAAQ,CAAC;gBAC3C,MAAM;YACR,KAAK,eAAe,CAAC,mBAAmB;gBACtC,UAAU,GAAG,oBAAoB,CAAC,mBAAmB,CAAC;gBACtD,MAAM;YACR,KAAK,eAAe,CAAC,4BAA4B;gBAC/C,UAAU,GAAG,oBAAoB,CAAC,+BAA+B,CAAC;gBAClE,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAC;SACL;QAED,MAAM,QAAQ,GACZ,UAAU,KAAK,oBAAoB,CAAC,+BAA+B;YACjE,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAAC;YAClE,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAExE,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,CACT,CAAC;IACJ,CAAC;;AAvOH,0BAwOC;AApOQ,eAAO,GAAG,CAAC,SAAS,CAAC,CAAC"}
@@ -1,33 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { SwapSide } from '../constants';
3
- import { AdapterExchangeParam, Address, SimpleExchangeParam } from '../types';
4
- import { IDexTxBuilder } from './idex';
5
- import { SimpleExchange } from './simple-exchange';
6
- import { NumberAsString } from '@paraswap/core';
7
- import { IDexHelper } from '../dex-helper';
8
- export declare type DodoV1Data = {
9
- fromToken: Address;
10
- toToken: Address;
11
- dodoPairs: Address[];
12
- directions: string;
13
- isIncentive: boolean;
14
- deadLine: string;
15
- };
16
- declare type DodoV1Param = [
17
- fromToken: Address,
18
- toToken: Address,
19
- fromTokenAmount: NumberAsString,
20
- minReturnAmount: NumberAsString,
21
- dodoPairs: Address[],
22
- directions: NumberAsString,
23
- isIncentive: boolean,
24
- deadLine: NumberAsString
25
- ];
26
- export declare class DodoV1 extends SimpleExchange implements IDexTxBuilder<DodoV1Data, DodoV1Param> {
27
- static dexKeys: string[];
28
- dodoV2Proxy: Interface;
29
- constructor(dexHelper: IDexHelper);
30
- getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: DodoV1Data, side: SwapSide): AdapterExchangeParam;
31
- getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: DodoV1Data, side: SwapSide): Promise<SimpleExchangeParam>;
32
- }
33
- export {};
@@ -1,63 +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
- exports.DodoV1 = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const constants_1 = require("../constants");
9
- const simple_exchange_1 = require("./simple-exchange");
10
- const dodo_v2_proxy_json_1 = __importDefault(require("../abi/dodo-v2-proxy.json"));
11
- // We use dodo-v2 proxy as the new proxy supports both v1 and v2
12
- const DODOV2ProxyAddress = {
13
- 1: '0xa356867fdcea8e71aeaf87805808803806231fdc',
14
- 56: '0x8F8Dd7DB1bDA5eD3da8C9daf3bfa471c12d58486',
15
- 42161: '0x88CBf433471A0CD8240D2a12354362988b4593E5',
16
- };
17
- const DODOAproveAddress = {
18
- 1: '0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149',
19
- 56: '0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1',
20
- 42161: '0xA867241cDC8d3b0C07C85cC06F25a0cD3b5474d8',
21
- };
22
- var DodoV1Functions;
23
- (function (DodoV1Functions) {
24
- DodoV1Functions["dodoSwapV1"] = "dodoSwapV1";
25
- })(DodoV1Functions || (DodoV1Functions = {}));
26
- class DodoV1 extends simple_exchange_1.SimpleExchange {
27
- constructor(dexHelper) {
28
- super(dexHelper, 'dodov1');
29
- this.dodoV2Proxy = new abi_1.Interface(dodo_v2_proxy_json_1.default);
30
- }
31
- getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
32
- const { dodoPairs, directions } = data;
33
- const payload = this.abiCoder.encodeParameter({
34
- ParentStruct: {
35
- dodoPairs: 'address[]',
36
- directions: 'uint256',
37
- },
38
- }, { dodoPairs, directions });
39
- return {
40
- targetExchange: DODOV2ProxyAddress[this.network],
41
- payload,
42
- networkFee: '0',
43
- };
44
- }
45
- async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
46
- const swapFunction = DodoV1Functions.dodoSwapV1;
47
- const swapFunctionParams = [
48
- srcToken,
49
- destToken,
50
- srcAmount,
51
- destAmount,
52
- data.dodoPairs,
53
- data.directions,
54
- data.isIncentive,
55
- constants_1.MAX_UINT,
56
- ];
57
- const swapData = this.dodoV2Proxy.encodeFunctionData(swapFunction, swapFunctionParams);
58
- return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, DODOV2ProxyAddress[this.network], DODOAproveAddress[this.network]);
59
- }
60
- }
61
- exports.DodoV1 = DodoV1;
62
- DodoV1.dexKeys = ['dodov1'];
63
- //# sourceMappingURL=dodo-v1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dodo-v1.js","sourceRoot":"","sources":["../../src/dex/dodo-v1.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAkD;AAGlD,uDAAmD;AACnD,mFAAuD;AAKvD,gEAAgE;AAChE,MAAM,kBAAkB,GAAmC;IACzD,CAAC,EAAE,4CAA4C;IAC/C,EAAE,EAAE,4CAA4C;IAChD,KAAK,EAAE,4CAA4C;CACpD,CAAC;AAEF,MAAM,iBAAiB,GAAmC;IACxD,CAAC,EAAE,4CAA4C;IAC/C,EAAE,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CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAChC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAChC,CAAC;IACJ,CAAC;;AAvEH,wBAwEC;AApEQ,cAAO,GAAG,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,49 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { BytesLike } from 'ethers/lib/utils';
3
- import { DeepReadonly } from 'ts-essentials';
4
- import { Log, Logger } from '../../types';
5
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
6
- import { IDexHelper } from '../../dex-helper/idex-helper';
7
- import { CommonAddresses, Pool } from './types';
8
- import { MultiResult } from '../../lib/multi-wrapper';
9
- import { Address } from '../../types';
10
- export declare class FluidDexCommonAddresses extends StatefulEventSubscriber<Pool[]> {
11
- readonly parentName: string;
12
- readonly commonAddresses: CommonAddresses;
13
- protected network: number;
14
- protected dexHelper: IDexHelper;
15
- handlers: {
16
- [event: string]: (event: any, state: DeepReadonly<Pool[]>, log: Readonly<Log>) => Promise<DeepReadonly<Pool[]> | null>;
17
- };
18
- logDecoder: (log: Log) => any;
19
- addressesSubscribed: Address[];
20
- protected dexFactoryIface: Interface;
21
- protected resolverIface: Interface;
22
- constructor(parentName: string, commonAddresses: CommonAddresses, network: number, dexHelper: IDexHelper, logger: Logger);
23
- /**
24
- * Handle a trade rate change on the pool.
25
- */
26
- handleDexDeployed(event: any, state: DeepReadonly<Pool[]>, log: Readonly<Log>): Promise<DeepReadonly<Pool[]> | null>;
27
- decodePool: (result: MultiResult<BytesLike> | BytesLike) => Pool;
28
- /**
29
- * The function is called every time any of the subscribed
30
- * addresses release log. The function accepts the current
31
- * state, updates the state according to the log, and returns
32
- * the updated state.
33
- * @param state - Current state of event subscriber
34
- * @param log - Log released by one of the subscribed addresses
35
- * @returns Updates state of the event subscriber after the log
36
- */
37
- processLog(state: DeepReadonly<Pool[]>, log: Readonly<Log>): Promise<DeepReadonly<Pool[]> | null>;
38
- getStateOrGenerate(blockNumber: number, readonly?: boolean): Promise<DeepReadonly<Pool[]>>;
39
- /**
40
- * The function generates state using on-chain calls. This
41
- * function is called to regenerate state if the event based
42
- * system fails to fetch events and the local state is no
43
- * more correct.
44
- * @param blockNumber - Blocknumber for which the state should
45
- * should be generated
46
- * @returns state of the event subscriber at blocknumber
47
- */
48
- generateState(blockNumber: number): Promise<DeepReadonly<Pool[]>>;
49
- }
@@ -1,104 +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
- exports.FluidDexCommonAddresses = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const utils_1 = require("../../utils");
9
- const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
10
- const resolver_abi_json_1 = __importDefault(require("../../abi/fluid-dex/resolver.abi.json"));
11
- const dexFactory_abi_json_1 = __importDefault(require("../../abi/fluid-dex/dexFactory.abi.json"));
12
- const decoders_1 = require("../../lib/decoders");
13
- const ethers_1 = require("ethers");
14
- class FluidDexCommonAddresses extends stateful_event_subscriber_1.StatefulEventSubscriber {
15
- constructor(parentName, commonAddresses, network, dexHelper, logger) {
16
- super(parentName, 'getAllPools', dexHelper, logger);
17
- this.parentName = parentName;
18
- this.commonAddresses = commonAddresses;
19
- this.network = network;
20
- this.dexHelper = dexHelper;
21
- this.handlers = {};
22
- this.dexFactoryIface = new abi_1.Interface(dexFactory_abi_json_1.default);
23
- this.resolverIface = new abi_1.Interface(resolver_abi_json_1.default);
24
- this.decodePool = (result) => {
25
- return (0, decoders_1.generalDecoder)(result, ['tuple(address pool, address token0, address token1, uint256 fee)'], undefined, decoded => {
26
- return {
27
- address: decoded[0].toLowerCase(),
28
- token0: decoded[1].toLowerCase(),
29
- token1: decoded[2].toLowerCase(),
30
- };
31
- });
32
- };
33
- this.logDecoder = (log) => this.dexFactoryIface.parseLog(log);
34
- this.addressesSubscribed = [commonAddresses.dexFactory];
35
- // Add handlers
36
- this.handlers['DexDeployed'] = this.handleDexDeployed.bind(this);
37
- }
38
- /**
39
- * Handle a trade rate change on the pool.
40
- */
41
- async handleDexDeployed(event, state, log) {
42
- const blockNumber_ = await this.dexHelper.provider.getBlockNumber();
43
- return this.getStateOrGenerate(blockNumber_, false);
44
- }
45
- /**
46
- * The function is called every time any of the subscribed
47
- * addresses release log. The function accepts the current
48
- * state, updates the state according to the log, and returns
49
- * the updated state.
50
- * @param state - Current state of event subscriber
51
- * @param log - Log released by one of the subscribed addresses
52
- * @returns Updates state of the event subscriber after the log
53
- */
54
- async processLog(state, log) {
55
- try {
56
- let event;
57
- try {
58
- event = this.logDecoder(log);
59
- }
60
- catch (e) {
61
- return null;
62
- }
63
- if (event.name in this.handlers) {
64
- return await this.handlers[event.name](event, state, log);
65
- }
66
- }
67
- catch (e) {
68
- (0, utils_1.catchParseLogError)(e, this.logger);
69
- }
70
- return null;
71
- }
72
- async getStateOrGenerate(blockNumber, readonly = false) {
73
- let state = this.getState(blockNumber);
74
- if (!state) {
75
- state = await this.generateState(blockNumber);
76
- if (!readonly)
77
- this.setState(state, blockNumber);
78
- }
79
- return state;
80
- }
81
- /**
82
- * The function generates state using on-chain calls. This
83
- * function is called to regenerate state if the event based
84
- * system fails to fetch events and the local state is no
85
- * more correct.
86
- * @param blockNumber - Blocknumber for which the state should
87
- * should be generated
88
- * @returns state of the event subscriber at blocknumber
89
- */
90
- async generateState(blockNumber) {
91
- const resolverContract = new ethers_1.Contract(this.commonAddresses.resolver, resolver_abi_json_1.default, this.dexHelper.provider);
92
- const rawResult = await resolverContract.callStatic.getAllPools({
93
- blockTag: blockNumber,
94
- });
95
- const pools = rawResult.map((result) => ({
96
- address: result[0],
97
- token0: result[1],
98
- token1: result[2],
99
- }));
100
- return pools;
101
- }
102
- }
103
- exports.FluidDexCommonAddresses = FluidDexCommonAddresses;
104
- //# sourceMappingURL=fluid-dex-generate-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fluid-dex-generate-pool.js","sourceRoot":"","sources":["../../../src/dex/fluid-dex/fluid-dex-generate-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAI/C,uCAAiD;AACjD,+EAA0E;AAE1E,8FAAgE;AAChE,kGAAoE;AAIpE,iDAAoD;AACpD,mCAAkC;AAElC,MAAa,uBAAwB,SAAQ,mDAA+B;IAe1E,YACW,UAAkB,EAClB,eAAgC,EAC/B,OAAe,EACf,SAAqB,EAC/B,MAAc;QAEd,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAN3C,eAAU,GAAV,UAAU,CAAQ;QAClB,oBAAe,GAAf,eAAe,CAAiB;QAC/B,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAlBjC,aAAQ,GAMJ,EAAE,CAAC;QAKG,oBAAe,GAAG,IAAI,eAAS,CAAC,6BAAa,CAAC,CAAC;QAC/C,kBAAa,GAAG,IAAI,eAAS,CAAC,2BAAW,CAAC,CAAC;QA8BrD,eAAU,GAAG,CAAC,MAA0C,EAAQ,EAAE;YAChE,OAAO,IAAA,yBAAc,EACnB,MAAM,EACN,CAAC,kEAAkE,CAAC,EACpE,SAAS,EACT,OAAO,CAAC,EAAE;gBACR,OAAO;oBACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;oBACjC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;oBAChC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;iBACjC,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;QAhCA,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ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,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;SAClD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,MAAM,gBAAgB,GAAG,IAAI,iBAAQ,CACnC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAC7B,2BAAW,EACX,IAAI,CAAC,SAAS,CAAC,QAAQ,CACxB,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC;YAC9D,QAAQ,EAAE,WAAW;SACtB,CAAC,CAAC;QAEH,MAAM,KAAK,GAAW,SAAS,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC;YACpD,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;YACjB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;SAClB,CAAC,CAAC,CAAC;QAEJ,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA/HD,0DA+HC"}
@@ -1,4 +0,0 @@
1
- import { DexParams } from './types';
2
- import { DexConfigMap, AdapterMappings } from '../../types';
3
- export declare const IntegralConfig: DexConfigMap<DexParams>;
4
- export declare const Adapters: Record<number, AdapterMappings>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.IntegralConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.IntegralConfig = {
6
- Integral: {
7
- [constants_1.Network.MAINNET]: {
8
- factoryAddress: '0xC480b33eE5229DE3FbDFAD1D2DCD3F3BAD0C56c6',
9
- relayerAddress: '0xd17b3c9784510E33cD5B87b490E79253BcD81e2E',
10
- subgraphURL: 'ANd5QJuYtyfngmXvBMu9kZAv935vhcqp4xAGBkmCADN3',
11
- },
12
- [constants_1.Network.ARBITRUM]: {
13
- factoryAddress: '0x717EF162cf831db83c51134734A15D1EBe9E516a',
14
- relayerAddress: '0x3c6951FDB433b5b8442e7aa126D50fBFB54b5f42',
15
- subgraphURL: 'HXeVedRK7VgogXwbK5Sc4mjyLkhBAS5akskRvbSYnkHU',
16
- },
17
- },
18
- };
19
- exports.Adapters = {};
20
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/integral/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,cAAc,GAA4B;IACrD,QAAQ,EAAE;QACR,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,cAAc,EAAE,4CAA4C;YAC5D,cAAc,EAAE,4CAA4C;YAC5D,WAAW,EAAE,8CAA8C;SAC5D;QACD,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,cAAc,EAAE,4CAA4C;YAC5D,cAAc,EAAE,4CAA4C;YAC5D,WAAW,EAAE,8CAA8C;SAC5D;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC,EAAE,CAAC"}
@@ -1,40 +0,0 @@
1
- import { Address } from '@paraswap/core';
2
- import { IntegralFactory } from './integral-factory';
3
- import { IntegralRelayer } from './integral-relayer';
4
- import { Network } from '../../constants';
5
- import { IDexHelper } from '../../dex-helper';
6
- import { Logger } from 'log4js';
7
- import { Interface } from '@ethersproject/abi';
8
- import { IntegralPool, PoolInitProps, RelayerPoolState } from './types';
9
- import { IntegralToken } from './integral-token';
10
- export declare class IntegralContext {
11
- readonly network: Network;
12
- readonly dexKey: string;
13
- readonly dexHelper: IDexHelper;
14
- readonly erc20Interface: Interface;
15
- readonly factoryAddress: Address;
16
- readonly relayerAddress: Address;
17
- static instances: {
18
- [network: number]: IntegralContext;
19
- };
20
- pools: {
21
- [poolId: string]: IntegralPool;
22
- };
23
- tokens: {
24
- [tokenAddress: Address]: IntegralToken;
25
- };
26
- factory: IntegralFactory;
27
- relayer: IntegralRelayer;
28
- logger: Logger;
29
- private constructor();
30
- addPools(pools: PoolInitProps, blockNumber: number, initPhase?: boolean): Promise<void>;
31
- getPoolAddresses(): string[];
32
- private removeDisabledPoolInitProps;
33
- static initialize(network: Network, dexKey: string, dexHelper: IDexHelper, erc20Interface: Interface, factoryAddress: Address, relayerAddress: Address): IntegralContext;
34
- static getInstance(network: Network): IntegralContext;
35
- onRelayerPoolEnabledSet(poolAddress: Address, state: RelayerPoolState, blockNumber: number): Promise<void>;
36
- onRebalanceSellOrderExecuted(blockNumber: number, orderId: bigint): void;
37
- onPoolCreatedAddPool(token0: Address, token1: Address, poolAddress: Address, blockNumber: number): Promise<void>;
38
- onPoolSwapForRelayer(blockNumber: number, poolAddress: Address, recipient: Address, amount0Out: bigint, amount1Out: bigint): Promise<void>;
39
- onTransferUpdateBalance(token: Address, from: Address, to: Address, amount: bigint, blockNumber: number): Promise<void>;
40
- }