@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,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.WombatConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.WombatConfig = {
6
- Wombat: {
7
- [constants_1.Network.BSC]: {
8
- bmwAddress: '0x489833311676B566f888119c29bd997Dc6C95830',
9
- },
10
- [constants_1.Network.ARBITRUM]: {
11
- bmwAddress: '0x62A83C6791A3d7950D823BB71a38e47252b6b6F4',
12
- },
13
- [constants_1.Network.MAINNET]: {
14
- bmwAddress: '0xC9bFC3eFeFe4CF96877009F75a61F5c1937e5d1a',
15
- },
16
- [constants_1.Network.AVALANCHE]: {
17
- bmwAddress: '0x6521a549834F5E6d253CD2e5F4fbe4048f86cd7b',
18
- },
19
- [constants_1.Network.BASE]: {
20
- bmwAddress: '0x6521a549834F5E6d253CD2e5F4fbe4048f86cd7b',
21
- },
22
- // [Network.OPTIMISM]: {
23
- // bmwAddress: '0x82E62f4e174E3C5e1641Df670c91Ac6Ab8541518',
24
- // },
25
- },
26
- };
27
- exports.Adapters = {
28
- [constants_1.Network.BSC]: {
29
- [constants_1.SwapSide.SELL]: [
30
- {
31
- name: 'BscAdapter02',
32
- index: 7,
33
- },
34
- ],
35
- // [SwapSide.BUY]: [
36
- // {
37
- // name: 'BscBuyAdapter',
38
- // index: 1,
39
- // },
40
- // ],
41
- },
42
- [constants_1.Network.ARBITRUM]: {
43
- [constants_1.SwapSide.SELL]: [
44
- {
45
- name: 'ArbitrumAdapter02',
46
- index: 7,
47
- },
48
- ],
49
- // [SwapSide.BUY]: [
50
- // {
51
- // name: 'ArbitrumBuyAdapter',
52
- // index: 1,
53
- // },
54
- // ],
55
- },
56
- [constants_1.Network.MAINNET]: {
57
- [constants_1.SwapSide.SELL]: [
58
- {
59
- name: 'Adapter04',
60
- index: 6,
61
- },
62
- ],
63
- // [SwapSide.BUY]: [
64
- // {
65
- // name: 'BscBuyAdapter',
66
- // index: 1,
67
- // },
68
- // ],
69
- },
70
- [constants_1.Network.AVALANCHE]: {
71
- [constants_1.SwapSide.SELL]: [
72
- {
73
- name: 'AvalancheAdapter02',
74
- index: 7,
75
- },
76
- ],
77
- // [SwapSide.BUY]: [
78
- // {
79
- // name: 'BscBuyAdapter',
80
- // index: 1,
81
- // },
82
- // ],
83
- },
84
- [constants_1.Network.BASE]: {
85
- [constants_1.SwapSide.SELL]: [
86
- {
87
- name: 'BaseAdapter01',
88
- index: 7,
89
- },
90
- ],
91
- // [SwapSide.BUY]: [
92
- // {
93
- // name: 'BscBuyAdapter',
94
- // index: 1,
95
- // },
96
- // ],
97
- },
98
- };
99
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/wombat/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,YAAY,GAA4B;IACnD,MAAM,EAAE;QACN,CAAC,mBAAO,CAAC,GAAG,CAAC,EAAE;YACb,UAAU,EAAE,4CAA4C;SACzD;QACD,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,UAAU,EAAE,4CAA4C;SACzD;QACD,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,UAAU,EAAE,4CAA4C;SACzD;QACD,CAAC,mBAAO,CAAC,SAAS,CAAC,EAAE;YACnB,UAAU,EAAE,4CAA4C;SACzD;QACD,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;YACd,UAAU,EAAE,4C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;QAChB,OAAO;QACP,KAAK;KACN;CACF,CAAC"}
@@ -1,33 +0,0 @@
1
- import { Address } from '../../types';
2
- export declare type BmwState = {
3
- pools: Address[];
4
- };
5
- export declare type PoolState = {
6
- params: PoolParams;
7
- underlyingAddresses: Address[];
8
- asset: {
9
- [underlyingAddress: string]: AssetState;
10
- };
11
- };
12
- export declare type AssetState = {
13
- address: Address;
14
- paused: boolean;
15
- cash: bigint;
16
- liability: bigint;
17
- underlyingTokenDecimals: number;
18
- relativePrice?: bigint;
19
- };
20
- export declare type PoolParams = {
21
- paused: boolean;
22
- ampFactor: bigint;
23
- haircutRate: bigint;
24
- startCovRatio: bigint;
25
- endCovRatio: bigint;
26
- };
27
- export declare type WombatData = {
28
- exchange: Address;
29
- };
30
- export declare type DexParams = {
31
- bmwAddress: Address;
32
- };
33
- export declare type MulticallResultOutputs = boolean | bigint | Address | number | undefined;
@@ -1,9 +0,0 @@
1
- import { MultiResult } from '../../lib/multi-wrapper';
2
- import { BytesLike } from 'ethers/lib/utils';
3
- export declare const WAD: bigint;
4
- export declare function wmul(x: bigint, y: bigint): bigint;
5
- export declare function wdiv(x: bigint, y: bigint): bigint;
6
- export declare function toWad(x: bigint, d: bigint): bigint;
7
- export declare function fromWad(x: bigint, d: bigint): bigint;
8
- export declare function sqrt(y: bigint, guess: bigint): bigint;
9
- export declare const uint120ToBigInt: (result: MultiResult<BytesLike> | BytesLike) => bigint;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uint120ToBigInt = exports.sqrt = exports.fromWad = exports.toWad = exports.wdiv = exports.wmul = exports.WAD = void 0;
4
- const bigint_constants_1 = require("../../bigint-constants");
5
- const decoders_1 = require("../../lib/decoders");
6
- exports.WAD = bigint_constants_1.BI_POWS[18];
7
- function wmul(x, y) {
8
- return (x * y + exports.WAD / 2n) / exports.WAD;
9
- }
10
- exports.wmul = wmul;
11
- function wdiv(x, y) {
12
- return (x * exports.WAD + y / 2n) / y;
13
- }
14
- exports.wdiv = wdiv;
15
- // Convert x to WAD (18 decimals) from d decimals.
16
- function toWad(x, d) {
17
- if (d < 18n) {
18
- return x * 10n ** (18n - d);
19
- }
20
- else if (d > 18n) {
21
- return x / 10n ** (d - 18n);
22
- }
23
- return x;
24
- }
25
- exports.toWad = toWad;
26
- // Convert x from WAD (18 decimals) to d decimals.
27
- function fromWad(x, d) {
28
- if (d < 18n) {
29
- return x / 10n ** (18n - d);
30
- }
31
- else if (d > 18n) {
32
- return x * 10n ** (d - 18n);
33
- }
34
- return x;
35
- }
36
- exports.fromWad = fromWad;
37
- // Babylonian Method with initial guess (typecast as int)
38
- function sqrt(y, guess) {
39
- let z = 0n;
40
- if (y > 3) {
41
- if (guess > 0 && guess <= y) {
42
- z = guess;
43
- }
44
- else if (guess < 0 && -guess <= y) {
45
- z = -guess;
46
- }
47
- else {
48
- z = y;
49
- }
50
- let x = (y / z + z) / 2n;
51
- while (x != z) {
52
- z = x;
53
- x = (y / x + x) / 2n;
54
- }
55
- }
56
- else if (y != 0n) {
57
- z = 1n;
58
- }
59
- return z;
60
- }
61
- exports.sqrt = sqrt;
62
- const uint120ToBigInt = (result) => {
63
- return (0, decoders_1.generalDecoder)(result, ['uint120'], 0n, value => value[0].toBigInt());
64
- };
65
- exports.uint120ToBigInt = uint120ToBigInt;
66
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/wombat/utils.ts"],"names":[],"mappings":";;;AAAA,6DAAiD;AAGjD,iDAAoD;AAEvC,QAAA,GAAG,GAAG,0BAAO,CAAC,EAAE,CAAC,CAAC;AAE/B,SAAgB,IAAI,CAAC,CAAS,EAAE,CAAS;IACvC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,WAAG,GAAG,EAAE,CAAC,GAAG,WAAG,CAAC;AAClC,CAAC;AAFD,oBAEC;AAED,SAAgB,IAAI,CAAC,CAAS,EAAE,CAAS;I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ACzB,OAAO,CAAC,IAAI,CAAC,EAAE;YACb,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;SACtB;KACF;SAAM,IAAI,CAAC,IAAI,EAAE,EAAE;QAClB,CAAC,GAAG,EAAE,CAAC;KACR;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AApBD,oBAoBC;AAEM,MAAM,eAAe,GAAG,CAC7B,MAA0C,EAClC,EAAE;IACV,OAAO,IAAA,yBAAc,EAAC,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC/E,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B"}
@@ -1,40 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { LogDescription } from 'ethers/lib/utils';
3
- import { DeepReadonly } from 'ts-essentials';
4
- import { Address, Log, Logger } from '../../types';
5
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
6
- import { IDexHelper } from '../../dex-helper';
7
- import { BmwState } from './types';
8
- export declare class WombatBmw extends StatefulEventSubscriber<BmwState> {
9
- protected network: number;
10
- protected dexHelper: IDexHelper;
11
- protected bmwAddress: Address;
12
- protected onAssetAdded: (pool: Address, asset2TokenMap: Map<Address, Address>, blockNumber: number) => Promise<void>;
13
- static readonly bmwInterface: Interface;
14
- static readonly assetInterface: Interface;
15
- static readonly poolInterface: Interface;
16
- private readonly logDecoder;
17
- private bmwContract;
18
- private handlers;
19
- constructor(dexKey: string, name: string, network: number, dexHelper: IDexHelper, logger: Logger, bmwAddress: Address, onAssetAdded: (pool: Address, asset2TokenMap: Map<Address, Address>, blockNumber: number) => Promise<void>);
20
- /**
21
- * The function is called every time any of the subscribed
22
- * addresses release log. The function accepts the current
23
- * state, updates the state according to the log, and returns
24
- * the updated state.
25
- * @param state - Current state of event subscriber
26
- * @param log - Log released by one of the subscribed addresses
27
- * @returns Updates state of the event subscriber after the log
28
- */
29
- protected processLog(state: DeepReadonly<BmwState>, log: Readonly<Log>): Promise<DeepReadonly<BmwState> | null>;
30
- /**
31
- * The function generates state using on-chain calls. This
32
- * function is called to regenerate state if the event based
33
- * system fails to fetch events and the local state is no
34
- * more correct.
35
- * should be generated
36
- * @returns state of the event subscriber at blocknumber
37
- */
38
- generateState(blockNumber: number): Promise<DeepReadonly<BmwState>>;
39
- handleAdd(event: LogDescription, state: DeepReadonly<BmwState>, log: Readonly<Log>): Promise<DeepReadonly<BmwState> | null>;
40
- }
@@ -1,147 +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.WombatBmw = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const utils_1 = require("../../utils");
9
- const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
10
- const bmw_json_1 = __importDefault(require("../../abi/wombat/bmw.json"));
11
- const asset_json_1 = __importDefault(require("../../abi/wombat/asset.json"));
12
- const pool_json_1 = __importDefault(require("../../abi/wombat/pool.json"));
13
- class WombatBmw extends stateful_event_subscriber_1.StatefulEventSubscriber {
14
- constructor(dexKey, name, network, dexHelper, logger, bmwAddress, onAssetAdded) {
15
- super(`${dexKey} ${name}`, `${dexKey}-${network} ${name}`, dexHelper, logger);
16
- this.network = network;
17
- this.dexHelper = dexHelper;
18
- this.bmwAddress = bmwAddress;
19
- this.onAssetAdded = onAssetAdded;
20
- this.handlers = {};
21
- this.logDecoder = (log) => WombatBmw.bmwInterface.parseLog(log);
22
- this.addressesSubscribed = [this.bmwAddress];
23
- this.bmwContract = new this.dexHelper.web3Provider.eth.Contract(bmw_json_1.default, this.bmwAddress);
24
- // users-actions handlers
25
- this.handlers['Add'] = this.handleAdd.bind(this);
26
- }
27
- /**
28
- * The function is called every time any of the subscribed
29
- * addresses release log. The function accepts the current
30
- * state, updates the state according to the log, and returns
31
- * the updated state.
32
- * @param state - Current state of event subscriber
33
- * @param log - Log released by one of the subscribed addresses
34
- * @returns Updates state of the event subscriber after the log
35
- */
36
- async processLog(state, log) {
37
- try {
38
- const event = this.logDecoder(log);
39
- if (event.name in this.handlers) {
40
- return await this.handlers[event.name](event, state, log);
41
- }
42
- }
43
- catch (e) {
44
- (0, utils_1.catchParseLogError)(e, this.logger);
45
- }
46
- return null;
47
- }
48
- /**
49
- * The function generates state using on-chain calls. This
50
- * function is called to regenerate state if the event based
51
- * system fails to fetch events and the local state is no
52
- * more correct.
53
- * should be generated
54
- * @returns state of the event subscriber at blocknumber
55
- */
56
- async generateState(blockNumber) {
57
- const bmwState = { pools: [] };
58
- let inputs = [];
59
- const poolLength = await this.bmwContract.methods
60
- .poolLength()
61
- .call({}, blockNumber);
62
- for (let i = 0; i < poolLength; i++) {
63
- inputs.push({
64
- target: this.bmwAddress,
65
- callData: WombatBmw.bmwInterface.encodeFunctionData('poolInfo', [i]),
66
- });
67
- }
68
- let returnData = (await this.dexHelper.multiContract.methods
69
- .aggregate(inputs)
70
- .call({}, blockNumber)).returnData;
71
- const lpTokens = returnData.map((data) => WombatBmw.bmwInterface
72
- .decodeFunctionResult('poolInfo', data)[0]
73
- .toLowerCase());
74
- inputs = [];
75
- for (const lpToken of lpTokens) {
76
- inputs.push({
77
- target: lpToken,
78
- callData: WombatBmw.assetInterface.encodeFunctionData('underlyingToken'),
79
- });
80
- inputs.push({
81
- target: lpToken,
82
- callData: WombatBmw.assetInterface.encodeFunctionData('pool'),
83
- });
84
- }
85
- returnData = (await this.dexHelper.multiContract.methods
86
- .aggregate(inputs)
87
- .call({}, blockNumber)).returnData;
88
- const pool2AssetInfo = new Map();
89
- let i = 0;
90
- for (const lpToken of lpTokens) {
91
- const underlyingToken = WombatBmw.assetInterface
92
- .decodeFunctionResult('underlyingToken', returnData[i++])[0]
93
- .toLowerCase();
94
- const pool = WombatBmw.assetInterface
95
- .decodeFunctionResult('pool', returnData[i++])[0]
96
- .toLowerCase();
97
- if (!pool2AssetInfo.has(pool)) {
98
- pool2AssetInfo.set(pool, new Map());
99
- }
100
- pool2AssetInfo.get(pool).set(lpToken, underlyingToken);
101
- }
102
- const promises = [];
103
- pool2AssetInfo.forEach((asset2TokenMap, pool) => {
104
- bmwState.pools.push(pool);
105
- promises.push(this.onAssetAdded(pool, asset2TokenMap, blockNumber));
106
- });
107
- await Promise.all(promises);
108
- return bmwState;
109
- }
110
- async handleAdd(event, state, log) {
111
- const lpToken = event.args.lpToken.toString().toLowerCase();
112
- let multiCallInputs = [];
113
- multiCallInputs.push({
114
- target: lpToken,
115
- callData: WombatBmw.assetInterface.encodeFunctionData('pool'),
116
- });
117
- multiCallInputs.push({
118
- target: lpToken,
119
- callData: WombatBmw.assetInterface.encodeFunctionData('underlyingToken'),
120
- });
121
- const returnData = (await this.dexHelper.multiContract.methods
122
- .aggregate(multiCallInputs)
123
- .call({}, log.blockNumber)).returnData;
124
- const pool = WombatBmw.assetInterface
125
- .decodeFunctionResult('pool', returnData[0])[0]
126
- .toLowerCase();
127
- const underlyingToken = WombatBmw.assetInterface
128
- .decodeFunctionResult('underlyingToken', returnData[1])[0]
129
- .toLowerCase();
130
- await this.onAssetAdded(pool, new Map().set(lpToken, underlyingToken), log.blockNumber);
131
- if (!state.pools.includes(pool)) {
132
- return {
133
- pools: [...state.pools, pool],
134
- };
135
- }
136
- else {
137
- return {
138
- pools: state.pools,
139
- };
140
- }
141
- }
142
- }
143
- exports.WombatBmw = WombatBmw;
144
- WombatBmw.bmwInterface = new abi_1.Interface(bmw_json_1.default);
145
- WombatBmw.assetInterface = new abi_1.Interface(asset_json_1.default);
146
- WombatBmw.poolInterface = new abi_1.Interface(pool_json_1.default);
147
- //# sourceMappingURL=wombat-bmw.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wombat-bmw.js","sourceRoot":"","sources":["../../../src/dex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CAAC;aACzD,WAAW,EAAE,CAAC;QAEjB,MAAM,IAAI,CAAC,YAAY,CACrB,IAAI,EACJ,IAAI,GAAG,EAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,eAAe,CAAC,EACzD,GAAG,CAAC,WAAW,CAChB,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC/B,OAAO;gBACL,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;aAC9B,CAAC;SACH;aAAM;YACL,OAAO;gBACL,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC;SACH;IACH,CAAC;;AAjMH,8BAkMC;AAjMiB,sBAAY,GAAG,IAAI,eAAS,CAAC,kBAAM,CAAC,CAAC;AACrC,wBAAc,GAAG,IAAI,eAAS,CAAC,oBAAQ,CAAC,CAAC;AACzC,uBAAa,GAAG,IAAI,eAAS,CAAC,mBAAO,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { Address } from '@paraswap/core';
3
- import { MultiCallParams, MultiResult } from '../../lib/multi-wrapper';
4
- import { IDexHelper } from '../../dex-helper';
5
- import { StatefulRpcPoller } from '../../lib/stateful-rpc-poller/stateful-rpc-poller';
6
- import { ObjWithUpdateInfo } from '../../lib/stateful-rpc-poller/types';
7
- import { MulticallResultOutputs, PoolState } from './types';
8
- export declare class WombatPool extends StatefulRpcPoller<PoolState, MulticallResultOutputs> {
9
- protected poolAddress: Address;
10
- protected asset2TokenMap: Map<Address, Address>;
11
- static readonly poolInterface: Interface;
12
- static readonly assetInterface: Interface;
13
- constructor(dexKey: string, poolIdentifier: string, dexHelper: IDexHelper, poolAddress: Address, asset2TokenMap: Map<Address, Address>);
14
- protected _getFetchStateMultiCalls(): MultiCallParams<MulticallResultOutputs>[];
15
- protected _parseStateFromMultiResults(multiOutputs: MulticallResultOutputs[]): PoolState;
16
- fetchLatestStateFromRpc(): Promise<ObjWithUpdateInfo<PoolState> | null>;
17
- parseStateFromMultiResultsWithBlockInfo(multiOutputs: [
18
- MultiResult<number>,
19
- ...MultiResult<MulticallResultOutputs>[]
20
- ], lastUpdatedAtMs: number): ObjWithUpdateInfo<PoolState>;
21
- addAssets(asset2TokenMap: Map<Address, Address>): void;
22
- }
@@ -1,161 +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.WombatPool = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const stateful_rpc_poller_1 = require("../../lib/stateful-rpc-poller/stateful-rpc-poller");
10
- const state_polling_manager_1 = require("../../lib/stateful-rpc-poller/state-polling-manager");
11
- const utils_1 = require("../../lib/stateful-rpc-poller/utils");
12
- const decoders_1 = require("../../lib/decoders");
13
- const pool_json_1 = __importDefault(require("../../abi/wombat/pool.json"));
14
- const asset_json_1 = __importDefault(require("../../abi/wombat/asset.json"));
15
- const utils_2 = require("./utils");
16
- class WombatPool extends stateful_rpc_poller_1.StatefulRpcPoller {
17
- constructor(dexKey, poolIdentifier, dexHelper, poolAddress, asset2TokenMap) {
18
- const callbacks = (0, utils_1.pollingManagerCbExtractor)(state_polling_manager_1.StatePollingManager.getInstance(dexHelper));
19
- super(dexKey, poolIdentifier, dexHelper, 0, 0, false, callbacks);
20
- this.poolAddress = poolAddress;
21
- this.asset2TokenMap = asset2TokenMap;
22
- }
23
- _getFetchStateMultiCalls() {
24
- const params = [];
25
- params.push({
26
- target: this.poolAddress,
27
- callData: WombatPool.poolInterface.encodeFunctionData('paused'),
28
- decodeFunction: decoders_1.booleanDecode,
29
- });
30
- params.push({
31
- target: this.poolAddress,
32
- callData: WombatPool.poolInterface.encodeFunctionData('ampFactor'),
33
- decodeFunction: decoders_1.uint256ToBigInt,
34
- });
35
- params.push({
36
- target: this.poolAddress,
37
- callData: WombatPool.poolInterface.encodeFunctionData('haircutRate'),
38
- decodeFunction: decoders_1.uint256ToBigInt,
39
- });
40
- params.push({
41
- target: this.poolAddress,
42
- callData: WombatPool.poolInterface.encodeFunctionData('startCovRatio'),
43
- decodeFunction: decoders_1.uint256ToBigInt,
44
- });
45
- params.push({
46
- target: this.poolAddress,
47
- callData: WombatPool.poolInterface.encodeFunctionData('endCovRatio'),
48
- decodeFunction: decoders_1.uint256ToBigInt,
49
- });
50
- params.push({
51
- target: this.poolAddress,
52
- callData: WombatPool.poolInterface.encodeFunctionData('getTokens'),
53
- decodeFunction: decoders_1.addressArrayDecode,
54
- });
55
- this.asset2TokenMap.forEach((token, asset) => {
56
- params.push({
57
- target: this.poolAddress,
58
- callData: WombatPool.poolInterface.encodeFunctionData('isPaused', [
59
- token,
60
- ]),
61
- decodeFunction: decoders_1.booleanDecode,
62
- });
63
- params.push({
64
- target: asset,
65
- callData: WombatPool.assetInterface.encodeFunctionData('cash'),
66
- decodeFunction: utils_2.uint120ToBigInt,
67
- });
68
- params.push({
69
- target: asset,
70
- callData: WombatPool.assetInterface.encodeFunctionData('liability'),
71
- decodeFunction: utils_2.uint120ToBigInt,
72
- });
73
- params.push({
74
- target: asset,
75
- callData: WombatPool.assetInterface.encodeFunctionData('underlyingTokenDecimals'),
76
- decodeFunction: decoders_1.uint8ToNumber,
77
- });
78
- params.push({
79
- target: asset,
80
- callData: WombatPool.assetInterface.encodeFunctionData('getRelativePrice'),
81
- decodeFunction: decoders_1.uint256ToBigInt,
82
- });
83
- });
84
- return params;
85
- }
86
- _parseStateFromMultiResults(multiOutputs) {
87
- const [paused, ampFactor, haircutRate, startCovRatio, endCovRatio, tokens, ...remained] = multiOutputs;
88
- const assetTokenArray = Array.from(this.asset2TokenMap.entries());
89
- const token2AssetStates = new Map();
90
- lodash_1.default.chunk(remained, 5).forEach((chunk, i) => {
91
- const [paused, cash, liability, underlyingTokenDecimals, relativePrice] = chunk;
92
- const [asset, token] = assetTokenArray[i];
93
- token2AssetStates.set(token, {
94
- address: asset,
95
- paused,
96
- cash,
97
- liability,
98
- underlyingTokenDecimals,
99
- relativePrice,
100
- });
101
- });
102
- const poolState = {
103
- params: {
104
- paused,
105
- ampFactor,
106
- haircutRate,
107
- startCovRatio,
108
- endCovRatio,
109
- },
110
- underlyingAddresses: tokens,
111
- asset: {},
112
- };
113
- const isMainPool = Array.from(token2AssetStates.values()).filter(assetState => assetState.relativePrice === undefined).length > 0;
114
- for (const token of poolState.underlyingAddresses) {
115
- if (!token2AssetStates.has(token)) {
116
- // this happens when asset has been added to pool but is not added to BMW yet
117
- continue;
118
- }
119
- poolState.asset[token] = token2AssetStates.get(token);
120
- if (isMainPool) {
121
- poolState.asset[token].relativePrice = undefined;
122
- }
123
- }
124
- return poolState;
125
- }
126
- async fetchLatestStateFromRpc() {
127
- const multiCalls = this.getFetchStateWithBlockInfoMultiCalls();
128
- try {
129
- const lastUpdatedAtMs = Date.now();
130
- const aggregatedResults = (await this.dexHelper.multiWrapper.tryAggregate(false, multiCalls));
131
- return this.parseStateFromMultiResultsWithBlockInfo(aggregatedResults, lastUpdatedAtMs);
132
- }
133
- catch (e) {
134
- this._logMessageWithSuppression('ERROR_FETCHING_STATE_FROM_RPC', e);
135
- }
136
- return null;
137
- }
138
- parseStateFromMultiResultsWithBlockInfo(multiOutputs, lastUpdatedAtMs) {
139
- const [blockNumber, ...outputsForAbstract] = multiOutputs.map((m, i) => {
140
- return m.returnData;
141
- });
142
- return {
143
- value: this._parseStateFromMultiResults(outputsForAbstract),
144
- blockNumber,
145
- lastUpdatedAtMs,
146
- };
147
- }
148
- addAssets(asset2TokenMap) {
149
- for (const [asset, token] of asset2TokenMap) {
150
- if (this.asset2TokenMap.has(asset)) {
151
- continue;
152
- }
153
- this.asset2TokenMap.set(asset, token);
154
- this._cachedMultiCallData = undefined;
155
- }
156
- }
157
- }
158
- exports.WombatPool = WombatPool;
159
- WombatPool.poolInterface = new abi_1.Interface(pool_json_1.default);
160
- WombatPool.assetInterface = new abi_1.Interface(asset_json_1.default);
161
- //# sourceMappingURL=wombat-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wombat-pool.js","sourceRoot":"","sources":["../../../src/dex/wombat/wombat-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAE/C,oDAAuB;AAIvB,2FAAsF;AACtF,+FAA0F;AAE1F,+DAAgF;AAChF,iDAK4B;AAC5B,2EAAiD;AACjD,6EAAmD;AACnD,mCAA0C;AAG1C,MAAa,UAAW,SAAQ,uCAG/B;IAIC,YACE,MAAc,EACd,cAAsB,EACtB,SAAqB,EACX,WAAoB,EACpB,cAAqC;QAE/C,MAAM,SAAS,GAAG,IAAA,iCAAyB,EACzC,2CAAmB,CAAC,WAAW,CAAC,SAAS,CAAC,CAC3C,CAAC;QAEF,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAPvD,gBAAW,GAAX,WAAW,CAAS;QACpB,mBAAc,GAAd,cAAc,CAAuB;IAOjD,CAAC;IAES,wBAAwB;QAChC,MAAM,MAAM,GAA8C,EAAE,CAAC;QAE7D,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,kBAAkB,CAAC,QAAQ,CAAC;YAC/D,cAAc,EAAE,wBAAa;SAC9B,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,kBAAkB,CAAC,WAAW,CAAC;YAClE,cAAc,EAAE,0BAAe;SAChC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC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CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrE,OAAO,CAAC,CAAC,UAAU,CAAC;QACtB,CAAC,CAA0C,CAAC;QAE5C,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,2BAA2B,CAAC,kBAAkB,CAAC;YAC3D,WAAW;YACX,eAAe;SAChB,CAAC;IACJ,CAAC;IAEM,SAAS,CAAC,cAAqC;QACpD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,cAAc,EAAE;YAC3C,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBAClC,SAAS;aACV;YAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACtC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;SACvC;IACH,CAAC;;AAhNH,gCAiNC;AA7MiB,wBAAa,GAAG,IAAI,eAAS,CAAC,mBAAO,CAAC,CAAC;AACvC,yBAAc,GAAG,IAAI,eAAS,CAAC,oBAAQ,CAAC,CAAC"}
@@ -1,16 +0,0 @@
1
- import { AssetState, PoolParams } from './types';
2
- export declare class WombatQuoter {
3
- private readonly ampFactor;
4
- private readonly haircutRate;
5
- private readonly startCovRatio;
6
- private readonly endCovRatio;
7
- constructor(poolParams: PoolParams);
8
- getQuote(fromAsset: AssetState, toAsset: AssetState, fromAmount: bigint): bigint;
9
- private _highCovRatioPoolQuoteFrom;
10
- private _highCovRatioFee;
11
- private _quoteFrom;
12
- private _findUpperBound;
13
- private _quoteFactor;
14
- static solveQuad(b: bigint, c: bigint): bigint;
15
- static swapQuoteFunc(aX: bigint, aY: bigint, lX: bigint, lY: bigint, dX: bigint, a: bigint): bigint;
16
- }