@paraswap/dex-lib 2.49.3 → 2.50.1

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 (58) hide show
  1. package/build/abi/algebra/AlgebraPool.abi.json +727 -0
  2. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +193 -0
  3. package/build/dex/algebra/algebra-pool-v1_1.d.ts +3 -2
  4. package/build/dex/algebra/algebra-pool-v1_1.js +3 -2
  5. package/build/dex/algebra/algebra-pool-v1_1.js.map +1 -1
  6. package/build/dex/algebra/algebra-pool-v1_9_bidirectional_fee.d.ts +16 -0
  7. package/build/dex/algebra/algebra-pool-v1_9_bidirectional_fee.js +26 -0
  8. package/build/dex/algebra/algebra-pool-v1_9_bidirectional_fee.js.map +1 -0
  9. package/build/dex/algebra/algebra-pool-v1_9_directional_fee.d.ts +54 -0
  10. package/build/dex/algebra/algebra-pool-v1_9_directional_fee.js +356 -0
  11. package/build/dex/algebra/algebra-pool-v1_9_directional_fee.js.map +1 -0
  12. package/build/dex/algebra/algebra-pool.d.ts +46 -0
  13. package/build/dex/algebra/algebra-pool.js +336 -0
  14. package/build/dex/algebra/algebra-pool.js.map +1 -0
  15. package/build/dex/algebra/algebra.d.ts +2 -1
  16. package/build/dex/algebra/algebra.js +6 -1
  17. package/build/dex/algebra/algebra.js.map +1 -1
  18. package/build/dex/algebra/config.js +20 -0
  19. package/build/dex/algebra/config.js.map +1 -1
  20. package/build/dex/algebra/types.d.ts +1 -1
  21. package/build/dex/pancakeswap-v3/config.js +0 -15
  22. package/build/dex/pancakeswap-v3/config.js.map +1 -1
  23. package/build/dex/pancakeswap-v3/pancakeswap-v3.js +1 -1
  24. package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
  25. package/build/dex/quickswap/camelot-v3.d.ts +6 -0
  26. package/build/dex/quickswap/camelot-v3.js +19 -0
  27. package/build/dex/quickswap/camelot-v3.js.map +1 -0
  28. package/build/dex/quickswap/zyberswap-v3.d.ts +6 -0
  29. package/build/dex/quickswap/zyberswap-v3.js +19 -0
  30. package/build/dex/quickswap/zyberswap-v3.js.map +1 -0
  31. package/build/dex/uniswap-v2/rebase-tokens.json +7 -0
  32. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -15
  33. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -1
  34. package/build/dex-helper/Cache.d.ts +31 -0
  35. package/build/dex-helper/Cache.js +106 -0
  36. package/build/dex-helper/Cache.js.map +1 -0
  37. package/build/dex-helper/RedisWrapper.d.ts +37 -0
  38. package/build/dex-helper/RedisWrapper.js +165 -0
  39. package/build/dex-helper/RedisWrapper.js.map +1 -0
  40. package/package.json +1 -1
  41. package/src/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
  42. package/src/dex/algebra/algebra-e2e.test.ts +22 -0
  43. package/src/dex/algebra/algebra-pool-v1_1.ts +3 -2
  44. package/src/dex/algebra/algebra-pool-v1_9_bidirectional_fee.ts +55 -0
  45. package/src/dex/algebra/algebra.ts +12 -3
  46. package/src/dex/algebra/config.ts +22 -0
  47. package/src/dex/algebra/types.ts +1 -1
  48. package/src/dex/pancakeswap-v3/config.ts +0 -16
  49. package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +1 -3
  50. package/.vscode/launch.json +0 -53
  51. package/.vscode/settings.json +0 -2
  52. package/.vscode/tasks.json +0 -15
  53. package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +0 -1
  54. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
  55. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
  56. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
  57. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
  58. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "components": [
6
+ { "internalType": "bytes", "name": "path", "type": "bytes" },
7
+ { "internalType": "address", "name": "recipient", "type": "address" },
8
+ { "internalType": "uint256", "name": "amountIn", "type": "uint256" },
9
+ {
10
+ "internalType": "uint256",
11
+ "name": "amountOutMinimum",
12
+ "type": "uint256"
13
+ }
14
+ ],
15
+ "internalType": "struct ISwapRouter.ExactInputParams",
16
+ "name": "params",
17
+ "type": "tuple"
18
+ }
19
+ ],
20
+ "name": "exactInput",
21
+ "outputs": [
22
+ { "internalType": "uint256", "name": "amountOut", "type": "uint256" }
23
+ ],
24
+ "stateMutability": "payable",
25
+ "type": "function"
26
+ },
27
+ {
28
+ "inputs": [
29
+ {
30
+ "components": [
31
+ { "internalType": "bytes", "name": "path", "type": "bytes" },
32
+ { "internalType": "address", "name": "recipient", "type": "address" },
33
+ { "internalType": "uint256", "name": "amountOut", "type": "uint256" },
34
+ {
35
+ "internalType": "uint256",
36
+ "name": "amountInMaximum",
37
+ "type": "uint256"
38
+ }
39
+ ],
40
+ "internalType": "struct ISwapRouter.ExactOutputParams",
41
+ "name": "params",
42
+ "type": "tuple"
43
+ }
44
+ ],
45
+ "name": "exactOutput",
46
+ "outputs": [
47
+ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }
48
+ ],
49
+ "stateMutability": "payable",
50
+ "type": "function"
51
+ }
52
+ ]
@@ -296,4 +296,26 @@ describe('Algebra', () => {
296
296
  );
297
297
  });
