@paraswap/dex-lib 2.42.23 → 2.42.24

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 (351) hide show
  1. package/.idea/aws.xml +17 -0
  2. package/.idea/codeStyles/Project.xml +19 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/misc.xml +6 -0
  5. package/.idea/modules.xml +8 -0
  6. package/.idea/paraswap-dex-lib.iml +9 -0
  7. package/.idea/prettier.xml +7 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/build/abi/AugustusV6.abi.json +395 -0
  10. package/build/abi/algebra/AlgebraPool.abi.json +727 -0
  11. package/build/abi/curve-v1/StableSwapFRXETH.json +889 -0
  12. package/build/abi/curve-v1/StableSwapWBETH.json +1223 -0
  13. package/build/abi/sushiswap-v3/QuoterV2.json +267 -0
  14. package/build/abi/sushiswap-v3/RouterProcessor3.json +289 -0
  15. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
  16. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +285 -0
  17. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +583 -0
  18. package/build/abi/wBETH.json +1527 -0
  19. package/build/abi/woo-fi/WooFeeManager.abi.json +318 -0
  20. package/build/abi/woo-fi/WooPP.abi.json +548 -0
  21. package/build/abi/woo-fi/Wooracle.abi.json +260 -0
  22. package/build/dex/aave-v3/tokens/arbitrum.json +50 -0
  23. package/build/dex/aave-v3/tokens/avalanche.json +74 -0
  24. package/build/dex/aave-v3/tokens/fantom.json +62 -0
  25. package/build/dex/aave-v3/tokens/optimism.json +50 -0
  26. package/build/dex/aave-v3/tokens/polygon.json +116 -0
  27. package/build/dex/algebra/algebra-pool.d.ts +114 -0
  28. package/build/dex/algebra/algebra-pool.js +448 -0
  29. package/build/dex/algebra/algebra-pool.js.map +1 -0
  30. package/build/dex/balancer-v2/Gyro3Pool.d.ts +43 -0
  31. package/build/dex/balancer-v2/Gyro3Pool.js +160 -0
  32. package/build/dex/balancer-v2/Gyro3Pool.js.map +1 -0
  33. package/build/dex/balancer-v2/LinearMath.d.ts +88 -0
  34. package/build/dex/balancer-v2/LinearMath.js +285 -0
  35. package/build/dex/balancer-v2/LinearMath.js.map +1 -0
  36. package/build/dex/balancer-v2/LinearPool.d.ts +81 -0
  37. package/build/dex/balancer-v2/LinearPool.js +444 -0
  38. package/build/dex/balancer-v2/LinearPool.js.map +1 -0
  39. package/build/dex/balancer-v2/PhantomStablePool.d.ts +90 -0
  40. package/build/dex/balancer-v2/PhantomStablePool.js +418 -0
  41. package/build/dex/balancer-v2/PhantomStablePool.js.map +1 -0
  42. package/build/dex/balancer-v2/StableMath.d.ts +9 -0
  43. package/build/dex/balancer-v2/StableMath.js +272 -0
  44. package/build/dex/balancer-v2/StableMath.js.map +1 -0
  45. package/build/dex/balancer-v2/balancer-v2-pool.d.ts +140 -0
  46. package/build/dex/balancer-v2/balancer-v2-pool.js +647 -0
  47. package/build/dex/balancer-v2/balancer-v2-pool.js.map +1 -0
  48. package/build/dex/balancer-v2/pools/gyro/Gyro3Pool.d.ts +33 -0
  49. package/build/dex/balancer-v2/pools/gyro/Gyro3Pool.js +128 -0
  50. package/build/dex/balancer-v2/pools/gyro/Gyro3Pool.js.map +1 -0
  51. package/build/dex/balancer-v2/pools/gyro/GyroEPool.d.ts +34 -0
  52. package/build/dex/balancer-v2/pools/gyro/GyroEPool.js +151 -0
  53. package/build/dex/balancer-v2/pools/gyro/GyroEPool.js.map +1 -0
  54. package/build/dex/curve-v1/pools/frxETHpool.d.ts +7 -0
  55. package/build/dex/curve-v1/pools/frxETHpool.js +27 -0
  56. package/build/dex/curve-v1/pools/frxETHpool.js.map +1 -0
  57. package/build/dex/curve-v1/pools/wbETHpool.d.ts +29 -0
  58. package/build/dex/curve-v1/pools/wbETHpool.js +408 -0
  59. package/build/dex/curve-v1/pools/wbETHpool.js.map +1 -0
  60. package/build/dex/dexalot/constants.js +1 -1
  61. package/build/dex/lighter-v1/abi/erc20.json +222 -0
  62. package/build/dex/lighter-v1/abi/factory.json +291 -0
  63. package/build/dex/lighter-v1/abi/order_book.json +594 -0
  64. package/build/dex/lighter-v1/abi/order_book_helper.json +176 -0
  65. package/build/dex/lighter-v1/abi/router.json +488 -0
  66. package/build/dex/{my-test-dex → lighter-v1}/config.d.ts +1 -1
  67. package/build/dex/lighter-v1/config.js +17 -0
  68. package/build/dex/lighter-v1/config.js.map +1 -0
  69. package/build/dex/lighter-v1/constants.d.ts +2 -0
  70. package/build/dex/lighter-v1/constants.js +13 -0
  71. package/build/dex/lighter-v1/constants.js.map +1 -0
  72. package/build/dex/{my-test-dex/my-test-dex-pool.d.ts → lighter-v1/lighter-v1-pool.d.ts} +24 -6
  73. package/build/dex/lighter-v1/lighter-v1-pool.js +310 -0
  74. package/build/dex/lighter-v1/lighter-v1-pool.js.map +1 -0
  75. package/build/dex/{my-test-dex/my-test-dex.d.ts → lighter-v1/lighter-v1.d.ts} +18 -10
  76. package/build/dex/lighter-v1/lighter-v1.js +331 -0
  77. package/build/dex/lighter-v1/lighter-v1.js.map +1 -0
  78. package/build/dex/lighter-v1/types.d.ts +40 -0
  79. package/build/dex/{hello → lighter-v1}/types.js.map +1 -1
  80. package/build/dex/pancakeswap-v3/types.d.ts +14 -0
  81. package/build/dex/{my-test-dex → pancakeswap-v3}/types.js.map +1 -1
  82. package/build/dex/quickswap/camelot-v3.d.ts +6 -0
  83. package/build/dex/quickswap/camelot-v3.js +19 -0
  84. package/build/dex/quickswap/camelot-v3.js.map +1 -0
  85. package/build/dex/quickswap/zyberswap-v3.d.ts +6 -0
  86. package/build/dex/quickswap/zyberswap-v3.js +19 -0
  87. package/build/dex/quickswap/zyberswap-v3.js.map +1 -0
  88. package/build/dex/quickswap-v3.d.ts +21 -0
  89. package/build/dex/quickswap-v3.js +40 -0
  90. package/build/dex/quickswap-v3.js.map +1 -0
  91. package/build/dex/{wombat → ramses-v2}/config.d.ts +1 -1
  92. package/build/dex/ramses-v2/config.js +28 -0
  93. package/build/dex/ramses-v2/config.js.map +1 -0
  94. package/build/dex/{baseswap-v3 → ramses-v2}/constants.d.ts +1 -1
  95. package/build/dex/{baseswap-v3 → ramses-v2}/constants.js +1 -1
  96. package/build/dex/ramses-v2/constants.js.map +1 -0
  97. package/build/dex/ramses-v2/contract-math/BitMath.js.map +1 -0
  98. package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +1 -0
  99. package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +1 -0
  100. package/build/dex/ramses-v2/contract-math/FullMath.js.map +1 -0
  101. package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +1 -0
  102. package/build/dex/ramses-v2/contract-math/Oracle.js.map +1 -0
  103. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +1 -0
  104. package/build/dex/ramses-v2/contract-math/SwapMath.js.map +1 -0
  105. package/build/dex/ramses-v2/contract-math/Tick.d.ts +7 -0
  106. package/build/dex/ramses-v2/contract-math/Tick.js.map +1 -0
  107. package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +8 -0
  108. package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/TickBitMap.js +3 -0
  109. package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +1 -0
  110. package/build/dex/ramses-v2/contract-math/TickMath.js.map +1 -0
  111. package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +1 -0
  112. package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/uniswap-v3-math.d.ts +0 -19
  113. package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/uniswap-v3-math.js +1 -2
  114. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +1 -0
  115. package/build/dex/ramses-v2/contract-math/utils.js.map +1 -0
  116. package/build/dex/{baseswap-v3/baseswap-v3-pool.d.ts → ramses-v2/ramses-v2-pool.d.ts} +7 -11
  117. package/build/dex/{baseswap-v3/baseswap-v3-pool.js → ramses-v2/ramses-v2-pool.js} +7 -12
  118. package/build/dex/ramses-v2/ramses-v2-pool.js.map +1 -0
  119. package/build/dex/{baseswap-v3/baseswap-v3.d.ts → ramses-v2/ramses-v2.d.ts} +16 -26
  120. package/build/dex/{baseswap-v3/baseswap-v3.js → ramses-v2/ramses-v2.js} +82 -144
  121. package/build/dex/ramses-v2/ramses-v2.js.map +1 -0
  122. package/build/dex/{baseswap-v3 → ramses-v2}/types.d.ts +7 -17
  123. package/build/dex/ramses-v2/types.js +9 -0
  124. package/build/dex/ramses-v2/types.js.map +1 -0
  125. package/build/dex/{baseswap-v3 → ramses-v2}/utils.js +7 -1
  126. package/build/dex/ramses-v2/utils.js.map +1 -0
  127. package/build/dex/{kyberswap-elastic → sushiswap-v3}/config.d.ts +2 -2
  128. package/build/dex/sushiswap-v3/config.js +132 -0
  129. package/build/dex/sushiswap-v3/config.js.map +1 -0
  130. package/build/dex/sushiswap-v3/constants.d.ts +4 -0
  131. package/build/dex/sushiswap-v3/constants.js +32 -0
  132. package/build/dex/sushiswap-v3/constants.js.map +1 -0
  133. package/build/dex/{kyberswap-elastic/kyberswap-elastic.d.ts → sushiswap-v3/sushiswap-v3-original.d.ts} +31 -28
  134. package/build/dex/{kyberswap-elastic/kyberswap-elastic.js → sushiswap-v3/sushiswap-v3-original.js} +257 -269
  135. package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +1 -0
  136. package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +1 -0
  137. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +6 -0
  138. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +1 -0
  139. package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +21 -0
  140. package/build/dex/sushiswap-v3/sushiswap-v3.js +58 -0
  141. package/build/dex/sushiswap-v3/sushiswap-v3.js.map +1 -0
  142. package/build/dex/sushiswap-v3/token.d.ts +6 -0
  143. package/build/dex/sushiswap-v3/token.js +23 -0
  144. package/build/dex/sushiswap-v3/token.js.map +1 -0
  145. package/build/dex/sushiswap-v3/types.d.ts +15 -0
  146. package/build/dex/sushiswap-v3/types.js +18 -0
  147. package/build/dex/sushiswap-v3/types.js.map +1 -0
  148. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +12 -0
  149. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +23 -0
  150. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +1 -0
  151. package/build/dex/{hello → woo-fi}/config.d.ts +1 -1
  152. package/build/dex/woo-fi/config.js +141 -0
  153. package/build/dex/woo-fi/config.js.map +1 -0
  154. package/build/dex/woo-fi/constants.d.ts +5 -0
  155. package/build/dex/woo-fi/constants.js +20 -0
  156. package/build/dex/woo-fi/constants.js.map +1 -0
  157. package/build/dex/woo-fi/types.d.ts +48 -0
  158. package/build/dex/{wombat → woo-fi}/types.js.map +1 -1
  159. package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +14 -0
  160. package/build/dex/woo-fi/woo-fi-decimal-math.js +42 -0
  161. package/build/dex/woo-fi/woo-fi-decimal-math.js.map +1 -0
  162. package/build/dex/woo-fi/woo-fi-math.d.ts +31 -0
  163. package/build/dex/woo-fi/woo-fi-math.js +300 -0
  164. package/build/dex/woo-fi/woo-fi-math.js.map +1 -0
  165. package/build/dex/woo-fi/woo-fi.d.ts +65 -0
  166. package/build/dex/woo-fi/woo-fi.js +480 -0
  167. package/build/dex/woo-fi/woo-fi.js.map +1 -0
  168. package/build/executor/Executor01BytecodeBuilder.d.ts +77 -0
  169. package/build/executor/Executor01BytecodeBuilder.js +359 -0
  170. package/build/executor/Executor01BytecodeBuilder.js.map +1 -0
  171. package/build/executor/Executor02BytecodeBuilder.d.ts +12 -0
  172. package/build/executor/Executor02BytecodeBuilder.js +14 -0
  173. package/build/executor/Executor02BytecodeBuilder.js.map +1 -0
  174. package/build/executor/ExecutorDetector.d.ts +28 -0
  175. package/build/executor/ExecutorDetector.js +89 -0
  176. package/build/executor/ExecutorDetector.js.map +1 -0
  177. package/build/executor/IExecutorBytecodeBuilder.d.ts +6 -0
  178. package/build/executor/IExecutorBytecodeBuilder.js +3 -0
  179. package/build/executor/IExecutorBytecodeBuilder.js.map +1 -0
  180. package/build/generic-swap-transaction-builder.d.ts +39 -0
  181. package/build/generic-swap-transaction-builder.js +156 -0
  182. package/build/generic-swap-transaction-builder.js.map +1 -0
  183. package/package.json +1 -1
  184. package/src/dex/dexalot/constants.ts +1 -1
  185. package/build/abi/kyberswap-elastic/IAntiSnipAttackPositionManager.json +0 -1276
  186. package/build/abi/kyberswap-elastic/IFactory.json +0 -550
  187. package/build/abi/kyberswap-elastic/IPool.json +0 -1042
  188. package/build/abi/kyberswap-elastic/IQuoterV2.json +0 -226
  189. package/build/abi/kyberswap-elastic/IRouter.json +0 -239
  190. package/build/abi/kyberswap-elastic/TicksFeesReader.json +0 -142
  191. package/build/abi/wombat/asset.json +0 -769
  192. package/build/abi/wombat/bmw.json +0 -1247
  193. package/build/abi/wombat/pool.json +0 -1364
  194. package/build/dex/baseswap-v3/baseswap-v3-factory.d.ts +0 -26
  195. package/build/dex/baseswap-v3/baseswap-v3-factory.js +0 -44
  196. package/build/dex/baseswap-v3/baseswap-v3-factory.js.map +0 -1
  197. package/build/dex/baseswap-v3/baseswap-v3-pool.js.map +0 -1
  198. package/build/dex/baseswap-v3/baseswap-v3.js.map +0 -1
  199. package/build/dex/baseswap-v3/config.d.ts +0 -9
  200. package/build/dex/baseswap-v3/config.js +0 -48
  201. package/build/dex/baseswap-v3/config.js.map +0 -1
  202. package/build/dex/baseswap-v3/constants.js.map +0 -1
  203. package/build/dex/baseswap-v3/contract-math/BitMath.js.map +0 -1
  204. package/build/dex/baseswap-v3/contract-math/FixedPoint128.js.map +0 -1
  205. package/build/dex/baseswap-v3/contract-math/FixedPoint96.js.map +0 -1
  206. package/build/dex/baseswap-v3/contract-math/FullMath.js.map +0 -1
  207. package/build/dex/baseswap-v3/contract-math/LiquidityMath.js.map +0 -1
  208. package/build/dex/baseswap-v3/contract-math/Oracle.js.map +0 -1
  209. package/build/dex/baseswap-v3/contract-math/SqrtPriceMath.js.map +0 -1
  210. package/build/dex/baseswap-v3/contract-math/SwapMath.js.map +0 -1
  211. package/build/dex/baseswap-v3/contract-math/Tick.d.ts +0 -7
  212. package/build/dex/baseswap-v3/contract-math/Tick.js.map +0 -1
  213. package/build/dex/baseswap-v3/contract-math/TickBitMap.d.ts +0 -7
  214. package/build/dex/baseswap-v3/contract-math/TickBitMap.js.map +0 -1
  215. package/build/dex/baseswap-v3/contract-math/TickMath.js.map +0 -1
  216. package/build/dex/baseswap-v3/contract-math/UnsafeMath.js.map +0 -1
  217. package/build/dex/baseswap-v3/contract-math/uniswap-v3-math.js.map +0 -1
  218. package/build/dex/baseswap-v3/contract-math/utils.d.ts +0 -7
  219. package/build/dex/baseswap-v3/contract-math/utils.js +0 -42
  220. package/build/dex/baseswap-v3/contract-math/utils.js.map +0 -1
  221. package/build/dex/baseswap-v3/types.js +0 -9
  222. package/build/dex/baseswap-v3/types.js.map +0 -1
  223. package/build/dex/baseswap-v3/utils.js.map +0 -1
  224. package/build/dex/hello/config.js +0 -15
  225. package/build/dex/hello/config.js.map +0 -1
  226. package/build/dex/hello/hello-pool.d.ts +0 -39
  227. package/build/dex/hello/hello-pool.js +0 -64
  228. package/build/dex/hello/hello-pool.js.map +0 -1
  229. package/build/dex/hello/hello.d.ts +0 -37
  230. package/build/dex/hello/hello.js +0 -126
  231. package/build/dex/hello/hello.js.map +0 -1
  232. package/build/dex/hello/types.d.ts +0 -6
  233. package/build/dex/kyberswap-elastic/config.js +0 -80
  234. package/build/dex/kyberswap-elastic/config.js.map +0 -1
  235. package/build/dex/kyberswap-elastic/constants.d.ts +0 -17
  236. package/build/dex/kyberswap-elastic/constants.js +0 -42
  237. package/build/dex/kyberswap-elastic/constants.js.map +0 -1
  238. package/build/dex/kyberswap-elastic/contract-math/FixedPoint96.d.ts +0 -4
  239. package/build/dex/kyberswap-elastic/contract-math/FixedPoint96.js +0 -9
  240. package/build/dex/kyberswap-elastic/contract-math/FixedPoint96.js.map +0 -1
  241. package/build/dex/kyberswap-elastic/contract-math/FullMath.d.ts +0 -5
  242. package/build/dex/kyberswap-elastic/contract-math/FullMath.js +0 -22
  243. package/build/dex/kyberswap-elastic/contract-math/FullMath.js.map +0 -1
  244. package/build/dex/kyberswap-elastic/contract-math/LiqDeltaMath.d.ts +0 -3
  245. package/build/dex/kyberswap-elastic/contract-math/LiqDeltaMath.js +0 -12
  246. package/build/dex/kyberswap-elastic/contract-math/LiqDeltaMath.js.map +0 -1
  247. package/build/dex/kyberswap-elastic/contract-math/LiquidityMath.d.ts +0 -3
  248. package/build/dex/kyberswap-elastic/contract-math/LiquidityMath.js +0 -22
  249. package/build/dex/kyberswap-elastic/contract-math/LiquidityMath.js.map +0 -1
  250. package/build/dex/kyberswap-elastic/contract-math/QtyDeltaMath.d.ts +0 -5
  251. package/build/dex/kyberswap-elastic/contract-math/QtyDeltaMath.js +0 -25
  252. package/build/dex/kyberswap-elastic/contract-math/QtyDeltaMath.js.map +0 -1
  253. package/build/dex/kyberswap-elastic/contract-math/QuadMath.d.ts +0 -4
  254. package/build/dex/kyberswap-elastic/contract-math/QuadMath.js +0 -27
  255. package/build/dex/kyberswap-elastic/contract-math/QuadMath.js.map +0 -1
  256. package/build/dex/kyberswap-elastic/contract-math/ReinvestmentMath.d.ts +0 -3
  257. package/build/dex/kyberswap-elastic/contract-math/ReinvestmentMath.js +0 -14
  258. package/build/dex/kyberswap-elastic/contract-math/ReinvestmentMath.js.map +0 -1
  259. package/build/dex/kyberswap-elastic/contract-math/SafeCast.d.ts +0 -8
  260. package/build/dex/kyberswap-elastic/contract-math/SafeCast.js +0 -30
  261. package/build/dex/kyberswap-elastic/contract-math/SafeCast.js.map +0 -1
  262. package/build/dex/kyberswap-elastic/contract-math/SqrtPriceMath.d.ts +0 -10
  263. package/build/dex/kyberswap-elastic/contract-math/SqrtPriceMath.js +0 -91
  264. package/build/dex/kyberswap-elastic/contract-math/SqrtPriceMath.js.map +0 -1
  265. package/build/dex/kyberswap-elastic/contract-math/SwapMath.d.ts +0 -13
  266. package/build/dex/kyberswap-elastic/contract-math/SwapMath.js +0 -188
  267. package/build/dex/kyberswap-elastic/contract-math/SwapMath.js.map +0 -1
  268. package/build/dex/kyberswap-elastic/contract-math/TickLinkedList.d.ts +0 -6
  269. package/build/dex/kyberswap-elastic/contract-math/TickLinkedList.js +0 -41
  270. package/build/dex/kyberswap-elastic/contract-math/TickLinkedList.js.map +0 -1
  271. package/build/dex/kyberswap-elastic/contract-math/TickMath.d.ts +0 -9
  272. package/build/dex/kyberswap-elastic/contract-math/TickMath.js +0 -165
  273. package/build/dex/kyberswap-elastic/contract-math/TickMath.js.map +0 -1
  274. package/build/dex/kyberswap-elastic/contract-math/UnsafeMath.d.ts +0 -3
  275. package/build/dex/kyberswap-elastic/contract-math/UnsafeMath.js +0 -10
  276. package/build/dex/kyberswap-elastic/contract-math/UnsafeMath.js.map +0 -1
  277. package/build/dex/kyberswap-elastic/contract-math/kyberswap-elastic-math.d.ts +0 -28
  278. package/build/dex/kyberswap-elastic/contract-math/kyberswap-elastic-math.js +0 -502
  279. package/build/dex/kyberswap-elastic/contract-math/kyberswap-elastic-math.js.map +0 -1
  280. package/build/dex/kyberswap-elastic/contract-math/utils.js.map +0 -1
  281. package/build/dex/kyberswap-elastic/errors.d.ts +0 -2
  282. package/build/dex/kyberswap-elastic/errors.js +0 -6
  283. package/build/dex/kyberswap-elastic/errors.js.map +0 -1
  284. package/build/dex/kyberswap-elastic/kyberswap-elastic-pool.d.ts +0 -80
  285. package/build/dex/kyberswap-elastic/kyberswap-elastic-pool.js +0 -458
  286. package/build/dex/kyberswap-elastic/kyberswap-elastic-pool.js.map +0 -1
  287. package/build/dex/kyberswap-elastic/kyberswap-elastic.js.map +0 -1
  288. package/build/dex/kyberswap-elastic/types.d.ts +0 -134
  289. package/build/dex/kyberswap-elastic/types.js +0 -9
  290. package/build/dex/kyberswap-elastic/types.js.map +0 -1
  291. package/build/dex/kyberswap-elastic/utils/decoders.d.ts +0 -9
  292. package/build/dex/kyberswap-elastic/utils/decoders.js +0 -78
  293. package/build/dex/kyberswap-elastic/utils/decoders.js.map +0 -1
  294. package/build/dex/morphex/config.d.ts +0 -11
  295. package/build/dex/morphex/config.js +0 -43
  296. package/build/dex/morphex/config.js.map +0 -1
  297. package/build/dex/morphex/morphex.d.ts +0 -25
  298. package/build/dex/morphex/morphex.js +0 -19
  299. package/build/dex/morphex/morphex.js.map +0 -1
  300. package/build/dex/my-test-dex/config.js +0 -15
  301. package/build/dex/my-test-dex/config.js.map +0 -1
  302. package/build/dex/my-test-dex/my-test-dex-pool.js +0 -64
  303. package/build/dex/my-test-dex/my-test-dex-pool.js.map +0 -1
  304. package/build/dex/my-test-dex/my-test-dex.js +0 -126
  305. package/build/dex/my-test-dex/my-test-dex.js.map +0 -1
  306. package/build/dex/my-test-dex/types.d.ts +0 -6
  307. package/build/dex/wombat/config.js +0 -99
  308. package/build/dex/wombat/config.js.map +0 -1
  309. package/build/dex/wombat/types.d.ts +0 -33
  310. package/build/dex/wombat/utils.d.ts +0 -9
  311. package/build/dex/wombat/utils.js +0 -66
  312. package/build/dex/wombat/utils.js.map +0 -1
  313. package/build/dex/wombat/wombat-bmw.d.ts +0 -40
  314. package/build/dex/wombat/wombat-bmw.js +0 -147
  315. package/build/dex/wombat/wombat-bmw.js.map +0 -1
  316. package/build/dex/wombat/wombat-pool.d.ts +0 -22
  317. package/build/dex/wombat/wombat-pool.js +0 -161
  318. package/build/dex/wombat/wombat-pool.js.map +0 -1
  319. package/build/dex/wombat/wombat-quoter.d.ts +0 -16
  320. package/build/dex/wombat/wombat-quoter.js +0 -176
  321. package/build/dex/wombat/wombat-quoter.js.map +0 -1
  322. package/build/dex/wombat/wombat.d.ts +0 -55
  323. package/build/dex/wombat/wombat.js +0 -290
  324. package/build/dex/wombat/wombat.js.map +0 -1
  325. /package/build/dex/{hello → lighter-v1}/types.js +0 -0
  326. /package/build/dex/{my-test-dex → pancakeswap-v3}/types.js +0 -0
  327. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/BitMath.d.ts +0 -0
  328. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/BitMath.js +0 -0
  329. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/FixedPoint128.d.ts +0 -0
  330. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/FixedPoint128.js +0 -0
  331. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/FixedPoint96.d.ts +0 -0
  332. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/FixedPoint96.js +0 -0
  333. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/FullMath.d.ts +0 -0
  334. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/FullMath.js +0 -0
  335. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/LiquidityMath.d.ts +0 -0
  336. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/LiquidityMath.js +0 -0
  337. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/Oracle.d.ts +0 -0
  338. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/Oracle.js +0 -0
  339. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/SqrtPriceMath.d.ts +0 -0
  340. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/SqrtPriceMath.js +0 -0
  341. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/SwapMath.d.ts +0 -0
  342. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/SwapMath.js +0 -0
  343. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/Tick.js +0 -0
  344. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/TickMath.d.ts +0 -0
  345. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/TickMath.js +0 -0
  346. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/UnsafeMath.d.ts +0 -0
  347. /package/build/dex/{baseswap-v3 → ramses-v2}/contract-math/UnsafeMath.js +0 -0
  348. /package/build/dex/{kyberswap-elastic → ramses-v2}/contract-math/utils.d.ts +0 -0
  349. /package/build/dex/{kyberswap-elastic → ramses-v2}/contract-math/utils.js +0 -0
  350. /package/build/dex/{baseswap-v3 → ramses-v2}/utils.d.ts +0 -0
  351. /package/build/dex/{wombat → woo-fi}/types.js +0 -0
