@paraswap/dex-lib 4.0.26 → 4.0.27

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 (248) hide show
  1. package/.vscode/launch.json +53 -0
  2. package/.vscode/settings.json +2 -0
  3. package/.vscode/tasks.json +15 -0
  4. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
  5. package/build/abi/usual-m-smart-m/usualM.abi.json +483 -0
  6. package/build/abi/{angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json → wombat/pool.json} +637 -594
  7. package/build/dex/aave-v1/aave-v1.js +1 -0
  8. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  9. package/build/dex/aave-v2/tokens-avalanche.json +44 -0
  10. package/build/dex/aave-v2/tokens-mainnet.json +188 -0
  11. package/build/dex/aave-v2/tokens-polygon.json +44 -0
  12. package/build/dex/algebra/config.js +1 -1
  13. package/build/dex/algebra/config.js.map +1 -1
  14. package/build/dex/bProtocol.d.ts +18 -0
  15. package/build/dex/bProtocol.js +39 -0
  16. package/build/dex/bProtocol.js.map +1 -0
  17. package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +729 -0
  18. package/build/dex/balancer-v3/abi/balancerBatchRouter.js +732 -0
  19. package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +1 -0
  20. package/build/dex/balancer-v3/abi/balancerRouter.d.ts +1406 -0
  21. package/build/dex/balancer-v3/abi/balancerRouter.js +1175 -0
  22. package/build/dex/balancer-v3/abi/balancerRouter.js.map +1 -0
  23. package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +2081 -0
  24. package/build/dex/balancer-v3/abi/vaultExtension.V3.js +1851 -0
  25. package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +1 -0
  26. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.d.ts +34 -0
  27. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js +406 -0
  28. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js.map +1 -0
  29. package/build/dex/bancor.d.ts +26 -0
  30. package/build/dex/bancor.js +58 -0
  31. package/build/dex/bancor.js.map +1 -0
  32. package/build/dex/compound.d.ts +18 -0
  33. package/build/dex/compound.js +46 -0
  34. package/build/dex/compound.js.map +1 -0
  35. package/build/dex/curve-v2.d.ts +58 -0
  36. package/build/dex/curve-v2.js +180 -0
  37. package/build/dex/curve-v2.js.map +1 -0
  38. package/build/dex/dodo-v1.d.ts +33 -0
  39. package/build/dex/dodo-v1.js +63 -0
  40. package/build/dex/dodo-v1.js.map +1 -0
  41. package/build/dex/inception/inception-event-pool.d.ts +4 -4
  42. package/build/dex/inception/inception-event-pool.js +7 -9
  43. package/build/dex/inception/inception-event-pool.js.map +1 -1
  44. package/build/dex/inception/inception.d.ts +6 -6
  45. package/build/dex/inception/inception.js +16 -40
  46. package/build/dex/inception/inception.js.map +1 -1
  47. package/build/dex/inception/utils.d.ts +1 -0
  48. package/build/dex/inception/utils.js +22 -1
  49. package/build/dex/inception/utils.js.map +1 -1
  50. package/build/dex/lido.d.ts +19 -0
  51. package/build/dex/lido.js +42 -0
  52. package/build/dex/lido.js.map +1 -0
  53. package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
  54. package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
  55. package/build/dex/maker-psm/scripts/validate-state.js +185 -0
  56. package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
  57. package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
  58. package/build/dex/onebit.d.ts +25 -0
  59. package/build/dex/onebit.js +42 -0
  60. package/build/dex/onebit.js.map +1 -0
  61. package/build/dex/platypus/platypus.js +17 -3
  62. package/build/dex/platypus/platypus.js.map +1 -1
  63. package/build/dex/smoothy.d.ts +26 -0
  64. package/build/dex/smoothy.js +48 -0
  65. package/build/dex/smoothy.js.map +1 -0
  66. package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
  67. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
  68. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
  69. package/build/dex/stable-pool.d.ts +28 -0
  70. package/build/dex/stable-pool.js +55 -0
  71. package/build/dex/stable-pool.js.map +1 -0
  72. package/build/dex/swaap-v1/swaap-v1.js +4 -0
  73. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  74. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
  75. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
  76. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
  77. package/build/dex/trader-joe-v2.1.d.ts +43 -0
  78. package/build/dex/trader-joe-v2.1.js +79 -0
  79. package/build/dex/trader-joe-v2.1.js.map +1 -0
  80. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
  81. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
  82. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
  83. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
  84. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
  85. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
  86. package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
  87. package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
  88. package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
  89. package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
  90. package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
  91. package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
  92. package/build/dex/usual/usual-m-smart-m.d.ts +17 -0
  93. package/build/dex/usual/usual-m-smart-m.js +50 -0
  94. package/build/dex/usual/usual-m-smart-m.js.map +1 -0
  95. package/build/dex/usual-m-smart-m/config.d.ts +3 -0
  96. package/build/dex/usual-m-smart-m/config.js +13 -0
  97. package/build/dex/usual-m-smart-m/config.js.map +1 -0
  98. package/build/dex/usual-m-smart-m/types.d.ts +7 -0
  99. package/build/dex/usual-m-smart-m/types.js +3 -0
  100. package/build/dex/usual-m-smart-m/types.js.map +1 -0
  101. package/build/dex/usual-m-smart-m/usual-m-smart-m.d.ts +35 -0
  102. package/build/dex/usual-m-smart-m/usual-m-smart-m.js +161 -0
  103. package/build/dex/usual-m-smart-m/usual-m-smart-m.js.map +1 -0
  104. package/build/dex/usual-m-usd0/config.d.ts +3 -0
  105. package/build/dex/usual-m-usd0/config.js +14 -0
  106. package/build/dex/usual-m-usd0/config.js.map +1 -0
  107. package/build/dex/usual-m-usd0/types.d.ts +8 -0
  108. package/build/dex/usual-m-usd0/types.js +3 -0
  109. package/build/dex/usual-m-usd0/types.js.map +1 -0
  110. package/build/dex/usual-m-usd0/usual-m-usd0.d.ts +35 -0
  111. package/build/dex/usual-m-usd0/usual-m-usd0.js +159 -0
  112. package/build/dex/usual-m-usd0/usual-m-usd0.js.map +1 -0
  113. package/build/generic-swap-transaction-builder.d.ts +1 -1
  114. package/build/generic-swap-transaction-builder.js +2 -0
  115. package/build/generic-swap-transaction-builder.js.map +1 -1
  116. package/package.json +1 -1
  117. package/src/dex/algebra/config.ts +1 -1
  118. package/src/dex/balancer-v2/scripts/abi.json +339 -0
  119. package/src/dex/balancer-v2/scripts/test.test.ts +121 -0
  120. package/src/generic-swap-transaction-builder.ts +3 -1
  121. package/tests/utils-e2e.ts +2 -2
  122. package/build/abi/Aave_GSM.json +0 -751
  123. package/build/abi/Balancer.json +0 -257
  124. package/build/abi/BalancerV2.json +0 -1179
  125. package/build/abi/RamsesV2Pool.abi.json +0 -1554
  126. package/build/abi/RamsesV2Quoter.abi.json +0 -274
  127. package/build/abi/USDM.json +0 -807
  128. package/build/abi/UniswapV2Router.json +0 -397
  129. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
  130. package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
  131. package/build/abi/curve-v1/CurveTokenV1.json +0 -305
  132. package/build/abi/curve-v1/CurveTokenV2.json +0 -318
  133. package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
  134. package/build/abi/curve-v1/CurveV2Swap.json +0 -700
  135. package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
  136. package/build/abi/curve-v1/FactoryRegistry.json +0 -508
  137. package/build/abi/curve-v1/StableSwapAave.json +0 -1152
  138. package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
  139. package/build/abi/curve-v1/StableSwapCompound.json +0 -814
  140. package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
  141. package/build/abi/curve-v1/StableSwapPax.json +0 -865
  142. package/build/abi/curve-v1/StableSwapSnow.json +0 -900
  143. package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
  144. package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
  145. package/build/abi/curve-v1/StableSwapY.json +0 -814
  146. package/build/abi/inception/inception-ineth.json +0 -609
  147. package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
  148. package/build/abi/kyberdmm.abi.json +0 -1148
  149. package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
  150. package/build/abi/nerve/nerve-metapool.json +0 -790
  151. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  152. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
  153. package/build/dex/balancer-v1/balancer-pools.json +0 -33333
  154. package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
  155. package/build/dex/bebop/websocket-fetcher.js +0 -87
  156. package/build/dex/bebop/websocket-fetcher.js.map +0 -1
  157. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  158. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  159. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  160. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  161. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  162. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  163. package/build/dex/idle-dao/scripts.d.ts +0 -9
  164. package/build/dex/idle-dao/scripts.js +0 -552
  165. package/build/dex/idle-dao/scripts.js.map +0 -1
  166. package/build/dex/inception/inception-native.d.ts +0 -43
  167. package/build/dex/inception/inception-native.js +0 -131
  168. package/build/dex/inception/inception-native.js.map +0 -1
  169. package/build/dex/inception/inception-pool.d.ts +0 -18
  170. package/build/dex/inception/inception-pool.js +0 -32
  171. package/build/dex/inception/inception-pool.js.map +0 -1
  172. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  173. package/build/dex/inception/inception-price-feed.js +0 -51
  174. package/build/dex/inception/inception-price-feed.js.map +0 -1
  175. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
  176. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
  177. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
  178. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
  179. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
  180. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
  181. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
  182. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
  183. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
  184. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
  185. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
  186. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
  187. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
  188. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
  189. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
  190. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
  191. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
  192. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
  193. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
  194. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
  195. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
  196. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
  197. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
  198. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
  199. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
  200. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
  201. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
  202. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
  203. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
  204. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
  205. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
  206. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
  207. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
  208. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
  209. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
  210. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
  211. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
  212. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
  213. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
  214. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
  215. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
  216. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
  217. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
  218. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
  219. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
  220. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
  221. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
  222. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
  223. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
  224. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
  225. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
  226. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
  227. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
  228. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
  229. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
  230. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
  231. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
  232. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
  233. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
  234. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
  235. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
  236. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
  237. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
  238. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
  239. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
  240. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
  241. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
  242. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
  243. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
  244. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
  245. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
  246. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
  247. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
  248. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraswap/dex-lib",
