@paraswap/dex-lib 2.50.4-angle-staked.7 → 2.50.4-angle-staked.8
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.
- package/build/config.js +3 -2
- package/build/config.js.map +1 -1
- package/build/dex/algebra/config.js +0 -16
- package/build/dex/algebra/config.js.map +1 -1
- package/build/dex/dexalot/config.js +7 -0
- package/build/dex/dexalot/config.js.map +1 -1
- package/build/dex/hashflow/constants.d.ts +27 -0
- package/build/dex/hashflow/constants.js +29 -1
- package/build/dex/hashflow/constants.js.map +1 -1
- package/build/dex/hashflow/hashflow.d.ts +3 -2
- package/build/dex/hashflow/hashflow.js +69 -12
- package/build/dex/hashflow/hashflow.js.map +1 -1
- package/build/dex/hashflow/types.d.ts +11 -0
- package/build/dex/hashflow/types.js +9 -0
- package/build/dex/hashflow/types.js.map +1 -1
- package/build/dex/idex.d.ts +1 -1
- package/build/dex/index.d.ts +2 -2
- package/build/dex/pancakeswap-v3/config.js +30 -0
- package/build/dex/pancakeswap-v3/config.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +5 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +3 -2
- package/src/dex/algebra/config.ts +0 -18
- package/src/dex/dexalot/config.ts +7 -0
- package/src/dex/dexalot/dexalot-e2e.test.ts +23 -1
- package/src/dex/dexalot/dexalot-integration.test.ts +121 -0
- package/src/dex/hashflow/constants.ts +32 -0
- package/src/dex/hashflow/hashflow.ts +121 -19
- package/src/dex/hashflow/types.ts +20 -2
- package/src/dex/idex.ts +1 -1
- package/src/dex/index.ts +2 -2
- package/src/dex/pancakeswap-v3/config.ts +32 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3-e2e.test.ts +21 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +7 -1
- package/tests/constants-e2e.ts +1 -1
- package/src/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Chain, QuoteData } from '@hashflow/taker-js/dist/types/common';
|
|
2
2
|
import { RequestHeaders } from '../../dex-helper';
|
|
3
|
+
import { ERROR_CODE_TO_RESTRICT_TTL, UNKNOWN_ERROR_CODE } from './constants';
|
|
3
4
|
|
|
4
5
|
export type HashflowData = {
|
|
5
6
|
mm: string;
|
|
@@ -16,14 +17,22 @@ export interface PriceLevel {
|
|
|
16
17
|
p: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export class RfqError extends Error {
|
|
20
|
+
export class RfqError extends Error {
|
|
21
|
+
code: ErrorCode;
|
|
22
|
+
constructor(message: string, code: ErrorCode = UNKNOWN_ERROR_CODE) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.code = code;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
export enum RFQType {
|
|
22
29
|
RFQT = 0,
|
|
23
30
|
RFQM = 1,
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
export class SlippageCheckError extends Error {
|
|
33
|
+
export class SlippageCheckError extends Error {
|
|
34
|
+
code: ErrorCode = 'SLIPPAGE';
|
|
35
|
+
}
|
|
27
36
|
|
|
28
37
|
export type HashflowRatesLevel = {
|
|
29
38
|
pair: Record<string, string>;
|
|
@@ -63,3 +72,12 @@ export type HashflowRateFetcherConfig = {
|
|
|
63
72
|
marketMakersCacheTTLSecs: number;
|
|
64
73
|
};
|
|
65
74
|
};
|
|
75
|
+
|
|
76
|
+
export type ErrorCode = keyof typeof ERROR_CODE_TO_RESTRICT_TTL;
|
|
77
|
+
|
|
78
|
+
export type CacheErrorCodesData = {
|
|
79
|
+
[code in ErrorCode]: {
|
|
80
|
+
addedDatetimeMS: number;
|
|
81
|
+
count: number;
|
|
82
|
+
} | null;
|
|
83
|
+
};
|
package/src/dex/idex.ts
CHANGED
|
@@ -194,7 +194,7 @@ export interface IDex<
|
|
|
194
194
|
IDexPooltracker {}
|
|
195
195
|
|
|
196
196
|
// Defines the static objects of the IDex class
|
|
197
|
-
export interface
|
|
197
|
+
export interface DexConstructor<
|
|
198
198
|
ExchangeData,
|
|
199
199
|
DirectParam = null,
|
|
200
200
|
OptimizedExchangeData = ExchangeData,
|
package/src/dex/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { UnoptimizedRate } from '../types';
|
|
3
3
|
import { CurveV2 } from './curve-v2';
|
|
4
|
-
import { IDexTxBuilder,
|
|
4
|
+
import { IDexTxBuilder, DexConstructor, IDex, IRouteOptimizer } from './idex';
|
|
5
5
|
import { Jarvis } from './jarvis';
|
|
6
6
|
import { JarvisV6 } from './jarvis-v6/jarvis-v6';
|
|
7
7
|
import { StablePool } from './stable-pool';
|
|
@@ -185,7 +185,7 @@ interface IGetDirectFunctionName {
|
|
|
185
185
|
|
|
186
186
|
export class DexAdapterService {
|
|
187
187
|
dexToKeyMap: {
|
|
188
|
-
[key: string]: LegacyDexConstructor |
|
|
188
|
+
[key: string]: LegacyDexConstructor | DexConstructor<any, any, any>;
|
|
189
189
|
} = {};
|
|
190
190
|
directFunctionsNames: string[];
|
|
191
191
|
dexInstances: {
|
|
@@ -69,6 +69,38 @@ 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
|
+
SwapBasedV3: {
|
|
89
|
+
[Network.BASE]: {
|
|
90
|
+
factory: '0xb5620f90e803c7f957a9ef351b8db3c746021bea',
|
|
91
|
+
quoter: '0x4fDBD73aD4B1DDde594BF05497C15f76308eFfb9',
|
|
92
|
+
deployer: '0x905a650133147012390c42624eeba4d3313bec6c',
|
|
93
|
+
router: '0x756c6bbdd915202adac7bebb1c6c89ac0886503f',
|
|
94
|
+
supportedFees: [10000n, 2500n, 500n, 100n, 35n],
|
|
95
|
+
stateMulticall: '0xeBF40A40CA3D4310Bf53048F48e860656e1D7C81',
|
|
96
|
+
uniswapMulticall: '0x091e99cb1C49331a94dD62755D168E941AbD0693',
|
|
97
|
+
chunksCount: 10,
|
|
98
|
+
initRetryFrequency: 10,
|
|
99
|
+
initHash: `0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2`,
|
|
100
|
+
subgraphURL:
|
|
101
|
+
'https://api.studio.thegraph.com/query/67101/swapbased-pcsv3-core/version/latest',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
72
104
|
};
|
|
73
105
|
|
|
74
106
|
export const Adapters: Record<number, AdapterMappings> = {
|
|
@@ -421,4 +421,25 @@ describe('PancakeswapV3 E2E', () => {
|
|
|
421
421
|
nativeTokenAmount,
|
|
422
422
|
);
|
|
423
423
|
});
|
|
424
|
+
|
|
425
|
+
describe('SwapBasedV3 Base', () => {
|
|
426
|
+
const network = Network.BASE;
|
|
427
|
+
|
|
428
|
+
const tokenASymbol: string = 'USDbC';
|
|
429
|
+
const tokenBSymbol: string = 'USDC';
|
|
430
|
+
|
|
431
|
+
const tokenAAmount: string = '11111000000';
|
|
432
|
+
const tokenBAmount: string = '11111000000';
|
|
433
|
+
const nativeTokenAmount = '110000000000000000000';
|
|
434
|
+
|
|
435
|
+
testForNetwork(
|
|
436
|
+
network,
|
|
437
|
+
'SwapBasedV3',
|
|
438
|
+
tokenASymbol,
|
|
439
|
+
tokenBSymbol,
|
|
440
|
+
tokenAAmount,
|
|
441
|
+
tokenBAmount,
|
|
442
|
+
nativeTokenAmount,
|
|
443
|
+
);
|
|
444
|
+
});
|
|
424
445
|
});
|
|
@@ -87,7 +87,13 @@ export class PancakeswapV3
|
|
|
87
87
|
intervalTask?: NodeJS.Timeout;
|
|
88
88
|
|
|
89
89
|
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
90
|
-
getDexKeysWithNetwork(
|
|
90
|
+
getDexKeysWithNetwork(
|
|
91
|
+
_.pick(PancakeswapV3Config, [
|
|
92
|
+
'PancakeswapV3',
|
|
93
|
+
'DackieSwapV3',
|
|
94
|
+
'SwapBasedV3',
|
|
95
|
+
]),
|
|
96
|
+
);
|
|
91
97
|
|
|
92
98
|
logger: Logger;
|
|
93
99
|
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -1370,7 +1370,7 @@ export const Holders: {
|
|
|
1370
1370
|
nETH: '0xcf2ef00e75558512ae735679ea5df62ad2056786',
|
|
1371
1371
|
avWETH: '0x92d78e32b990d10aeca0875dc5585f1a6f958179',
|
|
1372
1372
|
YUSD: '0x6c1a5ef2acde1fd2fc68def440d2c1eb35bae24a',
|
|
1373
|
-
BTCb: '
|
|
1373
|
+
BTCb: '0x4bb7f4c3d47C4b431cb0658F44287d52006fb506',
|
|
1374
1374
|
AMPL: '0xfcaA5ea7F8eb0631BcA72C345025C0A5a6D93f0E',
|
|
1375
1375
|
PHAR: '0x654296D56532f62B7d91d335791d3c364a9385b5',
|
|
1376
1376
|
},
|
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
]
|