@paraswap/dex-lib 2.21.1 → 2.21.3-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 (43) 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/dex/curve-v1-factory/curve-v1-factory.js +1 -2
  9. package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
  10. package/build/dex/index.js +2 -0
  11. package/build/dex/index.js.map +1 -1
  12. package/build/dex/pancakeswap-v3/types.d.ts +14 -0
  13. package/build/dex/{test-dex → pancakeswap-v3}/types.js.map +1 -1
  14. package/build/dex/solidly/config.js +13 -0
  15. package/build/dex/solidly/config.js.map +1 -1
  16. package/build/dex/solidly/forks-override/chronos.d.ts +23 -0
  17. package/build/dex/solidly/forks-override/chronos.js +132 -0
  18. package/build/dex/solidly/forks-override/chronos.js.map +1 -0
  19. package/build/dex/solidly/solidly.js +1 -0
  20. package/build/dex/solidly/solidly.js.map +1 -1
  21. package/package.json +1 -1
  22. package/src/dex/curve-v1-factory/curve-v1-factory.ts +1 -4
  23. package/src/dex/index.ts +2 -0
  24. package/src/dex/solidly/config.ts +14 -0
  25. package/src/dex/solidly/forks-override/chronos.ts +206 -0
  26. package/src/dex/solidly/solidly-e2e.test.ts +172 -0
  27. package/src/dex/solidly/solidly-integration.test.ts +141 -0
  28. package/src/dex/solidly/solidly.ts +1 -0
  29. package/tests/constants-e2e.ts +5 -0
  30. package/build/dex/test-dex/config.d.ts +0 -4
  31. package/build/dex/test-dex/config.js +0 -15
  32. package/build/dex/test-dex/config.js.map +0 -1
  33. package/build/dex/test-dex/test-dex-pool.d.ts +0 -39
  34. package/build/dex/test-dex/test-dex-pool.js +0 -63
  35. package/build/dex/test-dex/test-dex-pool.js.map +0 -1
  36. package/build/dex/test-dex/test-dex.d.ts +0 -37
  37. package/build/dex/test-dex/test-dex.js +0 -126
  38. package/build/dex/test-dex/test-dex.js.map +0 -1
  39. package/build/dex/test-dex/types.d.ts +0 -6
  40. package/build/dex/woo-fi-v2/woo-fi-math.d.ts +0 -16
  41. package/build/dex/woo-fi-v2/woo-fi-math.js +0 -137
  42. package/build/dex/woo-fi-v2/woo-fi-math.js.map +0 -1
  43. /package/build/dex/{test-dex → pancakeswap-v3}/types.js +0 -0
@@ -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: liquidityUSDToken0 + liquidityUSDToken1,
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: liquidityUSDToken0 + liquidityUSDToken1,
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
+ }
@@ -1075,4 +1075,176 @@ describe('Solidly E2E', () => {
1075
1075
  });
1076
1076
  });
1077
1077
  });
