@paraswap/dex-lib 3.9.4 → 3.9.5
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/dex/generic-rfq/e2e-test-config.js +5 -61
- package/build/dex/generic-rfq/e2e-test-config.js.map +1 -1
- package/build/dex/infusion/config.js +4 -4
- package/build/dex/solidly/config.js +3 -3
- package/build/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/config.ts +1 -1
- package/src/dex/generic-rfq/e2e-test-config.ts +5 -61
- package/src/dex/generic-rfq/generic-rfq-e2e.test.ts +4 -3
- package/src/dex/infusion/config.ts +4 -4
- package/src/dex/solidly/config.ts +3 -3
- package/src/types.ts +1 -1
- package/tests/constants-e2e.ts +9 -0
- package/tests/smart-tokens.ts +3 -0
- package/tests/utils-e2e.ts +6 -2
|
@@ -3,74 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.testConfig = void 0;
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
5
|
exports.testConfig = {
|
|
6
|
-
[constants_1.Network.
|
|
7
|
-
// {
|
|
8
|
-
// srcToken: 'USDT',
|
|
9
|
-
// destToken: 'WETH',
|
|
10
|
-
// swapSide: SwapSide.BUY,
|
|
11
|
-
// amount: '10000000000000000',
|
|
12
|
-
// },
|
|
13
|
-
// {
|
|
14
|
-
// srcToken: 'WETH',
|
|
15
|
-
// destToken: 'USDT',
|
|
16
|
-
// swapSide: SwapSide.BUY,
|
|
17
|
-
// amount: '1000000',
|
|
18
|
-
// },
|
|
19
|
-
// {
|
|
20
|
-
// srcToken: 'USDT',
|
|
21
|
-
// destToken: 'WETH',
|
|
22
|
-
// swapSide: SwapSide.SELL,
|
|
23
|
-
// amount: '1000000',
|
|
24
|
-
// },
|
|
25
|
-
{
|
|
26
|
-
// srcToken: 'WETH',
|
|
27
|
-
// destToken: 'DAI',
|
|
28
|
-
srcToken: 'DAI',
|
|
29
|
-
destToken: 'WETH',
|
|
30
|
-
swapSide: constants_1.SwapSide.BUY,
|
|
31
|
-
amount: '10000000000000000',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
srcToken: 'DAI',
|
|
35
|
-
destToken: 'ETH',
|
|
36
|
-
swapSide: constants_1.SwapSide.BUY,
|
|
37
|
-
amount: '10000000000000000',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
srcToken: 'ETH',
|
|
41
|
-
destToken: 'DAI',
|
|
42
|
-
swapSide: constants_1.SwapSide.BUY,
|
|
43
|
-
amount: '10000000000000000',
|
|
44
|
-
},
|
|
6
|
+
[constants_1.Network.ARBITRUM]: [
|
|
45
7
|
{
|
|
46
8
|
srcToken: 'WETH',
|
|
47
|
-
destToken: '
|
|
9
|
+
destToken: 'USDC',
|
|
10
|
+
amount: '10000',
|
|
48
11
|
swapSide: constants_1.SwapSide.BUY,
|
|
49
|
-
amount: '10000000000000000',
|
|
50
12
|
},
|
|
51
13
|
{
|
|
52
|
-
srcToken: '
|
|
14
|
+
srcToken: 'USDC',
|
|
53
15
|
destToken: 'WETH',
|
|
16
|
+
amount: '10000',
|
|
54
17
|
swapSide: constants_1.SwapSide.SELL,
|
|
55
|
-
amount: '10000000000000000',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
srcToken: 'DAI',
|
|
59
|
-
destToken: 'ETH',
|
|
60
|
-
swapSide: constants_1.SwapSide.SELL,
|
|
61
|
-
amount: '10000000000000000',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
srcToken: 'ETH',
|
|
65
|
-
destToken: 'DAI',
|
|
66
|
-
swapSide: constants_1.SwapSide.SELL,
|
|
67
|
-
amount: '10000000000000000',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
srcToken: 'WETH',
|
|
71
|
-
destToken: 'DAI',
|
|
72
|
-
swapSide: constants_1.SwapSide.SELL,
|
|
73
|
-
amount: '10000000000000000',
|
|
74
18
|
},
|
|
75
19
|
],
|
|
76
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e-test-config.js","sourceRoot":"","sources":["../../../src/dex/generic-rfq/e2e-test-config.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAEvC,QAAA,UAAU,GAOnB;IACF,CAAC,mBAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"e2e-test-config.js","sourceRoot":"","sources":["../../../src/dex/generic-rfq/e2e-test-config.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAEvC,QAAA,UAAU,GAOnB;IACF,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;QAClB;YACE,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,MAAM;YACjB,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,oBAAQ,CAAC,GAAG;SACvB;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,MAAM;YACjB,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,oBAAQ,CAAC,IAAI;SACxB;KACF;CACF,CAAC"}
|
|
@@ -8,12 +8,12 @@ exports.InfusionConfig = {
|
|
|
8
8
|
subgraphURL: 'https://api.goldsky.com/api/public/project_clvn0ei0x2qro0130fpihh83o/subgraphs/infusion-subgraph/1.0.0/gn',
|
|
9
9
|
factoryAddress: '0x2D9A3a2bd6400eE28d770c7254cA840c82faf23f',
|
|
10
10
|
router: '0x1E891C9F96DcA29Da8B97bE3403D16135EBe8028',
|
|
11
|
-
initCode: '
|
|
11
|
+
initCode: '0x219feae2806b91b43e3369a02074b26dde4d33b44972f02d717f37ac78ab0245',
|
|
12
12
|
// updatable fees on the factory without event
|
|
13
|
-
stableFee:
|
|
14
|
-
volatileFee:
|
|
13
|
+
stableFee: 5,
|
|
14
|
+
volatileFee: 5,
|
|
15
15
|
poolGasCost: 180 * 1000,
|
|
16
|
-
feeCode:
|
|
16
|
+
feeCode: 5,
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
};
|
|
@@ -57,10 +57,10 @@ exports.SolidlyConfig = {
|
|
|
57
57
|
router: '0xa2f581b012E0f2dcCDe86fCbfb529f4aC5dD4983',
|
|
58
58
|
initCode: '0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0',
|
|
59
59
|
// updatable fees on the factory without event
|
|
60
|
-
stableFee:
|
|
61
|
-
volatileFee:
|
|
60
|
+
stableFee: 5,
|
|
61
|
+
volatileFee: 5,
|
|
62
62
|
poolGasCost: 180 * 1000,
|
|
63
|
-
feeCode:
|
|
63
|
+
feeCode: 5,
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
VelodromeV2: {
|
package/build/types.d.ts
CHANGED
|
@@ -247,7 +247,7 @@ export declare type Config = {
|
|
|
247
247
|
wrappedNativeTokenAddress: Address;
|
|
248
248
|
hasEIP1559: boolean;
|
|
249
249
|
augustusAddress: Address;
|
|
250
|
-
augustusV6Address
|
|
250
|
+
augustusV6Address: Address;
|
|
251
251
|
augustusRFQAddress: Address;
|
|
252
252
|
tokenTransferProxyAddress: Address;
|
|
253
253
|
multicallV2Address: Address;
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -17,7 +17,7 @@ type BaseConfig = {
|
|
|
17
17
|
wrappedNativeTokenAddress: Address;
|
|
18
18
|
hasEIP1559: boolean;
|
|
19
19
|
augustusAddress: Address;
|
|
20
|
-
augustusV6Address
|
|
20
|
+
augustusV6Address: Address;
|
|
21
21
|
augustusRFQAddress: Address;
|
|
22
22
|
tokenTransferProxyAddress: Address;
|
|
23
23
|
multicallV2Address: Address;
|
|
@@ -8,74 +8,18 @@ export const testConfig: {
|
|
|
8
8
|
amount: string;
|
|
9
9
|
}>;
|
|
10
10
|
} = {
|
|
11
|
-
[Network.
|
|
12
|
-
// {
|
|
13
|
-
// srcToken: 'USDT',
|
|
14
|
-
// destToken: 'WETH',
|
|
15
|
-
// swapSide: SwapSide.BUY,
|
|
16
|
-
// amount: '10000000000000000',
|
|
17
|
-
// },
|
|
18
|
-
// {
|
|
19
|
-
// srcToken: 'WETH',
|
|
20
|
-
// destToken: 'USDT',
|
|
21
|
-
// swapSide: SwapSide.BUY,
|
|
22
|
-
// amount: '1000000',
|
|
23
|
-
// },
|
|
24
|
-
// {
|
|
25
|
-
// srcToken: 'USDT',
|
|
26
|
-
// destToken: 'WETH',
|
|
27
|
-
// swapSide: SwapSide.SELL,
|
|
28
|
-
// amount: '1000000',
|
|
29
|
-
// },
|
|
30
|
-
{
|
|
31
|
-
// srcToken: 'WETH',
|
|
32
|
-
// destToken: 'DAI',
|
|
33
|
-
srcToken: 'DAI',
|
|
34
|
-
destToken: 'WETH',
|
|
35
|
-
swapSide: SwapSide.BUY,
|
|
36
|
-
amount: '10000000000000000',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
srcToken: 'DAI',
|
|
40
|
-
destToken: 'ETH',
|
|
41
|
-
swapSide: SwapSide.BUY,
|
|
42
|
-
amount: '10000000000000000',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
srcToken: 'ETH',
|
|
46
|
-
destToken: 'DAI',
|
|
47
|
-
swapSide: SwapSide.BUY,
|
|
48
|
-
amount: '10000000000000000',
|
|
49
|
-
},
|
|
11
|
+
[Network.ARBITRUM]: [
|
|
50
12
|
{
|
|
51
13
|
srcToken: 'WETH',
|
|
52
|
-
destToken: '
|
|
14
|
+
destToken: 'USDC',
|
|
15
|
+
amount: '10000',
|
|
53
16
|
swapSide: SwapSide.BUY,
|
|
54
|
-
amount: '10000000000000000',
|
|
55
17
|
},
|
|
56
18
|
{
|
|
57
|
-
srcToken: '
|
|
19
|
+
srcToken: 'USDC',
|
|
58
20
|
destToken: 'WETH',
|
|
21
|
+
amount: '10000',
|
|
59
22
|
swapSide: SwapSide.SELL,
|
|
60
|
-
amount: '10000000000000000',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
srcToken: 'DAI',
|
|
64
|
-
destToken: 'ETH',
|
|
65
|
-
swapSide: SwapSide.SELL,
|
|
66
|
-
amount: '10000000000000000',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
srcToken: 'ETH',
|
|
70
|
-
destToken: 'DAI',
|
|
71
|
-
swapSide: SwapSide.SELL,
|
|
72
|
-
amount: '10000000000000000',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
srcToken: 'WETH',
|
|
76
|
-
destToken: 'DAI',
|
|
77
|
-
swapSide: SwapSide.SELL,
|
|
78
|
-
amount: '10000000000000000',
|
|
79
23
|
},
|
|
80
24
|
],
|
|
81
25
|
};
|
|
@@ -85,7 +85,8 @@ const buildConfigForGenericRFQ = (): RFQConfig => {
|
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
const SKIP_TENDERLY =
|
|
88
|
+
const SKIP_TENDERLY =
|
|
89
|
+
(process.env.GENERIC_RFQ_SKIP_TENDERLY ?? 'true') === 'true';
|
|
89
90
|
const dexKey = 'YOUR_NAME';
|
|
90
91
|
|
|
91
92
|
describe(`GenericRFQ ${dexKey} E2E`, () => {
|
|
@@ -133,8 +134,8 @@ describe(`GenericRFQ ${dexKey} E2E`, () => {
|
|
|
133
134
|
}
|
|
134
135
|
const contractMethod =
|
|
135
136
|
testCase.swapSide === SwapSide.BUY
|
|
136
|
-
? ContractMethod.
|
|
137
|
-
: ContractMethod.
|
|
137
|
+
? ContractMethod.swapOnAugustusRFQTryBatchFill
|
|
138
|
+
: ContractMethod.swapOnAugustusRFQTryBatchFill;
|
|
138
139
|
describe(`${contractMethod}`, () => {
|
|
139
140
|
it(`${testCase.swapSide} ${testCase.srcToken} -> ${testCase.destToken}`, async () => {
|
|
140
141
|
await newTestE2E({
|
|
@@ -10,12 +10,12 @@ export const InfusionConfig: DexConfigMap<DexParams> = {
|
|
|
10
10
|
factoryAddress: '0x2D9A3a2bd6400eE28d770c7254cA840c82faf23f',
|
|
11
11
|
router: '0x1E891C9F96DcA29Da8B97bE3403D16135EBe8028',
|
|
12
12
|
initCode:
|
|
13
|
-
'
|
|
13
|
+
'0x219feae2806b91b43e3369a02074b26dde4d33b44972f02d717f37ac78ab0245',
|
|
14
14
|
// updatable fees on the factory without event
|
|
15
|
-
stableFee:
|
|
16
|
-
volatileFee:
|
|
15
|
+
stableFee: 5,
|
|
16
|
+
volatileFee: 5,
|
|
17
17
|
poolGasCost: 180 * 1000,
|
|
18
|
-
feeCode:
|
|
18
|
+
feeCode: 5,
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
};
|
|
@@ -62,10 +62,10 @@ export const SolidlyConfig: DexConfigMap<DexParams> = {
|
|
|
62
62
|
initCode:
|
|
63
63
|
'0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0',
|
|
64
64
|
// updatable fees on the factory without event
|
|
65
|
-
stableFee:
|
|
66
|
-
volatileFee:
|
|
65
|
+
stableFee: 5,
|
|
66
|
+
volatileFee: 5,
|
|
67
67
|
poolGasCost: 180 * 1000,
|
|
68
|
-
feeCode:
|
|
68
|
+
feeCode: 5,
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
71
|
VelodromeV2: {
|
package/src/types.ts
CHANGED
|
@@ -294,7 +294,7 @@ export type Config = {
|
|
|
294
294
|
wrappedNativeTokenAddress: Address;
|
|
295
295
|
hasEIP1559: boolean;
|
|
296
296
|
augustusAddress: Address;
|
|
297
|
-
augustusV6Address
|
|
297
|
+
augustusV6Address: Address;
|
|
298
298
|
augustusRFQAddress: Address;
|
|
299
299
|
tokenTransferProxyAddress: Address;
|
|
300
300
|
multicallV2Address: Address;
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
allowedFn,
|
|
8
8
|
_balancesFn,
|
|
9
9
|
_allowancesFn,
|
|
10
|
+
balanceAndBlacklistStatesFn,
|
|
10
11
|
} from '../tests/smart-tokens';
|
|
11
12
|
import { Address } from '../src/types';
|
|
12
13
|
import { ETHER_ADDRESS, Network } from '../src/constants';
|
|
@@ -1177,6 +1178,12 @@ export const Tokens: {
|
|
|
1177
1178
|
address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
|
|
1178
1179
|
decimals: 6,
|
|
1179
1180
|
symbol: 'USDC',
|
|
1181
|
+
addBalance: balanceAndBlacklistStatesFn,
|
|
1182
|
+
addAllowance: allowedFn,
|
|
1183
|
+
},
|
|
1184
|
+
SUSHI: {
|
|
1185
|
+
address: '0xd4d42F0b6DEF4CE0383636770eF773390d85c61A',
|
|
1186
|
+
decimals: 18,
|
|
1180
1187
|
},
|
|
1181
1188
|
crvUSD: {
|
|
1182
1189
|
address: '0x498bf2b1e120fed3ad3d42ea2165e9b73f99c1e5',
|
|
@@ -1319,6 +1326,8 @@ export const Tokens: {
|
|
|
1319
1326
|
WETH: {
|
|
1320
1327
|
address: '0x4200000000000000000000000000000000000006',
|
|
1321
1328
|
decimals: 18,
|
|
1329
|
+
addBalance: balanceOfFn,
|
|
1330
|
+
addAllowance: allowanceFn,
|
|
1322
1331
|
},
|
|
1323
1332
|
ETH: { address: ETHER_ADDRESS, decimals: 18 },
|
|
1324
1333
|
USDCe: {
|
package/tests/smart-tokens.ts
CHANGED
|
@@ -43,6 +43,9 @@ const constructAddBAllowanceFn = (varName: string): AddAllowanceFn => {
|
|
|
43
43
|
|
|
44
44
|
export const balanceOfFn = constructAddBalanceFn('balanceOf');
|
|
45
45
|
export const balancesFn = constructAddBalanceFn('balances');
|
|
46
|
+
export const balanceAndBlacklistStatesFn = constructAddBalanceFn(
|
|
47
|
+
'balanceAndBlacklistStates',
|
|
48
|
+
);
|
|
46
49
|
export const _balancesFn = constructAddBalanceFn('_balances');
|
|
47
50
|
export const allowanceFn = constructAddBAllowanceFn('allowance');
|
|
48
51
|
export const _allowancesFn = constructAddBAllowanceFn('_allowances');
|
package/tests/utils-e2e.ts
CHANGED
|
@@ -777,7 +777,9 @@ export async function newTestE2E({
|
|
|
777
777
|
.addBalance(senderAddress, twiceAmount.toString())
|
|
778
778
|
.addAllowance(
|
|
779
779
|
senderAddress,
|
|
780
|
-
|
|
780
|
+
priceRoute.version === ParaSwapVersion.V5
|
|
781
|
+
? config.tokenTransferProxyAddress
|
|
782
|
+
: config.augustusV6Address,
|
|
781
783
|
amount.toString(),
|
|
782
784
|
);
|
|
783
785
|
} else {
|
|
@@ -785,7 +787,9 @@ export async function newTestE2E({
|
|
|
785
787
|
.addBalance(senderAddress, MAX_UINT)
|
|
786
788
|
.addAllowance(
|
|
787
789
|
senderAddress,
|
|
788
|
-
|
|
790
|
+
priceRoute.version === ParaSwapVersion.V5
|
|
791
|
+
? config.tokenTransferProxyAddress
|
|
792
|
+
: config.augustusV6Address,
|
|
789
793
|
(BigInt(MAX_UINT) / 8n).toString(),
|
|
790
794
|
);
|
|
791
795
|
}
|