@paraswap/dex-lib 3.11.0-bebop.2 → 3.11.0-bebop.4

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 (263) hide show
  1. package/.vscode/launch.json +53 -0
  2. package/.vscode/settings.json +2 -0
  3. package/.vscode/tasks.json +15 -0
  4. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
  5. package/build/abi/{angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json → wombat/pool.json} +637 -594
  6. package/build/dex/aave-v1/aave-v1.js +1 -0
  7. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  8. package/build/dex/aave-v2/tokens-avalanche.json +44 -0
  9. package/build/dex/aave-v2/tokens-mainnet.json +188 -0
  10. package/build/dex/aave-v2/tokens-polygon.json +44 -0
  11. package/build/dex/bProtocol.d.ts +18 -0
  12. package/build/dex/bProtocol.js +39 -0
  13. package/build/dex/bProtocol.js.map +1 -0
  14. package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +729 -0
  15. package/build/dex/balancer-v3/abi/balancerBatchRouter.js +732 -0
  16. package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +1 -0
  17. package/build/dex/balancer-v3/abi/balancerRouter.d.ts +1406 -0
  18. package/build/dex/balancer-v3/abi/balancerRouter.js +1175 -0
  19. package/build/dex/balancer-v3/abi/balancerRouter.js.map +1 -0
  20. package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +2081 -0
  21. package/build/dex/balancer-v3/abi/vaultExtension.V3.js +1851 -0
  22. package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +1 -0
  23. package/build/dex/balancer-v3/balancer-v3-pool.d.ts +76 -0
  24. package/build/dex/balancer-v3/balancer-v3-pool.js +383 -0
  25. package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -0
  26. package/build/dex/balancer-v3/balancer-v3.d.ts +57 -0
  27. package/build/dex/balancer-v3/balancer-v3.js +373 -0
  28. package/build/dex/balancer-v3/balancer-v3.js.map +1 -0
  29. package/build/dex/balancer-v3/config.d.ts +8 -0
  30. package/build/dex/balancer-v3/config.js +24 -0
  31. package/build/dex/balancer-v3/config.js.map +1 -0
  32. package/build/dex/balancer-v3/getOnChainState.d.ts +10 -0
  33. package/build/dex/balancer-v3/getOnChainState.js +158 -0
  34. package/build/dex/balancer-v3/getOnChainState.js.map +1 -0
  35. package/build/dex/balancer-v3/getPoolsApi.d.ts +2 -0
  36. package/build/dex/balancer-v3/getPoolsApi.js +81 -0
  37. package/build/dex/balancer-v3/getPoolsApi.js.map +1 -0
  38. package/build/dex/balancer-v3/getTopPoolsApi.d.ts +13 -0
  39. package/build/dex/balancer-v3/getTopPoolsApi.js +62 -0
  40. package/build/dex/balancer-v3/getTopPoolsApi.js.map +1 -0
  41. package/build/dex/balancer-v3/types.d.ts +63 -0
  42. package/build/dex/balancer-v3/types.js +3 -0
  43. package/build/dex/balancer-v3/types.js.map +1 -0
  44. package/build/dex/bancor.d.ts +26 -0
  45. package/build/dex/bancor.js +58 -0
  46. package/build/dex/bancor.js.map +1 -0
  47. package/build/dex/bebop/validators.js +3 -2
  48. package/build/dex/bebop/validators.js.map +1 -1
  49. package/build/dex/compound.d.ts +18 -0
  50. package/build/dex/compound.js +46 -0
  51. package/build/dex/compound.js.map +1 -0
  52. package/build/dex/curve-v2.d.ts +58 -0
  53. package/build/dex/curve-v2.js +180 -0
  54. package/build/dex/curve-v2.js.map +1 -0
  55. package/build/dex/dodo-v1.d.ts +33 -0
  56. package/build/dex/dodo-v1.js +63 -0
  57. package/build/dex/dodo-v1.js.map +1 -0
  58. package/build/dex/fluid-dex/fluid-dex-pool.d.ts +47 -0
  59. package/build/dex/fluid-dex/fluid-dex-pool.js +119 -0
  60. package/build/dex/fluid-dex/fluid-dex-pool.js.map +1 -0
  61. package/build/dex/inception/inception-event-pool.d.ts +4 -4
  62. package/build/dex/inception/inception-event-pool.js +7 -9
  63. package/build/dex/inception/inception-event-pool.js.map +1 -1
  64. package/build/dex/inception/inception.d.ts +6 -6
  65. package/build/dex/inception/inception.js +16 -40
  66. package/build/dex/inception/inception.js.map +1 -1
  67. package/build/dex/inception/utils.d.ts +1 -0
  68. package/build/dex/inception/utils.js +22 -1
  69. package/build/dex/inception/utils.js.map +1 -1
  70. package/build/dex/lido.d.ts +19 -0
  71. package/build/dex/lido.js +42 -0
  72. package/build/dex/lido.js.map +1 -0
  73. package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
  74. package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
  75. package/build/dex/maker-psm/scripts/validate-state.js +185 -0
  76. package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
  77. package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
  78. package/build/dex/onebit.d.ts +25 -0
  79. package/build/dex/onebit.js +42 -0
  80. package/build/dex/onebit.js.map +1 -0
  81. package/build/dex/platypus/platypus.js +17 -3
  82. package/build/dex/platypus/platypus.js.map +1 -1
  83. package/build/dex/smoothy.d.ts +26 -0
  84. package/build/dex/smoothy.js +48 -0
  85. package/build/dex/smoothy.js.map +1 -0
  86. package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
  87. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
  88. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
  89. package/build/dex/stable-pool.d.ts +28 -0
  90. package/build/dex/stable-pool.js +55 -0
  91. package/build/dex/stable-pool.js.map +1 -0
  92. package/build/dex/swaap-v1/swaap-v1.js +4 -0
  93. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  94. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
  95. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
  96. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
  97. package/build/dex/trader-joe-v2.1.d.ts +43 -0
  98. package/build/dex/trader-joe-v2.1.js +79 -0
  99. package/build/dex/trader-joe-v2.1.js.map +1 -0
  100. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
  101. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
  102. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
  103. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
  104. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
  105. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
  106. package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
  107. package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
  108. package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
  109. package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
  110. package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
  111. package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
  112. package/build/stateful-event-subscriber.js +78 -50
  113. package/build/stateful-event-subscriber.js.map +1 -1
  114. package/package.json +1 -1
  115. package/src/dex/bebop/validators.ts +3 -2
  116. package/src/stateful-event-subscriber.ts +110 -71
  117. package/tsconfig.json +1 -1
  118. package/build/abi/Aave_GSM.json +0 -751
  119. package/build/abi/Balancer.json +0 -257
  120. package/build/abi/BalancerV2.json +0 -1179
  121. package/build/abi/RamsesV2Pool.abi.json +0 -1554
  122. package/build/abi/RamsesV2Quoter.abi.json +0 -274
  123. package/build/abi/USDM.json +0 -807
  124. package/build/abi/UniswapV2Router.json +0 -397
  125. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
  126. package/build/abi/cables/CablesMainnetRFQ.json +0 -1083
  127. package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
  128. package/build/abi/curve-v1/CurveTokenV1.json +0 -305
  129. package/build/abi/curve-v1/CurveTokenV2.json +0 -318
  130. package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
  131. package/build/abi/curve-v1/CurveV2Swap.json +0 -700
  132. package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
  133. package/build/abi/curve-v1/FactoryRegistry.json +0 -508
  134. package/build/abi/curve-v1/StableSwapAave.json +0 -1152
  135. package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
  136. package/build/abi/curve-v1/StableSwapCompound.json +0 -814
  137. package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
  138. package/build/abi/curve-v1/StableSwapPax.json +0 -865
  139. package/build/abi/curve-v1/StableSwapSnow.json +0 -900
  140. package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
  141. package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
  142. package/build/abi/curve-v1/StableSwapY.json +0 -814
  143. package/build/abi/inception/inception-ineth.json +0 -609
  144. package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
  145. package/build/abi/kyberdmm.abi.json +0 -1148
  146. package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
  147. package/build/abi/nerve/nerve-metapool.json +0 -790
  148. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  149. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
  150. package/build/dex/balancer-v1/balancer-pools.json +0 -33333
  151. package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
  152. package/build/dex/bebop/websocket-fetcher.js +0 -87
  153. package/build/dex/bebop/websocket-fetcher.js.map +0 -1
  154. package/build/dex/cables/cables.d.ts +0 -57
  155. package/build/dex/cables/cables.js +0 -471
  156. package/build/dex/cables/cables.js.map +0 -1
  157. package/build/dex/cables/config.d.ts +0 -4
  158. package/build/dex/cables/config.js +0 -15
  159. package/build/dex/cables/config.js.map +0 -1
  160. package/build/dex/cables/constants.d.ts +0 -19
  161. package/build/dex/cables/constants.js +0 -26
  162. package/build/dex/cables/constants.js.map +0 -1
  163. package/build/dex/cables/rate-fetcher.d.ts +0 -34
  164. package/build/dex/cables/rate-fetcher.js +0 -106
  165. package/build/dex/cables/rate-fetcher.js.map +0 -1
  166. package/build/dex/cables/types.d.ts +0 -106
  167. package/build/dex/cables/types.js +0 -12
  168. package/build/dex/cables/types.js.map +0 -1
  169. package/build/dex/cables/validators.d.ts +0 -5
  170. package/build/dex/cables/validators.js +0 -49
  171. package/build/dex/cables/validators.js.map +0 -1
  172. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  173. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  174. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  175. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  176. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  177. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  178. package/build/dex/idle-dao/scripts.d.ts +0 -9
  179. package/build/dex/idle-dao/scripts.js +0 -552
  180. package/build/dex/idle-dao/scripts.js.map +0 -1
  181. package/build/dex/inception/inception-native.d.ts +0 -43
  182. package/build/dex/inception/inception-native.js +0 -131
  183. package/build/dex/inception/inception-native.js.map +0 -1
  184. package/build/dex/inception/inception-pool.d.ts +0 -18
  185. package/build/dex/inception/inception-pool.js +0 -32
  186. package/build/dex/inception/inception-pool.js.map +0 -1
  187. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  188. package/build/dex/inception/inception-price-feed.js +0 -51
  189. package/build/dex/inception/inception-price-feed.js.map +0 -1
  190. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
  191. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
  192. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
  193. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
  194. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
  195. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
  196. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
  197. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
  198. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
  199. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
  200. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
  201. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
  202. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
  203. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
  204. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
  205. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
  206. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
  207. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
  208. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
  209. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
  210. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
  211. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
  212. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
  213. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
  214. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
  215. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
  216. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
  217. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
  218. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
  219. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
  220. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
  221. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
  222. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
  223. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
  224. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
  225. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
  226. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
  227. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
  228. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
  229. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
  230. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
  231. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
  232. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
  233. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
  234. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
  235. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
  236. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
  237. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
  238. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
  239. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
  240. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
  241. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
  242. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
  243. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
  244. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
  245. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
  246. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
  247. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
  248. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
  249. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
  250. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
  251. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
  252. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
  253. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
  254. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
  255. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
  256. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
  257. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
  258. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
  259. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
  260. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
  261. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
  262. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
  263. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
