@paraswap/dex-lib 2.21.0 → 2.21.1-chronos

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 (131) hide show
  1. package/build/config.js +2 -4
  2. package/build/config.js.map +1 -1
  3. package/build/dex/balancer-v2/balancer-v2.d.ts +3 -9
  4. package/build/dex/balancer-v2/balancer-v2.js +0 -83
  5. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  6. package/build/dex/balancer-v2/constants.d.ts +0 -4
  7. package/build/dex/balancer-v2/constants.js +1 -6
  8. package/build/dex/balancer-v2/constants.js.map +1 -1
  9. package/build/dex/balancer-v2/types.d.ts +1 -20
  10. package/build/dex/balancer-v2/types.js.map +1 -1
  11. package/build/dex/curve-v1/constants.d.ts +0 -1
  12. package/build/dex/curve-v1/constants.js +1 -2
  13. package/build/dex/curve-v1/constants.js.map +1 -1
  14. package/build/dex/curve-v1/curve-v1.d.ts +3 -9
  15. package/build/dex/curve-v1/curve-v1.js +4 -92
  16. package/build/dex/curve-v1/curve-v1.js.map +1 -1
  17. package/build/dex/curve-v1/types.d.ts +0 -24
  18. package/build/dex/curve-v1/types.js +1 -6
  19. package/build/dex/curve-v1/types.js.map +1 -1
  20. package/build/dex/curve-v1-factory/constants.d.ts +0 -1
  21. package/build/dex/curve-v1-factory/constants.js +1 -2
  22. package/build/dex/curve-v1-factory/constants.js.map +1 -1
  23. package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +4 -11
  24. package/build/dex/curve-v1-factory/curve-v1-factory.js +0 -87
  25. package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
  26. package/build/dex/curve-v1-factory/types.d.ts +0 -24
  27. package/build/dex/curve-v1-factory/types.js +1 -6
  28. package/build/dex/curve-v1-factory/types.js.map +1 -1
  29. package/build/dex/curve-v2.d.ts +7 -29
  30. package/build/dex/curve-v2.js +1 -91
  31. package/build/dex/curve-v2.js.map +1 -1
  32. package/build/dex/idex.d.ts +1 -1
  33. package/build/dex/index.js +2 -4
  34. package/build/dex/index.js.map +1 -1
  35. package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +2 -2
  36. package/build/dex/pancakeswap-v3/utils.js.map +1 -1
  37. package/build/dex/quickswap/config.js +0 -8
  38. package/build/dex/quickswap/config.js.map +1 -1
  39. package/build/dex/simple-exchange.d.ts +0 -2
  40. package/build/dex/simple-exchange.js +0 -1
  41. package/build/dex/simple-exchange.js.map +1 -1
  42. package/build/dex/solidly/config.js +13 -0
  43. package/build/dex/solidly/config.js.map +1 -1
  44. package/build/dex/solidly/forks-override/chronos.d.ts +3 -0
  45. package/build/dex/solidly/forks-override/chronos.js +88 -0
  46. package/build/dex/solidly/forks-override/chronos.js.map +1 -1
  47. package/build/dex/solidly/solidly.js +1 -0
  48. package/build/dex/solidly/solidly.js.map +1 -1
  49. package/build/dex/uniswap-v2/uniswap-v2.d.ts +1 -1
  50. package/build/dex/uniswap-v2/uniswap-v2.js +1 -1
  51. package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
  52. package/build/dex/uniswap-v3/constants.d.ts +0 -4
  53. package/build/dex/uniswap-v3/constants.js +1 -6
  54. package/build/dex/uniswap-v3/constants.js.map +1 -1
  55. package/build/dex/uniswap-v3/types.d.ts +3 -20
  56. package/build/dex/uniswap-v3/types.js.map +1 -1
  57. package/build/dex/uniswap-v3/uniswap-v3.d.ts +1 -7
  58. package/build/dex/uniswap-v3/uniswap-v3.js +1 -85
  59. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  60. package/build/dex/woo-fi-v2/config.js +6 -6
  61. package/build/dex/zerox/index.d.ts +1 -1
  62. package/build/dex/zerox/index.js +1 -1
  63. package/build/dex/zerox/index.js.map +1 -1
  64. package/build/implementations/local-paraswap-sdk.js +1 -5
  65. package/build/implementations/local-paraswap-sdk.js.map +1 -1
  66. package/build/router/directswap.js +1 -7
  67. package/build/router/directswap.js.map +1 -1
  68. package/build/router/index.js.map +1 -1
  69. package/build/router/payload-encoder.js +6 -16
  70. package/build/router/payload-encoder.js.map +1 -1
  71. package/build/types.d.ts +0 -2
  72. package/build/utils.d.ts +0 -2
  73. package/build/utils.js +1 -5
  74. package/build/utils.js.map +1 -1
  75. package/package.json +4 -6
  76. package/src/config.ts +2 -5
  77. package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +0 -79
  78. package/src/dex/balancer-v2/balancer-v2.ts +4 -153
  79. package/src/dex/balancer-v2/constants.ts +0 -5
  80. package/src/dex/balancer-v2/types.ts +1 -21
  81. package/src/dex/curve-v1/constants.ts +0 -2
  82. package/src/dex/curve-v1/curve-v1-e2e.test.ts +0 -57
  83. package/src/dex/curve-v1/curve-v1.ts +5 -144
  84. package/src/dex/curve-v1/types.ts +0 -26
  85. package/src/dex/curve-v1-factory/constants.ts +0 -2
  86. package/src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts +0 -1
  87. package/src/dex/curve-v1-factory/curve-v1-factory.ts +4 -140
  88. package/src/dex/curve-v1-factory/types.ts +0 -26
  89. package/src/dex/curve-v2.ts +8 -169
  90. package/src/dex/idex.ts +0 -6
  91. package/src/dex/index.ts +2 -4
  92. package/src/dex/pancakeswap-v3/pancakeswap-v3-e2e.test.ts +6 -3
  93. package/src/dex/pancakeswap-v3/pancakeswap-v3-integration.test.ts +14 -3
  94. package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +3 -3
  95. package/src/dex/pancakeswap-v3/utils.ts +4 -1
  96. package/src/dex/quickswap/config.ts +0 -9
  97. package/src/dex/quickswap/quickswap-e2e.test.ts +0 -109
  98. package/src/dex/simple-exchange.ts +0 -6
  99. package/src/dex/solidly/config.ts +14 -0
  100. package/src/dex/solidly/forks-override/chronos.ts +206 -0
  101. package/src/dex/solidly/solidly-e2e.test.ts +205 -31
  102. package/src/dex/solidly/solidly-integration.test.ts +141 -0
  103. package/src/dex/solidly/solidly.ts +1 -0
  104. package/src/dex/uniswap-v2/uniswap-v2.ts +0 -6
  105. package/src/dex/uniswap-v3/constants.ts +0 -5
  106. package/src/dex/uniswap-v3/types.ts +3 -23
  107. package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +2 -100
  108. package/src/dex/uniswap-v3/uniswap-v3.ts +3 -138
  109. package/src/dex/woo-fi-v2/config.ts +6 -6
  110. package/src/dex/zerox/index.ts +0 -7
  111. package/src/implementations/local-paraswap-sdk.ts +1 -8
  112. package/src/router/directswap.ts +0 -23
  113. package/src/router/index.ts +2 -0
  114. package/src/router/payload-encoder.ts +5 -22
  115. package/src/types.ts +0 -2
  116. package/src/utils.ts +0 -5
  117. package/tests/constants-e2e.ts +9 -4
  118. package/tests/utils-e2e.ts +20 -140
  119. package/tests/utils.ts +0 -52
  120. package/src/abi/DirectSwap.json +0 -1018
  121. package/src/abi/swaap-v2/vault.json +0 -918
  122. package/src/dex/quickswap/camelot-v3.ts +0 -15
  123. package/src/dex/swaap-v2/config.ts +0 -19
  124. package/src/dex/swaap-v2/constants.ts +0 -37
  125. package/src/dex/swaap-v2/rate-fetcher.ts +0 -214
  126. package/src/dex/swaap-v2/swaap-v2-e2e.test.ts +0 -172
  127. package/src/dex/swaap-v2/swaap-v2-integration.test.ts +0 -142
  128. package/src/dex/swaap-v2/swaap-v2.ts +0 -901
  129. package/src/dex/swaap-v2/types.ts +0 -95
  130. package/src/dex/swaap-v2/utils.ts +0 -36
  131. package/src/dex/swaap-v2/validators.ts +0 -128
