@paraswap/dex-lib 2.50.3 → 2.50.4-angle-staked

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 (354) hide show
  1. package/build/abi/Redstone.json +739 -0
  2. package/build/abi/angle/stagToken.json +963 -0
  3. package/build/{dex/lighter-v1/abi/erc20.json → abi/angle-transmuter/MorphoOracle.json} +97 -126
  4. package/build/abi/angle-transmuter/MorphoVault.json +2506 -0
  5. package/build/abi/angle-transmuter/Pyth.json +1534 -0
  6. package/build/abi/angle-transmuter/Transmuter.json +1711 -0
  7. package/build/abi/pharaoh/PharaohPool.abi.json +1582 -0
  8. package/build/abi/smardex/smardex-factory.json +185 -0
  9. package/build/abi/smardex/smardex-pool.json +578 -0
  10. package/build/abi/smardex/smardex-router.json +648 -0
  11. package/build/abi/trader-joe-v2_1/FactoryABI.json +1208 -0
  12. package/build/abi/trader-joe-v2_1/PairABI.json +1493 -0
  13. package/build/abi/trader-joe-v2_1/RouterABI.json +1489 -0
  14. package/build/abi/trader-joe-v2_1/StateMulticall.json +193 -0
  15. package/build/abi/{integral/relayer.json → wombat/pool.json} +587 -446
  16. package/build/config.js +4 -2
  17. package/build/config.js.map +1 -1
  18. package/build/dex/angle-staked-stable/angle-staked-stable-pool.d.ts +55 -0
  19. package/build/dex/angle-staked-stable/angle-staked-stable-pool.js +183 -0
  20. package/build/dex/angle-staked-stable/angle-staked-stable-pool.js.map +1 -0
  21. package/build/dex/angle-staked-stable/angle-staked-stable.d.ts +50 -0
  22. package/build/dex/angle-staked-stable/angle-staked-stable.js +228 -0
  23. package/build/dex/angle-staked-stable/angle-staked-stable.js.map +1 -0
  24. package/build/dex/{woo-fi → angle-staked-stable}/config.d.ts +1 -1
  25. package/build/dex/angle-staked-stable/config.js +139 -0
  26. package/build/dex/angle-staked-stable/config.js.map +1 -0
  27. package/build/dex/angle-staked-stable/types.d.ts +15 -0
  28. package/build/dex/angle-staked-stable/types.js.map +1 -0
  29. package/build/dex/angle-transmuter/angle-transmuter-pool.d.ts +61 -0
  30. package/build/dex/angle-transmuter/angle-transmuter-pool.js +415 -0
  31. package/build/dex/angle-transmuter/angle-transmuter-pool.js.map +1 -0
  32. package/build/dex/{lighter-v1/lighter-v1.d.ts → angle-transmuter/angle-transmuter.d.ts} +31 -17
  33. package/build/dex/angle-transmuter/angle-transmuter.js +262 -0
  34. package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -0
  35. package/build/dex/angle-transmuter/backedOracle.d.ts +19 -0
  36. package/build/dex/angle-transmuter/backedOracle.js +56 -0
  37. package/build/dex/angle-transmuter/backedOracle.js.map +1 -0
  38. package/build/dex/{ramses-v2 → angle-transmuter}/config.d.ts +1 -1
  39. package/build/dex/angle-transmuter/config.js +30 -0
  40. package/build/dex/angle-transmuter/config.js.map +1 -0
  41. package/build/dex/angle-transmuter/constants.d.ts +77 -0
  42. package/build/dex/angle-transmuter/constants.js +94 -0
  43. package/build/dex/angle-transmuter/constants.js.map +1 -0
  44. package/build/dex/{integral/integral-pool.d.ts → angle-transmuter/morphoOracle.d.ts} +15 -12
  45. package/build/dex/angle-transmuter/morphoOracle.js +179 -0
  46. package/build/dex/angle-transmuter/morphoOracle.js.map +1 -0
  47. package/build/dex/angle-transmuter/morphoVault.d.ts +19 -0
  48. package/build/dex/angle-transmuter/morphoVault.js +78 -0
  49. package/build/dex/angle-transmuter/morphoVault.js.map +1 -0
  50. package/build/dex/angle-transmuter/pyth.d.ts +19 -0
  51. package/build/dex/angle-transmuter/pyth.js +70 -0
  52. package/build/dex/angle-transmuter/pyth.js.map +1 -0
  53. package/build/dex/angle-transmuter/redstone.d.ts +20 -0
  54. package/build/dex/angle-transmuter/redstone.js +73 -0
  55. package/build/dex/angle-transmuter/redstone.js.map +1 -0
  56. package/build/dex/angle-transmuter/transmuter.d.ts +52 -0
  57. package/build/dex/angle-transmuter/transmuter.js +374 -0
  58. package/build/dex/angle-transmuter/transmuter.js.map +1 -0
  59. package/build/dex/angle-transmuter/types.d.ts +188 -0
  60. package/build/dex/angle-transmuter/types.js +33 -0
  61. package/build/dex/angle-transmuter/types.js.map +1 -0
  62. package/build/dex/angle-transmuter/utils.d.ts +9 -0
  63. package/build/dex/angle-transmuter/utils.js +252 -0
  64. package/build/dex/angle-transmuter/utils.js.map +1 -0
  65. package/build/dex/curve-v1-factory/config.js +7 -7
  66. package/build/dex/curve-v1-factory/config.js.map +1 -1
  67. package/build/dex/curve-v1-factory/constants.d.ts +0 -1
  68. package/build/dex/curve-v1-factory/constants.js +1 -2
  69. package/build/dex/curve-v1-factory/constants.js.map +1 -1
  70. package/build/dex/index.js +2 -0
  71. package/build/dex/index.js.map +1 -1
  72. package/build/dex/smardex/subgraph-queries.d.ts +1 -0
  73. package/build/dex/smardex/subgraph-queries.js +17 -0
  74. package/build/dex/smardex/subgraph-queries.js.map +1 -0
  75. package/build/dex/smardex/usd-reserves.d.ts +23 -0
  76. package/build/dex/smardex/usd-reserves.js +86 -0
  77. package/build/dex/smardex/usd-reserves.js.map +1 -0
  78. package/build/dex/{integral → trader-joe-v2-1-2}/config.d.ts +1 -1
  79. package/build/dex/trader-joe-v2-1-2/config.js +47 -0
  80. package/build/dex/trader-joe-v2-1-2/config.js.map +1 -0
  81. package/build/dex/trader-joe-v2-1-2/constants.d.ts +20 -0
  82. package/build/dex/trader-joe-v2-1-2/constants.js +22 -0
  83. package/build/dex/trader-joe-v2-1-2/constants.js.map +1 -0
  84. package/build/dex/trader-joe-v2-1-2/math/index.d.ts +37 -0
  85. package/build/dex/trader-joe-v2-1-2/math/index.js +291 -0
  86. package/build/dex/trader-joe-v2-1-2/math/index.js.map +1 -0
  87. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.d.ts +60 -0
  88. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js +248 -0
  89. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js.map +1 -0
  90. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.d.ts +53 -0
  91. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js +307 -0
  92. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js.map +1 -0
  93. package/build/dex/trader-joe-v2-1-2/types.d.ts +82 -0
  94. package/build/dex/trader-joe-v2-1-2/types.js +9 -0
  95. package/build/dex/trader-joe-v2-1-2/types.js.map +1 -0
  96. package/build/dex/{lighter-v1 → trader-joe-v2_1}/config.d.ts +1 -1
  97. package/build/dex/trader-joe-v2_1/config.js +47 -0
  98. package/build/dex/trader-joe-v2_1/config.js.map +1 -0
  99. package/build/dex/trader-joe-v2_1/constants.d.ts +20 -0
  100. package/build/dex/trader-joe-v2_1/constants.js +22 -0
  101. package/build/dex/trader-joe-v2_1/constants.js.map +1 -0
  102. package/build/dex/trader-joe-v2_1/math/index.d.ts +37 -0
  103. package/build/dex/trader-joe-v2_1/math/index.js +291 -0
  104. package/build/dex/trader-joe-v2_1/math/index.js.map +1 -0
  105. package/build/dex/trader-joe-v2_1/trader-joe-v2.1.d.ts +0 -0
  106. package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js +384 -0
  107. package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js.map +1 -0
  108. package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.d.ts +60 -0
  109. package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js +247 -0
  110. package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js.map +1 -0
  111. package/build/dex/trader-joe-v2_1/trader-joe-v2_1.d.ts +53 -0
  112. package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js +307 -0
  113. package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js.map +1 -0
  114. package/build/dex/trader-joe-v2_1/types.d.ts +82 -0
  115. package/build/dex/trader-joe-v2_1/types.js +9 -0
  116. package/build/dex/trader-joe-v2_1/types.js.map +1 -0
  117. package/build/dex/wombat/wombat-pool-poller.d.ts +22 -0
  118. package/build/dex/wombat/wombat-pool-poller.js +164 -0
  119. package/build/dex/wombat/wombat-pool-poller.js.map +1 -0
  120. package/build/dex/woo-fi-v2/config.js +4 -4
  121. package/build/dex-helper/Cache.d.ts +31 -0
  122. package/build/dex-helper/Cache.js +106 -0
  123. package/build/dex-helper/Cache.js.map +1 -0
  124. package/build/dex-helper/RedisBatcher.d.ts +20 -0
  125. package/build/dex-helper/RedisBatcher.js +75 -0
  126. package/build/dex-helper/RedisBatcher.js.map +1 -0
  127. package/build/dex-helper/RedisWrapper.d.ts +37 -0
  128. package/build/dex-helper/RedisWrapper.js +165 -0
  129. package/build/dex-helper/RedisWrapper.js.map +1 -0
  130. package/package.json +1 -1
  131. package/src/abi/angle/stagToken.json +963 -0
  132. package/src/config.ts +4 -2
  133. package/src/dex/angle-staked-stable/angle-staked-stable-e2e.test.ts +146 -0
  134. package/src/dex/angle-staked-stable/angle-staked-stable-events.test.ts +95 -0
  135. package/src/dex/angle-staked-stable/angle-staked-stable-integration.test.ts +474 -0
  136. package/src/dex/angle-staked-stable/angle-staked-stable-pool.ts +297 -0
  137. package/src/dex/angle-staked-stable/angle-staked-stable.ts +314 -0
  138. package/src/dex/angle-staked-stable/config.ts +139 -0
  139. package/src/dex/angle-staked-stable/types.ts +16 -0
  140. package/src/dex/curve-v1-factory/config.ts +8 -8
  141. package/src/dex/curve-v1-factory/constants.ts +0 -2
  142. package/src/dex/index.ts +2 -0
  143. package/src/dex/woo-fi-v2/config.ts +4 -4
  144. package/tests/constants-e2e.ts +112 -1
  145. package/.idea/aws.xml +0 -17
  146. package/.idea/codeStyles/Project.xml +0 -19
  147. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  148. package/.idea/misc.xml +0 -6
  149. package/.idea/modules.xml +0 -8
  150. package/.idea/paraswap-dex-lib.iml +0 -9
  151. package/.idea/prettier.xml +0 -7
  152. package/.idea/vcs.xml +0 -6
  153. package/build/abi/AugustusV6.abi.json +0 -395
  154. package/build/abi/algebra/AlgebraPool.abi.json +0 -727
  155. package/build/abi/curve-v1/StableSwapFRXETH.json +0 -889
  156. package/build/abi/curve-v1/StableSwapWBETH.json +0 -1223
  157. package/build/abi/sushiswap-v3/QuoterV2.json +0 -267
  158. package/build/abi/sushiswap-v3/RouterProcessor3.json +0 -289
  159. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  160. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +0 -285
  161. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +0 -583
  162. package/build/abi/wBETH.json +0 -1527
  163. package/build/abi/woo-fi/WooFeeManager.abi.json +0 -318
  164. package/build/abi/woo-fi/WooPP.abi.json +0 -548
  165. package/build/abi/woo-fi/Wooracle.abi.json +0 -260
  166. package/build/dex/aave-v3/tokens/arbitrum.json +0 -50
  167. package/build/dex/aave-v3/tokens/avalanche.json +0 -74
  168. package/build/dex/aave-v3/tokens/fantom.json +0 -62
  169. package/build/dex/aave-v3/tokens/optimism.json +0 -50
  170. package/build/dex/aave-v3/tokens/polygon.json +0 -116
  171. package/build/dex/algebra/algebra-pool.d.ts +0 -114
  172. package/build/dex/algebra/algebra-pool.js +0 -448
  173. package/build/dex/algebra/algebra-pool.js.map +0 -1
  174. package/build/dex/balancer-v2/Gyro3Pool.d.ts +0 -43
  175. package/build/dex/balancer-v2/Gyro3Pool.js +0 -160
  176. package/build/dex/balancer-v2/Gyro3Pool.js.map +0 -1
  177. package/build/dex/balancer-v2/LinearMath.d.ts +0 -88
  178. package/build/dex/balancer-v2/LinearMath.js +0 -285
  179. package/build/dex/balancer-v2/LinearMath.js.map +0 -1
  180. package/build/dex/balancer-v2/LinearPool.d.ts +0 -81
  181. package/build/dex/balancer-v2/LinearPool.js +0 -444
  182. package/build/dex/balancer-v2/LinearPool.js.map +0 -1
  183. package/build/dex/balancer-v2/PhantomStablePool.d.ts +0 -90
  184. package/build/dex/balancer-v2/PhantomStablePool.js +0 -418
  185. package/build/dex/balancer-v2/PhantomStablePool.js.map +0 -1
  186. package/build/dex/balancer-v2/StableMath.d.ts +0 -9
  187. package/build/dex/balancer-v2/StableMath.js +0 -272
  188. package/build/dex/balancer-v2/StableMath.js.map +0 -1
  189. package/build/dex/balancer-v2/balancer-v2-pool.d.ts +0 -140
  190. package/build/dex/balancer-v2/balancer-v2-pool.js +0 -647
  191. package/build/dex/balancer-v2/balancer-v2-pool.js.map +0 -1
  192. package/build/dex/curve-v1/pools/frxETHpool.d.ts +0 -7
  193. package/build/dex/curve-v1/pools/frxETHpool.js +0 -27
  194. package/build/dex/curve-v1/pools/frxETHpool.js.map +0 -1
  195. package/build/dex/curve-v1/pools/wbETHpool.d.ts +0 -29
  196. package/build/dex/curve-v1/pools/wbETHpool.js +0 -408
  197. package/build/dex/curve-v1/pools/wbETHpool.js.map +0 -1
  198. package/build/dex/integral/config.js +0 -18
  199. package/build/dex/integral/config.js.map +0 -1
  200. package/build/dex/integral/integral-pool.js +0 -67
  201. package/build/dex/integral/integral-pool.js.map +0 -1
  202. package/build/dex/integral/integral.d.ts +0 -48
  203. package/build/dex/integral/integral.js +0 -402
  204. package/build/dex/integral/integral.js.map +0 -1
  205. package/build/dex/integral/types.d.ts +0 -25
  206. package/build/dex/integral/types.js +0 -9
  207. package/build/dex/integral/types.js.map +0 -1
  208. package/build/dex/lighter-v1/abi/factory.json +0 -291
  209. package/build/dex/lighter-v1/abi/order_book.json +0 -594
  210. package/build/dex/lighter-v1/abi/order_book_helper.json +0 -176
  211. package/build/dex/lighter-v1/abi/router.json +0 -488
  212. package/build/dex/lighter-v1/config.js +0 -17
  213. package/build/dex/lighter-v1/config.js.map +0 -1
  214. package/build/dex/lighter-v1/constants.d.ts +0 -2
  215. package/build/dex/lighter-v1/constants.js +0 -13
  216. package/build/dex/lighter-v1/constants.js.map +0 -1
  217. package/build/dex/lighter-v1/lighter-v1-pool.d.ts +0 -57
  218. package/build/dex/lighter-v1/lighter-v1-pool.js +0 -310
  219. package/build/dex/lighter-v1/lighter-v1-pool.js.map +0 -1
  220. package/build/dex/lighter-v1/lighter-v1.js +0 -331
  221. package/build/dex/lighter-v1/lighter-v1.js.map +0 -1
  222. package/build/dex/lighter-v1/types.d.ts +0 -40
  223. package/build/dex/lighter-v1/types.js.map +0 -1
  224. package/build/dex/pancakeswap-v3/types.d.ts +0 -14
  225. package/build/dex/pancakeswap-v3/types.js +0 -3
  226. package/build/dex/pancakeswap-v3/types.js.map +0 -1
  227. package/build/dex/quickswap/camelot-v3.d.ts +0 -6
  228. package/build/dex/quickswap/camelot-v3.js +0 -19
  229. package/build/dex/quickswap/camelot-v3.js.map +0 -1
  230. package/build/dex/quickswap/zyberswap-v3.d.ts +0 -6
  231. package/build/dex/quickswap/zyberswap-v3.js +0 -19
  232. package/build/dex/quickswap/zyberswap-v3.js.map +0 -1
  233. package/build/dex/quickswap-v3.d.ts +0 -21
  234. package/build/dex/quickswap-v3.js +0 -40
  235. package/build/dex/quickswap-v3.js.map +0 -1
  236. package/build/dex/ramses-v2/config.js +0 -28
  237. package/build/dex/ramses-v2/config.js.map +0 -1
  238. package/build/dex/ramses-v2/constants.d.ts +0 -28
  239. package/build/dex/ramses-v2/constants.js +0 -35
  240. package/build/dex/ramses-v2/constants.js.map +0 -1
  241. package/build/dex/ramses-v2/contract-math/BitMath.d.ts +0 -4
  242. package/build/dex/ramses-v2/contract-math/BitMath.js +0 -93
  243. package/build/dex/ramses-v2/contract-math/BitMath.js.map +0 -1
  244. package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +0 -3
  245. package/build/dex/ramses-v2/contract-math/FixedPoint128.js +0 -8
  246. package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +0 -1
  247. package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +0 -4
  248. package/build/dex/ramses-v2/contract-math/FixedPoint96.js +0 -9
  249. package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +0 -1
  250. package/build/dex/ramses-v2/contract-math/FullMath.d.ts +0 -4
  251. package/build/dex/ramses-v2/contract-math/FullMath.js +0 -19
  252. package/build/dex/ramses-v2/contract-math/FullMath.js.map +0 -1
  253. package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +0 -3
  254. package/build/dex/ramses-v2/contract-math/LiquidityMath.js +0 -22
  255. package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +0 -1
  256. package/build/dex/ramses-v2/contract-math/Oracle.d.ts +0 -10
  257. package/build/dex/ramses-v2/contract-math/Oracle.js +0 -133
  258. package/build/dex/ramses-v2/contract-math/Oracle.js.map +0 -1
  259. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +0 -10
  260. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +0 -91
  261. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +0 -1
  262. package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +0 -8
  263. package/build/dex/ramses-v2/contract-math/SwapMath.js +0 -70
  264. package/build/dex/ramses-v2/contract-math/SwapMath.js.map +0 -1
  265. package/build/dex/ramses-v2/contract-math/Tick.d.ts +0 -7
  266. package/build/dex/ramses-v2/contract-math/Tick.js +0 -45
  267. package/build/dex/ramses-v2/contract-math/Tick.js.map +0 -1
  268. package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +0 -8
  269. package/build/dex/ramses-v2/contract-math/TickBitMap.js +0 -87
  270. package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +0 -1
  271. package/build/dex/ramses-v2/contract-math/TickMath.d.ts +0 -8
  272. package/build/dex/ramses-v2/contract-math/TickMath.js +0 -162
  273. package/build/dex/ramses-v2/contract-math/TickMath.js.map +0 -1
  274. package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +0 -3
  275. package/build/dex/ramses-v2/contract-math/UnsafeMath.js +0 -10
  276. package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +0 -1
  277. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +0 -18
  278. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +0 -392
  279. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +0 -1
  280. package/build/dex/ramses-v2/contract-math/utils.d.ts +0 -3
  281. package/build/dex/ramses-v2/contract-math/utils.js +0 -16
  282. package/build/dex/ramses-v2/contract-math/utils.js.map +0 -1
  283. package/build/dex/ramses-v2/ramses-v2-pool.d.ts +0 -42
  284. package/build/dex/ramses-v2/ramses-v2-pool.js +0 -307
  285. package/build/dex/ramses-v2/ramses-v2-pool.js.map +0 -1
  286. package/build/dex/ramses-v2/ramses-v2.d.ts +0 -61
  287. package/build/dex/ramses-v2/ramses-v2.js +0 -690
  288. package/build/dex/ramses-v2/ramses-v2.js.map +0 -1
  289. package/build/dex/ramses-v2/types.d.ts +0 -154
  290. package/build/dex/ramses-v2/types.js +0 -9
  291. package/build/dex/ramses-v2/types.js.map +0 -1
  292. package/build/dex/ramses-v2/utils.d.ts +0 -6
  293. package/build/dex/ramses-v2/utils.js +0 -71
  294. package/build/dex/ramses-v2/utils.js.map +0 -1
  295. package/build/dex/solidly/forks-override/fvm.d.ts +0 -20
  296. package/build/dex/solidly/forks-override/fvm.js +0 -42
  297. package/build/dex/solidly/forks-override/fvm.js.map +0 -1
  298. package/build/dex/sushiswap-v3/config.d.ts +0 -4
  299. package/build/dex/sushiswap-v3/config.js +0 -132
  300. package/build/dex/sushiswap-v3/config.js.map +0 -1
  301. package/build/dex/sushiswap-v3/constants.d.ts +0 -4
  302. package/build/dex/sushiswap-v3/constants.js +0 -32
  303. package/build/dex/sushiswap-v3/constants.js.map +0 -1
  304. package/build/dex/sushiswap-v3/sushiswap-v3-original.d.ts +0 -56
  305. package/build/dex/sushiswap-v3/sushiswap-v3-original.js +0 -598
  306. package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +0 -1
  307. package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +0 -1
  308. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +0 -6
  309. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +0 -1
  310. package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +0 -21
  311. package/build/dex/sushiswap-v3/sushiswap-v3.js +0 -58
  312. package/build/dex/sushiswap-v3/sushiswap-v3.js.map +0 -1
  313. package/build/dex/sushiswap-v3/token.d.ts +0 -6
  314. package/build/dex/sushiswap-v3/token.js +0 -23
  315. package/build/dex/sushiswap-v3/token.js.map +0 -1
  316. package/build/dex/sushiswap-v3/types.d.ts +0 -15
  317. package/build/dex/sushiswap-v3/types.js +0 -18
  318. package/build/dex/sushiswap-v3/types.js.map +0 -1
  319. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +0 -12
  320. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +0 -23
  321. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +0 -1
  322. package/build/dex/woo-fi/config.js +0 -141
  323. package/build/dex/woo-fi/config.js.map +0 -1
  324. package/build/dex/woo-fi/constants.d.ts +0 -5
  325. package/build/dex/woo-fi/constants.js +0 -20
  326. package/build/dex/woo-fi/constants.js.map +0 -1
  327. package/build/dex/woo-fi/types.d.ts +0 -48
  328. package/build/dex/woo-fi/types.js +0 -3
  329. package/build/dex/woo-fi/types.js.map +0 -1
  330. package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +0 -14
  331. package/build/dex/woo-fi/woo-fi-decimal-math.js +0 -42
  332. package/build/dex/woo-fi/woo-fi-decimal-math.js.map +0 -1
  333. package/build/dex/woo-fi/woo-fi-math.d.ts +0 -31
  334. package/build/dex/woo-fi/woo-fi-math.js +0 -300
  335. package/build/dex/woo-fi/woo-fi-math.js.map +0 -1
  336. package/build/dex/woo-fi/woo-fi.d.ts +0 -65
  337. package/build/dex/woo-fi/woo-fi.js +0 -480
  338. package/build/dex/woo-fi/woo-fi.js.map +0 -1
  339. package/build/executor/Executor01BytecodeBuilder.d.ts +0 -77
  340. package/build/executor/Executor01BytecodeBuilder.js +0 -359
  341. package/build/executor/Executor01BytecodeBuilder.js.map +0 -1
  342. package/build/executor/Executor02BytecodeBuilder.d.ts +0 -12
  343. package/build/executor/Executor02BytecodeBuilder.js +0 -14
  344. package/build/executor/Executor02BytecodeBuilder.js.map +0 -1
  345. package/build/executor/ExecutorDetector.d.ts +0 -28
  346. package/build/executor/ExecutorDetector.js +0 -89
  347. package/build/executor/ExecutorDetector.js.map +0 -1
  348. package/build/executor/IExecutorBytecodeBuilder.d.ts +0 -6
  349. package/build/executor/IExecutorBytecodeBuilder.js +0 -3
  350. package/build/executor/IExecutorBytecodeBuilder.js.map +0 -1
  351. package/build/generic-swap-transaction-builder.d.ts +0 -39
  352. package/build/generic-swap-transaction-builder.js +0 -156
  353. package/build/generic-swap-transaction-builder.js.map +0 -1
  354. /package/build/dex/{lighter-v1 → angle-staked-stable}/types.js +0 -0
