@paraswap/dex-lib 2.37.3 → 2.37.4-current-fee-ramses-v2.2

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 (218) 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/vcs.xml +6 -0
  8. package/build/abi/algebra/AlgebraPool.abi.json +727 -0
  9. package/build/abi/curve-v1/StableSwapFRXETH.json +889 -0
  10. package/build/abi/curve-v1/StableSwapWBETH.json +1223 -0
  11. package/build/abi/dexalot/DexalotMainnetRFQ.json +887 -0
  12. package/build/abi/ramses-v2/RamsesV2Pool.abi.json +1580 -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 +46 -0
  28. package/build/dex/algebra/algebra-pool.js +336 -0
  29. package/build/dex/algebra/algebra-pool.js.map +1 -0
  30. package/build/dex/balancer-v2/LinearMath.d.ts +19 -0
  31. package/build/dex/balancer-v2/LinearMath.js +179 -0
  32. package/build/dex/balancer-v2/LinearMath.js.map +1 -0
  33. package/build/dex/balancer-v2/LinearPool.d.ts +47 -0
  34. package/build/dex/balancer-v2/LinearPool.js +324 -0
  35. package/build/dex/balancer-v2/LinearPool.js.map +1 -0
  36. package/build/dex/balancer-v2/PhantomStablePool.d.ts +47 -0
  37. package/build/dex/balancer-v2/PhantomStablePool.js +294 -0
  38. package/build/dex/balancer-v2/PhantomStablePool.js.map +1 -0
  39. package/build/dex/balancer-v2/StableMath.d.ts +9 -0
  40. package/build/dex/balancer-v2/StableMath.js +272 -0
  41. package/build/dex/balancer-v2/StableMath.js.map +1 -0
  42. package/build/dex/balancer-v2/balancer-v2-pool.d.ts +75 -0
  43. package/build/dex/balancer-v2/balancer-v2-pool.js +417 -0
  44. package/build/dex/balancer-v2/balancer-v2-pool.js.map +1 -0
  45. package/build/dex/curve-v1/pools/frxETHpool.d.ts +7 -0
  46. package/build/dex/curve-v1/pools/frxETHpool.js +27 -0
  47. package/build/dex/curve-v1/pools/frxETHpool.js.map +1 -0
  48. package/build/dex/curve-v1/pools/wbETHpool.d.ts +29 -0
  49. package/build/dex/curve-v1/pools/wbETHpool.js +408 -0
  50. package/build/dex/curve-v1/pools/wbETHpool.js.map +1 -0
  51. package/build/dex/{my-test-dex → dexalot}/config.d.ts +1 -1
  52. package/build/dex/dexalot/config.js +18 -0
  53. package/build/dex/dexalot/config.js.map +1 -0
  54. package/build/dex/dexalot/constants.d.ts +15 -0
  55. package/build/dex/dexalot/constants.js +22 -0
  56. package/build/dex/dexalot/constants.js.map +1 -0
  57. package/build/dex/dexalot/dexalot.d.ts +69 -0
  58. package/build/dex/dexalot/dexalot.js +646 -0
  59. package/build/dex/dexalot/dexalot.js.map +1 -0
  60. package/build/dex/dexalot/rate-fetcher.d.ts +28 -0
  61. package/build/dex/dexalot/rate-fetcher.js +100 -0
  62. package/build/dex/dexalot/rate-fetcher.js.map +1 -0
  63. package/build/dex/dexalot/types.d.ts +114 -0
  64. package/build/dex/dexalot/types.js +12 -0
  65. package/build/dex/dexalot/types.js.map +1 -0
  66. package/build/dex/dexalot/validators.d.ts +5 -0
  67. package/build/dex/dexalot/validators.js +45 -0
  68. package/build/dex/dexalot/validators.js.map +1 -0
  69. package/build/dex/pancakeswap-v3/types.d.ts +14 -0
  70. package/build/dex/{my-test-dex → pancakeswap-v3}/types.js.map +1 -1
  71. package/build/dex/quickswap/camelot-v3.d.ts +6 -0
  72. package/build/dex/quickswap/camelot-v3.js +19 -0
  73. package/build/dex/quickswap/camelot-v3.js.map +1 -0
  74. package/build/dex/quickswap/zyberswap-v3.d.ts +6 -0
  75. package/build/dex/quickswap/zyberswap-v3.js +19 -0
  76. package/build/dex/quickswap/zyberswap-v3.js.map +1 -0
  77. package/build/dex/quickswap-v3.d.ts +21 -0
  78. package/build/dex/quickswap-v3.js +40 -0
  79. package/build/dex/quickswap-v3.js.map +1 -0
  80. package/build/dex/ramses-v2/config.d.ts +4 -0
  81. package/build/dex/ramses-v2/config.js +28 -0
  82. package/build/dex/ramses-v2/config.js.map +1 -0
  83. package/build/dex/ramses-v2/constants.d.ts +28 -0
  84. package/build/dex/ramses-v2/constants.js +35 -0
  85. package/build/dex/ramses-v2/constants.js.map +1 -0
  86. package/build/dex/ramses-v2/contract-math/BitMath.d.ts +4 -0
  87. package/build/dex/ramses-v2/contract-math/BitMath.js +93 -0
  88. package/build/dex/ramses-v2/contract-math/BitMath.js.map +1 -0
  89. package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +3 -0
  90. package/build/dex/ramses-v2/contract-math/FixedPoint128.js +8 -0
  91. package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +1 -0
  92. package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +4 -0
  93. package/build/dex/ramses-v2/contract-math/FixedPoint96.js +9 -0
  94. package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +1 -0
  95. package/build/dex/ramses-v2/contract-math/FullMath.d.ts +4 -0
  96. package/build/dex/ramses-v2/contract-math/FullMath.js +19 -0
  97. package/build/dex/ramses-v2/contract-math/FullMath.js.map +1 -0
  98. package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +3 -0
  99. package/build/dex/ramses-v2/contract-math/LiquidityMath.js +22 -0
  100. package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +1 -0
  101. package/build/dex/ramses-v2/contract-math/Oracle.d.ts +10 -0
  102. package/build/dex/ramses-v2/contract-math/Oracle.js +133 -0
  103. package/build/dex/ramses-v2/contract-math/Oracle.js.map +1 -0
  104. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +10 -0
  105. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +91 -0
  106. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +1 -0
  107. package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +8 -0
  108. package/build/dex/ramses-v2/contract-math/SwapMath.js +70 -0
  109. package/build/dex/ramses-v2/contract-math/SwapMath.js.map +1 -0
  110. package/build/dex/ramses-v2/contract-math/Tick.d.ts +7 -0
  111. package/build/dex/ramses-v2/contract-math/Tick.js +45 -0
  112. package/build/dex/ramses-v2/contract-math/Tick.js.map +1 -0
  113. package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +8 -0
  114. package/build/dex/ramses-v2/contract-math/TickBitMap.js +87 -0
  115. package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +1 -0
  116. package/build/dex/ramses-v2/contract-math/TickMath.d.ts +8 -0
  117. package/build/dex/ramses-v2/contract-math/TickMath.js +162 -0
  118. package/build/dex/ramses-v2/contract-math/TickMath.js.map +1 -0
  119. package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +3 -0
  120. package/build/dex/ramses-v2/contract-math/UnsafeMath.js +10 -0
  121. package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +1 -0
  122. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +18 -0
  123. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +392 -0
  124. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +1 -0
  125. package/build/dex/ramses-v2/contract-math/utils.d.ts +3 -0
  126. package/build/dex/ramses-v2/contract-math/utils.js +16 -0
  127. package/build/dex/ramses-v2/contract-math/utils.js.map +1 -0
  128. package/build/dex/ramses-v2/ramses-v2-pool.d.ts +42 -0
  129. package/build/dex/ramses-v2/ramses-v2-pool.js +307 -0
  130. package/build/dex/ramses-v2/ramses-v2-pool.js.map +1 -0
  131. package/build/dex/ramses-v2/ramses-v2.d.ts +61 -0
  132. package/build/dex/ramses-v2/ramses-v2.js +690 -0
  133. package/build/dex/ramses-v2/ramses-v2.js.map +1 -0
  134. package/build/dex/ramses-v2/types.d.ts +154 -0
  135. package/build/dex/ramses-v2/types.js +9 -0
  136. package/build/dex/ramses-v2/types.js.map +1 -0
  137. package/build/dex/ramses-v2/utils.d.ts +6 -0
  138. package/build/dex/ramses-v2/utils.js +71 -0
  139. package/build/dex/ramses-v2/utils.js.map +1 -0
  140. package/build/dex/sushiswap-v3/config.d.ts +4 -0
  141. package/build/dex/sushiswap-v3/config.js +132 -0
  142. package/build/dex/sushiswap-v3/config.js.map +1 -0
  143. package/build/dex/sushiswap-v3/constants.d.ts +4 -0
  144. package/build/dex/sushiswap-v3/constants.js +32 -0
  145. package/build/dex/sushiswap-v3/constants.js.map +1 -0
  146. package/build/dex/sushiswap-v3/sushiswap-v3-original.d.ts +56 -0
  147. package/build/dex/sushiswap-v3/sushiswap-v3-original.js +598 -0
  148. package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +1 -0
  149. package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +1 -0
  150. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +6 -0
  151. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +1 -0
  152. package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +21 -0
  153. package/build/dex/sushiswap-v3/sushiswap-v3.js +58 -0
  154. package/build/dex/sushiswap-v3/sushiswap-v3.js.map +1 -0
  155. package/build/dex/sushiswap-v3/token.d.ts +6 -0
  156. package/build/dex/sushiswap-v3/token.js +23 -0
  157. package/build/dex/sushiswap-v3/token.js.map +1 -0
  158. package/build/dex/sushiswap-v3/types.d.ts +15 -0
  159. package/build/dex/sushiswap-v3/types.js +18 -0
  160. package/build/dex/sushiswap-v3/types.js.map +1 -0
  161. package/build/dex/uniswap-v3/config.js +2 -0
  162. package/build/dex/uniswap-v3/config.js.map +1 -1
  163. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +12 -0
  164. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +23 -0
  165. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +1 -0
  166. package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.d.ts +7 -0
  167. package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js +87 -0
  168. package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js.map +1 -0
  169. package/build/dex/uniswap-v3/types.d.ts +2 -0
  170. package/build/dex/uniswap-v3/types.js.map +1 -1
  171. package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +7 -5
  172. package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
  173. package/build/dex/uniswap-v3/uniswap-v3.js +7 -3
  174. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  175. package/build/dex/{hello → woo-fi}/config.d.ts +1 -1
  176. package/build/dex/woo-fi/config.js +141 -0
  177. package/build/dex/woo-fi/config.js.map +1 -0
  178. package/build/dex/woo-fi/constants.d.ts +5 -0
  179. package/build/dex/woo-fi/constants.js +20 -0
  180. package/build/dex/woo-fi/constants.js.map +1 -0
  181. package/build/dex/woo-fi/types.d.ts +48 -0
  182. package/build/dex/{hello → woo-fi}/types.js.map +1 -1
  183. package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +14 -0
  184. package/build/dex/woo-fi/woo-fi-decimal-math.js +42 -0
  185. package/build/dex/woo-fi/woo-fi-decimal-math.js.map +1 -0
  186. package/build/dex/woo-fi/woo-fi-math.d.ts +31 -0
  187. package/build/dex/woo-fi/woo-fi-math.js +300 -0
  188. package/build/dex/woo-fi/woo-fi-math.js.map +1 -0
  189. package/build/dex/woo-fi/woo-fi.d.ts +65 -0
  190. package/build/dex/woo-fi/woo-fi.js +480 -0
  191. package/build/dex/woo-fi/woo-fi.js.map +1 -0
  192. package/package.json +1 -1
  193. package/src/abi/ramses-v2/RamsesV2Pool.abi.json +1580 -0
  194. package/src/dex/uniswap-v3/config.ts +2 -0
  195. package/src/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.ts +104 -0
  196. package/src/dex/uniswap-v3/types.ts +2 -0
  197. package/src/dex/uniswap-v3/uniswap-v3-pool.ts +6 -4
  198. package/src/dex/uniswap-v3/uniswap-v3.ts +20 -15
  199. package/build/dex/hello/config.js +0 -15
  200. package/build/dex/hello/config.js.map +0 -1
  201. package/build/dex/hello/hello-pool.d.ts +0 -39
  202. package/build/dex/hello/hello-pool.js +0 -64
  203. package/build/dex/hello/hello-pool.js.map +0 -1
  204. package/build/dex/hello/hello.d.ts +0 -37
  205. package/build/dex/hello/hello.js +0 -126
  206. package/build/dex/hello/hello.js.map +0 -1
  207. package/build/dex/hello/types.d.ts +0 -6
  208. package/build/dex/my-test-dex/config.js +0 -15
  209. package/build/dex/my-test-dex/config.js.map +0 -1
  210. package/build/dex/my-test-dex/my-test-dex-pool.d.ts +0 -39
  211. package/build/dex/my-test-dex/my-test-dex-pool.js +0 -64
  212. package/build/dex/my-test-dex/my-test-dex-pool.js.map +0 -1
  213. package/build/dex/my-test-dex/my-test-dex.d.ts +0 -37
  214. package/build/dex/my-test-dex/my-test-dex.js +0 -126
  215. package/build/dex/my-test-dex/my-test-dex.js.map +0 -1
  216. package/build/dex/my-test-dex/types.d.ts +0 -6
  217. /package/build/dex/{hello → pancakeswap-v3}/types.js +0 -0
  218. /package/build/dex/{my-test-dex → woo-fi}/types.js +0 -0