@@ -1,176 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WombatQuoter = void 0;
4
- const utils_1 = require("./utils");
5
- class WombatQuoter {
6
- constructor(poolParams) {
7
- this.ampFactor = poolParams.ampFactor;
8
- this.haircutRate = poolParams.haircutRate;
9
- this.startCovRatio = poolParams.startCovRatio;
10
- this.endCovRatio = poolParams.endCovRatio;
11
- }
12
- getQuote(fromAsset, toAsset, fromAmount) {
13
- if (fromAmount === 0n || fromAsset.paused) {
14
- return 0n;
15
- }
16
- fromAmount = (0, utils_1.toWad)(fromAmount, BigInt(fromAsset.underlyingTokenDecimals));
17
- try {
18
- const { actualToAmount, haircut } = this._highCovRatioPoolQuoteFrom(fromAsset, toAsset, fromAmount);
19
- const toCash = toAsset.cash - actualToAmount - haircut;
20
- if ((0, utils_1.wdiv)(toCash, toAsset.liability) < utils_1.WAD / 100n) {
21
- return 0n;
22
- }
23
- return (0, utils_1.fromWad)(actualToAmount, BigInt(toAsset.underlyingTokenDecimals));
24
- }
25
- catch (e) {
26
- return 0n;
27
- }
28
- }
29
- _highCovRatioPoolQuoteFrom(fromAsset, toAsset, fromAmount) {
30
- let { actualToAmount, haircut } = this._quoteFrom(fromAsset, toAsset, fromAmount);
31
- if (fromAmount > 0n) {
32
- const fromCash = fromAsset.cash;
33
- const fromLiability = fromAsset.liability;
34
- const finalFromAssetCovRatio = (0, utils_1.wdiv)(fromCash + fromAmount, fromLiability);
35
- if (finalFromAssetCovRatio > this.startCovRatio) {
36
- // charge high cov ratio fee
37
- const highCovRatioFee = (0, utils_1.wmul)(this._highCovRatioFee((0, utils_1.wdiv)(fromCash, fromLiability), finalFromAssetCovRatio), actualToAmount);
38
- actualToAmount -= highCovRatioFee;
39
- haircut += highCovRatioFee;
40
- }
41
- }
42
- else {
43
- // reverse quote
44
- const toCash = toAsset.cash;
45
- const toLiability = toAsset.liability;
46
- const finalToAssetCovRatio = (0, utils_1.wdiv)(toCash + actualToAmount, toLiability);
47
- if (finalToAssetCovRatio <= this.startCovRatio) {
48
- // happy path: no high cov ratio fee is charged
49
- return { actualToAmount, haircut };
50
- }
51
- else if ((0, utils_1.wdiv)(toCash, toLiability) >= this.endCovRatio) {
52
- // the to-asset exceeds it's cov ratio limit, further swap to increase cov ratio is impossible
53
- throw new Error('WOMBAT_COV_RATIO_LIMIT_EXCEEDED');
54
- }
55
- // reverse quote: cov ratio of the to-asset exceed endCovRatio. direct reverse quote is not supported
56
- // we binary search for a upper bound
57
- actualToAmount = this._findUpperBound(toAsset, fromAsset, -fromAmount);
58
- const result = this._highCovRatioPoolQuoteFrom(toAsset, fromAsset, actualToAmount);
59
- haircut = result.haircut;
60
- }
61
- return { actualToAmount, haircut };
62
- }
63
- _highCovRatioFee(initCovRatio, finalCovRatio) {
64
- const startCovRatio = this.startCovRatio;
65
- const endCovRatio = this.endCovRatio;
66
- if (finalCovRatio > endCovRatio) {
67
- // invalid swap
68
- throw new Error('WOMBAT_COV_RATIO_LIMIT_EXCEEDED');
69
- }
70
- else if (finalCovRatio <= startCovRatio ||
71
- finalCovRatio <= initCovRatio) {
72
- return 0n;
73
- }
74
- // 1. Calculate the area of fee(r) = (r - startCovRatio) / (endCovRatio - startCovRatio)
75
- // when r increase from initCovRatio to finalCovRatio
76
- // 2. Then multiply it by (endCovRatio - startCovRatio) / (finalCovRatio - initCovRatio)
77
- // to get the average fee over the range
78
- const a = initCovRatio <= startCovRatio
79
- ? 0n
80
- : (initCovRatio - startCovRatio) * (initCovRatio - startCovRatio);
81
- const b = (finalCovRatio - startCovRatio) * (finalCovRatio - startCovRatio);
82
- return (0, utils_1.wdiv)((b - a) / (finalCovRatio - initCovRatio) / BigInt(2), endCovRatio - startCovRatio);
83
- }
84
- _quoteFrom(fromAsset, toAsset, fromAmount) {
85
- if (fromAmount < 0n) {
86
- fromAmount = (0, utils_1.wdiv)(fromAmount, utils_1.WAD - this.haircutRate);
87
- }
88
- let fromCash = fromAsset.cash;
89
- const toCash = toAsset.cash;
90
- let fromLiability = fromAsset.liability;
91
- const toLiability = toAsset.liability;
92
- const scaleFactor = this._quoteFactor(fromAsset, toAsset);
93
- if (scaleFactor !== utils_1.WAD) {
94
- fromCash = (fromCash * scaleFactor) / utils_1.WAD;
95
- fromLiability = (fromLiability * scaleFactor) / utils_1.WAD;
96
- fromAmount = (fromAmount * scaleFactor) / utils_1.WAD;
97
- }
98
- const idealToAmount = WombatQuoter.swapQuoteFunc(fromCash, toCash, fromLiability, toLiability, fromAmount, this.ampFactor);
99
- if ((fromAmount > 0n && toCash < idealToAmount) ||
100
- (fromAmount < 0n && fromCash < -fromAmount)) {
101
- throw new Error('WOMBAT_CASH_NOT_ENOUGH');
102
- }
103
- let actualToAmount, haircut;
104
- if (fromAmount > 0) {
105
- haircut = (0, utils_1.wmul)(idealToAmount, this.haircutRate);
106
- actualToAmount = idealToAmount - haircut;
107
- }
108
- else {
109
- actualToAmount = idealToAmount;
110
- haircut = (0, utils_1.wmul)(-fromAmount, this.haircutRate);
111
- }
112
- return { actualToAmount, haircut };
113
- }
114
- _findUpperBound(fromAsset, toAsset, toAmount) {
115
- const decimals = BigInt(fromAsset.underlyingTokenDecimals);
116
- const toWadFactor = (0, utils_1.toWad)(1n, decimals);
117
- // the search value uses the same number of digits as the token
118
- let high = (0, utils_1.fromWad)((0, utils_1.wmul)(fromAsset.liability, this.endCovRatio) - fromAsset.cash, decimals);
119
- let low = 1n;
120
- // verify `high` is a valid upper bound
121
- const { actualToAmount: quote } = this._highCovRatioPoolQuoteFrom(fromAsset, toAsset, high * toWadFactor);
122
- if (quote < toAmount) {
123
- throw new Error('WOMBAT_COV_RATIO_LIMIT_EXCEEDED');
124
- }
125
- // Note: we might limit the maximum number of rounds if the request is always rejected by the RPC server
126
- while (low < high) {
127
- const mid = (low + high) / BigInt(2);
128
- const { actualToAmount: quote } = this._highCovRatioPoolQuoteFrom(fromAsset, toAsset, mid * toWadFactor);
129
- if (quote >= toAmount) {
130
- high = mid;
131
- }
132
- else {
133
- low = mid + 1n;
134
- }
135
- }
136
- return high * toWadFactor;
137
- }
138
- _quoteFactor(fromAsset, toAsset) {
139
- if (!fromAsset.relativePrice || !toAsset.relativePrice) {
140
- return utils_1.WAD;
141
- }
142
- return (utils_1.WAD * fromAsset.relativePrice) / toAsset.relativePrice;
143
- }
144
- static solveQuad(b, c) {
145
- return ((0, utils_1.sqrt)(b * b + c * 4n * utils_1.WAD, b) - b) / 2n;
146
- }
147
- static swapQuoteFunc(aX, aY, lX, lY, dX, a) {
148
- if (lX == 0n || lY == 0n) {
149
- // in case div of 0, CORE_UNDERFLOW
150
- return 0n;
151
- }
152
- // int256 D = Ax + Ay - A.wmul((Lx * Lx) / Ax + (Ly * Ly) / Ay); // flattened _invariantFunc
153
- const d = aX + aY - (0, utils_1.wmul)(a, (lX * lX) / aX + (lY * lY) / aY);
154
- // int256 rx_ = (Ax + Dx).wdiv(Lx);
155
- const rX = (0, utils_1.wdiv)(aX + dX, lX);
156
- // int256 b = (Lx * (rx_ - A.wdiv(rx_))) / Ly - D.wdiv(Ly); // flattened _coefficientFunc
157
- const b = (lX * (rX - (0, utils_1.wdiv)(a, rX))) / lY - (0, utils_1.wdiv)(d, lY);
158
- // int256 ry_ = _solveQuad(b, A);
159
- const rY = WombatQuoter.solveQuad(b, a);
160
- // int256 Dy = Ly.wmul(ry_) - Ay;
161
- const dY = (0, utils_1.wmul)(lY, rY) - aY;
162
- // if (Dy < 0) {
163
- // quote = uint256(-Dy);
164
- // } else {
165
- // quote = uint256(Dy);
166
- // }
167
- if (dY < 0n) {
168
- return -dY;
169
- }
170
- else {
171
- return dY;
172
- }
173
- }
174
- }
175
- exports.WombatQuoter = WombatQuoter;
176
- //# sourceMappingURL=wombat-quoter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wombat-quoter.js","sourceRoot":"","sources":["../../../src/dex/wombat/wombat-quoter.ts"],"names":[],"mappings":";;;AACA,mCAAgE;AAEhE,MAAa,YAAY;IAMvB,YAAY,UAAsB;QAChC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IAC5C,CAAC;IAEM,QAAQ,CACb,SAAqB,EACrB,OAAmB,EACnB,UAAkB;QAElB,IAAI,UAAU,KAAK,EAAE,IAAI,SAAS,CAAC,MAAM,EAAE;YACzC,OAAO,EAAE,CAAC;SACX;QAED,UAAU,GAAG,IAAA,aAAK,EAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAE1E,IAAI;YACF,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,0BAA0B,CACjE,SAAS,EACT,OAAO,EACP,UAAU,CACX,CAAC;YACF,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,cAAc,GAAG,OAAO,CAAC;YAEvD,IAAI,IAAA,YAAI,EAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,WAAG,GAAG,IAAI,EAAE;gBAChD,OAAO,EAAE,CAAC;aACX;YAED,OAAO,IAAA,eAAO,EAAC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;SACzE;QAAC,OAAO,CAAC,EAAE;Y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AAE,CAAC;QAE7B,gBAAgB;QAChB,4BAA4B;QAC5B,WAAW;QACX,2BAA2B;QAC3B,IAAI;QACJ,IAAI,EAAE,GAAG,EAAE,EAAE;YACX,OAAO,CAAC,EAAE,CAAC;SACZ;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF;AAzQD,oCAyQC"}
@@ -1,55 +0,0 @@
1
- import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
2
- import { Interface } from '@ethersproject/abi';
3
- import { SwapSide } from '@paraswap/core';
4
- import { AdapterExchangeParam, Address, ExchangePrices, Logger, PoolLiquidity, PoolPrices, SimpleExchangeParam, Token } from '../../types';
5
- import { Network } from '../../constants';
6
- import { IDex } from '../idex';
7
- import { IDexHelper } from '../../dex-helper';
8
- import { DexParams, PoolState, WombatData } from './types';
9
- import { SimpleExchange } from '../simple-exchange';
10
- import { WombatBmw } from './wombat-bmw';
11
- import { WombatPool } from './wombat-pool';
12
- export declare class Wombat extends SimpleExchange implements IDex<WombatData> {
13
- readonly network: Network;
14
- readonly dexKey: string;
15
- readonly dexHelper: IDexHelper;
16
- protected adapters: import("../../types").AdapterMappings;
17
- static readonly erc20Interface: Interface;
18
- static readonly poolInterface: Interface;
19
- static readonly assetInterface: Interface;
20
- protected config: DexParams;
21
- protected poolLiquidityUSD?: {
22
- [poolAddress: string]: number;
23
- };
24
- bmw: WombatBmw;
25
- pools: {
26
- [poolAddress: string]: WombatPool;
27
- };
28
- readonly hasConstantPriceLargeAmounts = false;
29
- readonly needWrapNative = true;
30
- readonly isFeeOnTransferSupported = false;
31
- static dexKeysWithNetwork: {
32
- key: string;
33
- networks: Network[];
34
- }[];
35
- logger: Logger;
36
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, adapters?: import("../../types").AdapterMappings);
37
- init(blockNumber: number): Promise<void>;
38
- initializePricing(blockNumber: number): Promise<void>;
39
- onAssetAdded: (pool: Address, asset2TokenMap: Map<Address, Address>, blockNumber: number) => Promise<void>;
40
- getAdapters(side: SwapSide): {
41
- name: string;
42
- index: number;
43
- }[] | null;
44
- getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
45
- protected getPoolIdentifier(poolAddress: Address): string;
46
- getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<WombatData>>;
47
- protected computePrices(srcTokenAddress: Address, destTokenAddress: Address, amounts: bigint[], side: SwapSide, state: DeepReadonly<PoolState>): bigint[];
48
- protected findPools(srcTokenAddress: Address, destTokenAddress: Address, blockNumber: number): Promise<Address[]>;
49
- getCalldataGasCost(poolPrices: PoolPrices<WombatData>): number | number[];
50
- getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: WombatData, side: SwapSide): AdapterExchangeParam;
51
- getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: WombatData, side: SwapSide): Promise<SimpleExchangeParam>;
52
- updatePoolState(): Promise<void>;
53
- getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
54
- releaseResources(): AsyncOrSync<void>;
55
- }
@@ -1,290 +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.Wombat = void 0;
30
- const abi_1 = require("@ethersproject/abi");
31
- const core_1 = require("@paraswap/core");
32
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
33
- const utils_1 = require("../../utils");
34
- const simple_exchange_1 = require("../simple-exchange");
35
- const config_1 = require("./config");
36
- const pool_json_1 = __importDefault(require("../../abi/wombat/pool.json"));
37
- const asset_json_1 = __importDefault(require("../../abi/wombat/asset.json"));
38
- const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
39
- const wombat_quoter_1 = require("./wombat-quoter");
40
- const wombat_bmw_1 = require("./wombat-bmw");
41
- const utils_2 = require("./utils");
42
- const wombat_pool_1 = require("./wombat-pool");
43
- class Wombat extends simple_exchange_1.SimpleExchange {
44
- constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network] || {}) {
45
- super(dexHelper, dexKey);
46
- this.network = network;
47
- this.dexKey = dexKey;
48
- this.dexHelper = dexHelper;
49
- this.adapters = adapters;
50
- this.pools = {};
51
- this.hasConstantPriceLargeAmounts = false;
52
- this.needWrapNative = true;
53
- this.isFeeOnTransferSupported = false;
54
- this.onAssetAdded = async (pool, asset2TokenMap, blockNumber) => {
55
- if (!this.pools[pool]) {
56
- this.pools[pool] = new wombat_pool_1.WombatPool(this.dexKey, this.getPoolIdentifier(pool), this.dexHelper, pool, asset2TokenMap);
57
- await this.pools[pool].getState('latest', true);
58
- }
59
- else {
60
- this.pools[pool].addAssets(asset2TokenMap);
61
- }
62
- };
63
- this.logger = dexHelper.getLogger(dexKey);
64
- this.config = config_1.WombatConfig[dexKey][network];
65
- this.bmw = new wombat_bmw_1.WombatBmw(dexKey, this.config.bmwAddress, network, dexHelper, this.logger, this.config.bmwAddress, this.onAssetAdded.bind(this));
66
- }
67
- async init(blockNumber) {
68
- if (!this.bmw.isInitialized) {
69
- await this.bmw.initialize(blockNumber);
70
- }
71
- }
72
- // Initialize pricing is called once in the start of
73
- // pricing service. It is intended to setup the integration
74
- // for pricing requests. It is optional for a DEX to
75
- // implement this function
76
- async initializePricing(blockNumber) {
77
- await this.init(blockNumber);
78
- const bmwState = this.bmw.getState(blockNumber);
79
- if (!bmwState) {
80
- throw new Error('initializePricing: bmwState still null after init');
81
- }
82
- }
83
- // Returns the list of contract adapters (name and index)
84
- // for a buy/sell. Return null if there are no adapters.
85
- getAdapters(side) {
86
- return this.adapters[side] ? this.adapters[side] : null;
87
- }
88
- // Returns list of pool identifiers that can be used
89
- // for a given swap. poolIdentifiers must be unique
90
- // across DEXes. It is recommended to use
91
- // ${dexKey}_${poolAddress} as a poolIdentifier
92
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
93
- await this.updatePoolState();
94
- return (await this.findPools(this.dexHelper.config.wrapETH(srcToken).address.toLowerCase(), this.dexHelper.config.wrapETH(destToken).address.toLowerCase(), blockNumber)).map(p => this.getPoolIdentifier(p));
95
- }
96
- getPoolIdentifier(poolAddress) {
97
- return `${this.dexKey}_${poolAddress}`;
98
- }
99
- // Returns pool prices for amounts.
100
- // If limitPools is defined only pools in limitPools
101
- // should be used. If limitPools is undefined then
102
- // any pools can be used.
103
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
104
- if (!this.pools) {
105
- this.logger.error(`Missing pools for ${this.dexKey} in getPricesVolume`);
106
- return null;
107
- }
108
- const srcTokenAddress = this.dexHelper.config
109
- .wrapETH(srcToken)
110
- .address.toLowerCase();
111
- const destTokenAddress = this.dexHelper.config
112
- .wrapETH(destToken)
113
- .address.toLowerCase();
114
- if (srcTokenAddress === destTokenAddress)
115
- return null;
116
- const pools = (await this.findPools(srcTokenAddress, destTokenAddress, blockNumber)).filter(poolAddress => !limitPools || limitPools.includes(this.getPoolIdentifier(poolAddress)));
117
- const promises = [];
118
- for (const poolAddress of pools) {
119
- let state = await this.pools[poolAddress].getState(blockNumber);
120
- if (!state) {
121
- this.logger.warn(`State of pool ${poolAddress} is null in getPricesVolume, skipping...`);
122
- continue;
123
- }
124
- const [unit, ...prices] = this.computePrices(srcTokenAddress, destTokenAddress, [(0, utils_1.getBigIntPow)(srcToken.decimals), ...amounts], side, state.value);
125
- promises.push({
126
- prices,
127
- unit,
128
- data: {
129
- exchange: poolAddress,
130
- },
131
- poolAddresses: [poolAddress],
132
- exchange: this.dexKey,
133
- /** @todo specify gas cost */
134
- gasCost: 260 * 1000,
135
- poolIdentifier: this.getPoolIdentifier(poolAddress),
136
- });
137
- }
138
- return await Promise.all(promises);
139
- }
140
- // take PoolState to compute price
141
- computePrices(srcTokenAddress, destTokenAddress, amounts, side, state) {
142
- const srcAsset = state.asset[srcTokenAddress];
143
- const destAsset = state.asset[destTokenAddress];
144
- const quoter = new wombat_quoter_1.WombatQuoter(state.params);
145
- return amounts.map(fromAmount => {
146
- return side === core_1.SwapSide.SELL
147
- ? quoter.getQuote(srcAsset, destAsset, fromAmount)
148
- : quoter.getQuote(destAsset, srcAsset, -fromAmount);
149
- });
150
- }
151
- async findPools(srcTokenAddress, destTokenAddress, blockNumber) {
152
- const pools = [];
153
- for (const [poolAddress, pool] of Object.entries(this.pools)) {
154
- let stateOj = await pool.getState(blockNumber);
155
- if (!stateOj) {
156
- this.logger.warn(`State of pool ${poolAddress} is null in findPools, skipping...`);
157
- continue;
158
- }
159
- const state = stateOj.value;
160
- if (state &&
161
- !state.params.paused &&
162
- state.asset[srcTokenAddress] &&
163
- state.asset[destTokenAddress]) {
164
- pools.push(poolAddress);
165
- }
166
- }
167
- return pools;
168
- }
169
- // Returns estimated gas cost of calldata for this DEX in multiSwap
170
- getCalldataGasCost(poolPrices) {
171
- // TODO: update if there is any payload in getAdapterParam
172
- return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
173
- }
174
- getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
175
- const { exchange } = data;
176
- return {
177
- targetExchange: exchange,
178
- payload: '0x',
179
- networkFee: '0',
180
- };
181
- }
182
- // Encode call data used by simpleSwap like routers
183
- // Used for simpleSwap & simpleBuy
184
- // Hint: this.buildSimpleParamWithoutWETHConversion
185
- // could be useful
186
- async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
187
- const { exchange } = data;
188
- // Encode here the transaction arguments
189
- const swapData = Wombat.poolInterface.encodeFunctionData('swap', [
190
- srcToken,
191
- destToken,
192
- srcAmount,
193
- destAmount,
194
- this.augustusAddress,
195
- (0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(),
196
- ]);
197
- return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, exchange);
198
- }
199
- // This is called once before getTopPoolsForToken is
200
- // called for multiple tokens. This can be helpful to
201
- // update common state required for calculating
202
- // getTopPoolsForToken. For example, poolLiquidityUSD.
203
- async updatePoolState() {
204
- const blockNumber = await this.dexHelper.provider.getBlockNumber();
205
- await this.init(blockNumber);
206
- const bmwState = this.bmw.getState(blockNumber);
207
- if (!bmwState) {
208
- throw new Error('updatePoolState: bmwState still null after init');
209
- }
210
- // All tokens are USD stablecoins so to estimate liquidity can just add
211
- // the cash balances of all the tokens
212
- const poolLiquidityUSD = {};
213
- const usdPromises = [];
214
- const poolStates = {};
215
- const poolStateObjs = await Promise.all(Object.values(this.pools).map(pool => pool.getState()));
216
- for (const [poolAddress, pool] of Object.entries(this.pools)) {
217
- const index = Object.keys(this.pools).indexOf(poolAddress);
218
- let state = poolStateObjs[index];
219
- if (!state) {
220
- this.logger.warn(`State of ${poolAddress} is null in updatePoolState, skipping...`);
221
- continue;
222
- }
223
- poolStates[poolAddress] = state.value;
224
- for (const [tokenAddress, assetState] of Object.entries(state.value.asset)) {
225
- usdPromises.push(this.dexHelper.getTokenUSDPrice({
226
- address: tokenAddress,
227
- decimals: assetState.underlyingTokenDecimals,
228
- }, (0, utils_2.fromWad)(assetState.cash, BigInt(assetState.underlyingTokenDecimals))));
229
- }
230
- }
231
- const usdValues = await Promise.all(usdPromises);
232
- for (const [poolAddress, poolState] of Object.entries(poolStates)) {
233
- poolLiquidityUSD[poolAddress] = 0;
234
- for (let i = 0; i < poolState.underlyingAddresses.length; i++) {
235
- poolLiquidityUSD[poolAddress] += usdValues[i];
236
- }
237
- }
238
- this.poolLiquidityUSD = poolLiquidityUSD;
239
- }
240
- // Returns list of top pools based on liquidity. Max
241
- // limit number pools should be returned.
242
- async getTopPoolsForToken(tokenAddress, limit) {
243
- if (!this.poolLiquidityUSD)
244
- await this.updatePoolState();
245
- tokenAddress = ((0, utils_1.isETHAddress)(tokenAddress)
246
- ? this.dexHelper.config.data.wrappedNativeTokenAddress
247
- : tokenAddress).toLowerCase();
248
- const pools = [];
249
- const poolStates = {};
250
- for (const [poolAddress, eventPool] of Object.entries(this.pools)) {
251
- let state = await eventPool.getState();
252
- if (!state) {
253
- this.logger.warn(`State of ${poolAddress} is null in getTopPoolsForToken, skipping...`);
254
- continue;
255
- }
256
- if (state.value.underlyingAddresses.includes(tokenAddress) &&
257
- this.poolLiquidityUSD[poolAddress]) {
258
- poolStates[poolAddress] = state.value;
259
- pools.push(poolAddress);
260
- }
261
- }
262
- // sort by liquidity
263
- pools.sort((a, b) => this.poolLiquidityUSD[b] - this.poolLiquidityUSD[a]);
264
- return pools.slice(0, limit).map(poolAddress => ({
265
- exchange: this.dexKey,
266
- address: poolAddress,
267
- // other tokens in the same pool
268
- connectorTokens: poolStates[poolAddress].underlyingAddresses
269
- .filter(t => t !== tokenAddress)
270
- .map(t => ({
271
- decimals: poolStates[poolAddress].asset[t].underlyingTokenDecimals,
272
- address: t,
273
- })),
274
- liquidityUSD: this.poolLiquidityUSD[poolAddress],
275
- }));
276
- }
277
- // This is optional function in case if your implementation has acquired any resources
278
- // you need to release for graceful shutdown. For example, it may be any interval timer
279
- releaseResources() {
280
- // TODO: complete me!
281
- }
282
- }
283
- exports.Wombat = Wombat;
284
- // export class Wombat implements IDex<WombatData> {
285
- // contract interfaces
286
- Wombat.erc20Interface = new abi_1.Interface(erc20_json_1.default);
287
- Wombat.poolInterface = new abi_1.Interface(pool_json_1.default);
288
- Wombat.assetInterface = new abi_1.Interface(asset_json_1.default);
289
- Wombat.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.WombatConfig);
290
- //# sourceMappingURL=wombat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wombat.js","sourceRoot":"","sources":["../../../src/dex/wombat/wombat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4CAA+C;AAC/C,yCAA0C;AAa1C,2EAA6D;AAC7D,uCAAgF;AAIhF,wDAG4B;AAC5B,qCAAkD;AAClD,2EAAiD;AACjD,6EAAmD;AACnD,sEAA4C;AAC5C,mDAA+C;AAC/C,6CAAyC;AACzC,mCAAkC;AAClC,+CAA2C;AAE3C,MAAa,MAAO,SAAQ,gCAAc;IAwBxC,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACpB,WAAW,iBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAE5C,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QALhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QACpB,aAAQ,GAAR,QAAQ,CAA0B;QAlBvC,UAAK,GAA0C,EAAE,CAAC;QAEhD,iCAA4B,GAAG,KAAK,CAAC;QACrC,mBAAc,GAAG,IAAI,CAAC;QAEtB,6BAAwB,GAAG,KAAK,CAAC;QA+C1C,iBAAY,GAAG,KAAK,EAClB,IAAa,EACb,cAAqC,EACrC,WAAmB,EACJ,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CA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