@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,11 @@
1
+ import { GyroECLPImmutable } from '@balancer-labs/balancer-maths';
2
+ export declare const GYROECLP_GAS_COST = 214120;
3
+ export type GyroECLPImmutableString = {
4
+ [K in keyof Omit<GyroECLPImmutable, 'paramsAlpha' | 'paramsBeta' | 'paramsC' | 'paramsS' | 'paramsLambda'>]: string;
5
+ } & {
6
+ alpha: string;
7
+ beta: string;
8
+ c: string;
9
+ s: string;
10
+ lambda: string;
11
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GYROECLP_GAS_COST = void 0;
4
+ // https://sepolia.etherscan.io/tx/0x222800381cfc60b6af18c0f533149b6a3b4cda6c05aafb92cfbac42eb281bf76
5
+ exports.GYROECLP_GAS_COST = 214120;
6
+ //# sourceMappingURL=gyroECLPPool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gyroECLPPool.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/gyroECLPPool.ts"],"names":[],"mappings":";;;AAEA,qGAAqG;AACxF,QAAA,iBAAiB,GAAG,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { HooksConfigMap } from './hooks/balancer-hook-event-subscriber';
2
+ export declare function getUniqueHookNames(hooksConfigMap: HooksConfigMap): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUniqueHookNames = getUniqueHookNames;
4
+ function getUniqueHookNames(hooksConfigMap) {
5
+ // Use Object.values to get all HookConfig objects
6
+ // Then map to extract just the names
7
+ // Use Set to get unique names
8
+ // Convert back to array and join with comma
9
+ return Array.from(new Set(Object.values(hooksConfigMap).map(hook => hook.apiName))).join(', ');
10
+ }
11
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/balancer-v3/utils.ts"],"names":[],"mappings":";;AAEA,gDAQC;AARD,SAAgB,kBAAkB,CAAC,cAA8B;IAC/D,kDAAkD;IAClD,qCAAqC;IACrC,8BAA8B;IAC9B,4CAA4C;IAC5C,OAAO,KAAK,CAAC,IAAI,CACf,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CACjE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { Logger } from 'log4js';
2
+ import { RequestConfig, Response } from '../../dex-helper/irequest-wrapper';
3
+ export declare class SkippingRequest {
4
+ message: string;
5
+ constructor(message?: string);
6
+ }
7
+ export declare type RequestInfo<T> = {
8
+ requestFunc?: (options: RequestConfig) => Promise<Response<T> | SkippingRequest>;
9
+ requestOptions: RequestConfig;
10
+ caster: (data: unknown) => T;
11
+ authenticate?: (options: RequestConfig) => RequestConfig;
12
+ excludedFieldsCaching?: string[];
13
+ };
14
+ export declare type RequestInfoWithHandler<T> = {
15
+ info: RequestInfo<T>;
16
+ handler: (data: T) => void;
17
+ };
18
+ export declare class WebSocketFetcher<T> {
19
+ private logger;
20
+ private requests;
21
+ lastFetchSucceeded: boolean;
22
+ private stop;
23
+ private ws;
24
+ private connection;
25
+ constructor(requestsInfo: RequestInfoWithHandler<T>, logger: Logger);
26
+ private connected;
27
+ private connectFailed;
28
+ private onClose;
29
+ private onError;
30
+ private onMessage;
31
+ private connect;
32
+ startPolling(): void;
33
+ stopPolling(): void;
34
+ isPolling(): boolean;
35
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebSocketFetcher = exports.SkippingRequest = void 0;
4
+ const websocket_1 = require("websocket");
5
+ class SkippingRequest {
6
+ constructor(message = '') {
7
+ this.message = message;
8
+ }
9
+ }
10
+ exports.SkippingRequest = SkippingRequest;
11
+ class WebSocketFetcher {
12
+ constructor(requestsInfo, logger) {
13
+ this.logger = logger;
14
+ this.lastFetchSucceeded = false;
15
+ this.stop = true;
16
+ this.ws = new websocket_1.client();
17
+ this.connection = null;
18
+ this.requests = requestsInfo;
19
+ this.ws.on('connect', this.connected.bind(this));
20
+ this.ws.on('connectFailed', this.connectFailed.bind(this));
21
+ }
22
+ connected(connection) {
23
+ this.connection = connection;
24
+ this.logger.info(`Connected to ${this.requests.info.requestOptions.url}`);
25
+ this.connection.on('error', this.onError.bind(this));
26
+ this.connection.on('close', this.onClose.bind(this));
27
+ this.connection.on('message', this.onMessage.bind(this));
28
+ }
29
+ connectFailed(error) {
30
+ this.logger.error(`Connect Error: ${error.toString()}`);
31
+ }
32
+ onClose() {
33
+ this.logger.info(`Connection closed`);
34
+ }
35
+ onError(error) {
36
+ this.logger.error(`Connection Error: ${error.toString()}`);
37
+ }
38
+ onMessage(message) {
39
+ if (message.type === 'utf8') {
40
+ const response = JSON.parse(message.utf8Data);
41
+ const reqInfo = this.requests;
42
+ const info = reqInfo.info;
43
+ const options = reqInfo.info.requestOptions;
44
+ this.logger.debug(`(${options.url}) received new data`);
45
+ try {
46
+ const parsedData = info.caster(response);
47
+ reqInfo.handler(parsedData);
48
+ }
49
+ catch (e) {
50
+ this.logger.info(e);
51
+ this.logger.info(`(${options.url}) received incorrect data ${JSON.stringify(response).replace(/(?:\r\n|\r|\n)/g, ' ')}`, e);
52
+ return;
53
+ }
54
+ }
55
+ }
56
+ connect() {
57
+ const authorization = this.requests.info.requestOptions.headers.authorization;
58
+ const name = this.requests.info.requestOptions.headers.name;
59
+ if (typeof authorization !== 'string') {
60
+ throw new Error('Authorization header is not a string');
61
+ }
62
+ if (typeof name !== 'string') {
63
+ throw new Error('Name header is not a string');
64
+ }
65
+ this.ws.connect(this.requests.info.requestOptions.url, undefined, undefined, {
66
+ Authorization: authorization,
67
+ name: name,
68
+ });
69
+ }
70
+ startPolling() {
71
+ this.stop = false;
72
+ this.connect();
73
+ this.logger.info(`Connection started for ${this.requests.info.requestOptions.url}`);
74
+ }
75
+ stopPolling() {
76
+ if (this.connection) {
77
+ this.connection.close();
78
+ }
79
+ this.stop = true;
80
+ this.logger.info(`Connection stopped for ${this.requests.info.requestOptions.url}`);
81
+ }
82
+ isPolling() {
83
+ return !this.stop;
84
+ }
85
+ }
86
+ exports.WebSocketFetcher = WebSocketFetcher;
87
+ //# sourceMappingURL=websocket-fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-fetcher.js","sourceRoot":"","sources":["../../../src/dex/bebop/websocket-fetcher.ts"],"names":[],"mappings":";;;AAEA,yCAGmB;AAEnB,MAAa,eAAe;IAC1B,YAAmB,UAAU,EAAE;QAAZ,YAAO,GAAP,OAAO,CAAK;IAAG,CAAC;CACpC;AAFD,0CAEC;AAiBD,MAAa,gBAAgB;IAO3B,YAAY,YAAuC,EAAU,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QALpE,uBAAkB,GAAY,KAAK,CAAC;QACnC,SAAI,GAAY,IAAI,CAAC;QACrB,OAAE,GAAoB,IAAI,kBAAe,EAAE,CAAC;QAC5C,eAAU,GAA+B,IAAI,CAAC;QAGpD,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;IAEO,SAAS,CAAC,UAA+B;QAC/C,IAAI,CAAC,UAAU,GAAG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AAC,cAAc,CAAC,GAAG,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;SACzB;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,0BAA0B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,SAAS;QACP,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IACpB,CAAC;CACF;AAnGD,4CAmGC"}
@@ -0,0 +1,56 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { Contract } from 'web3-eth-contract';
3
+ import { Interface } from '@ethersproject/abi';
4
+ import { DeepReadonly } from 'ts-essentials';
5
+ import { Log, Logger } from '../../types';
6
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
7
+ import { IDexHelper } from '../../dex-helper/idex-helper';
8
+ import { PoolState, IdleToken } from './types';
9
+ import { IdleDao } from './idle-dao';
10
+ declare type BlocksTransfers = Record<number, {
11
+ underlyingAmount: BigNumber;
12
+ idleAmount: BigNumber;
13
+ processed: boolean;
14
+ }>;
15
+ export declare class IdleDaoEventPool extends StatefulEventSubscriber<PoolState> {
16
+ readonly parentName: string;
17
+ protected network: number;
18
+ protected dexHelper: IDexHelper;
19
+ protected logger: Logger;
20
+ protected idleToken: IdleToken;
21
+ protected IdleDao: IdleDao;
22
+ handlers: {
23
+ [event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => Promise<DeepReadonly<PoolState> | null>;
24
+ };
25
+ logDecoder: (log: Log) => any;
26
+ cdoContract: Contract;
27
+ poolInterface: Interface;
28
+ addressesSubscribed: string[];
29
+ blocksTransfers: BlocksTransfers;
30
+ constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, idleToken: IdleToken, IdleDao: IdleDao);
31
+ /**
32
+ * The function is called every time any of the subscribed
33
+ * addresses release log. The function accepts the current
34
+ * state, updates the state according to the log, and returns
35
+ * the updated state.
36
+ * @param state - Current state of event subscriber
37
+ * @param log - Log released by one of the subscribed addresses
38
+ * @returns Updates state of the event subscriber after the log
39
+ */
40
+ protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState> | null>;
41
+ /**
42
+ * The function generates state using on-chain calls. This
43
+ * function is called to regenerate state if the event based
44
+ * system fails to fetch events and the local state is no
45
+ * more correct.
46
+ * @param blockNumber - Blocknumber for which the state should
47
+ * should be generated
48
+ * @returns state of the event subscriber at blocknumber
49
+ */
50
+ generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
51
+ setBlockState(blockNumber: number, state: PoolState): void;
52
+ handleCoinTransfer(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
53
+ processBlockTransfer(blockNumber: number, state: PoolState): PoolState;
54
+ handleCoinTransfer_old(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
55
+ }
56
+ export {};
@@ -0,0 +1,176 @@
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.IdleDaoEventPool = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const abi_1 = require("@ethersproject/abi");
9
+ const utils_1 = require("../../utils");
10
+ const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
11
+ const idle_cdo_json_1 = __importDefault(require("../../abi/idle-dao/idle-cdo.json"));
12
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
13
+ const idle_dao_pooling_pool_1 = require("./idle-dao-pooling-pool");
14
+ const tokens_1 = require("./tokens");
15
+ class IdleDaoEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
16
+ constructor(parentName, network, dexHelper, logger, idleToken, IdleDao) {
17
+ // TODO: Add pool name
18
+ super(parentName, idleToken.idleSymbol, dexHelper, logger);
19
+ this.parentName = parentName;
20
+ this.network = network;
21
+ this.dexHelper = dexHelper;
22
+ this.logger = logger;
23
+ this.idleToken = idleToken;
24
+ this.IdleDao = IdleDao;
25
+ this.handlers = {};
26
+ this.blocksTransfers = {};
27
+ this.poolInterface = new abi_1.Interface(erc20_json_1.default);
28
+ // TODO: make logDecoder decode logs that
29
+ this.logDecoder = (log) => this.poolInterface.parseLog(log);
30
+ this.addressesSubscribed = [idleToken.address.toLowerCase()];
31
+ const cdoTokens = (0, tokens_1.getTokensByCdoAddress)(this.idleToken.cdoAddress);
32
+ if (cdoTokens) {
33
+ cdoTokens.forEach((idleToken) => {
34
+ if (!this.addressesSubscribed.includes(idleToken.idleAddress.toLowerCase())) {
35
+ this.addressesSubscribed.push(idleToken.idleAddress.toLowerCase());
36
+ }
37
+ });
38
+ }
39
+ // this.logger.debug('addressesSubscribed', this.idleToken.idleAddress, this.addressesSubscribed)
40
+ // Add handlers
41
+ this.handlers['Transfer'] = this.handleCoinTransfer.bind(this);
42
+ this.idleToken = idleToken;
43
+ this.cdoContract = new dexHelper.web3Provider.eth.Contract(idle_cdo_json_1.default, this.idleToken.cdoAddress);
44
+ }
45
+ /**
46
+ * The function is called every time any of the subscribed
47
+ * addresses release log. The function accepts the current
48
+ * state, updates the state according to the log, and returns
49
+ * the updated state.
50
+ * @param state - Current state of event subscriber
51
+ * @param log - Log released by one of the subscribed addresses
52
+ * @returns Updates state of the event subscriber after the log
53
+ */
54
+ async processLog(state, log) {
55
+ try {
56
+ const event = this.logDecoder(log);
57
+ if (event.name in this.handlers) {
58
+ const result = await this.handlers[event.name](event, state, log);
59
+ return result;
60
+ }
61
+ }
62
+ catch (e) {
63
+ (0, utils_1.catchParseLogError)(e, this.logger);
64
+ }
65
+ return null;
66
+ }
67
+ /**
68
+ * The function generates state using on-chain calls. This
69
+ * function is called to regenerate state if the event based
70
+ * system fails to fetch events and the local state is no
71
+ * more correct.
72
+ * @param blockNumber - Blocknumber for which the state should
73
+ * should be generated
74
+ * @returns state of the event subscriber at blocknumber
75
+ */
76
+ async generateState(blockNumber) {
77
+ const tranchePrice = await this.cdoContract.methods['virtualPrice'](this.idleToken.idleAddress).call({}, blockNumber);
78
+ return {
79
+ tokenPrice: BigInt(tranchePrice),
80
+ };
81
+ }
82
+ setBlockState(blockNumber, state) {
83
+ this.logger.debug('setBlockState', blockNumber, this.idleToken.idleAddress, state);
84
+ return this._setState(state, blockNumber);
85
+ }
86
+ async handleCoinTransfer(event, state, log) {
87
+ const idleTokens = (0, tokens_1.getTokensByCdoAddress)(this.idleToken.cdoAddress);
88
+ if (!idleTokens)
89
+ return null;
90
+ const pollingPool = new idle_dao_pooling_pool_1.IdleDaoPollingPool(this.parentName, this.parentName, this.dexHelper, idleTokens, this.logger);
91
+ const blockNumber = log.blockNumber;
92
+ let poolsState = null;
93
+ if (log.address.toLowerCase() === this.idleToken.address.toLowerCase()) {
94
+ if (event.args.dst.toLowerCase() ===
95
+ this.idleToken.cdoAddress.toLowerCase() ||
96
+ event.args.src.toLowerCase() === this.idleToken.cdoAddress.toLowerCase()) {
97
+ poolsState = await pollingPool.getAggregatedBlockData(blockNumber);
98
+ }
99
+ }
100
+ else if (this.addressesSubscribed.includes(log.address.toLowerCase())) {
101
+ poolsState = await pollingPool.getAggregatedBlockData(blockNumber);
102
+ }
103
+ // Update pools with the new state
104
+ if (poolsState) {
105
+ Object.keys(poolsState.value).forEach((idleAddress) => {
106
+ const poolState = poolsState?.value?.[idleAddress];
107
+ if (poolState) {
108
+ this.IdleDao.setEventPoolStateBlock(idleAddress, poolsState.blockNumber, poolState);
109
+ // Overwrite state
110
+ if (idleAddress === this.idleToken.idleAddress) {
111
+ state = poolState;
112
+ }
113
+ }
114
+ });
115
+ }
116
+ return state;
117
+ }
118
+ processBlockTransfer(blockNumber, state) {
119
+ if (!this.blocksTransfers[blockNumber] ||
120
+ this.blocksTransfers[blockNumber].processed)
121
+ return state;
122
+ const idleAmount = this.blocksTransfers[blockNumber].idleAmount.div(1e18);
123
+ const underlyingAmount = this.blocksTransfers[blockNumber].underlyingAmount.div(`1e${this.idleToken.decimals}`);
124
+ if (idleAmount.gt(0) && underlyingAmount.gt(0)) {
125
+ const tokenPrice = BigInt(bignumber_js_1.default.maximum(idleAmount, underlyingAmount)
126
+ .div(bignumber_js_1.default.minimum(idleAmount, underlyingAmount))
127
+ .times(`1e${this.idleToken.decimals}`)
128
+ .toFixed(0));
129
+ this.logger.debug('tokenPrice', blockNumber, this.idleToken.idleSymbol, this.idleToken.decimals, idleAmount.toString(), underlyingAmount.toString(), tokenPrice.toString());
130
+ this.blocksTransfers[blockNumber].processed = true;
131
+ return {
132
+ tokenPrice,
133
+ };
134
+ }
135
+ return state;
136
+ }
137
+ async handleCoinTransfer_old(event, state, log) {
138
+ // Handle underlying token transfer
139
+ if (log.address.toLowerCase() === this.idleToken.address.toLowerCase()) {
140
+ if (event.args.dst.toLowerCase() ===
141
+ this.idleToken.cdoAddress.toLowerCase() ||
142
+ event.args.src.toLowerCase() === this.idleToken.cdoAddress.toLowerCase()) {
143
+ if (!this.blocksTransfers[log.blockNumber]) {
144
+ this.blocksTransfers[log.blockNumber] = {
145
+ processed: false,
146
+ idleAmount: (0, bignumber_js_1.default)(0),
147
+ underlyingAmount: (0, bignumber_js_1.default)(0),
148
+ };
149
+ }
150
+ this.logger.debug('UnderlyingAmount', log.blockNumber, 'event', event, 'log', log, (0, bignumber_js_1.default)(BigInt(event.args.wad).toString()).toFixed());
151
+ this.blocksTransfers[log.blockNumber].underlyingAmount = (0, bignumber_js_1.default)(BigInt(event.args.wad).toString());
152
+ }
153
+ }
154
+ // Handle idle token transfer
155
+ else if (log.address.toLowerCase() === this.idleToken.idleAddress.toLowerCase()) {
156
+ this.logger.debug('IdleToken Transfer', log.blockNumber, 'event', event, 'log', log);
157
+ if (event.args.src.toLowerCase() ===
158
+ '0x0000000000000000000000000000000000000000' ||
159
+ event.args.dst.toLowerCase() ===
160
+ '0x0000000000000000000000000000000000000000') {
161
+ if (!this.blocksTransfers[log.blockNumber]) {
162
+ this.blocksTransfers[log.blockNumber] = {
163
+ processed: false,
164
+ idleAmount: (0, bignumber_js_1.default)(0),
165
+ underlyingAmount: (0, bignumber_js_1.default)(0),
166
+ };
167
+ }
168
+ this.logger.debug('IdleAmount', log.blockNumber, 'event', event, 'log', log, (0, bignumber_js_1.default)(BigInt(event.args.wad).toString()).toFixed());
169
+ this.blocksTransfers[log.blockNumber].idleAmount = (0, bignumber_js_1.default)(BigInt(event.args.wad).toString());
170
+ }
171
+ }
172
+ return this.processBlockTransfer(log.blockNumber, state);
173
+ }
174
+ }
175
+ exports.IdleDaoEventPool = IdleDaoEventPool;
176
+ //# sourceMappingURL=idle-dao-pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idle-dao-pool.js","sourceRoot":"","sources":["../../../src/dex/idle-dao/idle-dao-pool.ts"],"names":[],"mappings":";;;;;;AACA,gEAAqC;AAErC,4CAA+C;AAG/C,uCAAiD;AACjD,sEAA6C;AAC7C,qFAAuD;AACvD,+EAA0E;AAG1E,mEAA6D;AAC7D,qCAAiD;AAajD,MAAa,gBAAiB,SAAQ,mDAAkC;IAgBtE,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EACrB,MAAc,EACd,SAAoB,EACpB,OAAgB;QAE1B,sBAAsB;QACtB,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QARlD,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QACrB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAW;QACpB,YAAO,GAAP,OAAO,CAAS;QArB5B,aAAQ,GAMJ,EAAE,CAAC;QAOP,oBAAe,GAAoB,EAAE,CAAC;QAapC,IAAI,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IACE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE;gBAC1B,4CAA4C;gBAC9C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE;oBAC1B,4CAA4C,EAC9C;gBACA,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;oBAC1C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG;wBACtC,SAAS,EAAE,KAAK;wBAChB,UAAU,EAAE,IAAA,sBAAS,EAAC,CAAC,CAAC;wBACxB,gBAAgB,EAAE,IAAA,sBAAS,EAAC,CAAC,CAAC;qBAC/B,CAAC;iBACH;gBACD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,YAAY,EACZ,GAAG,CAAC,WAAW,EACf,OAAO,EACP,KAAK,EACL,KAAK,EACL,GAAG,EACH,IAAA,sBAAS,EAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CACvD,CAAC;gBACF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,UAAU,GAAG,IAAA,sBAAS,EAC1D,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAClC,CAAC;aACH;SACF;QAED,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;CACF;AArRD,4CAqRC"}
@@ -0,0 +1,16 @@
1
+ import { IDexHelper } from '../../dex-helper/idex-helper';
2
+ import { IdleToken, PoolsState } from './types';
3
+ import { MultiCallParams } from '../../lib/multi-wrapper';
4
+ import { StatefulRpcPoller } from '../../lib/stateful-rpc-poller/stateful-rpc-poller';
5
+ import { Logger } from '../../types';
6
+ import { ObjWithUpdateInfo } from '../../lib/stateful-rpc-poller/types';
7
+ declare type MulticallResultOutputs = bigint;
8
+ export declare class IdleDaoPollingPool extends StatefulRpcPoller<PoolsState, MulticallResultOutputs> {
9
+ protected idleTokens: IdleToken[];
10
+ protected logger: Logger;
11
+ constructor(dexKey: string, poolIdentifier: string, dexHelper: IDexHelper, idleTokens: IdleToken[], logger: Logger);
12
+ getAggregatedBlockData(blockNumber: number): Promise<ObjWithUpdateInfo<PoolsState> | null>;
13
+ protected _getFetchStateMultiCalls(): MultiCallParams<MulticallResultOutputs>[];
14
+ protected _parseStateFromMultiResults(multiOutputs: MulticallResultOutputs[]): PoolsState;
15
+ }
16
+ export {};
@@ -0,0 +1,57 @@
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.IdleDaoPollingPool = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const decoders_1 = require("../../lib/decoders");
9
+ const idle_cdo_json_1 = __importDefault(require("../../abi/idle-dao/idle-cdo.json"));
10
+ const utils_1 = require("../../lib/stateful-rpc-poller/utils");
11
+ const stateful_rpc_poller_1 = require("../../lib/stateful-rpc-poller/stateful-rpc-poller");
12
+ const state_polling_manager_1 = require("../../lib/stateful-rpc-poller/state-polling-manager");
13
+ class IdleDaoPollingPool extends stateful_rpc_poller_1.StatefulRpcPoller {
14
+ constructor(dexKey, poolIdentifier, dexHelper, idleTokens, logger) {
15
+ const callbacks = (0, utils_1.pollingManagerCbExtractor)(state_polling_manager_1.StatePollingManager.getInstance(dexHelper));
16
+ super(dexKey, poolIdentifier, dexHelper, 0, 0, false, callbacks);
17
+ this.idleTokens = idleTokens;
18
+ this.logger = logger;
19
+ }
20
+ async getAggregatedBlockData(blockNumber) {
21
+ const multiCalls = this.getFetchStateWithBlockInfoMultiCalls();
22
+ try {
23
+ const lastUpdatedAtMs = Date.now();
24
+ const aggregatedResults = (await this.dexHelper.multiWrapper.tryAggregate(true, multiCalls, blockNumber));
25
+ return this.parseStateFromMultiResultsWithBlockInfo(aggregatedResults, lastUpdatedAtMs);
26
+ }
27
+ catch (e) {
28
+ // this.logger.debug('ERROR fetching multicall data', blockNumber, e)
29
+ }
30
+ return null;
31
+ }
32
+ _getFetchStateMultiCalls() {
33
+ const cdoInterface = new abi_1.Interface(idle_cdo_json_1.default);
34
+ return this.idleTokens.map(idleToken => ({
35
+ target: idleToken.cdoAddress,
36
+ callData: cdoInterface.encodeFunctionData('virtualPrice', [
37
+ idleToken.idleAddress,
38
+ ]),
39
+ decodeFunction: decoders_1.uint256ToBigInt,
40
+ }));
41
+ }
42
+ _parseStateFromMultiResults(multiOutputs) {
43
+ const output = multiOutputs.reduce((acc, output, index) => {
44
+ const tokenPrice = output;
45
+ const idleToken = this.idleTokens[index];
46
+ return {
47
+ ...acc,
48
+ [idleToken.idleAddress]: {
49
+ tokenPrice,
50
+ },
51
+ };
52
+ }, {});
53
+ return output;
54
+ }
55
+ }
56
+ exports.IdleDaoPollingPool = IdleDaoPollingPool;
57
+ //# sourceMappingURL=idle-dao-pooling-pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idle-dao-pooling-pool.js","sourceRoot":"","sources":["../../../src/dex/idle-dao/idle-dao-pooling-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,iDAAqD;AACrD,qFAAuD;AAIvD,+DAAgF;AAChF,2FAAsF;AACtF,+FAA0F;AAM1F,MAAa,kBAAmB,SAAQ,uCAGvC;IACC,YACE,MAAc,EACd,cAAsB,EACtB,SAAqB,EACX,UAAuB,EACvB,MAAc;QAExB,MAAM,SAAS,GAAG,IAAA,iCAAyB,EACzC,2CAAmB,CAAC,WAAW,CAAC,SAAS,CAAC,CAC3C,CAAC;QAEF,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAPvD,eAAU,GAAV,UAAU,CAAa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CAAC;IAChB,CAAC;CACF;AAxED,gDAwEC"}
@@ -0,0 +1,9 @@
1
+ export declare const TOKEN_LISTS: {
2
+ decimals: number;
3
+ blockNumber: number;
4
+ cdoAddress: string;
5
+ idleAddress: string;
6
+ address: string;
7
+ idleSymbol: string;
8
+ tokenType: string;
9
+ }[];