@paraswap/dex-lib 4.0.27 → 4.0.28-partner-encoding

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 (246) hide show
  1. package/build/abi/Aave_GSM.json +751 -0
  2. package/build/abi/Balancer.json +257 -0
  3. package/build/abi/BalancerV2.json +1179 -0
  4. package/build/abi/RamsesV2Pool.abi.json +1554 -0
  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/{wombat/pool.json → angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json} +594 -637
  9. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +509 -0
  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/curve-v1/StableSwapUSDN.json +1004 -0
  24. package/build/abi/curve-v1/StableSwapUSDT.json +814 -0
  25. package/build/abi/curve-v1/StableSwapY.json +814 -0
  26. package/build/abi/inception/inception-ineth.json +609 -0
  27. package/build/abi/kyberdmm/kyber-storage.abi.json +824 -0
  28. package/build/abi/kyberdmm.abi.json +1148 -0
  29. package/build/abi/maverick-v2/MaverickV2Quoter.json +278 -0
  30. package/build/abi/nerve/nerve-metapool.json +790 -0
  31. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
  32. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +267 -0
  33. package/build/dex/aave-v1/aave-v1.js +0 -1
  34. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  35. package/build/dex/algebra/config.js +1 -1
  36. package/build/dex/algebra/config.js.map +1 -1
  37. package/build/dex/balancer-v1/balancer-pools.json +33333 -0
  38. package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
  39. package/build/dex/bebop/websocket-fetcher.js +87 -0
  40. package/build/dex/bebop/websocket-fetcher.js.map +1 -0
  41. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  42. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  43. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  44. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  45. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  46. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  47. package/build/dex/idle-dao/scripts.d.ts +9 -0
  48. package/build/dex/idle-dao/scripts.js +552 -0
  49. package/build/dex/idle-dao/scripts.js.map +1 -0
  50. package/build/dex/inception/inception-event-pool.d.ts +4 -4
  51. package/build/dex/inception/inception-event-pool.js +9 -7
  52. package/build/dex/inception/inception-event-pool.js.map +1 -1
  53. package/build/dex/inception/inception-native.d.ts +43 -0
  54. package/build/dex/inception/inception-native.js +131 -0
  55. package/build/dex/inception/inception-native.js.map +1 -0
  56. package/build/dex/inception/inception-pool.d.ts +18 -0
  57. package/build/dex/inception/inception-pool.js +32 -0
  58. package/build/dex/inception/inception-pool.js.map +1 -0
  59. package/build/dex/inception/inception-price-feed.d.ts +19 -0
  60. package/build/dex/inception/inception-price-feed.js +51 -0
  61. package/build/dex/inception/inception-price-feed.js.map +1 -0
  62. package/build/dex/inception/inception.d.ts +6 -6
  63. package/build/dex/inception/inception.js +40 -16
  64. package/build/dex/inception/inception.js.map +1 -1
  65. package/build/dex/inception/utils.d.ts +0 -1
  66. package/build/dex/inception/utils.js +1 -22
  67. package/build/dex/inception/utils.js.map +1 -1
  68. package/build/dex/platypus/platypus.js +3 -17
  69. package/build/dex/platypus/platypus.js.map +1 -1
  70. package/build/dex/swaap-v1/swaap-v1.js +0 -4
  71. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  72. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
  73. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
  74. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
  75. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
  76. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
  77. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
  78. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
  79. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
  80. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
  81. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
  82. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
  83. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
  84. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
  85. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
  86. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
  87. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
  88. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
  89. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
  90. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
  91. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
  92. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
  93. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
  94. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
  95. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
  96. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
  97. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
  98. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
  99. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
  100. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
  101. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
  102. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
  103. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
  104. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
  105. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
  106. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
  107. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
  108. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
  109. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
  110. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
  111. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
  112. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
  113. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
  114. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
  115. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
  116. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
  117. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
  118. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
  119. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
  120. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
  121. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
  122. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
  123. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
  124. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
  125. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
  126. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
  127. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
  128. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
  129. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
  130. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
  131. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
  132. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
  133. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
  134. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
  135. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
  136. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
  137. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
  138. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
  139. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
  140. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
  141. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
  142. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
  143. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
  144. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
  145. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
  146. package/build/generic-swap-transaction-builder.js +2 -1
  147. package/build/generic-swap-transaction-builder.js.map +1 -1
  148. package/package.json +1 -1
  149. package/src/dex/algebra/config.ts +1 -1
  150. package/src/generic-swap-transaction-builder.ts +5 -1
  151. package/.vscode/launch.json +0 -53
  152. package/.vscode/settings.json +0 -2
  153. package/.vscode/tasks.json +0 -15
  154. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
  155. package/build/abi/usual-m-smart-m/usualM.abi.json +0 -483
  156. package/build/dex/aave-v2/tokens-avalanche.json +0 -44
  157. package/build/dex/aave-v2/tokens-mainnet.json +0 -188
  158. package/build/dex/aave-v2/tokens-polygon.json +0 -44
  159. package/build/dex/bProtocol.d.ts +0 -18
  160. package/build/dex/bProtocol.js +0 -39
  161. package/build/dex/bProtocol.js.map +0 -1
  162. package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +0 -729
  163. package/build/dex/balancer-v3/abi/balancerBatchRouter.js +0 -732
  164. package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +0 -1
  165. package/build/dex/balancer-v3/abi/balancerRouter.d.ts +0 -1406
  166. package/build/dex/balancer-v3/abi/balancerRouter.js +0 -1175
  167. package/build/dex/balancer-v3/abi/balancerRouter.js.map +0 -1
  168. package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +0 -2081
  169. package/build/dex/balancer-v3/abi/vaultExtension.V3.js +0 -1851
  170. package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +0 -1
  171. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.d.ts +0 -34
  172. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js +0 -406
  173. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js.map +0 -1
  174. package/build/dex/bancor.d.ts +0 -26
  175. package/build/dex/bancor.js +0 -58
  176. package/build/dex/bancor.js.map +0 -1
  177. package/build/dex/compound.d.ts +0 -18
  178. package/build/dex/compound.js +0 -46
  179. package/build/dex/compound.js.map +0 -1
  180. package/build/dex/curve-v2.d.ts +0 -58
  181. package/build/dex/curve-v2.js +0 -180
  182. package/build/dex/curve-v2.js.map +0 -1
  183. package/build/dex/dodo-v1.d.ts +0 -33
  184. package/build/dex/dodo-v1.js +0 -63
  185. package/build/dex/dodo-v1.js.map +0 -1
  186. package/build/dex/lido.d.ts +0 -19
  187. package/build/dex/lido.js +0 -42
  188. package/build/dex/lido.js.map +0 -1
  189. package/build/dex/maker-psm/scripts/gem.abi.json +0 -136
  190. package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
  191. package/build/dex/maker-psm/scripts/validate-state.js +0 -185
  192. package/build/dex/maker-psm/scripts/validate-state.js.map +0 -1
  193. package/build/dex/maker-psm/scripts/vat.abi.json +0 -243
  194. package/build/dex/onebit.d.ts +0 -25
  195. package/build/dex/onebit.js +0 -42
  196. package/build/dex/onebit.js.map +0 -1
  197. package/build/dex/smoothy.d.ts +0 -26
  198. package/build/dex/smoothy.js +0 -48
  199. package/build/dex/smoothy.js.map +0 -1
  200. package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +0 -1
  201. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
  202. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
  203. package/build/dex/stable-pool.d.ts +0 -28
  204. package/build/dex/stable-pool.js +0 -55
  205. package/build/dex/stable-pool.js.map +0 -1
  206. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
  207. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
  208. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
  209. package/build/dex/trader-joe-v2.1.d.ts +0 -43
  210. package/build/dex/trader-joe-v2.1.js +0 -79
  211. package/build/dex/trader-joe-v2.1.js.map +0 -1
  212. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
  213. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
  214. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
  215. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
  216. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
  217. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
  218. package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +0 -4
  219. package/build/dex/uniswap-v3/uniswap-v3-pricing.js +0 -43
  220. package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +0 -1
  221. package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +0 -1
  222. package/build/dex/uniswap-v3/uniswap-v3-worker.js +0 -10
  223. package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +0 -1
  224. package/build/dex/usual/usual-m-smart-m.d.ts +0 -17
  225. package/build/dex/usual/usual-m-smart-m.js +0 -50
  226. package/build/dex/usual/usual-m-smart-m.js.map +0 -1
  227. package/build/dex/usual-m-smart-m/config.d.ts +0 -3
  228. package/build/dex/usual-m-smart-m/config.js +0 -13
  229. package/build/dex/usual-m-smart-m/config.js.map +0 -1
  230. package/build/dex/usual-m-smart-m/types.d.ts +0 -7
  231. package/build/dex/usual-m-smart-m/types.js +0 -3
  232. package/build/dex/usual-m-smart-m/types.js.map +0 -1
  233. package/build/dex/usual-m-smart-m/usual-m-smart-m.d.ts +0 -35
  234. package/build/dex/usual-m-smart-m/usual-m-smart-m.js +0 -161
  235. package/build/dex/usual-m-smart-m/usual-m-smart-m.js.map +0 -1
  236. package/build/dex/usual-m-usd0/config.d.ts +0 -3
  237. package/build/dex/usual-m-usd0/config.js +0 -14
  238. package/build/dex/usual-m-usd0/config.js.map +0 -1
  239. package/build/dex/usual-m-usd0/types.d.ts +0 -8
  240. package/build/dex/usual-m-usd0/types.js +0 -3
  241. package/build/dex/usual-m-usd0/types.js.map +0 -1
  242. package/build/dex/usual-m-usd0/usual-m-usd0.d.ts +0 -35
  243. package/build/dex/usual-m-usd0/usual-m-usd0.js +0 -159
  244. package/build/dex/usual-m-usd0/usual-m-usd0.js.map +0 -1
  245. package/src/dex/balancer-v2/scripts/abi.json +0 -339
  246. package/src/dex/balancer-v2/scripts/test.test.ts +0 -121
@@ -1,339 +0,0 @@
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
- ]
@@ -1,121 +0,0 @@
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();