@paraswap/dex-lib 4.0.17 → 4.0.19

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 (312) 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/aavev3statav2/Factory.json +131 -0
  5. package/build/abi/aavev3statav2/Pool.json +1459 -0
  6. package/build/abi/aavev3statav2/Token.json +997 -0
  7. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
  8. package/build/abi/usual-m-smart-m/usualM.abi.json +483 -0
  9. package/build/abi/{USDM.json → usual-pp/abi.json} +269 -326
  10. package/build/abi/{angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json → wombat/pool.json} +637 -594
  11. package/build/dex/aave-gsm/config.js +2 -2
  12. package/build/dex/aave-gsm/config.js.map +1 -1
  13. package/build/dex/aave-v1/aave-v1.js +1 -0
  14. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  15. package/build/dex/aave-v2/tokenlist.json +904 -0
  16. package/build/dex/aave-v2/tokens-avalanche.json +44 -0
  17. package/build/dex/aave-v2/tokens-mainnet.json +188 -0
  18. package/build/dex/aave-v2/tokens-polygon.json +44 -0
  19. package/build/dex/aave-v2/tokens.js +6 -4
  20. package/build/dex/aave-v2/tokens.js.map +1 -1
  21. package/build/dex/aave-v3/config.js +6 -6
  22. package/build/dex/aave-v3/config.js.map +1 -1
  23. package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.d.ts +49 -0
  24. package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js +377 -0
  25. package/build/dex/aave-v3-stata-v2/aave-v3-stata-v2.js.map +1 -0
  26. package/build/dex/aave-v3-stata-v2/config.d.ts +3 -0
  27. package/build/dex/aave-v3-stata-v2/config.js +21 -0
  28. package/build/dex/aave-v3-stata-v2/config.js.map +1 -0
  29. package/build/dex/aave-v3-stata-v2/tokens.d.ts +10 -0
  30. package/build/dex/aave-v3-stata-v2/tokens.js +43 -0
  31. package/build/dex/aave-v3-stata-v2/tokens.js.map +1 -0
  32. package/build/dex/aave-v3-stata-v2/types.d.ts +35 -0
  33. package/build/dex/aave-v3-stata-v2/types.js +25 -0
  34. package/build/dex/aave-v3-stata-v2/types.js.map +1 -0
  35. package/build/dex/aave-v3-stata-v2/utils.d.ts +4 -0
  36. package/build/dex/aave-v3-stata-v2/utils.js +67 -0
  37. package/build/dex/aave-v3-stata-v2/utils.js.map +1 -0
  38. package/build/dex/bProtocol.d.ts +18 -0
  39. package/build/dex/bProtocol.js +39 -0
  40. package/build/dex/bProtocol.js.map +1 -0
  41. package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +729 -0
  42. package/build/dex/balancer-v3/abi/balancerBatchRouter.js +732 -0
  43. package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +1 -0
  44. package/build/dex/balancer-v3/abi/balancerRouter.d.ts +1406 -0
  45. package/build/dex/balancer-v3/abi/balancerRouter.js +1175 -0
  46. package/build/dex/balancer-v3/abi/balancerRouter.js.map +1 -0
  47. package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +2081 -0
  48. package/build/dex/balancer-v3/abi/vaultExtension.V3.js +1851 -0
  49. package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +1 -0
  50. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.d.ts +34 -0
  51. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js +406 -0
  52. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js.map +1 -0
  53. package/build/dex/bancor.d.ts +26 -0
  54. package/build/dex/bancor.js +58 -0
  55. package/build/dex/bancor.js.map +1 -0
  56. package/build/dex/compound.d.ts +18 -0
  57. package/build/dex/compound.js +46 -0
  58. package/build/dex/compound.js.map +1 -0
  59. package/build/dex/curve-v2.d.ts +58 -0
  60. package/build/dex/curve-v2.js +180 -0
  61. package/build/dex/curve-v2.js.map +1 -0
  62. package/build/dex/dodo-v1.d.ts +33 -0
  63. package/build/dex/dodo-v1.js +63 -0
  64. package/build/dex/dodo-v1.js.map +1 -0
  65. package/build/dex/inception/inception-event-pool.d.ts +4 -4
  66. package/build/dex/inception/inception-event-pool.js +7 -9
  67. package/build/dex/inception/inception-event-pool.js.map +1 -1
  68. package/build/dex/inception/inception.d.ts +6 -6
  69. package/build/dex/inception/inception.js +16 -40
  70. package/build/dex/inception/inception.js.map +1 -1
  71. package/build/dex/inception/utils.d.ts +1 -0
  72. package/build/dex/inception/utils.js +22 -1
  73. package/build/dex/inception/utils.js.map +1 -1
  74. package/build/dex/index.js +4 -0
  75. package/build/dex/index.js.map +1 -1
  76. package/build/dex/lido.d.ts +19 -0
  77. package/build/dex/lido.js +42 -0
  78. package/build/dex/lido.js.map +1 -0
  79. package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
  80. package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
  81. package/build/dex/maker-psm/scripts/validate-state.js +185 -0
  82. package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
  83. package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
  84. package/build/dex/onebit.d.ts +25 -0
  85. package/build/dex/onebit.js +42 -0
  86. package/build/dex/onebit.js.map +1 -0
  87. package/build/dex/platypus/platypus.js +17 -3
  88. package/build/dex/platypus/platypus.js.map +1 -1
  89. package/build/dex/smoothy.d.ts +26 -0
  90. package/build/dex/smoothy.js +48 -0
  91. package/build/dex/smoothy.js.map +1 -0
  92. package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
  93. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
  94. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
  95. package/build/dex/stable-pool.d.ts +28 -0
  96. package/build/dex/stable-pool.js +55 -0
  97. package/build/dex/stable-pool.js.map +1 -0
  98. package/build/dex/stkgho/config.js +2 -2
  99. package/build/dex/stkgho/config.js.map +1 -1
  100. package/build/dex/swaap-v1/swaap-v1.js +4 -0
  101. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  102. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
  103. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
  104. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
  105. package/build/dex/trader-joe-v2.1.d.ts +43 -0
  106. package/build/dex/trader-joe-v2.1.js +79 -0
  107. package/build/dex/trader-joe-v2.1.js.map +1 -0
  108. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
  109. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
  110. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
  111. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
  112. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
  113. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
  114. package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
  115. package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
  116. package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
  117. package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
  118. package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
  119. package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
  120. package/build/dex/usual/usual-m-smart-m.d.ts +17 -0
  121. package/build/dex/usual/usual-m-smart-m.js +50 -0
  122. package/build/dex/usual/usual-m-smart-m.js.map +1 -0
  123. package/build/dex/usual/usual.js +1 -1
  124. package/build/dex/usual/usual.js.map +1 -1
  125. package/build/dex/usual-m-smart-m/config.d.ts +3 -0
  126. package/build/dex/usual-m-smart-m/config.js +13 -0
  127. package/build/dex/usual-m-smart-m/config.js.map +1 -0
  128. package/build/dex/usual-m-smart-m/types.d.ts +7 -0
  129. package/build/dex/usual-m-smart-m/types.js +3 -0
  130. package/build/dex/usual-m-smart-m/types.js.map +1 -0
  131. package/build/dex/usual-m-smart-m/usual-m-smart-m.d.ts +35 -0
  132. package/build/dex/usual-m-smart-m/usual-m-smart-m.js +161 -0
  133. package/build/dex/usual-m-smart-m/usual-m-smart-m.js.map +1 -0
  134. package/build/dex/usual-m-usd0/config.d.ts +3 -0
  135. package/build/dex/usual-m-usd0/config.js +14 -0
  136. package/build/dex/usual-m-usd0/config.js.map +1 -0
  137. package/build/dex/usual-m-usd0/types.d.ts +8 -0
  138. package/build/dex/usual-m-usd0/types.js +3 -0
  139. package/build/dex/usual-m-usd0/types.js.map +1 -0
  140. package/build/dex/usual-m-usd0/usual-m-usd0.d.ts +35 -0
  141. package/build/dex/usual-m-usd0/usual-m-usd0.js +159 -0
  142. package/build/dex/usual-m-usd0/usual-m-usd0.js.map +1 -0
  143. package/build/dex/usual-pp/config.d.ts +3 -0
  144. package/build/dex/usual-pp/config.js +19 -0
  145. package/build/dex/usual-pp/config.js.map +1 -0
  146. package/build/dex/usual-pp/pool.d.ts +17 -0
  147. package/build/dex/usual-pp/pool.js +57 -0
  148. package/build/dex/usual-pp/pool.js.map +1 -0
  149. package/build/dex/usual-pp/types.d.ts +15 -0
  150. package/build/dex/usual-pp/types.js +3 -0
  151. package/build/dex/usual-pp/types.js.map +1 -0
  152. package/build/dex/usual-pp/usual-pp.d.ts +35 -0
  153. package/build/dex/usual-pp/usual-pp.js +167 -0
  154. package/build/dex/usual-pp/usual-pp.js.map +1 -0
  155. package/build/dex/usual-pp/utils.d.ts +4 -0
  156. package/build/dex/usual-pp/utils.js +18 -0
  157. package/build/dex/usual-pp/utils.js.map +1 -0
  158. package/package.json +2 -2
  159. package/src/abi/aavev3statav2/Factory.json +131 -0
  160. package/src/abi/aavev3statav2/Pool.json +1459 -0
  161. package/src/abi/aavev3statav2/Token.json +997 -0
  162. package/src/abi/usual-pp/abi.json +750 -0
  163. package/src/dex/aave-gsm/config.ts +3 -3
  164. package/src/dex/aave-v2/tokenlist.json +904 -0
  165. package/src/dex/aave-v2/tokens.ts +3 -4
  166. package/src/dex/aave-v3/config.ts +6 -7
  167. package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts +397 -0
  168. package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-integration.test.ts +600 -0
  169. package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2.ts +477 -0
  170. package/src/dex/aave-v3-stata-v2/config.ts +24 -0
  171. package/src/dex/aave-v3-stata-v2/tokens.ts +48 -0
  172. package/src/dex/aave-v3-stata-v2/types.ts +41 -0
  173. package/src/dex/aave-v3-stata-v2/utils.ts +88 -0
  174. package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +0 -10
  175. package/src/dex/index.ts +4 -0
  176. package/src/dex/stkgho/config.ts +3 -3
  177. package/src/dex/usual/usual.ts +1 -1
  178. package/src/dex/usual-pp/config.ts +18 -0
  179. package/src/dex/usual-pp/pool.ts +77 -0
  180. package/src/dex/usual-pp/types.ts +12 -0
  181. package/src/dex/usual-pp/usual-events.test.ts +70 -0
  182. package/src/dex/usual-pp/usual-integration.test.ts +143 -0
  183. package/src/dex/usual-pp/usual-pp.e2e.test.ts +76 -0
  184. package/src/dex/usual-pp/usual-pp.ts +207 -0
  185. package/src/dex/usual-pp/utils.ts +27 -0
  186. package/tests/constants-e2e.ts +11 -1
  187. package/build/abi/Aave_GSM.json +0 -751
  188. package/build/abi/Balancer.json +0 -257
  189. package/build/abi/BalancerV2.json +0 -1179
  190. package/build/abi/RamsesV2Pool.abi.json +0 -1554
  191. package/build/abi/RamsesV2Quoter.abi.json +0 -274
  192. package/build/abi/UniswapV2Router.json +0 -397
  193. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
  194. package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
  195. package/build/abi/curve-v1/CurveTokenV1.json +0 -305
  196. package/build/abi/curve-v1/CurveTokenV2.json +0 -318
  197. package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
  198. package/build/abi/curve-v1/CurveV2Swap.json +0 -700
  199. package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
  200. package/build/abi/curve-v1/FactoryRegistry.json +0 -508
  201. package/build/abi/curve-v1/StableSwapAave.json +0 -1152
  202. package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
  203. package/build/abi/curve-v1/StableSwapCompound.json +0 -814
  204. package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
  205. package/build/abi/curve-v1/StableSwapPax.json +0 -865
  206. package/build/abi/curve-v1/StableSwapSnow.json +0 -900
  207. package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
  208. package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
  209. package/build/abi/curve-v1/StableSwapY.json +0 -814
  210. package/build/abi/inception/inception-ineth.json +0 -609
  211. package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
  212. package/build/abi/kyberdmm.abi.json +0 -1148
  213. package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
  214. package/build/abi/nerve/nerve-metapool.json +0 -790
  215. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  216. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
  217. package/build/dex/balancer-v1/balancer-pools.json +0 -33333
  218. package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
  219. package/build/dex/bebop/websocket-fetcher.js +0 -87
  220. package/build/dex/bebop/websocket-fetcher.js.map +0 -1
  221. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  222. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  223. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  224. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  225. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  226. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  227. package/build/dex/idle-dao/scripts.d.ts +0 -9
  228. package/build/dex/idle-dao/scripts.js +0 -552
  229. package/build/dex/idle-dao/scripts.js.map +0 -1
  230. package/build/dex/inception/inception-native.d.ts +0 -43
  231. package/build/dex/inception/inception-native.js +0 -131
  232. package/build/dex/inception/inception-native.js.map +0 -1
  233. package/build/dex/inception/inception-pool.d.ts +0 -18
  234. package/build/dex/inception/inception-pool.js +0 -32
  235. package/build/dex/inception/inception-pool.js.map +0 -1
  236. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  237. package/build/dex/inception/inception-price-feed.js +0 -51
  238. package/build/dex/inception/inception-price-feed.js.map +0 -1
  239. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
  240. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
  241. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
  242. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
  243. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
  244. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
  245. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
  246. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
  247. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
  248. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
  249. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
  250. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
  251. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
  252. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
  253. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
  254. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
  255. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
  256. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
  257. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
  258. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
  259. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
  260. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
  261. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
  262. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
  263. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
  264. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
  265. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
  266. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
  267. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
  268. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
  269. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
  270. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
  271. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
  272. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
  273. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
  274. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
  275. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
  276. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
  277. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
  278. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
  279. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
  280. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
  281. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
  282. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
  283. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
  284. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
  285. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
  286. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
  287. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
  288. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
  289. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
  290. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
  291. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
  292. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
  293. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
  294. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
  295. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
  296. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
  297. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
  298. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
  299. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
  300. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
  301. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
  302. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
  303. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
  304. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
  305. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
  306. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
  307. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
  308. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
  309. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
  310. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
  311. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
  312. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
