@paraswap/dex-lib 2.37.2-current-fee-ramses-v2.4 → 2.37.3

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 (254) hide show
  1. package/build/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
  2. package/build/abi/uniswap-v3/UniswapV3Factory.abi.json +148 -0
  3. package/build/dex/algebra/algebra-factory.d.ts +25 -0
  4. package/build/dex/algebra/algebra-factory.js +43 -0
  5. package/build/dex/algebra/algebra-factory.js.map +1 -0
  6. package/build/dex/algebra/algebra.d.ts +3 -0
  7. package/build/dex/algebra/algebra.js +27 -5
  8. package/build/dex/algebra/algebra.js.map +1 -1
  9. package/build/dex/algebra/config.js +0 -1
  10. package/build/dex/algebra/config.js.map +1 -1
  11. package/build/dex/algebra/types.d.ts +1 -1
  12. package/build/dex/{woo-fi → hello}/config.d.ts +1 -1
  13. package/build/dex/hello/config.js +15 -0
  14. package/build/dex/hello/config.js.map +1 -0
  15. package/build/dex/hello/hello-pool.d.ts +39 -0
  16. package/build/dex/hello/hello-pool.js +64 -0
  17. package/build/dex/hello/hello-pool.js.map +1 -0
  18. package/build/dex/hello/hello.d.ts +37 -0
  19. package/build/dex/hello/hello.js +126 -0
  20. package/build/dex/hello/hello.js.map +1 -0
  21. package/build/dex/hello/types.d.ts +6 -0
  22. package/build/dex/{woo-fi → hello}/types.js.map +1 -1
  23. package/build/dex/index.js +7 -2
  24. package/build/dex/index.js.map +1 -1
  25. package/build/dex/{dexalot → my-test-dex}/config.d.ts +1 -1
  26. package/build/dex/my-test-dex/config.js +15 -0
  27. package/build/dex/my-test-dex/config.js.map +1 -0
  28. package/build/dex/my-test-dex/my-test-dex-pool.d.ts +39 -0
  29. package/build/dex/my-test-dex/my-test-dex-pool.js +64 -0
  30. package/build/dex/my-test-dex/my-test-dex-pool.js.map +1 -0
  31. package/build/dex/my-test-dex/my-test-dex.d.ts +37 -0
  32. package/build/dex/my-test-dex/my-test-dex.js +126 -0
  33. package/build/dex/my-test-dex/my-test-dex.js.map +1 -0
  34. package/build/dex/my-test-dex/types.d.ts +6 -0
  35. package/build/dex/{pancakeswap-v3 → my-test-dex}/types.js.map +1 -1
  36. package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.d.ts +26 -0
  37. package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js +44 -0
  38. package/build/dex/pancakeswap-v3/pancakeswap-v3-factory.js.map +1 -0
  39. package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +3 -0
  40. package/build/dex/pancakeswap-v3/pancakeswap-v3.js +26 -2
  41. package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
  42. package/build/dex/uniswap-v3/config.js +0 -2
  43. package/build/dex/uniswap-v3/config.js.map +1 -1
  44. package/build/dex/uniswap-v3/types.d.ts +1 -2
  45. package/build/dex/uniswap-v3/uniswap-v3-factory.d.ts +26 -0
  46. package/build/dex/uniswap-v3/uniswap-v3-factory.js +44 -0
  47. package/build/dex/uniswap-v3/uniswap-v3-factory.js.map +1 -0
  48. package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +5 -7
  49. package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
  50. package/build/dex/uniswap-v3/uniswap-v3.d.ts +3 -0
  51. package/build/dex/uniswap-v3/uniswap-v3.js +29 -9
  52. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  53. package/build/dex-helper/dummy-dex-helper.js +3 -0
  54. package/build/dex-helper/dummy-dex-helper.js.map +1 -1
  55. package/build/dex-helper/icache.d.ts +1 -0
  56. package/package.json +1 -1
  57. package/src/abi/pancakeswap-v3/PancakeswapV3Factory.abi.json +300 -0
  58. package/src/dex/algebra/algebra-factory.ts +70 -0
  59. package/src/dex/algebra/algebra.ts +47 -6
  60. package/src/dex/algebra/config.ts +0 -1
  61. package/src/dex/algebra/types.ts +2 -1
  62. package/src/dex/index.ts +6 -3
  63. package/src/dex/pancakeswap-v3/pancakeswap-v3-factory.ts +73 -0
  64. package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +50 -2
  65. package/src/dex/uniswap-v3/config.ts +0 -2
  66. package/src/dex/uniswap-v3/types.ts +2 -2
  67. package/src/dex/uniswap-v3/uniswap-v3-factory.ts +73 -0
  68. package/src/dex/uniswap-v3/uniswap-v3-pool.ts +4 -6
  69. package/src/dex/uniswap-v3/uniswap-v3.ts +67 -27
  70. package/src/dex-helper/dummy-dex-helper.ts +4 -0
  71. package/src/dex-helper/icache.ts +2 -0
  72. package/.idea/aws.xml +0 -17
  73. package/.idea/codeStyles/Project.xml +0 -19
  74. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  75. package/.idea/misc.xml +0 -6
  76. package/.idea/modules.xml +0 -8
  77. package/.idea/paraswap-dex-lib.iml +0 -9
  78. package/.idea/vcs.xml +0 -6
  79. package/build/abi/algebra/AlgebraPool.abi.json +0 -727
  80. package/build/abi/curve-v1/StableSwapFRXETH.json +0 -889
  81. package/build/abi/curve-v1/StableSwapWBETH.json +0 -1223
  82. package/build/abi/dexalot/DexalotMainnetRFQ.json +0 -887
  83. package/build/abi/ramses-v2/RamsesV2Pool.abi.json +0 -1580
  84. package/build/abi/sushiswap-v3/QuoterV2.json +0 -267
  85. package/build/abi/sushiswap-v3/RouterProcessor3.json +0 -289
  86. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  87. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +0 -285
  88. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +0 -583
  89. package/build/abi/wBETH.json +0 -1527
  90. package/build/abi/woo-fi/WooFeeManager.abi.json +0 -318
  91. package/build/abi/woo-fi/WooPP.abi.json +0 -548
  92. package/build/abi/woo-fi/Wooracle.abi.json +0 -260
  93. package/build/dex/aave-v3/tokens/arbitrum.json +0 -50
  94. package/build/dex/aave-v3/tokens/avalanche.json +0 -74
  95. package/build/dex/aave-v3/tokens/fantom.json +0 -62
  96. package/build/dex/aave-v3/tokens/optimism.json +0 -50
  97. package/build/dex/aave-v3/tokens/polygon.json +0 -116
  98. package/build/dex/algebra/algebra-pool.d.ts +0 -46
  99. package/build/dex/algebra/algebra-pool.js +0 -336
  100. package/build/dex/algebra/algebra-pool.js.map +0 -1
  101. package/build/dex/balancer-v2/LinearMath.d.ts +0 -19
  102. package/build/dex/balancer-v2/LinearMath.js +0 -179
  103. package/build/dex/balancer-v2/LinearMath.js.map +0 -1
  104. package/build/dex/balancer-v2/LinearPool.d.ts +0 -47
  105. package/build/dex/balancer-v2/LinearPool.js +0 -324
  106. package/build/dex/balancer-v2/LinearPool.js.map +0 -1
  107. package/build/dex/balancer-v2/PhantomStablePool.d.ts +0 -47
  108. package/build/dex/balancer-v2/PhantomStablePool.js +0 -294
  109. package/build/dex/balancer-v2/PhantomStablePool.js.map +0 -1
  110. package/build/dex/balancer-v2/StableMath.d.ts +0 -9
  111. package/build/dex/balancer-v2/StableMath.js +0 -272
  112. package/build/dex/balancer-v2/StableMath.js.map +0 -1
  113. package/build/dex/balancer-v2/balancer-v2-pool.d.ts +0 -75
  114. package/build/dex/balancer-v2/balancer-v2-pool.js +0 -417
  115. package/build/dex/balancer-v2/balancer-v2-pool.js.map +0 -1
  116. package/build/dex/curve-v1/pools/frxETHpool.d.ts +0 -7
  117. package/build/dex/curve-v1/pools/frxETHpool.js +0 -27
  118. package/build/dex/curve-v1/pools/frxETHpool.js.map +0 -1
  119. package/build/dex/curve-v1/pools/wbETHpool.d.ts +0 -29
  120. package/build/dex/curve-v1/pools/wbETHpool.js +0 -408
  121. package/build/dex/curve-v1/pools/wbETHpool.js.map +0 -1
  122. package/build/dex/dexalot/config.js +0 -18
  123. package/build/dex/dexalot/config.js.map +0 -1
  124. package/build/dex/dexalot/constants.d.ts +0 -15
  125. package/build/dex/dexalot/constants.js +0 -22
  126. package/build/dex/dexalot/constants.js.map +0 -1
  127. package/build/dex/dexalot/dexalot.d.ts +0 -69
  128. package/build/dex/dexalot/dexalot.js +0 -646
  129. package/build/dex/dexalot/dexalot.js.map +0 -1
  130. package/build/dex/dexalot/rate-fetcher.d.ts +0 -28
  131. package/build/dex/dexalot/rate-fetcher.js +0 -100
  132. package/build/dex/dexalot/rate-fetcher.js.map +0 -1
  133. package/build/dex/dexalot/types.d.ts +0 -114
  134. package/build/dex/dexalot/types.js +0 -12
  135. package/build/dex/dexalot/types.js.map +0 -1
  136. package/build/dex/dexalot/validators.d.ts +0 -5
  137. package/build/dex/dexalot/validators.js +0 -45
  138. package/build/dex/dexalot/validators.js.map +0 -1
  139. package/build/dex/pancakeswap-v3/types.d.ts +0 -14
  140. package/build/dex/quickswap/camelot-v3.d.ts +0 -6
  141. package/build/dex/quickswap/camelot-v3.js +0 -19
  142. package/build/dex/quickswap/camelot-v3.js.map +0 -1
  143. package/build/dex/quickswap/zyberswap-v3.d.ts +0 -6
  144. package/build/dex/quickswap/zyberswap-v3.js +0 -19
  145. package/build/dex/quickswap/zyberswap-v3.js.map +0 -1
  146. package/build/dex/quickswap-v3.d.ts +0 -21
  147. package/build/dex/quickswap-v3.js +0 -40
  148. package/build/dex/quickswap-v3.js.map +0 -1
  149. package/build/dex/ramses-v2/config.d.ts +0 -4
  150. package/build/dex/ramses-v2/config.js +0 -28
  151. package/build/dex/ramses-v2/config.js.map +0 -1
  152. package/build/dex/ramses-v2/constants.d.ts +0 -28
  153. package/build/dex/ramses-v2/constants.js +0 -35
  154. package/build/dex/ramses-v2/constants.js.map +0 -1
  155. package/build/dex/ramses-v2/contract-math/BitMath.d.ts +0 -4
  156. package/build/dex/ramses-v2/contract-math/BitMath.js +0 -93
  157. package/build/dex/ramses-v2/contract-math/BitMath.js.map +0 -1
  158. package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +0 -3
  159. package/build/dex/ramses-v2/contract-math/FixedPoint128.js +0 -8
  160. package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +0 -1
  161. package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +0 -4
  162. package/build/dex/ramses-v2/contract-math/FixedPoint96.js +0 -9
  163. package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +0 -1
  164. package/build/dex/ramses-v2/contract-math/FullMath.d.ts +0 -4
  165. package/build/dex/ramses-v2/contract-math/FullMath.js +0 -19
  166. package/build/dex/ramses-v2/contract-math/FullMath.js.map +0 -1
  167. package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +0 -3
  168. package/build/dex/ramses-v2/contract-math/LiquidityMath.js +0 -22
  169. package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +0 -1
  170. package/build/dex/ramses-v2/contract-math/Oracle.d.ts +0 -10
  171. package/build/dex/ramses-v2/contract-math/Oracle.js +0 -133
  172. package/build/dex/ramses-v2/contract-math/Oracle.js.map +0 -1
  173. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +0 -10
  174. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +0 -91
  175. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +0 -1
  176. package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +0 -8
  177. package/build/dex/ramses-v2/contract-math/SwapMath.js +0 -70
  178. package/build/dex/ramses-v2/contract-math/SwapMath.js.map +0 -1
  179. package/build/dex/ramses-v2/contract-math/Tick.d.ts +0 -7
  180. package/build/dex/ramses-v2/contract-math/Tick.js +0 -45
  181. package/build/dex/ramses-v2/contract-math/Tick.js.map +0 -1
  182. package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +0 -8
  183. package/build/dex/ramses-v2/contract-math/TickBitMap.js +0 -87
  184. package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +0 -1
  185. package/build/dex/ramses-v2/contract-math/TickMath.d.ts +0 -8
  186. package/build/dex/ramses-v2/contract-math/TickMath.js +0 -162
  187. package/build/dex/ramses-v2/contract-math/TickMath.js.map +0 -1
  188. package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +0 -3
  189. package/build/dex/ramses-v2/contract-math/UnsafeMath.js +0 -10
  190. package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +0 -1
  191. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +0 -18
  192. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +0 -392
  193. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +0 -1
  194. package/build/dex/ramses-v2/contract-math/utils.d.ts +0 -3
  195. package/build/dex/ramses-v2/contract-math/utils.js +0 -16
  196. package/build/dex/ramses-v2/contract-math/utils.js.map +0 -1
  197. package/build/dex/ramses-v2/ramses-v2-pool.d.ts +0 -42
  198. package/build/dex/ramses-v2/ramses-v2-pool.js +0 -307
  199. package/build/dex/ramses-v2/ramses-v2-pool.js.map +0 -1
  200. package/build/dex/ramses-v2/ramses-v2.d.ts +0 -61
  201. package/build/dex/ramses-v2/ramses-v2.js +0 -690
  202. package/build/dex/ramses-v2/ramses-v2.js.map +0 -1
  203. package/build/dex/ramses-v2/types.d.ts +0 -154
  204. package/build/dex/ramses-v2/types.js +0 -9
  205. package/build/dex/ramses-v2/types.js.map +0 -1
  206. package/build/dex/ramses-v2/utils.d.ts +0 -6
  207. package/build/dex/ramses-v2/utils.js +0 -71
  208. package/build/dex/ramses-v2/utils.js.map +0 -1
  209. package/build/dex/sushiswap-v3/config.d.ts +0 -4
  210. package/build/dex/sushiswap-v3/config.js +0 -132
  211. package/build/dex/sushiswap-v3/config.js.map +0 -1
  212. package/build/dex/sushiswap-v3/constants.d.ts +0 -4
  213. package/build/dex/sushiswap-v3/constants.js +0 -32
  214. package/build/dex/sushiswap-v3/constants.js.map +0 -1
  215. package/build/dex/sushiswap-v3/sushiswap-v3-original.d.ts +0 -56
  216. package/build/dex/sushiswap-v3/sushiswap-v3-original.js +0 -598
  217. package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +0 -1
  218. package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +0 -1
  219. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +0 -6
  220. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +0 -1
  221. package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +0 -21
  222. package/build/dex/sushiswap-v3/sushiswap-v3.js +0 -58
  223. package/build/dex/sushiswap-v3/sushiswap-v3.js.map +0 -1
  224. package/build/dex/sushiswap-v3/token.d.ts +0 -6
  225. package/build/dex/sushiswap-v3/token.js +0 -23
  226. package/build/dex/sushiswap-v3/token.js.map +0 -1
  227. package/build/dex/sushiswap-v3/types.d.ts +0 -15
  228. package/build/dex/sushiswap-v3/types.js +0 -18
  229. package/build/dex/sushiswap-v3/types.js.map +0 -1
  230. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +0 -12
  231. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +0 -23
  232. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +0 -1
  233. package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.d.ts +0 -7
  234. package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js +0 -87
  235. package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js.map +0 -1
  236. package/build/dex/woo-fi/config.js +0 -141
  237. package/build/dex/woo-fi/config.js.map +0 -1
  238. package/build/dex/woo-fi/constants.d.ts +0 -5
  239. package/build/dex/woo-fi/constants.js +0 -20
  240. package/build/dex/woo-fi/constants.js.map +0 -1
  241. package/build/dex/woo-fi/types.d.ts +0 -48
  242. package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +0 -14
  243. package/build/dex/woo-fi/woo-fi-decimal-math.js +0 -42
  244. package/build/dex/woo-fi/woo-fi-decimal-math.js.map +0 -1
  245. package/build/dex/woo-fi/woo-fi-math.d.ts +0 -31
  246. package/build/dex/woo-fi/woo-fi-math.js +0 -300
  247. package/build/dex/woo-fi/woo-fi-math.js.map +0 -1
  248. package/build/dex/woo-fi/woo-fi.d.ts +0 -65
  249. package/build/dex/woo-fi/woo-fi.js +0 -480
  250. package/build/dex/woo-fi/woo-fi.js.map +0 -1
  251. package/src/abi/ramses-v2/RamsesV2Pool.abi.json +0 -1580
  252. package/src/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.ts +0 -104
  253. /package/build/dex/{pancakeswap-v3 → hello}/types.js +0 -0
  254. /package/build/dex/{woo-fi → my-test-dex}/types.js +0 -0
