@paraswap/dex-lib 4.7.27-1 → 4.7.27-ekubo-v3.1

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 (341) hide show
  1. package/build/abi/PendleRouterStatic.json +19 -0
  2. package/build/abi/apex-defi/ApexDefiFactory.abi.json +1749 -0
  3. package/build/abi/apex-defi/ApexDefiRouter.abi.json +1120 -0
  4. package/build/abi/apex-defi/ApexDefiToken.abi.json +229 -0
  5. package/build/abi/apex-defi/ApexDefiWrapper.abi.json +92 -0
  6. package/build/abi/apex-defi/ApexDefiWrapperFactory.abi.json +1107 -0
  7. package/build/abi/ekubo-v3/core.json +797 -0
  8. package/build/abi/ekubo-v3/mev-capture-router.json +936 -0
  9. package/build/abi/ekubo-v3/quote-data-fetcher.json +161 -0
  10. package/build/abi/ekubo-v3/twamm-data-fetcher.json +216 -0
  11. package/build/abi/ekubo-v3/twamm.json +613 -0
  12. package/build/abi/idle-dao/idle-cdo-factory.json +38 -0
  13. package/build/abi/idle-dao/idle-cdo.json +1245 -0
  14. package/build/abi/infusion/InfusionFactory.json +147 -0
  15. package/build/abi/infusion/InfusionPair.json +658 -0
  16. package/build/abi/infusion/InfusionRouter.json +442 -0
  17. package/build/abi/maker-psm/pot.json +322 -0
  18. package/build/abi/maker-psm/psm.json +243 -0
  19. package/build/abi/maker-psm/vat.json +363 -0
  20. package/build/abi/nomiswap-v2/nomiswap-v2-pool.json +773 -0
  21. package/build/abi/pangolin-v3/PangolinV3StateMulticall.abi.json +796 -0
  22. package/build/abi/pendle/pendle-deployer.abi.json +520 -0
  23. package/build/abi/pendle/pendle-oracle.abi.json +413 -0
  24. package/build/abi/quick-perps/fast-price-events.json +70 -0
  25. package/build/abi/quick-perps/fast-price-feed.json +741 -0
  26. package/build/abi/quick-perps/reader.json +313 -0
  27. package/build/abi/quick-perps/vault-price-feed.json +323 -0
  28. package/build/abi/quick-perps/vault.json +1953 -0
  29. package/build/abi/ring-v2/few-wrapped-token.json +587 -0
  30. package/build/abi/ring-v2/ring-v2-factory.json +125 -0
  31. package/build/abi/ring-v2/ring-v2-pool.json +461 -0
  32. package/build/abi/ring-v2/ring-v2-router.json +332 -0
  33. package/build/abi/stabull/stabull-curve.json +738 -0
  34. package/build/abi/stabull/stabull-router.json +76 -0
  35. package/build/abi/uniswap-v2/excalibur-pool.json +881 -0
  36. package/build/abi/uniswap-v2/mdex-factory.json +759 -0
  37. package/build/abi/uniswap-v4/hooks/SpotDynamicFeeManager.json +26 -0
  38. package/build/abi/uniswap-v4/hooks/SpotHook.json +54 -0
  39. package/build/abi/uniswap-v4/hooks/SpotPolicyManager.json +45 -0
  40. package/build/abi/uniswap-v4/hooks/cabalcoin-hook.abi.json +682 -0
  41. package/build/abi/uniswap-v4/hooks/fee-hook.abi.json +1335 -0
  42. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.d.ts +29 -0
  43. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.js +153 -0
  44. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.js.map +1 -0
  45. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.d.ts +40 -0
  46. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js +323 -0
  47. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js.map +1 -0
  48. package/build/dex/aave-pt-to-underlying/config.d.ts +3 -0
  49. package/build/dex/aave-pt-to-underlying/config.js +24 -0
  50. package/build/dex/aave-pt-to-underlying/config.js.map +1 -0
  51. package/build/dex/aave-pt-to-underlying/constants.d.ts +2 -0
  52. package/build/dex/aave-pt-to-underlying/constants.js +6 -0
  53. package/build/dex/aave-pt-to-underlying/constants.js.map +1 -0
  54. package/build/dex/aave-pt-to-underlying/types.d.ts +24 -0
  55. package/build/dex/aave-pt-to-underlying/types.js +3 -0
  56. package/build/dex/aave-pt-to-underlying/types.js.map +1 -0
  57. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.d.ts +39 -0
  58. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js +244 -0
  59. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js.map +1 -0
  60. package/build/dex/aave-pt-to-usdc/config.d.ts +3 -0
  61. package/build/dex/aave-pt-to-usdc/config.js +47 -0
  62. package/build/dex/aave-pt-to-usdc/config.js.map +1 -0
  63. package/build/dex/aave-pt-to-usdc/constants.d.ts +2 -0
  64. package/build/dex/aave-pt-to-usdc/constants.js +6 -0
  65. package/build/dex/aave-pt-to-usdc/constants.js.map +1 -0
  66. package/build/dex/aave-pt-to-usdc/types.d.ts +22 -0
  67. package/build/dex/aave-pt-to-usdc/types.js +3 -0
  68. package/build/dex/aave-pt-to-usdc/types.js.map +1 -0
  69. package/build/dex/algebra-integral/algebra-integral-factory.d.ts +1 -3
  70. package/build/dex/algebra-integral/algebra-integral-factory.js +1 -59
  71. package/build/dex/algebra-integral/algebra-integral-factory.js.map +1 -1
  72. package/build/dex/algebra-integral/algebra-integral.d.ts +0 -3
  73. package/build/dex/algebra-integral/algebra-integral.js +4 -112
  74. package/build/dex/algebra-integral/algebra-integral.js.map +1 -1
  75. package/build/dex/algebra-integral/constants.d.ts +0 -2
  76. package/build/dex/algebra-integral/constants.js +1 -5
  77. package/build/dex/algebra-integral/constants.js.map +1 -1
  78. package/build/dex/apex-defi/apex-defi-factory.d.ts +26 -0
  79. package/build/dex/apex-defi/apex-defi-factory.js +53 -0
  80. package/build/dex/apex-defi/apex-defi-factory.js.map +1 -0
  81. package/build/dex/apex-defi/apex-defi-pool.d.ts +55 -0
  82. package/build/dex/apex-defi/apex-defi-pool.js +247 -0
  83. package/build/dex/apex-defi/apex-defi-pool.js.map +1 -0
  84. package/build/dex/apex-defi/apex-defi-wrapper-factory.d.ts +57 -0
  85. package/build/dex/apex-defi/apex-defi-wrapper-factory.js +250 -0
  86. package/build/dex/apex-defi/apex-defi-wrapper-factory.js.map +1 -0
  87. package/build/dex/apex-defi/apex-defi.d.ts +97 -0
  88. package/build/dex/apex-defi/apex-defi.js +1021 -0
  89. package/build/dex/apex-defi/apex-defi.js.map +1 -0
  90. package/build/dex/apex-defi/config.d.ts +4 -0
  91. package/build/dex/apex-defi/config.js +138 -0
  92. package/build/dex/apex-defi/config.js.map +1 -0
  93. package/build/dex/apex-defi/types.d.ts +32 -0
  94. package/build/dex/apex-defi/types.js +3 -0
  95. package/build/dex/apex-defi/types.js.map +1 -0
  96. package/build/dex/apex-defi/utils.d.ts +46 -0
  97. package/build/dex/apex-defi/utils.js +133 -0
  98. package/build/dex/apex-defi/utils.js.map +1 -0
  99. package/build/dex/ekubo/pools/base-pool.d.ts +47 -0
  100. package/build/dex/ekubo/pools/base-pool.js +184 -0
  101. package/build/dex/ekubo/pools/base-pool.js.map +1 -0
  102. package/build/dex/ekubo/pools/iface.d.ts +46 -0
  103. package/build/dex/ekubo/pools/iface.js +75 -0
  104. package/build/dex/ekubo/pools/iface.js.map +1 -0
  105. package/build/dex/ekubo/pools/math/price.d.ts +7 -0
  106. package/build/dex/ekubo/pools/math/price.js +112 -0
  107. package/build/dex/ekubo/pools/math/price.js.map +1 -0
  108. package/build/dex/ekubo/pools/oracle-pool.d.ts +10 -0
  109. package/build/dex/ekubo/pools/oracle-pool.js +19 -0
  110. package/build/dex/ekubo/pools/oracle-pool.js.map +1 -0
  111. package/build/dex/ekubo/pools/pool-utils.d.ts +44 -0
  112. package/build/dex/ekubo/pools/pool-utils.js +240 -0
  113. package/build/dex/ekubo/pools/pool-utils.js.map +1 -0
  114. package/build/dex/ekubo-v3/config.d.ts +13 -0
  115. package/build/dex/ekubo-v3/config.js +23 -0
  116. package/build/dex/ekubo-v3/config.js.map +1 -0
  117. package/build/dex/ekubo-v3/ekubo-v3-pool-manager.d.ts +34 -0
  118. package/build/dex/ekubo-v3/ekubo-v3-pool-manager.js +421 -0
  119. package/build/dex/ekubo-v3/ekubo-v3-pool-manager.js.map +1 -0
  120. package/build/dex/ekubo-v3/ekubo-v3.d.ts +38 -0
  121. package/build/dex/ekubo-v3/ekubo-v3.js +315 -0
  122. package/build/dex/ekubo-v3/ekubo-v3.js.map +1 -0
  123. package/build/dex/ekubo-v3/pools/base.d.ts +42 -0
  124. package/build/dex/ekubo-v3/pools/base.js +307 -0
  125. package/build/dex/ekubo-v3/pools/base.js.map +1 -0
  126. package/build/dex/ekubo-v3/pools/full-range.d.ts +25 -0
  127. package/build/dex/ekubo-v3/pools/full-range.js +105 -0
  128. package/build/dex/ekubo-v3/pools/full-range.js.map +1 -0
  129. package/build/dex/ekubo-v3/pools/math/constants.d.ts +12 -0
  130. package/build/dex/ekubo-v3/pools/math/constants.js +16 -0
  131. package/build/dex/ekubo-v3/pools/math/constants.js.map +1 -0
  132. package/build/dex/ekubo-v3/pools/math/delta.d.ts +2 -0
  133. package/build/dex/ekubo-v3/pools/math/delta.js +51 -0
  134. package/build/dex/ekubo-v3/pools/math/delta.js.map +1 -0
  135. package/build/dex/ekubo-v3/pools/math/sqrt-ratio.d.ts +8 -0
  136. package/build/dex/ekubo-v3/pools/math/sqrt-ratio.js +113 -0
  137. package/build/dex/ekubo-v3/pools/math/sqrt-ratio.js.map +1 -0
  138. package/build/dex/ekubo-v3/pools/math/swap.d.ts +18 -0
  139. package/build/dex/ekubo-v3/pools/math/swap.js +128 -0
  140. package/build/dex/ekubo-v3/pools/math/swap.js.map +1 -0
  141. package/build/dex/ekubo-v3/pools/math/tick.d.ts +8 -0
  142. package/build/dex/ekubo-v3/pools/math/tick.js +129 -0
  143. package/build/dex/ekubo-v3/pools/math/tick.js.map +1 -0
  144. package/build/dex/ekubo-v3/pools/math/twamm/exp2.d.ts +1 -0
  145. package/build/dex/ekubo-v3/pools/math/twamm/exp2.js +86 -0
  146. package/build/dex/ekubo-v3/pools/math/twamm/exp2.js.map +1 -0
  147. package/build/dex/ekubo-v3/pools/math/twamm/sqrt-ratio.d.ts +1 -0
  148. package/build/dex/ekubo-v3/pools/math/twamm/sqrt-ratio.js +56 -0
  149. package/build/dex/ekubo-v3/pools/math/twamm/sqrt-ratio.js.map +1 -0
  150. package/build/dex/ekubo-v3/pools/mev-capture.d.ts +8 -0
  151. package/build/dex/ekubo-v3/pools/mev-capture.js +42 -0
  152. package/build/dex/ekubo-v3/pools/mev-capture.js.map +1 -0
  153. package/build/dex/ekubo-v3/pools/oracle.d.ts +8 -0
  154. package/build/dex/ekubo-v3/pools/oracle.js +18 -0
  155. package/build/dex/ekubo-v3/pools/oracle.js.map +1 -0
  156. package/build/dex/ekubo-v3/pools/pool.d.ts +56 -0
  157. package/build/dex/ekubo-v3/pools/pool.js +88 -0
  158. package/build/dex/ekubo-v3/pools/pool.js.map +1 -0
  159. package/build/dex/ekubo-v3/pools/stableswap.d.ts +22 -0
  160. package/build/dex/ekubo-v3/pools/stableswap.js +123 -0
  161. package/build/dex/ekubo-v3/pools/stableswap.js.map +1 -0
  162. package/build/dex/ekubo-v3/pools/twamm.d.ts +40 -0
  163. package/build/dex/ekubo-v3/pools/twamm.js +265 -0
  164. package/build/dex/ekubo-v3/pools/twamm.js.map +1 -0
  165. package/build/dex/ekubo-v3/pools/utils.d.ts +62 -0
  166. package/build/dex/ekubo-v3/pools/utils.js +160 -0
  167. package/build/dex/ekubo-v3/pools/utils.js.map +1 -0
  168. package/build/dex/ekubo-v3/types.d.ts +58 -0
  169. package/build/dex/ekubo-v3/types.js +3 -0
  170. package/build/dex/ekubo-v3/types.js.map +1 -0
  171. package/build/dex/ekubo-v3/utils.d.ts +10 -0
  172. package/build/dex/ekubo-v3/utils.js +54 -0
  173. package/build/dex/ekubo-v3/utils.js.map +1 -0
  174. package/build/dex/idle-dao/config.d.ts +5 -0
  175. package/build/dex/idle-dao/config.js +24 -0
  176. package/build/dex/idle-dao/config.js.map +1 -0
  177. package/build/dex/idle-dao/idle-dao.d.ts +42 -0
  178. package/build/dex/idle-dao/idle-dao.js +279 -0
  179. package/build/dex/idle-dao/idle-dao.js.map +1 -0
  180. package/build/dex/idle-dao/token_list.d.ts +4 -0
  181. package/build/dex/idle-dao/token_list.js +289 -0
  182. package/build/dex/idle-dao/token_list.js.map +1 -0
  183. package/build/dex/idle-dao/tokens.d.ts +9 -0
  184. package/build/dex/idle-dao/tokens.js +68 -0
  185. package/build/dex/idle-dao/tokens.js.map +1 -0
  186. package/build/dex/idle-dao/types.d.ts +35 -0
  187. package/build/dex/idle-dao/types.js +11 -0
  188. package/build/dex/idle-dao/types.js.map +1 -0
  189. package/build/dex/idle-dao/utils.d.ts +8 -0
  190. package/build/dex/idle-dao/utils.js +149 -0
  191. package/build/dex/idle-dao/utils.js.map +1 -0
  192. package/build/dex/index.js +2 -0
  193. package/build/dex/index.js.map +1 -1
  194. package/build/dex/infusion/config.d.ts +3 -0
  195. package/build/dex/infusion/config.js +20 -0
  196. package/build/dex/infusion/config.js.map +1 -0
  197. package/build/dex/infusion/infusion-stable-pool.d.ts +4 -0
  198. package/build/dex/infusion/infusion-stable-pool.js +74 -0
  199. package/build/dex/infusion/infusion-stable-pool.js.map +1 -0
  200. package/build/dex/infusion/infusion.d.ts +51 -0
  201. package/build/dex/infusion/infusion.js +461 -0
  202. package/build/dex/infusion/infusion.js.map +1 -0
  203. package/build/dex/infusion/types.d.ts +45 -0
  204. package/build/dex/infusion/types.js +3 -0
  205. package/build/dex/infusion/types.js.map +1 -0
  206. package/build/dex/infusion/utils/isStablePair.d.ts +2 -0
  207. package/build/dex/infusion/utils/isStablePair.js +18 -0
  208. package/build/dex/infusion/utils/isStablePair.js.map +1 -0
  209. package/build/dex/maker-psm/config.d.ts +11 -0
  210. package/build/dex/maker-psm/config.js +53 -0
  211. package/build/dex/maker-psm/config.js.map +1 -0
  212. package/build/dex/maker-psm/maker-psm-event-pool.d.ts +43 -0
  213. package/build/dex/maker-psm/maker-psm-event-pool.js +132 -0
  214. package/build/dex/maker-psm/maker-psm-event-pool.js.map +1 -0
  215. package/build/dex/maker-psm/maker-psm.d.ts +103 -0
  216. package/build/dex/maker-psm/maker-psm.js +493 -0
  217. package/build/dex/maker-psm/maker-psm.js.map +1 -0
  218. package/build/dex/maker-psm/types.d.ts +39 -0
  219. package/build/dex/maker-psm/types.js +3 -0
  220. package/build/dex/maker-psm/types.js.map +1 -0
  221. package/build/dex/miro-migrator/miro-migrator-state.d.ts +27 -0
  222. package/build/dex/miro-migrator/miro-migrator-state.js +89 -0
  223. package/build/dex/miro-migrator/miro-migrator-state.js.map +1 -0
  224. package/build/dex/quick-perps/config.d.ts +11 -0
  225. package/build/dex/quick-perps/config.js +27 -0
  226. package/build/dex/quick-perps/config.js.map +1 -0
  227. package/build/dex/quick-perps/fast-price-feed.d.ts +26 -0
  228. package/build/dex/quick-perps/fast-price-feed.js +184 -0
  229. package/build/dex/quick-perps/fast-price-feed.js.map +1 -0
  230. package/build/dex/quick-perps/pool.d.ts +21 -0
  231. package/build/dex/quick-perps/pool.js +229 -0
  232. package/build/dex/quick-perps/pool.js.map +1 -0
  233. package/build/dex/quick-perps/quick-perps.d.ts +53 -0
  234. package/build/dex/quick-perps/quick-perps.js +247 -0
  235. package/build/dex/quick-perps/quick-perps.js.map +1 -0
  236. package/build/dex/quick-perps/types.d.ts +98 -0
  237. package/build/dex/quick-perps/types.js +3 -0
  238. package/build/dex/quick-perps/types.js.map +1 -0
  239. package/build/dex/quick-perps/usdq.d.ts +15 -0
  240. package/build/dex/quick-perps/usdq.js +62 -0
  241. package/build/dex/quick-perps/usdq.js.map +1 -0
  242. package/build/dex/quick-perps/vault-price-feed.d.ts +43 -0
  243. package/build/dex/quick-perps/vault-price-feed.js +203 -0
  244. package/build/dex/quick-perps/vault-price-feed.js.map +1 -0
  245. package/build/dex/quick-perps/vault-utils.d.ts +8 -0
  246. package/build/dex/quick-perps/vault-utils.js +42 -0
  247. package/build/dex/quick-perps/vault-utils.js.map +1 -0
  248. package/build/dex/quick-perps/vault.d.ts +46 -0
  249. package/build/dex/quick-perps/vault.js +182 -0
  250. package/build/dex/quick-perps/vault.js.map +1 -0
  251. package/build/dex/solidly/forks-override/aerodrome.d.ts +14 -0
  252. package/build/dex/solidly/forks-override/aerodrome.js +50 -0
  253. package/build/dex/solidly/forks-override/aerodrome.js.map +1 -0
  254. package/build/dex/solidly/forks-override/chronos.d.ts +23 -0
  255. package/build/dex/solidly/forks-override/chronos.js +141 -0
  256. package/build/dex/solidly/forks-override/chronos.js.map +1 -0
  257. package/build/dex/solidly/forks-override/usdfi.d.ts +8 -0
  258. package/build/dex/solidly/forks-override/usdfi.js +15 -0
  259. package/build/dex/solidly/forks-override/usdfi.js.map +1 -0
  260. package/build/dex/solidly/forks-override/velocimeter.d.ts +23 -0
  261. package/build/dex/solidly/forks-override/velocimeter.js +77 -0
  262. package/build/dex/solidly/forks-override/velocimeter.js.map +1 -0
  263. package/build/dex/stabull/config.d.ts +3 -0
  264. package/build/dex/stabull/config.js +177 -0
  265. package/build/dex/stabull/config.js.map +1 -0
  266. package/build/dex/stabull/stabull-pool.d.ts +46 -0
  267. package/build/dex/stabull/stabull-pool.js +113 -0
  268. package/build/dex/stabull/stabull-pool.js.map +1 -0
  269. package/build/dex/stabull/stabull.d.ts +55 -0
  270. package/build/dex/stabull/stabull.js +286 -0
  271. package/build/dex/stabull/stabull.js.map +1 -0
  272. package/build/dex/stabull/types.d.ts +21 -0
  273. package/build/dex/stabull/types.js +3 -0
  274. package/build/dex/stabull/types.js.map +1 -0
  275. package/build/dex/uniswap-v2/dfyn.d.ts +19 -0
  276. package/build/dex/uniswap-v2/dfyn.js +61 -0
  277. package/build/dex/uniswap-v2/dfyn.js.map +1 -0
  278. package/build/dex/uniswap-v2/excalibur.d.ts +24 -0
  279. package/build/dex/uniswap-v2/excalibur.js +47 -0
  280. package/build/dex/uniswap-v2/excalibur.js.map +1 -0
  281. package/build/dex/uniswap-v2/mdex.d.ts +24 -0
  282. package/build/dex/uniswap-v2/mdex.js +50 -0
  283. package/build/dex/uniswap-v2/mdex.js.map +1 -0
  284. package/build/dex/uniswap-v2/nomiswap-v2.d.ts +24 -0
  285. package/build/dex/uniswap-v2/nomiswap-v2.js +57 -0
  286. package/build/dex/uniswap-v2/nomiswap-v2.js.map +1 -0
  287. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.d.ts +4 -0
  288. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js +56 -0
  289. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js.map +1 -0
  290. package/build/dex/uniswap-v4/contract-math/Position.d.ts +9 -0
  291. package/build/dex/uniswap-v4/contract-math/Position.js +39 -0
  292. package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -0
  293. package/build/dex/uniswap-v4/hooks/arena.d.ts +6 -0
  294. package/build/dex/uniswap-v4/hooks/arena.js +10 -0
  295. package/build/dex/uniswap-v4/hooks/arena.js.map +1 -0
  296. package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.d.ts +0 -0
  297. package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.js +2 -0
  298. package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.js.map +1 -0
  299. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.d.ts +7 -0
  300. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js +28 -0
  301. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js.map +1 -0
  302. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.d.ts +0 -0
  303. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js +2 -0
  304. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js.map +1 -0
  305. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.d.ts +7 -0
  306. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js +28 -0
  307. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js.map +1 -0
  308. package/build/dex/uniswap-v4/hooks/fee-hook/types.d.ts +0 -0
  309. package/build/dex/uniswap-v4/hooks/fee-hook/types.js +2 -0
  310. package/build/dex/uniswap-v4/hooks/fee-hook/types.js.map +1 -0
  311. package/build/dex/uniswap-v4/hooks/index.d.ts +1 -0
  312. package/build/dex/uniswap-v4/hooks/index.js +18 -0
  313. package/build/dex/uniswap-v4/hooks/index.js.map +1 -0
  314. package/build/dex/uniswap-v4/hooks/spot.d.ts +15 -0
  315. package/build/dex/uniswap-v4/hooks/spot.js +109 -0
  316. package/build/dex/uniswap-v4/hooks/spot.js.map +1 -0
  317. package/build/dex/uniswap-v4/hooks/template.d.ts +150 -0
  318. package/build/dex/uniswap-v4/hooks/template.js +104 -0
  319. package/build/dex/uniswap-v4/hooks/template.js.map +1 -0
  320. package/build/dex/usdc-transmuter/usdc-transmuter-pool.d.ts +26 -0
  321. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js +75 -0
  322. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js.map +1 -0
  323. package/build/dex/usual/usual-usdc-usdc.d.ts +17 -0
  324. package/build/dex/usual/usual-usdc-usdc.js +59 -0
  325. package/build/dex/usual/usual-usdc-usdc.js.map +1 -0
  326. package/build/dex/yo/config.d.ts +3 -0
  327. package/build/dex/yo/config.js +21 -0
  328. package/build/dex/yo/config.js.map +1 -0
  329. package/build/dex/yo/types.d.ts +13 -0
  330. package/build/dex/yo/types.js +3 -0
  331. package/build/dex/yo/types.js.map +1 -0
  332. package/build/dex/yo/yo-pool.d.ts +13 -0
  333. package/build/dex/yo/yo-pool.js +26 -0
  334. package/build/dex/yo/yo-pool.js.map +1 -0
  335. package/build/dex/yo/yo.d.ts +39 -0
  336. package/build/dex/yo/yo.js +248 -0
  337. package/build/dex/yo/yo.js.map +1 -0
  338. package/build/implementations/api-paraswap-sdk.d.ts +25 -0
  339. package/build/implementations/api-paraswap-sdk.js +102 -0
  340. package/build/implementations/api-paraswap-sdk.js.map +1 -0
  341. package/package.json +3 -3