1078
+
1079
+ describe('Arbitrum', () => {
1080
+ const network = Network.ARBITRUM;
1081
+ const tokens = Tokens[network];
1082
+ const holders = Holders[network];
1083
+ const provider = new StaticJsonRpcProvider(
1084
+ generateConfig(network).privateHttpProvider,
1085
+ network,
1086
+ );
1087
+
1088
+ describe(`Chronos`, () => {
1089
+ const dexKey = 'Chronos';
1090
+
1091
+ const sideToContractMethods = new Map([
1092
+ [
1093
+ SwapSide.SELL,
1094
+ [
1095
+ ContractMethod.simpleSwap,
1096
+ ContractMethod.multiSwap,
1097
+ ContractMethod.megaSwap,
1098
+ ],
1099
+ ],
1100
+ ]);
1101
+
1102
+ const pairs: { name: string; sellAmount: string }[][] = [
1103
+ [
1104
+ {
1105
+ name: 'ETH',
1106
+ sellAmount: '1000000000000000000',
1107
+ },
1108
+ {
1109
+ name: 'USDC',
1110
+ sellAmount: '100000000',
1111
+ },
1112
+ ],
1113
+ [
1114
+ {
1115
+ name: 'USDT',
1116
+ sellAmount: '100000000',
1117
+ },
1118
+ {
1119
+ name: 'USDC',
1120
+ sellAmount: '100000000',
1121
+ },
1122
+ ],
1123
+ [
1124
+ {
1125
+ name: 'USDC',
1126
+ sellAmount: '100000000',
1127
+ },
1128
+ {
1129
+ name: 'DAI',
1130
+ sellAmount: '100000000000000000000',
1131
+ },
1132
+ ],
1133
+ [
1134
+ {
1135
+ name: 'ARB',
1136
+ sellAmount: '100000000',
1137
+ },
1138
+ {
1139
+ name: 'ETH',
1140
+ sellAmount: '100000000000000000000',
1141
+ },
1142
+ ],
1143
+ ];
1144
+
1145
+ sideToContractMethods.forEach((contractMethods, side) =>
1146
+ describe(`${side}`, () => {
1147
+ contractMethods.forEach((contractMethod: ContractMethod) => {
1148
+ pairs.forEach(pair => {
1149
+ describe(`${contractMethod}`, () => {
1150
+ it(`${pair[0].name} -> ${pair[1].name}`, async () => {
1151
+ await testE2E(
1152
+ tokens[pair[0].name],
1153
+ tokens[pair[1].name],
1154
+ holders[pair[0].name],
1155
+ pair[0].sellAmount,
1156
+ side,
1157
+ dexKey,
1158
+ contractMethod,
1159
+ network,
1160
+ provider,
1161
+ );
1162
+ });
1163
+ it(`${pair[1].name} -> ${pair[0].name}`, async () => {
1164
+ await testE2E(
1165
+ tokens[pair[1].name],
1166
+ tokens[pair[0].name],
1167
+ holders[pair[1].name],
1168
+ pair[1].sellAmount,
1169
+ side,
1170
+ dexKey,
1171
+ contractMethod,
1172
+ network,
1173
+ provider,
1174
+ );
1175
+ });
1176
+ });
1177
+ });
1178
+ });
1179
+ }),
1180
+ );
1181
+ });
1182
+
1183
+ // describe(`simpleSwap`, () => {
1184
+ // describe(`Volatile`, () => {
1185
+ // it('ETH -> USDC', async () => {
1186
+ // await testE2E(
1187
+ // tokens.ETH,
1188
+ // tokens.USDC,
1189
+ // holders.ETH,
1190
+ // '1000000000000000000',
1191
+ // SwapSide.SELL,
1192
+ // dexKey,
1193
+ // ContractMethod.simpleSwap,
1194
+ // network,
1195
+ // provider,
1196
+ // );
1197
+ // });
1198
+ // });
1199
+ // describe(`Stable`, () => {
1200
+ // it('USDC -> USDT', async () => {
1201
+ // await testE2E(
1202
+ // tokens.USDC,
1203
+ // tokens.USDT,
1204
+ // holders.USDC,
1205
+ // '10000000',
1206
+ // SwapSide.SELL,
1207
+ // dexKey,
1208
+ // ContractMethod.simpleSwap,
1209
+ // network,
1210
+ // provider,
1211
+ // );
1212
+ // });
1213
+ // });
1214
+ // });
1215
+ //
1216
+ // describe(`multiSwap`, () => {
1217
+ // describe(`Volatile`, () => {
1218
+ // it('ETH -> USDC', async () => {
1219
+ // await testE2E(
1220
+ // tokens.ETH,
1221
+ // tokens.USDC,
1222
+ // holders.ETH,
1223
+ // '1000000000000000000',
1224
+ // SwapSide.SELL,
1225
+ // dexKey,
1226
+ // ContractMethod.multiSwap,
1227
+ // network,
1228
+ // provider,
1229
+ // );
1230
+ // });
1231
+ // });
1232
+ // describe(`Stable`, () => {
1233
+ // it('USDC -> USDT', async () => {
1234
+ // await testE2E(
1235
+ // tokens.USDC,
1236
+ // tokens.USDT,
1237
+ // holders.USDC,
1238
+ // '10000000',
1239
+ // SwapSide.SELL,
1240
+ // dexKey,
1241
+ // ContractMethod.multiSwap,
1242
+ // network,
1243
+ // provider,
1244
+ // );
1245
+ // });
1246
+ // });
1247
+ // });
1248
+ // });
1249
+ });
1078
1250
  });