@@ -5,6 +5,7 @@ import { Address } from '../../types';
5
5
  import RamsesV2StateMulticallABI from '../../abi/RamsesV2StateMulticall.abi.json';
6
6
  import { AbiItem } from 'web3-utils';
7
7
  import { decodeStateMultiCallResultWithRelativeBitmaps } from './forks/ramses-v2/utils';
8
+ import { RamsesV2EventPool } from './forks/ramses-v2/ramses-v2-pool';
8
9
 
9
10
  const SUPPORTED_FEES = [10000n, 3000n, 500n, 100n];
10
11
 
@@ -251,6 +252,7 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
251
252
  uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
252
253
  chunksCount: 10,
253
254
  initRetryFrequency: 10,
255
+ eventPoolImplementation: RamsesV2EventPool,
254
256
  decodeStateMultiCallResultWithRelativeBitmaps,
255
257
  initHash:
256
258
  '0x1565b129f2d1790f12d45301b9b084335626f0c92410bc43130763b69971135d',
@@ -0,0 +1,104 @@
1
+ import { UniswapV3EventPool } from '../../uniswap-v3-pool';
2
+ import { DecodedStateMultiCallResultWithRelativeBitmaps, PoolState } from '../../types';
3
+ import { assert } from 'ts-essentials';
4
+ import { _reduceTickBitmap, _reduceTicks } from '../../contract-math/utils';
5
+ import { bigIntify } from '../../../../utils';
6
+ import { TickBitMap } from '../../contract-math/TickBitMap';
7
+ import { uint24ToBigInt } from '../../../../lib/decoders';
8
+ import { Interface } from 'ethers/lib/utils';
9
+ import RamsesV2PoolABI from '../../../../abi/ramses-v2/RamsesV2Pool.abi.json';
10
+
11
+ export class RamsesV2EventPool extends UniswapV3EventPool {
12
+
13
+ public readonly poolIface = new Interface(RamsesV2PoolABI);
14
+
15
+ async generateState(blockNumber: number): Promise<Readonly<PoolState>> {
16
+ const callData = this._getStateRequestCallData();
17
+
18
+ const calldataWithFee = [
19
+ ...callData,
20
+ {
21
+ target: this.poolAddress,
22
+ callData: this.poolIface.encodeFunctionData('currentFee'),
23
+ decodeFunction: uint24ToBigInt,
24
+ },
25
+ ];
26
+
27
+ this._stateRequestCallData = calldataWithFee;
28
+
29
+ const [resBalance0, resBalance1, resState, resCurrentFee] =
30
+ await this.dexHelper.multiWrapper.tryAggregate<
31
+ bigint | DecodedStateMultiCallResultWithRelativeBitmaps
32
+ >(
33
+ false,
34
+ calldataWithFee,
35
+ blockNumber,
36
+ this.dexHelper.multiWrapper.defaultBatchSize,
37
+ false,
38
+ );
39
+
40
+ assert(resState.success, 'Pool does not exist');
41
+
42
+ const [balance0, balance1, _state, fee] = [
43
+ resBalance0.returnData,
44
+ resBalance1.returnData,
45
+ resState.returnData,
46
+ resCurrentFee.returnData,
47
+ ] as [bigint, bigint, DecodedStateMultiCallResultWithRelativeBitmaps, bigint];
48
+
49
+ const tickBitmap = {};
50
+ const ticks = {};
51
+
52
+ this.currentFeeCodeAsString = fee.toString();
53
+ _reduceTickBitmap(tickBitmap, _state.tickBitmap);
54
+ _reduceTicks(ticks, _state.ticks);
55
+
56
+ const observations = {
57
+ [_state.slot0.observationIndex]: {
58
+ blockTimestamp: bigIntify(_state.observation.blockTimestamp),
59
+ tickCumulative: bigIntify(_state.observation.tickCumulative),
60
+ secondsPerLiquidityCumulativeX128: bigIntify(
61
+ _state.observation.secondsPerLiquidityCumulativeX128,
62
+ ),
63
+ initialized: _state.observation.initialized,
64
+ },
65
+ };
66
+
67
+ const currentTick = bigIntify(_state.slot0.tick);
68
+ const tickSpacing = bigIntify(_state.tickSpacing);
69
+
70
+ const startTickBitmap = TickBitMap.position(currentTick / tickSpacing)[0];
71
+ const requestedRange = this.getBitmapRangeToRequest();
72
+
73
+ return {
74
+ pool: _state.pool,
75
+ blockTimestamp: bigIntify(_state.blockTimestamp),
76
+ slot0: {
77
+ sqrtPriceX96: bigIntify(_state.slot0.sqrtPriceX96),
78
+ tick: currentTick,
79
+ observationIndex: +_state.slot0.observationIndex,
80
+ observationCardinality: +_state.slot0.observationCardinality,
81
+ observationCardinalityNext: +_state.slot0.observationCardinalityNext,
82
+ feeProtocol: bigIntify(_state.slot0.feeProtocol),
83
+ },
84
+ liquidity: bigIntify(_state.liquidity),
85
+ fee,
86
+ tickSpacing,
87
+ maxLiquidityPerTick: bigIntify(_state.maxLiquidityPerTick),
88
+ tickBitmap,
89
+ ticks,
90
+ observations,
91
+ isValid: true,
92
+ startTickBitmap,
93
+ lowestKnownTick:
94
+ (BigInt.asIntN(24, startTickBitmap - requestedRange) << 8n) *
95
+ tickSpacing,
96
+ highestKnownTick:
97
+ ((BigInt.asIntN(24, startTickBitmap + requestedRange) << 8n) +
98
+ BigInt.asIntN(24, 255n)) *
99
+ tickSpacing,
100
+ balance0,
101
+ balance1,
102
+ };
103
+ }
104
+ }
@@ -3,6 +3,7 @@ import { NumberAsString } from '../../types';
3
3
  import { Address } from '../../types';