3
- "version": "4.0.26",
3
+ "version": "4.0.27",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "repository": "https://github.com/paraswap/paraswap-dex-lib",
@@ -95,7 +95,7 @@ export const AlgebraConfig: DexConfigMap<DexParams> = {
95
95
  initRetryFrequency: 10,
96
96
  // AlgebraStateMulticall
97
97
  algebraStateMulticall: '0x49C46f7f88110ccA234ef27Cd664510f7bbF5998',
98
- subgraphURL: 'YwkNWffc8UTH77wDqGWgMShMq1uXdiQsD5wrD5MzKwJ',
98
+ subgraphURL: 'AAA1vYjxwFHzbt6qKwLHNcDSASyr1J1xVViDH8gTMFMR',
99
99
  uniswapMulticall: '0x4dfa9a980efE4802E969AC33968E3d6E59B8a19e',
100
100
  deployer: '0xC1b576AC6Ec749d5Ace1787bF9Ec6340908ddB47',
101
101
  version: 'v1.9-bidirectional-fee',
@@ -0,0 +1,339 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" },
5
+ { "internalType": "uint256", "name": "amountOut", "type": "uint256" },
6
+ { "internalType": "bool", "name": "tokenInIsToken0", "type": "bool" },
7
+ {
8
+ "components": [
9
+ { "internalType": "int256", "name": "alpha", "type": "int256" },
10
+ { "internalType": "int256", "name": "beta", "type": "int256" },
11
+ { "internalType": "int256", "name": "c", "type": "int256" },
12
+ { "internalType": "int256", "name": "s", "type": "int256" },
13
+ { "internalType": "int256", "name": "lambda", "type": "int256" }
14
+ ],
15
+ "internalType": "struct GyroECLPMath.Params",
16
+ "name": "params",
17
+ "type": "tuple"
18
+ },
19
+ {
20
+ "components": [
21
+ {
22
+ "components": [
23
+ { "internalType": "int256", "name": "x", "type": "int256" },
24
+ { "internalType": "int256", "name": "y", "type": "int256" }
25
+ ],
26
+ "internalType": "struct GyroECLPMath.Vector2",
27
+ "name": "tauAlpha",
28
+ "type": "tuple"
29
+ },
30
+ {
31
+ "components": [
32
+ { "internalType": "int256", "name": "x", "type": "int256" },
33
+ { "internalType": "int256", "name": "y", "type": "int256" }
34
+ ],
35
+ "internalType": "struct GyroECLPMath.Vector2",
36
+ "name": "tauBeta",
37
+ "type": "tuple"
38
+ },
39
+ { "internalType": "int256", "name": "u", "type": "int256" },
40
+ { "internalType": "int256", "name": "v", "type": "int256" },
41
+ { "internalType": "int256", "name": "w", "type": "int256" },
42
+ { "internalType": "int256", "name": "z", "type": "int256" },
43
+ { "internalType": "int256", "name": "dSq", "type": "int256" }
44
+ ],
45
+ "internalType": "struct GyroECLPMath.DerivedParams",
46
+ "name": "derived",
47
+ "type": "tuple"
48
+ },
49
+ {
50
+ "components": [
51
+ { "internalType": "int256", "name": "x", "type": "int256" },
52
+ { "internalType": "int256", "name": "y", "type": "int256" }
53
+ ],
54
+ "internalType": "struct GyroECLPMath.Vector2",
55
+ "name": "invariant",
56
+ "type": "tuple"
57
+ }
58
+ ],
59
+ "name": "calcInGivenOut",
60
+ "outputs": [
61
+ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }
62
+ ],
63
+ "stateMutability": "pure",
64
+ "type": "function"
65
+ },
66
+ {
67
+ "inputs": [
68
+ { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" },
69
+ { "internalType": "uint256", "name": "amountIn", "type": "uint256" },
70
+ { "internalType": "bool", "name": "tokenInIsToken0", "type": "bool" },
71
+ {
72
+ "components": [
73
+ { "internalType": "int256", "name": "alpha", "type": "int256" },
74
+ { "internalType": "int256", "name": "beta", "type": "int256" },
75
+ { "internalType": "int256", "name": "c", "type": "int256" },
76
+ { "internalType": "int256", "name": "s", "type": "int256" },
77
+ { "internalType": "int256", "name": "lambda", "type": "int256" }
78
+ ],
79
+ "internalType": "struct GyroECLPMath.Params",
80
+ "name": "params",
81
+ "type": "tuple"
82
+ },
83
+ {
84
+ "components": [
85
+ {
86
+ "components": [
87
+ { "internalType": "int256", "name": "x", "type": "int256" },
88
+ { "internalType": "int256", "name": "y", "type": "int256" }
89
+ ],
90
+ "internalType": "struct GyroECLPMath.Vector2",
91
+ "name": "tauAlpha",
92
+ "type": "tuple"
93
+ },
94
+ {
95
+ "components": [
96
+ { "internalType": "int256", "name": "x", "type": "int256" },
97
+ { "internalType": "int256", "name": "y", "type": "int256" }
98
+ ],
99
+ "internalType": "struct GyroECLPMath.Vector2",
100
+ "name": "tauBeta",
101
+ "type": "tuple"
102
+ },
103
+ { "internalType": "int256", "name": "u", "type": "int256" },
104
+ { "internalType": "int256", "name": "v", "type": "int256" },
105
+ { "internalType": "int256", "name": "w", "type": "int256" },
106
+ { "internalType": "int256", "name": "z", "type": "int256" },
107
+ { "internalType": "int256", "name": "dSq", "type": "int256" }
108
+ ],
109
+ "internalType": "struct GyroECLPMath.DerivedParams",
110
+ "name": "derived",
111
+ "type": "tuple"
112
+ },
113
+ {
114
+ "components": [
115
+ { "internalType": "int256", "name": "x", "type": "int256" },
116
+ { "internalType": "int256", "name": "y", "type": "int256" }
117
+ ],
118
+ "internalType": "struct GyroECLPMath.Vector2",
119
+ "name": "invariant",
120
+ "type": "tuple"
121
+ }
122
+ ],
123
+ "name": "calcOutGivenIn",
124
+ "outputs": [
125
+ { "internalType": "uint256", "name": "amountOut", "type": "uint256" }
126
+ ],
127
+ "stateMutability": "pure",
128
+ "type": "function"
129
+ },
130
+ {
131
+ "inputs": [
132
+ { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" },
133
+ {
134
+ "components": [
135
+ { "internalType": "int256", "name": "alpha", "type": "int256" },
136
+ { "internalType": "int256", "name": "beta", "type": "int256" },
137
+ { "internalType": "int256", "name": "c", "type": "int256" },
138
+ { "internalType": "int256", "name": "s", "type": "int256" },
139
+ { "internalType": "int256", "name": "lambda", "type": "int256" }
140
+ ],
141
+ "internalType": "struct GyroECLPMath.Params",
142
+ "name": "params",
143
+ "type": "tuple"
144
+ },
145
+ {
146
+ "components": [
147
+ {
148
+ "components": [
149
+ { "internalType": "int256", "name": "x", "type": "int256" },
150
+ { "internalType": "int256", "name": "y", "type": "int256" }
151
+ ],
152
+ "internalType": "struct GyroECLPMath.Vector2",
153
+ "name": "tauAlpha",
154
+ "type": "tuple"
155
+ },
156
+ {
157
+ "components": [
158
+ { "internalType": "int256", "name": "x", "type": "int256" },
159
+ { "internalType": "int256", "name": "y", "type": "int256" }
160
+ ],
161
+ "internalType": "struct GyroECLPMath.Vector2",
162
+ "name": "tauBeta",
163
+ "type": "tuple"
164
+ },
165
+ { "internalType": "int256", "name": "u", "type": "int256" },
166
+ { "internalType": "int256", "name": "v", "type": "int256" },
167
+ { "internalType": "int256", "name": "w", "type": "int256" },
168
+ { "internalType": "int256", "name": "z", "type": "int256" },
169
+ { "internalType": "int256", "name": "dSq", "type": "int256" }
170
+ ],
171
+ "internalType": "struct GyroECLPMath.DerivedParams",
172
+ "name": "derived",
173
+ "type": "tuple"
174
+ },
175
+ { "internalType": "int256", "name": "invariant", "type": "int256" }
176
+ ],
177
+ "name": "calcSpotPrice0in1",
178
+ "outputs": [{ "internalType": "uint256", "name": "px", "type": "uint256" }],
179
+ "stateMutability": "pure",
180
+ "type": "function"
181
+ },
182
+ {
183
+ "inputs": [
184
+ { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" },
185
+ {
186
+ "components": [
187
+ { "internalType": "int256", "name": "alpha", "type": "int256" },
188
+ { "internalType": "int256", "name": "beta", "type": "int256" },
189
+ { "internalType": "int256", "name": "c", "type": "int256" },
190
+ { "internalType": "int256", "name": "s", "type": "int256" },
191
+ { "internalType": "int256", "name": "lambda", "type": "int256" }
192
+ ],
193
+ "internalType": "struct GyroECLPMath.Params",
194
+ "name": "params",
195
+ "type": "tuple"
196
+ },
197
+ {
198
+ "components": [
199
+ {
200
+ "components": [
201
+ { "internalType": "int256", "name": "x", "type": "int256" },
202
+ { "internalType": "int256", "name": "y", "type": "int256" }
203
+ ],
204
+ "internalType": "struct GyroECLPMath.Vector2",
205
+ "name": "tauAlpha",
206
+ "type": "tuple"
207
+ },
208
+ {
209
+ "components": [
210
+ { "internalType": "int256", "name": "x", "type": "int256" },
211
+ { "internalType": "int256", "name": "y", "type": "int256" }
212
+ ],
213
+ "internalType": "struct GyroECLPMath.Vector2",
214
+ "name": "tauBeta",
215
+ "type": "tuple"
216
+ },
217
+ { "internalType": "int256", "name": "u", "type": "int256" },
218
+ { "internalType": "int256", "name": "v", "type": "int256" },
219
+ { "internalType": "int256", "name": "w", "type": "int256" },
220
+ { "internalType": "int256", "name": "z", "type": "int256" },
221
+ { "internalType": "int256", "name": "dSq", "type": "int256" }
222
+ ],
223
+ "internalType": "struct GyroECLPMath.DerivedParams",
224
+ "name": "derived",
225
+ "type": "tuple"
226
+ }
227
+ ],
228
+ "name": "calculateInvariant",
229
+ "outputs": [
230
+ { "internalType": "uint256", "name": "uinvariant", "type": "uint256" }
231
+ ],
232
+ "stateMutability": "pure",
233
+ "type": "function"
234
+ },
235
+ {
236
+ "inputs": [
237
+ { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" },
238
+ {
239
+ "components": [
240
+ { "internalType": "int256", "name": "alpha", "type": "int256" },
241
+ { "internalType": "int256", "name": "beta", "type": "int256" },
242
+ { "internalType": "int256", "name": "c", "type": "int256" },
243
+ { "internalType": "int256", "name": "s", "type": "int256" },
244
+ { "internalType": "int256", "name": "lambda", "type": "int256" }
245
+ ],
246
+ "internalType": "struct GyroECLPMath.Params",
247
+ "name": "params",
248
+ "type": "tuple"
249
+ },
250
+ {
251
+ "components": [
252
+ {
253
+ "components": [
254
+ { "internalType": "int256", "name": "x", "type": "int256" },
255
+ { "internalType": "int256", "name": "y", "type": "int256" }
256
+ ],
257
+ "internalType": "struct GyroECLPMath.Vector2",
258
+ "name": "tauAlpha",
259
+ "type": "tuple"
260
+ },
261
+ {
262
+ "components": [
263
+ { "internalType": "int256", "name": "x", "type": "int256" },
264
+ { "internalType": "int256", "name": "y", "type": "int256" }
265
+ ],
266
+ "internalType": "struct GyroECLPMath.Vector2",
267
+ "name": "tauBeta",
268
+ "type": "tuple"
269
+ },
270
+ { "internalType": "int256", "name": "u", "type": "int256" },
271
+ { "internalType": "int256", "name": "v", "type": "int256" },
272
+ { "internalType": "int256", "name": "w", "type": "int256" },
273
+ { "internalType": "int256", "name": "z", "type": "int256" },
274
+ { "internalType": "int256", "name": "dSq", "type": "int256" }
275
+ ],
276
+ "internalType": "struct GyroECLPMath.DerivedParams",
277
+ "name": "derived",
278
+ "type": "tuple"
279
+ }
280
+ ],
281
+ "name": "calculateInvariantWithError",
282
+ "outputs": [
283
+ { "internalType": "int256", "name": "", "type": "int256" },
284
+ { "internalType": "int256", "name": "", "type": "int256" }
285
+ ],
286
+ "stateMutability": "pure",
287
+ "type": "function"
288
+ },
289
+ {
290
+ "inputs": [
291
+ {
292
+ "components": [
293
+ { "internalType": "int256", "name": "alpha", "type": "int256" },
294
+ { "internalType": "int256", "name": "beta", "type": "int256" },
295
+ { "internalType": "int256", "name": "c", "type": "int256" },
296
+ { "internalType": "int256", "name": "s", "type": "int256" },
297
+ { "internalType": "int256", "name": "lambda", "type": "int256" }
298
+ ],
299
+ "internalType": "struct GyroECLPMath.Params",
300
+ "name": "params",
301
+ "type": "tuple"
302
+ },
303
+ {
304
+ "components": [
305
+ {
306
+ "components": [
307
+ { "internalType": "int256", "name": "x", "type": "int256" },
308
+ { "internalType": "int256", "name": "y", "type": "int256" }
309
+ ],
310
+ "internalType": "struct GyroECLPMath.Vector2",
311
+ "name": "tauAlpha",
312
+ "type": "tuple"
313
+ },
314
+ {
315
+ "components": [
316
+ { "internalType": "int256", "name": "x", "type": "int256" },
317
+ { "internalType": "int256", "name": "y", "type": "int256" }
318
+ ],
319
+ "internalType": "struct GyroECLPMath.Vector2",
320
+ "name": "tauBeta",
321
+ "type": "tuple"
322
+ },
323
+ { "internalType": "int256", "name": "u", "type": "int256" },
324
+ { "internalType": "int256", "name": "v", "type": "int256" },
325
+ { "internalType": "int256", "name": "w", "type": "int256" },
326
+ { "internalType": "int256", "name": "z", "type": "int256" },
327
+ { "internalType": "int256", "name": "dSq", "type": "int256" }
328
+ ],
329
+ "internalType": "struct GyroECLPMath.DerivedParams",
330
+ "name": "derived",
331
+ "type": "tuple"
332
+ }
333
+ ],
334
+ "name": "validateDerivedParamsLimits",
335
+ "outputs": [],
336
+ "stateMutability": "pure",
337
+ "type": "function"
338
+ }
339
+ ]
@@ -0,0 +1,121 @@
1
+ import {
2
+ GyroEMaths,
3
+ Gyro2Maths,
4
+ Gyro3Maths,
5
+ DerivedGyroEParams,
6
+ } from '@balancer-labs/sor';
7
+ import { Interface } from '@ethersproject/abi';
8
+ import { BigNumber } from 'ethers';
9
+ import abi from './abi.json';
10
+
11
+ // GyroEMaths.calcOutGivenIn();
12
+ // Gyro2Maths._calcOutGivenIn();
13
+ // Gyro3Maths._calcOutGivenIn();
14
+
15
+ const iface = new Interface(abi);
16
+
17
+ iface;
18
+
19
+ describe('Balancer V2', () => {
20
+ it('should work', () => {
21
+ const a = iface.getFunction('calcOutGivenIn');
22
+ // for (const func of Array.from(Object.values(iface.functions))) {
23
+ // console.log(func.name, iface.getSighash(func.name));
24
+ // }
25
+ // console.log(iface);
26
+ const res = iface.decodeFunctionData(
27
+ 'calcOutGivenIn',
28
+ `0x8e4745e40000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000eb1a9b92135e000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b469471f8014000000000000000000000000000000000000000000000000000107ad8f556c6c00000000000000000000000000000000000000000000000000009be601cefc3171300000000000000000000000000000000000000000000000009e1cbaaa8d304d10000000000000000000000000000000000000000000000006124fee993bc0000ffffffffffffffffffffffffffffffffd1f35207dbac7faf93327a7968129abd000000000000000000000000000000003b7dd3de71da8605031cc87d4f669e8c00000000000000000000000000000000244588dab51864f925308eeb9a6b692a0000000000000000000000000000000041e90a1db37afb34ed577881bbe62abd0000000000000000000000000000000029280f48cc41e49bf9bdefc1cf627d48000000000000000000000000000000003ebf047daef0e9f1179c2428df5ffb5f000000000000000000000000000000000335863789b949ef74e3639b4ac1cbbdfffffffffffffffffffffffffffffffffa87dce2be9da7c4ab8d70c44b4ee2a5000000000000000000000000000000004b3b4ca85a86c47ad768bf58ebe9bbe800000000000000000000000000000000000000000000000ae1d515a532d75f4200000000000000000000000000000000000000000000000ae1d515a532d75f3c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000003b2e545742f021f1e000000000000000000000000000000000000000000000000000a14eb28b61c000`,
29
+ );
30
+
31
+ const data = {
32
+ amountIn: res.amountIn.toString(),
33
+ // @ts-ignore
34
+ balances: res.balances.map(t => t.toString()),
35
+ // @ts-ignore
36
+ invariant: res.invariant.map(t => t.toString()),
37
+ };
38
+
39
+ // @ts-ignore
40
+ const balances = res.balances.map(t => BigNumber.from(t));
41
+ // @ts-ignore
42
+ const amountIn = BigNumber.from(res.amountIn);
43
+
44
+ const res1 = GyroEMaths.calcOutGivenIn(
45
+ // @ts-ignore
46
+ balances,
47
+ // @ts-ignore
48
+ amountIn,
49
+ // @ts-ignore
50
+ res.tokenInIsToken0,
51
+ // @ts-ignore
52
+ res.params,
53
+ // @ts-ignore
54
+ res.derived,
55
+ // @ts-ignore
56
+ res.invariant,
57
+ );
58
+ console.log(res);
59
+ });
60
+ });
61
+
62
+ const params = {
63
+ swapRequest: {
64
+ kind: '0',
65
+ tokenIn: '0x4200000000000000000000000000000000000006',
66
+ tokenOut: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
67
+ amount: '16941024000000000000',
68
+ poolId:
69
+ '0x1a63b425600d775a1e1bfc212f021273812c3b160002000000000000000001a7',
70
+ lastChangeBlock: '25583670',
71
+ from: '0x59c7c832e96d2568bea6db468c1aadcbbda08a52',
72
+ to: '0x59c7c832e96d2568bea6db468c1aadcbbda08a52',
73
+ userData: '0x',
74
+ },
75
+ balances: ['1091696289517660140000', '45404000000000000'],
76
+ tokenInIsToken0: true,
77
+ eclpParams: {
78
+ alpha: BigNumber.from('812500000000000000'),
79
+ beta: BigNumber.from('1187500000000000000'),
80
+ c: BigNumber.from('702104269314266899'),
81
+ s: BigNumber.from('712074149938529489'),
82
+ lambda: BigNumber.from('7000000000000000000'),
83
+ },
84
+ derivedECLPParams: {
85
+ tauAlpha: {
86
+ x: '960',
87
+ y: '1024',
88
+ },
89
+ tauBeta: {
90
+ x: '54706349705309301454914549190626540872',
91
+ y: '83403955525945303751187915386843560799',
92
+ },
93
+ u: '4265597963916367863499663222916631485',
94
+ v: '-7269927804137016433476462764480339291',
95
+ w: '100000000000000000014834466952967732200',
96
+ z: '-61210323885096690504742396048605799747',
97
+ dSq: '79077786070941323452088008583454039692',
98
+ },
99
+ invariant: {
100
+ x: '200740377364935434050',
101
+ y: '200740377364935434044',
102
+ },
103
+ };
104
+
105
+ // GyroEMaths.calcOutGivenIn(
106
+ // params.balances.map(t => BigNumber.from(t)),
107
+ // BigNumber.from(params.swapRequest.amount),
108
+ // params.tokenInIsToken0,
109
+ // params.eclpParams,
110
+ // params.derivedECLPParams,
111
+ // params.invariant,
112
+ // );
113
+
114
+ // const amountOut = GyroEMaths.calcOutGivenIn(
115
+ // orderedNormalizedBalances,
116
+ // BigNumber.from(amount),
117
+ // poolPairData.tokenInIsToken0,
118
+ // poolPairData.gyroParams,
119
+ // poolPairData.gyroDerivedParams,
120
+ // invariant,
121
+ // ).toBigInt();
@@ -447,7 +447,7 @@ export class GenericSwapTransactionBuilder {
447
447
  uuid: string;
448
448
  beneficiary?: Address;
449
449
  onlyParams?: boolean;
450
- }): Promise<TxObject> {
450
+ }): Promise<TxObject | (string | string[])[]> {
451
451
  // if beneficiary is not defined, then in smart contract it will be replaced to msg.sender
452
452
  const _beneficiary =
453
453
  beneficiary !== NULL_ADDRESS &&
@@ -494,6 +494,8 @@ export class GenericSwapTransactionBuilder {
494
494
  ));
495
495
  }
496
496
 
497
+ if (onlyParams) return params;
498
+
497
499
  const value = (
498
500
  priceRoute.srcToken.toLowerCase() === ETHER_ADDRESS.toLowerCase()
499
501
  ? BigInt(
@@ -214,7 +214,7 @@ class APIParaswapSDK implements IParaSwapSDK {
214
214
  const minMaxAmount = _minMaxAmount.toString();
215
215
  let deadline = Number((Math.floor(Date.now() / 1000) + 10 * 60).toFixed());
216
216
 
217
- return await this.transactionBuilder.build({
217
+ return (await this.transactionBuilder.build({
218
218
  priceRoute,
219
219
  minMaxAmount: minMaxAmount.toString(),
220
220
  userAddress,
@@ -222,7 +222,7 @@ class APIParaswapSDK implements IParaSwapSDK {
222
222
  partnerFeePercent: '0',
223
223
  deadline: deadline.toString(),
224
224
  uuid: uuid(),
225
- });
225
+ })) as TxObject;
226
226
  }
227
227
  }
228
228