@@ -0,0 +1,57 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { DeepReadonly } from 'ts-essentials';
3
+ import { IDexHelper } from '../../dex-helper/idex-helper';
4
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
+ import { Address, Log, Logger } from '../../types';
6
+ import { LogDescription } from 'ethers/lib/utils';
7
+ export interface WrapperInfo {
8
+ wrapperAddress: Address;
9
+ originalToken: Address;
10
+ wrappedToken: Address;
11
+ originalTokenDecimals: number;
12
+ wrappedTokenDecimals: number;
13
+ }
14
+ export type WrapperFactoryState = Record<Address, WrapperInfo>;
15
+ export type OnWrapperCreatedCallback = ({ wrapperInfo, blockNumber, }: {
16
+ wrapperInfo: WrapperInfo;
17
+ blockNumber: number;
18
+ }) => Promise<void>;
19
+ export declare class ApexDefiWrapperFactory extends StatefulEventSubscriber<WrapperFactoryState> {
20
+ readonly dexHelper: IDexHelper;
21
+ protected readonly wrapperFactoryAddress: Address;
22
+ protected readonly onWrapperCreated: OnWrapperCreatedCallback;
23
+ handlers: {
24
+ [event: string]: (event: any, log: Readonly<Log>) => Promise<void>;
25
+ };
26
+ logDecoder: (log: Log) => any;
27
+ readonly wrapperFactoryIface: Interface;
28
+ readonly wrapperIface: Interface;
29
+ private wrapperCache;
30
+ private originalTokenToWrapper;
31
+ private wrappedTokenToWrapper;
32
+ constructor(dexHelper: IDexHelper, parentName: string, wrapperFactoryAddress: Address, logger: Logger, onWrapperCreated: OnWrapperCreatedCallback);
33
+ generateState(): WrapperFactoryState;
34
+ protected processLog(_: DeepReadonly<WrapperFactoryState>, log: Readonly<Log>): Promise<WrapperFactoryState>;
35
+ handleWrapperCreated(event: LogDescription, log: Readonly<Log>): Promise<void>;
36
+ private fetchWrapperInfo;
37
+ initialize(blockNumber: number): Promise<void>;
38
+ getWrapperInfo(wrapperAddress: Address): WrapperInfo | undefined;
39
+ getWrapperByOriginalToken(originalToken: Address): Address | undefined;
40
+ getWrapperByWrappedToken(wrappedToken: Address): Address | undefined;
41
+ isWrappedToken(tokenAddress: Address): boolean;
42
+ isOriginalToken(tokenAddress: Address): boolean;
43
+ getAllWrappers(): WrapperInfo[];
44
+ /**
45
+ * Check if two tokens form a wrapper pair and return wrapper info
46
+ */
47
+ getWrapperPairInfo(srcToken: Address, destToken: Address): {
48
+ wrapperAddress: Address;
49
+ isWrap: boolean;
50
+ wrapperInfo: WrapperInfo;
51
+ } | null;
52
+ /**
53
+ * Check if two tokens form a wrapper operation
54
+ */
55
+ isWrapperOperation(srcToken: Address, destToken: Address): boolean;
56
+ releaseResources(): void;
57
+ }
@@ -0,0 +1,250 @@
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.ApexDefiWrapperFactory = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const ApexDefiWrapperFactory_abi_json_1 = __importDefault(require("../../abi/apex-defi/ApexDefiWrapperFactory.abi.json"));
9
+ const ApexDefiWrapper_abi_json_1 = __importDefault(require("../../abi/apex-defi/ApexDefiWrapper.abi.json"));
10
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
11
+ /*
12
+ * Event subscriber to capture "WrapperCreated" events on new wrappers created.
13
+ * Maintains a cache of all wrapper information for quick lookups.
14
+ */
15
+ class ApexDefiWrapperFactory extends stateful_event_subscriber_1.StatefulEventSubscriber {
16
+ dexHelper;
17
+ wrapperFactoryAddress;
18
+ onWrapperCreated;
19
+ handlers = {};
20
+ logDecoder;
21
+ wrapperFactoryIface = new abi_1.Interface(ApexDefiWrapperFactory_abi_json_1.default);
22
+ wrapperIface = new abi_1.Interface(ApexDefiWrapper_abi_json_1.default);
23
+ // Cache for quick lookups
24
+ wrapperCache = new Map();
25
+ originalTokenToWrapper = new Map();
26
+ wrappedTokenToWrapper = new Map();
27
+ constructor(dexHelper, parentName, wrapperFactoryAddress, logger, onWrapperCreated) {
28
+ super(parentName, `${parentName} WrapperFactory`, dexHelper, logger);
29
+ this.dexHelper = dexHelper;
30
+ this.wrapperFactoryAddress = wrapperFactoryAddress;
31
+ this.onWrapperCreated = onWrapperCreated;
32
+ this.addressesSubscribed = [wrapperFactoryAddress];
33
+ this.logDecoder = (log) => this.wrapperFactoryIface.parseLog(log);
34
+ this.handlers['WrapperCreated'] = this.handleWrapperCreated.bind(this);
35
+ }
36
+ generateState() {
37
+ return {};
38
+ }
39
+ async processLog(_, log) {
40
+ const event = this.logDecoder(log);
41
+ if (event.name in this.handlers) {
42
+ await this.handlers[event.name](event, log);
43
+ }
44
+ return {};
45
+ }
46
+ async handleWrapperCreated(event, log) {
47
+ const { originalToken, wrappedToken, wrapperContract } = event.args;
48
+ // Fetch wrapper details
49
+ const wrapperInfo = await this.fetchWrapperInfo(wrapperContract.toLowerCase(), originalToken.toLowerCase(), wrappedToken.toLowerCase());
50
+ if (wrapperInfo) {
51
+ // Update caches
52
+ // Fix case sensitivity issue in wrapper cache
53
+ // Add to cache - use lowercase for consistency
54
+ this.wrapperCache.set(wrapperInfo.wrapperAddress.toLowerCase(), wrapperInfo);
55
+ this.originalTokenToWrapper.set(wrapperInfo.originalToken, wrapperInfo.wrapperAddress.toLowerCase());
56
+ this.wrappedTokenToWrapper.set(wrapperInfo.wrappedToken, wrapperInfo.wrapperAddress.toLowerCase());
57
+ await this.onWrapperCreated({
58
+ wrapperInfo,
59
+ blockNumber: log.blockNumber,
60
+ });
61
+ }
62
+ }
63
+ async fetchWrapperInfo(wrapperAddress, originalToken, wrappedToken) {
64
+ try {
65
+ const blockNumber = await this.dexHelper.web3Provider.eth.getBlockNumber();
66
+ const result = await this.dexHelper.multiContract.methods
67
+ .aggregate([
68
+ {
69
+ target: wrapperAddress,
70
+ callData: this.wrapperIface.encodeFunctionData('originalTokenDecimals', []),
71
+ },
72
+ {
73
+ target: wrapperAddress,
74
+ callData: this.wrapperIface.encodeFunctionData('wrappedTokenDecimals', []),
75
+ },
76
+ ])
77
+ .call({}, blockNumber);
78
+ const [originalTokenDecimals, wrappedTokenDecimals] = result.returnData.map((data, index) => {
79
+ const decoded = this.wrapperIface.decodeFunctionResult(index === 0 ? 'originalTokenDecimals' : 'wrappedTokenDecimals', data);
80
+ return Number(decoded[0]);
81
+ });
82
+ return {
83
+ wrapperAddress,
84
+ originalToken,
85
+ wrappedToken,
86
+ originalTokenDecimals,
87
+ wrappedTokenDecimals,
88
+ };
89
+ }
90
+ catch (error) {
91
+ this.logger.error(`Error fetching wrapper info for ${wrapperAddress}:`, error);
92
+ return null;
93
+ }
94
+ }
95
+ // Initialize by fetching all existing wrappers
96
+ async initialize(blockNumber) {
97
+ try {
98
+ // Get all wrappers from factory
99
+ const result = await this.dexHelper.multiContract.methods
100
+ .aggregate([
101
+ {
102
+ target: this.wrapperFactoryAddress,
103
+ callData: this.wrapperFactoryIface.encodeFunctionData('getAllWrappers', []),
104
+ },
105
+ ])
106
+ .call({}, blockNumber);
107
+ const wrapperAddresses = this.wrapperFactoryIface.decodeFunctionResult('getAllWrappers', result.returnData[0])[0];
108
+ // Use tryAggregate for all wrapper info calls
109
+ const wrapperInfoCalls = wrapperAddresses
110
+ .map(wrapperAddress => [
111
+ {
112
+ target: wrapperAddress,
113
+ callData: this.wrapperIface.encodeFunctionData('originalToken', []),
114
+ },
115
+ {
116
+ target: wrapperAddress,
117
+ callData: this.wrapperIface.encodeFunctionData('wrappedToken', []),
118
+ },
119
+ {
120
+ target: wrapperAddress,
121
+ callData: this.wrapperIface.encodeFunctionData('originalTokenDecimals', []),
122
+ },
123
+ {
124
+ target: wrapperAddress,
125
+ callData: this.wrapperIface.encodeFunctionData('wrappedTokenDecimals', []),
126
+ },
127
+ ])
128
+ .flat();
129
+ const tokenResults = await this.dexHelper.multiContract.methods
130
+ .tryAggregate(false, wrapperInfoCalls)
131
+ .call({}, blockNumber);
132
+ // Process results in groups of 4 (originalToken, wrappedToken, originalDecimals, wrappedDecimals)
133
+ for (let i = 0; i < wrapperAddresses.length; i++) {
134
+ const wrapperAddress = wrapperAddresses[i];
135
+ const baseIndex = i * 4;
136
+ const [originalTokenSuccess, originalTokenData] = tokenResults[baseIndex];
137
+ const [wrappedTokenSuccess, wrappedTokenData] = tokenResults[baseIndex + 1];
138
+ const [originalDecimalsSuccess, originalDecimalsData] = tokenResults[baseIndex + 2];
139
+ const [wrappedDecimalsSuccess, wrappedDecimalsData] = tokenResults[baseIndex + 3];
140
+ // Check if basic token info succeeded
141
+ if (originalTokenSuccess && wrappedTokenSuccess) {
142
+ const originalToken = this.wrapperIface
143
+ .decodeFunctionResult('originalToken', originalTokenData)[0]
144
+ .toLowerCase();
145
+ const wrappedToken = this.wrapperIface
146
+ .decodeFunctionResult('wrappedToken', wrappedTokenData)[0]
147
+ .toLowerCase();
148
+ // Handle decimals - use fallback for older wrappers
149
+ let originalTokenDecimals;
150
+ let wrappedTokenDecimals;
151
+ if (originalDecimalsSuccess && wrappedDecimalsSuccess) {
152
+ // New wrapper with decimals functions
153
+ originalTokenDecimals = Number(this.wrapperIface.decodeFunctionResult('originalTokenDecimals', originalDecimalsData)[0]);
154
+ wrappedTokenDecimals = Number(this.wrapperIface.decodeFunctionResult('wrappedTokenDecimals', wrappedDecimalsData)[0]);
155
+ }
156
+ else {
157
+ // Fallback for older wrappers - assume standard decimals
158
+ originalTokenDecimals = 0; // Default for most ERC20
159
+ wrappedTokenDecimals = 18; // ERC314 always has 18 decimals
160
+ }
161
+ const wrapperInfo = {
162
+ wrapperAddress,
163
+ originalToken,
164
+ wrappedToken,
165
+ originalTokenDecimals,
166
+ wrappedTokenDecimals,
167
+ };
168
+ // Add to cache
169
+ this.wrapperCache.set(wrapperInfo.wrapperAddress.toLowerCase(), wrapperInfo);
170
+ this.originalTokenToWrapper.set(wrapperInfo.originalToken, wrapperInfo.wrapperAddress.toLowerCase());
171
+ this.wrappedTokenToWrapper.set(wrapperInfo.wrappedToken, wrapperInfo.wrapperAddress.toLowerCase());
172
+ }
173
+ }
174
+ }
175
+ catch (error) {
176
+ this.logger.error('Error initializing wrapper factory:', error);
177
+ }
178
+ }
179
+ // Quick lookup methods
180
+ getWrapperInfo(wrapperAddress) {
181
+ const result = this.wrapperCache.get(wrapperAddress.toLowerCase());
182
+ return result;
183
+ }
184
+ getWrapperByOriginalToken(originalToken) {
185
+ const result = this.originalTokenToWrapper.get(originalToken.toLowerCase());
186
+ return result;
187
+ }
188
+ getWrapperByWrappedToken(wrappedToken) {
189
+ return this.wrappedTokenToWrapper.get(wrappedToken.toLowerCase());
190
+ }
191
+ isWrappedToken(tokenAddress) {
192
+ return this.wrappedTokenToWrapper.has(tokenAddress.toLowerCase());
193
+ }
194
+ isOriginalToken(tokenAddress) {
195
+ return this.originalTokenToWrapper.has(tokenAddress.toLowerCase());
196
+ }
197
+ // Get all wrapper infos
198
+ getAllWrappers() {
199
+ return Array.from(this.wrapperCache.values());
200
+ }
201
+ // ✅ New helper methods for wrapper operations
202
+ /**
203
+ * Check if two tokens form a wrapper pair and return wrapper info
204
+ */
205
+ getWrapperPairInfo(srcToken, destToken) {
206
+ // Check if srcToken has a wrapper that matches destToken (wrap operation)
207
+ const srcWrapper = this.getWrapperByOriginalToken(srcToken);
208
+ if (srcWrapper) {
209
+ const wrapperInfo = this.getWrapperInfo(srcWrapper);
210
+ if (wrapperInfo &&
211
+ wrapperInfo.wrappedToken.toLowerCase() === destToken.toLowerCase()) {
212
+ return {
213
+ wrapperAddress: srcWrapper,
214
+ isWrap: true,
215
+ wrapperInfo,
216
+ };
217
+ }
218
+ }
219
+ // Check if destToken has a wrapper that matches srcToken (unwrap operation)
220
+ const destWrapper = this.getWrapperByOriginalToken(destToken);
221
+ if (destWrapper) {
222
+ const wrapperInfo = this.getWrapperInfo(destWrapper);
223
+ if (wrapperInfo &&
224
+ wrapperInfo.wrappedToken.toLowerCase() === srcToken.toLowerCase()) {
225
+ return {
226
+ wrapperAddress: destWrapper,
227
+ isWrap: false,
228
+ wrapperInfo,
229
+ };
230
+ }
231
+ }
232
+ return null;
233
+ }
234
+ /**
235
+ * Check if two tokens form a wrapper operation
236
+ */
237
+ isWrapperOperation(srcToken, destToken) {
238
+ return this.getWrapperPairInfo(srcToken, destToken) !== null;
239
+ }
240
+ // Release resources
241
+ releaseResources() {
242
+ this.wrapperCache.clear();
243
+ this.originalTokenToWrapper.clear();
244
+ this.wrappedTokenToWrapper.clear();
245
+ this.handlers = {};
246
+ this.addressesSubscribed = [];
247
+ }
248
+ }
249
+ exports.ApexDefiWrapperFactory = ApexDefiWrapperFactory;
250
+ //# sourceMappingURL=apex-defi-wrapper-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apex-defi-wrapper-factory.js","sourceRoot":"","sources":["../../../src/dex/apex-defi/apex-defi-wrapper-factory.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAE/C,0HAA4F;AAC5F,4GAA8E;AAE9E,+EAA0E;AAsB1E;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,mDAA4C;IAkB3E;IAEU;IAEA;IArBrB,QAAQ,GAEJ,EAAE,CAAC;IAEP,UAAU,CAAoB;IAEd,mBAAmB,GAAG,IAAI,eAAS,CACjD,yCAAyB,CAC1B,CAAC;IACc,YAAY,GAAG,IAAI,eAAS,CAAC,kCAAkB,CAAC,CAAC;IAEjE,0BAA0B;IAClB,YAAY,GAA8B,IAAI,GAAG,EAAE,CAAC;IACpD,sBAAsB,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC1D,qBAAqB,GAA0B,IAAI,GAAG,EAAE,CAAC;IAEjE,YACW,SAAqB,EAC9B,UAAkB,EACC,qBAA8B,EACjD,MAAc,EACK,gBAA0C;QAE7D,KAAK,CAAC,UAAU,EAAE,GAAG,UAAU,iBAAiB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAN5D,cAAS,GAAT,SAAS,CAAY;QAEX,0BAAqB,GAArB,qBAAqB,CAAS;QAE9B,qBAAgB,GAAhB,gBAAgB,CAA0B;QAI7D,IAAI,CAAC,mBAAmB,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAEnD,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,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C,SAAS,CAAC,CAAC;QAC9D,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YACrD,IACE,WAAW;gBACX,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,EACjE,CAAC;gBACD,OAAO;oBACL,cAAc,EAAE,WAAW;oBAC3B,MAAM,EAAE,KAAK;oBACb,WAAW;iBACZ,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,QAAiB,EAAE,SAAkB;QACtD,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,IAAI,CAAC;IAC/D,CAAC;IAED,oBAAoB;IACpB,gBAAgB;QACd,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAChC,CAAC;CACF;AAnWD,wDAmWC"}
@@ -0,0 +1,97 @@
1
+ import { AsyncOrSync } from 'ts-essentials';
2
+ import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger, NumberAsString, TxInfo, DexExchangeParam } from '../../types';
3
+ import { SwapSide, Network } from '../../constants';
4
+ import { IDex } from '../../dex/idex';
5
+ import { IDexHelper } from '../../dex-helper/idex-helper';
6
+ import { ApexDefiData } from './types';
7
+ import { SimpleExchange } from '../simple-exchange';
8
+ import { ApexDefiEventPool } from './apex-defi-pool';
9
+ import { Interface } from '@ethersproject/abi';
10
+ import { ApexDefiFactory, OnPoolCreatedCallback } from './apex-defi-factory';
11
+ import { ApexDefiWrapperFactory, OnWrapperCreatedCallback } from './apex-defi-wrapper-factory';
12
+ export declare class ApexDefi extends SimpleExchange implements IDex<ApexDefiData> {
13
+ readonly network: Network;
14
+ readonly dexKey: string;
15
+ readonly dexHelper: IDexHelper;
16
+ readonly eventPools: Record<string, ApexDefiEventPool | null>;
17
+ protected supportedTokensMap: {
18
+ [address: string]: Token;
19
+ };
20
+ protected readonly factory: ApexDefiFactory;
21
+ protected readonly wrapperFactory: ApexDefiWrapperFactory;
22
+ readonly routerIface: Interface;
23
+ readonly erc20Iface: Interface;
24
+ readonly tokenIface: Interface;
25
+ readonly factoryIface: Interface;
26
+ readonly wrapperFactoryIface: Interface;
27
+ readonly wrapperIface: Interface;
28
+ feeFactor: number;
29
+ readonly hasConstantPriceLargeAmounts = false;
30
+ readonly needWrapNative = false;
31
+ readonly isFeeOnTransferSupported = false;
32
+ static dexKeysWithNetwork: {
33
+ key: string;
34
+ networks: Network[];
35
+ }[];
36
+ logger: Logger;
37
+ constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
38
+ protected getFactoryInstance(): ApexDefiFactory;
39
+ protected getWrapperFactoryInstance(): ApexDefiWrapperFactory;
40
+ protected onPoolCreated(): OnPoolCreatedCallback;
41
+ protected onWrapperCreated(): OnWrapperCreatedCallback;
42
+ initializePricing(blockNumber: number): Promise<void>;
43
+ getAdapters(side: SwapSide): {
44
+ name: string;
45
+ index: number;
46
+ }[] | null;
47
+ getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
48
+ protected getPoolIdentifier(pairAddress: Address): string;
49
+ protected getPoolAddress(srcToken: Token, destToken: Token): string;
50
+ getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<ApexDefiData>>;
51
+ private getDirectAVAXPairPrices;
52
+ private getCrossPairTokenToTokenPrices;
53
+ private getOrDiscoverPool;
54
+ /**
55
+ * Discover and add a pool for a given token pair
56
+ * This method is called when a pool is not found in the eventPools map
57
+ */
58
+ private discoverPool;
59
+ /**
60
+ * Calculate the output amount for a sell (exact input) swap
61
+ * Uses the constant product formula: amountOut = (amountIn * reserveOut) / (reserveIn + amountIn)
62
+ */
63
+ private getSellPrice;
64
+ /**
65
+ * Calculate the input amount for a buy (exact output) swap
66
+ * Uses the constant product formula: amountIn = (amountOut * reserveIn * feeFactor) / ((reserveOut - amountOut) * (feeFactor - totalFee))
67
+ */
68
+ private getBuyPrice;
69
+ private calculateCrossPairSellPrice;
70
+ private calculateCrossPairBuyPrice;
71
+ private calculatePrices;
72
+ getCalldataGasCost(_poolPrices: PoolPrices<ApexDefiData>): number | number[];
73
+ getAdapterParam(_srcToken: string, _destToken: string, _srcAmount: string, _destAmount: string, _data: ApexDefiData, _side: SwapSide): AdapterExchangeParam;
74
+ getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: ApexDefiData, _side: SwapSide): DexExchangeParam;
75
+ private getDirectTokenSwap;
76
+ private getRouterSwap;
77
+ getSimpleParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, data: ApexDefiData, _side: SwapSide): Promise<SimpleExchangeParam>;
78
+ getDirectParam(_srcToken: Address, _destToken: Address, _srcAmount: NumberAsString, _destAmount: NumberAsString, _expectedAmount: NumberAsString, _data: ApexDefiData, _side: SwapSide, _permit: string, _uuid: string, _feePercent: NumberAsString, _deadline: NumberAsString, _partner: string, _beneficiary: string, _contractMethod: string): TxInfo<null>;
79
+ getDirectParamV6(_srcToken: Address, _destToken: Address, _fromAmount: NumberAsString, _toAmount: NumberAsString, _quotedAmount: NumberAsString, _data: ApexDefiData, _side: SwapSide, _permit: string, _uuid: string, _partnerAndFee: string, _beneficiary: string, _blockNumber: number, _contractMethod: string): TxInfo<null>;
80
+ static getDirectFunctionName(): string[];
81
+ static getDirectFunctionNameV6(): string[];
82
+ updatePoolState(): Promise<void>;
83
+ getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
84
+ private fetchAndInitPool;
85
+ releaseResources(): AsyncOrSync<void>;
86
+ protected _getLoweredAddresses(srcToken: Token, destToken: Token): string[];
87
+ fixPathForRouter(path: Address[]): Address[];
88
+ private getERC314Token;
89
+ private convertAmountToERC314;
90
+ private convertAmountFromERC314;
91
+ private convertAmountsToERC314;
92
+ private convertPricesFromERC314;
93
+ private isWrapperOperation;
94
+ private getWrapperPrices;
95
+ private getWrapperSwap;
96
+ private getWrapperSimpleParam;
97
+ }