@paraswap/dex-lib 4.2.5 → 4.2.7

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 (369) hide show
  1. package/build/constants.js +1 -1
  2. package/build/dex/uniswap-v4/constants.d.ts +1 -2
  3. package/build/dex/uniswap-v4/constants.js +2 -3
  4. package/build/dex/uniswap-v4/constants.js.map +1 -1
  5. package/build/dex/uniswap-v4/contract-math/Tick.d.ts +1 -1
  6. package/build/dex/uniswap-v4/contract-math/Tick.js +13 -9
  7. package/build/dex/uniswap-v4/contract-math/Tick.js.map +1 -1
  8. package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js +6 -5
  9. package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js.map +1 -1
  10. package/build/dex/uniswap-v4/optimizer.d.ts +2 -0
  11. package/build/dex/uniswap-v4/optimizer.js +47 -0
  12. package/build/dex/uniswap-v4/optimizer.js.map +1 -0
  13. package/build/dex/uniswap-v4/uniswap-v4-pool.js +14 -6
  14. package/build/dex/uniswap-v4/uniswap-v4-pool.js.map +1 -1
  15. package/build/dex/uniswap-v4/uniswap-v4.js +7 -1
  16. package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -1
  17. package/package.json +1 -1
  18. package/build/abi/AaveV1_lending_pool.json +0 -27
  19. package/build/abi/Aave_GSM.json +0 -751
  20. package/build/abi/BProtocol.json +0 -1155
  21. package/build/abi/Balancer.json +0 -257
  22. package/build/abi/BalancerV2.json +0 -1179
  23. package/build/abi/Jarvis.json +0 -1172
  24. package/build/abi/MStableAsset.json +0 -1545
  25. package/build/abi/OneInchLp.json +0 -1304
  26. package/build/abi/Onebit.json +0 -736
  27. package/build/abi/RamsesV2Pool.abi.json +0 -1554
  28. package/build/abi/RamsesV2Quoter.abi.json +0 -274
  29. package/build/abi/Shell.json +0 -1294
  30. package/build/abi/TraderJoeV2Router.json +0 -50
  31. package/build/abi/USDM.json +0 -807
  32. package/build/abi/UniswapV2Router.json +0 -397
  33. package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +0 -1246
  34. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
  35. package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
  36. package/build/abi/curve-v1/CurveTokenV1.json +0 -305
  37. package/build/abi/curve-v1/CurveTokenV2.json +0 -318
  38. package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
  39. package/build/abi/curve-v1/CurveV2Swap.json +0 -700
  40. package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
  41. package/build/abi/curve-v1/FactoryRegistry.json +0 -508
  42. package/build/abi/curve-v1/StableSwapAave.json +0 -1152
  43. package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
  44. package/build/abi/curve-v1/StableSwapCompound.json +0 -814
  45. package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
  46. package/build/abi/curve-v1/StableSwapPax.json +0 -865
  47. package/build/abi/curve-v1/StableSwapSnow.json +0 -900
  48. package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
  49. package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
  50. package/build/abi/curve-v1/StableSwapY.json +0 -814
  51. package/build/abi/inception/inception-ineth-pool.json +0 -1062
  52. package/build/abi/inception/inception-ineth.json +0 -609
  53. package/build/abi/inception/inception-ratio-feed.json +0 -329
  54. package/build/abi/inception/inception-vault.json +0 -991
  55. package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
  56. package/build/abi/kyberdmm.abi.json +0 -1148
  57. package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
  58. package/build/abi/nerve/nerve-metapool.json +0 -790
  59. package/build/abi/platypus/asset.json +0 -490
  60. package/build/abi/platypus/avax-pool.json +0 -820
  61. package/build/abi/platypus/oracle.json +0 -119
  62. package/build/abi/platypus/pool.json +0 -677
  63. package/build/abi/smardex/all/smardex-router.json +0 -648
  64. package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
  65. package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
  66. package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
  67. package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
  68. package/build/abi/swaap-v1/pool.json +0 -1346
  69. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  70. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
  71. package/build/abi/wUSDM.json +0 -757
  72. package/build/abi/zrx.v2.json +0 -1967
  73. package/build/abi/zrx.v3.json +0 -3454
  74. package/build/abi/zrx.v4.json +0 -2193
  75. package/build/dex/OneInchLp.d.ts +0 -24
  76. package/build/dex/OneInchLp.js +0 -43
  77. package/build/dex/OneInchLp.js.map +0 -1
  78. package/build/dex/aave-v1/aave-v1.d.ts +0 -34
  79. package/build/dex/aave-v1/aave-v1.js +0 -180
  80. package/build/dex/aave-v1/aave-v1.js.map +0 -1
  81. package/build/dex/aave-v1/config.d.ts +0 -11
  82. package/build/dex/aave-v1/config.js +0 -20
  83. package/build/dex/aave-v1/config.js.map +0 -1
  84. package/build/dex/aave-v1/tokens-mainnet.json +0 -134
  85. package/build/dex/aave-v1/tokens.d.ts +0 -3
  86. package/build/dex/aave-v1/tokens.js +0 -50
  87. package/build/dex/aave-v1/tokens.js.map +0 -1
  88. package/build/dex/aave-v1/types.d.ts +0 -12
  89. package/build/dex/aave-v1/types.js +0 -3
  90. package/build/dex/aave-v1/types.js.map +0 -1
  91. package/build/dex/bProtocol/bProtocol.d.ts +0 -15
  92. package/build/dex/bProtocol/bProtocol.js +0 -56
  93. package/build/dex/bProtocol/bProtocol.js.map +0 -1
  94. package/build/dex/bProtocol/types.d.ts +0 -11
  95. package/build/dex/bProtocol/types.js +0 -8
  96. package/build/dex/bProtocol/types.js.map +0 -1
  97. package/build/dex/balancer-v1/balancer-pools.json +0 -33333
  98. package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
  99. package/build/dex/bebop/websocket-fetcher.js +0 -87
  100. package/build/dex/bebop/websocket-fetcher.js.map +0 -1
  101. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  102. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  103. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  104. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  105. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  106. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  107. package/build/dex/idle-dao/scripts.d.ts +0 -9
  108. package/build/dex/idle-dao/scripts.js +0 -552
  109. package/build/dex/idle-dao/scripts.js.map +0 -1
  110. package/build/dex/inception/config.d.ts +0 -4
  111. package/build/dex/inception/config.js +0 -109
  112. package/build/dex/inception/config.js.map +0 -1
  113. package/build/dex/inception/inception-event-pool.d.ts +0 -16
  114. package/build/dex/inception/inception-event-pool.js +0 -51
  115. package/build/dex/inception/inception-event-pool.js.map +0 -1
  116. package/build/dex/inception/inception-native.d.ts +0 -43
  117. package/build/dex/inception/inception-native.js +0 -131
  118. package/build/dex/inception/inception-native.js.map +0 -1
  119. package/build/dex/inception/inception-pool.d.ts +0 -18
  120. package/build/dex/inception/inception-pool.js +0 -32
  121. package/build/dex/inception/inception-pool.js.map +0 -1
  122. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  123. package/build/dex/inception/inception-price-feed.js +0 -51
  124. package/build/dex/inception/inception-price-feed.js.map +0 -1
  125. package/build/dex/inception/inception.d.ts +0 -43
  126. package/build/dex/inception/inception.js +0 -204
  127. package/build/dex/inception/inception.js.map +0 -1
  128. package/build/dex/inception/tokens.d.ts +0 -9
  129. package/build/dex/inception/tokens.js +0 -28
  130. package/build/dex/inception/tokens.js.map +0 -1
  131. package/build/dex/inception/types.d.ts +0 -22
  132. package/build/dex/inception/types.js +0 -3
  133. package/build/dex/inception/types.js.map +0 -1
  134. package/build/dex/inception/utils.d.ts +0 -6
  135. package/build/dex/inception/utils.js +0 -37
  136. package/build/dex/inception/utils.js.map +0 -1
  137. package/build/dex/jarvis.d.ts +0 -56
  138. package/build/dex/jarvis.js +0 -163
  139. package/build/dex/jarvis.js.map +0 -1
  140. package/build/dex/mStable.d.ts +0 -44
  141. package/build/dex/mStable.js +0 -75
  142. package/build/dex/mStable.js.map +0 -1
  143. package/build/dex/onebit/onebit.d.ts +0 -16
  144. package/build/dex/onebit/onebit.js +0 -61
  145. package/build/dex/onebit/onebit.js.map +0 -1
  146. package/build/dex/onebit/types.d.ts +0 -14
  147. package/build/dex/onebit/types.js +0 -8
  148. package/build/dex/onebit/types.js.map +0 -1
  149. package/build/dex/platypus/asset.d.ts +0 -14
  150. package/build/dex/platypus/asset.js +0 -97
  151. package/build/dex/platypus/asset.js.map +0 -1
  152. package/build/dex/platypus/config.d.ts +0 -11
  153. package/build/dex/platypus/config.js +0 -69
  154. package/build/dex/platypus/config.js.map +0 -1
  155. package/build/dex/platypus/platypus.d.ts +0 -63
  156. package/build/dex/platypus/platypus.js +0 -473
  157. package/build/dex/platypus/platypus.js.map +0 -1
  158. package/build/dex/platypus/pool-avax.d.ts +0 -8
  159. package/build/dex/platypus/pool-avax.js +0 -54
  160. package/build/dex/platypus/pool-avax.js.map +0 -1
  161. package/build/dex/platypus/pool-base.d.ts +0 -19
  162. package/build/dex/platypus/pool-base.js +0 -86
  163. package/build/dex/platypus/pool-base.js.map +0 -1
  164. package/build/dex/platypus/pool-pure.d.ts +0 -8
  165. package/build/dex/platypus/pool-pure.js +0 -37
  166. package/build/dex/platypus/pool-pure.js.map +0 -1
  167. package/build/dex/platypus/pool-subscriber.d.ts +0 -14
  168. package/build/dex/platypus/pool-subscriber.js +0 -167
  169. package/build/dex/platypus/pool-subscriber.js.map +0 -1
  170. package/build/dex/platypus/pool.d.ts +0 -8
  171. package/build/dex/platypus/pool.js +0 -58
  172. package/build/dex/platypus/pool.js.map +0 -1
  173. package/build/dex/platypus/types.d.ts +0 -92
  174. package/build/dex/platypus/types.js +0 -10
  175. package/build/dex/platypus/types.js.map +0 -1
  176. package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
  177. package/build/dex/quickswap/spiritswap-v3.js +0 -19
  178. package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
  179. package/build/dex/shell.d.ts +0 -25
  180. package/build/dex/shell.js +0 -41
  181. package/build/dex/shell.js.map +0 -1
  182. package/build/dex/smardex/config.d.ts +0 -4
  183. package/build/dex/smardex/config.js +0 -64
  184. package/build/dex/smardex/config.js.map +0 -1
  185. package/build/dex/smardex/constants.d.ts +0 -18
  186. package/build/dex/smardex/constants.js +0 -33
  187. package/build/dex/smardex/constants.js.map +0 -1
  188. package/build/dex/smardex/sdk/constants.d.ts +0 -6
  189. package/build/dex/smardex/sdk/constants.js +0 -13
  190. package/build/dex/smardex/sdk/constants.js.map +0 -1
  191. package/build/dex/smardex/sdk/core.d.ts +0 -113
  192. package/build/dex/smardex/sdk/core.js +0 -499
  193. package/build/dex/smardex/sdk/core.js.map +0 -1
  194. package/build/dex/smardex/sdk/errors.d.ts +0 -15
  195. package/build/dex/smardex/sdk/errors.js +0 -22
  196. package/build/dex/smardex/sdk/errors.js.map +0 -1
  197. package/build/dex/smardex/sdk/types.d.ts +0 -62
  198. package/build/dex/smardex/sdk/types.js +0 -3
  199. package/build/dex/smardex/sdk/types.js.map +0 -1
  200. package/build/dex/smardex/sdk/utils.d.ts +0 -44
  201. package/build/dex/smardex/sdk/utils.js +0 -133
  202. package/build/dex/smardex/sdk/utils.js.map +0 -1
  203. package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
  204. package/build/dex/smardex/smardex-event-pool.js +0 -119
  205. package/build/dex/smardex/smardex-event-pool.js.map +0 -1
  206. package/build/dex/smardex/smardex.d.ts +0 -65
  207. package/build/dex/smardex/smardex.js +0 -519
  208. package/build/dex/smardex/smardex.js.map +0 -1
  209. package/build/dex/smardex/types.d.ts +0 -55
  210. package/build/dex/smardex/types.js +0 -3
  211. package/build/dex/smardex/types.js.map +0 -1
  212. package/build/dex/solidly/forks-override/cone.d.ts +0 -22
  213. package/build/dex/solidly/forks-override/cone.js +0 -53
  214. package/build/dex/solidly/forks-override/cone.js.map +0 -1
  215. package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
  216. package/build/dex/solidly/forks-override/solisnek.js +0 -15
  217. package/build/dex/solidly/forks-override/solisnek.js.map +0 -1
  218. package/build/dex/swaap-v1/config.d.ts +0 -17
  219. package/build/dex/swaap-v1/config.js +0 -56
  220. package/build/dex/swaap-v1/config.js.map +0 -1
  221. package/build/dex/swaap-v1/constants.d.ts +0 -6
  222. package/build/dex/swaap-v1/constants.js +0 -17
  223. package/build/dex/swaap-v1/constants.js.map +0 -1
  224. package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
  225. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
  226. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
  227. package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
  228. package/build/dex/swaap-v1/libraries/Const.js +0 -26
  229. package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
  230. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
  231. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
  232. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
  233. package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
  234. package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
  235. package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
  236. package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
  237. package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
  238. package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
  239. package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
  240. package/build/dex/swaap-v1/libraries/Num.js +0 -167
  241. package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
  242. package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
  243. package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
  244. package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
  245. package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
  246. package/build/dex/swaap-v1/libraries/Struct.js +0 -3
  247. package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
  248. package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
  249. package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
  250. package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
  251. package/build/dex/swaap-v1/swaap-v1.d.ts +0 -62
  252. package/build/dex/swaap-v1/swaap-v1.js +0 -379
  253. package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
  254. package/build/dex/swaap-v1/types.d.ts +0 -106
  255. package/build/dex/swaap-v1/types.js +0 -9
  256. package/build/dex/swaap-v1/types.js.map +0 -1
  257. package/build/dex/trader-joe-v2.d.ts +0 -40
  258. package/build/dex/trader-joe-v2.js +0 -74
  259. package/build/dex/trader-joe-v2.js.map +0 -1
  260. package/build/dex/usual-bond/config.d.ts +0 -3
  261. package/build/dex/usual-bond/config.js +0 -13
  262. package/build/dex/usual-bond/config.js.map +0 -1
  263. package/build/dex/usual-bond/types.d.ts +0 -7
  264. package/build/dex/usual-bond/types.js +0 -3
  265. package/build/dex/usual-bond/types.js.map +0 -1
  266. package/build/dex/usual-bond/usual-bond.d.ts +0 -35
  267. package/build/dex/usual-bond/usual-bond.js +0 -176
  268. package/build/dex/usual-bond/usual-bond.js.map +0 -1
  269. package/build/dex/wusdm/config.d.ts +0 -3
  270. package/build/dex/wusdm/config.js +0 -43
  271. package/build/dex/wusdm/config.js.map +0 -1
  272. package/build/dex/wusdm/constants.d.ts +0 -2
  273. package/build/dex/wusdm/constants.js +0 -6
  274. package/build/dex/wusdm/constants.js.map +0 -1
  275. package/build/dex/wusdm/types.d.ts +0 -18
  276. package/build/dex/wusdm/types.js +0 -11
  277. package/build/dex/wusdm/types.js.map +0 -1
  278. package/build/dex/wusdm/wusdm-pool.d.ts +0 -21
  279. package/build/dex/wusdm/wusdm-pool.js +0 -74
  280. package/build/dex/wusdm/wusdm-pool.js.map +0 -1
  281. package/build/dex/wusdm/wusdm.d.ts +0 -46
  282. package/build/dex/wusdm/wusdm.js +0 -243
  283. package/build/dex/wusdm/wusdm.js.map +0 -1
  284. package/build/dex/zerox/config.d.ts +0 -2
  285. package/build/dex/zerox/config.js +0 -33
  286. package/build/dex/zerox/config.js.map +0 -1
  287. package/build/dex/zerox/index.d.ts +0 -22
  288. package/build/dex/zerox/index.js +0 -225
  289. package/build/dex/zerox/index.js.map +0 -1
  290. package/build/dex/zerox/order.d.ts +0 -88
  291. package/build/dex/zerox/order.js +0 -53
  292. package/build/dex/zerox/order.js.map +0 -1
  293. package/build/dex/zerox/types.d.ts +0 -73
  294. package/build/dex/zerox/types.js +0 -21
  295. package/build/dex/zerox/types.js.map +0 -1
  296. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
  297. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
  298. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
  299. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
  300. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
  301. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
  302. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
  303. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
  304. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
  305. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
  306. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
  307. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
  308. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
  309. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
  310. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
  311. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
  312. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
  313. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
  314. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
  315. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
  316. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
  317. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
  318. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
  319. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
  320. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
  321. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
  322. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
  323. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
  324. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
  325. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
  326. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
  327. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
  328. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
  329. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
  330. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
  331. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
  332. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
  333. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
  334. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
  335. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
  336. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
  337. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
  338. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
  339. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
  340. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
  341. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
  342. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
  343. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
  344. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
  345. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
  346. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
  347. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
  348. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
  349. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
  350. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
  351. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
  352. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
  353. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
  354. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
  355. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
  356. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
  357. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
  358. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
  359. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
  360. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
  361. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
  362. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
  363. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
  364. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
  365. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
  366. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
  367. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
  368. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
  369. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/inception/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,eAAe,GAA8B;IACxD,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,MAAM;aACtB;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,MAAM;aACtB;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,QAAQ;aACxB;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,MAAM;aACtB;YACD;gBACE,MAAM,EAAE,WAAW;gBACnB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,SAAS;aACzB;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,MAAM;aACtB;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,OAAO;aACvB;YACD;gBACE,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,4CAA4C;gBACnD,KAAK,EAAE,4CAA4C;gBACnD,SAAS,EAAE,4CAA4C;gBACvD,aAAa,EAAE,KAAK;aACrB;SACF;KACF;CACF,CAAC;AAEW,QAAA,wBAAwB,GAAkC;IACrE,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,SAAS,EAAE,4CAA4C;SACxD;KACF;CACF,CAAC"}
