@paraswap/dex-lib 4.1.4-bal-v3-hooks.0 → 4.1.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 (321) hide show
  1. package/build/abi/Aave_GSM.json +751 -0
  2. package/build/abi/Balancer.json +257 -0
  3. package/build/abi/{balancer-v3/stableSurgeHook.json → BalancerV2.json} +732 -529
  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/fluid-dex/resolver.abi.json +30 -0
  27. package/build/abi/inception/inception-ineth-pool.json +1062 -0
  28. package/build/abi/inception/inception-ineth.json +609 -0
  29. package/build/abi/inception/inception-ratio-feed.json +329 -0
  30. package/build/abi/inception/inception-vault.json +991 -0
  31. package/build/abi/kyberdmm/kyber-storage.abi.json +824 -0
  32. package/build/abi/kyberdmm.abi.json +1148 -0
  33. package/build/abi/maverick-v2/MaverickV2Quoter.json +278 -0
  34. package/build/abi/nerve/nerve-metapool.json +790 -0
  35. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
  36. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +267 -0
  37. package/build/dex/aave-v1/aave-v1.d.ts +2 -1
  38. package/build/dex/aave-v1/aave-v1.js +22 -0
  39. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  40. package/build/dex/balancer-v1/balancer-pools.json +33333 -0
  41. package/build/dex/balancer-v3/balancer-v3-pool.d.ts +1 -4
  42. package/build/dex/balancer-v3/balancer-v3-pool.js +13 -20
  43. package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -1
  44. package/build/dex/balancer-v3/balancer-v3.d.ts +0 -4
  45. package/build/dex/balancer-v3/balancer-v3.js +3 -29
  46. package/build/dex/balancer-v3/balancer-v3.js.map +1 -1
  47. package/build/dex/balancer-v3/config.js +0 -39
  48. package/build/dex/balancer-v3/config.js.map +1 -1
  49. package/build/dex/balancer-v3/getOnChainState.d.ts +2 -1
  50. package/build/dex/balancer-v3/getOnChainState.js +2 -0
  51. package/build/dex/balancer-v3/getOnChainState.js.map +1 -1
  52. package/build/dex/balancer-v3/getPoolsApi.d.ts +1 -2
  53. package/build/dex/balancer-v3/getPoolsApi.js +10 -17
  54. package/build/dex/balancer-v3/getPoolsApi.js.map +1 -1
  55. package/build/dex/balancer-v3/getTopPoolsApi.d.ts +1 -5
  56. package/build/dex/balancer-v3/getTopPoolsApi.js +3 -6
  57. package/build/dex/balancer-v3/getTopPoolsApi.js.map +1 -1
  58. package/build/dex/balancer-v3/types.d.ts +1 -4
  59. package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
  60. package/build/dex/bebop/websocket-fetcher.js +87 -0
  61. package/build/dex/bebop/websocket-fetcher.js.map +1 -0
  62. package/build/dex/fluid-dex/config.js +2 -2
  63. package/build/dex/fluid-dex/constants.d.ts +1 -1
  64. package/build/dex/fluid-dex/constants.js +2 -1
  65. package/build/dex/fluid-dex/constants.js.map +1 -1
  66. package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js +3 -1
  67. package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js.map +1 -1
  68. package/build/dex/fluid-dex/fluid-dex.d.ts +4 -5
  69. package/build/dex/fluid-dex/fluid-dex.js +61 -59
  70. package/build/dex/fluid-dex/fluid-dex.js.map +1 -1
  71. package/build/dex/fluid-dex/types.d.ts +3 -0
  72. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  73. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  74. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  75. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  76. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  77. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  78. package/build/dex/idle-dao/scripts.d.ts +9 -0
  79. package/build/dex/idle-dao/scripts.js +552 -0
  80. package/build/dex/idle-dao/scripts.js.map +1 -0
  81. package/build/dex/inception/config.d.ts +4 -0
  82. package/build/dex/inception/config.js +109 -0
  83. package/build/dex/inception/config.js.map +1 -0
  84. package/build/dex/inception/inception-event-pool.d.ts +16 -0
  85. package/build/dex/inception/inception-event-pool.js +51 -0
  86. package/build/dex/inception/inception-event-pool.js.map +1 -0
  87. package/build/dex/{integral/integral.d.ts → inception/inception-native.d.ts} +21 -19
  88. package/build/dex/inception/inception-native.js +131 -0
  89. package/build/dex/inception/inception-native.js.map +1 -0
  90. package/build/dex/inception/inception-pool.d.ts +18 -0
  91. package/build/dex/inception/inception-pool.js +32 -0
  92. package/build/dex/inception/inception-pool.js.map +1 -0
  93. package/build/dex/inception/inception-price-feed.d.ts +19 -0
  94. package/build/dex/inception/inception-price-feed.js +51 -0
  95. package/build/dex/inception/inception-price-feed.js.map +1 -0
  96. package/build/dex/inception/inception.d.ts +43 -0
  97. package/build/dex/inception/inception.js +204 -0
  98. package/build/dex/inception/inception.js.map +1 -0
  99. package/build/dex/inception/tokens.d.ts +9 -0
  100. package/build/dex/inception/tokens.js +28 -0
  101. package/build/dex/inception/tokens.js.map +1 -0
  102. package/build/dex/inception/types.d.ts +22 -0
  103. package/build/dex/inception/types.js +3 -0
  104. package/build/dex/inception/types.js.map +1 -0
  105. package/build/dex/inception/utils.d.ts +6 -0
  106. package/build/dex/inception/utils.js +37 -0
  107. package/build/dex/inception/utils.js.map +1 -0
  108. package/build/dex/jarvis.d.ts +2 -1
  109. package/build/dex/jarvis.js +58 -0
  110. package/build/dex/jarvis.js.map +1 -1
  111. package/build/dex/platypus/platypus.d.ts +2 -1
  112. package/build/dex/platypus/platypus.js +31 -0
  113. package/build/dex/platypus/platypus.js.map +1 -1
  114. package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
  115. package/build/dex/swaap-v1/swaap-v1.js +10 -0
  116. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  117. package/build/dex/zerox/index.d.ts +4 -26
  118. package/build/dex/zerox/index.js +50 -42
  119. package/build/dex/zerox/index.js.map +1 -1
  120. package/build/dex/zerox/types.d.ts +29 -0
  121. package/build/dex/zerox/types.js +8 -1
  122. package/build/dex/zerox/types.js.map +1 -1
  123. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
  124. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
  125. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
  126. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
  127. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
  128. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
  129. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
  130. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
  131. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
  132. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
  133. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
  134. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
  135. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
  136. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
  137. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
  138. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
  139. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
  140. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
  141. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
  142. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
  143. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
  144. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
  145. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
  146. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
  147. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
  148. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
  149. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
  150. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
  151. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
  152. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
  153. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
  154. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
  155. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
  156. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
  157. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
  158. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
  159. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
  160. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
  161. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
  162. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
  163. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
  164. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
  165. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
  166. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
  167. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
  168. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
  169. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
  170. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
  171. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
  172. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
  173. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
  174. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
  175. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
  176. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
  177. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
  178. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
  179. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
  180. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
  181. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
  182. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
  183. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
  184. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
  185. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
  186. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
  187. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
  188. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
  189. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
  190. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
  191. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
  192. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
  193. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
  194. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
  195. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
  196. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
  197. package/package.json +2 -2
  198. package/scripts/run-dex-integration-v3.ts +4 -4
  199. package/src/abi/fluid-dex/resolver.abi.json +30 -0
  200. package/src/dex/balancer-v3/balancer-v3-e2e.test.ts +0 -20
  201. package/src/dex/balancer-v3/balancer-v3-integration.test.ts +197 -2
  202. package/src/dex/balancer-v3/balancer-v3-pool.ts +13 -37
  203. package/src/dex/balancer-v3/balancer-v3.ts +1 -42
  204. package/src/dex/balancer-v3/config.ts +0 -39
  205. package/src/dex/balancer-v3/getOnChainState.ts +4 -1
  206. package/src/dex/balancer-v3/getPoolsApi.ts +23 -42
  207. package/src/dex/balancer-v3/getTopPoolsApi.ts +2 -13
  208. package/src/dex/balancer-v3/types.ts +2 -4
  209. package/src/dex/fluid-dex/config.ts +2 -2
  210. package/src/dex/fluid-dex/constants.ts +2 -1
  211. package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +61 -117
  212. package/src/dex/fluid-dex/fluid-dex-liquidity-proxy.ts +3 -0
  213. package/src/dex/fluid-dex/fluid-dex.ts +96 -94
  214. package/src/dex/fluid-dex/types.ts +3 -0
  215. package/tests/constants-e2e.ts +2 -7
  216. package/tests/tenderly-simulation.ts +1 -0
  217. package/.idea/aws.xml +0 -17
  218. package/.idea/codeStyles/Project.xml +0 -19
  219. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  220. package/.idea/misc.xml +0 -6
  221. package/.idea/modules.xml +0 -8
  222. package/.idea/paraswap-dex-lib.iml +0 -9
  223. package/.idea/prettier.xml +0 -7
  224. package/.idea/vcs.xml +0 -6
  225. package/build/abi/balancer-v3/directionalFeeHook.json +0 -684
  226. package/build/abi/integral/factory.json +0 -333
  227. package/build/dex/bProtocol.d.ts +0 -18
  228. package/build/dex/bProtocol.js +0 -39
  229. package/build/dex/bProtocol.js.map +0 -1
  230. package/build/dex/balancer-v3/balancer-test-helpers.d.ts +0 -5
  231. package/build/dex/balancer-v3/balancer-test-helpers.js +0 -122
  232. package/build/dex/balancer-v3/balancer-test-helpers.js.map +0 -1
  233. package/build/dex/balancer-v3/hooks/balancer-hook-event-subscriber.d.ts +0 -54
  234. package/build/dex/balancer-v3/hooks/balancer-hook-event-subscriber.js +0 -153
  235. package/build/dex/balancer-v3/hooks/balancer-hook-event-subscriber.js.map +0 -1
  236. package/build/dex/balancer-v3/hooks/directionalFeeHook.d.ts +0 -26
  237. package/build/dex/balancer-v3/hooks/directionalFeeHook.js +0 -41
  238. package/build/dex/balancer-v3/hooks/directionalFeeHook.js.map +0 -1
  239. package/build/dex/balancer-v3/hooks/loadHooksConfig.d.ts +0 -2
  240. package/build/dex/balancer-v3/hooks/loadHooksConfig.js +0 -11
  241. package/build/dex/balancer-v3/hooks/loadHooksConfig.js.map +0 -1
  242. package/build/dex/balancer-v3/hooks/stableSurgeHook.d.ts +0 -39
  243. package/build/dex/balancer-v3/hooks/stableSurgeHook.js +0 -99
  244. package/build/dex/balancer-v3/hooks/stableSurgeHook.js.map +0 -1
  245. package/build/dex/bancor.d.ts +0 -26
  246. package/build/dex/bancor.js +0 -58
  247. package/build/dex/bancor.js.map +0 -1
  248. package/build/dex/compound.d.ts +0 -18
  249. package/build/dex/compound.js +0 -46
  250. package/build/dex/compound.js.map +0 -1
  251. package/build/dex/curve-v2.d.ts +0 -58
  252. package/build/dex/curve-v2.js +0 -180
  253. package/build/dex/curve-v2.js.map +0 -1
  254. package/build/dex/dodo-v1.d.ts +0 -33
  255. package/build/dex/dodo-v1.js +0 -63
  256. package/build/dex/dodo-v1.js.map +0 -1
  257. package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +0 -49
  258. package/build/dex/fluid-dex/fluid-dex-generate-pool.js +0 -104
  259. package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +0 -1
  260. package/build/dex/integral/config.d.ts +0 -4
  261. package/build/dex/integral/config.js +0 -20
  262. package/build/dex/integral/config.js.map +0 -1
  263. package/build/dex/integral/context.d.ts +0 -40
  264. package/build/dex/integral/context.js +0 -158
  265. package/build/dex/integral/context.js.map +0 -1
  266. package/build/dex/integral/integral-factory.d.ts +0 -24
  267. package/build/dex/integral/integral-factory.js +0 -95
  268. package/build/dex/integral/integral-factory.js.map +0 -1
  269. package/build/dex/integral/integral-pool.d.ts +0 -50
  270. package/build/dex/integral/integral-pool.js +0 -149
  271. package/build/dex/integral/integral-pool.js.map +0 -1
  272. package/build/dex/integral/integral-pricing.d.ts +0 -18
  273. package/build/dex/integral/integral-pricing.js +0 -114
  274. package/build/dex/integral/integral-pricing.js.map +0 -1
  275. package/build/dex/integral/integral-relayer.d.ts +0 -42
  276. package/build/dex/integral/integral-relayer.js +0 -192
  277. package/build/dex/integral/integral-relayer.js.map +0 -1
  278. package/build/dex/integral/integral-token.d.ts +0 -27
  279. package/build/dex/integral/integral-token.js +0 -59
  280. package/build/dex/integral/integral-token.js.map +0 -1
  281. package/build/dex/integral/integral.js +0 -376
  282. package/build/dex/integral/integral.js.map +0 -1
  283. package/build/dex/integral/types.d.ts +0 -85
  284. package/build/dex/integral/types.js +0 -9
  285. package/build/dex/integral/types.js.map +0 -1
  286. package/build/dex/integral/utils-e2e.d.ts +0 -9
  287. package/build/dex/integral/utils-e2e.js +0 -131
  288. package/build/dex/integral/utils-e2e.js.map +0 -1
  289. package/build/dex/integral/utils.d.ts +0 -17
  290. package/build/dex/integral/utils.js +0 -94
  291. package/build/dex/integral/utils.js.map +0 -1
  292. package/build/dex/lido.d.ts +0 -19
  293. package/build/dex/lido.js +0 -42
  294. package/build/dex/lido.js.map +0 -1
  295. package/build/dex/onebit.d.ts +0 -25
  296. package/build/dex/onebit.js +0 -42
  297. package/build/dex/onebit.js.map +0 -1
  298. package/build/dex/smoothy.d.ts +0 -26
  299. package/build/dex/smoothy.js +0 -48
  300. package/build/dex/smoothy.js.map +0 -1
  301. package/build/dex/stable-pool.d.ts +0 -28
  302. package/build/dex/stable-pool.js +0 -62
  303. package/build/dex/stable-pool.js.map +0 -1
  304. package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
  305. package/build/dex/trader-joe-v2.1/optimizer.js +0 -47
  306. package/build/dex/trader-joe-v2.1/optimizer.js.map +0 -1
  307. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
  308. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
  309. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
  310. package/build/dex/trader-joe-v2.1.d.ts +0 -43
  311. package/build/dex/trader-joe-v2.1.js +0 -79
  312. package/build/dex/trader-joe-v2.1.js.map +0 -1
  313. package/src/abi/balancer-v3/directionalFeeHook.json +0 -684
  314. package/src/abi/balancer-v3/stableSurgeHook.json +0 -976
  315. package/src/dex/balancer-v3/balancer-hooks-events.test.ts +0 -99
  316. package/src/dex/balancer-v3/balancer-stableSurge.test.ts +0 -110
  317. package/src/dex/balancer-v3/balancer-test-helpers.ts +0 -199
  318. package/src/dex/balancer-v3/hooks/balancer-hook-event-subscriber.ts +0 -226
  319. package/src/dex/balancer-v3/hooks/directionalFeeHook.ts +0 -51
  320. package/src/dex/balancer-v3/hooks/loadHooksConfig.ts +0 -12
  321. package/src/dex/balancer-v3/hooks/stableSurgeHook.ts +0 -163