@@ -11,6 +11,7 @@ import { Interface, Result } from '@ethersproject/abi';
11
11
  import solidlyPairABI from '../../abi/solidly/SolidlyPair.json';
12
12
  import { SpiritSwapV2 } from './forks-override/spiritSwapV2';
13
13
  import { Cone } from './forks-override/cone';
14
+ import { Chronos } from './forks-override/chronos';
14
15
 
15
16
  const amounts18 = [0n, BI_POWS[18], 2000000000000000000n];
16
17
  const amounts6 = [0n, BI_POWS[6], 2000000n];
@@ -628,4 +629,144 @@ describe('Solidly integration tests', () => {
628
629
  });
629
630
  });
630
631
  });
632
+
633
+ describe('Arbitrum', () => {
634
+ const network = Network.ARBITRUM;
635
+ const dexHelper = new DummyDexHelper(network);
636
+ const checkOnChainPricing = constructCheckOnChainPricing(dexHelper);
637
+
638
+ describe('Chronos', function () {
639
+ const dexKey = 'Chronos';
640
+ const chronos = new Chronos(network, dexKey, dexHelper);
641
+
642
+ describe('UniswapV2 like pool', function () {
643
+ const TokenASymbol = 'USDC';
644
+ const tokenA = Tokens[network][TokenASymbol];
645
+ const TokenBSymbol = 'WETH';
646
+ const tokenB = Tokens[network][TokenBSymbol];
647
+
648
+ const amounts = amounts18;
649
+
650
+ it('getPoolIdentifiers and getPricesVolume', async function () {
651
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
652
+ const pools = await chronos.getPoolIdentifiers(
653
+ tokenA,
654
+ tokenB,
655
+ SwapSide.SELL,
656
+ blocknumber,
657
+ );
658
+ console.log(
659
+ `${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
660
+ pools,
661
+ );
662
+
663
+ expect(pools.length).toBeGreaterThan(0);
664
+
665
+ const poolPrices = await chronos.getPricesVolume(
666
+ tokenA,
667
+ tokenB,
668
+ amounts,
669
+ SwapSide.SELL,
670
+ blocknumber,
671
+ pools,
672
+ );
673
+ console.log(
674
+ `${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
675
+ poolPrices,
676
+ );
677
+
678
+ expect(poolPrices).not.toBeNull();
679
+ checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
680
+
681
+ // Check if onchain pricing equals to calculated ones
682
+
683
+ for (const i in poolPrices || []) {
684
+ await checkOnChainPricing(
685
+ chronos,
686
+ 'getAmountOut',
687
+ blocknumber,
688
+ poolPrices![i].prices,
689
+ poolPrices![i].poolAddresses![0],
690
+ tokenA.address,
691
+ amounts,
692
+ );
693
+ }
694
+ });
695
+
696
+ it('getTopPoolsForToken', async function () {
697
+ const poolLiquidity = await chronos.getTopPoolsForToken(
698
+ tokenA.address,
699
+ 10,
700
+ );
701
+ console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
702
+
703
+ checkPoolsLiquidity(poolLiquidity, tokenA.address, dexKey);
704
+ });
705
+ });
706
+
707
+ describe('Curve like stable pool', function () {
708
+ const TokenASymbol = 'USDT';
709
+ const tokenA = Tokens[network][TokenASymbol];
710
+ const TokenBSymbol = 'USDC';
711
+ const tokenB = Tokens[network][TokenBSymbol];
712
+
713
+ const amounts = amounts6;
714
+
715
+ it('getPoolIdentifiers and getPricesVolume', async function () {
716
+ const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
717
+ const pools = await chronos.getPoolIdentifiers(
718
+ tokenA,
719
+ tokenB,
720
+ SwapSide.SELL,
721
+ blocknumber,
722
+ );
723
+ console.log(
724
+ `${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `,
725
+ pools,
726
+ );
727
+
728
+ expect(pools.length).toBeGreaterThan(0);
729
+
730
+ const poolPrices = await chronos.getPricesVolume(
731
+ tokenA,
732
+ tokenB,
733
+ amounts,
734
+ SwapSide.SELL,
735
+ blocknumber,
736
+ pools,
737
+ );
738
+ console.log(
739
+ `${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `,
740
+ poolPrices,
741
+ );
742
+
743
+ expect(poolPrices).not.toBeNull();
744
+ checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
745
+
746
+ // Check if onchain pricing equals to calculated ones
747
+ for (const i in poolPrices || []) {
748
+ await checkOnChainPricing(
749
+ chronos,
750
+ 'getAmountOut',
751
+ blocknumber,
752
+ poolPrices![i].prices,
753
+ poolPrices![i].poolAddresses![0],
754
+ tokenA.address,
755
+ amounts,
756
+ );
757
+ }
758
+ });
759
+
760
+ it('getTopPoolsForToken', async function () {
761
+ const poolLiquidity = await chronos.getTopPoolsForToken(
762
+ tokenA.address,
763
+ 10,
764
+ );
765
+ console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
766
+
767
+ checkPoolsLiquidity(poolLiquidity, tokenA.address, dexKey);
768
+ });
769
+ });
770
+ });
771
+ });
631
772
  });