@@ -1,16 +0,0 @@
1
- import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
2
- import { Address, BlockHeader, Log, Logger } from '../../types';
3
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
4
- import { IDexHelper } from '../../dex-helper/idex-helper';
5
- import { PoolState } from './types';
6
- import { Interface } from '@ethersproject/abi';
7
- export declare class InceptionEventPool extends StatefulEventSubscriber<PoolState> {
8
- protected network: number;
9
- protected dexHelper: IDexHelper;
10
- protected ratioFeedAddress: Address;
11
- poolInterface: Interface;
12
- protected ratioFeedInterface: Interface;
13
- constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, ratioFeedAddress: Address, poolInterface: Interface);
14
- protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): AsyncOrSync<DeepReadonly<PoolState> | null>;
15
- generateState(blockNumber: number): Promise<Readonly<PoolState>>;
16
- }
@@ -1,51 +0,0 @@
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.InceptionEventPool = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
9
- const utils_1 = require("./utils");
10
- const abi_1 = require("@ethersproject/abi");
11
- const inception_ratio_feed_json_1 = __importDefault(require("../../abi/inception/inception-ratio-feed.json"));
12
- const tokens_1 = require("./tokens");
13
- class InceptionEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
14
- constructor(parentName, network, dexHelper, logger, ratioFeedAddress, poolInterface) {
15
- super(parentName, ratioFeedAddress, dexHelper, logger);
16
- this.network = network;
17
- this.dexHelper = dexHelper;
18
- this.ratioFeedAddress = ratioFeedAddress;
19
- this.poolInterface = poolInterface;
20
- this.ratioFeedInterface = new abi_1.Interface(inception_ratio_feed_json_1.default);
21
- this.addressesSubscribed = [ratioFeedAddress];
22
- }
23
- processLog(state, log, blockHeader) {
24
- try {
25
- const parsed = this.ratioFeedInterface.parseLog(log);
26
- const _state = lodash_1.default.cloneDeep(state);
27
- switch (parsed.name) {
28
- case 'RatioUpdated': {
29
- const tokenInfo = (0, tokens_1.getTokenFromAddress)(this.network, parsed.args[0]);
30
- if (tokenInfo) {
31
- _state[tokenInfo.symbol.toLowerCase()] = {
32
- ratio: BigInt(parsed.args[2].toString()),
33
- };
34
- }
35
- return _state;
36
- }
37
- default:
38
- return _state;
39
- }
40
- }
41
- catch (e) {
42
- this.logger.error('Failed to parse log', e);
43
- return null;
44
- }
45
- }
46
- async generateState(blockNumber) {
47
- return (0, utils_1.getOnChainState)(this.dexHelper.multiContract, this.poolInterface, this.network, blockNumber);
48
- }
49
- }
50
- exports.InceptionEventPool = InceptionEventPool;
51
- //# sourceMappingURL=inception-event-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inception-event-pool.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-event-pool.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAGvB,+EAA0E;AAG1E,mCAA0C;AAC1C,4CAA+C;AAC/C,8GAAiF;AACjF,qCAA+C;AAE/C,MAAa,kBAAmB,SAAQ,mDAAkC;IAExE,YACE,UAAkB,EACR,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,gBAAyB,EAC5B,aAAwB;QAE/B,KAAK,CAAC,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAN7C,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,qBAAgB,GAAhB,gBAAgB,CAAS;QAC5B,kBAAa,GAAb,aAAa,CAAW;QAPvB,uBAAkB,GAAc,IAAI,eAAS,CAAC,mCAAoB,CAAC,CAAC;QAW5E,IAAI,CAAC,mBAAmB,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAChD,CAAC;IAES,UAAU,CAClB,KAA8B,EAC9B,GAAkB,EAClB,WAAkC;QAElC,IAAI;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACrD,MAAM,MAAM,GAAc,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC7C,QAAQ,MAAM,CAAC,IAAI,EAAE;gBACnB,KAAK,cAAc,CAAC,CAAC;oBACnB,MAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpE,IAAI,SAAS,EAAE;wBACb,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG;4BACvC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;yBACzC,CAAC;qBACH;oBACD,OAAO,MAAM,CAAC;iBACf;gBACD;oBACE,OAAO,MAAM,CAAC;aACjB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,OAAO,IAAA,uBAAe,EACpB,IAAI,CAAC,SAAS,CAAC,aAAa,EAC5B,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,WAAW,CACZ,CAAC;IACJ,CAAC;CACF;AAlDD,gDAkDC"}
@@ -1,43 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { AsyncOrSync } from 'ts-essentials';
3
- import { NumberAsString, SwapSide } from '@paraswap/core';
4
- import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, Logger, PoolLiquidity, PoolPrices, Token } from '../../types';
5
- import { Network } from '../../constants';
6
- import { IDex } from '../../dex/idex';
7
- import { IDexHelper } from '../../dex-helper/idex-helper';
8
- import { InceptionData } from './types';
9
- import { SimpleExchange } from '../simple-exchange';
10
- import { InceptionPool } from './inception-pool';
11
- export declare const depositETHFunction = "stake()";
12
- export declare class InceptionNative extends SimpleExchange implements IDex<InceptionData> {
13
- readonly network: Network;
14
- readonly dexKey: string;
15
- readonly dexHelper: IDexHelper;
16
- protected config: import("./types").DexParams;
17
- protected adapters: import("../../types").AdapterMappings;
18
- protected inceptionPool: InceptionPool;
19
- protected vaultInterface: Interface;
20
- protected tokenInterface: Interface;
21
- readonly hasConstantPriceLargeAmounts = false;
22
- readonly needWrapNative = false;
23
- readonly isFeeOnTransferSupported = false;
24
- static dexKeysWithNetwork: {
25
- key: string;
26
- networks: Network[];
27
- }[];
28
- logger: Logger;
29
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, config?: import("./types").DexParams, adapters?: import("../../types").AdapterMappings);
30
- initializePricing(blockNumber: number): Promise<void>;
31
- getAdapters(side: SwapSide): {
32
- name: string;
33
- index: number;
34
- }[] | null;
35
- getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
36
- getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<InceptionData>>;
37
- getCalldataGasCost(poolPrices: PoolPrices<InceptionData>): number | number[];
38
- getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: InceptionData, side: SwapSide): AdapterExchangeParam;
39
- getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: InceptionData, side: SwapSide): DexExchangeParam;
40
- updatePoolState(): Promise<void>;
41
- getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
42
- releaseResources(): AsyncOrSync<void>;
43
- }
@@ -1,131 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.InceptionNative = exports.depositETHFunction = void 0;
30
- const abi_1 = require("@ethersproject/abi");
31
- const inception_ineth_json_1 = __importDefault(require("../../abi/inception/inception-ineth.json"));
32
- const inception_ineth_pool_json_1 = __importDefault(require("../../abi/inception/inception-ineth-pool.json"));
33
- const constants_1 = require("../../constants");
34
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
35
- const utils_1 = require("../../utils");
36
- const simple_exchange_1 = require("../simple-exchange");
37
- const config_1 = require("./config");
38
- const inception_pool_1 = require("./inception-pool");
39
- const ethers_1 = require("ethers");
40
- const bigint_constants_1 = require("../../bigint-constants");
41
- exports.depositETHFunction = 'stake()';
42
- class InceptionNative extends simple_exchange_1.SimpleExchange {
43
- constructor(network, dexKey, dexHelper, config = config_1.InceptionNativeConfig[dexKey][network], adapters = config_1.Adapters[network] || {}) {
44
- super(dexHelper, dexKey);
45
- this.network = network;
46
- this.dexKey = dexKey;
47
- this.dexHelper = dexHelper;
48
- this.config = config;
49
- this.adapters = adapters;
50
- this.hasConstantPriceLargeAmounts = false;
51
- this.needWrapNative = false;
52
- this.isFeeOnTransferSupported = false;
53
- this.logger = dexHelper.getLogger(dexKey);
54
- this.vaultInterface = new abi_1.Interface(inception_ineth_pool_json_1.default);
55
- this.tokenInterface = new abi_1.Interface(inception_ineth_json_1.default);
56
- this.inceptionPool = new inception_pool_1.InceptionPool(this.dexKey, network, dexHelper, this.logger, this.config.token, this.tokenInterface);
57
- }
58
- async initializePricing(blockNumber) {
59
- const data = await this.dexHelper.multiContract.methods
60
- .aggregate([
61
- {
62
- target: this.config.token,
63
- callData: this.tokenInterface.encodeFunctionData('ratio', []),
64
- },
65
- ])
66
- .call({}, blockNumber);
67
- const decodedData = data.returnData.map(d => ethers_1.ethers.utils.defaultAbiCoder.decode(['uint256'], d));
68
- const [ratio] = decodedData.map(d => BigInt(d[0].toString()));
69
- await Promise.all([
70
- this.inceptionPool.initialize(blockNumber, {
71
- state: { ratio },
72
- }),
73
- ]);
74
- }
75
- getAdapters(side) {
76
- return this.adapters[side] ? this.adapters[side] : null;
77
- }
78
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
79
- return [`ETH_${destToken.address}`.toLowerCase()];
80
- }
81
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
82
- const pool = this.inceptionPool;
83
- if (!pool.getState(blockNumber))
84
- return null;
85
- const unitIn = bigint_constants_1.BI_POWS[18];
86
- const unitOut = pool.getPrice(blockNumber, unitIn);
87
- const amountsOut = amounts.map(amountIn => pool.getPrice(blockNumber, amountIn));
88
- return [
89
- {
90
- prices: amountsOut,
91
- unit: unitOut,
92
- data: {
93
- ratio: unitOut,
94
- },
95
- exchange: this.dexKey,
96
- poolIdentifier: `ETH_${destToken.address}`.toLowerCase(),
97
- gasCost: 120000,
98
- poolAddresses: [this.config.vault],
99
- },
100
- ];
101
- }
102
- getCalldataGasCost(poolPrices) {
103
- return CALLDATA_GAS_COST.DEX_OVERHEAD + CALLDATA_GAS_COST.LENGTH_SMALL;
104
- }
105
- getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
106
- return {
107
- targetExchange: constants_1.NULL_ADDRESS,
108
- payload: '0x',
109
- networkFee: '0',
110
- };
111
- }
112
- getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
113
- const swapData = this.vaultInterface.encodeFunctionData(exports.depositETHFunction, []);
114
- return {
115
- needWrapNative: this.needWrapNative,
116
- dexFuncHasRecipient: false,
117
- exchangeData: swapData,
118
- targetExchange: this.config.vault,
119
- swappedAmountNotPresentInExchangeData: true,
120
- returnAmountPos: undefined,
121
- };
122
- }
123
- async updatePoolState() { }
124
- async getTopPoolsForToken(tokenAddress, limit) {
125
- return [];
126
- }
127
- releaseResources() { }
128
- }
129
- exports.InceptionNative = InceptionNative;
130
- InceptionNative.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.InceptionNativeConfig);
131
- //# sourceMappingURL=inception-native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inception-native.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-native.ts"],"names":[],"mappings":"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"}
@@ -1,18 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { Log, Logger } from '../../types';
4
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
- import { IDexHelper } from '../../dex-helper/idex-helper';
6
- import { PoolState } from './types';
7
- export declare class InceptionPool extends StatefulEventSubscriber<PoolState> {
8
- readonly parentName: string;
9
- protected network: number;
10
- protected dexHelper: IDexHelper;
11
- protected vault: string;
12
- protected inceptionIface: Interface;
13
- logDecoder: (log: Log) => any;
14
- constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, vault: string, inceptionIface: Interface);
15
- protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
16
- generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
17
- getPrice(blockNumber: number, ethAmount: bigint): bigint;
18
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InceptionPool = void 0;
4
- const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
5
- const utils_1 = require("./utils");
6
- const bigint_constants_1 = require("../../bigint-constants");
7
- class InceptionPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
8
- constructor(parentName, network, dexHelper, logger, vault, inceptionIface) {
9
- super(parentName, 'inception_pool', dexHelper, logger);
10
- this.parentName = parentName;
11
- this.network = network;
12
- this.dexHelper = dexHelper;
13
- this.vault = vault;
14
- this.inceptionIface = inceptionIface;
15
- this.logDecoder = (log) => this.inceptionIface.parseLog(log);
16
- }
17
- processLog(state, log) {
18
- return state;
19
- }
20
- async generateState(blockNumber) {
21
- const state = await (0, utils_1.getOnChainRatio)(this.dexHelper.multiContract, this.vault, this.inceptionIface, blockNumber);
22
- return state;
23
- }
24
- getPrice(blockNumber, ethAmount) {
25
- const state = this.getState(blockNumber);
26
- if (!state)
27
- throw new Error('Cannot compute price');
28
- return (ethAmount * state.ratio) / bigint_constants_1.BI_POWS[18];
29
- }
30
- }
31
- exports.InceptionPool = InceptionPool;
32
- //# sourceMappingURL=inception-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inception-pool.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-pool.ts"],"names":[],"mappings":";;;AAGA,+EAA0E;AAG1E,mCAA0C;AAC1C,6DAAiD;AAEjD,MAAa,aAAc,SAAQ,mDAAkC;IAGnE,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,KAAa,EACb,cAAyB;QAEnC,KAAK,CAAC,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAP9C,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,UAAK,GAAL,KAAK,CAAQ;QACb,mBAAc,GAAd,cAAc,CAAW;QAInC,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IAES,UAAU,CAClB,KAA8B,EAC9B,GAAkB;QAElB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,MAAM,KAAK,GAAG,MAAM,IAAA,uBAAe,EACjC,IAAI,CAAC,SAAS,CAAC,aAAa,EAC5B,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,cAAc,EACnB,WAAW,CACZ,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,QAAQ,CAAC,WAAmB,EAAE,SAAiB;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAEpD,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,0BAAO,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;CACF;AAxCD,sCAwCC"}
@@ -1,19 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { PartialEventSubscriber } from '../../composed-event-subscriber';
4
- import { Address, BlockHeader, Log, Logger, MultiCallInput, MultiCallOutput } from '../../types';
5
- import { Lens } from '../../lens';
6
- import { PoolState } from './types';
7
- import { Network } from '../../constants';
8
- export declare class InceptionPriceFeed<State> extends PartialEventSubscriber<State, PoolState> {
9
- private ratioFeedAddress;
10
- private network;
11
- protected ratioFeedInterface: Interface;
12
- constructor(ratioFeedAddress: Address, network: Network, lens: Lens<DeepReadonly<State>, DeepReadonly<PoolState>>, logger: Logger);
13
- getRatio(state: DeepReadonly<State>): {
14
- readonly ratio: bigint;
15
- };
16
- processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): DeepReadonly<PoolState> | null;
17
- getGenerateStateMultiCallInputs(): MultiCallInput[];
18
- generateState(multicallOutputs: MultiCallOutput[], blockNumber?: number | 'latest'): DeepReadonly<PoolState>;
19
- }
@@ -1,51 +0,0 @@
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.InceptionPriceFeed = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const abi_1 = require("@ethersproject/abi");
9
- const composed_event_subscriber_1 = require("../../composed-event-subscriber");
10
- const inception_ratio_feed_json_1 = __importDefault(require("../../abi/inception/inception-ratio-feed.json"));
11
- const tokens_1 = require("./tokens");
12
- class InceptionPriceFeed extends composed_event_subscriber_1.PartialEventSubscriber {
13
- constructor(ratioFeedAddress, network, lens, logger) {
14
- super([ratioFeedAddress], lens, logger);
15
- this.ratioFeedAddress = ratioFeedAddress;
16
- this.network = network;
17
- this.ratioFeedInterface = new abi_1.Interface(inception_ratio_feed_json_1.default);
18
- }
19
- getRatio(state) {
20
- return this.lens.get()(state).ratio;
21
- }
22
- processLog(state, log, blockHeader) {
23
- try {
24
- const parsed = this.ratioFeedInterface.parseLog(log);
25
- const _state = lodash_1.default.cloneDeep(state);
26
- switch (parsed.name) {
27
- case 'RatioUpdated': {
28
- const tokenInfo = (0, tokens_1.getTokenFromAddress)(this.network, parsed.args[0]);
29
- _state[tokenInfo.symbol.toLowerCase()] = {
30
- ratio: BigInt(parsed.args[2].toString()),
31
- };
32
- return _state;
33
- }
34
- default:
35
- return null;
36
- }
37
- }
38
- catch (e) {
39
- this.logger.error('Failed to parse log', e);
40
- return null;
41
- }
42
- }
43
- getGenerateStateMultiCallInputs() {
44
- return [];
45
- }
46
- generateState(multicallOutputs, blockNumber) {
47
- return {};
48
- }
49
- }
50
- exports.InceptionPriceFeed = InceptionPriceFeed;
51
- //# sourceMappingURL=inception-price-feed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inception-price-feed.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-price-feed.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,4CAA+C;AAE/C,+EAAyE;AAWzE,8GAAiF;AACjF,qCAA+C;AAG/C,MAAa,kBAA0B,SAAQ,kDAG9C;IAEC,YACU,gBAAyB,EACzB,OAAgB,EACxB,IAAwD,EACxD,MAAc;QAEd,KAAK,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QALhC,qBAAgB,GAAhB,gBAAgB,CAAS;QACzB,YAAO,GAAP,OAAO,CAAS;QAHhB,uBAAkB,GAAc,IAAI,eAAS,CAAC,mCAAoB,CAAC,CAAC;IAQ9E,CAAC;IAED,QAAQ,CAAC,KAA0B;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;IACtC,CAAC;IAEM,UAAU,CACf,KAA8B,EAC9B,GAAkB,EAClB,WAAkC;QAElC,IAAI;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACrD,MAAM,MAAM,GAAc,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC7C,QAAQ,MAAM,CAAC,IAAI,EAAE;gBACnB,KAAK,cAAc,CAAC,CAAC;oBACnB,MAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG;wBACvC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;qBACzC,CAAC;oBACF,OAAO,MAAM,CAAC;iBACf;gBACD;oBACE,OAAO,IAAI,CAAC;aACf;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAEM,+BAA+B;QACpC,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,aAAa,CAClB,gBAAmC,EACnC,WAA+B;QAE/B,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AArDD,gDAqDC"}
@@ -1,43 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { AsyncOrSync } from 'ts-essentials';
3
- import { NumberAsString, SwapSide } from '@paraswap/core';
4
- import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, Logger, PoolLiquidity, PoolPrices, Token, TransferFeeParams } from '../../types';
5
- import { Network } from '../../constants';
6
- import { IDex } from '../../dex/idex';
7
- import { IDexHelper } from '../../dex-helper/idex-helper';
8
- import { InceptionDexData, PoolState } from './types';
9
- import { SimpleExchange } from '../simple-exchange';
10
- import { InceptionEventPool } from './inception-event-pool';
11
- export declare class Inception extends SimpleExchange implements IDex<InceptionDexData> {
12
- readonly network: Network;
13
- readonly dexKey: string;
14
- readonly dexHelper: IDexHelper;
15
- protected config: import("./types").DexParams[];
16
- protected vaultInterface: Interface;
17
- protected poolInterface: Interface;
18
- readonly hasConstantPriceLargeAmounts = false;
19
- readonly needWrapNative = false;
20
- readonly isFeeOnTransferSupported = true;
21
- static dexKeysWithNetwork: {
22
- key: string;
23
- networks: Network[];
24
- }[];
25
- logger: Logger;
26
- private eventPool;
27
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, config?: import("./types").DexParams[]);
28
- initializePricing(blockNumber: number): Promise<void>;
29
- initializeTokens(): Promise<void>;
30
- getAdapters(side: SwapSide): {
31
- name: string;
32
- index: number;
33
- }[] | null;
34
- getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
35
- getPoolState(pool: InceptionEventPool, blockNumber: number): Promise<PoolState>;
36
- getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[], transferFees?: TransferFeeParams): Promise<null | ExchangePrices<InceptionDexData>>;
37
- getCalldataGasCost(poolPrices: PoolPrices<InceptionDexData>): number | number[];
38
- getAdapterParam(): AdapterExchangeParam;
39
- getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: InceptionDexData, side: SwapSide): DexExchangeParam;
40
- updatePoolState(): Promise<void>;
41
- getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
42
- releaseResources(): AsyncOrSync<void>;
43
- }
@@ -1,204 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Inception = void 0;
30
- const abi_1 = require("@ethersproject/abi");
31
- const core_1 = require("@paraswap/core");
32
- const inception_vault_json_1 = __importDefault(require("../../abi/inception/inception-vault.json"));
33
- const inception_ineth_pool_json_1 = __importDefault(require("../../abi/inception/inception-ineth-pool.json"));
34
- const constants_1 = require("../../constants");
35
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
36
- const utils_1 = require("../../utils");
37
- const simple_exchange_1 = require("../simple-exchange");
38
- const config_1 = require("./config");
39
- const tokens_1 = require("./tokens");
40
- const utils_2 = require("./utils");
41
- const inception_event_pool_1 = require("./inception-event-pool");
42
- const token_transfer_fee_1 = require("../../lib/token-transfer-fee");
43
- const constants_2 = require("../../executor/constants");
44
- const DECIMALS = BigInt(1e18);
45
- class Inception extends simple_exchange_1.SimpleExchange {
46
- constructor(network, dexKey, dexHelper, config = config_1.InceptionConfig[dexKey][network]) {
47
- super(dexHelper, dexKey);
48
- this.network = network;
49
- this.dexKey = dexKey;
50
- this.dexHelper = dexHelper;
51
- this.config = config;
52
- this.hasConstantPriceLargeAmounts = false;
53
- this.needWrapNative = false;
54
- this.isFeeOnTransferSupported = true;
55
- this.logger = dexHelper.getLogger(dexKey);
56
- this.vaultInterface = new abi_1.Interface(inception_vault_json_1.default);
57
- this.poolInterface = new abi_1.Interface(inception_ineth_pool_json_1.default);
58
- this.eventPool = new inception_event_pool_1.InceptionEventPool(dexKey, network, dexHelper, this.logger, config_1.InceptionPricePoolConfig[dexKey][network].ratioFeed, this.poolInterface);
59
- }
60
- async initializePricing(blockNumber) {
61
- const poolState = await (0, utils_2.getOnChainState)(this.dexHelper.multiContract, this.vaultInterface, this.network, blockNumber);
62
- await this.eventPool.initialize(blockNumber, {
63
- state: poolState,
64
- });
65
- await this.initializeTokens();
66
- }
67
- async initializeTokens() {
68
- let tokenList = await (0, utils_2.getTokenList)(this.network);
69
- (0, tokens_1.setTokensOnNetwork)(this.network, tokenList);
70
- }
71
- getAdapters(side) {
72
- return null;
73
- }
74
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
75
- return [
76
- this.dexKey +
77
- '-' +
78
- [srcToken.address.toLowerCase(), destToken.address.toLowerCase()]
79
- .sort((a, b) => (a > b ? 1 : -1))
80
- .join('_'),
81
- ];
82
- }
83
- async getPoolState(pool, blockNumber) {
84
- const eventState = pool.getState(blockNumber);
85
- if (eventState)
86
- return eventState;
87
- const onChainState = await pool.generateState(blockNumber);
88
- pool.setState(onChainState, blockNumber);
89
- return onChainState;
90
- }
91
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools, transferFees = {
92
- srcFee: 0,
93
- destFee: 0,
94
- srcDexFee: 0,
95
- destDexFee: 0,
96
- }) {
97
- if (side === core_1.SwapSide.BUY) {
98
- return null;
99
- }
100
- const src = (0, tokens_1.getTokenFromAddress)(this.network, srcToken.address);
101
- const dest = (0, tokens_1.getTokenFromAddress)(this.network, destToken.address);
102
- if (!src || !dest || src !== dest) {
103
- return null;
104
- }
105
- // TODO: Implement in both directions
106
- // only baseToken -> inception token swaps are supported
107
- if (src.baseToken.toLowerCase() !== srcToken.address.toLowerCase()) {
108
- return null;
109
- }
110
- const poolState = await this.getPoolState(this.eventPool, blockNumber);
111
- if (!poolState)
112
- return null;
113
- const unitPrice = DECIMALS;
114
- const prices = amounts.map(amount => {
115
- const ratio = poolState[src.symbol.toLowerCase()].ratio;
116
- return (ratio * amount) / DECIMALS;
117
- });
118
- const [unitPriceWithFee, ...pricesWithFee] = (0, token_transfer_fee_1.applyTransferFee)([unitPrice, ...prices], side, side === core_1.SwapSide.SELL ? transferFees.srcFee : transferFees.destFee, side === core_1.SwapSide.SELL
119
- ? constants_1.SRC_TOKEN_PARASWAP_TRANSFERS
120
- : constants_1.DEST_TOKEN_PARASWAP_TRANSFERS);
121
- return [
122
- {
123
- prices: pricesWithFee,
124
- unit: unitPriceWithFee,
125
- gasCost: 120000,
126
- exchange: this.dexKey,
127
- data: {
128
- exchange: dest.vault,
129
- },
130
- poolAddresses: [dest.vault],
131
- },
132
- ];
133
- }
134
- getCalldataGasCost(poolPrices) {
135
- return CALLDATA_GAS_COST.DEX_OVERHEAD + CALLDATA_GAS_COST.LENGTH_SMALL;
136
- }
137
- getAdapterParam() {
138
- return {
139
- targetExchange: constants_1.NULL_ADDRESS,
140
- payload: '0x',
141
- networkFee: '0',
142
- };
143
- }
144
- getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
145
- const dexParams = (0, tokens_1.getTokenFromAddress)(this.network, srcToken);
146
- if (!dexParams) {
147
- throw new Error('Unknown token');
148
- }
149
- const isNative = dexParams.baseTokenSlug === 'ETH';
150
- let swapData;
151
- let dexFuncHasRecipient;
152
- let swappedAmountNotPresentInExchangeData;
153
- let returnAmountPos = undefined;
154
- if (isNative) {
155
- swapData = this.poolInterface.encodeFunctionData('stake()', []);
156
- dexFuncHasRecipient = false;
157
- swappedAmountNotPresentInExchangeData = true;
158
- }
159
- else {
160
- swapData = this.vaultInterface.encodeFunctionData('deposit', [
161
- srcAmount,
162
- recipient,
163
- ]);
164
- dexFuncHasRecipient = true;
165
- swappedAmountNotPresentInExchangeData = false;
166
- returnAmountPos = constants_2.RETURN_AMOUNT_POS_0;
167
- }
168
- return {
169
- needWrapNative: false,
170
- dexFuncHasRecipient,
171
- exchangeData: swapData,
172
- targetExchange: dexParams.vault,
173
- swappedAmountNotPresentInExchangeData,
174
- returnAmountPos,
175
- };
176
- }
177
- async updatePoolState() { }
178
- async getTopPoolsForToken(tokenAddress, limit) {
179
- await this.initializeTokens();
180
- const token = (0, tokens_1.getTokenFromAddress)(this.network, tokenAddress);
181
- if (token) {
182
- return [
183
- {
184
- liquidityUSD: 1e9,
185
- exchange: this.dexKey,
186
- address: token.vault,
187
- connectorTokens: [
188
- {
189
- address: tokenAddress.toLowerCase() === token.token.toLowerCase()
190
- ? token.baseToken
191
- : token.token,
192
- decimals: 1e18,
193
- },
194
- ],
195
- },
196
- ];
197
- }
198
- return [];
199
- }
200
- releaseResources() { }
201
- }
202
- exports.Inception = Inception;
203
- Inception.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.InceptionConfig);
204
- //# sourceMappingURL=inception.js.map