@paraswap/dex-lib 2.37.7-dexalot → 2.37.7

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 (171) hide show
  1. package/build/abi/quickPerps/fast-price-events.json +70 -0
  2. package/build/abi/quickPerps/fast-price-feed.json +748 -0
  3. package/build/abi/quickPerps/reader.json +313 -0
  4. package/build/abi/quickPerps/vault-price-feed.json +477 -0
  5. package/build/abi/quickPerps/vault.json +1953 -0
  6. package/build/config.js +2 -4
  7. package/build/config.js.map +1 -1
  8. package/build/dex/gmx/config.js +1 -1
  9. package/build/dex/idex.d.ts +1 -1
  10. package/build/dex/index.js +0 -2
  11. package/build/dex/index.js.map +1 -1
  12. package/build/dex/maverick-v1/scripts/event-sequence.d.ts +1 -0
  13. package/build/dex/maverick-v1/scripts/event-sequence.js +110 -0
  14. package/build/dex/maverick-v1/scripts/event-sequence.js.map +1 -0
  15. package/build/dex/{dexalot → test-dex}/config.d.ts +1 -1
  16. package/build/dex/test-dex/config.js +15 -0
  17. package/build/dex/test-dex/config.js.map +1 -0
  18. package/build/dex/test-dex/test-dex-pool.d.ts +39 -0
  19. package/build/dex/test-dex/test-dex-pool.js +63 -0
  20. package/build/dex/test-dex/test-dex-pool.js.map +1 -0
  21. package/build/dex/test-dex/test-dex.d.ts +37 -0
  22. package/build/dex/test-dex/test-dex.js +126 -0
  23. package/build/dex/test-dex/test-dex.js.map +1 -0
  24. package/build/dex/test-dex/types.d.ts +6 -0
  25. package/build/dex/{pancakeswap-v3 → test-dex}/types.js.map +1 -1
  26. package/build/dex/woo-fi-v2/woo-fi-math.d.ts +16 -0
  27. package/build/dex/woo-fi-v2/woo-fi-math.js +137 -0
  28. package/build/dex/woo-fi-v2/woo-fi-math.js.map +1 -0
  29. package/build/types.d.ts +0 -1
  30. package/build/workers.d.ts +0 -0
  31. package/build/workers.js +2 -0
  32. package/build/workers.js.map +1 -0
  33. package/package.json +1 -1
  34. package/src/config.ts +2 -5
  35. package/src/dex/gmx/config.ts +1 -1
  36. package/src/dex/idex.ts +0 -2
  37. package/src/dex/index.ts +0 -2
  38. package/src/types.ts +0 -1
  39. package/tests/constants-e2e.ts +2 -2
  40. package/.idea/aws.xml +0 -17
  41. package/.idea/codeStyles/Project.xml +0 -19
  42. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  43. package/.idea/misc.xml +0 -6
  44. package/.idea/modules.xml +0 -8
  45. package/.idea/paraswap-dex-lib.iml +0 -9
  46. package/.idea/vcs.xml +0 -6
  47. package/build/abi/algebra/AlgebraPool.abi.json +0 -727
  48. package/build/abi/curve-v1/StableSwapFRXETH.json +0 -889
  49. package/build/abi/curve-v1/StableSwapWBETH.json +0 -1223
  50. package/build/abi/dexalot/DexalotMainnetRFQ.json +0 -952
  51. package/build/abi/sushiswap-v3/QuoterV2.json +0 -267
  52. package/build/abi/sushiswap-v3/RouterProcessor3.json +0 -289
  53. package/build/abi/wBETH.json +0 -1527
  54. package/build/dex/algebra/algebra-pool.d.ts +0 -46
  55. package/build/dex/algebra/algebra-pool.js +0 -336
  56. package/build/dex/algebra/algebra-pool.js.map +0 -1
  57. package/build/dex/curve-v1/pools/frxETHpool.d.ts +0 -7
  58. package/build/dex/curve-v1/pools/frxETHpool.js +0 -27
  59. package/build/dex/curve-v1/pools/frxETHpool.js.map +0 -1
  60. package/build/dex/curve-v1/pools/wbETHpool.d.ts +0 -29
  61. package/build/dex/curve-v1/pools/wbETHpool.js +0 -408
  62. package/build/dex/curve-v1/pools/wbETHpool.js.map +0 -1
  63. package/build/dex/dexalot/config.js +0 -18
  64. package/build/dex/dexalot/config.js.map +0 -1
  65. package/build/dex/dexalot/constants.d.ts +0 -15
  66. package/build/dex/dexalot/constants.js +0 -22
  67. package/build/dex/dexalot/constants.js.map +0 -1
  68. package/build/dex/dexalot/dexalot.d.ts +0 -69
  69. package/build/dex/dexalot/dexalot.js +0 -642
  70. package/build/dex/dexalot/dexalot.js.map +0 -1
  71. package/build/dex/dexalot/rate-fetcher.d.ts +0 -28
  72. package/build/dex/dexalot/rate-fetcher.js +0 -100
  73. package/build/dex/dexalot/rate-fetcher.js.map +0 -1
  74. package/build/dex/dexalot/types.d.ts +0 -114
  75. package/build/dex/dexalot/types.js +0 -12
  76. package/build/dex/dexalot/types.js.map +0 -1
  77. package/build/dex/dexalot/validators.d.ts +0 -5
  78. package/build/dex/dexalot/validators.js +0 -45
  79. package/build/dex/dexalot/validators.js.map +0 -1
  80. package/build/dex/pancakeswap-v3/types.d.ts +0 -14
  81. package/build/dex/ramses-v2/config.d.ts +0 -4
  82. package/build/dex/ramses-v2/config.js +0 -28
  83. package/build/dex/ramses-v2/config.js.map +0 -1
  84. package/build/dex/ramses-v2/constants.d.ts +0 -28
  85. package/build/dex/ramses-v2/constants.js +0 -35
  86. package/build/dex/ramses-v2/constants.js.map +0 -1
  87. package/build/dex/ramses-v2/contract-math/BitMath.d.ts +0 -4
  88. package/build/dex/ramses-v2/contract-math/BitMath.js +0 -93
  89. package/build/dex/ramses-v2/contract-math/BitMath.js.map +0 -1
  90. package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +0 -3
  91. package/build/dex/ramses-v2/contract-math/FixedPoint128.js +0 -8
  92. package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +0 -1
  93. package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +0 -4
  94. package/build/dex/ramses-v2/contract-math/FixedPoint96.js +0 -9
  95. package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +0 -1
  96. package/build/dex/ramses-v2/contract-math/FullMath.d.ts +0 -4
  97. package/build/dex/ramses-v2/contract-math/FullMath.js +0 -19
  98. package/build/dex/ramses-v2/contract-math/FullMath.js.map +0 -1
  99. package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +0 -3
  100. package/build/dex/ramses-v2/contract-math/LiquidityMath.js +0 -22
  101. package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +0 -1
  102. package/build/dex/ramses-v2/contract-math/Oracle.d.ts +0 -10
  103. package/build/dex/ramses-v2/contract-math/Oracle.js +0 -133
  104. package/build/dex/ramses-v2/contract-math/Oracle.js.map +0 -1
  105. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +0 -10
  106. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +0 -91
  107. package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +0 -1
  108. package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +0 -8
  109. package/build/dex/ramses-v2/contract-math/SwapMath.js +0 -70
  110. package/build/dex/ramses-v2/contract-math/SwapMath.js.map +0 -1
  111. package/build/dex/ramses-v2/contract-math/Tick.d.ts +0 -7
  112. package/build/dex/ramses-v2/contract-math/Tick.js +0 -45
  113. package/build/dex/ramses-v2/contract-math/Tick.js.map +0 -1
  114. package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +0 -8
  115. package/build/dex/ramses-v2/contract-math/TickBitMap.js +0 -87
  116. package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +0 -1
  117. package/build/dex/ramses-v2/contract-math/TickMath.d.ts +0 -8
  118. package/build/dex/ramses-v2/contract-math/TickMath.js +0 -162
  119. package/build/dex/ramses-v2/contract-math/TickMath.js.map +0 -1
  120. package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +0 -3
  121. package/build/dex/ramses-v2/contract-math/UnsafeMath.js +0 -10
  122. package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +0 -1
  123. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +0 -18
  124. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +0 -392
  125. package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +0 -1
  126. package/build/dex/ramses-v2/contract-math/utils.d.ts +0 -3
  127. package/build/dex/ramses-v2/contract-math/utils.js +0 -16
  128. package/build/dex/ramses-v2/contract-math/utils.js.map +0 -1
  129. package/build/dex/ramses-v2/ramses-v2-pool.d.ts +0 -42
  130. package/build/dex/ramses-v2/ramses-v2-pool.js +0 -307
  131. package/build/dex/ramses-v2/ramses-v2-pool.js.map +0 -1
  132. package/build/dex/ramses-v2/ramses-v2.d.ts +0 -61
  133. package/build/dex/ramses-v2/ramses-v2.js +0 -690
  134. package/build/dex/ramses-v2/ramses-v2.js.map +0 -1
  135. package/build/dex/ramses-v2/types.d.ts +0 -154
  136. package/build/dex/ramses-v2/types.js +0 -9
  137. package/build/dex/ramses-v2/types.js.map +0 -1
  138. package/build/dex/ramses-v2/utils.d.ts +0 -6
  139. package/build/dex/ramses-v2/utils.js +0 -71
  140. package/build/dex/ramses-v2/utils.js.map +0 -1
  141. package/build/dex/sushiswap-v3/config.d.ts +0 -4
  142. package/build/dex/sushiswap-v3/config.js +0 -132
  143. package/build/dex/sushiswap-v3/config.js.map +0 -1
  144. package/build/dex/sushiswap-v3/constants.d.ts +0 -4
  145. package/build/dex/sushiswap-v3/constants.js +0 -32
  146. package/build/dex/sushiswap-v3/constants.js.map +0 -1
  147. package/build/dex/sushiswap-v3/sushiswap-v3-original.d.ts +0 -56
  148. package/build/dex/sushiswap-v3/sushiswap-v3-original.js +0 -598
  149. package/build/dex/sushiswap-v3/sushiswap-v3-original.js.map +0 -1
  150. package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +0 -1
  151. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +0 -6
  152. package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +0 -1
  153. package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +0 -21
  154. package/build/dex/sushiswap-v3/sushiswap-v3.js +0 -58
  155. package/build/dex/sushiswap-v3/sushiswap-v3.js.map +0 -1
  156. package/build/dex/sushiswap-v3/token.d.ts +0 -6
  157. package/build/dex/sushiswap-v3/token.js +0 -23
  158. package/build/dex/sushiswap-v3/token.js.map +0 -1
  159. package/build/dex/sushiswap-v3/types.d.ts +0 -15
  160. package/build/dex/sushiswap-v3/types.js +0 -18
  161. package/build/dex/sushiswap-v3/types.js.map +0 -1
  162. package/src/abi/dexalot/DexalotMainnetRFQ.json +0 -952
  163. package/src/dex/dexalot/config.ts +0 -18
  164. package/src/dex/dexalot/constants.ts +0 -29
  165. package/src/dex/dexalot/dexalot-e2e.test.ts +0 -192
  166. package/src/dex/dexalot/dexalot-integration.test.ts +0 -188
  167. package/src/dex/dexalot/dexalot.ts +0 -998
  168. package/src/dex/dexalot/rate-fetcher.ts +0 -197
  169. package/src/dex/dexalot/types.ts +0 -131
  170. package/src/dex/dexalot/validators.ts +0 -46
  171. /package/build/dex/{pancakeswap-v3 → test-dex}/types.js +0 -0