@@ -353,115 +353,6 @@ describe('QuickSwap', () => {
353
353
  });
354
354
  });
355
355
  });
356
-
357
- describe('CamelotV3', () => {
358
- const dexKey = 'CamelotV3';
359
-
360
- const sideToContractMethods = new Map([
361
- [
362
- SwapSide.SELL,
363
- [
364
- ContractMethod.simpleSwap,
365
- ContractMethod.multiSwap,
366
- ContractMethod.megaSwap,
367
- ],
368
- ],
369
- [ SwapSide.BUY, [ ContractMethod.simpleBuy, ContractMethod.buy ] ],
370
- ]);
371
-
372
- const pairs: { name: string; sellAmount: string; buyAmount: string }[][] =
373
- [
374
- [
375
- {
376
- name: 'WBTC',
377
- sellAmount: '1000',
378
- buyAmount: '151080000000000',
379
- },
380
- {
381
- name: 'WETH',
382
- sellAmount: '1050000000000',
383
- buyAmount: '1000',
384
- },
385
- ],
386
- [
387
- {
388
- name: 'WBTC',
389
- sellAmount: '1000',
390
- buyAmount: '1300000',
391
- },
392
- {
393
- name: 'USDC',
394
- sellAmount: '1000000',
395
- buyAmount: '1000',
396
- },
397
- ],
398
- [
399
- {
400
- name: 'WETH',
401
- sellAmount: '10000000000',
402
- buyAmount: '10000000',
403
- },
404
- {
405
- name: 'USDC',
406
- sellAmount: '10000000',
407
- buyAmount: '10000000000',
408
- },
409
- ],
410
- [
411
- {
412
- name: 'ETH',
413
- sellAmount: '10000000000',
414
- buyAmount: '10000000',
415
- },
416
- {
417
- name: 'USDC',
418
- sellAmount: '10000000',
419
- buyAmount: '10000000000',
420
- },
421
- ],
422
- ];
423
-
424
- sideToContractMethods.forEach((contractMethods, side) =>
425
- describe(`${side}`, () => {
426
- contractMethods.forEach((contractMethod: ContractMethod) => {
427
- pairs.forEach(pair => {
428
- describe(`${contractMethod}`, () => {
429
- it(`${pair[0].name} -> ${pair[1].name}`, async () => {
430
- await testE2E(
431
- tokens[pair[0].name],
432
- tokens[pair[1].name],
433
- holders[pair[0].name],
434
- side === SwapSide.SELL
435
- ? pair[0].sellAmount
436
- : pair[0].buyAmount,
437
- side,
438
- dexKey,
439
- contractMethod,
440
- network,
441
- provider,
442
- );
443
- });
444
- it(`${pair[1].name} -> ${pair[0].name}`, async () => {
445
- await testE2E(
446
- tokens[pair[1].name],
447
- tokens[pair[0].name],
448
- holders[pair[1].name],
449
- side === SwapSide.SELL
450
- ? pair[1].sellAmount
451
- : pair[1].buyAmount,
452
- side,
453
- dexKey,
454
- contractMethod,
455
- network,
456
- provider,
457
- );
458
- });
459
- });
460
- });
461
- });
462
- }),
463
- );
464
- });
465
356
  });