@@ -0,0 +1,600 @@
1
+ /* eslint-disable no-console */
2
+ import dotenv from 'dotenv';
3
+ dotenv.config();
4
+
5
+ import { Interface, Result } from '@ethersproject/abi';
6
+ import { DummyDexHelper } from '../../dex-helper/index';
7
+ import { Network, SwapSide } from '../../constants';
8
+ import { BI_POWS } from '../../bigint-constants';
9
+ import { AaveV3StataV2 } from './aave-v3-stata-v2';
10
+ import {
11
+ checkPoolPrices,
12
+ checkPoolsLiquidity,
13
+ checkConstantPoolPrices,
14
+ } from '../../../tests/utils';
15
+ import { Tokens } from '../../../tests/constants-e2e';
16
+
17
+ function getReaderCalldata(
18
+ exchangeAddress: string,
19
+ readerIface: Interface,
20
+ amounts: bigint[],
21
+ funcName: string,
22
+ ) {
23
+ return amounts.map(amount => ({
24
+ target: exchangeAddress,
25
+ callData: readerIface.encodeFunctionData(funcName, [amount]),
26
+ }));
27
+ }
28
+
29
+ function decodeReaderResult(
30
+ results: Result,
31
+ readerIface: Interface,
32
+ funcName: string,
33
+ ) {
34
+ return results.map(result => {
35
+ const parsed = readerIface.decodeFunctionResult(funcName, result);
36
+ return BigInt(parsed[0]._hex);
37
+ });
38
+ }
39
+
40
+ async function checkOnChainPricing(
41
+ aaveV3Statav2: AaveV3StataV2,
42
+ exchangeAddress: string,
43
+ funcName: string,
44
+ blockNumber: number,
45
+ prices: bigint[],
46
+ amounts: bigint[],
47
+ ) {
48
+ const readerIface = AaveV3StataV2.stata;
49
+
50
+ const readerCallData = getReaderCalldata(
51
+ exchangeAddress,
52
+ readerIface,
53
+ amounts.slice(1),
54
+ funcName,
55
+ );
56
+ const readerResult = (
57
+ await aaveV3Statav2.dexHelper.multiContract.methods
58
+ .aggregate(readerCallData)
59
+ .call({}, blockNumber)
60
+ ).returnData;
61
+
62
+ const expectedPrices = [0n].concat(
63
+ decodeReaderResult(readerResult, readerIface, funcName),
64
+ );
65
+
66
+ expect(prices).toEqual(expectedPrices);
67
+ }
68
+
69
+ async function testPricingOnNetwork(
70
+ aaveV3Statav2: AaveV3StataV2,
71
+ network: Network,
72
+ dexKey: string,
73
+ blockNumber: number,
74
+ srcTokenSymbol: string,
75
+ destTokenSymbol: string,
76
+ side: SwapSide,
77
+ amounts: bigint[],
78
+ exchangeAddress: string,
79
+ funcNameToCheck: string,
80
+ ) {
81
+ const networkTokens = Tokens[network];
82
+
83
+ const pools = await aaveV3Statav2.getPoolIdentifiers(
84
+ networkTokens[srcTokenSymbol],
85
+ networkTokens[destTokenSymbol],
86
+ side,
87
+ blockNumber,
88
+ );
89
+ console.log(
90
+ `${srcTokenSymbol} <> ${destTokenSymbol} Pool Identifiers: `,
91
+ pools,
92
+ );
93
+
94
+ expect(pools.length).toBeGreaterThan(0);
95
+
96
+ const poolPrices = await aaveV3Statav2.getPricesVolume(
97
+ networkTokens[srcTokenSymbol],
98
+ networkTokens[destTokenSymbol],
99
+ amounts,
100
+ side,
101
+ blockNumber,
102
+ pools,
103
+ );
104
+ console.log(
105
+ `${srcTokenSymbol} <> ${destTokenSymbol} Pool Prices: `,
106
+ poolPrices,
107
+ );
108
+
109
+ expect(poolPrices).not.toBeNull();
110
+ if (aaveV3Statav2.hasConstantPriceLargeAmounts) {
111
+ checkConstantPoolPrices(poolPrices!, amounts, dexKey);
112
+ } else {
113
+ checkPoolPrices(poolPrices!, amounts, side, dexKey);
114
+ }
115
+
116
+ // Check if onchain pricing equals to calculated ones
117
+ await checkOnChainPricing(
118
+ aaveV3Statav2,
119
+ exchangeAddress,
120
+ funcNameToCheck,
121
+ blockNumber,
122
+ poolPrices![0].prices,
123
+ amounts,
124
+ );
125
+ }
126
+
127
+ describe('AaveV3StataV2', function () {
128
+ const dexKey = 'AaveV3StataV2';
129
+ let blockNumber: number;
130
+ let aaveV3Statav2: AaveV3StataV2;
131
+
132
+ describe('Mainnet', () => {
133
+ const network = Network.MAINNET;
134
+ const dexHelper = new DummyDexHelper(network);
135
+
136
+ const tokens = Tokens[network];
137
+
138
+ const srcTokenSymbol = 'USDT';
139
+ const destTokenSymbol = 'waEthUSDT';
140
+
141
+ const amountsForSell = [
142
+ 0n,
143
+ 1n * BI_POWS[tokens[srcTokenSymbol].decimals],
144
+ 2n * BI_POWS[tokens[srcTokenSymbol].decimals],
145
+ 3n * BI_POWS[tokens[srcTokenSymbol].decimals],
146
+ 4n * BI_POWS[tokens[srcTokenSymbol].decimals],
147
+ 5n * BI_POWS[tokens[srcTokenSymbol].decimals],
148
+ 6n * BI_POWS[tokens[srcTokenSymbol].decimals],
149
+ 7n * BI_POWS[tokens[srcTokenSymbol].decimals],
150
+ 8n * BI_POWS[tokens[srcTokenSymbol].decimals],
151
+ 9n * BI_POWS[tokens[srcTokenSymbol].decimals],
152
+ 10n * BI_POWS[tokens[srcTokenSymbol].decimals],
153
+ ];
154
+
155
+ const amountsForBuy = [
156
+ 0n,
157
+ 1n * BI_POWS[tokens[destTokenSymbol].decimals],
158
+ 2n * BI_POWS[tokens[destTokenSymbol].decimals],
159
+ 3n * BI_POWS[tokens[destTokenSymbol].decimals],
160
+ 4n * BI_POWS[tokens[destTokenSymbol].decimals],
161
+ 5n * BI_POWS[tokens[destTokenSymbol].decimals],
162
+ 6n * BI_POWS[tokens[destTokenSymbol].decimals],
163
+ 7n * BI_POWS[tokens[destTokenSymbol].decimals],
164
+ 8n * BI_POWS[tokens[destTokenSymbol].decimals],
165
+ 9n * BI_POWS[tokens[destTokenSymbol].decimals],
166
+ 10n * BI_POWS[tokens[destTokenSymbol].decimals],
167
+ ];
168
+
169
+ beforeAll(async () => {
170
+ blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
171
+ aaveV3Statav2 = new AaveV3StataV2(network, dexKey, dexHelper);
172
+ if (aaveV3Statav2.initializePricing) {
173
+ await aaveV3Statav2.initializePricing(blockNumber);
174
+ }
175
+ });
176
+
177
+ it('getPoolIdentifiers and getPricesVolume SELL USDT -> waEthUSDT', async function () {
178
+ await testPricingOnNetwork(
179
+ aaveV3Statav2,
180
+ network,
181
+ dexKey,
182
+ blockNumber,
183
+ srcTokenSymbol,
184
+ destTokenSymbol,
185
+ SwapSide.SELL,
186
+ amountsForSell,
187
+ '0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
188
+ 'previewDeposit',
189
+ );
190
+ });
191
+
192
+ it('getPoolIdentifiers and getPricesVolume SELL waEthUSDT -> USDT ', async function () {
193
+ await testPricingOnNetwork(
194
+ aaveV3Statav2,
195
+ network,
196
+ dexKey,
197
+ blockNumber,
198
+ destTokenSymbol,
199
+ srcTokenSymbol,
200
+ SwapSide.SELL,
201
+ amountsForSell,
202
+ '0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
203
+ 'previewRedeem',
204
+ );
205
+ });
206
+
207
+ it('getPoolIdentifiers and getPricesVolume BUY USDT -> waEthUSDT', async function () {
208
+ await testPricingOnNetwork(
209
+ aaveV3Statav2,
210
+ network,
211
+ dexKey,
212
+ blockNumber,
213
+ srcTokenSymbol,
214
+ destTokenSymbol,
215
+ SwapSide.BUY,
216
+ amountsForBuy,
217
+ '0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
218
+ 'previewMint',
219
+ );
220
+ });
221
+
222
+ it('getPoolIdentifiers and getPricesVolume BUY waEthUSDT -> USDT', async function () {
223
+ await testPricingOnNetwork(
224
+ aaveV3Statav2,
225
+ network,
226
+ dexKey,
227
+ blockNumber,
228
+ destTokenSymbol,
229
+ srcTokenSymbol,
230
+ SwapSide.BUY,
231
+ amountsForBuy,
232
+ '0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8',
233
+ 'previewWithdraw',
234
+ );
235
+ });
236
+
237
+ it(`getTopPoolsForToken - ${srcTokenSymbol}`, async function () {
238
+ // We have to check without calling initializePricing, because
239
+ // pool-tracker is not calling that function
240
+ const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
241
+ if (newAaveV3Stata.updatePoolState) {
242
+ await newAaveV3Stata.updatePoolState();
243
+ }
244
+ const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
245
+ tokens[srcTokenSymbol].address,
246
+ 10,
247
+ );
248
+ console.log(
249
+ `${srcTokenSymbol} Top Pools:`,
250
+ JSON.stringify(poolLiquidity, null, 2),
251
+ );
252
+
253
+ if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
254
+ checkPoolsLiquidity(
255
+ poolLiquidity,
256
+ Tokens[network][srcTokenSymbol].address,
257
+ dexKey,
258
+ );
259
+ }
260
+ });
261
+
262
+ it(`getTopPoolsForToken - ${destTokenSymbol}`, async function () {
263
+ // We have to check without calling initializePricing, because
264
+ // pool-tracker is not calling that function
265
+ const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
266
+ if (newAaveV3Stata.updatePoolState) {
267
+ await newAaveV3Stata.updatePoolState();
268
+ }
269
+ const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
270
+ tokens[destTokenSymbol].address,
271
+ 10,
272
+ );
273
+ console.log(
274
+ `${destTokenSymbol} Top Pools:`,
275
+ JSON.stringify(poolLiquidity, null, 2),
276
+ );
277
+
278
+ if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
279
+ checkPoolsLiquidity(
280
+ poolLiquidity,
281
+ Tokens[network][destTokenSymbol].address,
282
+ dexKey,
283
+ );
284
+ }
285
+ });
286
+ });
287
+
288
+ describe('Gnosis', () => {
289
+ const network = Network.GNOSIS;
290
+ const dexHelper = new DummyDexHelper(network);
291
+
292
+ const tokens = Tokens[network];
293
+
294
+ const srcTokenSymbol = 'wstETH';
295
+ const destTokenSymbol = 'waGnowstETH';
296
+
297
+ const amountsForSell = [
298
+ 0n,
299
+ 1n * BI_POWS[tokens[srcTokenSymbol].decimals],
300
+ 2n * BI_POWS[tokens[srcTokenSymbol].decimals],
301
+ 3n * BI_POWS[tokens[srcTokenSymbol].decimals],
302
+ 4n * BI_POWS[tokens[srcTokenSymbol].decimals],
303
+ 5n * BI_POWS[tokens[srcTokenSymbol].decimals],
304
+ 6n * BI_POWS[tokens[srcTokenSymbol].decimals],
305
+ 7n * BI_POWS[tokens[srcTokenSymbol].decimals],
306
+ 8n * BI_POWS[tokens[srcTokenSymbol].decimals],
307
+ 9n * BI_POWS[tokens[srcTokenSymbol].decimals],
308
+ 10n * BI_POWS[tokens[srcTokenSymbol].decimals],
309
+ ];
310
+
311
+ const amountsForBuy = [
312
+ 0n,
313
+ 1n * BI_POWS[tokens[destTokenSymbol].decimals],
314
+ 2n * BI_POWS[tokens[destTokenSymbol].decimals],
315
+ 3n * BI_POWS[tokens[destTokenSymbol].decimals],
316
+ 4n * BI_POWS[tokens[destTokenSymbol].decimals],
317
+ 5n * BI_POWS[tokens[destTokenSymbol].decimals],
318
+ 6n * BI_POWS[tokens[destTokenSymbol].decimals],
319
+ 7n * BI_POWS[tokens[destTokenSymbol].decimals],
320
+ 8n * BI_POWS[tokens[destTokenSymbol].decimals],
321
+ 9n * BI_POWS[tokens[destTokenSymbol].decimals],
322
+ 10n * BI_POWS[tokens[destTokenSymbol].decimals],
323
+ ];
324
+
325
+ beforeAll(async () => {
326
+ blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
327
+ aaveV3Statav2 = new AaveV3StataV2(network, dexKey, dexHelper);
328
+ if (aaveV3Statav2.initializePricing) {
329
+ await aaveV3Statav2.initializePricing(blockNumber);
330
+ }
331
+ });
332
+
333
+ it('getPoolIdentifiers and getPricesVolume SELL wstETH -> waGnowstETH', async function () {
334
+ await testPricingOnNetwork(
335
+ aaveV3Statav2,
336
+ network,
337
+ dexKey,
338
+ blockNumber,
339
+ srcTokenSymbol,
340
+ destTokenSymbol,
341
+ SwapSide.SELL,
342
+ amountsForSell,
343
+ '0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
344
+ 'previewDeposit',
345
+ );
346
+ });
347
+
348
+ it('getPoolIdentifiers and getPricesVolume SELL waGnowstETH -> wstETH', async function () {
349
+ await testPricingOnNetwork(
350
+ aaveV3Statav2,
351
+ network,
352
+ dexKey,
353
+ blockNumber,
354
+ destTokenSymbol,
355
+ srcTokenSymbol,
356
+ SwapSide.SELL,
357
+ amountsForSell,
358
+ '0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
359
+ 'previewRedeem',
360
+ );
361
+ });
362
+
363
+ it('getPoolIdentifiers and getPricesVolume BUY wstETH -> waGnowstETH', async function () {
364
+ await testPricingOnNetwork(
365
+ aaveV3Statav2,
366
+ network,
367
+ dexKey,
368
+ blockNumber,
369
+ srcTokenSymbol,
370
+ destTokenSymbol,
371
+ SwapSide.BUY,
372
+ amountsForBuy,
373
+ '0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
374
+ 'previewMint',
375
+ );
376
+ });
377
+
378
+ it('getPoolIdentifiers and getPricesVolume BUY waGnowstETH -> wstETH', async function () {
379
+ await testPricingOnNetwork(
380
+ aaveV3Statav2,
381
+ network,
382
+ dexKey,
383
+ blockNumber,
384
+ destTokenSymbol,
385
+ srcTokenSymbol,
386
+ SwapSide.BUY,
387
+ amountsForBuy,
388
+ '0x773CDA0CADe2A3d86E6D4e30699d40bB95174ff2',
389
+ 'previewWithdraw',
390
+ );
391
+ });
392
+
393
+ it(`getTopPoolsForToken - ${srcTokenSymbol}`, async function () {
394
+ // We have to check without calling initializePricing, because
395
+ // pool-tracker is not calling that function
396
+ const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
397
+ if (newAaveV3Stata.updatePoolState) {
398
+ await newAaveV3Stata.updatePoolState();
399
+ }
400
+ const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
401
+ tokens[srcTokenSymbol].address,
402
+ 10,
403
+ );
404
+ console.log(
405
+ `${srcTokenSymbol} Top Pools:`,
406
+ JSON.stringify(poolLiquidity, null, 2),
407
+ );
408
+
409
+ if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
410
+ checkPoolsLiquidity(
411
+ poolLiquidity,
412
+ Tokens[network][srcTokenSymbol].address,
413
+ dexKey,
414
+ );
415
+ }
416
+ });
417
+
418
+ it(`getTopPoolsForToken - ${destTokenSymbol}`, async function () {
419
+ // We have to check without calling initializePricing, because
420
+ // pool-tracker is not calling that function
421
+ const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
422
+ if (newAaveV3Stata.updatePoolState) {
423
+ await newAaveV3Stata.updatePoolState();
424
+ }
425
+ const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
426
+ tokens[destTokenSymbol].address,
427
+ 10,
428
+ );
429
+ console.log(
430
+ `${destTokenSymbol} Top Pools:`,
431
+ JSON.stringify(poolLiquidity, null, 2),
432
+ );
433
+
434
+ if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
435
+ checkPoolsLiquidity(
436
+ poolLiquidity,
437
+ Tokens[network][destTokenSymbol].address,
438
+ dexKey,
439
+ );
440
+ }
441
+ });
442
+ });
443
+
444
+ // polygon is not yet live
445
+ describe.skip('Polygon', () => {
446
+ const network = Network.POLYGON;
447
+ const dexHelper = new DummyDexHelper(network);
448
+
449
+ const tokens = Tokens[network];
450
+
451
+ const srcTokenSymbol = 'USDCn';
452
+ const destTokenSymbol = 'stataUSDCn';
453
+
454
+ const amountsForSell = [
455
+ 0n,
456
+ 1n * BI_POWS[tokens[srcTokenSymbol].decimals],
457
+ 2n * BI_POWS[tokens[srcTokenSymbol].decimals],
458
+ 3n * BI_POWS[tokens[srcTokenSymbol].decimals],
459
+ 4n * BI_POWS[tokens[srcTokenSymbol].decimals],
460
+ 5n * BI_POWS[tokens[srcTokenSymbol].decimals],
461
+ 6n * BI_POWS[tokens[srcTokenSymbol].decimals],
462
+ 7n * BI_POWS[tokens[srcTokenSymbol].decimals],
463
+ 8n * BI_POWS[tokens[srcTokenSymbol].decimals],
464
+ 9n * BI_POWS[tokens[srcTokenSymbol].decimals],
465
+ 10n * BI_POWS[tokens[srcTokenSymbol].decimals],
466
+ ];
467
+
468
+ const amountsForBuy = [
469
+ 0n,
470
+ 1n * BI_POWS[tokens[destTokenSymbol].decimals],
471
+ 2n * BI_POWS[tokens[destTokenSymbol].decimals],
472
+ 3n * BI_POWS[tokens[destTokenSymbol].decimals],
473
+ 4n * BI_POWS[tokens[destTokenSymbol].decimals],
474
+ 5n * BI_POWS[tokens[destTokenSymbol].decimals],
475
+ 6n * BI_POWS[tokens[destTokenSymbol].decimals],
476
+ 7n * BI_POWS[tokens[destTokenSymbol].decimals],
477
+ 8n * BI_POWS[tokens[destTokenSymbol].decimals],
478
+ 9n * BI_POWS[tokens[destTokenSymbol].decimals],
479
+ 10n * BI_POWS[tokens[destTokenSymbol].decimals],
480
+ ];
481
+
482
+ beforeAll(async () => {
483
+ blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
484
+ aaveV3Statav2 = new AaveV3StataV2(network, dexKey, dexHelper);
485
+ if (aaveV3Statav2.initializePricing) {
486
+ await aaveV3Statav2.initializePricing(blockNumber);
487
+ }
488
+ });
489
+
490
+ it('getPoolIdentifiers and getPricesVolume SELL USDCn -> stataUSDCn', async function () {
491
+ await testPricingOnNetwork(
492
+ aaveV3Statav2,
493
+ network,
494
+ dexKey,
495
+ blockNumber,
496
+ srcTokenSymbol,
497
+ destTokenSymbol,
498
+ SwapSide.SELL,
499
+ amountsForSell,
500
+ '0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
501
+ 'previewDeposit',
502
+ );
503
+ });
504
+
505
+ it('getPoolIdentifiers and getPricesVolume SELL stataUSDCn -> USDCn ', async function () {
506
+ await testPricingOnNetwork(
507
+ aaveV3Statav2,
508
+ network,
509
+ dexKey,
510
+ blockNumber,
511
+ destTokenSymbol,
512
+ srcTokenSymbol,
513
+ SwapSide.SELL,
514
+ amountsForSell,
515
+ '0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
516
+ 'previewRedeem',
517
+ );
518
+ });
519
+
520
+ it('getPoolIdentifiers and getPricesVolume BUY USDC -> stataUSDCn', async function () {
521
+ await testPricingOnNetwork(
522
+ aaveV3Statav2,
523
+ network,
524
+ dexKey,
525
+ blockNumber,
526
+ srcTokenSymbol,
527
+ destTokenSymbol,
528
+ SwapSide.BUY,
529
+ amountsForBuy,
530
+ '0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
531
+ 'previewMint',
532
+ );
533
+ });
534
+
535
+ it('getPoolIdentifiers and getPricesVolume BUY stataUSDCn -> USDC', async function () {
536
+ await testPricingOnNetwork(
537
+ aaveV3Statav2,
538
+ network,
539
+ dexKey,
540
+ blockNumber,
541
+ destTokenSymbol,
542
+ srcTokenSymbol,
543
+ SwapSide.BUY,
544
+ amountsForBuy,
545
+ '0x2dca80061632f3f87c9ca28364d1d0c30cd79a19',
546
+ 'previewWithdraw',
547
+ );
548
+ });
549
+
550
+ it(`getTopPoolsForToken - ${srcTokenSymbol}`, async function () {
551
+ // We have to check without calling initializePricing, because
552
+ // pool-tracker is not calling that function
553
+ const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
554
+ if (newAaveV3Stata.updatePoolState) {
555
+ await newAaveV3Stata.updatePoolState();
556
+ }
557
+ const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
558
+ tokens[srcTokenSymbol].address,
559
+ 10,
560
+ );
561
+ console.log(
562
+ `${srcTokenSymbol} Top Pools:`,
563
+ JSON.stringify(poolLiquidity, null, 2),
564
+ );
565
+
566
+ if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
567
+ checkPoolsLiquidity(
568
+ poolLiquidity,
569
+ Tokens[network][srcTokenSymbol].address,
570
+ dexKey,
571
+ );
572
+ }
573
+ });
574
+
575
+ it(`getTopPoolsForToken - ${destTokenSymbol}`, async function () {
576
+ // We have to check without calling initializePricing, because
577
+ // pool-tracker is not calling that function
578
+ const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper);
579
+ if (newAaveV3Stata.updatePoolState) {
580
+ await newAaveV3Stata.updatePoolState();
581
+ }
582
+ const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken(
583
+ tokens[destTokenSymbol].address,
584
+ 10,
585
+ );
586
+ console.log(
587
+ `${destTokenSymbol} Top Pools:`,
588
+ JSON.stringify(poolLiquidity, null, 2),
589
+ );
590
+
591
+ if (!newAaveV3Stata.hasConstantPriceLargeAmounts) {
592
+ checkPoolsLiquidity(
593
+ poolLiquidity,
594
+ Tokens[network][destTokenSymbol].address,
595
+ dexKey,
596
+ );
597
+ }
598
+ });
599
+ });
600
+ });