298
298
  });
299
+
300
+ describe('SwapBased', () => {
301
+ const dexKey = 'SwapBased';
302
+ const network = Network.BASE;
303
+
304
+ const tokenASymbol: string = 'USDC';
305
+ const tokenBSymbol: string = 'WETH';
306
+
307
+ const tokenAAmount: string = '1000000000';
308
+ const tokenBAmount: string = '1000000000000000000';
309
+ const nativeTokenAmount = '1000000000000000000';
310
+
311
+ testForNetwork(
312
+ network,
313
+ dexKey,
314
+ tokenASymbol,
315
+ tokenBSymbol,
316
+ tokenAAmount,
317
+ tokenBAmount,
318
+ nativeTokenAmount,
319
+ );
320
+ });
299
321
  });
@@ -53,7 +53,7 @@ const MAX_BATCH_SIZE = 100;
53
53
  const MAX_NUMBER_OF_BATCH_REQUEST_HALVING = 3;
54
54
 
55
55
  export class AlgebraEventPoolV1_1 extends StatefulEventSubscriber<PoolStateV1_1> {
56
- handlers: {
56
+ protected handlers: {
57
57
  [event: string]: (
58
58
  event: any,
59
59
  state: DeepReadonly<PoolStateV1_1>,
@@ -95,6 +95,7 @@ export class AlgebraEventPoolV1_1 extends StatefulEventSubscriber<PoolStateV1_1>
95
95
  readonly poolInitCodeHash: string,
96
96
  readonly poolDeployer: string,
97
97
  private readonly forceManualStateGeneration: boolean = false,
98
+ private readonly areTicksCompressed: boolean = true,
98
99
  ) {
99
100
  super(parentName, `${token0}_${token1}`, dexHelper, logger, true, mapKey);
100
101
  this.token0 = token0.toLowerCase();
@@ -648,7 +649,7 @@ export class AlgebraEventPoolV1_1 extends StatefulEventSubscriber<PoolStateV1_1>
648
649
  isValid: true,
649
650
  balance0,
650
651
  balance1,
651
- areTicksCompressed: true,
652
+ areTicksCompressed: this.areTicksCompressed,
652
653
  };
653
654
  }
654
655
 
@@ -0,0 +1,55 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { Contract } from 'web3-eth-contract';
3
+ import { IDexHelper } from '../../dex-helper/idex-helper';
4
+ import { Address, BlockHeader, Log, Logger } from '../../types';
5
+ import { bigIntify } from '../../utils';
6
+ import { AlgebraEventPoolV1_1 } from './algebra-pool-v1_1';
7
+ import { PoolStateV1_1 } from './types';
8
+
9
+ export class AlgebraEventPoolV1_9_bidirectional_fee extends AlgebraEventPoolV1_1 {
10
+ constructor(
11
+ readonly dexHelper: IDexHelper,
12
+ parentName: string,
13
+ readonly stateMultiContract: Contract,
14
+ readonly erc20Interface: Interface,
15
+ protected readonly factoryAddress: Address,
16
+ token0: Address,
17
+ token1: Address,
18
+ logger: Logger,
19
+ mapKey: string = '',
20
+ readonly poolInitCodeHash: string,
21
+ readonly poolDeployer: string,
22
+ ) {
23
+ super(
24
+ dexHelper,
25
+ parentName,
26
+ stateMultiContract,
27
+ erc20Interface,
28
+ factoryAddress,
29
+ token0,
30
+ token1,
31
+ logger,
32
+ mapKey,
33
+ poolInitCodeHash,
34
+ poolDeployer,
35
+ false, // forceManualStateGeneration; mainly for zkEVM
36
+ false, // areTicksCompressed
37
+ );
38
+
39
+ this.handlers['TickSpacing'] = this.handleTickSpacing.bind(this);
40
+ }
41
+
42
+ handleTickSpacing(
43
+ event: any,
44
+ pool: PoolStateV1_1,
45
+ log: Log,
46
+ blockHeader: BlockHeader,
47
+ ) {
48
+ const newTickSpacing = bigIntify(event.args.newTickSpacing);
49
+
50
+ pool.tickSpacing = newTickSpacing;
51
+ pool.blockTimestamp = bigIntify(blockHeader.timestamp);
52
+
53
+ return pool;
54
+ }
55
+ }
@@ -49,6 +49,7 @@ import { AlgebraEventPoolV1_1 } from './algebra-pool-v1_1';
49
49
  import { AlgebraEventPoolV1_9 } from './algebra-pool-v1_9';
50
50
  import { AlgebraFactory, OnPoolCreatedCallback } from './algebra-factory';
51
51
  import { applyTransferFee } from '../../lib/token-transfer-fee';
52
+ import { AlgebraEventPoolV1_9_bidirectional_fee } from './algebra-pool-v1_9_bidirectional_fee';
52
53
 
53
54
  type PoolPairsInfo = {
54
55
  token0: Address;
@@ -69,7 +70,10 @@ const MAX_STALE_STATE_BLOCK_AGE = {
69
70
  [Network.ZKEVM]: 150, // approximately 3min
70
71
  };
71
72
 
72
- type IAlgebraEventPool = AlgebraEventPoolV1_1 | AlgebraEventPoolV1_9;
73
+ type IAlgebraEventPool =
74
+ | AlgebraEventPoolV1_1
75
+ | AlgebraEventPoolV1_9
76
+ | AlgebraEventPoolV1_9_bidirectional_fee;
73
77
 
74
78
  export class Algebra extends SimpleExchange implements IDex<AlgebraData> {
75
79
  private readonly factory: AlgebraFactory;
@@ -95,7 +99,8 @@ export class Algebra extends SimpleExchange implements IDex<AlgebraData> {
95
99
 
96
100
  private AlgebraPoolImplem:
97
101
  | typeof AlgebraEventPoolV1_1
98
- | typeof AlgebraEventPoolV1_9;
102
+ | typeof AlgebraEventPoolV1_9
103
+ | typeof AlgebraEventPoolV1_9_bidirectional_fee;
99
104
 
100
105
  readonly SRC_TOKEN_DEX_TRANSFERS = 1;
101
106
  readonly DEST_TOKEN_DEX_TRANSFERS = 1;
@@ -132,7 +137,11 @@ export class Algebra extends SimpleExchange implements IDex<AlgebraData> {
132
137
  `${CACHE_PREFIX}_${network}_${dexKey}_not_existings_pool_set`.toLowerCase();
133
138
 
134
139
  this.AlgebraPoolImplem =
135
- config.version === 'v1.1' ? AlgebraEventPoolV1_1 : AlgebraEventPoolV1_9;
140
+ config.version === 'v1.1'
141
+ ? AlgebraEventPoolV1_1
142
+ : config.version === 'v1.9-bidirectional-fee'
143
+ ? AlgebraEventPoolV1_9_bidirectional_fee
144
+ : AlgebraEventPoolV1_9;
136
145
 
137
146
  this.factory = new AlgebraFactory(
138
147
  dexHelper,
@@ -86,6 +86,24 @@ export const AlgebraConfig: DexConfigMap<DexParams> = {
86
86
  forceRPC: true,
87
87
  },
88
88
  },
89
+ SwapBasedV3: {
90
+ [Network.BASE]: {
91
+ factory: '0xC207628E5e2b59E9C690071e68c7C1c4193b0252',
92
+ router: '0xd58f563a7d6150a2575c74065cb18f53ec2e9d07',
93
+ quoter: '0x64F477C68049B554113Bab6526038bcF5643136c',
94
+ initHash:
95
+ '0xbce37a54eab2fcd71913a0d40723e04238970e7fc1159bfd58ad5b79531697e7',
96
+ chunksCount: 10,
97
+ initRetryFrequency: 10,
98
+ algebraStateMulticall: '0x23d574867597c7A980024d8b83a74b6Ca6E08A7B',
99
+ subgraphURL:
100
+ 'https://api.thegraph.com/subgraphs/name/chimpydev/swapbase/graphql',
101
+ uniswapMulticall: '0xce512f490Bf09C4544A12a7264750B28FbE9AD76',
102
+ deployer: '0xe4DFd4ad723B5DB11aa41D53603dB03B117eC690',
103
+ version: 'v1.9-bidirectional-fee',
104
+ forceRPC: true,
105
+ },
106
+ },
89
107
  };
90
108
 
91
109
  export const Adapters: Record<number, AdapterMappings> = {
@@ -105,4 +123,8 @@ export const Adapters: Record<number, AdapterMappings> = {
105
123
  [SwapSide.SELL]: [{ name: 'OptimismAdapter01', index: 3 }],
106
124
  [SwapSide.BUY]: [{ name: 'OptimismBuyAdapter', index: 2 }],
107
125
  },
126
+ [Network.BASE]: {
127
+ [SwapSide.SELL]: [{ name: 'BaseAdapter01', index: 10 }],
128
+ [SwapSide.BUY]: [{ name: 'BaseBuyAdapter', index: 6 }],
129
+ },
108
130
  };
@@ -84,7 +84,7 @@ export type DexParams = {
84
84
  deployer: Address;
85
85
  subgraphURL: string;
86
86
  initHash: string;
87
- version: 'v1.1' | 'v1.9';
87
+ version: 'v1.1' | 'v1.9' | 'v1.9-bidirectional-fee';
88
88
  forceRPC?: boolean;
89
89
  forceManualStateGenerate?: boolean;
90
90
  };
@@ -69,22 +69,6 @@ export const PancakeswapV3Config: DexConfigMap<DexParams> = {
69
69
  'https://api.studio.thegraph.com/query/45376/exchange-v3-base/version/latest',
70
70
  },
71
71
  },
72
- DackieSwapV3: {
73
- [Network.BASE]: {
74
- factory: '0x3D237AC6D2f425D2E890Cc99198818cc1FA48870',
75
- quoter: '0x4fDBD73aD4B1DDde594BF05497C15f76308eFfb9',
76
- deployer: '0x4f205D69834f9B101b9289F7AFFAc9B77B3fF9b7',
77
- router: '0x4030ebafeb76e5fc848891076dfe315993800ba5',
78
- supportedFees: [10000n, 2500n, 500n, 100n],
79
- stateMulticall: '0xeBF40A40CA3D4310Bf53048F48e860656e1D7C81',
80
- uniswapMulticall: '0x091e99cb1C49331a94dD62755D168E941AbD0693',
81
- chunksCount: 10,
82
- initRetryFrequency: 10,
83
- initHash: `0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2`,
84
- subgraphURL:
85
- 'https://api.studio.thegraph.com/query/50473/exchange-clmm/version/latest',
86
- },
87
- },
88
72
  };
89
73
 
90
74
  export const Adapters: Record<number, AdapterMappings> = {
@@ -87,9 +87,7 @@ export class PancakeswapV3
87
87
  intervalTask?: NodeJS.Timeout;
88
88
 
89
89
  public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
90
- getDexKeysWithNetwork(
91
- _.pick(PancakeswapV3Config, ['PancakeswapV3', 'DackieSwapV3']),
92
- );
90
+ getDexKeysWithNetwork(_.pick(PancakeswapV3Config, ['PancakeswapV3']));
93
91
 
94
92
  logger: Logger;
95
93
 
@@ -1,53 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "type": "node",
6
- "request": "launch",
7
- "name": "Current",
8
- "program": "${file}",
9
- "preLaunchTask": "npm: build",
10
- "sourceMaps": true,
11
- "smartStep": true,
12
- "internalConsoleOptions": "openOnSessionStart",
13
- "outFiles": ["${workspaceFolder}/build/**/*.js"]
14
- },
15
- {
16
- "type": "node",
17
- "request": "launch",
18
- "name": "Debug dex integration",
19
- "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
20
- "args": [
21
- "--project",
22
- "tsconfig.json",
23
- // "${workspaceFolder}/src/dex/algebra/scripts/validate-state.ts",
24
- "${workspaceFolder}/src/dex/camelot/camelot-pool-discovery.test.ts",
25
- // "${workspaceFolder}/src/dex/solidly-v3/scripts/check-event-pool-event.ts",
26
- // "${workspaceFolder}/scripts/dex-integration.ts",
27
- "test",
28
- "wombat"
29
- ],
30
- "console": "integratedTerminal",
31
- "internalConsoleOptions": "neverOpen",
32
- "runtimeArgs": ["--nolazy"],
33
- "sourceMaps": true,
34
- "smartStep": true,
35
- "skipFiles": ["<node_internals>/**"],
36
- "cwd": "${workspaceFolder}"
37
- },
38
- {
39
- "type": "node",
40
- "name": "Jest file",
41
- "request": "launch",
42
- "program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
43
- // "program": "${workspaceFolder}/src/dex/camelot/scripts/validate-state.ts",
44
- // "args": ["src/dex/balancer-v1/balancer-v1-e2e.test.ts"],
45
- // "args": ["${relativeFile}"],
46
- "args": ["${file}"],
47
- "cwd": "${workspaceRoot}",
48
- "console": "integratedTerminal",
49
- "internalConsoleOptions": "neverOpen",
50
- "sourceMaps": true
51
- }
52
- ]
53
- }
@@ -1,2 +0,0 @@
1
- {
2
- }
@@ -1,15 +0,0 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "label": "tsc: build - tsconfig.json",
6
- "type": "typescript",
7
- "tsconfig": "tsconfig.json",
8
- "problemMatcher": ["$tsc"],
9
- "group": {
10
- "kind": "build",
11
- "isDefault": true
12
- }
13
- }
14
- ]
15
- }
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /* eslint-disable no-console */
7
- const dotenv_1 = __importDefault(require("dotenv"));
8
- dotenv_1.default.config();
9
- const constants_1 = require("../../../constants");
10
- const dex_helper_1 = require("../../../dex-helper");
11
- const config_1 = require("./../config");
12
- const solidly_v3_1 = require("../solidly-v3");
13
- const dex = 'SolidlyV3';
14
- const factory = config_1.SolidlyV3Config[dex][constants_1.Network.MAINNET].factory;
15
- const blockHeaders = {};
16
- async function checkForPoolEvents(startBlockNumber, endBlockNumber) {
17
- const network = constants_1.Network.MAINNET;
18
- const dexHelper = new dex_helper_1.DummyDexHelper(network);
19
- const solidlyV3 = new solidly_v3_1.SolidlyV3(network, dex, dexHelper);
20
- await solidlyV3.initializePricing(startBlockNumber);
21
- const logsToDispatch = await dexHelper.provider.getLogs({
22
- fromBlock: startBlockNumber,
23
- toBlock: endBlockNumber,
24
- address: factory,
25
- });
26
- const logsByBlockNumber = {};
27
- for (let log of logsToDispatch) {
28
- if (!logsByBlockNumber[log.blockNumber]) {
29
- logsByBlockNumber[log.blockNumber] = [];
30
- }
31
- logsByBlockNumber[log.blockNumber].push(log);
32
- }
33
- const sortedBlocks = Object.keys(logsByBlockNumber)
34
- .map(Number)
35
- .sort((a, b) => Number(a) - Number(b));
36
- for (let blockNumber of sortedBlocks) {
37
- if (!blockHeaders[blockNumber]) {
38
- blockHeaders[blockNumber] = await dexHelper.web3Provider.eth.getBlock(blockNumber);
39
- }
40
- await solidlyV3.factory?.update(logsByBlockNumber[blockNumber], {
41
- [blockNumber]: blockHeaders[blockNumber],
42
- });
43
- }
44
- return true;
45
- }
46
- async function main() {
47
- // event for https://etherscan.io/tx/0x2bef7c17f3f775525f076aeb20567ee25eb820e92aa8422fbfe4bed652fd2bd3
48
- checkForPoolEvents(18758010, 18758019);
49
- }
50
- main()
51
- .then(() => console.log('Done'))
52
- .catch(e => console.error(e));
53
- //# sourceMappingURL=check-event-pool-event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-event-pool-event.js","sourceRoot":"","sources":["../../../../src/dex/solidly-v3/scripts/check-event-pool-event.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAIhB,kDAA6C;AAC7C,oDAAqD;AACrD,wCAA8C;AAC9C,8CAA0C;AAE1C,MAAM,GAAG,GAAG,WAAW,CAAC;AACxB,MAAM,OAAO,GAAG,wBAAe,CAAC,GAAG,CAAC,CAAC,mBAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;AAC9D,MAAM,YAAY,GAAgC,EAAE,CAAC;AAErD,KAAK,UAAU,kBAAkB,CAC/B,gBAAwB,EACxB,cAAsB;IAEtB,MAAM,OAAO,GAAG,mBAAO,CAAC,OAAO,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,2BAAc,CAAC,OAAO,CAAC,CAAC;IAE9C,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,SAAS,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEpD,MAAM,cAAc,GAAG,MAA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M,CAAC,CAAC;KAC/B,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { Network, SwapSide } from '../../../../constants';
2
- import { IDexHelper } from '../../../../dex-helper';
3
- import { DexConfigMap, SimpleExchangeParam } from '../../../../types';
4
- import { DexParams, UniswapV3Data } from '../../types';
5
- import { UniswapV3 } from '../../uniswap-v3';
6
- export declare const AlienBaseV3Config: DexConfigMap<DexParams>;
7
- export declare class AlienBaseV3 extends UniswapV3 {
8
- protected network: Network;
9
- protected dexHelper: IDexHelper;
10
- static dexKeysWithNetwork: {
11
- key: string;
12
- networks: Network[];
13
- }[];
14
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
15
- static getDirectFunctionName(): string[];
16
- getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UniswapV3Data, side: SwapSide): Promise<SimpleExchangeParam>;
17
- }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AlienBaseV3 = exports.AlienBaseV3Config = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const constants_1 = require("../../../../constants");
9
- const utils_1 = require("../../../../utils");
10
- const types_1 = require("../../types");
11
- const uniswap_v3_1 = require("../../uniswap-v3");
12
- const AlienBaseV3Router_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v3/AlienBaseV3Router.abi.json"));
13
- exports.AlienBaseV3Config = {
14
- AlienBaseV3: {
15
- [constants_1.Network.BASE]: {
16
- factory: '0x0Fd83557b2be93617c9C1C1B6fd549401C74558C',
17
- quoter: '0x4fDBD73aD4B1DDde594BF05497C15f76308eFfb9',
18
- router: '0xB20C411FC84FBB27e78608C24d0056D974ea9411',
19
- supportedFees: [10000n, 3000n, 750n, 200n],
20
- stateMulticall: '0x7160f736c52e1e78e92FD4eE4D73e21A7Cf4F950',
21
- uniswapMulticall: '0x091e99cb1C49331a94dD62755D168E941AbD0693',
22
- chunksCount: 10,
23
- initRetryFrequency: 10,
24
- initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
25
- subgraphURL: 'https://api.studio.thegraph.com/query/59130/v3alb/0.3',
26
- },
27
- },
28
- };
29
- class AlienBaseV3 extends uniswap_v3_1.UniswapV3 {
30
- constructor(network, dexKey, dexHelper) {
31
- super(network, dexKey, dexHelper, {}, new abi_1.Interface(AlienBaseV3Router_abi_json_1.default), undefined, exports.AlienBaseV3Config[dexKey][network]);
32
- this.network = network;
33
- this.dexHelper = dexHelper;
34
- }
35
- static getDirectFunctionName() {
36
- return [];
37
- }
38
- async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
39
- const swapFunction = side === constants_1.SwapSide.SELL
40
- ? types_1.UniswapV3Functions.exactInput
41
- : types_1.UniswapV3Functions.exactOutput;
42
- const path = this._encodePath(data.path, side);
43
- const swapFunctionParams = side === constants_1.SwapSide.SELL
44
- ? {
45
- recipient: this.augustusAddress,
46
- amountIn: srcAmount,
47
- amountOutMinimum: destAmount,
48
- path,
49
- }
50
- : {
51
- recipient: this.augustusAddress,
52
- amountOut: destAmount,
53
- amountInMaximum: srcAmount,
54
- path,
55
- };
56
- const swapData = this.routerIface.encodeFunctionData(swapFunction, [
57
- swapFunctionParams,
58
- ]);
59
- return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.config.router);
60
- }
61
- }
62
- exports.AlienBaseV3 = AlienBaseV3;
63
- AlienBaseV3.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(exports.AlienBaseV3Config);
64
- //# sourceMappingURL=alien-base-v3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alien-base-v3.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v3/forks/alien-base-v3/alien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