@@ -0,0 +1,300 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ { "internalType": "address", "name": "_poolDeployer", "type": "address" }
5
+ ],
6
+ "stateMutability": "nonpayable",
7
+ "type": "constructor"
8
+ },
9
+ {
10
+ "anonymous": false,
11
+ "inputs": [
12
+ {
13
+ "indexed": true,
14
+ "internalType": "uint24",
15
+ "name": "fee",
16
+ "type": "uint24"
17
+ },
18
+ {
19
+ "indexed": true,
20
+ "internalType": "int24",
21
+ "name": "tickSpacing",
22
+ "type": "int24"
23
+ }
24
+ ],
25
+ "name": "FeeAmountEnabled",
26
+ "type": "event"
27
+ },
28
+ {
29
+ "anonymous": false,
30
+ "inputs": [
31
+ {
32
+ "indexed": true,
33
+ "internalType": "uint24",
34
+ "name": "fee",
35
+ "type": "uint24"
36
+ },
37
+ {
38
+ "indexed": false,
39
+ "internalType": "bool",
40
+ "name": "whitelistRequested",
41
+ "type": "bool"
42
+ },
43
+ {
44
+ "indexed": false,
45
+ "internalType": "bool",
46
+ "name": "enabled",
47
+ "type": "bool"
48
+ }
49
+ ],
50
+ "name": "FeeAmountExtraInfoUpdated",
51
+ "type": "event"
52
+ },
53
+ {
54
+ "anonymous": false,
55
+ "inputs": [
56
+ {
57
+ "indexed": true,
58
+ "internalType": "address",
59
+ "name": "oldOwner",
60
+ "type": "address"
61
+ },
62
+ {
63
+ "indexed": true,
64
+ "internalType": "address",
65
+ "name": "newOwner",
66
+ "type": "address"
67
+ }
68
+ ],
69
+ "name": "OwnerChanged",
70
+ "type": "event"
71
+ },
72
+ {
73
+ "anonymous": false,
74
+ "inputs": [
75
+ {
76
+ "indexed": true,
77
+ "internalType": "address",
78
+ "name": "token0",
79
+ "type": "address"
80
+ },
81
+ {
82
+ "indexed": true,
83
+ "internalType": "address",
84
+ "name": "token1",
85
+ "type": "address"
86
+ },
87
+ {
88
+ "indexed": true,
89
+ "internalType": "uint24",
90
+ "name": "fee",
91
+ "type": "uint24"
92
+ },
93
+ {
94
+ "indexed": false,
95
+ "internalType": "int24",
96
+ "name": "tickSpacing",
97
+ "type": "int24"
98
+ },
99
+ {
100
+ "indexed": false,
101
+ "internalType": "address",
102
+ "name": "pool",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "name": "PoolCreated",
107
+ "type": "event"
108
+ },
109
+ {
110
+ "anonymous": false,
111
+ "inputs": [
112
+ {
113
+ "indexed": true,
114
+ "internalType": "address",
115
+ "name": "lmPoolDeployer",
116
+ "type": "address"
117
+ }
118
+ ],
119
+ "name": "SetLmPoolDeployer",
120
+ "type": "event"
121
+ },
122
+ {
123
+ "anonymous": false,
124
+ "inputs": [
125
+ {
126
+ "indexed": true,
127
+ "internalType": "address",
128
+ "name": "user",
129
+ "type": "address"
130
+ },
131
+ {
132
+ "indexed": false,
133
+ "internalType": "bool",
134
+ "name": "verified",
135
+ "type": "bool"
136
+ }
137
+ ],
138
+ "name": "WhiteListAdded",
139
+ "type": "event"
140
+ },
141
+ {
142
+ "inputs": [
143
+ { "internalType": "address", "name": "pool", "type": "address" },
144
+ { "internalType": "address", "name": "recipient", "type": "address" },
145
+ {
146
+ "internalType": "uint128",
147
+ "name": "amount0Requested",
148
+ "type": "uint128"
149
+ },
150
+ {
151
+ "internalType": "uint128",
152
+ "name": "amount1Requested",
153
+ "type": "uint128"
154
+ }
155
+ ],
156
+ "name": "collectProtocol",
157
+ "outputs": [
158
+ { "internalType": "uint128", "name": "amount0", "type": "uint128" },
159
+ { "internalType": "uint128", "name": "amount1", "type": "uint128" }
160
+ ],
161
+ "stateMutability": "nonpayable",
162
+ "type": "function"
163
+ },
164
+ {
165
+ "inputs": [
166
+ { "internalType": "address", "name": "tokenA", "type": "address" },
167
+ { "internalType": "address", "name": "tokenB", "type": "address" },
168
+ { "internalType": "uint24", "name": "fee", "type": "uint24" }
169
+ ],
170
+ "name": "createPool",
171
+ "outputs": [
172
+ { "internalType": "address", "name": "pool", "type": "address" }
173
+ ],
174
+ "stateMutability": "nonpayable",
175
+ "type": "function"
176
+ },
177
+ {
178
+ "inputs": [
179
+ { "internalType": "uint24", "name": "fee", "type": "uint24" },
180
+ { "internalType": "int24", "name": "tickSpacing", "type": "int24" }
181
+ ],
182
+ "name": "enableFeeAmount",
183
+ "outputs": [],
184
+ "stateMutability": "nonpayable",
185
+ "type": "function"
186
+ },
187
+ {
188
+ "inputs": [{ "internalType": "uint24", "name": "", "type": "uint24" }],
189
+ "name": "feeAmountTickSpacing",
190
+ "outputs": [{ "internalType": "int24", "name": "", "type": "int24" }],
191
+ "stateMutability": "view",
192
+ "type": "function"
193
+ },
194
+ {
195
+ "inputs": [{ "internalType": "uint24", "name": "", "type": "uint24" }],
196
+ "name": "feeAmountTickSpacingExtraInfo",
197
+ "outputs": [
198
+ { "internalType": "bool", "name": "whitelistRequested", "type": "bool" },
199
+ { "internalType": "bool", "name": "enabled", "type": "bool" }
200
+ ],
201
+ "stateMutability": "view",
202
+ "type": "function"
203
+ },
204
+ {
205
+ "inputs": [
206
+ { "internalType": "address", "name": "", "type": "address" },
207
+ { "internalType": "address", "name": "", "type": "address" },
208
+ { "internalType": "uint24", "name": "", "type": "uint24" }
209
+ ],
210
+ "name": "getPool",
211
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
212
+ "stateMutability": "view",
213
+ "type": "function"
214
+ },
215
+ {
216
+ "inputs": [],
217
+ "name": "lmPoolDeployer",
218
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
219
+ "stateMutability": "view",
220
+ "type": "function"
221
+ },
222
+ {
223
+ "inputs": [],
224
+ "name": "owner",
225
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
226
+ "stateMutability": "view",
227
+ "type": "function"
228
+ },
229
+ {
230
+ "inputs": [],
231
+ "name": "poolDeployer",
232
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
233
+ "stateMutability": "view",
234
+ "type": "function"
235
+ },
236
+ {
237
+ "inputs": [
238
+ { "internalType": "uint24", "name": "fee", "type": "uint24" },
239
+ { "internalType": "bool", "name": "whitelistRequested", "type": "bool" },
240
+ { "internalType": "bool", "name": "enabled", "type": "bool" }
241
+ ],
242
+ "name": "setFeeAmountExtraInfo",
243
+ "outputs": [],
244
+ "stateMutability": "nonpayable",
245
+ "type": "function"
246
+ },
247
+ {
248
+ "inputs": [
249
+ { "internalType": "address", "name": "pool", "type": "address" },
250
+ { "internalType": "uint32", "name": "feeProtocol0", "type": "uint32" },
251
+ { "internalType": "uint32", "name": "feeProtocol1", "type": "uint32" }
252
+ ],
253
+ "name": "setFeeProtocol",
254
+ "outputs": [],
255
+ "stateMutability": "nonpayable",
256
+ "type": "function"
257
+ },
258
+ {
259
+ "inputs": [
260
+ { "internalType": "address", "name": "pool", "type": "address" },
261
+ { "internalType": "address", "name": "lmPool", "type": "address" }
262
+ ],
263
+ "name": "setLmPool",
264
+ "outputs": [],
265
+ "stateMutability": "nonpayable",
266
+ "type": "function"
267
+ },
268
+ {
269
+ "inputs": [
270
+ {
271
+ "internalType": "address",
272
+ "name": "_lmPoolDeployer",
273
+ "type": "address"
274
+ }
275
+ ],
276
+ "name": "setLmPoolDeployer",
277
+ "outputs": [],
278
+ "stateMutability": "nonpayable",
279
+ "type": "function"
280
+ },
281
+ {
282
+ "inputs": [
283
+ { "internalType": "address", "name": "_owner", "type": "address" }
284
+ ],
285
+ "name": "setOwner",
286
+ "outputs": [],
287
+ "stateMutability": "nonpayable",
288
+ "type": "function"
289
+ },
290
+ {
291
+ "inputs": [
292
+ { "internalType": "address", "name": "user", "type": "address" },
293
+ { "internalType": "bool", "name": "verified", "type": "bool" }
294
+ ],
295
+ "name": "setWhiteListAddress",
296
+ "outputs": [],
297
+ "stateMutability": "nonpayable",
298
+ "type": "function"
299
+ }
300
+ ]
@@ -0,0 +1,148 @@
1
+ [
2
+ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
3
+ {
4
+ "anonymous": false,
5
+ "inputs": [
6
+ {
7
+ "indexed": true,
8
+ "internalType": "uint24",
9
+ "name": "fee",
10
+ "type": "uint24"
11
+ },
12
+ {
13
+ "indexed": true,
14
+ "internalType": "int24",
15
+ "name": "tickSpacing",
16
+ "type": "int24"
17
+ }
18
+ ],
19
+ "name": "FeeAmountEnabled",
20
+ "type": "event"
21
+ },
22
+ {
23
+ "anonymous": false,
24
+ "inputs": [
25
+ {
26
+ "indexed": true,
27
+ "internalType": "address",
28
+ "name": "oldOwner",
29
+ "type": "address"
30
+ },
31
+ {
32
+ "indexed": true,
33
+ "internalType": "address",
34
+ "name": "newOwner",
35
+ "type": "address"
36
+ }
37
+ ],
38
+ "name": "OwnerChanged",
39
+ "type": "event"
40
+ },
41
+ {
42
+ "anonymous": false,
43
+ "inputs": [
44
+ {
45
+ "indexed": true,
46
+ "internalType": "address",
47
+ "name": "token0",
48
+ "type": "address"
49
+ },
50
+ {
51
+ "indexed": true,
52
+ "internalType": "address",
53
+ "name": "token1",
54
+ "type": "address"
55
+ },
56
+ {
57
+ "indexed": true,
58
+ "internalType": "uint24",
59
+ "name": "fee",
60
+ "type": "uint24"
61
+ },
62
+ {
63
+ "indexed": false,
64
+ "internalType": "int24",
65
+ "name": "tickSpacing",
66
+ "type": "int24"
67
+ },
68
+ {
69
+ "indexed": false,
70
+ "internalType": "address",
71
+ "name": "pool",
72
+ "type": "address"
73
+ }
74
+ ],
75
+ "name": "PoolCreated",
76
+ "type": "event"
77
+ },
78
+ {
79
+ "inputs": [
80
+ { "internalType": "address", "name": "tokenA", "type": "address" },
81
+ { "internalType": "address", "name": "tokenB", "type": "address" },
82
+ { "internalType": "uint24", "name": "fee", "type": "uint24" }
83
+ ],
84
+ "name": "createPool",
85
+ "outputs": [
86
+ { "internalType": "address", "name": "pool", "type": "address" }
87
+ ],
88
+ "stateMutability": "nonpayable",
89
+ "type": "function"
90
+ },
91
+ {
92
+ "inputs": [
93
+ { "internalType": "uint24", "name": "fee", "type": "uint24" },
94
+ { "internalType": "int24", "name": "tickSpacing", "type": "int24" }
95
+ ],
96
+ "name": "enableFeeAmount",
97
+ "outputs": [],
98
+ "stateMutability": "nonpayable",
99
+ "type": "function"
100
+ },
101
+ {
102
+ "inputs": [{ "internalType": "uint24", "name": "", "type": "uint24" }],
103
+ "name": "feeAmountTickSpacing",
104
+ "outputs": [{ "internalType": "int24", "name": "", "type": "int24" }],
105
+ "stateMutability": "view",
106
+ "type": "function"
107
+ },
108
+ {
109
+ "inputs": [
110
+ { "internalType": "address", "name": "", "type": "address" },
111
+ { "internalType": "address", "name": "", "type": "address" },
112
+ { "internalType": "uint24", "name": "", "type": "uint24" }
113
+ ],
114
+ "name": "getPool",
115
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
116
+ "stateMutability": "view",
117
+ "type": "function"
118
+ },
119
+ {
120
+ "inputs": [],
121
+ "name": "owner",
122
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
123
+ "stateMutability": "view",
124
+ "type": "function"
125
+ },
126
+ {
127
+ "inputs": [],
128
+ "name": "parameters",
129
+ "outputs": [
130
+ { "internalType": "address", "name": "factory", "type": "address" },
131
+ { "internalType": "address", "name": "token0", "type": "address" },
132
+ { "internalType": "address", "name": "token1", "type": "address" },
133
+ { "internalType": "uint24", "name": "fee", "type": "uint24" },
134
+ { "internalType": "int24", "name": "tickSpacing", "type": "int24" }
135
+ ],
136
+ "stateMutability": "view",
137
+ "type": "function"
138
+ },
139
+ {
140
+ "inputs": [
141
+ { "internalType": "address", "name": "_owner", "type": "address" }
142
+ ],
143
+ "name": "setOwner",
144
+ "outputs": [],
145
+ "stateMutability": "nonpayable",
146
+ "type": "function"
147
+ }
148
+ ]
@@ -0,0 +1,25 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { DeepReadonly } from 'ts-essentials';
3
+ import { IDexHelper } from '../../dex-helper/idex-helper';
4
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
+ import { Address, Log, Logger } from '../../types';
6
+ import { LogDescription } from 'ethers/lib/utils';
7
+ import { FactoryState } from './types';
8
+ export declare type OnPoolCreatedCallback = ({ token0, token1, }: {
9
+ token0: string;
10
+ token1: string;
11
+ }) => Promise<void>;
12
+ export declare class AlgebraFactory extends StatefulEventSubscriber<FactoryState> {
13
+ readonly dexHelper: IDexHelper;
14
+ protected readonly factoryAddress: Address;
15
+ protected readonly onPoolCreated: OnPoolCreatedCallback;
16
+ handlers: {
17
+ [event: string]: (event: any) => Promise<void>;
18
+ };
19
+ logDecoder: (log: Log) => any;
20
+ readonly factoryIface: Interface;
21
+ constructor(dexHelper: IDexHelper, parentName: string, factoryAddress: Address, logger: Logger, onPoolCreated: OnPoolCreatedCallback, mapKey?: string);
22
+ generateState(): FactoryState;
23
+ protected processLog(_: DeepReadonly<FactoryState>, log: Readonly<Log>): Promise<FactoryState>;
24
+ handleNewPool(event: LogDescription): Promise<void>;
25
+ }
@@ -0,0 +1,43 @@
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.AlgebraFactory = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const AlgebraFactory_v1_1_abi_json_1 = __importDefault(require("../../abi/algebra/AlgebraFactory-v1_1.abi.json"));
9
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
10
+ /*
11
+ * "Stateless" event subscriber in order to capture "PoolCreated" event on new pools created.
12
+ * State is present, but it's a placeholder to actually make the events reach handlers (if there's no previous state - `processBlockLogs` is not called)
13
+ */
14
+ class AlgebraFactory extends stateful_event_subscriber_1.StatefulEventSubscriber {
15
+ constructor(dexHelper, parentName, factoryAddress, logger, onPoolCreated, mapKey = '') {
16
+ super(parentName, `${parentName} Factory`, dexHelper, logger, true, mapKey);
17
+ this.dexHelper = dexHelper;
18
+ this.factoryAddress = factoryAddress;
19
+ this.onPoolCreated = onPoolCreated;
20
+ this.handlers = {};
21
+ this.factoryIface = new abi_1.Interface(AlgebraFactory_v1_1_abi_json_1.default);
22
+ this.addressesSubscribed = [factoryAddress];
23
+ this.logDecoder = (log) => this.factoryIface.parseLog(log);
24
+ this.handlers['Pool'] = this.handleNewPool.bind(this);
25
+ }
26
+ generateState() {
27
+ return {};
28
+ }
29
+ async processLog(_, log) {
30
+ const event = this.logDecoder(log);
31
+ if (event.name in this.handlers) {
32
+ await this.handlers[event.name](event);
33
+ }
34
+ return {};
35
+ }
36
+ async handleNewPool(event) {
37
+ const token0 = event.args.token0;
38
+ const token1 = event.args.token1;
39
+ await this.onPoolCreated({ token0, token1 });
40
+ }
41
+ }
42
+ exports.AlgebraFactory = AlgebraFactory;
43
+ //# sourceMappingURL=algebra-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algebra-factory.js","sourceRoot":"","sources":["../../../src/dex/algebra/algebra-factory.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAE/C,kHAAwE;AAExE,+EAA0E;AAa1E;;;GAGG;AACH,MAAa,cAAe,SAAQ,mDAAqC;IASvE,YACW,SAAqB,EAC9B,UAAkB,EACC,cAAuB,EAC1C,MAAc,EACK,aAAoC,EACvD,SAAiB,EAAE;QAEnB,KAAK,CAAC,UAAU,EAAE,GAAG,UAAU,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAPnE,cAAS,GAAT,SAAS,CAAY;QAEX,mBAAc,GAAd,cAAc,CAAS;QAEvB,kBAAa,GAAb,aAAa,CAAuB;QAbzD,aAAQ,GAEJ,EAAE,CAAC;QAIS,iBAAY,GAAG,IAAI,eAAS,CAAC,sCAAU,CAAC,CAAC;QAYvD,IAAI,CAAC,mBAAmB,GAAG,CAAC,cAAc,CAAC,CAAC;QAE5C,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEhE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,aAAa;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,KAAK,CAAC,UAAU,CACxB,CAA6B,EAC7B,GAAkB;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC/B,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;SACxC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,KAAqB;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QACjC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAEjC,MAAM,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF;AAhDD,wCAgDC"}
@@ -8,6 +8,7 @@ import { SimpleExchange } from '../simple-exchange';
8
8
  import { Interface } from 'ethers/lib/utils';
9
9
  import { AlgebraEventPoolV1_1 } from './algebra-pool-v1_1';
10
10
  import { AlgebraEventPoolV1_9 } from './algebra-pool-v1_9';
11
+ import { OnPoolCreatedCallback } from './algebra-factory';
11
12
  declare type IAlgebraEventPool = AlgebraEventPoolV1_1 | AlgebraEventPoolV1_9;
12
13
  export declare class Algebra extends SimpleExchange implements IDex<AlgebraData> {
13
14
  protected network: Network;
@@ -16,6 +17,7 @@ export declare class Algebra extends SimpleExchange implements IDex<AlgebraData>
16
17
  readonly routerIface: Interface;
17
18
  readonly quoterIface: Interface;
18
19
  readonly config: DexParams;
20
+ private readonly factory;
19
21
  readonly isFeeOnTransferSupported: boolean;
20
22
  protected eventPools: Record<string, IAlgebraEventPool | null>;
21
23
  readonly hasConstantPriceLargeAmounts = false;
@@ -38,6 +40,7 @@ export declare class Algebra extends SimpleExchange implements IDex<AlgebraData>
38
40
  }[] | null;
39
41
  getPoolIdentifier(srcAddress: Address, destAddress: Address): string;
40
42
  initializePricing(blockNumber: number): Promise<void>;
43
+ onPoolCreatedDeleteFromNonExistingSet: OnPoolCreatedCallback;
41
44
  getPool(srcAddress: Address, destAddress: Address, blockNumber: number): Promise<IAlgebraEventPool | null>;
42
45
  addMasterPool(poolKey: string, blockNumber: number): Promise<boolean>;
43
46
  getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
@@ -44,8 +44,9 @@ const types_1 = require("../uniswap-v3/types");
44
44
  const AlgebraMath_1 = require("./lib/AlgebraMath");
45
45
  const algebra_pool_v1_1_1 = require("./algebra-pool-v1_1");
46
46
  const algebra_pool_v1_9_1 = require("./algebra-pool-v1_9");
47
- const ALGEBRA_CLEAN_NOT_EXISTING_POOL_TTL_MS = 3 * 60 * 60 * 1000; // 3 hours
48
- const ALGEBRA_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS = 30 * 60 * 1000; // Once in 30 minutes
47
+ const algebra_factory_1 = require("./algebra-factory");
48
+ const ALGEBRA_CLEAN_NOT_EXISTING_POOL_TTL_MS = 3 * 24 * 60 * 60 * 1000; // 3 days
49
+ const ALGEBRA_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS = 24 * 60 * 60 * 1000; // Once in a day
49
50
  const ALGEBRA_EFFICIENCY_FACTOR = 3;
50
51
  const ALGEBRA_TICK_GAS_COST = 24000; // Ceiled
51
52
  const ALGEBRA_TICK_BASE_OVERHEAD = 75000;
@@ -68,6 +69,26 @@ class Algebra extends simple_exchange_1.SimpleExchange {
68
69
  this.eventPools = {};
69
70
  this.hasConstantPriceLargeAmounts = false;
70
71
  this.needWrapNative = true;
72
+ /*
73
+ * When a non existing pool is queried, it's blacklisted for an arbitrary long period in order to prevent issuing too many rpc calls
74
+ * Once the pool is created, it gets immediately flagged
75
+ */
76
+ this.onPoolCreatedDeleteFromNonExistingSet = async ({ token0, token1, }) => {
77
+ const logPrefix = '[Algebra.onPoolCreatedDeleteFromNonExistingSet]';
78
+ const [_token0, _token1] = this._sortTokens(token0, token1);
79
+ const poolKey = `${token0}_${token1}`.toLowerCase();
80
+ // consider doing it only from master pool for less calls to distant cache
81
+ // delete entry locally to let local instance discover the pool
82
+ delete this.eventPools[this.getPoolIdentifier(_token0, _token1)];
83
+ try {
84
+ this.logger.info(`${logPrefix} delete pool from not existing set: ${poolKey}`);
85
+ // delete pool record from set
86
+ await this.dexHelper.cache.zrem(this.notExistingPoolSetKey, [poolKey]);
87
+ }
88
+ catch (error) {
89
+ this.logger.error(`${logPrefix} failed to delete pool from set: ${poolKey}`, error);
90
+ }
91
+ };
71
92
  this.logger = dexHelper.getLogger(dexKey + '-' + network);
72
93
  this.uniswapMulti = new this.dexHelper.web3Provider.eth.Contract(UniswapMulti_abi_json_1.default, this.config.uniswapMulticall);
73
94
  this.stateMultiContract = new this.dexHelper.web3Provider.eth.Contract(AlgebraStateMulticall_abi_json_1.default, this.config.algebraStateMulticall);
@@ -79,6 +100,7 @@ class Algebra extends simple_exchange_1.SimpleExchange {
79
100
  `${constants_1.CACHE_PREFIX}_${network}_${dexKey}_not_existings_pool_set`.toLowerCase();
80
101
  this.AlgebraPoolImplem =
81
102
  config.version === 'v1.1' ? algebra_pool_v1_1_1.AlgebraEventPoolV1_1 : algebra_pool_v1_9_1.AlgebraEventPoolV1_9;
103
+ this.factory = new algebra_factory_1.AlgebraFactory(dexHelper, dexKey, this.config.factory, this.logger, this.onPoolCreatedDeleteFromNonExistingSet);
82
104
  }
83
105
  getAdapters(side) {
84
106
  return this.adapters[side] ? this.adapters[side] : null;
@@ -88,11 +110,11 @@ class Algebra extends simple_exchange_1.SimpleExchange {
88
110
  return `${this.dexKey}_${tokenAddresses}`;
89
111
  }
90
112
  async initializePricing(blockNumber) {
91
- const cleanNonExistingPoolTTLMs = this.config.cleanExistingPoolTTLMs ||
92
- ALGEBRA_CLEAN_NOT_EXISTING_POOL_TTL_MS;
113
+ // Init listening to new pools creation
114
+ await this.factory.initialize(blockNumber);
93
115
  if (!this.dexHelper.config.isSlave) {
94
116
  const cleanExpiredNotExistingPoolsKeys = async () => {
95
- const maxTimestamp = Date.now() - cleanNonExistingPoolTTLMs;
117
+ const maxTimestamp = Date.now() - ALGEBRA_CLEAN_NOT_EXISTING_POOL_TTL_MS;
96
118
  await this.dexHelper.cache.zremrangebyscore(this.notExistingPoolSetKey, 0, maxTimestamp);
97
119
  };
98
120
  this.intervalTask = setInterval(cleanExpiredNotExistingPoolsKeys.bind(this), ALGEBRA_CLEAN_NOT_EXISTING_POOL_INTERVAL_MS);