@@ -1,18 +0,0 @@
1
- import { DexParams } from './types';
2
- import { DexConfigMap, AdapterMappings } from '../../types';
3
- import { Network, SwapSide } from '../../constants';
4
-
5
- export const DexalotConfig: DexConfigMap<DexParams> = {
6
- Dexalot: {
7
- [Network.AVALANCHE]: {
8
- mainnetRFQAddress: '0xEed3c159F3A96aB8d41c8B9cA49EE1e5071A7cdD',
9
- },
10
- },
11
- };
12
-
13
- export const Adapters: Record<number, AdapterMappings> = {
14
- [Network.AVALANCHE]: {
15
- [SwapSide.SELL]: [{ name: 'AvalancheAdapter02', index: 6 }],
16
- [SwapSide.BUY]: [{ name: 'AvalancheBuyAdapter', index: 8 }],
17
- },
18
- };
@@ -1,29 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
-
3
- export const DEXALOT_PRICES_CACHES_TTL_S = 3;
4
-
5
- export const DEXALOT_PAIRS_CACHES_TTL_S = 21 * 60; // 21 mins
6
-
7
- export const DEXALOT_TOKENS_CACHES_TTL_S = 21 * 60; // 21 mins
8
-
9
- export const DEXALOT_BLACKLIST_CACHES_TTL_S = 180 * 60; // 3 hours
10
-
11
- export const DEXALOT_API_PRICES_POLLING_INTERVAL_MS = 1000;
12
-
13
- export const DEXALOT_API_PAIRS_POLLING_INTERVAL_MS = 1000 * 60 * 10; // 10 mins
14
-
15
- export const DEXALOT_API_BLACKLIST_POLLING_INTERVAL_MS = 1000 * 60 * 60; // 1 hour
16
-
17
- export const DEXALOT_API_URL = 'https://api.dexalot.com';
18
-
19
- export const DEXALOT_GAS_COST = 120_000;
20
-
21
- export const DEXALOT_RATE_LIMITED_TTL_S = 60 * 60; // 1 hour
22
-
23
- export const DEXALOT_RATELIMIT_CACHE_VALUE = 'limited';
24
-
25
- export const DEXALOT_RESTRICT_TTL_S = 60 * 30; // 30 minutes
26
-
27
- export const DEXALOT_RESTRICTED_CACHE_KEY = 'restricted';
28
-
29
- export const DEXALOT_MIN_SLIPPAGE_FACTOR_THRESHOLD_FOR_RESTRICTION = new BigNumber('0.001');
@@ -1,192 +0,0 @@
1
- import dotenv from 'dotenv';
2
- dotenv.config();
3
-
4
- import { testE2E } from '../../../tests/utils-e2e';
5
- import {
6
- Tokens,
7
- NativeTokenSymbols,
8
- Holders,
9
- } from '../../../tests/constants-e2e';
10
- import { Network, ContractMethod, SwapSide } from '../../constants';
11
- import { StaticJsonRpcProvider } from '@ethersproject/providers';
12
- import { generateConfig } from '../../config';
13
-
14
- function testForNetwork(
15
- network: Network,
16
- dexKey: string,
17
- tokenASymbol: string,
18
- tokenBSymbol: string,
19
- tokenAAmount: string,
20
- tokenBAmount: string,
21
- nativeTokenAmount: string,
22
- excludeNativeTokenTests: boolean = false,
23
- ) {
24
- const config = generateConfig(network);
25
- const provider = new StaticJsonRpcProvider(
26
- config.privateHttpProvider,
27
- network,
28
- );
29
- const tokens = Tokens[network];
30
- const holders = Holders[network];
31
- const nativeTokenSymbol = NativeTokenSymbols[network];
32
- const sleepMs = 20000;
33
-
34
- const sideToContractMethods = new Map([
35
- [SwapSide.SELL, [
36
- ContractMethod.simpleSwap,
37
- ContractMethod.megaSwap,
38
- ContractMethod.multiSwap
39
- ]],
40
- [SwapSide.BUY, [
41
- ContractMethod.simpleBuy,
42
- ContractMethod.buy
43
- ]],
44
- ]);
45
-
46
- describe(`${network}`, () => {
47
- sideToContractMethods.forEach((contractMethods, side) =>
48
- describe(`${side}`, () => {
49
- contractMethods.forEach((contractMethod: ContractMethod) => {
50
- describe(`${contractMethod}`, () => {
51
- if (excludeNativeTokenTests) {
52
- it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
53
- await testE2E(
54
- tokens[tokenASymbol],
55
- tokens[tokenBSymbol],
56
- holders[tokenASymbol],
57
- side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
58
- side,
59
- dexKey,
60
- contractMethod,
61
- network,
62
- provider,
63
- undefined,
64
- undefined,
65
- undefined,
66
- undefined,
67
- sleepMs,
68
- );
69
- });
70
- it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
71
- await testE2E(
72
- tokens[tokenBSymbol],
73
- tokens[tokenASymbol],
74
- holders[tokenBSymbol],
75
- side === SwapSide.SELL ? tokenBAmount : tokenAAmount,
76
- side,
77
- dexKey,
78
- contractMethod,
79
- network,
80
- provider,
81
- undefined,
82
- undefined,
83
- undefined,
84
- undefined,
85
- sleepMs,
86
- );
87
- });
88
- } else {
89
- it(`${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
90
- await testE2E(
91
- tokens[nativeTokenSymbol],
92
- tokens[tokenASymbol],
93
- holders[nativeTokenSymbol],
94
- side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
95
- side,
96
- dexKey,
97
- contractMethod,
98
- network,
99
- provider,
100
- undefined,
101
- undefined,
102
- undefined,
103
- undefined,
104
- sleepMs,
105
- );
106
- });
107
- it(`${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
108
- await testE2E(
109
- tokens[tokenASymbol],
110
- tokens[nativeTokenSymbol],
111
- holders[tokenASymbol],
112
- side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
113
- side,
114
- dexKey,
115
- contractMethod,
116
- network,
117
- provider,
118
- undefined,
119
- undefined,
120
- undefined,
121
- undefined,
122
- sleepMs,
123
- );
124
- });
125
- it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
126
- await testE2E(
127
- tokens[tokenASymbol],
128
- tokens[tokenBSymbol],
129
- holders[tokenASymbol],
130
- side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
131
- side,
132
- dexKey,
133
- contractMethod,
134
- network,
135
- provider,
136
- undefined,
137
- undefined,
138
- undefined,
139
- undefined,
140
- sleepMs,
141
- );
142
- });
143
- it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => {
144
- await testE2E(
145
- tokens[tokenBSymbol],
146
- tokens[tokenASymbol],
147
- holders[tokenBSymbol],
148
- side === SwapSide.SELL ? tokenBAmount : tokenAAmount,
149
- side,
150
- dexKey,
151
- contractMethod,
152
- network,
153
- provider,
154
- undefined,
155
- undefined,
156
- undefined,
157
- undefined,
158
- sleepMs,
159
- );
160
- });
161
- }
162
- });
163
- });
164
- }),
165
- );
166
- });
167
- }
168
-
169
- describe('Dexalot E2E', () => {
170
- const dexKey = 'Dexalot';
171
-
172
- describe('Avalanche', () => {
173
- const network = Network.AVALANCHE;
174
-
175
- const tokenASymbol: string = 'USDC';
176
- const tokenBSymbol: string = 'USDT';
177
-
178
- const tokenAAmount: string = '1000000';
179
- const tokenBAmount: string = '1000000';
180
- const nativeTokenAmount = '1000000000000000000';
181
-
182
- testForNetwork(
183
- network,
184
- dexKey,
185
- tokenASymbol,
186
- tokenBSymbol,
187
- tokenAAmount,
188
- tokenBAmount,
189
- nativeTokenAmount,
190
- );
191
- });
192
- });
@@ -1,188 +0,0 @@
1
- /* eslint-disable no-console */
2
- import dotenv from 'dotenv';
3
- dotenv.config();
4
-
5
- import { DummyDexHelper } from '../../dex-helper/index';
6
- import { Network, SwapSide } from '../../constants';
7
- import { BI_POWS } from '../../bigint-constants';
8
- import { Dexalot } from './dexalot';
9
- import {
10
- checkPoolPrices,
11
- checkPoolsLiquidity,
12
- checkConstantPoolPrices,
13
- sleep,
14
- } from '../../../tests/utils';
15
- import { Tokens } from '../../../tests/constants-e2e';
16
-
17
- async function testPricingOnNetwork(
18
- dexalot: Dexalot,
19
- network: Network,
20
- dexKey: string,
21
- blockNumber: number,
22
- srcTokenSymbol: string,
23
- destTokenSymbol: string,
24
- side: SwapSide,
25
- amounts: bigint[],
26
- ) {
27
- const networkTokens = Tokens[network];
28
-
29
- const pools = await dexalot.getPoolIdentifiers(
30
- networkTokens[srcTokenSymbol],
31
- networkTokens[destTokenSymbol],
32
- side,
33
- blockNumber,
34
- );
35
- console.log(
36
- `${srcTokenSymbol} <> ${destTokenSymbol} Pool Identifiers: `,
37
- pools,
38
- );
39
-
40
- expect(pools.length).toBeGreaterThan(0);
41
-
42
- const poolPrices = await dexalot.getPricesVolume(
43
- networkTokens[srcTokenSymbol],
44
- networkTokens[destTokenSymbol],
45
- amounts,
46
- side,
47
- blockNumber,
48
- pools,
49
- );
50
- console.log(
51
- `${srcTokenSymbol} <> ${destTokenSymbol} Pool Prices: `,
52
- poolPrices,
53
- );
54
-
55
- expect(poolPrices).not.toBeNull();
56
- if (dexalot.hasConstantPriceLargeAmounts) {
57
- checkConstantPoolPrices(poolPrices!, amounts, dexKey);
58
- } else {
59
- checkPoolPrices(poolPrices!, amounts, side, dexKey);
60
- }
61
- }
62
-
63
- describe('Dexalot', function () {
64
- const dexKey = 'Dexalot';
65
- let blockNumber: number;
66
- let dexalot: Dexalot;
67
-
68
- describe('Avalanche', () => {
69
- const network = Network.AVALANCHE;
70
- const dexHelper = new DummyDexHelper(network);
71
-
72
- const tokens = Tokens[network];
73
-
74
- const tokenASymbol = 'AVAX';
75
- const tokenBSymbol = 'USDC';
76
-
77
- const amountsForTokenA = [
78
- 0n,
79
- 1n * BI_POWS[tokens[tokenASymbol].decimals],
80
- 2n * BI_POWS[tokens[tokenASymbol].decimals],
81
- 3n * BI_POWS[tokens[tokenASymbol].decimals],
82
- 4n * BI_POWS[tokens[tokenASymbol].decimals],
83
- 5n * BI_POWS[tokens[tokenASymbol].decimals],
84
- 6n * BI_POWS[tokens[tokenASymbol].decimals],
85
- 7n * BI_POWS[tokens[tokenASymbol].decimals],
86
- 8n * BI_POWS[tokens[tokenASymbol].decimals],
87
- 9n * BI_POWS[tokens[tokenASymbol].decimals],
88
- 10n * BI_POWS[tokens[tokenASymbol].decimals],
89
- ];
90
-
91
- const amountsForTokenB = [
92
- 0n,
93
- 1n * BI_POWS[tokens[tokenBSymbol].decimals],
94
- 2n * BI_POWS[tokens[tokenBSymbol].decimals],
95
- 3n * BI_POWS[tokens[tokenBSymbol].decimals],
96
- 4n * BI_POWS[tokens[tokenBSymbol].decimals],
97
- 5n * BI_POWS[tokens[tokenBSymbol].decimals],
98
- 6n * BI_POWS[tokens[tokenBSymbol].decimals],
99
- 7n * BI_POWS[tokens[tokenBSymbol].decimals],
100
- 8n * BI_POWS[tokens[tokenBSymbol].decimals],
101
- 9n * BI_POWS[tokens[tokenBSymbol].decimals],
102
- 10n * BI_POWS[tokens[tokenBSymbol].decimals],
103
- ];
104
-
105
- beforeEach(async () => {
106
- blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
107
- dexalot = new Dexalot(network, dexKey, dexHelper);
108
- await dexalot.initializePricing(blockNumber);
109
- await sleep(5000);
110
- });
111
-
112
- afterEach(async () => {
113
- dexalot.releaseResources();
114
- await sleep(5000);
115
- });
116
-
117
- it(`getPoolIdentifiers and getPricesVolume SELL ${tokenASymbol} ${tokenBSymbol}`, async function () {
118
- await testPricingOnNetwork(
119
- dexalot,
120
- network,
121
- dexKey,
122
- blockNumber,
123
- tokenASymbol,
124
- tokenBSymbol,
125
- SwapSide.SELL,
126
- amountsForTokenA,
127
- );
128
- });
129
-
130
- it(`getPoolIdentifiers and getPricesVolume BUY ${tokenASymbol} ${tokenBSymbol}`, async function () {
131
- await testPricingOnNetwork(
132
- dexalot,
133
- network,
134
- dexKey,
135
- blockNumber,
136
- tokenASymbol,
137
- tokenBSymbol,
138
- SwapSide.BUY,
139
- amountsForTokenB,
140
- );
141
- });
142
-
143
- it(`getPoolIdentifiers and getPricesVolume SELL ${tokenBSymbol} ${tokenASymbol}`, async function () {
144
- await testPricingOnNetwork(
145
- dexalot,
146
- network,
147
- dexKey,
148
- blockNumber,
149
- tokenBSymbol,
150
- tokenASymbol,
151
- SwapSide.SELL,
152
- amountsForTokenB,
153
- );
154
- });
155
-
156
- it(`getPoolIdentifiers and getPricesVolume BUY ${tokenBSymbol} ${tokenASymbol}`, async function () {
157
- await testPricingOnNetwork(
158
- dexalot,
159
- network,
160
- dexKey,
161
- blockNumber,
162
- tokenBSymbol,
163
- tokenASymbol,
164
- SwapSide.BUY,
165
- amountsForTokenA,
166
- );
167
- });
168
-
169
- it('getTopPoolsForToken', async function () {
170
- // We have to check without calling initializePricing, because
171
- // pool-tracker is not calling that function
172
- const dexalot = new Dexalot(network, dexKey, dexHelper);
173
- const poolLiquidity = await dexalot.getTopPoolsForToken(
174
- tokens[tokenASymbol].address,
175
- 10,
176
- );
177
- console.log(`${tokenASymbol} Top Pools:`, poolLiquidity);
178
-
179
- if (!dexalot.hasConstantPriceLargeAmounts) {
180
- checkPoolsLiquidity(
181
- poolLiquidity,
182
- Tokens[network][tokenASymbol].address,
183
- dexKey,
184
- );
185
- }
186
- });
187
- });
188
- });