@@ -71,6 +71,7 @@ export class Solidly extends UniswapV2 {
71
71
  'SolidlyV2',
72
72
  'Thena',
73
73
  'SoliSnek',
74
+ 'Chronos',
74
75
  ]),
75
76
  );
76
77
 
@@ -704,6 +704,10 @@ export const Tokens: {
704
704
  address: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
705
705
  decimals: 18,
706
706
  },
707
+ ARB: {
708
+ address: '0x912ce59144191c1204e64559fe8253a0e49e6548',
709
+ decimals: 18,
710
+ },
707
711
  WETH: {
708
712
  address: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
709
713
  decimals: 18,
@@ -987,6 +991,7 @@ export const Holders: {
987
991
  YUSD: '0x6c1a5ef2acde1fd2fc68def440d2c1eb35bae24a',
988
992
  },
989
993
  [Network.ARBITRUM]: {
994
+ ARB: '0xb65edba80a3d81903ecd499c8eb9cf0e19096bd0',
990
995
  ETH: '0xF977814e90dA44bFA03b6295A0616a897441aceC',
991
996
  DAI: '0x07d7f291e731a41d3f0ea4f1ae5b6d920ffb3fe0',
992
997
  WETH: '0xc31e54c7a869b9fcbecc14363cf510d1c41fa443',
@@ -1,4 +0,0 @@
1
- import { DexParams } from './types';
2
- import { DexConfigMap, AdapterMappings } from '../../types';
3
- export declare const TestDexConfig: DexConfigMap<DexParams>;
4
- export declare const Adapters: Record<number, AdapterMappings>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.TestDexConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.TestDexConfig = {
6
- TestDex: {
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/test-dex/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,aAAa,GAA4B;IACpD,OAAO,EAAE;IACP,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 TestDexEventPool extends StatefulEventSubscriber<PoolState> {
8
- protected parentName: string;
9
- protected network: number;
10
- protected dexHelper: IDexHelper;
11
- protected testDexIface: 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, testDexIface?: 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
- }