4
4
  import { AbiItem } from 'web3-utils';
5
5
  import { MultiResult } from '../../lib/multi-wrapper';
6
+ import { UniswapV3EventPool } from './uniswap-v3-pool';
6
7
 
7
8
  export type OracleObservation = {
8
9
  blockTimestamp: bigint;
@@ -81,6 +82,7 @@ export type DexParams = {
81
82
  subgraphURL: string;
82
83
  initHash: string;
83
84
  stateMultiCallAbi?: AbiItem[];
85
+ eventPoolImplementation?: typeof UniswapV3EventPool;
84
86
  decodeStateMultiCallResultWithRelativeBitmaps?: DecodeStateMultiCallFunc;
85
87
  };
86
88
 
@@ -46,7 +46,9 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
46
46
 
47
47
  private _poolAddress?: Address;
48
48
 
49
- private _stateRequestCallData?: MultiCallParams<
49
+ public currentFeeCodeAsString: string | undefined;
50
+
51
+ protected _stateRequestCallData?: MultiCallParams<
50
52
  bigint | DecodedStateMultiCallResultWithRelativeBitmaps
51
53
  >[];
52
54
 
@@ -55,7 +57,7 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
55
57
  public initFailed = false;
56
58
  public initRetryAttemptCount = 0;
57
59
 
58
- public readonly feeCodeAsString;
60
+ public feeCodeAsString;
59
61
 
60
62
  constructor(
61
63
  readonly dexHelper: IDexHelper,
@@ -66,7 +68,7 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
66
68
  | undefined,
67
69
  readonly erc20Interface: Interface,
68
70
  protected readonly factoryAddress: Address,
69
- public readonly feeCode: bigint,
71
+ public feeCode: bigint,
70
72
  token0: Address,
71
73
  token1: Address,
72
74
  logger: Logger,
@@ -199,7 +201,7 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
199
201
  return null; // ignore unrecognized event
200
202
  }
201
203
 
202
- private _getStateRequestCallData() {
204
+ protected _getStateRequestCallData() {
203
205
  if (!this._stateRequestCallData) {
204
206
  const callData: MultiCallParams<
205
207
  bigint | DecodedStateMultiCallResultWithRelativeBitmaps
@@ -287,21 +287,25 @@ export class UniswapV3
287
287
  }
288
288
 
289
289
  this.logger.trace(`starting to listen to new pool: ${key}`);
290
+ const poolImplementation =
291
+ this.config.eventPoolImplementation !== undefined
292
+ ? this.config.eventPoolImplementation
293
+ : UniswapV3EventPool;
290
294
  pool =
291
295
  pool ||
292
- new UniswapV3EventPool(
293
- this.dexHelper,
294
- this.dexKey,
295
- this.stateMultiContract,
296
- this.config.decodeStateMultiCallResultWithRelativeBitmaps,
297
- this.erc20Interface,
298
- this.config.factory,
299
- fee,
300
- token0,
301
- token1,
302
- this.logger,
303
- this.cacheStateKey,
304
- this.config.initHash,
296
+ new poolImplementation(
297
+ this.dexHelper,
298
+ this.dexKey,
299
+ this.stateMultiContract,
300
+ this.config.decodeStateMultiCallResultWithRelativeBitmaps,
301
+ this.erc20Interface,
302
+ this.config.factory,
303
+ fee,
304
+ token0,
305
+ token1,
306
+ this.logger,
307
+ this.cacheStateKey,
308
+ this.config.initHash,
305
309
  );
306
310
 
307
311
  try {
@@ -536,7 +540,7 @@ export class UniswapV3
536
540
  {
537
541
  tokenIn: from.address,
538
542
  tokenOut: to.address,
539
- fee: pool.feeCodeAsString,
543
+ fee: pool.currentFeeCodeAsString ? pool.currentFeeCodeAsString : pool.feeCodeAsString,
540
544
  },
541
545
  ],
542
546
  exchange: pool.poolAddress,
@@ -730,7 +734,7 @@ export class UniswapV3
730
734
  {
731
735
  tokenIn: _srcAddress,
732
736
  tokenOut: _destAddress,
733
- fee: pool.feeCode.toString(),
737
+ fee: pool.currentFeeCodeAsString ? pool.currentFeeCodeAsString : pool.feeCode.toString(),
734
738
  },
735
739
  ],
736
740
  },
@@ -1111,6 +1115,7 @@ export class UniswapV3
1111
1115
  initHash: this.config.initHash,
1112
1116
  subgraphURL: this.config.subgraphURL,
1113
1117
  stateMultiCallAbi: this.config.stateMultiCallAbi,
1118
+ eventPoolImplementation: this.config.eventPoolImplementation,
1114
1119
  decodeStateMultiCallResultWithRelativeBitmaps:
1115
1120
  this.config.decodeStateMultiCallResultWithRelativeBitmaps,
1116
1121
  };
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.HelloConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.HelloConfig = {
6
- Hello: {
7
- // TODO: complete me!
8
- },
9
- };
10
- exports.Adapters = {
11
- // TODO: add adapters for each chain
12
- // This is an example to copy
13
- [constants_1.Network.MAINNET]: { [constants_1.SwapSide.SELL]: [{ name: '', index: 0 }] },
14
- };
15
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/hello/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,WAAW,GAA4B;IAClD,KAAK,EAAE;IACL,qBAAqB;KACtB;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC;IACvD,oCAAoC;IACpC,6BAA6B;IAC7B,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE;CACjE,CAAC"}
@@ -1,39 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { Log, Logger } from '../../types';
4
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
- import { IDexHelper } from '../../dex-helper/idex-helper';
6
- import { PoolState } from './types';
7
- export declare class HelloEventPool extends StatefulEventSubscriber<PoolState> {
8
- readonly parentName: string;
9
- protected network: number;
10
- protected dexHelper: IDexHelper;
11
- protected helloIface: Interface;
12
- handlers: {
13
- [event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
14
- };
15
- logDecoder: (log: Log) => any;
16
- addressesSubscribed: string[];
17
- constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, helloIface?: Interface);
18
- /**
19
- * The function is called every time any of the subscribed
20
- * addresses release log. The function accepts the current
21
- * state, updates the state according to the log, and returns
22
- * the updated state.
23
- * @param state - Current state of event subscriber
24
- * @param log - Log released by one of the subscribed addresses
25
- * @returns Updates state of the event subscriber after the log
26
- */
27
- protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
28
- /**
29
- * The function generates state using on-chain calls. This
30
- * function is called to regenerate state if the event based
31
- * system fails to fetch events and the local state is no
32
- * more correct.
33
- * @param blockNumber - Blocknumber for which the state should
34
- * should be generated
35
- * @returns state of the event subscriber at blocknumber
36
- */
37
- generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
38
- handleMyEvent(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
39
- }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HelloEventPool = void 0;
4
- const abi_1 = require("@ethersproject/abi");
5
- const utils_1 = require("../../utils");
6
- const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
7
- class HelloEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
8
- constructor(parentName, network, dexHelper, logger, helloIface = new abi_1.Interface('' /* TODO: Import and put here Hello ABI */)) {
9
- // TODO: Add pool name
10
- super(parentName, 'POOL_NAME', dexHelper, logger);
11
- this.parentName = parentName;
12
- this.network = network;
13
- this.dexHelper = dexHelper;
14
- this.helloIface = helloIface;
15
- this.handlers = {};
16
- // TODO: make logDecoder decode logs that
17
- this.logDecoder = (log) => this.helloIface.parseLog(log);
18
- this.addressesSubscribed = [
19
- /* subscribed addresses */
20
- ];
21
- // Add handlers
22
- this.handlers['myEvent'] = this.handleMyEvent.bind(this);
23
- }
24
- /**
25
- * The function is called every time any of the subscribed
26
- * addresses release log. The function accepts the current
27
- * state, updates the state according to the log, and returns
28
- * the updated state.
29
- * @param state - Current state of event subscriber
30
- * @param log - Log released by one of the subscribed addresses
31
- * @returns Updates state of the event subscriber after the log
32
- */
33
- processLog(state, log) {
34
- try {
35
- const event = this.logDecoder(log);
36
- if (event.name in this.handlers) {
37
- return this.handlers[event.name](event, state, log);
38
- }
39
- }
40
- catch (e) {
41
- (0, utils_1.catchParseLogError)(e, this.logger);
42
- }
43
- return null;
44
- }
45
- /**
46
- * The function generates state using on-chain calls. This
47
- * function is called to regenerate state if the event based
48
- * system fails to fetch events and the local state is no
49
- * more correct.
50
- * @param blockNumber - Blocknumber for which the state should
51
- * should be generated
52
- * @returns state of the event subscriber at blocknumber
53
- */
54
- async generateState(blockNumber) {
55
- // TODO: complete me!
56
- return {};
57
- }
58
- // Its just a dummy example
59
- handleMyEvent(event, state, log) {
60
- return null;
61
- }
62
- }
63
- exports.HelloEventPool = HelloEventPool;
64
- //# sourceMappingURL=hello-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hello-pool.js","sourceRoot":"","sources":["../../../src/dex/hello/hello-pool.ts"],"names":[],"mappings":";;;AAAA,4CAA+C;AAG/C,uCAAiD;AACjD,+EAA0E;AAI1E,MAAa,cAAe,SAAQ,mDAAkC;IAapE,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,aAAa,IAAI,eAAS,CAClC,EAAE,CAAC,yCAAyC,CAC7C;QAED,sBAAsB;QACtB,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QATzC,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,eAAU,GAAV,UAAU,CAEnB;QAnBH,aAAQ,GAMJ,EAAE,CAAC;QAkBL,yCAAyC;QACzC,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,mBAAmB,GAAG;QACzB,0BAA0B;SAC3B,CAAC;QAEF,eAAe;QACf,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;OAQG;IACO,UAAU,CAClB,KAA8B,EAC9B,GAAkB;QAElB,IAAI;YACF,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aACrD;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,0BAAkB,EAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACpC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,qBAAqB;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,2BAA2B;IAC3B,aAAa,CACX,KAAU,EACV,KAA8B,EAC9B,GAAkB;QAElB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAlFD,wCAkFC"}
@@ -1,37 +0,0 @@
1
- import { AsyncOrSync } from 'ts-essentials';
2
- import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger } from '../../types';
3
- import { SwapSide, Network } from '../../constants';
4
- import { IDex } from '../../dex/idex';
5
- import { IDexHelper } from '../../dex-helper/idex-helper';
6
- import { HelloData } from './types';
7
- import { SimpleExchange } from '../simple-exchange';
8
- import { HelloEventPool } from './hello-pool';
9
- export declare class Hello extends SimpleExchange implements IDex<HelloData> {
10
- readonly network: Network;
11
- readonly dexKey: string;
12
- readonly dexHelper: IDexHelper;
13
- protected adapters: import("../../types").AdapterMappings;
14
- protected eventPools: HelloEventPool;
15
- readonly hasConstantPriceLargeAmounts = false;
16
- readonly needWrapNative = true;
17
- readonly isFeeOnTransferSupported = false;
18
- static dexKeysWithNetwork: {
19
- key: string;
20
- networks: Network[];
21
- }[];
22
- logger: Logger;
23
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, adapters?: import("../../types").AdapterMappings);
24
- initializePricing(blockNumber: number): Promise<void>;
25
- getAdapters(side: SwapSide): {
26
- name: string;
27
- index: number;
28
- }[] | null;
29
- getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
30
- getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<HelloData>>;
31
- getCalldataGasCost(poolPrices: PoolPrices<HelloData>): number | number[];
32
- getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: HelloData, side: SwapSide): AdapterExchangeParam;
33
- getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: HelloData, side: SwapSide): Promise<SimpleExchangeParam>;
34
- updatePoolState(): Promise<void>;
35
- getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
36
- releaseResources(): AsyncOrSync<void>;
37
- }
@@ -1,126 +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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Hello = void 0;
27
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
28
- const utils_1 = require("../../utils");
29
- const simple_exchange_1 = require("../simple-exchange");
30
- const config_1 = require("./config");
31
- const hello_pool_1 = require("./hello-pool");
32
- class Hello extends simple_exchange_1.SimpleExchange {
33
- constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network] || {}) {
34
- super(dexHelper, dexKey);
35
- this.network = network;
36
- this.dexKey = dexKey;
37
- this.dexHelper = dexHelper;
38
- this.adapters = adapters;
39
- this.hasConstantPriceLargeAmounts = false;
40
- // TODO: set true here if protocols works only with wrapped asset
41
- this.needWrapNative = true;
42
- this.isFeeOnTransferSupported = false;
43
- this.logger = dexHelper.getLogger(dexKey);
44
- this.eventPools = new hello_pool_1.HelloEventPool(dexKey, network, dexHelper, this.logger);
45
- }
46
- // Initialize pricing is called once in the start of
47
- // pricing service. It is intended to setup the integration
48
- // for pricing requests. It is optional for a DEX to
49
- // implement this function
50
- async initializePricing(blockNumber) {
51
- // TODO: complete me!
52
- }
53
- // Returns the list of contract adapters (name and index)
54
- // for a buy/sell. Return null if there are no adapters.
55
- getAdapters(side) {
56
- return this.adapters[side] ? this.adapters[side] : null;
57
- }
58
- // Returns list of pool identifiers that can be used
59
- // for a given swap. poolIdentifiers must be unique
60
- // across DEXes. It is recommended to use
61
- // ${dexKey}_${poolAddress} as a poolIdentifier
62
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
63
- // TODO: complete me!
64
- return [];
65
- }
66
- // Returns pool prices for amounts.
67
- // If limitPools is defined only pools in limitPools
68
- // should be used. If limitPools is undefined then
69
- // any pools can be used.
70
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
71
- // TODO: complete me!
72
- return null;
73
- }
74
- // Returns estimated gas cost of calldata for this DEX in multiSwap
75
- getCalldataGasCost(poolPrices) {
76
- // TODO: update if there is any payload in getAdapterParam
77
- return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
78
- }
79
- // Encode params required by the exchange adapter
80
- // Used for multiSwap, buy & megaSwap
81
- // Hint: abiCoder.encodeParameter() could be useful
82
- getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
83
- // TODO: complete me!
84
- const { exchange } = data;
85
- // Encode here the payload for adapter
86
- const payload = '';
87
- return {
88
- targetExchange: exchange,
89
- payload,
90
- networkFee: '0',
91
- };
92
- }
93
- // Encode call data used by simpleSwap like routers
94
- // Used for simpleSwap & simpleBuy
95
- // Hint: this.buildSimpleParamWithoutWETHConversion
96
- // could be useful
97
- async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
98
- // TODO: complete me!
99
- const { exchange } = data;
100
- // Encode here the transaction arguments
101
- const swapData = '';
102
- return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, exchange);
103
- }
104
- // This is called once before getTopPoolsForToken is
105
- // called for multiple tokens. This can be helpful to
106
- // update common state required for calculating
107
- // getTopPoolsForToken. It is optional for a DEX
108
- // to implement this
109
- async updatePoolState() {
110
- // TODO: complete me!
111
- }
112
- // Returns list of top pools based on liquidity. Max
113
- // limit number pools should be returned.
114
- async getTopPoolsForToken(tokenAddress, limit) {
115
- //TODO: complete me!
116
- return [];
117
- }
118
- // This is optional function in case if your implementation has acquired any resources
119
- // you need to release for graceful shutdown. For example, it may be any interval timer
120
- releaseResources() {
121
- // TODO: complete me!
122
- }
123
- }
124
- exports.Hello = Hello;
125
- Hello.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.HelloConfig);
126
- //# sourceMappingURL=hello.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hello.js","sourceRoot":"","sources":["../../../src/dex/hello/hello.ts"],"names":[],"mappings":"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"}
@@ -1,6 +0,0 @@
1
- import { Address } from '../../types';
2
- export declare type PoolState = {};
3
- export declare type HelloData = {
4
- exchange: Address;
5
- };
6
- export declare type DexParams = {};
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.MyTestDexConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.MyTestDexConfig = {
6
- MyTestDex: {
7
- // TODO: complete me!
8
- },
9
- };
10
- exports.Adapters = {
11
- // TODO: add adapters for each chain
12
- // This is an example to copy
13
- [constants_1.Network.MAINNET]: { [constants_1.SwapSide.SELL]: [{ name: '', index: 0 }] },
14
- };
15
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/my-test-dex/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,eAAe,GAA4B;IACtD,SAAS,EAAE;IACT,qBAAqB;KACtB;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC;IACvD,oCAAoC;IACpC,6BAA6B;IAC7B,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE;CACjE,CAAC"}
@@ -1,39 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { Log, Logger } from '../../types';
4
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
- import { IDexHelper } from '../../dex-helper/idex-helper';
6
- import { PoolState } from './types';
7
- export declare class MyTestDexEventPool extends StatefulEventSubscriber<PoolState> {
8
- readonly parentName: string;
9
- protected network: number;
10
- protected dexHelper: IDexHelper;
11
- protected myTestDexIface: Interface;
12
- handlers: {
13
- [event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
14
- };
15
- logDecoder: (log: Log) => any;
16
- addressesSubscribed: string[];
17
- constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, myTestDexIface?: Interface);
18
- /**
19
- * The function is called every time any of the subscribed
20
- * addresses release log. The function accepts the current
21
- * state, updates the state according to the log, and returns
22
- * the updated state.
23
- * @param state - Current state of event subscriber
24
- * @param log - Log released by one of the subscribed addresses
25
- * @returns Updates state of the event subscriber after the log
26
- */
27
- protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
28
- /**
29
- * The function generates state using on-chain calls. This
30
- * function is called to regenerate state if the event based
31
- * system fails to fetch events and the local state is no
32
- * more correct.
33
- * @param blockNumber - Blocknumber for which the state should
34
- * should be generated
35
- * @returns state of the event subscriber at blocknumber
36
- */
37
- generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
38
- handleMyEvent(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
39
- }