@paraswap/dex-lib 4.1.19 → 4.1.20

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 (347) hide show
  1. package/build/abi/AaveV1_lending_pool.json +27 -0
  2. package/build/abi/Aave_GSM.json +751 -0
  3. package/build/abi/Balancer.json +257 -0
  4. package/build/abi/BalancerV2.json +1179 -0
  5. package/build/abi/RamsesV2Pool.abi.json +1554 -0
  6. package/build/abi/RamsesV2Quoter.abi.json +274 -0
  7. package/build/abi/USDM.json +807 -0
  8. package/build/abi/UniswapV2Router.json +397 -0
  9. package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +1246 -0
  10. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +509 -0
  11. package/build/abi/curve-v1/CurveBUSDv2.abi.json +1356 -0
  12. package/build/abi/curve-v1/CurveTokenV1.json +305 -0
  13. package/build/abi/curve-v1/CurveTokenV2.json +318 -0
  14. package/build/abi/curve-v1/CurveV1StableNg.json +1452 -0
  15. package/build/abi/curve-v1/CurveV2Swap.json +700 -0
  16. package/build/abi/curve-v1/FactoryCryptoRegistry.json +316 -0
  17. package/build/abi/curve-v1/FactoryRegistry.json +508 -0
  18. package/build/abi/curve-v1/StableSwapAave.json +1152 -0
  19. package/build/abi/curve-v1/StableSwapBUSD.json +814 -0
  20. package/build/abi/curve-v1/StableSwapCompound.json +814 -0
  21. package/build/abi/curve-v1/StableSwapIDLE.json +1253 -0
  22. package/build/abi/curve-v1/StableSwapPax.json +865 -0
  23. package/build/abi/curve-v1/StableSwapSnow.json +900 -0
  24. package/build/abi/curve-v1/StableSwapUSDN.json +1004 -0
  25. package/build/abi/curve-v1/StableSwapUSDT.json +814 -0
  26. package/build/abi/curve-v1/StableSwapY.json +814 -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/platypus/asset.json +490 -0
  36. package/build/abi/platypus/avax-pool.json +820 -0
  37. package/build/abi/platypus/oracle.json +119 -0
  38. package/build/abi/platypus/pool.json +677 -0
  39. package/build/abi/smardex/all/smardex-router.json +648 -0
  40. package/build/abi/smardex/layer-1/smardex-factory.json +242 -0
  41. package/build/abi/smardex/layer-1/smardex-pool.json +506 -0
  42. package/build/abi/smardex/layer-2/smardex-factory.json +185 -0
  43. package/build/abi/smardex/layer-2/smardex-pool.json +578 -0
  44. package/build/abi/swaap-v1/pool.json +1346 -0
  45. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
  46. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +267 -0
  47. package/build/dex/aave-v1/aave-v1.d.ts +34 -0
  48. package/build/dex/aave-v1/aave-v1.js +180 -0
  49. package/build/dex/aave-v1/aave-v1.js.map +1 -0
  50. package/build/dex/aave-v1/config.d.ts +11 -0
  51. package/build/dex/aave-v1/config.js +20 -0
  52. package/build/dex/aave-v1/config.js.map +1 -0
  53. package/build/dex/aave-v1/tokens-mainnet.json +134 -0
  54. package/build/dex/aave-v1/tokens.d.ts +3 -0
  55. package/build/dex/aave-v1/tokens.js +50 -0
  56. package/build/dex/aave-v1/tokens.js.map +1 -0
  57. package/build/dex/aave-v1/types.d.ts +12 -0
  58. package/build/dex/aave-v1/types.js +3 -0
  59. package/build/dex/aave-v1/types.js.map +1 -0
  60. package/build/dex/balancer-v1/balancer-pools.json +33333 -0
  61. package/build/dex/balancer-v3/balancer-test-helpers.d.ts +5 -0
  62. package/build/dex/balancer-v3/balancer-test-helpers.js +25 -1
  63. package/build/dex/balancer-v3/balancer-test-helpers.js.map +1 -1
  64. package/build/dex/balancer-v3/balancer-v3-pool.js +35 -7
  65. package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -1
  66. package/build/dex/balancer-v3/balancer-v3.js +9 -2
  67. package/build/dex/balancer-v3/balancer-v3.js.map +1 -1
  68. package/build/dex/balancer-v3/config.d.ts +2 -1
  69. package/build/dex/balancer-v3/config.js +7 -0
  70. package/build/dex/balancer-v3/config.js.map +1 -1
  71. package/build/dex/balancer-v3/getGasCost.js +3 -0
  72. package/build/dex/balancer-v3/getGasCost.js.map +1 -1
  73. package/build/dex/balancer-v3/getOnChainState.d.ts +5 -1
  74. package/build/dex/balancer-v3/getOnChainState.js +69 -9
  75. package/build/dex/balancer-v3/getOnChainState.js.map +1 -1
  76. package/build/dex/balancer-v3/getPoolsApi.js +45 -7
  77. package/build/dex/balancer-v3/getPoolsApi.js.map +1 -1
  78. package/build/dex/balancer-v3/getTopPoolsApi.d.ts +4 -3
  79. package/build/dex/balancer-v3/getTopPoolsApi.js +17 -6
  80. package/build/dex/balancer-v3/getTopPoolsApi.js.map +1 -1
  81. package/build/dex/balancer-v3/gyroECLPPool.d.ts +11 -0
  82. package/build/dex/balancer-v3/gyroECLPPool.js +6 -0
  83. package/build/dex/balancer-v3/gyroECLPPool.js.map +1 -0
  84. package/build/dex/balancer-v3/hooks/directionalFeeHook.d.ts +2 -0
  85. package/build/dex/balancer-v3/hooks/directionalFeeHook.js +1 -0
  86. package/build/dex/balancer-v3/hooks/directionalFeeHook.js.map +1 -1
  87. package/build/dex/balancer-v3/hooks/stableSurgeHook.d.ts +2 -0
  88. package/build/dex/balancer-v3/hooks/stableSurgeHook.js +1 -0
  89. package/build/dex/balancer-v3/hooks/stableSurgeHook.js.map +1 -1
  90. package/build/dex/balancer-v3/types.d.ts +6 -2
  91. package/build/dex/balancer-v3/utils.d.ts +2 -0
  92. package/build/dex/balancer-v3/utils.js +11 -0
  93. package/build/dex/balancer-v3/utils.js.map +1 -0
  94. package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
  95. package/build/dex/bebop/websocket-fetcher.js +87 -0
  96. package/build/dex/bebop/websocket-fetcher.js.map +1 -0
  97. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  98. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  99. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  100. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  101. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  102. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  103. package/build/dex/idle-dao/scripts.d.ts +9 -0
  104. package/build/dex/idle-dao/scripts.js +552 -0
  105. package/build/dex/idle-dao/scripts.js.map +1 -0
  106. package/build/dex/inception/config.d.ts +4 -0
  107. package/build/dex/inception/config.js +109 -0
  108. package/build/dex/inception/config.js.map +1 -0
  109. package/build/dex/inception/inception-event-pool.d.ts +16 -0
  110. package/build/dex/inception/inception-event-pool.js +51 -0
  111. package/build/dex/inception/inception-event-pool.js.map +1 -0
  112. package/build/dex/inception/inception-native.d.ts +43 -0
  113. package/build/dex/inception/inception-native.js +131 -0
  114. package/build/dex/inception/inception-native.js.map +1 -0
  115. package/build/dex/inception/inception-pool.d.ts +18 -0
  116. package/build/dex/inception/inception-pool.js +32 -0
  117. package/build/dex/inception/inception-pool.js.map +1 -0
  118. package/build/dex/inception/inception-price-feed.d.ts +19 -0
  119. package/build/dex/inception/inception-price-feed.js +51 -0
  120. package/build/dex/inception/inception-price-feed.js.map +1 -0
  121. package/build/dex/inception/inception.d.ts +43 -0
  122. package/build/dex/inception/inception.js +204 -0
  123. package/build/dex/inception/inception.js.map +1 -0
  124. package/build/dex/inception/tokens.d.ts +9 -0
  125. package/build/dex/inception/tokens.js +28 -0
  126. package/build/dex/inception/tokens.js.map +1 -0
  127. package/build/dex/inception/types.d.ts +22 -0
  128. package/build/dex/inception/types.js +3 -0
  129. package/build/dex/inception/types.js.map +1 -0
  130. package/build/dex/inception/utils.d.ts +6 -0
  131. package/build/dex/inception/utils.js +37 -0
  132. package/build/dex/inception/utils.js.map +1 -0
  133. package/build/dex/platypus/asset.d.ts +14 -0
  134. package/build/dex/platypus/asset.js +97 -0
  135. package/build/dex/platypus/asset.js.map +1 -0
  136. package/build/dex/platypus/config.d.ts +11 -0
  137. package/build/dex/platypus/config.js +69 -0
  138. package/build/dex/platypus/config.js.map +1 -0
  139. package/build/dex/platypus/platypus.d.ts +63 -0
  140. package/build/dex/platypus/platypus.js +473 -0
  141. package/build/dex/platypus/platypus.js.map +1 -0
  142. package/build/dex/platypus/pool-avax.d.ts +8 -0
  143. package/build/dex/platypus/pool-avax.js +54 -0
  144. package/build/dex/platypus/pool-avax.js.map +1 -0
  145. package/build/dex/platypus/pool-base.d.ts +19 -0
  146. package/build/dex/platypus/pool-base.js +86 -0
  147. package/build/dex/platypus/pool-base.js.map +1 -0
  148. package/build/dex/platypus/pool-pure.d.ts +8 -0
  149. package/build/dex/platypus/pool-pure.js +37 -0
  150. package/build/dex/platypus/pool-pure.js.map +1 -0
  151. package/build/dex/platypus/pool-subscriber.d.ts +14 -0
  152. package/build/dex/platypus/pool-subscriber.js +167 -0
  153. package/build/dex/platypus/pool-subscriber.js.map +1 -0
  154. package/build/dex/platypus/pool.d.ts +8 -0
  155. package/build/dex/platypus/pool.js +58 -0
  156. package/build/dex/platypus/pool.js.map +1 -0
  157. package/build/dex/platypus/types.d.ts +92 -0
  158. package/build/dex/platypus/types.js +10 -0
  159. package/build/dex/platypus/types.js.map +1 -0
  160. package/build/dex/quickswap/spiritswap-v3.d.ts +6 -0
  161. package/build/dex/quickswap/spiritswap-v3.js +19 -0
  162. package/build/dex/quickswap/spiritswap-v3.js.map +1 -0
  163. package/build/dex/smardex/config.d.ts +4 -0
  164. package/build/dex/smardex/config.js +64 -0
  165. package/build/dex/smardex/config.js.map +1 -0
  166. package/build/dex/smardex/constants.d.ts +18 -0
  167. package/build/dex/smardex/constants.js +33 -0
  168. package/build/dex/smardex/constants.js.map +1 -0
  169. package/build/dex/smardex/sdk/constants.d.ts +6 -0
  170. package/build/dex/smardex/sdk/constants.js +13 -0
  171. package/build/dex/smardex/sdk/constants.js.map +1 -0
  172. package/build/dex/smardex/sdk/core.d.ts +113 -0
  173. package/build/dex/smardex/sdk/core.js +499 -0
  174. package/build/dex/smardex/sdk/core.js.map +1 -0
  175. package/build/dex/smardex/sdk/errors.d.ts +15 -0
  176. package/build/dex/smardex/sdk/errors.js +22 -0
  177. package/build/dex/smardex/sdk/errors.js.map +1 -0
  178. package/build/dex/smardex/sdk/types.d.ts +62 -0
  179. package/build/dex/smardex/sdk/types.js +3 -0
  180. package/build/dex/smardex/sdk/types.js.map +1 -0
  181. package/build/dex/smardex/sdk/utils.d.ts +44 -0
  182. package/build/dex/smardex/sdk/utils.js +133 -0
  183. package/build/dex/smardex/sdk/utils.js.map +1 -0
  184. package/build/dex/smardex/smardex-event-pool.d.ts +28 -0
  185. package/build/dex/smardex/smardex-event-pool.js +119 -0
  186. package/build/dex/smardex/smardex-event-pool.js.map +1 -0
  187. package/build/dex/smardex/smardex.d.ts +65 -0
  188. package/build/dex/smardex/smardex.js +519 -0
  189. package/build/dex/smardex/smardex.js.map +1 -0
  190. package/build/dex/smardex/types.d.ts +55 -0
  191. package/build/dex/smardex/types.js +3 -0
  192. package/build/dex/smardex/types.js.map +1 -0
  193. package/build/dex/solidly/forks-override/cone.d.ts +22 -0
  194. package/build/dex/solidly/forks-override/cone.js +53 -0
  195. package/build/dex/solidly/forks-override/cone.js.map +1 -0
  196. package/build/dex/solidly/forks-override/solisnek.d.ts +8 -0
  197. package/build/dex/solidly/forks-override/solisnek.js +15 -0
  198. package/build/dex/solidly/forks-override/solisnek.js.map +1 -0
  199. package/build/dex/swaap-v1/config.d.ts +17 -0
  200. package/build/dex/swaap-v1/config.js +56 -0
  201. package/build/dex/swaap-v1/config.js.map +1 -0
  202. package/build/dex/swaap-v1/constants.d.ts +6 -0
  203. package/build/dex/swaap-v1/constants.js +17 -0
  204. package/build/dex/swaap-v1/constants.js.map +1 -0
  205. package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +25 -0
  206. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +62 -0
  207. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +1 -0
  208. package/build/dex/swaap-v1/libraries/Const.d.ts +18 -0
  209. package/build/dex/swaap-v1/libraries/Const.js +26 -0
  210. package/build/dex/swaap-v1/libraries/Const.js.map +1 -0
  211. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +77 -0
  212. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +316 -0
  213. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +1 -0
  214. package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +75 -0
  215. package/build/dex/swaap-v1/libraries/LogExpMath.js +418 -0
  216. package/build/dex/swaap-v1/libraries/LogExpMath.js.map +1 -0
  217. package/build/dex/swaap-v1/libraries/MathMMM.d.ts +185 -0
  218. package/build/dex/swaap-v1/libraries/MathMMM.js +453 -0
  219. package/build/dex/swaap-v1/libraries/MathMMM.js.map +1 -0
  220. package/build/dex/swaap-v1/libraries/Num.d.ts +31 -0
  221. package/build/dex/swaap-v1/libraries/Num.js +167 -0
  222. package/build/dex/swaap-v1/libraries/Num.js.map +1 -0
  223. package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +23 -0
  224. package/build/dex/swaap-v1/libraries/PoolQuotations.js +131 -0
  225. package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +1 -0
  226. package/build/dex/swaap-v1/libraries/Struct.d.ts +56 -0
  227. package/build/dex/swaap-v1/libraries/Struct.js +3 -0
  228. package/build/dex/swaap-v1/libraries/Struct.js.map +1 -0
  229. package/build/dex/swaap-v1/swaap-v1-pool.d.ts +45 -0
  230. package/build/dex/swaap-v1/swaap-v1-pool.js +656 -0
  231. package/build/dex/swaap-v1/swaap-v1-pool.js.map +1 -0
  232. package/build/dex/swaap-v1/swaap-v1.d.ts +62 -0
  233. package/build/dex/swaap-v1/swaap-v1.js +379 -0
  234. package/build/dex/swaap-v1/swaap-v1.js.map +1 -0
  235. package/build/dex/swaap-v1/types.d.ts +106 -0
  236. package/build/dex/swaap-v1/types.js +9 -0
  237. package/build/dex/swaap-v1/types.js.map +1 -0
  238. package/build/dex/zerox/index.d.ts +1 -1
  239. package/build/dex/zerox/index.js.map +1 -1
  240. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
  241. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
  242. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
  243. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
  244. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
  245. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
  246. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
  247. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
  248. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
  249. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
  250. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
  251. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
  252. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
  253. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
  254. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
  255. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
  256. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
  257. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
  258. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
  259. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
  260. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
  261. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
  262. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
  263. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
  264. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
  265. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
  266. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
  267. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
  268. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
  269. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
  270. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
  271. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
  272. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
  273. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
  274. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
  275. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
  276. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
  277. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
  278. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
  279. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
  280. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
  281. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
  282. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
  283. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
  284. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
  285. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
  286. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
  287. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
  288. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
  289. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
  290. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
  291. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
  292. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
  293. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
  294. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
  295. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
  296. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
  297. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
  298. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
  299. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
  300. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
  301. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
  302. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
  303. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
  304. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
  305. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
  306. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
  307. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
  308. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
  309. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
  310. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
  311. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
  312. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
  313. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
  314. package/package.json +2 -2
  315. package/src/dex/balancer-v3/balancer-api.test.ts +122 -0
  316. package/src/dex/balancer-v3/balancer-buffer.test.ts +75 -0
  317. package/src/dex/balancer-v3/balancer-gyroECLP.test.ts +76 -0
  318. package/src/dex/balancer-v3/balancer-stableSurge.test.ts +54 -52
  319. package/src/dex/balancer-v3/balancer-test-helpers.ts +52 -0
  320. package/src/dex/balancer-v3/balancer-test-weighted.test.ts +96 -0
  321. package/src/dex/balancer-v3/balancer-v3-e2e.test.ts +49 -2
  322. package/src/dex/balancer-v3/balancer-v3-events.test.ts +162 -1
  323. package/src/dex/balancer-v3/balancer-v3-pool.ts +50 -15
  324. package/src/dex/balancer-v3/balancer-v3.ts +14 -4
  325. package/src/dex/balancer-v3/config.ts +7 -0
  326. package/src/dex/balancer-v3/getGasCost.ts +3 -0
  327. package/src/dex/balancer-v3/getOnChainState.ts +101 -12
  328. package/src/dex/balancer-v3/getPoolsApi.ts +55 -12
  329. package/src/dex/balancer-v3/getTopPoolsApi.ts +29 -11
  330. package/src/dex/balancer-v3/gyroECLPPool.ts +17 -0
  331. package/src/dex/balancer-v3/hooks/directionalFeeHook.ts +2 -0
  332. package/src/dex/balancer-v3/hooks/stableSurgeHook.ts +2 -0
  333. package/src/dex/balancer-v3/types.ts +6 -2
  334. package/src/dex/balancer-v3/utils.ts +11 -0
  335. package/tests/constants-e2e.ts +9 -0
  336. package/tests/token-storage-slots.json +40 -0
  337. package/.idea/codeStyles/Project.xml +0 -59
  338. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  339. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  340. package/.idea/modules.xml +0 -8
  341. package/.idea/paraswap-dex-lib.iml +0 -12
  342. package/.idea/prettier.xml +0 -7
  343. package/.idea/vcs.xml +0 -6
  344. package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +0 -94
  345. package/build/dex/uniswap-v3/uniswap-v3-new.js +0 -923
  346. package/build/dex/uniswap-v3/uniswap-v3-new.js.map +0 -1
  347. package/scripts/get-uniswap-v3-dexes.ts +0 -64