466
357
 
467
358
  describe('Fantom', () => {
@@ -1,6 +1,5 @@
1
1
  import { Interface } from '@ethersproject/abi';
2
2
  import Web3Abi, { AbiCoder } from 'web3-eth-abi';
3
- import { Contract } from 'web3-eth-contract';
4
3
  import { Address, SimpleExchangeParam, NumberAsString } from '../types';
5
4
  import { CACHE_PREFIX, ETHER_ADDRESS } from '../constants';
6
5
  import SimpleSwapHelperABI from '../abi/SimpleSwapHelperRouter.json';
@@ -10,7 +9,6 @@ import { isETHAddress } from '../utils';
10
9
  import { MAX_UINT } from '../constants';
11
10
  import Web3 from 'web3';
12
11
  import { IDexHelper } from '../dex-helper';
13
- import { AbiItem } from 'web3-utils';
14
12
 
15
13
  /*
16
14
  * Context: Augustus routers have all a deadline protection logic implemented globally.
@@ -28,7 +26,6 @@ export class SimpleExchange {
28
26
  simpleSwapHelper: Interface;
29
27
  protected abiCoder: AbiCoder;
30
28
  erc20Interface: Interface;
31
- erc20Contract: Contract;
32
29
 
33
30
  needWrapNative = false;
34
31
  isFeeOnTransferSupported = false;
@@ -45,9 +42,6 @@ export class SimpleExchange {
45
42
  constructor(dexHelper: IDexHelper, public dexKey: string) {
46
43
  this.simpleSwapHelper = new Interface(SimpleSwapHelperABI);
47
44
  this.erc20Interface = new Interface(ERC20ABI);
48
- this.erc20Contract = new dexHelper.web3Provider.eth.Contract(
49
- ERC20ABI as AbiItem[],
50
- );
51
45
  this.abiCoder = Web3Abi as unknown as AbiCoder;
52
46
 
53
47
  this.network = dexHelper.config.data.network;
@@ -114,6 +114,17 @@ export const SolidlyConfig: DexConfigMap<DexParams> = {
114
114
  feeCode: 2,
115
115
  },
116
116
  },
117
+ Chronos: {
118
+ [Network.ARBITRUM]: {
119
+ subgraphURL: 'https://api.thegraph.com/subgraphs/name/xliee/chronos',
120
+ factoryAddress: '0xce9240869391928253ed9cc9bcb8cb98cb5b0722',
121
+ router: '0xb2634B3CBc1E401AB3C2743DB44d459C5c9aA662',
122
+ initCode:
123
+ '0x1840ae455256f509042de907fe0623f2e5e0ad44751ef974c4c37c1e516b7644',
124
+ poolGasCost: 180 * 1000,
125
+ feeCode: 0,
126
+ },
127
+ },
117
128
  };
118
129
 
119
130
  export const Adapters: Record<number, AdapterMappings> = {
@@ -135,4 +146,7 @@ export const Adapters: Record<number, AdapterMappings> = {
135
146
  [Network.AVALANCHE]: {
136
147
  [SwapSide.SELL]: [{ name: 'AvalancheAdapter02', index: 3 }], // solisnek
137
148
  },
149
+ [Network.ARBITRUM]: {
150
+ [SwapSide.SELL]: [{ name: 'ArbitrumAdapter02', index: 1 }], // chronos
151
+ },
138
152
  };
@@ -0,0 +1,206 @@
1
+ import { Solidly } from '../solidly';
2
+ import { SolidlyPair } from '../types';
3
+ import { Network, SUBGRAPH_TIMEOUT } from '../../../constants';
4
+ import { IDexHelper } from '../../../dex-helper';
5
+ import { Interface } from '@ethersproject/abi';
6
+ import { getDexKeysWithNetwork } from '../../../utils';
7
+ import { SolidlyConfig } from '../config';
8
+ import _ from 'lodash';
9
+ import { Address, PoolLiquidity } from '../../../types';
10
+ import BigNumber from 'bignumber.js';
11
+
12
+ const ChronosFactoryABI = [
13
+ {
14
+ inputs: [{ internalType: 'bool', name: '_stable', type: 'bool' }],
15
+ name: 'getFee',
16
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
17
+ stateMutability: 'view',
18
+ type: 'function',
19
+ },
20
+ ];
21
+
22
+ const chronosFactoryIface = new Interface(ChronosFactoryABI);
23
+
24
+ type ChronosSubgraphPool = {
25
+ id: string;
26
+ isStable: boolean;
27
+ token0: { id: string; decimals: string };
28
+ reserve0: string;
29
+ reserve1: string;
30
+ token1: { id: string; decimals: string; };
31
+ };
32
+
33
+ export class Chronos extends Solidly {
34
+ public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
35
+ getDexKeysWithNetwork(_.pick(SolidlyConfig, ['Chronos']));
36
+
37
+ constructor(
38
+ protected network: Network,
39
+ dexKey: string,
40
+ protected dexHelper: IDexHelper,
41
+ ) {
42
+ super(
43
+ network,
44
+ dexKey,
45
+ dexHelper,
46
+ true, // dynamic fees
47
+ );
48
+ }
49
+
50
+ protected getFeesMultiCallData(pair: SolidlyPair) {
51
+ const callEntry = {
52
+ target: this.factoryAddress,
53
+ callData: chronosFactoryIface.encodeFunctionData('getFee', [pair.stable]),
54
+ };
55
+ const callDecoder = (values: any[]) =>
56
+ parseInt(
57
+ chronosFactoryIface
58
+ .decodeFunctionResult('getFee', values)[0]
59
+ .toString(),
60
+ );
61
+
62
+ return {
63
+ callEntry,
64
+ callDecoder,
65
+ };
66
+ }
67
+
68
+ async getTopPoolsForToken(
69
+ tokenAddress: Address,
70
+ count: number,
71
+ ): Promise<PoolLiquidity[]> {
72
+ if (!this.subgraphURL) return [];
73
+
74
+ const query = `query ($token: Bytes!, $count: Int) {
75
+ pools0: pairs(first: $count, orderBy: reserve0, orderDirection: desc, where: {token0: $token, reserve0_gt: 1, reserve1_gt: 1}) {
76
+ id
77
+ isStable
78
+ token0 {
79
+ id
80
+ decimals
81
+ }
82
+ token1 {
83
+ id
84
+ decimals
85
+ }
86
+ reserve0,
87
+ reserve1,
88
+ }
89
+ pools1: pairs(first: $count, orderBy: reserve1, orderDirection: desc, where: {token1: $token, reserve0_gt: 1, reserve1_gt: 1}) {
90
+ id
91
+ isStable
92
+ token0 {
93
+ id
94
+ decimals
95
+ }
96
+ token1 {
97
+ id
98
+ decimals
99
+ },
100
+ reserve0,
101
+ reserve1,
102
+ }
103
+ }`;
104
+
105
+ const { data } = await this.dexHelper.httpRequest.post(
106
+ this.subgraphURL,
107
+ {
108
+ query,
109
+ variables: { token: tokenAddress.toLowerCase(), count },
110
+ },
111
+ SUBGRAPH_TIMEOUT,
112
+ );
113
+
114
+ if (!(data && data.pools0 && data.pools1))
115
+ throw new Error("Couldn't fetch the pools from the subgraph");
116
+
117
+ const pools0 = await this.prepareSubgraphPools(data.pools0, (pool,{
118
+ address1, decimals1, liquidityUSDToken0, liquidityUSDToken1,
119
+ }) => ({
120
+ exchange: this.dexKey,
121
+ stable: pool.isStable,
122
+ address: pool.id.toLowerCase(),
123
+ connectorTokens: [
124
+ {
125
+ address: address1,
126
+ decimals: decimals1,
127
+ },
128
+ ],
129
+ liquidityUSD: parseFloat((liquidityUSDToken0 + liquidityUSDToken1).toFixed()),
130
+ }));
131
+
132
+ const pools1 = await this.prepareSubgraphPools(data.pools1, (pool,{
133
+ address0, decimals0, liquidityUSDToken0, liquidityUSDToken1,
134
+ }) => ({
135
+ exchange: this.dexKey,
136
+ stable: pool.isStable,
137
+ address: pool.id.toLowerCase(),
138
+ connectorTokens: [
139
+ {
140
+ address: address0,
141
+ decimals: decimals0,
142
+ },
143
+ ],
144
+ liquidityUSD: parseFloat((liquidityUSDToken0 + liquidityUSDToken1).toFixed()),
145
+ }));
146
+
147
+ return _.slice(
148
+ _.sortBy(_.concat(pools0, pools1), [pool => -1 * pool.liquidityUSD]),
149
+ 0,
150
+ count,
151
+ );
152
+ }
153
+
154
+ private async prepareSubgraphPools(
155
+ pools: ChronosSubgraphPool[],
156
+ iterator: (
157
+ pool: ChronosSubgraphPool, {
158
+ address0,
159
+ address1,
160
+ decimals0,
161
+ decimals1,
162
+ reserve0,
163
+ reserve1,
164
+ liquidityUSDToken0,
165
+ liquidityUSDToken1,
166
+ }: {
167
+ address0: string,
168
+ address1: string,
169
+ decimals0: number,
170
+ decimals1: number,
171
+ reserve0: bigint,
172
+ reserve1: bigint,
173
+ liquidityUSDToken0: number,
174
+ liquidityUSDToken1: number,
175
+ }) => PoolLiquidity
176
+ ): Promise<PoolLiquidity[]> {
177
+ return Promise.all(pools.map(async (
178
+ pool: ChronosSubgraphPool,
179
+ ) => {
180
+ const address0 = pool.token0.id.toLowerCase();
181
+ const address1 = pool.token1.id.toLowerCase();
182
+
183
+ const decimals0 = parseInt(pool.token0.decimals);
184
+ const decimals1 = parseInt(pool.token1.decimals);
185
+
186
+ const reserve0 = BigInt(new BigNumber(pool.reserve0).multipliedBy(10 ** decimals0).toFixed());
187
+ const reserve1 = BigInt(new BigNumber(pool.reserve1).multipliedBy(10 ** decimals1).toFixed());
188
+
189
+ const liquidityUSDToken0 = await this.dexHelper.getTokenUSDPrice({
190
+ address: address0,
191
+ decimals: decimals0,
192
+ }, reserve0);
193
+
194
+ const liquidityUSDToken1 = await this.dexHelper.getTokenUSDPrice({
195
+ address: address1,
196
+ decimals: decimals1,
197
+ }, reserve1);
198
+
199
+ return iterator(
200
+ pool, {
201
+ address0, address1, decimals0, decimals1, reserve0, reserve1, liquidityUSDToken0, liquidityUSDToken1,
202
+ },
203
+ );
204
+ }));
205
+ }
206
+ }
@@ -905,38 +905,39 @@ describe('Solidly E2E', () => {
905
905
  ],
906
906
  ]);
907
907
 
908
- const pairs: { name: string; sellAmount: string }[][] = [
908
+ const pairs: { name: string; sellAmount: string; }[][] =
909
909
  [
910
- {
911
- name: 'BNB',
912
- sellAmount: '1000000000000000000',
913
- },
914
- {
915
- name: 'USDT',
916
- sellAmount: '10000000000000000000',
917
- },
918
- ],
919
- [
920
- {
921
- name: 'USDT',
922
- sellAmount: '10000000000000000000',
923
- },
924
- {
925
- name: 'USDC',
926
- sellAmount: '10000000000000000000',
927
- },
928
- ],
929
- [
930
- {
931
- name: 'ETH',
932
- sellAmount: '5000000000000000000',
933
- },
934
- {
935
- name: 'BNB',
936
- sellAmount: '1000000000000000000',
937
- },
938
- ],
939
- ];
910
+ [
911
+ {
912
+ name: 'BNB',
913
+ sellAmount: '1000000000000000000',
914
+ },
915
+ {
916
+ name: 'USDT',
917
+ sellAmount: '10000000000000000000',
918
+ },
919
+ ],
920
+ [
921
+ {
922
+ name: 'USDT',
923
+ sellAmount: '10000000000000000000',
924
+ },
925
+ {
926
+ name: 'USDC',
927
+ sellAmount: '10000000000000000000',
928
+ },
929
+ ],
930
+ [
931
+ {
932
+ name: 'ETH',
933
+ sellAmount: '5000000000000000000',
934
+ },
935
+ {
936
+ name: 'BNB',
937
+ sellAmount: '1000000000000000000',
938
+ },
939
+ ]
940
+ ];
940
941
 
941
942
  sideToContractMethods.forEach((contractMethods, side) =>
942
943
  describe(`${side}`, () => {
@@ -1075,4 +1076,177 @@ describe('Solidly E2E', () => {
1075
1076
  });
1076
1077
  });
1077
1078
  });
1079
+
1080
+ describe('Arbitrum', () => {
1081
+ const network = Network.ARBITRUM;
1082
+ const tokens = Tokens[network];
1083
+ const holders = Holders[network];
1084
+ const provider = new StaticJsonRpcProvider(
1085
+ generateConfig(network).privateHttpProvider,
1086
+ network,
1087
+ );
1088
+
1089
+ describe(`Chronos`, () => {
1090
+ const dexKey = 'Chronos';
1091
+
1092
+ const sideToContractMethods = new Map([
1093
+ [
1094
+ SwapSide.SELL,
1095
+ [
1096
+ ContractMethod.simpleSwap,
1097
+ ContractMethod.multiSwap,
1098
+ ContractMethod.megaSwap,
1099
+ ],
1100
+ ],
1101
+ ]);
1102
+
1103
+ const pairs: { name: string; sellAmount: string; }[][] =
1104
+ [
1105
+ [
1106
+ {
1107
+ name: 'ETH',
1108
+ sellAmount: '1000000000000000000',
1109
+ },
1110
+ {
1111
+ name: 'USDC',
1112
+ sellAmount: '100000000',
1113
+ },
1114
+ ],
1115
+ [
1116
+ {
1117
+ name: 'USDT',
1118
+ sellAmount: '100000000',
1119
+ },
1120
+ {
1121
+ name: 'USDC',
1122
+ sellAmount: '100000000',
1123
+ },
1124
+ ],
1125
+ [
1126
+ {
1127
+ name: 'USDC',
1128
+ sellAmount: '100000000',
1129
+ },
1130
+ {
1131
+ name: 'DAI',
1132
+ sellAmount: '100000000000000000000',
1133
+ },
1134
+ ],
1135
+ [
1136
+ {
1137
+ name: 'ARB',
1138
+ sellAmount: '100000000',
1139
+ },
1140
+ {
1141
+ name: 'ETH',
1142
+ sellAmount: '100000000000000000000',
1143
+ },
1144
+ ]
1145
+ ];
1146
+
1147
+ sideToContractMethods.forEach((contractMethods, side) =>
1148
+ describe(`${side}`, () => {
1149
+ contractMethods.forEach((contractMethod: ContractMethod) => {
1150
+ pairs.forEach(pair => {
1151
+ describe(`${contractMethod}`, () => {
1152
+ it(`${pair[0].name} -> ${pair[1].name}`, async () => {
1153
+ await testE2E(
1154
+ tokens[pair[0].name],
1155
+ tokens[pair[1].name],
1156
+ holders[pair[0].name],
1157
+ pair[0].sellAmount,
1158
+ side,
1159
+ dexKey,
1160
+ contractMethod,
1161
+ network,
1162
+ provider,
1163
+ );
1164
+ });
1165
+ it(`${pair[1].name} -> ${pair[0].name}`, async () => {
1166
+ await testE2E(
1167
+ tokens[pair[1].name],
1168
+ tokens[pair[0].name],
1169
+ holders[pair[1].name],
1170
+ pair[1].sellAmount,
1171
+ side,
1172
+ dexKey,
1173
+ contractMethod,
1174
+ network,
1175
+ provider,
1176
+ );
1177
+ });
1178
+ });
1179
+ });
1180
+ });
1181
+ }),
1182
+ );
1183
+ });
1184
+
1185
+ // describe(`simpleSwap`, () => {
1186
+ // describe(`Volatile`, () => {
1187
+ // it('ETH -> USDC', async () => {
1188
+ // await testE2E(
1189
+ // tokens.ETH,
1190
+ // tokens.USDC,
1191
+ // holders.ETH,
1192
+ // '1000000000000000000',
1193
+ // SwapSide.SELL,
1194
+ // dexKey,
1195
+ // ContractMethod.simpleSwap,
1196
+ // network,
1197
+ // provider,
1198
+ // );
1199
+ // });
1200
+ // });
1201
+ // describe(`Stable`, () => {
1202
+ // it('USDC -> USDT', async () => {
1203
+ // await testE2E(
1204
+ // tokens.USDC,
1205
+ // tokens.USDT,
1206
+ // holders.USDC,
1207
+ // '10000000',
1208
+ // SwapSide.SELL,
1209
+ // dexKey,
1210
+ // ContractMethod.simpleSwap,
1211
+ // network,
1212
+ // provider,
1213
+ // );
1214
+ // });
1215
+ // });
1216
+ // });
1217
+ //
1218
+ // describe(`multiSwap`, () => {
1219
+ // describe(`Volatile`, () => {
1220
+ // it('ETH -> USDC', async () => {
1221
+ // await testE2E(
1222
+ // tokens.ETH,
1223
+ // tokens.USDC,
1224
+ // holders.ETH,
1225
+ // '1000000000000000000',
1226
+ // SwapSide.SELL,
1227
+ // dexKey,
1228
+ // ContractMethod.multiSwap,
1229
+ // network,
1230
+ // provider,
1231
+ // );
1232
+ // });
1233
+ // });
1234
+ // describe(`Stable`, () => {
1235
+ // it('USDC -> USDT', async () => {
1236
+ // await testE2E(
1237
+ // tokens.USDC,
1238
+ // tokens.USDT,
1239
+ // holders.USDC,
1240
+ // '10000000',
1241
+ // SwapSide.SELL,
1242
+ // dexKey,
1243
+ // ContractMethod.multiSwap,
1244
+ // network,
1245
+ // provider,
1246
+ // );
1247
+ // });
1248
+ // });
1249
+ // });
1250
+ // });
1251
+ });
1078
1252
  });