@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
@@ -48,10 +48,10 @@ async function main() {
48
48
 
49
49
  await balancerV3.initializePricing(blocknumber);
50
50
 
51
- // const from = stataUSDC;
52
- // const to = stataUSDT;
53
- const from = usdcAave;
54
- const to = daiAave;
51
+ const from = stataUSDC;
52
+ const to = stataUSDT;
53
+ // const from = daiAave;
54
+ // const to = usdcAave;
55
55
 
56
56
  const pools = await balancerV3.getPoolIdentifiers(
57
57
  from,
@@ -201,6 +201,11 @@
201
201
  "name": "fee",
202
202
  "type": "uint256"
203
203
  },
204
+ {
205
+ "internalType": "uint256",
206
+ "name": "centerPrice",
207
+ "type": "uint256"
208
+ },
204
209
  {
205
210
  "components": [
206
211
  {
@@ -395,6 +400,11 @@
395
400
  "name": "fee",
396
401
  "type": "uint256"
397
402
  },
403
+ {
404
+ "internalType": "uint256",
405
+ "name": "centerPrice",
406
+ "type": "uint256"
407
+ },
398
408
  {
399
409
  "components": [
400
410
  {
@@ -1192,6 +1202,11 @@
1192
1202
  "name": "fee",
1193
1203
  "type": "uint256"
1194
1204
  },
1205
+ {
1206
+ "internalType": "uint256",
1207
+ "name": "centerPrice",
1208
+ "type": "uint256"
1209
+ },
1195
1210
  {
1196
1211
  "components": [
1197
1212
  {
@@ -1392,6 +1407,11 @@
1392
1407
  "name": "fee",
1393
1408
  "type": "uint256"
1394
1409
  },
1410
+ {
1411
+ "internalType": "uint256",
1412
+ "name": "centerPrice",
1413
+ "type": "uint256"
1414
+ },
1395
1415
  {
1396
1416
  "components": [
1397
1417
  {
@@ -1616,6 +1636,11 @@
1616
1636
  "name": "fee",
1617
1637
  "type": "uint256"
1618
1638
  },
1639
+ {
1640
+ "internalType": "uint256",
1641
+ "name": "centerPrice",
1642
+ "type": "uint256"
1643
+ },
1619
1644
  {
1620
1645
  "components": [
1621
1646
  {
@@ -1816,6 +1841,11 @@
1816
1841
  "name": "fee",
1817
1842
  "type": "uint256"
1818
1843
  },
1844
+ {
1845
+ "internalType": "uint256",
1846
+ "name": "centerPrice",
1847
+ "type": "uint256"
1848
+ },
1819
1849
  {
1820
1850
  "components": [
1821
1851
  {
@@ -385,26 +385,6 @@ describe('BalancerV3 E2E', () => {
385
385
  );
386
386
  });
387
387
 
388
- describe('StableSurge Hook', () => {
389
- const tokenASymbol: string = 'waBasGHO';
390
- const tokenBSymbol: string = 'waBasUSDC';
391
-
392
- const tokenAAmount: string = '500000000000000000';
393
- const tokenBAmount: string = '500000';
394
- const nativeTokenAmount = '0';
395
-
396
- testForNetwork(
397
- network,
398
- dexKey,
399
- tokenASymbol,
400
- tokenBSymbol,
401
- tokenAAmount,
402
- tokenBAmount,
403
- nativeTokenAmount,
404
- false,
405
- );
406
- });
407
-
408
388
  // No holders for waBasWETH
409
389
  // describe('Boosted Path', () => {
410
390
  // const tokenASymbol: string = 'waBaswstETH';
@@ -2,9 +2,9 @@
2
2
  import dotenv from 'dotenv';
3
3
  dotenv.config();
4
4
 
5
- import { checkOnChainPricingNonMulti } from './balancer-test-helpers';
5
+ import { Interface, Result } from '@ethersproject/abi';
6
6
  import { DummyDexHelper } from '../../dex-helper/index';
7
- import { Network, SwapSide } from '../../constants';
7
+ import { Network, NULL_ADDRESS, SwapSide } from '../../constants';
8
8
  import { BI_POWS } from '../../bigint-constants';
9
9
  import { BalancerV3 } from './balancer-v3';
10
10
  import {
@@ -13,6 +13,201 @@ import {
13
13
  checkPoolsLiquidity,
14
14
  } from '../../../tests/utils';
15
15
  import { Tokens } from '../../../tests/constants-e2e';
16
+ import { BalancerV3Config } from './config';
17
+ import { BalancerV3Data, Step } from './types';
18
+ import { Address, ExchangePrices, PoolPrices } from '../../types';
19
+ import balancerBatchRouterAbi from '../../abi/balancer-v3/batch-router.json';
20
+ import balancerRouterAbi from '../../abi/balancer-v3/router.json';
21
+
22
+ function getQuerySwapSingleTokenCalldata(
23
+ routerAddress: Address,
24
+ routerInterface: Interface,
25
+ amounts: bigint[],
26
+ step: Step,
27
+ side: SwapSide,
28
+ ) {
29
+ return amounts
30
+ .filter(amount => amount !== 0n)
31
+ .map(amount => {
32
+ return {
33
+ target: routerAddress,
34
+ callData: routerInterface.encodeFunctionData(
35
+ side === SwapSide.SELL
36
+ ? `querySwapSingleTokenExactIn`
37
+ : `querySwapSingleTokenExactOut`,
38
+ [
39
+ step.pool,
40
+ step.swapInput.tokenIn,
41
+ step.swapInput.tokenOut,
42
+ amount,
43
+ NULL_ADDRESS,
44
+ '0x',
45
+ ],
46
+ ),
47
+ };
48
+ });
49
+ }
50
+
51
+ function getQuerySwapMultiTokenCalldata(
52
+ routerAddress: Address,
53
+ routerInterface: Interface,
54
+ amounts: bigint[],
55
+ steps: Step[],
56
+ side: SwapSide,
57
+ ) {
58
+ const tokenIn = steps[0].swapInput.tokenIn;
59
+ const stepsNew = steps.map(s => ({
60
+ pool: s.pool,
61
+ tokenOut: s.swapInput.tokenOut,
62
+ isBuffer: s.isBuffer,
63
+ }));
64
+ return amounts
65
+ .filter(amount => amount !== 0n)
66
+ .map(amount => {
67
+ let args: any[] = [];
68
+ if (side === SwapSide.SELL)
69
+ args = [
70
+ {
71
+ tokenIn,
72
+ steps: stepsNew,
73
+ exactAmountIn: amount,
74
+ minAmountOut: 0n,
75
+ },
76
+ ];
77
+ else
78
+ args = [
79
+ {
80
+ tokenIn,
81
+ steps: stepsNew,
82
+ exactAmountOut: amount,
83
+ maxAmountIn: 0n,
84
+ },
85
+ ];
86
+ return {
87
+ target: routerAddress,
88
+ callData: routerInterface.encodeFunctionData(
89
+ side === SwapSide.SELL ? `querySwapExactIn` : `querySwapExactOut`,
90
+ [args, NULL_ADDRESS, '0x'],
91
+ ),
92
+ };
93
+ });
94
+ }
95
+
96
+ async function querySinglePathPrices(
97
+ network: number,
98
+ side: SwapSide,
99
+ balancerV3: BalancerV3,
100
+ blockNumber: number,
101
+ price: PoolPrices<BalancerV3Data>,
102
+ amounts: bigint[],
103
+ ) {
104
+ const balancerRouter = new Interface(balancerRouterAbi);
105
+ const readerCallData = getQuerySwapSingleTokenCalldata(
106
+ BalancerV3Config.BalancerV3[network].balancerRouterAddress,
107
+ balancerRouter,
108
+ amounts,
109
+ price.data.steps[0],
110
+ side,
111
+ );
112
+
113
+ const expectedPrices = [0n];
114
+ for (const call of readerCallData) {
115
+ try {
116
+ const result = await balancerV3.dexHelper.provider.call(
117
+ {
118
+ to: call.target,
119
+ data: call.callData,
120
+ },
121
+ blockNumber,
122
+ );
123
+ const parsed = balancerRouter.decodeFunctionResult(
124
+ side === SwapSide.SELL
125
+ ? `querySwapSingleTokenExactIn`
126
+ : `querySwapSingleTokenExactOut`,
127
+ result,
128
+ );
129
+ expectedPrices.push(BigInt(parsed[0]._hex));
130
+ } catch (error) {
131
+ console.log('Error in querySinglePathPrices', error);
132
+ expectedPrices.push(0n);
133
+ }
134
+ }
135
+ return expectedPrices;
136
+ }
137
+
138
+ async function queryMultiPathPrices(
139
+ network: number,
140
+ side: SwapSide,
141
+ balancerV3: BalancerV3,
142
+ blockNumber: number,
143
+ price: PoolPrices<BalancerV3Data>,
144
+ amounts: bigint[],
145
+ ) {
146
+ const balancerBatchRouter = new Interface(balancerBatchRouterAbi);
147
+ const readerCallData = getQuerySwapMultiTokenCalldata(
148
+ BalancerV3Config.BalancerV3[network].balancerBatchRouterAddress,
149
+ balancerBatchRouter,
150
+ amounts,
151
+ price.data.steps,
152
+ side,
153
+ );
154
+
155
+ const expectedPrices = [0n];
156
+ for (const call of readerCallData) {
157
+ try {
158
+ const result = await balancerV3.dexHelper.provider.call(
159
+ {
160
+ to: call.target,
161
+ data: call.callData,
162
+ },
163
+ blockNumber,
164
+ );
165
+ const parsed = balancerBatchRouter.decodeFunctionResult(
166
+ side === SwapSide.SELL ? `querySwapExactIn` : `querySwapExactOut`,
167
+ result,
168
+ );
169
+ expectedPrices.push(BigInt(parsed[2][0]._hex));
170
+ } catch (error) {
171
+ console.log('Error in queryMultiPathPrices', error);
172
+ expectedPrices.push(0n);
173
+ }
174
+ }
175
+ return expectedPrices;
176
+ }
177
+
178
+ // Note - this is currently needed because queries won't work with multicall but should be updated in future
179
+ async function checkOnChainPricingNonMulti(
180
+ network: number,
181
+ side: SwapSide,
182
+ balancerV3: BalancerV3,
183
+ blockNumber: number,
184
+ prices: ExchangePrices<BalancerV3Data>,
185
+ amounts: bigint[],
186
+ ) {
187
+ // test match for each returned price
188
+ for (const price of prices) {
189
+ let expectedPrices: bigint[] = [];
190
+ if (price.data.steps.length === 1 && !price.data.steps[0].isBuffer)
191
+ expectedPrices = await querySinglePathPrices(
192
+ network,
193
+ side,
194
+ balancerV3,
195
+ blockNumber,
196
+ price,
197
+ amounts,
198
+ );
199
+ else
200
+ expectedPrices = await queryMultiPathPrices(
201
+ network,
202
+ side,
203
+ balancerV3,
204
+ blockNumber,
205
+ price,
206
+ amounts,
207
+ );
208
+ expect(price.prices).toEqual(expectedPrices);
209
+ }
210
+ }
16
211
 
17
212
  async function testPricingOnNetwork(
18
213
  balancerV3: BalancerV3,
@@ -29,11 +29,6 @@ import {
29
29
  isStableMutableState,
30
30
  } from './stablePool';
31
31
  import { BI_POWS } from '../../bigint-constants';
32
- import {
33
- HookStateMap,
34
- HooksConfigMap,
35
- } from './hooks/balancer-hook-event-subscriber';
36
- import { StableSurge, StableSurgeHookState } from './hooks/stableSurgeHook';
37
32
 
38
33
  export const WAD = BI_POWS[18];
39
34
 
@@ -53,8 +48,8 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
53
48
  interfaces: {
54
49
  [name: string]: Interface;
55
50
  };
51
+
56
52
  vault: Vault;
57
- hooksConfigMap: HooksConfigMap = {};
58
53
 
59
54
  constructor(
60
55
  readonly parentName: string,
@@ -101,10 +96,6 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
101
96
  this.vault = new Vault();
102
97
  }
103
98
 
104
- setHooksConfigMap(hooksConfigMap: HooksConfigMap) {
105
- this.hooksConfigMap = hooksConfigMap;
106
- }
107
-
108
99
  /**
109
100
  * The function is called every time any of the subscribed
110
101
  * addresses release log. The function accepts the current
@@ -143,11 +134,7 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
143
134
  blockNumber: number,
144
135
  ): Promise<DeepReadonly<PoolStateMap>> {
145
136
  const block = await this.dexHelper.provider.getBlock(blockNumber);
146
- const apiPoolStateMap = await getPoolsApi(
147
- this.network,
148
- this.hooksConfigMap,
149
- block.timestamp,
150
- );
137
+ const apiPoolStateMap = await getPoolsApi(this.network, block.timestamp);
151
138
  const allOnChainPools = await getOnChainState(
152
139
  this.network,
153
140
  apiPoolStateMap,
@@ -173,10 +160,7 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
173
160
  existingPoolState: DeepReadonly<PoolStateMap>,
174
161
  ): Promise<DeepReadonly<PoolStateMap> | null> {
175
162
  // Get all latest pools from API
176
- const apiPoolStateMap = await getPoolsApi(
177
- this.network,
178
- this.hooksConfigMap,
179
- );
163
+ const apiPoolStateMap = await getPoolsApi(this.network);
180
164
 
181
165
  // Filter out pools that already exist in existing state
182
166
  const newApiPools = Object.entries(apiPoolStateMap).reduce(
@@ -202,10 +186,19 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
202
186
  this.interfaces,
203
187
  );
204
188
 
189
+ // Filter out pools with hooks and paused pools from new state
190
+ // TODO this won't be necessary once API has this filter option
191
+ const filteredNewPools = Object.entries(newOnChainPools)
192
+ .filter(([_, pool]) => !(pool.hasHook || pool.isPoolPaused))
193
+ .reduce((acc, [address, pool]) => {
194
+ acc[address] = pool;
195
+ return acc;
196
+ }, {} as PoolStateMap);
197
+
205
198
  // Merge existing pools with new pools
206
199
  return {
207
200
  ...existingPoolState,
208
- ...newOnChainPools,
201
+ ...filteredNewPools,
209
202
  };
210
203
  }
211
204
 
@@ -405,7 +398,6 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
405
398
  amountRaw: bigint,
406
399
  swapKind: SwapKind,
407
400
  timestamp: number,
408
- hookStateMap: HookStateMap,
409
401
  ): bigint {
410
402
  if (amountRaw === 0n) return 0n;
411
403
 
@@ -419,12 +411,6 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
419
411
  let outputAmountRaw = 0n;
420
412
  for (const i of indices) {
421
413
  const step = steps[i];
422
-
423
- // If the pool has a hook we fetch latest hook state for use in maths
424
- let hookState = undefined;
425
- if ('hookAddress' in step.poolState && step.poolState.hookAddress)
426
- hookState = hookStateMap[step.poolState.hookAddress];
427
-
428
414
  // If its a Stable Pool with an updating Amp factor calculate current Amp value
429
415
  if (
430
416
  step.poolState.poolType === 'STABLE' &&
@@ -439,16 +425,7 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
439
425
  BigInt(timestamp),
440
426
  );
441
427
  }
442
- // StableSurge hook uses Amp as part of maths
443
- if (step.poolState.hookType === StableSurge.type && hookState)
444
- hookState = {
445
- ...(hookState as StableSurgeHookState)[
446
- step.poolState.poolAddress.toLowerCase()
447
- ],
448
- amp: step.poolState.amp,
449
- };
450
428
  }
451
-
452
429
  outputAmountRaw = this.vault.swap(
453
430
  {
454
431
  ...step.swapInput,
@@ -456,7 +433,6 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
456
433
  swapKind,
457
434
  },
458
435
  step.poolState,
459
- hookState,
460
436
  );
461
437
  // Next step uses output from previous step as input
462
438
  amount = outputAmountRaw;
@@ -27,13 +27,11 @@ import balancerRouterAbi from '../../abi/balancer-v3/router.json';
27
27
  import balancerBatchRouterAbi from '../../abi/balancer-v3/batch-router.json';
28
28
  import { getGasCost } from './getGasCost';
29
29
  import { Block } from '@ethersproject/abstract-provider';
30
- import { BalancerEventHook } from './hooks/balancer-hook-event-subscriber';
31
30
 
32
31
  const MAX_UINT256 =
33
32
  '115792089237316195423570985008687907853269984665640564039457584007913129639935';
34
33
  const POOL_UPDATE_TTL = 1 * 60; // 1min
35
34
  const RATE_UPDATE_TTL = 1 * 60; // 1min
36
- const HOOK_UPDATE_TTL = 5 * 60; // 5min
37
35
 
38
36
  type DeepMutable<T> = {
39
37
  -readonly [P in keyof T]: T[P] extends object ? DeepMutable<T[P]> : T[P];
@@ -41,7 +39,6 @@ type DeepMutable<T> = {
41
39
 
42
40
  export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
43
41
  protected eventPools: BalancerV3EventPool;
44
- protected eventHooks: BalancerEventHook;
45
42
 
46
43
  readonly hasConstantPriceLargeAmounts = false;
47
44
  // Vault can handle native
@@ -57,7 +54,6 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
57
54
  balancerBatchRouter: Interface;
58
55
  updateNewPoolsTimer?: NodeJS.Timeout;
59
56
  updateRatesTimer?: NodeJS.Timeout;
60
- updateHooksTimer?: NodeJS.Timeout;
61
57
 
62
58
  latestBlock?: Block;
63
59
 
@@ -68,12 +64,6 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
68
64
  ) {
69
65
  super(dexHelper, dexKey);
70
66
  this.logger = dexHelper.getLogger(dexKey);
71
- this.eventHooks = new BalancerEventHook(
72
- dexKey,
73
- network,
74
- dexHelper,
75
- this.logger,
76
- );
77
67
  this.eventPools = new BalancerV3EventPool(
78
68
  dexKey,
79
69
  network,
@@ -89,8 +79,6 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
89
79
  // for pricing requests. It is optional for a DEX to
90
80
  // implement this function
91
81
  async initializePricing(blockNumber: number) {
92
- await this.eventHooks.initialize(blockNumber);
93
- this.eventPools.setHooksConfigMap(this.eventHooks.hooksConfigMap);
94
82
  await this.eventPools.initialize(blockNumber);
95
83
 
96
84
  // This will periodically query API and add any new pools to pool state
@@ -114,17 +102,6 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
114
102
  }
115
103
  }, RATE_UPDATE_TTL * 1000);
116
104
  }
117
-
118
- // This will periodically update any hook state that can't be tracked by events
119
- if (!this.updateHooksTimer) {
120
- this.updateHooksTimer = setInterval(async () => {
121
- try {
122
- await this.updateHooksState();
123
- } catch (e) {
124
- this.logger.error(`${this.dexKey}: Failed to update hook state:`, e);
125
- }
126
- }, HOOK_UPDATE_TTL * 1000);
127
- }
128
105
  }
129
106
 
130
107
  getAdapters(side: SwapSide): null {
@@ -284,7 +261,6 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
284
261
  unitAmount,
285
262
  swapKind,
286
263
  block.timestamp,
287
- this.eventHooks.getState(blockNumber) || {},
288
264
  );
289
265
 
290
266
  const poolExchangePrice: PoolPrices<BalancerV3Data> = {
@@ -307,7 +283,6 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
307
283
  amounts[j],
308
284
  swapKind,
309
285
  block.timestamp,
310
- this.eventHooks.getState(blockNumber) || {},
311
286
  );
312
287
  }
313
288
  }
@@ -584,10 +559,6 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
584
559
  await this.eventPools.updateStatePools();
585
560
  }
586
561
 
587
- async updateHooksState(): Promise<void> {
588
- await this.eventHooks.updateHookState();
589
- }
590
-
591
562
  // Returns list of top pools based on liquidity. Max
592
563
  // limit number pools should be returned.
593
564
  async getTopPoolsForToken(
@@ -600,12 +571,7 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
600
571
  })
601
572
  .map(([address]) => address);
602
573
 
603
- const topPools = await getTopPoolsApi(
604
- this.network,
605
- poolsWithToken,
606
- count,
607
- this.eventHooks.hooksConfigMap,
608
- );
574
+ const topPools = await getTopPoolsApi(this.network, poolsWithToken, count);
609
575
 
610
576
  return topPools.map(pool => {
611
577
  const tokens = pool.poolTokens
@@ -644,12 +610,5 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
644
610
  `${this.dexKey}: cleared updateRatesTimer before shutting down`,
645
611
  );
646
612
  }
647
- if (this.updateHooksTimer) {
648
- clearInterval(this.updateHooksTimer);
649
- this.updateHooksTimer = undefined;
650
- this.logger.info(
651
- `${this.dexKey}: cleared updateHooksTimer before shutting down`,
652
- );
653
- }
654
613
  }
655
614
  }
@@ -25,69 +25,30 @@ export const BalancerV3Config: DexConfigMap<DexParams> = {
25
25
  apiNetworkName: 'SEPOLIA',
26
26
  balancerRouterAddress: '0x0BF61f706105EA44694f2e92986bD01C39930280',
27
27
  balancerBatchRouterAddress: '0xC85b652685567C1B074e8c0D4389f83a2E458b1C',
28
- hooks: [
29
- {
30
- type: 'DirectionalFee',
31
- address: '0xd68372e85d8a14afa5fdb3d506bf765939aaf382',
32
- },
33
- {
34
- type: 'StableSurge',
35
- factory: '0x9eB9867C1d4B6fd3a7D0dAd3101b5A153b1107Ec', // Pools with StableSurge hook will always be deployed from this factory
36
- address: '0xc0cbcdd6b823a4f22aa6bbdde44c17e754266aef', // Address of the hook that will be used by pools
37
- },
38
- ],
39
28
  },
40
29
  [Network.GNOSIS]: {
41
30
  vaultAddress: '0xbA1333333333a1BA1108E8412f11850A5C319bA9',
42
31
  apiNetworkName: 'GNOSIS',
43
32
  balancerRouterAddress: '0x84813aA3e079A665C0B80F944427eE83cBA63617',
44
33
  balancerBatchRouterAddress: '0xe2fa4e1d17725e72dcdAfe943Ecf45dF4B9E285b',
45
- hooks: [
46
- {
47
- type: 'StableSurge',
48
- factory: '0x268E2EE1413D768b6e2dc3F5a4ddc9Ae03d9AF42', // Pools with StableSurge hook will always be deployed from this factory
49
- address: '0xe4f1878eC9710846E2B529C1b5037F8bA94583b1', // Address of the hook that will be used by pools
50
- },
51
- ],
52
34
  },
53
35
  [Network.MAINNET]: {
54
36
  vaultAddress: '0xbA1333333333a1BA1108E8412f11850A5C319bA9',
55
37
  apiNetworkName: 'MAINNET',
56
38
  balancerRouterAddress: '0x5C6fb490BDFD3246EB0bB062c168DeCAF4bD9FDd',
57
39
  balancerBatchRouterAddress: '0x136f1EFcC3f8f88516B9E94110D56FDBfB1778d1',
58
- hooks: [
59
- {
60
- type: 'StableSurge',
61
- factory: '0xD53F5d8d926fb2a0f7Be614B16e649B8aC102D83', // Pools with StableSurge hook will always be deployed from this factory
62
- address: '0xb18fA0cb5DE8cecB8899AAE6e38b1B7ed77885dA', // Address of the hook that will be used by pools
63
- },
64
- ],
65
40
  },
66
41
  [Network.ARBITRUM]: {
67
42
  vaultAddress: '0xbA1333333333a1BA1108E8412f11850A5C319bA9',
68
43
  apiNetworkName: 'ARBITRUM',
69
44
  balancerRouterAddress: '0x0f08eEf2C785AA5e7539684aF04755dEC1347b7c',
70
45
  balancerBatchRouterAddress: '0xaD89051bEd8d96f045E8912aE1672c6C0bF8a85E',
71
- hooks: [
72
- {
73
- type: 'StableSurge',
74
- factory: '0x86e67E115f96DF37239E0479441303De0de7bc2b', // Pools with StableSurge hook will always be deployed from this factory
75
- address: '0x0Fa0f9990D7969a7aE6f9961d663E4A201Ed6417', // Address of the hook that will be used by pools
76
- },
77
- ],
78
46
  },
79
47
  [Network.BASE]: {
80
48
  vaultAddress: '0xbA1333333333a1BA1108E8412f11850A5C319bA9',
81
49
  apiNetworkName: 'BASE',
82
50
  balancerRouterAddress: '0x76578ecf9a141296Ec657847fb45B0585bCDa3a6',
83
51
  balancerBatchRouterAddress: '0x85a80afee867aDf27B50BdB7b76DA70f1E853062',
84
- hooks: [
85
- {
86
- type: 'StableSurge',
87
- factory: '0x4fb47126Fa83A8734991E41B942Ac29A3266C968', // Pools with StableSurge hook will always be deployed from this factory
88
- address: '0xb2007B8B7E0260042517f635CFd8E6dD2Dd7f007', // Address of the hook that will be used by pools
89
- },
90
- ],
91
52
  },
92
53
  },
93
54
  };
@@ -10,7 +10,7 @@ import { Interface, Result } from '@ethersproject/abi';
10
10
  import { IDexHelper } from '../../dex-helper';
11
11
  import { WAD } from './balancer-v3-pool';
12
12
 
13
- export interface callData {
13
+ interface callData {
14
14
  target: string;
15
15
  callData: string;
16
16
  }
@@ -161,6 +161,9 @@ const poolOnChain: Record<
161
161
  (r: string) => BigInt(r),
162
162
  ),
163
163
  isPoolPaused: resultIsPoolPaused[0],
164
+ hasHook:
165
+ resultHooksConfig[0].hooksContract !==
166
+ '0x0000000000000000000000000000000000000000',
164
167
  };
165
168
  },
166
169
  },