@@ -1,153 +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.BalancerEventHook = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const utils_1 = require("../../../utils");
10
- const stateful_event_subscriber_1 = require("../../../stateful-event-subscriber");
11
- const loadHooksConfig_1 = require("./loadHooksConfig");
12
- const directionalFeeHook_1 = require("./directionalFeeHook");
13
- const directionalFeeHook_json_1 = __importDefault(require("../../../abi/balancer-v3/directionalFeeHook.json"));
14
- const stableSurgeHook_1 = require("./stableSurgeHook");
15
- const stableSurgeHook_json_1 = __importDefault(require("../../../abi/balancer-v3/stableSurgeHook.json"));
16
- /**
17
- * This will handle events/state for each supported hook contract. State is used during swap calculations.
18
- * Each hook should have its own implementation file for state typing, fetching state and handling events.
19
- */
20
- class BalancerEventHook extends stateful_event_subscriber_1.StatefulEventSubscriber {
21
- parentName;
22
- network;
23
- dexHelper;
24
- handlers = {};
25
- interfaces;
26
- logDecoder;
27
- addressesSubscribed;
28
- hooksConfigMap;
29
- constructor(parentName, network, dexHelper, logger) {
30
- super(parentName, 'Balancer_Hooks', dexHelper, logger);
31
- this.parentName = parentName;
32
- this.network = network;
33
- this.dexHelper = dexHelper;
34
- // Load supported hooks from config file
35
- this.hooksConfigMap = (0, loadHooksConfig_1.loadHooksConfig)(network);
36
- // Add each hook ABI here
37
- this.interfaces = [
38
- new abi_1.Interface(directionalFeeHook_json_1.default),
39
- new abi_1.Interface(stableSurgeHook_json_1.default),
40
- ];
41
- this.logDecoder = (log) => this.combineInterfaces(this.interfaces).parseLog(log);
42
- // Subscribe to all hooks
43
- this.addressesSubscribed = Object.keys(this.hooksConfigMap);
44
- // StableSurgeHook events
45
- this.handlers['ThresholdSurgePercentageChanged'] =
46
- stableSurgeHook_1.thresholdSurgePercentageChangedEvent.bind(this);
47
- this.handlers['MaxSurgeFeePercentageChanged'] =
48
- stableSurgeHook_1.maxSurgeFeePercentageChangedEvent.bind(this);
49
- }
50
- /**
51
- * The function is called every time any of the subscribed
52
- * addresses release log. The function accepts the current
53
- * state, updates the state according to the log, and returns
54
- * the updated state.
55
- * @param state - Current state of event subscriber
56
- * @param log - Log released by one of the subscribed addresses
57
- * @returns Updates state of the event subscriber after the log
58
- */
59
- processLog(state, log) {
60
- try {
61
- const event = this.logDecoder(log);
62
- if (event.name in this.handlers) {
63
- return this.handlers[event.name](event, state, log);
64
- }
65
- }
66
- catch (e) {
67
- (0, utils_1.catchParseLogError)(e, this.logger);
68
- }
69
- return null;
70
- }
71
- /**
72
- * The function generates state using on-chain calls. This
73
- * function is called to regenerate state if the event based
74
- * system fails to fetch events and the local state is no
75
- * more correct.
76
- * @param blockNumber - Blocknumber for which the state should
77
- * should be generated
78
- * @returns state of the event subscriber at blocknumber
79
- */
80
- async generateState(blockNumber) {
81
- // Only hooks that are supported will be called
82
- const hookState = {};
83
- await Promise.all(Object.keys(this.hooksConfigMap).map(async (hookAddress) => {
84
- const hookConfig = this.hooksConfigMap[hookAddress];
85
- if (hookConfig.type === directionalFeeHook_1.DirectionalFee.type) {
86
- hookState[hookAddress] = await (0, directionalFeeHook_1.getDirectionalFeeHookState)();
87
- }
88
- else if (hookConfig.type === stableSurgeHook_1.StableSurge.type) {
89
- hookState[hookAddress] = await (0, stableSurgeHook_1.getStableSurgeHookState)(this.interfaces[1], hookAddress, hookConfig.factory, this.dexHelper, blockNumber);
90
- }
91
- }));
92
- // for (const hookAddress in this.hooksConfigMap) {
93
- // const hookConfig = this.hooksConfigMap[hookAddress];
94
- // if (hookConfig.type === DirectionalFee.type) {
95
- // hookState[hookAddress] = await getDirectionalFeeHookState();
96
- // } else if (hookConfig.type === StableSurge.type) {
97
- // hookState[hookAddress] = await getStableSurgeHookState(
98
- // this.interfaces[1],
99
- // hookAddress,
100
- // hookConfig.factory,
101
- // this.dexHelper,
102
- // blockNumber,
103
- // );
104
- // }
105
- // }
106
- return hookState;
107
- }
108
- async updateHookState() {
109
- // Not all hooks need updated, only ones with settings/state that can't be handled by events
110
- const blockNumber = await this.dexHelper.provider.getBlockNumber();
111
- const currentState = lodash_1.default.cloneDeep(this.getStaleState()) || {};
112
- await Promise.all(Object.keys(this.hooksConfigMap).map(async (hookAddress) => {
113
- const hookConfig = this.hooksConfigMap[hookAddress];
114
- // StableSurge can have new registered pools with associated hook state
115
- if (hookConfig.type === stableSurgeHook_1.StableSurge.type) {
116
- currentState[hookAddress] = await (0, stableSurgeHook_1.getStableSurgeHookState)(this.interfaces[1], hookAddress, hookConfig.factory, this.dexHelper, blockNumber);
117
- }
118
- }));
119
- this.setState(currentState, blockNumber);
120
- }
121
- combineInterfaces = (interfaces) => {
122
- // Use a Map to store unique fragments, keyed by their string representation
123
- const uniqueFragments = new Map();
124
- interfaces.forEach((interfaceInstance) => {
125
- interfaceInstance.fragments.forEach((fragment) => {
126
- let key;
127
- if (fragment instanceof abi_1.FunctionFragment) {
128
- // For functions, use the signature as the key
129
- // This includes name and parameter types
130
- key = fragment.format();
131
- }
132
- else if (fragment instanceof abi_1.EventFragment) {
133
- // For events, use the signature as the key
134
- key = fragment.format();
135
- }
136
- else {
137
- // For other fragment types (like errors), use their string representation
138
- key = fragment.toString();
139
- }
140
- // Only add if we haven't seen this signature before
141
- if (!uniqueFragments.has(key)) {
142
- uniqueFragments.set(key, fragment);
143
- }
144
- });
145
- });
146
- // Convert the Map values back to an array
147
- const dedupedFragments = Array.from(uniqueFragments.values());
148
- // Create a new interface with the deduped fragments
149
- return new abi_1.Interface(dedupedFragments);
150
- };
151
- }
152
- exports.BalancerEventHook = BalancerEventHook;
153
- //# sourceMappingURL=balancer-hook-event-subscriber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"balancer-hook-event-subscriber.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/balancer-hook-event-subscriber.ts"],"names":[],"mappings":";;;;;;AAAA,4CAK4B;AAC5B,oDAAuB;AAGvB,0CAAoD;AACpD,kFAA6E;AAE7E,uDAAoD;AACpD,6DAK8B;AAC9B,+GAA8E;AAC9E,uDAO2B;AAC3B,yGAA+E;AAe/E;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,mDAAqC;IAiB/D;IACC;IACA;IAlBZ,QAAQ,GAMJ,EAAE,CAAC;IAEP,UAAU,CAAc;IACxB,UAAU,CAAoB;IAE9B,mBAAmB,CAAW;IAE9B,cAAc,CAAiB;IAE/B,YACW,UAAkB,EACjB,OAAe,EACf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ACN,0EAA0E;oBAC1E,GAAG,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBAC5B,CAAC;gBAED,oDAAoD;gBACpD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC9B,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,0CAA0C;QAC1C,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;QAE9D,oDAAoD;QACpD,OAAO,IAAI,eAAS,CAAC,gBAAgB,CAAC,CAAC;IACzC,CAAC,CAAC;CACH;AAlLD,8CAkLC"}
@@ -1,26 +0,0 @@
1
- import { Log } from '../../../types';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { HookStateMap } from './balancer-hook-event-subscriber';
4
- export declare const DirectionalFee: {
5
- type: "DirectionalFee";
6
- };
7
- export type DirectionalFeeConfig = {
8
- type: typeof DirectionalFee.type;
9
- address: string;
10
- };
11
- export type DirectionalFeeHookState = {
12
- test: string;
13
- };
14
- /**
15
- * Retrieve any initial hook state required.
16
- * @returns
17
- */
18
- export declare function getDirectionalFeeHookState(): Promise<DirectionalFeeHookState>;
19
- /**
20
- * Handles the event emitted when a new hook is registered.
21
- * @param event
22
- * @param state
23
- * @param log
24
- * @returns
25
- */
26
- export declare function exitFeeHookExampleRegisteredEvent(event: any, state: DeepReadonly<HookStateMap>, log: Readonly<Log>): DeepReadonly<HookStateMap> | null;
@@ -1,41 +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.DirectionalFee = void 0;
7
- exports.getDirectionalFeeHookState = getDirectionalFeeHookState;
8
- exports.exitFeeHookExampleRegisteredEvent = exitFeeHookExampleRegisteredEvent;
9
- /**
10
- * Each supported hook should implement its own version of this file making it easy to retrieve required onchain state.
11
- */
12
- const lodash_1 = __importDefault(require("lodash"));
13
- exports.DirectionalFee = {
14
- type: 'DirectionalFee',
15
- };
16
- /**
17
- * Retrieve any initial hook state required.
18
- * @returns
19
- */
20
- async function getDirectionalFeeHookState() {
21
- // Note - for other hooks this function would retrieve any initial state using onchain calls
22
- return { test: 'initial' };
23
- }
24
- /**
25
- * Handles the event emitted when a new hook is registered.
26
- * @param event
27
- * @param state
28
- * @param log
29
- * @returns
30
- */
31
- function exitFeeHookExampleRegisteredEvent(event, state, log) {
32
- // Note - This is a non-important event but demos the use case. Other hooks would implement this for any state changes required for swap maths.
33
- const hookAddress = event.args.hooksContract.toLowerCase();
34
- if (!state[hookAddress]) {
35
- return null;
36
- }
37
- const newState = lodash_1.default.cloneDeep(state);
38
- newState[hookAddress] = { test: event.args.pool };
39
- return newState;
40
- }
41
- //# sourceMappingURL=directionalFeeHook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directionalFeeHook.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/directionalFeeHook.ts"],"names":[],"mappings":";;;;;;AAyBA,gEAGC;AASD,8EAaC;AAlDD;;GAEG;AACH,oDAAuB;AAKV,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAyB;CAChC,CAAC;AAWF;;;GAGG;AACI,KAAK,UAAU,0BAA0B;IAC9C,4FAA4F;IAC5F,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iCAAiC,CAC/C,KAAU,EACV,KAAiC,EACjC,GAAkB;IAElB,+IAA+I;IAC/I,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;IAC3D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAiB,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAClD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,2 +0,0 @@
1
- import { HooksConfigMap } from './balancer-hook-event-subscriber';
2
- export declare function loadHooksConfig(network: number): HooksConfigMap;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadHooksConfig = loadHooksConfig;
4
- const config_1 = require("./../config");
5
- function loadHooksConfig(network) {
6
- const hooks = config_1.BalancerV3Config.BalancerV3[network].hooks;
7
- if (!hooks)
8
- return {};
9
- return Object.fromEntries(hooks.map(hook => [hook.address.toLowerCase(), hook]));
10
- }
11
- //# sourceMappingURL=loadHooksConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadHooksConfig.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/loadHooksConfig.ts"],"names":[],"mappings":";;AAGA,0CAQC;AAXD,wCAA+C;AAG/C,SAAgB,eAAe,CAAC,OAAe;IAC7C,MAAM,KAAK,GAAG,yBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IAEzD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,OAAO,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC,CACtD,CAAC;AACJ,CAAC"}
@@ -1,39 +0,0 @@
1
- import { Log } from '../../../types';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { HookStateMap } from './balancer-hook-event-subscriber';
4
- import { Interface } from '@ethersproject/abi';
5
- import { IDexHelper } from '../../../dex-helper';
6
- export declare const StableSurge: {
7
- type: "StableSurge";
8
- };
9
- export type StableSurgeConfig = {
10
- type: typeof StableSurge.type;
11
- factory: string;
12
- address: string;
13
- };
14
- export type StableSurgePoolSetting = {
15
- surgeThresholdPercentage: bigint;
16
- maxSurgeFeePercentage: bigint;
17
- };
18
- export type StableSurgeHookState = Record<string, StableSurgePoolSetting>;
19
- /**
20
- * Retrieve any initial hook state required.
21
- * @returns
22
- */
23
- export declare function getStableSurgeHookState(hookInterface: Interface, hookAddress: string, factoryAddress: string, dexHelper: IDexHelper, blockNumber: number): Promise<StableSurgeHookState>;
24
- /**
25
- * Handles the event emitted when threshold surge percentage changed.
26
- * @param event
27
- * @param state
28
- * @param log
29
- * @returns
30
- */
31
- export declare function thresholdSurgePercentageChangedEvent(event: any, state: DeepReadonly<HookStateMap>, log: Readonly<Log>): DeepReadonly<HookStateMap> | null;
32
- /**
33
- * Handles the event emitted when max surge fee percentage changed.
34
- * @param event
35
- * @param state
36
- * @param log
37
- * @returns
38
- */
39
- export declare function maxSurgeFeePercentageChangedEvent(event: any, state: DeepReadonly<HookStateMap>, log: Readonly<Log>): DeepReadonly<HookStateMap> | null;
@@ -1,99 +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.StableSurge = void 0;
7
- exports.getStableSurgeHookState = getStableSurgeHookState;
8
- exports.thresholdSurgePercentageChangedEvent = thresholdSurgePercentageChangedEvent;
9
- exports.maxSurgeFeePercentageChangedEvent = maxSurgeFeePercentageChangedEvent;
10
- const lodash_1 = __importDefault(require("lodash"));
11
- const ethers_1 = require("ethers");
12
- const getOnChainState_1 = require("../getOnChainState");
13
- exports.StableSurge = {
14
- type: 'StableSurge',
15
- };
16
- /**
17
- * Retrieve any initial hook state required.
18
- * @returns
19
- */
20
- async function getStableSurgeHookState(hookInterface, hookAddress, factoryAddress, dexHelper, blockNumber) {
21
- // Find all pools with hook
22
- const resolverContract = new ethers_1.Contract(factoryAddress, ['function getPools() external view returns (address[])'], dexHelper.provider);
23
- const pools = (await resolverContract.callStatic.getPools({
24
- blockTag: blockNumber,
25
- }));
26
- const surgeThresholdCallData = pools.flatMap(pool => {
27
- return [
28
- {
29
- target: hookAddress,
30
- callData: hookInterface.encodeFunctionData('getSurgeThresholdPercentage', [pool]),
31
- },
32
- {
33
- target: hookAddress,
34
- callData: hookInterface.encodeFunctionData('getMaxSurgeFeePercentage', [
35
- pool,
36
- ]),
37
- },
38
- ];
39
- });
40
- // 500 is an arbitrary number chosen based on the blockGasLimit
41
- const slicedMultiCallData = lodash_1.default.chunk(surgeThresholdCallData, 500);
42
- const multicallDataResult = (await Promise.all(slicedMultiCallData.map(async (_multiCallData) => dexHelper.multiContract.methods
43
- .tryAggregate(false, _multiCallData)
44
- .call({}, blockNumber)))).flat();
45
- return mapPoolsToDecodedData(hookInterface, pools, multicallDataResult);
46
- }
47
- function mapPoolsToDecodedData(hookInterface, pools, data) {
48
- return pools.reduce((acc, pool, index) => {
49
- const dataIndex = index * 2;
50
- // Ensure we have enough data
51
- if (dataIndex + 1 >= data.length) {
52
- throw new Error(`Insufficient data for pool ${pool}`);
53
- }
54
- // Decode the corresponding data pairs
55
- const decodedX = (0, getOnChainState_1.decodeThrowError)(hookInterface, 'getSurgeThresholdPercentage', data[dataIndex], 'n/a');
56
- const decodedY = (0, getOnChainState_1.decodeThrowError)(hookInterface, 'getMaxSurgeFeePercentage', data[dataIndex + 1], 'n/a');
57
- // Add to accumulator
58
- acc[pool.toLowerCase()] = {
59
- surgeThresholdPercentage: decodedX[0].toBigInt(),
60
- maxSurgeFeePercentage: decodedY[0].toBigInt(),
61
- };
62
- return acc;
63
- }, {});
64
- }
65
- /**
66
- * Handles the event emitted when threshold surge percentage changed.
67
- * @param event
68
- * @param state
69
- * @param log
70
- * @returns
71
- */
72
- function thresholdSurgePercentageChangedEvent(event, state, log) {
73
- // ThresholdSurgePercentageChanged(pool, newSurgeThresholdPercentage)
74
- const hookAddress = log.address.toLowerCase();
75
- if (!state[hookAddress]) {
76
- return null;
77
- }
78
- const newState = lodash_1.default.cloneDeep(state);
79
- newState[hookAddress][event.args.pool.toLowerCase()].surgeThresholdPercentage = BigInt(event.args.newSurgeThresholdPercentage);
80
- return newState;
81
- }
82
- /**
83
- * Handles the event emitted when max surge fee percentage changed.
84
- * @param event
85
- * @param state
86
- * @param log
87
- * @returns
88
- */
89
- function maxSurgeFeePercentageChangedEvent(event, state, log) {
90
- // MaxSurgeFeePercentageChanged(pool, newMaxSurgeFeePercentage)
91
- const hookAddress = log.address.toLowerCase();
92
- if (!state[hookAddress]) {
93
- return null;
94
- }
95
- const newState = lodash_1.default.cloneDeep(state);
96
- newState[hookAddress][event.args.pool.toLowerCase()].maxSurgeFeePercentage = BigInt(event.args.newMaxSurgeFeePercentage);
97
- return newState;
98
- }
99
- //# sourceMappingURL=stableSurgeHook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stableSurgeHook.js","sourceRoot":"","sources":["../../../../src/dex/balancer-v3/hooks/stableSurgeHook.ts"],"names":[],"mappings":";;;;;;AA8BA,0DAgDC;AA6CD,oFAeC;AASD,8EAeC;AAlKD,oDAAuB;AAKvB,mCAAkC;AAElC,wDAAgE;AAEnD,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,aAAsB;CAC7B,CAAC;AAeF;;;GAGG;AACI,KAAK,UAAU,uBAAuB,CAC3C,aAAwB,EACxB,WAAmB,EACnB,cAAsB,EACtB,SAAqB,EACrB,WAAmB;IAEnB,2BAA2B;IAC3B,MAAM,gBAAgB,GAAG,IAAI,iBAAQ,CACnC,cAAc,EACd,CAAC,uDAAuD,CAAC,EACzD,SAAS,CAAC,QAAQ,CACnB,CAAC;IACF,MAAM,KAAK,GAAG,CAAC,MAAM,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC;QACxD,QAAQ,EAAE,WAAW;KACtB,C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AAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAiB,CAAC;IACnD,QAAQ,CAAC,WAAW,CAA0B,CAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAC9B,CAAC,qBAAqB,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,26 +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 { 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 {};
@@ -1,58 +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.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
@@ -1 +0,0 @@
1
- {"version":3,"file":"bancor.js","sourceRoot":"","sources":["../../src/dex/bancor.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAsD;AAGtD,uDAAmD;AACnD,qE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Y;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"}
@@ -1,18 +0,0 @@
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 {};
@@ -1,46 +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.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
@@ -1 +0,0 @@
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;A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SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,CACP,CAAC;IACJ,CAAC;;AA/DH,4BAgEC;AA5DQ,gBAAO,GAAG,CAAC,UAAU,CAAC,CAAC"}
@@ -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 {};