@paraswap/dex-lib 3.5.4-v6.2.0 → 3.5.4-v6.2.2
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/constants.d.ts +2 -0
- package/build/constants.js +3 -1
- package/build/constants.js.map +1 -1
- package/build/dex/balancer-v2/balancer-v2.d.ts +2 -2
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/curve-v1/curve-v1.d.ts +2 -2
- package/build/dex/curve-v1/curve-v1.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +2 -2
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/curve-v2/curve-v2.d.ts +2 -2
- package/build/dex/curve-v2/curve-v2.js.map +1 -1
- package/build/dex/generic-rfq/generic-rfq.d.ts +1 -1
- package/build/dex/generic-rfq/generic-rfq.js.map +1 -1
- package/build/dex/idex.d.ts +2 -2
- package/build/dex/maker-psm/maker-psm.d.ts +12 -3
- package/build/dex/maker-psm/maker-psm.js +66 -0
- package/build/dex/maker-psm/maker-psm.js.map +1 -1
- package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +185 -0
- package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
- package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/build/dex/maker-psm/types.d.ts +15 -1
- package/build/dex/uniswap-v2/uniswap-v2.d.ts +2 -2
- package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +2 -2
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/zerox/index.d.ts +1 -1
- package/build/dex/zerox/index.js.map +1 -1
- package/build/generic-swap-transaction-builder.d.ts +5 -3
- package/build/generic-swap-transaction-builder.js +22 -7
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +2 -0
- package/src/dex/balancer-v2/balancer-v2.ts +2 -2
- package/src/dex/curve-v1/curve-v1.ts +2 -2
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +2 -2
- package/src/dex/curve-v2/curve-v2.ts +2 -2
- package/src/dex/generic-rfq/generic-rfq.ts +1 -1
- package/src/dex/idex.ts +2 -2
- package/src/dex/maker-psm/maker-psm-e2e.test.ts +8 -33
- package/src/dex/maker-psm/maker-psm.ts +136 -5
- package/src/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/src/dex/maker-psm/scripts/validate-state.ts +221 -0
- package/src/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/src/dex/maker-psm/types.ts +17 -1
- package/src/dex/uniswap-v2/uniswap-v2.ts +2 -2
- package/src/dex/uniswap-v3/uniswap-v3.ts +2 -2
- package/src/dex/zerox/index.ts +1 -1
- package/src/generic-swap-transaction-builder.ts +40 -0
- package/tests/constants-e2e.ts +1 -1
|
@@ -12,9 +12,11 @@ import {
|
|
|
12
12
|
ETHER_ADDRESS,
|
|
13
13
|
FEE_PERCENT_IN_BASIS_POINTS_MASK,
|
|
14
14
|
IS_CAP_SURPLUS_MASK,
|
|
15
|
+
IS_DIRECT_TRANSFER_MASK,
|
|
15
16
|
IS_REFERRAL_MASK,
|
|
16
17
|
IS_SKIP_BLACKLIST_MASK,
|
|
17
18
|
IS_TAKE_SURPLUS_MASK,
|
|
19
|
+
IS_USER_SURPLUS_MASK,
|
|
18
20
|
NULL_ADDRESS,
|
|
19
21
|
SwapSide,
|
|
20
22
|
} from './constants';
|
|
@@ -43,6 +45,8 @@ interface FeeParams {
|
|
|
43
45
|
feePercent: string;
|
|
44
46
|
isTakeSurplus: boolean;
|
|
45
47
|
isCapSurplus: boolean;
|
|
48
|
+
isSurplusToUser: boolean;
|
|
49
|
+
isDirectFeeTransfer: boolean;
|
|
46
50
|
isReferral: boolean;
|
|
47
51
|
isSkipBlacklist: boolean;
|
|
48
52
|
}
|
|
@@ -209,6 +213,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
209
213
|
partnerFeePercent: string,
|
|
210
214
|
takeSurplus: boolean,
|
|
211
215
|
isCapSurplus: boolean,
|
|
216
|
+
isSurplusToUser: boolean,
|
|
217
|
+
isDirectFeeTransfer: boolean,
|
|
212
218
|
beneficiary: Address,
|
|
213
219
|
permit: string,
|
|
214
220
|
deadline: string,
|
|
@@ -237,6 +243,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
237
243
|
partnerFeePercent,
|
|
238
244
|
takeSurplus,
|
|
239
245
|
isCapSurplus,
|
|
246
|
+
isSurplusToUser,
|
|
247
|
+
isDirectFeeTransfer,
|
|
240
248
|
priceRoute,
|
|
241
249
|
});
|
|
242
250
|
|
|
@@ -280,6 +288,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
280
288
|
partnerFeePercent: string,
|
|
281
289
|
takeSurplus: boolean,
|
|
282
290
|
isCapSurplus: boolean,
|
|
291
|
+
isSurplusToUser: boolean,
|
|
292
|
+
isDirectFeeTransfer: boolean,
|
|
283
293
|
permit: string,
|
|
284
294
|
uuid: string,
|
|
285
295
|
beneficiary: Address,
|
|
@@ -324,6 +334,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
324
334
|
partnerFeePercent,
|
|
325
335
|
takeSurplus,
|
|
326
336
|
isCapSurplus,
|
|
337
|
+
isSurplusToUser,
|
|
338
|
+
isDirectFeeTransfer,
|
|
327
339
|
priceRoute,
|
|
328
340
|
});
|
|
329
341
|
|
|
@@ -349,6 +361,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
349
361
|
priceRoute,
|
|
350
362
|
takeSurplus,
|
|
351
363
|
isCapSurplus,
|
|
364
|
+
isSurplusToUser,
|
|
365
|
+
isDirectFeeTransfer,
|
|
352
366
|
partnerAddress,
|
|
353
367
|
partnerFeePercent,
|
|
354
368
|
skipBlacklist = false,
|
|
@@ -358,6 +372,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
358
372
|
partnerFeePercent: string;
|
|
359
373
|
takeSurplus: boolean;
|
|
360
374
|
isCapSurplus: boolean;
|
|
375
|
+
isSurplusToUser: boolean;
|
|
376
|
+
isDirectFeeTransfer: boolean;
|
|
361
377
|
priceRoute: OptimalRate;
|
|
362
378
|
skipBlacklist?: boolean;
|
|
363
379
|
}) {
|
|
@@ -367,6 +383,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
367
383
|
feePercent: '0',
|
|
368
384
|
isTakeSurplus: takeSurplus,
|
|
369
385
|
isCapSurplus,
|
|
386
|
+
isSurplusToUser,
|
|
387
|
+
isDirectFeeTransfer,
|
|
370
388
|
isReferral: true,
|
|
371
389
|
isSkipBlacklist: skipBlacklist,
|
|
372
390
|
})
|
|
@@ -375,6 +393,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
375
393
|
feePercent: partnerFeePercent,
|
|
376
394
|
isTakeSurplus: takeSurplus,
|
|
377
395
|
isCapSurplus,
|
|
396
|
+
isSurplusToUser,
|
|
397
|
+
isDirectFeeTransfer,
|
|
378
398
|
isSkipBlacklist: skipBlacklist,
|
|
379
399
|
isReferral: false,
|
|
380
400
|
});
|
|
@@ -391,6 +411,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
391
411
|
partnerFeePercent,
|
|
392
412
|
takeSurplus,
|
|
393
413
|
isCapSurplus,
|
|
414
|
+
isSurplusToUser,
|
|
415
|
+
isDirectFeeTransfer,
|
|
394
416
|
gasPrice,
|
|
395
417
|
maxFeePerGas,
|
|
396
418
|
maxPriorityFeePerGas,
|
|
@@ -408,6 +430,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
408
430
|
partnerFeePercent: string;
|
|
409
431
|
takeSurplus?: boolean;
|
|
410
432
|
isCapSurplus?: boolean;
|
|
433
|
+
isSurplusToUser?: boolean;
|
|
434
|
+
isDirectFeeTransfer?: boolean;
|
|
411
435
|
gasPrice?: string;
|
|
412
436
|
maxFeePerGas?: string;
|
|
413
437
|
maxPriorityFeePerGas?: string;
|
|
@@ -438,6 +462,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
438
462
|
partnerFeePercent,
|
|
439
463
|
takeSurplus ?? false,
|
|
440
464
|
isCapSurplus ?? true,
|
|
465
|
+
isSurplusToUser ?? false,
|
|
466
|
+
isDirectFeeTransfer ?? false,
|
|
441
467
|
permit || '0x',
|
|
442
468
|
uuid,
|
|
443
469
|
_beneficiary,
|
|
@@ -452,6 +478,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
452
478
|
partnerFeePercent,
|
|
453
479
|
takeSurplus ?? false,
|
|
454
480
|
isCapSurplus ?? true,
|
|
481
|
+
isSurplusToUser ?? false,
|
|
482
|
+
isDirectFeeTransfer ?? false,
|
|
455
483
|
_beneficiary,
|
|
456
484
|
permit || '0x',
|
|
457
485
|
deadline,
|
|
@@ -485,6 +513,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
485
513
|
feePercent,
|
|
486
514
|
isTakeSurplus,
|
|
487
515
|
isCapSurplus,
|
|
516
|
+
isSurplusToUser,
|
|
517
|
+
isDirectFeeTransfer,
|
|
488
518
|
isReferral,
|
|
489
519
|
isSkipBlacklist,
|
|
490
520
|
}: FeeParams): string {
|
|
@@ -522,6 +552,16 @@ export class GenericSwapTransactionBuilder {
|
|
|
522
552
|
partialFeeCodeWithBitFlags.or(IS_CAP_SURPLUS_MASK);
|
|
523
553
|
}
|
|
524
554
|
|
|
555
|
+
if (isSurplusToUser) {
|
|
556
|
+
partialFeeCodeWithBitFlags =
|
|
557
|
+
partialFeeCodeWithBitFlags.or(IS_USER_SURPLUS_MASK);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (isDirectFeeTransfer) {
|
|
561
|
+
partialFeeCodeWithBitFlags = partialFeeCodeWithBitFlags.or(
|
|
562
|
+
IS_DIRECT_TRANSFER_MASK,
|
|
563
|
+
);
|
|
564
|
+
}
|
|
525
565
|
// Combine partnerBigInt and feePercentBigInt
|
|
526
566
|
const feeCode = partialFeeCodeWithPartnerAddress.or(
|
|
527
567
|
partialFeeCodeWithBitFlags,
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -1314,7 +1314,7 @@ export const Holders: {
|
|
|
1314
1314
|
CVX: '0x0aCA67Fa70B142A3b9bF2eD89A81B40ff85dACdC',
|
|
1315
1315
|
MIM: '0xa046a8660e66d178ee07ec97c585eeb6aa18c26c',
|
|
1316
1316
|
AnkETH: '0xF7260D4ADc48fEefd5a19a9Eb23f9747CeE15C92',
|
|
1317
|
-
DAI: '
|
|
1317
|
+
DAI: '0xd1668fb5f690c59ab4b0cabad0f8c1617895052b',
|
|
1318
1318
|
oldFRAX: '0x183d0dc5867c01bfb1dbbc41d6a9d3de6e044626',
|
|
1319
1319
|
newFRAX: '0x183d0dc5867c01bfb1dbbc41d6a9d3de6e044626',
|
|
1320
1320
|
FEI: '0x19c549357034d10db8d75ed812b45be1dd8a7218',
|