@paraswap/dex-lib 4.1.17 → 4.1.18

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 (304) 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/gyroECLPPool.d.ts +11 -0
  62. package/build/dex/balancer-v3/gyroECLPPool.js +6 -0
  63. package/build/dex/balancer-v3/gyroECLPPool.js.map +1 -0
  64. package/build/dex/balancer-v3/utils.d.ts +2 -0
  65. package/build/dex/balancer-v3/utils.js +11 -0
  66. package/build/dex/balancer-v3/utils.js.map +1 -0
  67. package/build/dex/bebop/websocket-fetcher.d.ts +35 -0
  68. package/build/dex/bebop/websocket-fetcher.js +87 -0
  69. package/build/dex/bebop/websocket-fetcher.js.map +1 -0
  70. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  71. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  72. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  73. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  74. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  75. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  76. package/build/dex/idle-dao/scripts.d.ts +9 -0
  77. package/build/dex/idle-dao/scripts.js +552 -0
  78. package/build/dex/idle-dao/scripts.js.map +1 -0
  79. package/build/dex/inception/config.d.ts +4 -0
  80. package/build/dex/inception/config.js +109 -0
  81. package/build/dex/inception/config.js.map +1 -0
  82. package/build/dex/inception/inception-event-pool.d.ts +16 -0
  83. package/build/dex/inception/inception-event-pool.js +51 -0
  84. package/build/dex/inception/inception-event-pool.js.map +1 -0
  85. package/build/dex/inception/inception-native.d.ts +43 -0
  86. package/build/dex/inception/inception-native.js +131 -0
  87. package/build/dex/inception/inception-native.js.map +1 -0
  88. package/build/dex/inception/inception-pool.d.ts +18 -0
  89. package/build/dex/inception/inception-pool.js +32 -0
  90. package/build/dex/inception/inception-pool.js.map +1 -0
  91. package/build/dex/inception/inception-price-feed.d.ts +19 -0
  92. package/build/dex/inception/inception-price-feed.js +51 -0
  93. package/build/dex/inception/inception-price-feed.js.map +1 -0
  94. package/build/dex/inception/inception.d.ts +43 -0
  95. package/build/dex/inception/inception.js +204 -0
  96. package/build/dex/inception/inception.js.map +1 -0
  97. package/build/dex/inception/tokens.d.ts +9 -0
  98. package/build/dex/inception/tokens.js +28 -0
  99. package/build/dex/inception/tokens.js.map +1 -0
  100. package/build/dex/inception/types.d.ts +22 -0
  101. package/build/dex/inception/types.js +3 -0
  102. package/build/dex/inception/types.js.map +1 -0
  103. package/build/dex/inception/utils.d.ts +6 -0
  104. package/build/dex/inception/utils.js +37 -0
  105. package/build/dex/inception/utils.js.map +1 -0
  106. package/build/dex/platypus/asset.d.ts +14 -0
  107. package/build/dex/platypus/asset.js +97 -0
  108. package/build/dex/platypus/asset.js.map +1 -0
  109. package/build/dex/platypus/config.d.ts +11 -0
  110. package/build/dex/platypus/config.js +69 -0
  111. package/build/dex/platypus/config.js.map +1 -0
  112. package/build/dex/platypus/platypus.d.ts +63 -0
  113. package/build/dex/platypus/platypus.js +473 -0
  114. package/build/dex/platypus/platypus.js.map +1 -0
  115. package/build/dex/platypus/pool-avax.d.ts +8 -0
  116. package/build/dex/platypus/pool-avax.js +54 -0
  117. package/build/dex/platypus/pool-avax.js.map +1 -0
  118. package/build/dex/platypus/pool-base.d.ts +19 -0
  119. package/build/dex/platypus/pool-base.js +86 -0
  120. package/build/dex/platypus/pool-base.js.map +1 -0
  121. package/build/dex/platypus/pool-pure.d.ts +8 -0
  122. package/build/dex/platypus/pool-pure.js +37 -0
  123. package/build/dex/platypus/pool-pure.js.map +1 -0
  124. package/build/dex/platypus/pool-subscriber.d.ts +14 -0
  125. package/build/dex/platypus/pool-subscriber.js +167 -0
  126. package/build/dex/platypus/pool-subscriber.js.map +1 -0
  127. package/build/dex/platypus/pool.d.ts +8 -0
  128. package/build/dex/platypus/pool.js +58 -0
  129. package/build/dex/platypus/pool.js.map +1 -0
  130. package/build/dex/platypus/types.d.ts +92 -0
  131. package/build/dex/platypus/types.js +10 -0
  132. package/build/dex/platypus/types.js.map +1 -0
  133. package/build/dex/quickswap/spiritswap-v3.d.ts +6 -0
  134. package/build/dex/quickswap/spiritswap-v3.js +19 -0
  135. package/build/dex/quickswap/spiritswap-v3.js.map +1 -0
  136. package/build/dex/smardex/config.d.ts +4 -0
  137. package/build/dex/smardex/config.js +64 -0
  138. package/build/dex/smardex/config.js.map +1 -0
  139. package/build/dex/smardex/constants.d.ts +18 -0
  140. package/build/dex/smardex/constants.js +33 -0
  141. package/build/dex/smardex/constants.js.map +1 -0
  142. package/build/dex/smardex/sdk/constants.d.ts +6 -0
  143. package/build/dex/smardex/sdk/constants.js +13 -0
  144. package/build/dex/smardex/sdk/constants.js.map +1 -0
  145. package/build/dex/smardex/sdk/core.d.ts +113 -0
  146. package/build/dex/smardex/sdk/core.js +499 -0
  147. package/build/dex/smardex/sdk/core.js.map +1 -0
  148. package/build/dex/smardex/sdk/errors.d.ts +15 -0
  149. package/build/dex/smardex/sdk/errors.js +22 -0
  150. package/build/dex/smardex/sdk/errors.js.map +1 -0
  151. package/build/dex/smardex/sdk/types.d.ts +62 -0
  152. package/build/dex/smardex/sdk/types.js +3 -0
  153. package/build/dex/smardex/sdk/types.js.map +1 -0
  154. package/build/dex/smardex/sdk/utils.d.ts +44 -0
  155. package/build/dex/smardex/sdk/utils.js +133 -0
  156. package/build/dex/smardex/sdk/utils.js.map +1 -0
  157. package/build/dex/smardex/smardex-event-pool.d.ts +28 -0
  158. package/build/dex/smardex/smardex-event-pool.js +119 -0
  159. package/build/dex/smardex/smardex-event-pool.js.map +1 -0
  160. package/build/dex/smardex/smardex.d.ts +65 -0
  161. package/build/dex/smardex/smardex.js +519 -0
  162. package/build/dex/smardex/smardex.js.map +1 -0
  163. package/build/dex/smardex/types.d.ts +55 -0
  164. package/build/dex/smardex/types.js +3 -0
  165. package/build/dex/smardex/types.js.map +1 -0
  166. package/build/dex/solidly/forks-override/cone.d.ts +22 -0
  167. package/build/dex/solidly/forks-override/cone.js +53 -0
  168. package/build/dex/solidly/forks-override/cone.js.map +1 -0
  169. package/build/dex/solidly/forks-override/solisnek.d.ts +8 -0
  170. package/build/dex/solidly/forks-override/solisnek.js +15 -0
  171. package/build/dex/solidly/forks-override/solisnek.js.map +1 -0
  172. package/build/dex/swaap-v1/config.d.ts +17 -0
  173. package/build/dex/swaap-v1/config.js +56 -0
  174. package/build/dex/swaap-v1/config.js.map +1 -0
  175. package/build/dex/swaap-v1/constants.d.ts +6 -0
  176. package/build/dex/swaap-v1/constants.js +17 -0
  177. package/build/dex/swaap-v1/constants.js.map +1 -0
  178. package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +25 -0
  179. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +62 -0
  180. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +1 -0
  181. package/build/dex/swaap-v1/libraries/Const.d.ts +18 -0
  182. package/build/dex/swaap-v1/libraries/Const.js +26 -0
  183. package/build/dex/swaap-v1/libraries/Const.js.map +1 -0
  184. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +77 -0
  185. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +316 -0
  186. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +1 -0
  187. package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +75 -0
  188. package/build/dex/swaap-v1/libraries/LogExpMath.js +418 -0
  189. package/build/dex/swaap-v1/libraries/LogExpMath.js.map +1 -0
  190. package/build/dex/swaap-v1/libraries/MathMMM.d.ts +185 -0
  191. package/build/dex/swaap-v1/libraries/MathMMM.js +453 -0
  192. package/build/dex/swaap-v1/libraries/MathMMM.js.map +1 -0
  193. package/build/dex/swaap-v1/libraries/Num.d.ts +31 -0
  194. package/build/dex/swaap-v1/libraries/Num.js +167 -0
  195. package/build/dex/swaap-v1/libraries/Num.js.map +1 -0
  196. package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +23 -0
  197. package/build/dex/swaap-v1/libraries/PoolQuotations.js +131 -0
  198. package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +1 -0
  199. package/build/dex/swaap-v1/libraries/Struct.d.ts +56 -0
  200. package/build/dex/swaap-v1/libraries/Struct.js +3 -0
  201. package/build/dex/swaap-v1/libraries/Struct.js.map +1 -0
  202. package/build/dex/swaap-v1/swaap-v1-pool.d.ts +45 -0
  203. package/build/dex/swaap-v1/swaap-v1-pool.js +656 -0
  204. package/build/dex/swaap-v1/swaap-v1-pool.js.map +1 -0
  205. package/build/dex/swaap-v1/swaap-v1.d.ts +62 -0
  206. package/build/dex/swaap-v1/swaap-v1.js +379 -0
  207. package/build/dex/swaap-v1/swaap-v1.js.map +1 -0
  208. package/build/dex/swaap-v1/types.d.ts +106 -0
  209. package/build/dex/swaap-v1/types.js +9 -0
  210. package/build/dex/swaap-v1/types.js.map +1 -0
  211. package/build/dex/uniswap-v2/config.js +8 -0
  212. package/build/dex/uniswap-v2/config.js.map +1 -1
  213. package/build/dex/zerox/index.d.ts +1 -1
  214. package/build/dex/zerox/index.js.map +1 -1
  215. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +16 -0
  216. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +16 -0
  217. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +16 -0
  218. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +16 -0
  219. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +16 -0
  220. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +16 -0
  221. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +16 -0
  222. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +16 -0
  223. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +9 -0
  224. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +9 -0
  225. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +9 -0
  226. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +9 -0
  227. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +9 -0
  228. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +9 -0
  229. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +9 -0
  230. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +9 -0
  231. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +9 -0
  232. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +12 -0
  233. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +7 -0
  234. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +7 -0
  235. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +7 -0
  236. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +7 -0
  237. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +12 -0
  238. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +7 -0
  239. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +7 -0
  240. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +78 -0
  241. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +81 -0
  242. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +78 -0
  243. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +78 -0
  244. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +81 -0
  245. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +81 -0
  246. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +81 -0
  247. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +81 -0
  248. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +64 -0
  249. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +85 -0
  250. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +64 -0
  251. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +52 -0
  252. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +52 -0
  253. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +52 -0
  254. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +55 -0
  255. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +55 -0
  256. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +55 -0
  257. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +23 -0
  258. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +37 -0
  259. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +23 -0
  260. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +23 -0
  261. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +51 -0
  262. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +58 -0
  263. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +23 -0
  264. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +23 -0
  265. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +9 -0
  266. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +16 -0
  267. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +23 -0
  268. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +12 -0
  269. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +7 -0
  270. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +12 -0
  271. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +12 -0
  272. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +7 -0
  273. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +7 -0
  274. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +7 -0
  275. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +7 -0
  276. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +7 -0
  277. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +7 -0
  278. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +130 -0
  279. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +136 -0
  280. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +100 -0
  281. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +100 -0
  282. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +166 -0
  283. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +190 -0
  284. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +114 -0
  285. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +114 -0
  286. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +55 -0
  287. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +73 -0
  288. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +82 -0
  289. package/package.json +1 -1
  290. package/src/dex/uniswap-v2/config.ts +9 -0
  291. package/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts +105 -1
  292. package/tests/constants-e2e.ts +5 -0
  293. package/tests/token-storage-slots.json +8 -0
  294. package/.idea/codeStyles/Project.xml +0 -59
  295. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  296. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  297. package/.idea/modules.xml +0 -8
  298. package/.idea/paraswap-dex-lib.iml +0 -12
  299. package/.idea/prettier.xml +0 -7
  300. package/.idea/vcs.xml +0 -6
  301. package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +0 -94
  302. package/build/dex/uniswap-v3/uniswap-v3-new.js +0 -923
  303. package/build/dex/uniswap-v3/uniswap-v3-new.js.map +0 -1
  304. package/scripts/get-uniswap-v3-dexes.ts +0 -64
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatypusPoolBase = exports.calcPrice = exports.rpow = exports.rmul = exports.wdiv = exports.wmul = exports.RAY = exports.WAD = exports.ETH_UNIT = void 0;
4
+ const composed_event_subscriber_1 = require("../../composed-event-subscriber");
5
+ const bigint_constants_1 = require("../../bigint-constants");
6
+ exports.ETH_UNIT = bigint_constants_1.BI_POWS[18];
7
+ exports.WAD = bigint_constants_1.BI_POWS[18];
8
+ exports.RAY = bigint_constants_1.BI_POWS[27];
9
+ function wmul(x, y) {
10
+ return (x * y + exports.WAD / 2n) / exports.WAD;
11
+ }
12
+ exports.wmul = wmul;
13
+ function wdiv(x, y) {
14
+ return (x * exports.WAD + y / 2n) / y;
15
+ }
16
+ exports.wdiv = wdiv;
17
+ function rmul(x, y) {
18
+ return (x * y + exports.RAY / 2n) / exports.RAY;
19
+ }
20
+ exports.rmul = rmul;
21
+ function rpow(x, n) {
22
+ let z = n % 2n !== 0n ? x : exports.RAY;
23
+ for (n /= 2n; n !== 0n; n /= 2n) {
24
+ x = rmul(x, x);
25
+ if (n % 2n !== 0n) {
26
+ z = rmul(z, x);
27
+ }
28
+ }
29
+ return z;
30
+ }
31
+ exports.rpow = rpow;
32
+ function slippageFunc(k, n, c1, xThreshold, x) {
33
+ if (x < xThreshold) {
34
+ return c1 - x;
35
+ }
36
+ else {
37
+ return wdiv(k, (rpow((x * exports.RAY) / exports.WAD, n) * exports.WAD) / exports.RAY);
38
+ }
39
+ }
40
+ function calcSlippage(k, n, c1, xThreshold, cash, liability, cashChange, addCash) {
41
+ const covBefore = wdiv(cash, liability);
42
+ let covAfter;
43
+ if (addCash) {
44
+ covAfter = wdiv(cash + cashChange, liability);
45
+ }
46
+ else {
47
+ covAfter = wdiv(cash - cashChange, liability);
48
+ }
49
+ if (covBefore === covAfter) {
50
+ return 0n;
51
+ }
52
+ const slippageBefore = slippageFunc(k, n, c1, xThreshold, covBefore);
53
+ const slippageAfter = slippageFunc(k, n, c1, xThreshold, covAfter);
54
+ if (covBefore > covAfter) {
55
+ return wdiv(slippageAfter - slippageBefore, covBefore - covAfter);
56
+ }
57
+ else {
58
+ return wdiv(slippageBefore - slippageAfter, covAfter - covBefore);
59
+ }
60
+ }
61
+ function calcSwappingSlippage(si, sj) {
62
+ return exports.WAD + si - sj;
63
+ }
64
+ function calcHaircut(amount, rate) {
65
+ return wmul(amount, rate);
66
+ }
67
+ function calcPrice(srcToken, destToken, fromAmount, idealToAmount, state) {
68
+ if (state.asset[destToken.address].cash < idealToAmount)
69
+ return 0n;
70
+ const slippageFrom = calcSlippage(state.params.slippageParamK, state.params.slippageParamN, state.params.c1, state.params.xThreshold, state.asset[srcToken.address].cash, state.asset[srcToken.address].liability, fromAmount, true);
71
+ const slippageTo = calcSlippage(state.params.slippageParamK, state.params.slippageParamN, state.params.c1, state.params.xThreshold, state.asset[destToken.address].cash, state.asset[destToken.address].liability, idealToAmount, false);
72
+ const swappingSlippage = calcSwappingSlippage(slippageFrom, slippageTo);
73
+ const toAmount = wmul(idealToAmount, swappingSlippage);
74
+ const haircut = calcHaircut(toAmount, state.params.haircutRate);
75
+ return toAmount - haircut;
76
+ }
77
+ exports.calcPrice = calcPrice;
78
+ class PlatypusPoolBase extends composed_event_subscriber_1.ComposedEventSubscriber {
79
+ constructor(dexKey, network, name, dexHelper, parts, blankState) {
80
+ super(dexKey, name, dexHelper.getLogger(`${dexKey}-${network} ${name}`), dexHelper, parts, blankState);
81
+ this.dexKey = dexKey;
82
+ this.network = network;
83
+ }
84
+ }
85
+ exports.PlatypusPoolBase = PlatypusPoolBase;
86
+ //# sourceMappingURL=pool-base.js.map
@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CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAChE,OAAO,QAAQ,GAAG,OAAO,CAAC;AAC5B,CAAC;AAhCD,8BAgCC;AAED,MAAsB,gBAEpB,SAAQ,mDAA8B;IACtC,YACW,MAAc,EACJ,OAAe,EAClC,IAAY,EACZ,SAAqB,EACrB,KAA2C,EAC3C,UAA+B;QAE/B,KAAK,CACH,MAAM,EACN,IAAI,EACJ,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC,EACnD,SAAS,EACT,KAAK,EACL,UAAU,CACX,CAAC;QAdO,WAAM,GAAN,MAAM,CAAQ;QACJ,YAAO,GAAP,OAAO,CAAQ;IAcpC,CAAC;CAQF;AA3BD,4CA2BC"}
@@ -0,0 +1,8 @@
1
+ import { Address, Token } from '../../types';
2
+ import { IDexHelper } from '../../dex-helper/idex-helper';
3
+ import { PlatypusPurePoolState, PlatypusPurePoolConfigInfo } from './types';
4
+ import { PlatypusPoolBase } from './pool-base';
5
+ export declare class PlatypusPurePool extends PlatypusPoolBase<PlatypusPurePoolState> {
6
+ constructor(dexKey: string, network: number, name: string, poolAddress: Address, poolCfg: PlatypusPurePoolConfigInfo, dexHelper: IDexHelper);
7
+ computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: PlatypusPurePoolState): bigint[];
8
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatypusPurePool = void 0;
4
+ const lens_1 = require("../../lens");
5
+ const asset_1 = require("./asset");
6
+ const pool_subscriber_1 = require("./pool-subscriber");
7
+ const utils_1 = require("../../utils");
8
+ const pool_base_1 = require("./pool-base");
9
+ class PlatypusPurePool extends pool_base_1.PlatypusPoolBase {
10
+ constructor(dexKey, network, name, poolAddress, poolCfg, dexHelper) {
11
+ super(dexKey, network, name, dexHelper, [
12
+ new pool_subscriber_1.PlatypusPoolSubscriber(poolAddress, (0, lens_1.lens)().params, dexHelper.getLogger(`${dexKey}-${network} Params ${name}`)),
13
+ ...Object.entries(poolCfg.tokens).map(([tokenAddress, c]) => new asset_1.PlatypusAssetSubscriber(c.assetAddress, (0, lens_1.lens)().asset[tokenAddress], dexHelper.getLogger(`${dexKey}-${network} ${c.tokenSymbol} asset ${name}`))),
14
+ ], {
15
+ params: {
16
+ paused: false,
17
+ slippageParamK: 0n,
18
+ slippageParamN: 0n,
19
+ c1: 0n,
20
+ xThreshold: 0n,
21
+ haircutRate: 0n,
22
+ retentionRatio: 0n,
23
+ maxPriceDeviation: 0n,
24
+ },
25
+ asset: {},
26
+ });
27
+ }
28
+ computePrices(srcToken, destToken, amounts, state) {
29
+ return amounts.map(fromAmount => {
30
+ const idealToAmount = (fromAmount * (0, utils_1.getBigIntPow)(destToken.decimals)) /
31
+ (0, utils_1.getBigIntPow)(srcToken.decimals);
32
+ return (0, pool_base_1.calcPrice)(srcToken, destToken, fromAmount, idealToAmount, state);
33
+ });
34
+ }
35
+ }
36
+ exports.PlatypusPurePool = PlatypusPurePool;
37
+ //# sourceMappingURL=pool-pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-pure.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool-pure.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,mCAAkD;AAClD,uDAA2D;AAG3D,uCAA2C;AAC3C,2CAA0D;AAE1D,MAAa,gBAAiB,SAAQ,4BAAuC;IAC3E,YACE,MAAc,EACd,OAAe,EACf,IAAY,EACZ,WAAoB,EACpB,OAAmC,EACnC,SAAqB;QAErB,KAAK,CACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT;YACE,IAAI,wCAAsB,CACxB,WAAW,EACX,IAAA,WAAI,GAAuC,CAAC,MAAM,EAClD,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,OAAO,WAAW,IAAI,EAAE,CAAC,CAC3D;YACD,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CACnC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CACpB,IAAI,+BAAuB,CACzB,CAAC,CAAC,YAAY,EACd,IAAA,WAAI,GAAuC,CAAC,KAAK,CAAC,YAAY,CAAC,EAC/D,SAAS,CAAC,SAAS,CACjB,GAAG,MAAM,IAAI,OAAO,IAAI,CAAC,CAAC,WAAW,UAAU,IAAI,EAAE,CACtD,CACF,CACJ;SACF,EACD;YACE,MAAM,EAAE;gBACN,MAAM,EAAE,KAAK;gBACb,cAAc,EAAE,EAAE;gBAClB,cAAc,EAAE,EAAE;gBAClB,EAAE,EAAE,EAAE;gBACN,UAAU,EAAE,EAAE;gBACd,WAAW,EAAE,EAAE;gBACf,cAAc,EAAE,EAAE;gBAClB,iBAAiB,EAAE,EAAE;aACtB;YACD,KAAK,EAAE,EAAE;SACV,CACF,CAAC;IACJ,CAAC;IAEM,aAAa,CAClB,QAAe,EACf,SAAgB,EAChB,OAAiB,EACjB,KAA4B;QAE5B,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC9B,MAAM,aAAa,GACjB,CAAC,UAAU,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC/C,IAAA,oBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAClC,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA5DD,4CA4DC"}
@@ -0,0 +1,14 @@
1
+ import { DeepReadonly } from 'ts-essentials';
2
+ import { PartialEventSubscriber } from '../../composed-event-subscriber';
3
+ import { Address, BlockHeader, Log, Logger, MultiCallInput, MultiCallOutput } from '../../types';
4
+ import { Lens } from '../../lens';
5
+ import { Interface } from '@ethersproject/abi';
6
+ import { PlatypusPoolParams } from './types';
7
+ export declare class PlatypusPoolSubscriber<State> extends PartialEventSubscriber<State, PlatypusPoolParams> {
8
+ private pool;
9
+ static readonly poolInterface: Interface;
10
+ constructor(pool: Address, lens: Lens<DeepReadonly<State>, DeepReadonly<PlatypusPoolParams>>, logger: Logger);
11
+ processLog(state: DeepReadonly<PlatypusPoolParams>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): DeepReadonly<PlatypusPoolParams> | null;
12
+ getGenerateStateMultiCallInputs(): MultiCallInput[];
13
+ generateState(multicallOutputs: MultiCallOutput[], blockNumber?: number | 'latest'): DeepReadonly<PlatypusPoolParams>;
14
+ }
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PlatypusPoolSubscriber = void 0;
7
+ const composed_event_subscriber_1 = require("../../composed-event-subscriber");
8
+ const abi_1 = require("@ethersproject/abi");
9
+ const pool_json_1 = __importDefault(require("../../abi/platypus/pool.json"));
10
+ class PlatypusPoolSubscriber extends composed_event_subscriber_1.PartialEventSubscriber {
11
+ constructor(pool, lens, logger) {
12
+ super([pool], lens, logger);
13
+ this.pool = pool;
14
+ }
15
+ processLog(state, log, blockHeader) {
16
+ try {
17
+ const parsed = PlatypusPoolSubscriber.poolInterface.parseLog(log);
18
+ switch (parsed.name) {
19
+ case 'Paused': {
20
+ return {
21
+ ...state,
22
+ paused: true,
23
+ };
24
+ }
25
+ case 'Unpaused': {
26
+ return {
27
+ ...state,
28
+ paused: false,
29
+ };
30
+ }
31
+ case 'PriceDeviationUpdated': {
32
+ const previousPriceDeviation = BigInt(parsed.args.previousPriceDeviation.toString());
33
+ const newPriceDeviation = BigInt(parsed.args.newPriceDeviation.toString());
34
+ if (state.maxPriceDeviation !== previousPriceDeviation) {
35
+ this.logger.error('state.maxPriceDeviation !== previousPriceDeviation');
36
+ }
37
+ return {
38
+ ...state,
39
+ maxPriceDeviation: newPriceDeviation,
40
+ };
41
+ }
42
+ case 'SlippageParamsUpdated': {
43
+ const previousK = BigInt(parsed.args.previousK.toString());
44
+ const newK = BigInt(parsed.args.newK.toString());
45
+ const previousN = BigInt(parsed.args.previousN.toString());
46
+ const newN = BigInt(parsed.args.newN.toString());
47
+ const previousC1 = BigInt(parsed.args.previousC1.toString());
48
+ const newC1 = BigInt(parsed.args.newC1.toString());
49
+ const previousXThreshold = BigInt(parsed.args.previousXThreshold.toString());
50
+ const newXThreshold = BigInt(parsed.args.newXThreshold.toString());
51
+ if (state.slippageParamK !== previousK) {
52
+ this.logger.error('state.slippageParamK !== previousK');
53
+ }
54
+ if (state.slippageParamN !== previousN) {
55
+ this.logger.error('state.slippageParamN !== previousN');
56
+ }
57
+ if (state.c1 !== previousC1) {
58
+ this.logger.error('state.c1 !== previousC1');
59
+ }
60
+ if (state.xThreshold !== previousXThreshold) {
61
+ this.logger.error('state.xThreshold !== previousXThreshold');
62
+ }
63
+ return {
64
+ ...state,
65
+ slippageParamK: newK,
66
+ slippageParamN: newN,
67
+ c1: newC1,
68
+ xThreshold: newXThreshold,
69
+ };
70
+ }
71
+ case 'HaircutRateUpdated': {
72
+ const previousHaircut = BigInt(parsed.args.previousHaircut.toString());
73
+ const newHaircut = BigInt(parsed.args.newHaircut.toString());
74
+ if (state.haircutRate !== previousHaircut) {
75
+ this.logger.error('state.haircutRate !== previousHaircut');
76
+ }
77
+ return {
78
+ ...state,
79
+ haircutRate: newHaircut,
80
+ };
81
+ }
82
+ case 'RetentionRatioUpdated': {
83
+ const previousRetentionRatio = BigInt(parsed.args.previousRetentionRatio.toString());
84
+ const newRetentionRatio = BigInt(parsed.args.newRetentionRatio.toString());
85
+ if (state.retentionRatio !== previousRetentionRatio) {
86
+ this.logger.error('state.retentionRatio !== previousRetentionRatio');
87
+ }
88
+ return {
89
+ ...state,
90
+ retentionRatio: newRetentionRatio,
91
+ };
92
+ }
93
+ default:
94
+ return null;
95
+ }
96
+ }
97
+ catch (e) {
98
+ this.logger.error('Failed to parse log', e);
99
+ return null;
100
+ }
101
+ }
102
+ getGenerateStateMultiCallInputs() {
103
+ return [
104
+ {
105
+ target: this.pool,
106
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('paused'),
107
+ },
108
+ {
109
+ target: this.pool,
110
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getSlippageParamK'),
111
+ },
112
+ {
113
+ target: this.pool,
114
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getSlippageParamN'),
115
+ },
116
+ {
117
+ target: this.pool,
118
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getC1'),
119
+ },
120
+ {
121
+ target: this.pool,
122
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getXThreshold'),
123
+ },
124
+ {
125
+ target: this.pool,
126
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getHaircutRate'),
127
+ },
128
+ {
129
+ target: this.pool,
130
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getRetentionRatio'),
131
+ },
132
+ {
133
+ target: this.pool,
134
+ callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getMaxPriceDeviation'),
135
+ },
136
+ ];
137
+ }
138
+ generateState(multicallOutputs, blockNumber) {
139
+ return {
140
+ paused: PlatypusPoolSubscriber.poolInterface.decodeFunctionResult('paused', multicallOutputs[0])[0],
141
+ slippageParamK: BigInt(PlatypusPoolSubscriber.poolInterface
142
+ .decodeFunctionResult('getSlippageParamK', multicallOutputs[1])[0]
143
+ .toString()),
144
+ slippageParamN: BigInt(PlatypusPoolSubscriber.poolInterface
145
+ .decodeFunctionResult('getSlippageParamN', multicallOutputs[2])[0]
146
+ .toString()),
147
+ c1: BigInt(PlatypusPoolSubscriber.poolInterface
148
+ .decodeFunctionResult('getC1', multicallOutputs[3])[0]
149
+ .toString()),
150
+ xThreshold: BigInt(PlatypusPoolSubscriber.poolInterface
151
+ .decodeFunctionResult('getXThreshold', multicallOutputs[4])[0]
152
+ .toString()),
153
+ haircutRate: BigInt(PlatypusPoolSubscriber.poolInterface
154
+ .decodeFunctionResult('getHaircutRate', multicallOutputs[5])[0]
155
+ .toString()),
156
+ retentionRatio: BigInt(PlatypusPoolSubscriber.poolInterface
157
+ .decodeFunctionResult('getRetentionRatio', multicallOutputs[6])[0]
158
+ .toString()),
159
+ maxPriceDeviation: BigInt(PlatypusPoolSubscriber.poolInterface
160
+ .decodeFunctionResult('getMaxPriceDeviation', multicallOutputs[7])[0]
161
+ .toString()),
162
+ };
163
+ }
164
+ }
165
+ exports.PlatypusPoolSubscriber = PlatypusPoolSubscriber;
166
+ PlatypusPoolSubscriber.poolInterface = new abi_1.Interface(pool_json_1.default);
167
+ //# sourceMappingURL=pool-subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-subscriber.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool-subscriber.ts"],"names":[],"mappings":";;;;;;AACA,+EAAyE;AAUzE,4CAA+C;AAC/C,6EAAmD;AAGnD,MAAa,sBAA8B,SAAQ,kDAGlD;IAGC,YACU,IAAa,EACrB,IAAiE,EACjE,MAAc;QAEd,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAJpB,SAAI,GAAJ,IAAI,CAAS;IAKvB,CAAC;IAEM,UAAU,CACf,KAAuC,EACvC,GAAkB,EAClB,WAAkC;QAElC,IAAI;YACF,MAAM,MAAM,GAAG,sBAAsB,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAClE,QAAQ,MAAM,CAAC,IAAI,EAAE;gBACnB,KAAK,QAAQ,CAAC,CAAC;oBACb,OAAO;wBACL,GAAG,KAAK;wBACR,MAAM,EAAE,IAAI;qBACb,CAAC;iBACH;gBACD,KAAK,UAAU,CAAC,CAAC;oBACf,OAAO;wBACL,GAAG,KA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AAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9D,QAAQ,EAAE,CACd;YACD,cAAc,EAAE,MAAM,CACpB,sBAAsB,CAAC,aAAa;iBACjC,oBAAoB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACjE,QAAQ,EAAE,CACd;YACD,iBAAiB,EAAE,MAAM,CACvB,sBAAsB,CAAC,aAAa;iBACjC,oBAAoB,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpE,QAAQ,EAAE,CACd;SACF,CAAC;IACJ,CAAC;;AA9NH,wDA+NC;AA3NiB,oCAAa,GAAG,IAAI,eAAS,CAAC,mBAAO,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Address, Token } from '../../types';
2
+ import { IDexHelper } from '../../dex-helper/idex-helper';
3
+ import { PlatypusPoolState, PlatypusPoolConfigInfo } from './types';
4
+ import { PlatypusPoolBase } from './pool-base';
5
+ export declare class PlatypusPool extends PlatypusPoolBase<PlatypusPoolState> {
6
+ constructor(dexKey: string, network: number, name: string, poolAddress: Address, poolCfg: PlatypusPoolConfigInfo, dexHelper: IDexHelper);
7
+ computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: PlatypusPoolState): bigint[];
8
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatypusPool = void 0;
4
+ const lens_1 = require("../../lens");
5
+ const chainlink_1 = require("../../lib/chainlink");
6
+ const asset_1 = require("./asset");
7
+ const pool_subscriber_1 = require("./pool-subscriber");
8
+ const utils_1 = require("../../utils");
9
+ const pool_base_1 = require("./pool-base");
10
+ class PlatypusPool extends pool_base_1.PlatypusPoolBase {
11
+ constructor(dexKey, network, name, poolAddress, poolCfg, dexHelper) {
12
+ super(dexKey, network, name, dexHelper, [
13
+ new pool_subscriber_1.PlatypusPoolSubscriber(poolAddress, (0, lens_1.lens)().params, dexHelper.getLogger(`${dexKey}-${network} Params ${name}`)),
14
+ ...Object.entries(poolCfg.tokens)
15
+ .map(([tokenAddress, c]) => [
16
+ new asset_1.PlatypusAssetSubscriber(c.assetAddress, (0, lens_1.lens)().asset[tokenAddress], dexHelper.getLogger(`${dexKey}-${network} ${c.tokenSymbol} asset ${name}`)),
17
+ new chainlink_1.ChainLinkSubscriber(c.chainlink.proxyAddress, c.chainlink.aggregatorAddress, (0, lens_1.lens)().chainlink[tokenAddress], dexHelper.getLogger(`${c.tokenSymbol} ChainLink for ${dexKey}-${network} ${name}`)),
18
+ ])
19
+ .flat(),
20
+ ], {
21
+ params: {
22
+ paused: false,
23
+ slippageParamK: 0n,
24
+ slippageParamN: 0n,
25
+ c1: 0n,
26
+ xThreshold: 0n,
27
+ haircutRate: 0n,
28
+ retentionRatio: 0n,
29
+ maxPriceDeviation: 0n,
30
+ },
31
+ asset: {},
32
+ chainlink: {},
33
+ });
34
+ }
35
+ computePrices(srcToken, destToken, amounts, state) {
36
+ const tokenAPrice = state.chainlink[srcToken.address].answer;
37
+ const tokenBPrice = state.chainlink[destToken.address].answer;
38
+ if (tokenBPrice > tokenAPrice) {
39
+ if (((tokenBPrice - tokenAPrice) * pool_base_1.ETH_UNIT) / tokenBPrice >
40
+ state.params.maxPriceDeviation) {
41
+ return Array(amounts.length).fill(0n);
42
+ }
43
+ }
44
+ else {
45
+ if (((tokenAPrice - tokenBPrice) * pool_base_1.ETH_UNIT) / tokenAPrice >
46
+ state.params.maxPriceDeviation) {
47
+ return Array(amounts.length).fill(0n);
48
+ }
49
+ }
50
+ return amounts.map(fromAmount => {
51
+ const idealToAmount = (fromAmount * (0, utils_1.getBigIntPow)(destToken.decimals)) /
52
+ (0, utils_1.getBigIntPow)(srcToken.decimals);
53
+ return (0, pool_base_1.calcPrice)(srcToken, destToken, fromAmount, idealToAmount, state);
54
+ });
55
+ }
56
+ }
57
+ exports.PlatypusPool = PlatypusPool;
58
+ //# sourceMappingURL=pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,mDAA0D;AAC1D,mCAAkD;AAClD,uDAA2D;AAG3D,uCAA2C;AAC3C,2CAAoE;AAEpE,MAAa,YAAa,SAAQ,4BAAmC;IACnE,YACE,MAAc,EACd,OAAe,EACf,IAAY,EACZ,WAAoB,EACpB,OAA+B,EAC/B,SAAqB;QAErB,KAAK,CACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT;YACE,IAAI,wCAAsB,CACxB,WAAW,EACX,IAAA,WAAI,GAAmC,CAAC,MAAM,EAC9C,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,OAAO,WAAW,IAAI,EAAE,CAAC,CAC3D;YACD,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;iBAC9B,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;gBAC1B,IAAI,+BAAuB,CACzB,CAAC,CAAC,YAAY,EACd,IAAA,WAAI,GAAmC,CAAC,KAAK,CAAC,YAAY,CAAC,EAC3D,SAAS,CAAC,SAAS,CACjB,GAAG,MAAM,IAAI,OAAO,IAAI,CAAC,CAAC,WAAW,UAAU,IAAI,EAAE,CACtD,CACF;gBACD,IAAI,+BAAmB,CACrB,CAAC,CAAC,SAAS,CAAC,YAAY,EACxB,CAAC,CAAC,SAAS,CAAC,iBAAiB,EAC7B,IAAA,WAAI,GAAmC,CAAC,SAAS,CAAC,YAAY,CAAC,EAC/D,SAAS,CAAC,SAAS,CACjB,GAAG,CAAC,CAAC,WAAW,kBAAkB,MAAM,IAAI,OAAO,IAAI,IAAI,EAAE,CAC9D,CACF;aACF,CAAC;iBACD,IAAI,EAAE;SACV,EACD;YACE,MAAM,EAAE;gBACN,MAAM,EAAE,KAAK;gBACb,cAA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,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvFD,oCAuFC"}
@@ -0,0 +1,92 @@
1
+ import { Address } from '../../types';
2
+ import { ChainLinkState } from '../../lib/chainlink';
3
+ import { StakedAvaxState } from '../../lib/benqi/staked-avax';
4
+ export declare enum PlatypusOracleType {
5
+ None = "None",
6
+ ChainLink = "ChainLink",
7
+ StakedAvax = "StakedAvax"
8
+ }
9
+ export declare type PlatypusPoolStateCommon = {
10
+ params: PlatypusPoolParams;
11
+ asset: {
12
+ [underlyingAddress: string]: PlatypusAssetState;
13
+ };
14
+ };
15
+ export declare type PlatypusPoolState = PlatypusPoolStateCommon & {
16
+ chainlink: {
17
+ [underlyingAddress: string]: ChainLinkState;
18
+ };
19
+ };
20
+ export declare type PlatypusPurePoolState = PlatypusPoolStateCommon;
21
+ export declare type PlatypusAvaxPoolState = PlatypusPoolStateCommon & {
22
+ stakedAvax: StakedAvaxState;
23
+ };
24
+ export declare type PlatypusPoolParams = {
25
+ paused: boolean;
26
+ slippageParamK: bigint;
27
+ slippageParamN: bigint;
28
+ c1: bigint;
29
+ xThreshold: bigint;
30
+ haircutRate: bigint;
31
+ retentionRatio: bigint;
32
+ maxPriceDeviation: bigint;
33
+ };
34
+ export declare type PlatypusAssetState = {
35
+ cash: bigint;
36
+ liability: bigint;
37
+ };
38
+ export declare type PlatypusConfigInfo = {
39
+ poolAddresses: Address[];
40
+ pools: {
41
+ [poolAddress: string]: PlatypusPoolConfigInfo | PlatypusPurePoolConfigInfo | PlatypusAvaxPoolConfigInfo;
42
+ };
43
+ };
44
+ export declare type PlatypusPoolConfigInfo = {
45
+ oracleType: PlatypusOracleType.ChainLink;
46
+ priceOracleAddress: Address;
47
+ tokenAddresses: Address[];
48
+ tokens: {
49
+ [tokenAddress: string]: {
50
+ tokenSymbol: string;
51
+ tokenDecimals: number;
52
+ assetAddress: Address;
53
+ chainlink: {
54
+ proxyAddress: Address;
55
+ aggregatorAddress: Address;
56
+ };
57
+ };
58
+ };
59
+ };
60
+ export declare type PlatypusPurePoolConfigInfo = {
61
+ oracleType: PlatypusOracleType.None;
62
+ tokenAddresses: Address[];
63
+ tokens: {
64
+ [tokenAddress: string]: {
65
+ tokenSymbol: string;
66
+ tokenDecimals: number;
67
+ assetAddress: Address;
68
+ };
69
+ };
70
+ };
71
+ export declare type PlatypusAvaxPoolConfigInfo = {
72
+ oracleType: PlatypusOracleType.StakedAvax;
73
+ priceOracleAddress: Address;
74
+ tokenAddresses: Address[];
75
+ tokens: {
76
+ [tokenAddress: string]: {
77
+ tokenSymbol: string;
78
+ tokenDecimals: number;
79
+ assetAddress: Address;
80
+ };
81
+ };
82
+ };
83
+ export declare type PlatypusData = {
84
+ pool: Address;
85
+ };
86
+ export declare type DexParams = {
87
+ pools: {
88
+ address: Address;
89
+ name: string;
90
+ oracleType: PlatypusOracleType;
91
+ }[];
92
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatypusOracleType = void 0;
4
+ var PlatypusOracleType;
5
+ (function (PlatypusOracleType) {
6
+ PlatypusOracleType["None"] = "None";
7
+ PlatypusOracleType["ChainLink"] = "ChainLink";
8
+ PlatypusOracleType["StakedAvax"] = "StakedAvax";
9
+ })(PlatypusOracleType = exports.PlatypusOracleType || (exports.PlatypusOracleType = {}));
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/platypus/types.ts"],"names":[],"mappings":";;;AAIA,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,6CAAuB,CAAA;IACvB,+CAAyB,CAAA;AAC3B,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B"}
@@ -0,0 +1,6 @@
1
+ import { IDexHelper } from '../../dex-helper';
2
+ import { QuickSwapV3 } from './quickswap-v3';
3
+ export declare class SpiritSwapV3 extends QuickSwapV3 {
4
+ static dexKeys: string[];
5
+ constructor(dexHelper: IDexHelper);
6
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SpiritSwapV3 = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const config_1 = require("./config");
9
+ const quickswap_v3_1 = require("./quickswap-v3");
10
+ const config = lodash_1.default.pick(config_1.QuickSwapConfig, ['SpiritSwapV3']).SpiritSwapV3;
11
+ class SpiritSwapV3 extends quickswap_v3_1.QuickSwapV3 {
12
+ // public static dexKeysWithNetwork
13
+ constructor(dexHelper) {
14
+ super(dexHelper, 'spiritswapv3', config[dexHelper.config.data.network].router);
15
+ }
16
+ }
17
+ exports.SpiritSwapV3 = SpiritSwapV3;
18
+ SpiritSwapV3.dexKeys = ['spiritswapv3'];
19
+ //# sourceMappingURL=spiritswap-v3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spiritswap-v3.js","sourceRoot":"","sources":["../../../src/dex/quickswap/spiritswap-v3.ts"],"names":[],"mappings":";;;;;;AACA,oDAAuB;AACvB,qCAA2C;AAC3C,iDAA6C;AAE7C,MAAM,MAAM,GAAG,gBAAC,CAAC,IAAI,CAAC,wBAAe,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;AAEtE,MAAa,YAAa,SAAQ,0BAAW;IAG3C,mCAAmC;IACnC,YAAY,SAAqB;QAC/B,KAAK,CACH,SAAS,EACT,cAAc,EACd,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAC7C,CAAC;IACJ,CAAC;;AAVH,oCAWC;AAVQ,oBAAO,GAAG,CAAC,cAAc,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap, AdapterMappings } from '../../types';
3
+ export declare const SmardexConfig: DexConfigMap<DexParams>;
4
+ export declare const Adapters: Record<number, AdapterMappings>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Adapters = exports.SmardexConfig = void 0;
4
+ const constants_1 = require("../../constants");
5
+ const GATEWAY_SUBGRAPH = 'https://subgraph.smardex.io';
6
+ const MAINNET_INIT_HASH = '0xc762a0f9885cc92b9fd8eef224b75997682b634460611bc0f2138986e20b653f';
7
+ const LAYER2_INIT_HASH = '0x33bee911475f015247aeb1eebe149d1c6d2669be54126c29d85df6b0abb4c4e9';
8
+ exports.SmardexConfig = {
9
+ Smardex: {
10
+ [constants_1.Network.MAINNET]: {
11
+ factoryAddress: '0xB878DC600550367e14220d4916Ff678fB284214F',
12
+ router: '0xC33984ABcAe20f47a754eF78f6526FeF266c0C6F',
13
+ initCode: MAINNET_INIT_HASH,
14
+ subgraphURL: `${GATEWAY_SUBGRAPH}/ethereum`,
15
+ },
16
+ [constants_1.Network.ARBITRUM]: {
17
+ factoryAddress: '0x41A00e3FbE7F479A99bA6822704d9c5dEB611F22',
18
+ router: '0xDA3970a20cdc2B1269fc96C4E8D300E0fdDB7b3D',
19
+ initCode: LAYER2_INIT_HASH,
20
+ subgraphURL: `${GATEWAY_SUBGRAPH}/arbitrum`,
21
+ },
22
+ [constants_1.Network.BSC]: {
23
+ factoryAddress: '0xA8EF6FEa013034E62E2C4A9Ec1CDb059fE23Af33',
24
+ router: '0xaB3699B71e89a53c529eC037C3389B5A2Caf545A',
25
+ initCode: LAYER2_INIT_HASH,
26
+ subgraphURL: `${GATEWAY_SUBGRAPH}/bsc`,
27
+ },
28
+ [constants_1.Network.POLYGON]: {
29
+ factoryAddress: '0x9A1e1681f6D59Ca051776410465AfAda6384398f',
30
+ router: '0xedD758D17175Dc9131992ebd02F55Cc4ebeb7B7c',
31
+ initCode: LAYER2_INIT_HASH,
32
+ subgraphURL: `${GATEWAY_SUBGRAPH}/polygon`,
33
+ },
34
+ [constants_1.Network.BASE]: {
35
+ factoryAddress: '0xdd4536dD9636564D891c919416880a3e250f975A',
36
+ router: '0xF03D133627364E5eDDaB8134faB3A030cf7b3020',
37
+ initCode: LAYER2_INIT_HASH,
38
+ subgraphURL: `${GATEWAY_SUBGRAPH}/base`,
39
+ },
40
+ },
41
+ };
42
+ exports.Adapters = {
43
+ [constants_1.Network.MAINNET]: {
44
+ [constants_1.SwapSide.SELL]: [{ name: 'Adapter04', index: 6 }],
45
+ [constants_1.SwapSide.BUY]: [{ name: 'BuyAdapter02', index: 2 }],
46
+ },
47
+ [constants_1.Network.ARBITRUM]: {
48
+ [constants_1.SwapSide.SELL]: [{ name: 'ArbitrumAdapter02', index: 9 }],
49
+ [constants_1.SwapSide.BUY]: [{ name: 'ArbitrumBuyAdapter', index: 9 }],
50
+ },
51
+ [constants_1.Network.BSC]: {
52
+ [constants_1.SwapSide.SELL]: [{ name: 'BscAdapter02', index: 8 }],
53
+ [constants_1.SwapSide.BUY]: [{ name: 'BscBuyAdapter', index: 7 }],
54
+ },
55
+ [constants_1.Network.POLYGON]: {
56
+ [constants_1.SwapSide.SELL]: [{ name: 'PolygonAdapter02', index: 9 }],
57
+ [constants_1.SwapSide.BUY]: [{ name: 'PolygonBuyAdapter', index: 8 }],
58
+ },
59
+ [constants_1.Network.BASE]: {
60
+ [constants_1.SwapSide.SELL]: [{ name: 'BaseAdapter01', index: 8 }],
61
+ [constants_1.SwapSide.BUY]: [{ name: 'BaseBuyAdapter', index: 5 }],
62
+ },
63
+ };
64
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/smardex/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEpD,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AACvD,MAAM,iBAAiB,GACrB,oEAAoE,C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