@@ -0,0 +1,297 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import type { DeepReadonly } from 'ts-essentials';
3
+ import type { BlockHeader, Log, Logger } from '../../types';
4
+ import {
5
+ bigIntify,
6
+ catchParseLogError,
7
+ currentBigIntTimestampInS,
8
+ } from '../../utils';
9
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
10
+ import type { IDexHelper } from '../../dex-helper/idex-helper';
11
+ import type { DexParams, PoolState } from './types';
12
+ import StakedStableABI from '../../abi/angle/stagToken.json';
13
+ import ERC20ABI from '../../abi/erc20.json';
14
+
15
+ export class AngleStakedStableEventPool extends StatefulEventSubscriber<PoolState> {
16
+ handlers: {
17
+ [event: string]: (
18
+ event: any,
19
+ state: DeepReadonly<PoolState>,
20
+ log: Readonly<Log>,
21
+ blockHeader: Readonly<BlockHeader>,
22
+ ) => DeepReadonly<PoolState> | null;
23
+ } = {};
24
+
25
+ static angleStakedStableIface = new Interface(StakedStableABI);
26
+ static erc20Iface = new Interface(ERC20ABI);
27
+
28
+ logDecoder: (log: Log) => any;
29
+
30
+ addressesSubscribed: string[];
31
+
32
+ BASE_27 = BigInt(1e27);
33
+ HALF_BASE_27 = BigInt(1e27 / 2);
34
+ ZERO = BigInt(0);
35
+
36
+ constructor(
37
+ readonly parentName: string,
38
+ protected network: number,
39
+ protected dexHelper: IDexHelper,
40
+ public stakeToken: string,
41
+ public agToken: string,
42
+ logger: Logger,
43
+ ) {
44
+ super(parentName, 'Staked_Stable', dexHelper, logger);
45
+
46
+ this.logDecoder = (log: Log) =>
47
+ AngleStakedStableEventPool.angleStakedStableIface.parseLog(log);
48
+ this.addressesSubscribed = [stakeToken];
49
+
50
+ // Add handlers
51
+ this.handlers.Accrued = this.handleAccrued.bind(this);
52
+ this.handlers.Deposit = this.handleDeposit.bind(this);
53
+ this.handlers.Withdraw = this.handleWithdraw.bind(this);
54
+ this.handlers.ToggledPause = this.handleToggledPause.bind(this);
55
+ this.handlers.RateUpdated = this.handleRateUpdated.bind(this);
56
+ }
57
+
58
+ /**
59
+ * The function is called every time any of the subscribed
60
+ * addresses release log. The function accepts the current
61
+ * state, updates the state according to the log, and returns
62
+ * the updated state.
63
+ * @param state - Current state of event subscriber
64
+ * @param log - Log released by one of the subscribed addresses
65
+ * @returns Updates state of the event subscriber after the log
66
+ */
67
+ protected processLog(
68
+ state: DeepReadonly<PoolState>,
69
+ log: Readonly<Log>,
70
+ blockHeader: Readonly<BlockHeader>,
71
+ ): DeepReadonly<PoolState> | null {
72
+ try {
73
+ const event = this.logDecoder(log);
74
+ if (event.name in this.handlers) {
75
+ return this.handlers[event.name](event, state, log, blockHeader);
76
+ }
77
+ } catch (e) {
78
+ catchParseLogError(e, this.logger);
79
+ }
80
+
81
+ return null;
82
+ }
83
+
84
+ /**
85
+ * The function generates state using on-chain calls. This
86
+ * function is called to regenerate state if the event based
87
+ * system fails to fetch events and the local state is no
88
+ * more correct.
89
+ * @param blockNumber - Blocknumber for which the state should
90
+ * should be generated
91
+ * @returns state of the event subscriber at blocknumber
92
+ */
93
+ async generateState(blockNumber: number): Promise<DeepReadonly<PoolState>> {
94
+ const poolState = {
95
+ totalAssets: 0n,
96
+ totalSupply: 0n,
97
+ lastUpdate: 0n,
98
+ paused: false,
99
+ rate: 0n,
100
+ } as PoolState;
101
+
102
+ const multicall = [
103
+ {
104
+ target: this.agToken,
105
+ callData: AngleStakedStableEventPool.erc20Iface.encodeFunctionData(
106
+ 'balanceOf',
107
+ [this.stakeToken],
108
+ ),
109
+ },
110
+ {
111
+ target: this.stakeToken,
112
+ callData:
113
+ AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData(
114
+ 'totalSupply',
115
+ ),
116
+ },
117
+ {
118
+ target: this.stakeToken,
119
+ callData:
120
+ AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData(
121
+ 'lastUpdate',
122
+ ),
123
+ },
124
+ {
125
+ target: this.stakeToken,
126
+ callData:
127
+ AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData(
128
+ 'paused',
129
+ ),
130
+ },
131
+ {
132
+ target: this.stakeToken,
133
+ callData:
134
+ AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData(
135
+ 'rate',
136
+ ),
137
+ },
138
+ ];
139
+
140
+ // on chain call
141
+ const returnData = (
142
+ await this.dexHelper.multiContract.methods
143
+ .aggregate(multicall)
144
+ .call({}, blockNumber)
145
+ ).returnData;
146
+
147
+ // Decode
148
+ poolState.totalAssets = bigIntify(
149
+ AngleStakedStableEventPool.erc20Iface.decodeFunctionResult(
150
+ 'balanceOf',
151
+ returnData[0],
152
+ )[0],
153
+ );
154
+ poolState.totalSupply = bigIntify(
155
+ AngleStakedStableEventPool.angleStakedStableIface.decodeFunctionResult(
156
+ 'totalSupply',
157
+ returnData[1],
158
+ )[0],
159
+ );
160
+ poolState.lastUpdate = bigIntify(
161
+ AngleStakedStableEventPool.angleStakedStableIface.decodeFunctionResult(
162
+ 'lastUpdate',
163
+ returnData[2],
164
+ )[0],
165
+ );
166
+ poolState.paused =
167
+ AngleStakedStableEventPool.angleStakedStableIface.decodeFunctionResult(
168
+ 'paused',
169
+ returnData[3],
170
+ )[0] as boolean;
171
+
172
+ poolState.rate = bigIntify(
173
+ AngleStakedStableEventPool.angleStakedStableIface.decodeFunctionResult(
174
+ 'rate',
175
+ returnData[4],
176
+ )[0],
177
+ );
178
+
179
+ return poolState;
180
+ }
181
+
182
+ getRateDeposit(amount: bigint, state: PoolState): bigint {
183
+ const newTotalAssets = this._accrue(state);
184
+ return amount === 0n || state.totalSupply === 0n
185
+ ? amount
186
+ : (amount * state.totalSupply) / newTotalAssets;
187
+ }
188
+
189
+ getRateMint(shares: bigint, state: PoolState): bigint {
190
+ const newTotalAssets = this._accrue(state);
191
+ const roundUp =
192
+ (shares * newTotalAssets) % state.totalSupply > 0n ? 1n : 0n;
193
+ return state.totalSupply === 0n
194
+ ? shares
195
+ : (shares * newTotalAssets) / state.totalSupply + roundUp;
196
+ }
197
+
198
+ getRateRedeem(shares: bigint, state: PoolState): bigint {
199
+ const newTotalAssets = this._accrue(state);
200
+ return state.totalSupply === 0n
201
+ ? shares
202
+ : (shares * newTotalAssets) / state.totalSupply;
203
+ }
204
+
205
+ getRateWithdraw(amount: bigint, state: PoolState): bigint {
206
+ const newTotalAssets = this._accrue(state);
207
+ const roundUp =
208
+ (amount * state.totalSupply) % newTotalAssets > 0n ? 1n : 0n;
209
+ return amount === 0n || state.totalSupply === 0n
210
+ ? amount
211
+ : (amount * state.totalSupply) / newTotalAssets + roundUp;
212
+ }
213
+
214
+ _accrue(state: PoolState): bigint {
215
+ const newTotalAssets = this._computeUpdatedAssets(
216
+ state.totalAssets,
217
+ state.rate,
218
+ currentBigIntTimestampInS() - state.lastUpdate,
219
+ );
220
+ return newTotalAssets;
221
+ }
222
+
223
+ _computeUpdatedAssets(amount: bigint, rate: bigint, exp: bigint): bigint {
224
+ if (exp === 0n || rate === 0n) return amount;
225
+ const expMinusOne = exp - 1n;
226
+ const expMinusTwo = exp > 2n ? exp - 2n : 0n;
227
+ const basePowerTwo = (rate * rate + this.HALF_BASE_27) / this.BASE_27;
228
+ const basePowerThree =
229
+ (basePowerTwo * rate + this.HALF_BASE_27) / this.BASE_27;
230
+ const secondTerm = (exp * expMinusOne * basePowerTwo) / 2n;
231
+ const thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6n;
232
+ return (
233
+ (amount * (this.BASE_27 + rate * exp + secondTerm + thirdTerm)) /
234
+ this.BASE_27
235
+ );
236
+ }
237
+
238
+ handleAccrued(
239
+ event: any,
240
+ state: PoolState,
241
+ log: Readonly<Log>,
242
+ blockHeader: BlockHeader,
243
+ ): DeepReadonly<PoolState> | null {
244
+ const interest = bigIntify(event.args.interest);
245
+ state.totalAssets += interest;
246
+ state.lastUpdate = bigIntify(blockHeader.timestamp);
247
+ return state;
248
+ }
249
+
250
+ handleRateUpdated(
251
+ event: any,
252
+ state: PoolState,
253
+ log: Readonly<Log>,
254
+ blockHeader: BlockHeader,
255
+ ): DeepReadonly<PoolState> | null {
256
+ state.rate = bigIntify(event.args.newRate);
257
+ return state;
258
+ }
259
+
260
+ handleDeposit(
261
+ event: any,
262
+ state: PoolState,
263
+ log: Readonly<Log>,
264
+ blockHeader: BlockHeader,
265
+ ): DeepReadonly<PoolState> | null {
266
+ const assets = bigIntify(event.args.assets);
267
+ const shares = bigIntify(event.args.shares);
268
+ state.totalAssets += assets;
269
+ state.totalSupply += shares;
270
+ state.lastUpdate = bigIntify(blockHeader.timestamp);
271
+ return state;
272
+ }
273
+
274
+ handleWithdraw(
275
+ event: any,
276
+ state: PoolState,
277
+ log: Readonly<Log>,
278
+ blockHeader: BlockHeader,
279
+ ): DeepReadonly<PoolState> | null {
280
+ const assets = bigIntify(event.args.assets);
281
+ const shares = bigIntify(event.args.shares);
282
+ state.totalAssets -= assets;
283
+ state.totalSupply -= shares;
284
+ state.lastUpdate = bigIntify(blockHeader.timestamp);
285
+ return state;
286
+ }
287
+
288
+ handleToggledPause(
289
+ event: any,
290
+ state: PoolState,
291
+ log: Readonly<Log>,
292
+ ): DeepReadonly<PoolState> | null {
293
+ const pauseStatus: boolean = event.args.pauseStatus;
294
+ state.paused = pauseStatus;
295
+ return state;
296
+ }
297
+ }
@@ -0,0 +1,314 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import type { AsyncOrSync } from 'ts-essentials';
3
+ import type {
4
+ Token,
5
+ Address,
6
+ ExchangePrices,
7
+ PoolPrices,
8
+ AdapterExchangeParam,
9
+ SimpleExchangeParam,
10
+ PoolLiquidity,
11
+ Logger,
12
+ } from '../../types';
13
+ import { SwapSide, type Network } from '../../constants';
14
+ import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
15
+ import { getDexKeysWithNetwork } from '../../utils';
16
+ import type { IDex } from '../../dex/idex';
17
+ import type { IDexHelper } from '../../dex-helper/idex-helper';
18
+ import type { AngleStakedStableData, DexParams } from './types';
19
+ import { SimpleExchange } from '../simple-exchange';
20
+ import { AngleStakedStableConfig, Adapters } from './config';
21
+ import { AngleStakedStableEventPool } from './angle-staked-stable-pool';
22
+ import StakedStableABI from '../../abi/angle/stagToken.json';
23
+
24
+ const AngleStakedGasCost = 0;
25
+
26
+ export class AngleStakedStable
27
+ extends SimpleExchange
28
+ implements IDex<AngleStakedStableData>
29
+ {
30
+ static readonly wstETHIface = new Interface(StakedStableABI);
31
+ protected config: DexParams;
32
+
33
+ readonly hasConstantPriceLargeAmounts = false;
34
+ readonly needWrapNative = true;
35
+
36
+ readonly isFeeOnTransferSupported = false;
37
+
38
+ public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
39
+ getDexKeysWithNetwork(AngleStakedStableConfig);
40
+
41
+ logger: Logger;
42
+
43
+ protected eventPools: { [key: string]: AngleStakedStableEventPool } = {};
44
+ protected isPaused: { [key: string]: boolean } = {};
45
+
46
+ constructor(
47
+ readonly network: Network,
48
+ readonly dexKey: string,
49
+ readonly dexHelper: IDexHelper,
50
+ protected adapters = Adapters[network] || {},
51
+ ) {
52
+ super(dexHelper, dexKey);
53
+ const config = AngleStakedStableConfig[dexKey][network];
54
+ this.logger = dexHelper.getLogger(dexKey);
55
+ this.config = {
56
+ stakeToken: config.stakeToken.toLowerCase(),
57
+ agToken: config.agToken.toLowerCase(),
58
+ };
59
+ }
60
+
61
+ async initializePricing(blockNumber: number) {
62
+ this.eventPools[this.config.stakeToken] = new AngleStakedStableEventPool(
63
+ `${this.dexKey}_${this.config.stakeToken!.toLowerCase()}`,
64
+ this.network,
65
+ this.dexHelper,
66
+ this.config.stakeToken,
67
+ this.config.agToken,
68
+ this.logger,
69
+ );
70
+ await this.eventPools[this.config.stakeToken].initialize(blockNumber);
71
+ }
72
+
73
+ getAdapters(side: SwapSide): { name: string; index: number }[] | null {
74
+ return this.adapters[side] ? this.adapters[side] : null;
75
+ }
76
+
77
+ async getPoolIdentifiers(
78
+ srcToken: Token,
79
+ destToken: Token,
80
+ side: SwapSide,
81
+ blockNumber: number,
82
+ ): Promise<string[]> {
83
+ const knownInfo = this._knownAddress(srcToken, destToken);
84
+ if (!knownInfo.known) return [];
85
+ return [`${this.dexKey}_${knownInfo.stakeToken!.toLowerCase()}`];
86
+ }
87
+
88
+ async getPricesVolume(
89
+ srcToken: Token,
90
+ destToken: Token,
91
+ amounts: bigint[],
92
+ side: SwapSide,
93
+ blockNumber: number,
94
+ limitPools?: string[],
95
+ ): Promise<null | ExchangePrices<AngleStakedStableData>> {
96
+ const srcTokenAddress = srcToken.address.toLowerCase();
97
+ const destTokenAddress = destToken.address.toLowerCase();
98
+ const knownInfo = this._knownAddress(srcToken, destToken);
99
+ if (!knownInfo.known) return null;
100
+
101
+ const agToken = knownInfo.agToken!;
102
+ const stakeToken = knownInfo.stakeToken!;
103
+ const eventPool = this.eventPools[stakeToken];
104
+ const exchange = `${this.dexKey}`;
105
+ const state = eventPool?.getState(blockNumber);
106
+ if (this.eventPools === null || state === undefined || state === null)
107
+ return null;
108
+ if (srcTokenAddress === agToken && side === SwapSide.SELL)
109
+ return [
110
+ {
111
+ prices: amounts.map(amount =>
112
+ eventPool.getRateDeposit(amount, state),
113
+ ),
114
+ unit: eventPool.getRateDeposit(1n * BigInt(10 ** 18), state),
115
+ gasCost: AngleStakedGasCost,
116
+ exchange: exchange,
117
+ data: { exchange: `${stakeToken}` },
118
+ poolAddresses: [`${stakeToken}`],
119
+ },
120
+ ];
121
+ if (destTokenAddress === agToken && side === SwapSide.SELL)
122
+ return [
123
+ {
124
+ prices: amounts.map(share => eventPool.getRateRedeem(share, state)),
125
+ unit: eventPool.getRateRedeem(1n * BigInt(10 ** 18), state),
126
+ gasCost: AngleStakedGasCost,
127
+ exchange: exchange,
128
+ data: { exchange: `${stakeToken}` },
129
+ poolAddresses: [`${stakeToken}_${agToken}`],
130
+ },
131
+ ];
132
+ if (srcTokenAddress === agToken && side === SwapSide.BUY)
133
+ return [
134
+ {
135
+ prices: amounts.map(share => eventPool.getRateMint(share, state)),
136
+ unit: eventPool.getRateMint(1n * BigInt(10 ** 18), state),
137
+ gasCost: AngleStakedGasCost,
138
+ exchange: exchange,
139
+ data: { exchange: `${stakeToken}` },
140
+ poolAddresses: [`${stakeToken}_${agToken}`],
141
+ },
142
+ ];
143
+ return [
144
+ {
145
+ prices: amounts.map(amount => eventPool.getRateWithdraw(amount, state)),
146
+ unit: eventPool.getRateWithdraw(1n * BigInt(10 ** 18), state),
147
+ gasCost: AngleStakedGasCost,
148
+ exchange: exchange,
149
+ data: { exchange: `${stakeToken}` },
150
+ poolAddresses: [`${stakeToken}_${agToken}`],
151
+ },
152
+ ];
153
+ }
154
+
155
+ // Returns estimated gas cost of calldata for this DEX in multiSwap
156
+ getCalldataGasCost(
157
+ poolPrices: PoolPrices<AngleStakedStableData>,
158
+ ): number | number[] {
159
+ return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
160
+ }
161
+
162
+ getAdapterParam(
163
+ srcToken: string,
164
+ destToken: string,
165
+ srcAmount: string,
166
+ destAmount: string,
167
+ data: AngleStakedStableData,
168
+ side: SwapSide,
169
+ ): AdapterExchangeParam {
170
+ const { exchange } = data;
171
+
172
+ const payload = this.abiCoder.encodeParameter(
173
+ {
174
+ ParentStruct: {
175
+ toStaked: 'bool',
176
+ },
177
+ },
178
+ {
179
+ toStaked: srcToken.toLowerCase() === this.config.agToken,
180
+ },
181
+ );
182
+
183
+ return {
184
+ targetExchange: exchange,
185
+ payload,
186
+ networkFee: '0',
187
+ };
188
+ }
189
+
190
+ // Encode call data used by simpleSwap like routers
191
+ // Used for simpleSwap & simpleBuy
192
+ // Hint: this.buildSimpleParamWithoutWETHConversion
193
+ // could be useful
194
+ async getSimpleParam(
195
+ srcToken: string,
196
+ destToken: string,
197
+ srcAmount: string,
198
+ destAmount: string,
199
+ data: AngleStakedStableData,
200
+ side: SwapSide,
201
+ ): Promise<SimpleExchangeParam> {
202
+ const { exchange } = data;
203
+
204
+ // Encode here the transaction arguments
205
+ const swapData =
206
+ srcToken.toLowerCase() === this.config.agToken
207
+ ? AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData(
208
+ side === SwapSide.SELL ? 'deposit' : 'mint',
209
+ [
210
+ side === SwapSide.SELL ? srcAmount : destAmount,
211
+ this.augustusAddress,
212
+ ],
213
+ )
214
+ : AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData(
215
+ side === SwapSide.SELL ? 'redeem' : 'withdraw',
216
+ [
217
+ side === SwapSide.SELL ? srcAmount : destAmount,
218
+ this.augustusAddress,
219
+ this.augustusAddress,
220
+ ],
221
+ );
222
+
223
+ return this.buildSimpleParamWithoutWETHConversion(
224
+ srcToken,
225
+ srcAmount,
226
+ destToken,
227
+ destAmount,
228
+ swapData,
229
+ exchange,
230
+ );
231
+ }
232
+
233
+ // This is called once before getTopPoolsForToken is
234
+ // called for multiple tokens. This can be helpful to
235
+ // update common state required for calculating
236
+ // getTopPoolsForToken. It is optional for a DEX
237
+ // to implement this
238
+ async updatePoolState(): Promise<void> {
239
+ const tokenBalanceMultiCall = [
240
+ {
241
+ target: this.config.stakeToken,
242
+ callData:
243
+ AngleStakedStableEventPool.angleStakedStableIface.encodeFunctionData(
244
+ 'paused',
245
+ ),
246
+ },
247
+ ];
248
+ const returnData = (
249
+ await this.dexHelper.multiContract.methods
250
+ .aggregate(tokenBalanceMultiCall)
251
+ .call()
252
+ ).returnData;
253
+
254
+ this.isPaused[this.config.stakeToken] =
255
+ AngleStakedStableEventPool.angleStakedStableIface.decodeFunctionResult(
256
+ 'paused',
257
+ returnData[0],
258
+ )[0] as boolean;
259
+ }
260
+
261
+ // Returns list of top pools based on liquidity. Max
262
+ // limit number pools should be returned.
263
+ async getTopPoolsForToken(
264
+ tokenAddress: Address,
265
+ limit: number,
266
+ ): Promise<PoolLiquidity[]> {
267
+ if (
268
+ this.isPaused[this.config.stakeToken] ||
269
+ (tokenAddress.toLowerCase() !== this.config.agToken &&
270
+ tokenAddress.toLowerCase() !== this.config.stakeToken)
271
+ ) {
272
+ return [];
273
+ }
274
+
275
+ return [
276
+ {
277
+ exchange: `${this.dexKey}_${this.config.stakeToken!.toLowerCase()}`,
278
+ address: this.config.stakeToken,
279
+ connectorTokens: [
280
+ tokenAddress.toLowerCase() === this.config.agToken
281
+ ? ({ address: this.config.stakeToken, decimals: 18 } as Token)
282
+ : ({ address: this.config.agToken, decimals: 18 } as Token),
283
+ ],
284
+ // liquidity is infinite as to have been able to mint stakeToken, you must have deposited agToken
285
+ liquidityUSD: 1e12,
286
+ },
287
+ ];
288
+ }
289
+
290
+ // This is optional function in case if your implementation has acquired any resources
291
+ // you need to release for graceful shutdown. For example, it may be any interval timer
292
+ releaseResources(): AsyncOrSync<void> {}
293
+
294
+ _knownAddress(
295
+ srcToken: Token,
296
+ destToken: Token,
297
+ ): { known: boolean; agToken: string | null; stakeToken: string | null } {
298
+ const srcTokenAddress = srcToken.address.toLowerCase();
299
+ const destTokenAddress = destToken.address.toLowerCase();
300
+ if (
301
+ (srcTokenAddress === this.config.agToken &&
302
+ destTokenAddress === this.config.stakeToken) ||
303
+ (srcTokenAddress === this.config.stakeToken &&
304
+ destTokenAddress === this.config.agToken)
305
+ ) {
306
+ return {
307
+ known: true,
308
+ agToken: this.config.agToken,
309
+ stakeToken: this.config.stakeToken,
310
+ };
311
+ }
312
+ return { known: false, agToken: null, stakeToken: null };
313
+ }
314
+ }