@@ -0,0 +1,81 @@
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.getPoolsApi = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const config_1 = require("./config");
9
+ const utils_1 = require("ethers/lib/utils");
10
+ function createQuery(networkId, poolTypes, timestamp) {
11
+ const poolTypesString = poolTypes.map(type => `${type}`).join(', ');
12
+ const networkString = config_1.BalancerV3Config.BalancerV3[networkId].apiNetworkName;
13
+ // Build the where clause conditionally
14
+ const whereClause = {
15
+ chainIn: networkString,
16
+ protocolVersionIn: 3,
17
+ hasHook: false,
18
+ poolTypeIn: `[${poolTypesString}]`,
19
+ ...(timestamp && { createTime: `{lt: ${timestamp}}` }),
20
+ };
21
+ // Convert where clause to string, filtering out undefined values
22
+ const whereString = Object.entries(whereClause)
23
+ .map(([key, value]) => `${key}: ${value}`)
24
+ .join(', ');
25
+ return `
26
+ query MyQuery {
27
+ poolGetAggregatorPools(
28
+ where: {${whereString}}
29
+ ) {
30
+ id
31
+ type
32
+ poolTokens {
33
+ address
34
+ weight
35
+ isErc4626
36
+ underlyingToken {
37
+ address
38
+ }
39
+ }
40
+ }
41
+ }
42
+ `;
43
+ }
44
+ function toImmutablePoolStateMap(pools) {
45
+ return pools.reduce((map, pool) => {
46
+ const immutablePoolState = {
47
+ address: pool.id,
48
+ tokens: pool.poolTokens.map(t => t.address),
49
+ tokensUnderlying: pool.poolTokens.map(t => t.underlyingToken ? t.underlyingToken.address : null),
50
+ weights: pool.poolTokens.map(t => t.weight ? (0, utils_1.parseUnits)(t.weight, 18).toBigInt() : 0n),
51
+ poolType: pool.type,
52
+ // TODO add scalingFactors once API provides them
53
+ // scalingFactors: pool.poolTokens.map(t => parseUnits('1', 18).toBigInt()),
54
+ // TODO Hook support will be added in future PR
55
+ hookType: undefined,
56
+ };
57
+ map[pool.id] = immutablePoolState;
58
+ return map;
59
+ }, {});
60
+ }
61
+ // Any data from API will be immutable. Mutable data such as balances, etc will be fetched via onchain/event state.
62
+ async function getPoolsApi(network, timestamp) {
63
+ try {
64
+ const query = createQuery(network, Object.values(config_1.SUPPORTED_POOLS), timestamp);
65
+ const response = await axios_1.default.post(config_1.apiUrl, {
66
+ query,
67
+ }, {
68
+ headers: {
69
+ 'Content-Type': 'application/json',
70
+ },
71
+ });
72
+ const pools = response.data.data.poolGetAggregatorPools;
73
+ return toImmutablePoolStateMap(pools);
74
+ }
75
+ catch (error) {
76
+ // console.error('Error executing GraphQL query:', error);
77
+ throw error;
78
+ }
79
+ }
80
+ exports.getPoolsApi = getPoolsApi;
81
+ //# sourceMappingURL=getPoolsApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPoolsApi.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/getPoolsApi.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,qCAAqE;AAErE,4CAA8C;AAuB9C,SAAS,WAAW,CAClB,SAAiB,EACjB,SAA4B,EAC5B,SAAkB;IAElB,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,yBAAgB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC;IAC5E,uCAAuC;IACvC,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE,aAAa;QACtB,iBAAiB,EAAE,CAAC;QACpB,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,IAAI,eAAe,GAAG;QAClC,GAAG,CAAC,SAAS,IAAI,EAAE,UAAU,EAAE,QAAQ,SAAS,GAAG,EAAE,CAAC;KACvD,CAAC;IAEF,iEAAiE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W,CAC/B,OAAe,EACf,SAAkB;IAElB,IAAI;QACF,MAAM,KAAK,GAAG,WAAW,CACvB,OAAO,EACP,MAAM,CAAC,MAAM,CAAC,wBAAe,CAAC,EAC9B,SAAS,CACV,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,eAAM,EACN;YACE,KAAK;SACN,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC;QACxD,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC;KACvC;IAAC,OAAO,KAAK,EAAE;QACd,0DAA0D;QAC1D,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AA5BD,kCA4BC"}
@@ -0,0 +1,13 @@
1
+ interface PoolToken {
2
+ address: string;
3
+ decimals: number;
4
+ }
5
+ interface Pool {
6
+ address: string;
7
+ poolTokens: PoolToken[];
8
+ dynamicData: {
9
+ totalLiquidity: string;
10
+ };
11
+ }
12
+ export declare function getTopPoolsApi(networkId: number, poolsFilter: string[], count: number): Promise<Pool[]>;
13
+ export {};
@@ -0,0 +1,62 @@
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.getTopPoolsApi = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const config_1 = require("./config");
9
+ function createQuery(networkId, poolsFilter, count) {
10
+ const networkString = config_1.BalancerV3Config.BalancerV3[networkId].apiNetworkName;
11
+ const poolIdString = poolsFilter.map(a => `"${a}"`).join(', ');
12
+ // Build the where clause conditionally
13
+ const whereClause = {
14
+ chainIn: networkString,
15
+ protocolVersionIn: 3,
16
+ hasHook: false,
17
+ idIn: `[${poolIdString}]`,
18
+ };
19
+ // Convert where clause to string, filtering out undefined values
20
+ const whereString = Object.entries(whereClause)
21
+ .map(([key, value]) => `${key}: ${value}`)
22
+ .join(', ');
23
+ return `
24
+ query MyQuery {
25
+ poolGetAggregatorPools(
26
+ where: {${whereString}}
27
+ first: ${count}
28
+ orderBy: totalLiquidity
29
+ orderDirection: desc
30
+ ) {
31
+ address
32
+ poolTokens {
33
+ address
34
+ decimals
35
+ }
36
+ dynamicData {
37
+ totalLiquidity
38
+ }
39
+ }
40
+ }
41
+ `;
42
+ }
43
+ async function getTopPoolsApi(networkId, poolsFilter, count) {
44
+ try {
45
+ const query = createQuery(networkId, poolsFilter, count);
46
+ const response = await axios_1.default.post(config_1.apiUrl, {
47
+ query,
48
+ }, {
49
+ headers: {
50
+ 'Content-Type': 'application/json',
51
+ },
52
+ });
53
+ const pools = response.data.data.poolGetAggregatorPools;
54
+ return pools;
55
+ }
56
+ catch (error) {
57
+ // console.error('Error executing GraphQL query:', error);
58
+ throw error;
59
+ }
60
+ }
61
+ exports.getTopPoolsApi = getTopPoolsApi;
62
+ //# sourceMappingURL=getTopPoolsApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTopPoolsApi.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/getTopPoolsApi.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qCAAoD;AAqBpD,SAAS,WAAW,CAClB,SAAiB,EACjB,WAAqB,EACrB,KAAa;IAEb,MAAM,aAAa,GAAG,yBAAgB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC;IAC5E,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,uCAAuC;IACvC,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE,aAAa;QACtB,iBAAiB,EAAE,CAAC;QACpB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,IAAI,YAAY,GAAG;KAC1B,CAAC;IAEF,iEAAiE;IACjE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;SACzC,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO;;;kBAGS,WAAW;iBACZ,KAAK;;;;;;;;;;;;;;GAcnB,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,SAAiB,EACjB,WAAqB,EACrB,KAAa;IAEb,IAAI;QACF,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,eAAM,EACN;YACE,KAAK;SACN,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC;QACxD,OAAO,KAAK,CAAC;KACd;IAAC,OAAO,KAAK,EAAE;QACd,0DAA0D;QAC1D,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AAzBD,wCAyBC"}
@@ -0,0 +1,63 @@
1
+ import { BufferState } from '@balancer-labs/balancer-maths';
2
+ import { Address } from '../../types';
3
+ export declare type CommonImmutablePoolState = {
4
+ address: string;
5
+ poolType: string;
6
+ tokens: string[];
7
+ tokensUnderlying: (string | null)[];
8
+ weights: bigint[];
9
+ hookType: string | undefined;
10
+ };
11
+ export interface CommonMutableState {
12
+ tokenRates: bigint[];
13
+ balancesLiveScaled18: bigint[];
14
+ swapFee: bigint;
15
+ aggregateSwapFee: bigint;
16
+ totalSupply: bigint;
17
+ isPoolPaused: boolean;
18
+ scalingFactors: bigint[];
19
+ hasHook: boolean;
20
+ }
21
+ declare type CommonPoolState = CommonImmutablePoolState & CommonMutableState;
22
+ export declare type PoolState = CommonPoolState | (CommonPoolState & StableMutableState);
23
+ export interface StableMutableState {
24
+ amp: bigint;
25
+ ampIsUpdating: boolean;
26
+ ampStartValue: bigint;
27
+ ampEndValue: bigint;
28
+ ampStartTime: bigint;
29
+ ampStopTime: bigint;
30
+ }
31
+ export declare type PoolStateMap = {
32
+ [address: string]: PoolState;
33
+ };
34
+ export declare type ImmutablePoolStateMap = {
35
+ [address: string]: CommonImmutablePoolState;
36
+ };
37
+ export declare type Step = {
38
+ pool: Address;
39
+ tokenOut: Address;
40
+ isBuffer: boolean;
41
+ swapInput: {
42
+ tokenIn: Address;
43
+ tokenOut: Address;
44
+ };
45
+ poolState: PoolState | BufferState;
46
+ };
47
+ export declare type BalancerV3Data = {
48
+ steps: Step[];
49
+ };
50
+ export declare type DexParams = {
51
+ apiNetworkName: string;
52
+ vaultAddress: string;
53
+ balancerRouterAddress: string;
54
+ balancerBatchRouterAddress: string;
55
+ };
56
+ export declare type TokenInfo = {
57
+ isBoosted: boolean;
58
+ underlyingToken: string | null;
59
+ mainToken: string;
60
+ index: number;
61
+ rate: bigint;
62
+ };
63
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
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 { IDexHelper } from '../dex-helper';
7
+ export declare type BancorData = {
8
+ minDestToken: string;
9
+ path: Address[];
10
+ bancorNetwork?: string;
11
+ };
12
+ declare type BancorParam = [
13
+ path: Address[],
14
+ srcAmount: string,
15
+ minDestToken: string,
16
+ affiliateAccount: string,
17
+ affiliateFee: string
18
+ ];
19
+ export declare class Bancor extends SimpleExchange implements IDexTxBuilder<BancorData, BancorParam> {
20
+ static dexKeys: string[];
21
+ exchangeRouterInterface: Interface;
22
+ constructor(dexHelper: IDexHelper);
23
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: BancorData, side: SwapSide): AdapterExchangeParam;
24
+ getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: BancorData, side: SwapSide): Promise<SimpleExchangeParam>;
25
+ }
26
+ export {};
@@ -0,0 +1,58 @@
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.Bancor = 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 Bancor_json_1 = __importDefault(require("../abi/Bancor.json"));
11
+ const BANCOR_NETWORK = {
12
+ 1: '0x2F9EC37d6CcFFf1caB21733BdaDEdE11c823cCB0',
13
+ };
14
+ const BancorRegistry = {
15
+ 1: '0x52ae12abe5d8bd778bd5397f99ca900624cfadd4',
16
+ };
17
+ var BancorFunctions;
18
+ (function (BancorFunctions) {
19
+ BancorFunctions["convert2"] = "convert2";
20
+ })(BancorFunctions || (BancorFunctions = {}));
21
+ class Bancor extends simple_exchange_1.SimpleExchange {
22
+ constructor(dexHelper) {
23
+ super(dexHelper, 'bancor');
24
+ this.exchangeRouterInterface = new abi_1.Interface(Bancor_json_1.default);
25
+ }
26
+ getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
27
+ if (side === constants_1.SwapSide.BUY)
28
+ throw new Error(`Buy not supported`);
29
+ const { path } = data;
30
+ const payload = this.abiCoder.encodeParameter({
31
+ ParentStruct: {
32
+ path: 'address[]',
33
+ },
34
+ }, { path });
35
+ return {
36
+ targetExchange: BancorRegistry[this.network],
37
+ payload,
38
+ networkFee: '0',
39
+ };
40
+ }
41
+ async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
42
+ if (side === constants_1.SwapSide.BUY)
43
+ throw new Error(`Buy not supported`);
44
+ const defaultArgs = [
45
+ data.path,
46
+ srcAmount,
47
+ data.minDestToken || '1',
48
+ constants_1.NULL_ADDRESS,
49
+ '0',
50
+ ];
51
+ const swapMethod = BancorFunctions.convert2;
52
+ const swapData = this.exchangeRouterInterface.encodeFunctionData(swapMethod, defaultArgs);
53
+ return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, data.bancorNetwork || BANCOR_NETWORK[this.network]);
54
+ }
55
+ }
56
+ exports.Bancor = Bancor;
57
+ Bancor.dexKeys = ['bancor'];
58
+ //# sourceMappingURL=bancor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bancor.js","sourceRoot":"","sources":["../../src/dex/bancor.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAsD;AAGtD,uDAAmD;AACnD,qEAA2C;AAI3C,MAAM,cAAc,GAAkC;IACpD,CAAC,EAAE,4CAA4C;CAChD,CAAC;AAEF,MAAM,cAAc,GAAkC;IACpD,CAAC,EAAE,4CAA4C;CAChD,CAAC;AAgBF,IAAK,eAEJ;AAFD,WAAK,eAAe;IAClB,wCAAqB,CAAA;AACvB,CAAC,EAFI,eAAe,KAAf,eAAe,QAEnB;AAED,MAAa,MACX,SAAQ,gCAAc;IAMtB,YAAY,SAAqB;QAC/B,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC3B,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAS,CAAC,qBAA2B,CAAC,CAAC;IAC5E,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAgB,EAChB,IAAc;QAEd,IAAI,IAAI,KAAK,oBAAQ,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEhE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAC3C;YACE,YAAY,EAAE;gBACZ,IAAI,EAAE,WAAW;aAClB;SACF,EACD,EAAE,IAAI,EAAE,CACT,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;YAC5C,OAAO;YACP,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAgB,EAChB,IAAc;QAEd,IAAI,IAAI,KAAK,oBAAQ,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEhE,MAAM,WAAW,GAAG;YAClB,IAAI,CAAC,IAAI;YACT,SAAS;YACT,IAAI,CAAC,YAAY,IAAI,GAAG;YACxB,wBAAY;YACZ,GAAG;SACJ,CAAC;QACF,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,CAC9D,UAAU,EACV,WAAW,CACZ,CAAC;QAEF,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,CAAC,aAAa,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CACnD,CAAC;IACJ,CAAC;;AAtEH,wBAuEC;AAnEQ,cAAO,GAAG,CAAC,QAAQ,CAAC,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BebopPricingUpdate = exports.blacklistResponseValidator = exports.tokensResponseValidator = exports.pricesResponseValidator = void 0;
7
7
  const joi_1 = __importDefault(require("joi"));