@@ -0,0 +1,96 @@
1
+ // npx jest src/dex/balancer-v3/balancer-test-weighted.test.ts
2
+ import dotenv from 'dotenv';
3
+ dotenv.config();
4
+ import { Tokens } from '../../../tests/constants-e2e';
5
+ import { Network, SwapSide } from '../../constants';
6
+ import { DummyDexHelper } from '../../dex-helper';
7
+ import { BalancerV3 } from './balancer-v3';
8
+ import {
9
+ allPricesAreZero,
10
+ checkOnChainPricingNonMulti,
11
+ } from './balancer-test-helpers';
12
+ import { ExchangePrices, Token } from '../../types';
13
+ import { BalancerV3Data } from './types';
14
+
15
+ const dexKey = 'BalancerV3';
16
+ const blockNumber = 27675048;
17
+ let balancerV3: BalancerV3;
18
+ const network = Network.BASE;
19
+ const dexHelper = new DummyDexHelper(network);
20
+ const tokens = Tokens[network];
21
+ const usdc = tokens['USDC'];
22
+ const weth = tokens['WETH'];
23
+ // https://basescan.org/address/0x0657c3467f3bf465fab59b10f1453d665abe507e
24
+ const weightedPool = '0x0657c3467f3bf465fab59b10f1453d665abe507e'.toLowerCase();
25
+
26
+ describe('BalancerV3 Weighted pool tests', function () {
27
+ beforeAll(async () => {
28
+ balancerV3 = new BalancerV3(network, dexKey, dexHelper);
29
+ if (balancerV3.initializePricing) {
30
+ await balancerV3.initializePricing(blockNumber);
31
+ }
32
+ });
33
+
34
+ describe('pool should be returned', function () {
35
+ it('getPoolIdentifiers', async function () {
36
+ const pools = await balancerV3.getPoolIdentifiers(
37
+ weth,
38
+ usdc,
39
+ SwapSide.SELL,
40
+ blockNumber,
41
+ );
42
+ expect(pools.some(pool => pool === weightedPool)).toBe(true);
43
+ });
44
+
45
+ it('getTopPoolsForToken', async function () {
46
+ const pools = await balancerV3.getTopPoolsForToken(weth.address, 100);
47
+ expect(pools.some(pool => pool.address === weightedPool)).toBe(true);
48
+ });
49
+ });
50
+
51
+ describe('should match onchain pricing', function () {
52
+ it('SELL', async function () {
53
+ const amounts = [0n, 3000000000000000n];
54
+ const side = SwapSide.SELL;
55
+ await testPricesVsOnchain(amounts, weth, usdc, side, blockNumber, [
56
+ weightedPool,
57
+ ]);
58
+ });
59
+ it('BUY', async function () {
60
+ const amounts = [0n, 5000000n];
61
+ const side = SwapSide.BUY;
62
+ await testPricesVsOnchain(amounts, weth, usdc, side, blockNumber, [
63
+ weightedPool,
64
+ ]);
65
+ });
66
+ });
67
+ });
68
+
69
+ async function testPricesVsOnchain(
70
+ amounts: bigint[],
71
+ srcToken: Token,
72
+ dstToken: Token,
73
+ side: SwapSide,
74
+ blockNumber: number,
75
+ limitPools: string[],
76
+ ) {
77
+ const prices = await balancerV3.getPricesVolume(
78
+ srcToken,
79
+ dstToken,
80
+ amounts,
81
+ side,
82
+ blockNumber,
83
+ limitPools,
84
+ );
85
+ expect(prices).not.toBeNull();
86
+ expect(prices?.length).toBeGreaterThan(0);
87
+ expect(allPricesAreZero(prices!)).toBe(false);
88
+ await checkOnChainPricingNonMulti(
89
+ network,
90
+ side,
91
+ balancerV3,
92
+ blockNumber,
93
+ prices as ExchangePrices<BalancerV3Data>,
94
+ amounts,
95
+ );
96
+ }
@@ -60,6 +60,7 @@ function testForNetwork(
60
60
  tokenBAmount: string,
61
61
  nativeTokenAmount: string,
62
62
  testNative: boolean,
63
+ poolIds?: string[],
63
64
  ) {
64
65
  const provider = new StaticJsonRpcProvider(
65
66
  generateConfig(network).privateHttpProvider,
@@ -69,7 +70,8 @@ function testForNetwork(
69
70
  const holders = Holders[network];
70
71
  const nativeTokenSymbol = NativeTokenSymbols[network];
71
72
 
72
- // TODO: Add any direct swap contractMethod name if it exists
73
+ const poolIdentifiers = poolIds ? { [dexKey]: poolIds } : undefined;
74
+
73
75
  const sideToContractMethods = new Map([
74
76
  [SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
75
77
  [SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
@@ -92,6 +94,7 @@ function testForNetwork(
92
94
  contractMethod,
93
95
  network,
94
96
  provider,
97
+ poolIdentifiers,
95
98
  );
96
99
  });
97
100
  it(`${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
@@ -105,6 +108,7 @@ function testForNetwork(
105
108
  contractMethod,
106
109
  network,
107
110
  provider,
111
+ poolIdentifiers,
108
112
  );
109
113
  });
110
114
  }
@@ -119,6 +123,7 @@ function testForNetwork(
119
123
  contractMethod,
120
124
  network,
121
125
  provider,
126
+ poolIdentifiers,
122
127
  );
123
128
  });
124
129
  it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
@@ -132,6 +137,7 @@ function testForNetwork(
132
137
  contractMethod,
133
138
  network,
134
139
  provider,
140
+ poolIdentifiers,
135
141
  );
136
142
  });
137
143
  });
@@ -145,7 +151,7 @@ function testForNetwork(
145
151
  describe('BalancerV3 E2E', () => {
146
152
  const dexKey = 'BalancerV3';
147
153
 
148
- describe('Sepolia', () => {
154
+ describe.skip('Sepolia', () => {
149
155
  const network = Network.SEPOLIA;
150
156
 
151
157
  describe('Weighted Path', () => {
@@ -207,6 +213,27 @@ describe('BalancerV3 E2E', () => {
207
213
  false,
208
214
  );
209
215
  });
216
+
217
+ describe('GyroE Path', () => {
218
+ const tokenASymbol: string = 'bal';
219
+ const tokenBSymbol: string = 'DAI';
220
+
221
+ const tokenAAmount: string = '100000000000';
222
+ const tokenBAmount: string = '100000000000';
223
+ const nativeTokenAmount = '0';
224
+
225
+ testForNetwork(
226
+ network,
227
+ dexKey,
228
+ tokenASymbol,
229
+ tokenBSymbol,
230
+ tokenAAmount,
231
+ tokenBAmount,
232
+ nativeTokenAmount,
233
+ false,
234
+ ['0x80fd5bc9d4fa6c22132f8bb2d9d30b01c3336fb3'],
235
+ );
236
+ });
210
237
  });
211
238
 
212
239
  describe('Gnosis', () => {
@@ -345,6 +372,26 @@ describe('BalancerV3 E2E', () => {
345
372
  describe('Base', () => {
346
373
  const network = Network.BASE;
347
374
 
375
+ describe('FAILED_CASE', () => {
376
+ const tokenASymbol: string = 'WETH';
377
+ const tokenBSymbol: string = 'USDC';
378
+
379
+ const tokenAAmount: string = '300000000000000';
380
+ const tokenBAmount: string = '100000000';
381
+ const nativeTokenAmount = '0';
382
+
383
+ testForNetwork(
384
+ network,
385
+ dexKey,
386
+ tokenASymbol,
387
+ tokenBSymbol,
388
+ tokenAAmount,
389
+ tokenBAmount,
390
+ nativeTokenAmount,
391
+ false,
392
+ );
393
+ });
394
+
348
395
  describe('Stable Path', () => {
349
396
  const tokenASymbol: string = 'wstETH';
350
397
  const tokenBSymbol: string = 'WETH';
@@ -130,7 +130,7 @@ type EventData = { blockNumbers: number[]; poolAddress: string[] };
130
130
  describe('BalancerV3 EventPool', function () {
131
131
  const dexKey = 'BalancerV3';
132
132
 
133
- describe('Sepolia', function () {
133
+ describe.skip('Sepolia', function () {
134
134
  const network = Network.SEPOLIA;
135
135
  const dexHelper = new DummyDexHelper(network);
136
136
  const logger = dexHelper.getLogger(dexKey);
@@ -293,4 +293,165 @@ describe('BalancerV3 EventPool', function () {
293
293
  },
294
294
  );
295
295
  });
296
+
297
+ describe('Mainnet:0x6b49054c350b47ca9aa1331ab156a1eedbe94e79', function () {
298
+ const network = Network.MAINNET;
299
+ const dexHelper = new DummyDexHelper(network);
300
+ const logger = dexHelper.getLogger(dexKey);
301
+ let balancerV3Pool: BalancerV3EventPool;
302
+
303
+ // vault -> EventMappings
304
+ // TODO once we have a new test deployment add tests for: AggregateSwapFeePercentageChanged, SwapFeePercentageChanged, PoolPausedStateChanged
305
+ const eventsToTest: Record<Address, EventMappings> = {
306
+ [BalancerV3Config.BalancerV3[network].vaultAddress]: {
307
+ LiquidityAdded: {
308
+ blockNumbers: [21774068],
309
+ poolAddress: ['0x6b49054c350b47ca9aa1331ab156a1eedbe94e79'],
310
+ },
311
+ LiquidityRemoved: {
312
+ blockNumbers: [21788910],
313
+ poolAddress: ['0x6b49054c350b47ca9aa1331ab156a1eedbe94e79'],
314
+ },
315
+ Swap: {
316
+ blockNumbers: [21788638, 21791514, 21791514],
317
+ poolAddress: [
318
+ '0x6b49054c350b47ca9aa1331ab156a1eedbe94e79',
319
+ '0x6b49054c350b47ca9aa1331ab156a1eedbe94e79',
320
+ '0x6b49054c350b47ca9aa1331ab156a1eedbe94e79',
321
+ ],
322
+ },
323
+ },
324
+ };
325
+
326
+ beforeEach(async () => {
327
+ balancerV3Pool = new BalancerV3EventPool(
328
+ dexKey,
329
+ network,
330
+ dexHelper,
331
+ logger,
332
+ );
333
+ });
334
+
335
+ Object.entries(eventsToTest).forEach(
336
+ ([vaultAddress, events]: [string, EventMappings]) => {
337
+ describe(`Events for Vault: ${vaultAddress}`, () => {
338
+ Object.entries(events).forEach(
339
+ ([eventName, eventData]: [string, EventData]) => {
340
+ describe(`${eventName}`, () => {
341
+ eventData.blockNumbers.forEach((blockNumber: number, i) => {
342
+ it(`Pool: ${eventData.poolAddress[i]} State after ${blockNumber}`, async function () {
343
+ await testEventSubscriber(
344
+ balancerV3Pool,
345
+ balancerV3Pool.addressesSubscribed,
346
+ (_blockNumber: number) =>
347
+ fetchPoolState(
348
+ balancerV3Pool,
349
+ _blockNumber,
350
+ eventData.poolAddress[i],
351
+ ),
352
+ blockNumber,
353
+ `${dexKey}_${vaultAddress}`,
354
+ dexHelper.provider,
355
+ stateCompare,
356
+ );
357
+ });
358
+ });
359
+ });
360
+ },
361
+ );
362
+ });
363
+ },
364
+ );
365
+ });
366
+
367
+ describe('Base_selected_blocks', function () {
368
+ const network = Network.BASE;
369
+ const dexHelper = new DummyDexHelper(network);
370
+ const logger = dexHelper.getLogger(dexKey);
371
+ let balancerV3Pool: BalancerV3EventPool;
372
+
373
+ const blocksToCheck = [
374
+ 27674270, 27674570, 27674574, 27674788, 27674853, 27674886, 27674931,
375
+ ];
376
+
377
+ const vaultAddress = BalancerV3Config.BalancerV3[network].vaultAddress;
378
+
379
+ beforeEach(async () => {
380
+ balancerV3Pool = new BalancerV3EventPool(
381
+ dexKey,
382
+ network,
383
+ dexHelper,
384
+ logger,
385
+ );
386
+ });
387
+
388
+ describe(`Events for Vault: ${vaultAddress} ${blocksToCheck.length} blocks`, () => {
389
+ for (const blockNumber of blocksToCheck) {
390
+ it(`Check state for block ${blockNumber}`, async function () {
391
+ await testEventSubscriber(
392
+ balancerV3Pool,
393
+ balancerV3Pool.addressesSubscribed,
394
+ (_blockNumber: number) =>
395
+ fetchPoolState(
396
+ balancerV3Pool,
397
+ _blockNumber,
398
+ '0x0657c3467f3bf465fab59b10f1453d665abe507e',
399
+ ),
400
+ blockNumber,
401
+ `${dexKey}_${vaultAddress}`,
402
+ dexHelper.provider,
403
+ stateCompare,
404
+ );
405
+ });
406
+ }
407
+ });
408
+ });
409
+
410
+ // If need to run through block interval up to a block number
411
+ // describe.skip('Base', function () {
412
+ // const network = Network.BASE;
413
+ // const dexHelper = new DummyDexHelper(network);
414
+ // const logger = dexHelper.getLogger(dexKey);
415
+ // let balancerV3Pool: BalancerV3EventPool;
416
+
417
+ // const END_BLOCK = 27675048;
418
+ // const BLOCKS_TO_CHECK = 1000;
419
+ // const START_BLOCK = END_BLOCK - BLOCKS_TO_CHECK;
420
+
421
+ // const vaultAddress = BalancerV3Config.BalancerV3[network].vaultAddress;
422
+
423
+ // beforeEach(async () => {
424
+ // balancerV3Pool = new BalancerV3EventPool(
425
+ // dexKey,
426
+ // network,
427
+ // dexHelper,
428
+ // logger,
429
+ // );
430
+ // });
431
+
432
+ // describe(`Events for Vault: ${vaultAddress} blocks ${START_BLOCK} to ${END_BLOCK}`, () => {
433
+ // for (
434
+ // let blockNumber = START_BLOCK;
435
+ // blockNumber <= END_BLOCK;
436
+ // blockNumber++
437
+ // ) {
438
+ // it(`Check state for block ${blockNumber}`, async function () {
439
+ // await testEventSubscriber(
440
+ // balancerV3Pool,
441
+ // balancerV3Pool.addressesSubscribed,
442
+ // (_blockNumber: number) =>
443
+ // fetchPoolState(
444
+ // balancerV3Pool,
445
+ // _blockNumber,
446
+ // '0x0657c3467f3bf465fab59b10f1453d665abe507e',
447
+ // ),
448
+ // blockNumber,
449
+ // `${dexKey}_${vaultAddress}`,
450
+ // dexHelper.provider,
451
+ // stateCompare,
452
+ // );
453
+ // });
454
+ // }
455
+ // });
456
+ // });
296
457
  });
@@ -77,6 +77,8 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
77
77
  ]),
78
78
  ['ERC4626']: new Interface([
79
79
  'function convertToAssets(uint256 shares) external view returns (uint256 assets)',
80
+ 'function maxDeposit(address receiver) external view returns (uint256 maxAssets)',
81
+ 'function maxMint(address receiver) external view returns (uint256 maxShares)',
80
82
  ]),
81
83
  };
82
84
 
@@ -463,16 +465,20 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
463
465
  };
464
466
  }
465
467
  }
466
-
467
- outputAmountRaw = this.vault.swap(
468
- {
469
- ...step.swapInput,
470
- amountRaw: amount,
471
- swapKind,
472
- },
473
- step.poolState,
474
- hookState,
475
- );
468
+ // try/catch as the swap can fail for e.g. wrapAmountTooSmall, etc
469
+ try {
470
+ outputAmountRaw = this.vault.swap(
471
+ {
472
+ ...step.swapInput,
473
+ amountRaw: amount,
474
+ swapKind,
475
+ },
476
+ step.poolState,
477
+ hookState,
478
+ );
479
+ } catch (err) {
480
+ outputAmountRaw = 0n;
481
+ }
476
482
  // Next step uses output from previous step as input
477
483
  amount = outputAmountRaw;
478
484
  }
@@ -502,10 +508,23 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
502
508
  const poolRates = await this.getPoolRates(poolState);
503
509
 
504
510
  // Update each pools rate
505
- poolRates.forEach(({ poolAddress, tokenRates, erc4626Rates }, i) => {
506
- poolState[poolAddress].tokenRates = tokenRates;
507
- poolState[poolAddress].erc4626Rates = erc4626Rates;
508
- });
511
+ poolRates.forEach(
512
+ (
513
+ {
514
+ poolAddress,
515
+ tokenRates,
516
+ erc4626Rates,
517
+ erc4626MaxDeposit,
518
+ erc4626MaxMint,
519
+ },
520
+ i,
521
+ ) => {
522
+ poolState[poolAddress].tokenRates = tokenRates;
523
+ poolState[poolAddress].erc4626Rates = erc4626Rates;
524
+ poolState[poolAddress].erc4626MaxDeposit = erc4626MaxDeposit;
525
+ poolState[poolAddress].erc4626MaxMint = erc4626MaxMint;
526
+ },
527
+ );
509
528
 
510
529
  // Update state
511
530
  const blockNumber = await this.dexHelper.provider.getBlockNumber();
@@ -572,7 +591,15 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
572
591
  tokenRates: tokenRateResult.tokenRates.map((r: string) => BigInt(r)),
573
592
  erc4626Rates: poolState[address].tokens.map(t => {
574
593
  if (!tokensWithRates[t]) return null;
575
- return tokensWithRates[t];
594
+ return tokensWithRates[t].rate;
595
+ }),
596
+ erc4626MaxDeposit: poolState[address].tokens.map(t => {
597
+ if (!tokensWithRates[t]) return null;
598
+ return tokensWithRates[t].maxDeposit;
599
+ }),
600
+ erc4626MaxMint: poolState[address].tokens.map(t => {
601
+ if (!tokensWithRates[t]) return null;
602
+ return tokensWithRates[t].maxMint;
576
603
  }),
577
604
  };
578
605
  });
@@ -594,6 +621,8 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
594
621
  underlyingToken: null,
595
622
  index: tokenIndex,
596
623
  rate: poolState.tokenRates[tokenIndex],
624
+ maxDeposit: 0n, // N/A As non-erc4626
625
+ maxMint: 0n,
597
626
  };
598
627
  }
599
628
 
@@ -616,6 +645,8 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
616
645
  underlyingToken: tokenAddress,
617
646
  index: tokenIndex,
618
647
  rate: poolState.erc4626Rates[tokenIndex]!,
648
+ maxDeposit: poolState.erc4626MaxDeposit[tokenIndex]!,
649
+ maxMint: poolState.erc4626MaxMint[tokenIndex]!,
619
650
  };
620
651
  }
621
652
  }
@@ -702,6 +733,8 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
702
733
  rate: token.rate,
703
734
  poolAddress: token.mainToken,
704
735
  tokens: [token.mainToken, token.underlyingToken], // staticToken & underlying
736
+ maxDeposit: token.maxDeposit,
737
+ maxMint: token.maxMint,
705
738
  },
706
739
  };
707
740
  }
@@ -725,6 +758,8 @@ export class BalancerV3EventPool extends StatefulEventSubscriber<PoolStateMap> {
725
758
  rate: token.rate,
726
759
  poolAddress: token.mainToken,
727
760
  tokens: [token.mainToken, token.underlyingToken], // staticToken & underlying
761
+ maxDeposit: token.maxDeposit,
762
+ maxMint: token.maxMint,
728
763
  },
729
764
  };
730
765
  }
@@ -313,10 +313,20 @@ export class BalancerV3 extends SimpleExchange implements IDex<BalancerV3Data> {
313
313
  }
314
314
  poolPrices.push(poolExchangePrice);
315
315
  } catch (err) {
316
- this.logger.error(
317
- `error fetching prices for pool: ${pool.poolAddress}`,
318
- );
319
- this.logger.error(err);
316
+ const errorMessage =
317
+ err instanceof Error ? `error: ${err.message}` : `error: ${err}`;
318
+ const stack = err instanceof Error ? err.stack : '';
319
+ // Ignore some sort of errors
320
+ // minimum trade amount - https://github.com/balancer/balancer-maths/blob/main/typescript/src/vault/vault.ts#L39
321
+ // wrapAmountTooSmall - https://github.com/balancer/balancer-maths/blob/main/typescript/src/buffer/erc4626BufferWrapOrUnwrap.ts#L17
322
+ if (
323
+ !errorMessage.includes('TradeAmountTooSmall') &&
324
+ !errorMessage.includes('wrapAmountTooSmall')
325
+ ) {
326
+ this.logger.error(
327
+ `error fetching prices for pool: ${pool.poolAddress}, msg: ${errorMessage}, stack: ${stack}`,
328
+ );
329
+ }
320
330
  }
321
331
  }
322
332
 
@@ -6,6 +6,7 @@ import { Network, SwapSide } from '../../constants';
6
6
  export enum SUPPORTED_POOLS {
7
7
  WEIGHTED = 'WEIGHTED',
8
8
  STABLE = 'STABLE',
9
+ GYROE = 'GYROE',
9
10
  }
10
11
 
11
12
  export const disabledPoolIds: Record<string, Record<number, string[]>> = {
@@ -28,10 +29,12 @@ export const BalancerV3Config: DexConfigMap<DexParams> = {
28
29
  hooks: [
29
30
  {
30
31
  type: 'DirectionalFee',
32
+ apiName: 'DIRECTIONAL_FEE',
31
33
  address: '0xd68372e85d8a14afa5fdb3d506bf765939aaf382',
32
34
  },
33
35
  {
34
36
  type: 'StableSurge',
37
+ apiName: 'STABLE_SURGE',
35
38
  factory: '0x9eB9867C1d4B6fd3a7D0dAd3101b5A153b1107Ec', // Pools with StableSurge hook will always be deployed from this factory
36
39
  address: '0xc0cbcdd6b823a4f22aa6bbdde44c17e754266aef', // Address of the hook that will be used by pools
37
40
  },
@@ -45,6 +48,7 @@ export const BalancerV3Config: DexConfigMap<DexParams> = {
45
48
  hooks: [
46
49
  {
47
50
  type: 'StableSurge',
51
+ apiName: 'STABLE_SURGE',
48
52
  factory: '0x268E2EE1413D768b6e2dc3F5a4ddc9Ae03d9AF42', // Pools with StableSurge hook will always be deployed from this factory
49
53
  address: '0xe4f1878eC9710846E2B529C1b5037F8bA94583b1', // Address of the hook that will be used by pools
50
54
  },
@@ -58,6 +62,7 @@ export const BalancerV3Config: DexConfigMap<DexParams> = {
58
62
  hooks: [
59
63
  {
60
64
  type: 'StableSurge',
65
+ apiName: 'STABLE_SURGE',
61
66
  factory: '0xD53F5d8d926fb2a0f7Be614B16e649B8aC102D83', // Pools with StableSurge hook will always be deployed from this factory
62
67
  address: '0xb18fA0cb5DE8cecB8899AAE6e38b1B7ed77885dA', // Address of the hook that will be used by pools
63
68
  },
@@ -71,6 +76,7 @@ export const BalancerV3Config: DexConfigMap<DexParams> = {
71
76
  hooks: [
72
77
  {
73
78
  type: 'StableSurge',
79
+ apiName: 'STABLE_SURGE',
74
80
  factory: '0x86e67E115f96DF37239E0479441303De0de7bc2b', // Pools with StableSurge hook will always be deployed from this factory
75
81
  address: '0x0Fa0f9990D7969a7aE6f9961d663E4A201Ed6417', // Address of the hook that will be used by pools
76
82
  },
@@ -84,6 +90,7 @@ export const BalancerV3Config: DexConfigMap<DexParams> = {
84
90
  hooks: [
85
91
  {
86
92
  type: 'StableSurge',
93
+ apiName: 'STABLE_SURGE',
87
94
  factory: '0x4fb47126Fa83A8734991E41B942Ac29A3266C968', // Pools with StableSurge hook will always be deployed from this factory
88
95
  address: '0xb2007B8B7E0260042517f635CFd8E6dD2Dd7f007', // Address of the hook that will be used by pools
89
96
  },
@@ -1,6 +1,7 @@
1
1
  import { STABLE_GAS_COST } from './stablePool';
2
2
  import { Step } from './types';
3
3
  import { WEIGHTED_GAS_COST } from './weightedPool';
4
+ import { GYROECLP_GAS_COST } from './gyroECLPPool';
4
5
 
5
6
  // https://sepolia.etherscan.io/tx/0x8c2c5ec7fc2855ed2ffab3467ee434f4e374e0ecf791e8d2b93c8d74e3f5b1fe
6
7
  // 0x7ec61d6dcf0ea412327c30f013e60578c0ff4d83c334a95fb3a68739860e6f59
@@ -30,6 +31,8 @@ export function getGasCost(steps: Step[]): number {
30
31
  return STABLE_GAS_COST;
31
32
  case 'BUFFER':
32
33
  return BUFFER_WRAP_UNWRAP_GAS_COST;
34
+ case 'GYROE':
35
+ return GYROECLP_GAS_COST;
33
36
  default:
34
37
  return WEIGHTED_GAS_COST;
35
38
  }