8
8
  const protobufjs_1 = __importDefault(require("protobufjs"));
9
+ const bebop_json_1 = __importDefault(require("./bebop.json"));
9
10
  const levelValidator = joi_1.default.array().items(joi_1.default.number()).length(2);
10
11
  const pairValidator = joi_1.default.object({
11
12
  bids: joi_1.default.array().items(levelValidator).required(),
@@ -30,8 +31,8 @@ exports.blacklistResponseValidator = joi_1.default.object({
30
31
  });
31
32
  // Original .proto def
32
33
  // const root = protobuf.loadSync(__dirname + '/bebop.proto');
33
- // Use .json to not include .proto files
34
+ // Use .json to not change build step to include .proto files
34
35
  // console.log(JSON.stringify(root.toJSON(), null, 4));
35
- const root = protobufjs_1.default.loadSync(__dirname + '/bebop.json');
36
+ const root = protobufjs_1.default.Root.fromJSON(bebop_json_1.default);
36
37
  exports.BebopPricingUpdate = root.lookupType('bebop.BebopPricingUpdate');
37
38
  //# sourceMappingURL=validators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/dex/bebop/validators.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,4DAAkC;AAElC,MAAM,cAAc,GAAG,aAAG,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,aAAG,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEjE,MAAM,aAAa,GAAG,aAAG,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,aAAG,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAClD,IAAI,EAAE,aAAG,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAClD,cAAc,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,aAAG;KACvC,MAAM,EA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CAAC,CAAC,QAAQ,EAAE;CAC7D,CAAC,CAAC;AAEH,sBAAsB;AACtB,8DAA8D;AAC9D,6DAA6D;AAC7D,uDAAuD;AAEvD,MAAM,IAAI,GAAG,oBAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAc,CAAC,CAAC;AACvC,QAAA,kBAAkB,GAAG,IAAI,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { SwapSide } from '../constants';
3
+ import { AdapterExchangeParam, SimpleExchangeParam } from '../types';
4
+ import { IDexTxBuilder } from './idex';
5
+ import { SimpleExchange } from './simple-exchange';
6
+ import { IDexHelper } from '../dex-helper';
7
+ export declare type CompoundData = {
8
+ fromCToken: boolean;
9
+ };
10
+ declare type CompoundParam = [srcAmount: string];
11
+ export declare class Compound extends SimpleExchange implements IDexTxBuilder<CompoundData, CompoundParam> {
12
+ static dexKeys: string[];
13
+ cethInterface: Interface;
14
+ constructor(dexHelper: IDexHelper);
15
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: CompoundData, side: SwapSide): AdapterExchangeParam;
16
+ getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: CompoundData, side: SwapSide): Promise<SimpleExchangeParam>;
17
+ }
18
+ export {};
@@ -0,0 +1,46 @@
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.Compound = 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 Compound_CETH_json_1 = __importDefault(require("../abi/Compound_CETH.json")); // CETH abi
11
+ const utils_1 = require("../utils");
12
+ var CompoundFunctions;
13
+ (function (CompoundFunctions) {
14
+ CompoundFunctions["redeem"] = "redeem";
15
+ CompoundFunctions["mint"] = "mint";
16
+ })(CompoundFunctions || (CompoundFunctions = {}));
17
+ class Compound extends simple_exchange_1.SimpleExchange {
18
+ constructor(dexHelper) {
19
+ super(dexHelper, 'compound');
20
+ this.cethInterface = new abi_1.Interface(Compound_CETH_json_1.default);
21
+ }
22
+ getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
23
+ const cToken = data.fromCToken ? srcToken : destToken; // Warning
24
+ const payload = this.abiCoder.encodeParameter({
25
+ ParentStruct: {
26
+ cToken: 'address',
27
+ },
28
+ }, { cToken });
29
+ return {
30
+ // target exchange is not used by the contract
31
+ targetExchange: constants_1.NULL_ADDRESS,
32
+ payload,
33
+ networkFee: '0',
34
+ };
35
+ }
36
+ async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
37
+ const cToken = data.fromCToken ? srcToken : destToken;
38
+ const swapData = (0, utils_1.isETHAddress)(srcToken)
39
+ ? this.cethInterface.encodeFunctionData(CompoundFunctions.mint)
40
+ : this.erc20Interface.encodeFunctionData(data.fromCToken ? CompoundFunctions.redeem : CompoundFunctions.mint, [srcAmount]);
41
+ return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, cToken);
42
+ }
43
+ }
44
+ exports.Compound = Compound;
45
+ Compound.dexKeys = ['compound'];
46
+ //# sourceMappingURL=compound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compound.js","sourceRoot":"","sources":["../../src/dex/compound.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAsD;AAGtD,uDAAmD;AACnD,mFAA6C,CAAC,WAAW;AACzD,oCAAwC;AAQxC,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;AACf,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,MAAa,QACX,SAAQ,gCAAc;IAMtB,YAAY,SAAqB;QAC/B,KAAK,CAAC,SAAS,EA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C;AA5DQ,gBAAO,GAAG,CAAC,UAAU,CAAC,CAAC"}
@@ -0,0 +1,58 @@
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 {};