@indigo-labs/indigo-sdk 0.4.4 → 0.5.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.
- package/dist/index.d.mts +121 -40
- package/dist/index.d.ts +121 -40
- package/dist/index.js +962 -818
- package/dist/index.mjs +418 -282
- package/package.json +2 -2
- package/scripts/run-repeat.sh +22 -0
- package/src/contracts/cdp/helpers.ts +7 -6
- package/src/contracts/cdp/transactions.ts +8 -29
- package/src/contracts/gov/transactions.ts +12 -16
- package/src/contracts/iasset/helpers.ts +2 -7
- package/src/contracts/initialize/actions.ts +0 -2
- package/src/contracts/initialize/helpers.ts +0 -4
- package/src/contracts/interest-collection/transactions.ts +2 -5
- package/src/contracts/interest-oracle/helpers.ts +4 -0
- package/src/contracts/interest-oracle/transactions.ts +1 -4
- package/src/contracts/price-oracle/helpers.ts +5 -11
- package/src/contracts/price-oracle/transactions.ts +2 -7
- package/src/contracts/rob/transactions.ts +0 -2
- package/src/contracts/rob-leverage/transactions.ts +1 -4
- package/src/contracts/stability-pool/transactions.ts +2 -8
- package/src/contracts/stableswap/helpers.ts +487 -2
- package/src/contracts/stableswap/transactions.ts +53 -222
- package/src/contracts/staking/transactions.ts +2 -7
- package/tests/cdp/actions.ts +0 -11
- package/tests/cdp/cdp-helpers.ts +2 -2
- package/tests/cdp/cdp-queries.ts +1 -3
- package/tests/cdp/cdp.test.ts +407 -619
- package/tests/cdp/transactions-mutated.ts +30 -25
- package/tests/endpoints/initialize.ts +0 -2
- package/tests/gov/actions.ts +7 -32
- package/tests/gov/gov.test.ts +169 -401
- package/tests/indigo-test-helpers.ts +2 -3
- package/tests/initialize.test.ts +15 -20
- package/tests/interest-collection/interest-collection.test.ts +0 -4
- package/tests/interest-oracle.test.ts +1 -8
- package/tests/price-oracle/actions.ts +6 -8
- package/tests/price-oracle/price-oracle.test.ts +1 -13
- package/tests/price-oracle/transactions-mutated.ts +1 -4
- package/tests/pyth/pyth-indigo.test.ts +8 -12
- package/tests/pyth/pyth.test.ts +1 -2
- package/tests/rob/actions.ts +0 -2
- package/tests/rob/rob-leverage.test.ts +164 -220
- package/tests/rob/rob.test.ts +158 -263
- package/tests/rob/transactions-mutated.ts +7 -18
- package/tests/stability-pool/actions.ts +4 -8
- package/tests/stability-pool.test.ts +164 -255
- package/tests/stableswap/stableswap-actions.ts +0 -1
- package/tests/stableswap/stableswap-queries.ts +26 -17
- package/tests/stableswap/stableswap.test.ts +338 -4
- package/tests/staking.test.ts +2 -13
- package/tests/treasury/treasury.test.ts +6 -30
|
@@ -52,33 +52,21 @@ export async function findSingleStableswapOrder(
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export async function
|
|
55
|
+
export async function findAllStableswapOrders(
|
|
56
56
|
lucid: LucidEvolution,
|
|
57
57
|
stableswapScriptHash: ScriptHash,
|
|
58
|
-
iassetName: string,
|
|
59
|
-
collateralAsset: AssetClass,
|
|
60
58
|
): Promise<{ utxo: UTxO; datum: StableswapOrderDatum }[]> {
|
|
61
|
-
const
|
|
59
|
+
const psmUtxos = await lucid.utxosAt(
|
|
62
60
|
createScriptAddress(lucid.config().network!, stableswapScriptHash),
|
|
63
61
|
);
|
|
64
62
|
|
|
65
63
|
const orders = F.pipe(
|
|
66
|
-
|
|
64
|
+
psmUtxos.map((utxo) =>
|
|
67
65
|
F.pipe(
|
|
68
66
|
O.fromNullable(utxo.datum),
|
|
69
67
|
O.flatMap(parseStableswapOrderDatum),
|
|
70
|
-
O.
|
|
71
|
-
|
|
72
|
-
toHex(datum.iasset) === iassetName &&
|
|
73
|
-
toHex(datum.collateralAsset.currencySymbol) ===
|
|
74
|
-
toHex(collateralAsset.currencySymbol) &&
|
|
75
|
-
toHex(datum.collateralAsset.tokenName) ===
|
|
76
|
-
toHex(collateralAsset.tokenName)
|
|
77
|
-
) {
|
|
78
|
-
return O.some({ utxo, datum: datum });
|
|
79
|
-
} else {
|
|
80
|
-
return O.none;
|
|
81
|
-
}
|
|
68
|
+
O.map((datum) => {
|
|
69
|
+
return { utxo, datum: datum };
|
|
82
70
|
}),
|
|
83
71
|
),
|
|
84
72
|
),
|
|
@@ -87,3 +75,24 @@ export async function findStableswapOrders(
|
|
|
87
75
|
|
|
88
76
|
return orders;
|
|
89
77
|
}
|
|
78
|
+
|
|
79
|
+
export async function findStableswapOrders(
|
|
80
|
+
lucid: LucidEvolution,
|
|
81
|
+
stableswapScriptHash: ScriptHash,
|
|
82
|
+
iassetName: string,
|
|
83
|
+
collateralAsset: AssetClass,
|
|
84
|
+
): Promise<{ utxo: UTxO; datum: StableswapOrderDatum }[]> {
|
|
85
|
+
const allPsmOrders = await findAllStableswapOrders(
|
|
86
|
+
lucid,
|
|
87
|
+
stableswapScriptHash,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return allPsmOrders.filter(
|
|
91
|
+
(order) =>
|
|
92
|
+
toHex(order.datum.iasset) === iassetName &&
|
|
93
|
+
toHex(order.datum.collateralAsset.currencySymbol) ===
|
|
94
|
+
toHex(collateralAsset.currencySymbol) &&
|
|
95
|
+
toHex(order.datum.collateralAsset.tokenName) ===
|
|
96
|
+
toHex(collateralAsset.tokenName),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assert, beforeEach, test } from 'vitest';
|
|
1
|
+
import { assert, beforeEach, expect, test } from 'vitest';
|
|
2
2
|
import {
|
|
3
3
|
IndigoTestContext,
|
|
4
4
|
repeat,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
createIndigoTestContext,
|
|
10
10
|
EXAMPLE_TOKEN_1,
|
|
11
|
+
EXAMPLE_TOKEN_2,
|
|
11
12
|
} from '../indigo-test-helpers';
|
|
12
13
|
import { benchmarkAndAwaitTx } from '../utils/benchmark-utils';
|
|
13
14
|
import {
|
|
@@ -36,11 +37,13 @@ import {
|
|
|
36
37
|
findStableswapPool,
|
|
37
38
|
} from '../cdp/cdp-queries';
|
|
38
39
|
import {
|
|
40
|
+
findAllStableswapOrders,
|
|
39
41
|
findSingleStableswapOrder,
|
|
40
42
|
findStableswapOrders,
|
|
41
43
|
} from './stableswap-queries';
|
|
42
44
|
import { feedPriceOracleTx } from '../../src/contracts/price-oracle/transactions';
|
|
43
45
|
import {
|
|
46
|
+
adaAssetClass,
|
|
44
47
|
addressFromBech32,
|
|
45
48
|
assetClassValueOf,
|
|
46
49
|
lovelacesAmt,
|
|
@@ -53,7 +56,10 @@ import { array as A } from 'fp-ts';
|
|
|
53
56
|
import { runOpenCdp } from '../cdp/actions';
|
|
54
57
|
import { Data } from '@evolution-sdk/evolution';
|
|
55
58
|
import { serialiseStableswapOrderDatum } from '../../src/contracts/stableswap/types-new';
|
|
56
|
-
import {
|
|
59
|
+
import {
|
|
60
|
+
BASE_MAX_EXECUTION_FEE,
|
|
61
|
+
pickValidSatisfiableOrders,
|
|
62
|
+
} from '../../src/contracts/stableswap/helpers';
|
|
57
63
|
import { StableswapPoolContent } from '../../src/contracts/cdp/types-new';
|
|
58
64
|
import { mutatedBatchProcessStableswapOrders } from './transactions-mutated';
|
|
59
65
|
import { expectScriptFailure } from '../utils/asserts';
|
|
@@ -63,6 +69,7 @@ import {
|
|
|
63
69
|
} from '../../src/contracts/treasury/queries';
|
|
64
70
|
import { createUtxoAtTreasury } from '../endpoints/treasury';
|
|
65
71
|
import { rationalFromInt, rationalZero } from '../../src/types/rational';
|
|
72
|
+
import { refreshPriceOracle } from '../price-oracle/actions';
|
|
66
73
|
|
|
67
74
|
beforeEach<IndigoTestContext>(async (context: IndigoTestContext) => {
|
|
68
75
|
await createIndigoTestContext(context);
|
|
@@ -391,6 +398,335 @@ test<IndigoTestContext>('Stableswap - Batch a single order to mint with no minti
|
|
|
391
398
|
);
|
|
392
399
|
});
|
|
393
400
|
|
|
401
|
+
test<IndigoTestContext>('Stableswap - pickValidSatisfiableOrders', async (context: IndigoTestContext) => {
|
|
402
|
+
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
403
|
+
|
|
404
|
+
await runCreateStableswapPool(
|
|
405
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
406
|
+
EXAMPLE_TOKEN_1,
|
|
407
|
+
context,
|
|
408
|
+
rationalFromInt(1n),
|
|
409
|
+
{ numerator: 5n, denominator: 1000n },
|
|
410
|
+
{ numerator: 5n, denominator: 1000n },
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
const stableswapPool = await findStableswapPool(
|
|
414
|
+
context.lucid,
|
|
415
|
+
context.systemParams.validatorHashes.cdpHash,
|
|
416
|
+
fromSystemParamsAsset(context.systemParams.stableswapParams.cdpToken),
|
|
417
|
+
fromText(context.assetConfigs[0].iassetTokenNameAscii),
|
|
418
|
+
EXAMPLE_TOKEN_1,
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
await refreshPriceOracle(
|
|
422
|
+
context,
|
|
423
|
+
context.systemParams,
|
|
424
|
+
context.assetConfigs[0],
|
|
425
|
+
adaAssetClass,
|
|
426
|
+
);
|
|
427
|
+
await refreshPriceOracle(
|
|
428
|
+
context,
|
|
429
|
+
context.systemParams,
|
|
430
|
+
context.assetConfigs[1],
|
|
431
|
+
adaAssetClass,
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
435
|
+
|
|
436
|
+
// Add some IUSD to wallet
|
|
437
|
+
await runAndAwaitTx(
|
|
438
|
+
context.lucid,
|
|
439
|
+
runOpenCdp(
|
|
440
|
+
context,
|
|
441
|
+
context.systemParams,
|
|
442
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
443
|
+
adaAssetClass,
|
|
444
|
+
100_000_000n,
|
|
445
|
+
50_000_000n,
|
|
446
|
+
),
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
// iEUR
|
|
450
|
+
await runAndAwaitTx(
|
|
451
|
+
context.lucid,
|
|
452
|
+
runOpenCdp(
|
|
453
|
+
context,
|
|
454
|
+
context.systemParams,
|
|
455
|
+
context.assetConfigs[1].iassetTokenNameAscii,
|
|
456
|
+
adaAssetClass,
|
|
457
|
+
100_000_000n,
|
|
458
|
+
50_000_000n,
|
|
459
|
+
),
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
// mint order
|
|
463
|
+
await runAndAwaitTx(
|
|
464
|
+
context.lucid,
|
|
465
|
+
createStableswapOrder(
|
|
466
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
467
|
+
EXAMPLE_TOKEN_1,
|
|
468
|
+
10_000_000n,
|
|
469
|
+
true,
|
|
470
|
+
stableswapPool.datum,
|
|
471
|
+
context.systemParams,
|
|
472
|
+
context.lucid,
|
|
473
|
+
),
|
|
474
|
+
);
|
|
475
|
+
|
|
476
|
+
// mint order, can't process because not enough lovelaces
|
|
477
|
+
const mintOrderMinLovelacesTx = await runAndAwaitTx(
|
|
478
|
+
context.lucid,
|
|
479
|
+
createStableswapOrder(
|
|
480
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
481
|
+
EXAMPLE_TOKEN_1,
|
|
482
|
+
10_000_000n,
|
|
483
|
+
true,
|
|
484
|
+
stableswapPool.datum,
|
|
485
|
+
context.systemParams,
|
|
486
|
+
context.lucid,
|
|
487
|
+
await context.lucid.wallet().address(),
|
|
488
|
+
undefined,
|
|
489
|
+
BASE_MAX_EXECUTION_FEE,
|
|
490
|
+
-200_000n,
|
|
491
|
+
),
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
const mintOtherCollateralTx = await runAndAwaitTx(
|
|
495
|
+
context.lucid,
|
|
496
|
+
createStableswapOrder(
|
|
497
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
498
|
+
EXAMPLE_TOKEN_2,
|
|
499
|
+
1_000_000n,
|
|
500
|
+
true,
|
|
501
|
+
stableswapPool.datum,
|
|
502
|
+
context.systemParams,
|
|
503
|
+
context.lucid,
|
|
504
|
+
),
|
|
505
|
+
);
|
|
506
|
+
|
|
507
|
+
const mintOtherIassetTx = await runAndAwaitTx(
|
|
508
|
+
context.lucid,
|
|
509
|
+
createStableswapOrder(
|
|
510
|
+
'IBTC',
|
|
511
|
+
EXAMPLE_TOKEN_1,
|
|
512
|
+
1_000_000n,
|
|
513
|
+
true,
|
|
514
|
+
stableswapPool.datum,
|
|
515
|
+
context.systemParams,
|
|
516
|
+
context.lucid,
|
|
517
|
+
),
|
|
518
|
+
);
|
|
519
|
+
|
|
520
|
+
// mint order, can't process because max exec fee is low
|
|
521
|
+
const mintOrderMaxExecFeeTx = await runAndAwaitTx(
|
|
522
|
+
context.lucid,
|
|
523
|
+
createStableswapOrder(
|
|
524
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
525
|
+
EXAMPLE_TOKEN_1,
|
|
526
|
+
3_000_000n,
|
|
527
|
+
true,
|
|
528
|
+
stableswapPool.datum,
|
|
529
|
+
context.systemParams,
|
|
530
|
+
context.lucid,
|
|
531
|
+
await context.lucid.wallet().address(),
|
|
532
|
+
undefined,
|
|
533
|
+
1n,
|
|
534
|
+
),
|
|
535
|
+
);
|
|
536
|
+
|
|
537
|
+
// mint order, this one shouldn't be processed because of maxFeeRatio
|
|
538
|
+
const mintOrderMaxFeeTx = await runAndAwaitTx(
|
|
539
|
+
context.lucid,
|
|
540
|
+
createStableswapOrder(
|
|
541
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
542
|
+
EXAMPLE_TOKEN_1,
|
|
543
|
+
10_000_000n,
|
|
544
|
+
true,
|
|
545
|
+
stableswapPool.datum,
|
|
546
|
+
context.systemParams,
|
|
547
|
+
context.lucid,
|
|
548
|
+
await context.lucid.wallet().address(),
|
|
549
|
+
undefined,
|
|
550
|
+
BASE_MAX_EXECUTION_FEE,
|
|
551
|
+
0n,
|
|
552
|
+
rationalZero,
|
|
553
|
+
),
|
|
554
|
+
);
|
|
555
|
+
|
|
556
|
+
// Redemption order, this can't be processed because of lack of liquidity
|
|
557
|
+
const redeemOrderTx0 = await runAndAwaitTx(
|
|
558
|
+
context.lucid,
|
|
559
|
+
createStableswapOrder(
|
|
560
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
561
|
+
EXAMPLE_TOKEN_1,
|
|
562
|
+
20_000_000n,
|
|
563
|
+
false,
|
|
564
|
+
stableswapPool.datum,
|
|
565
|
+
context.systemParams,
|
|
566
|
+
context.lucid,
|
|
567
|
+
),
|
|
568
|
+
);
|
|
569
|
+
|
|
570
|
+
// Redemption order
|
|
571
|
+
await runAndAwaitTx(
|
|
572
|
+
context.lucid,
|
|
573
|
+
createStableswapOrder(
|
|
574
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
575
|
+
EXAMPLE_TOKEN_1,
|
|
576
|
+
5_000_000n,
|
|
577
|
+
false,
|
|
578
|
+
stableswapPool.datum,
|
|
579
|
+
context.systemParams,
|
|
580
|
+
context.lucid,
|
|
581
|
+
),
|
|
582
|
+
);
|
|
583
|
+
|
|
584
|
+
// Redemption order
|
|
585
|
+
const redeemOtherCollateralTx = await runAndAwaitTx(
|
|
586
|
+
context.lucid,
|
|
587
|
+
createStableswapOrder(
|
|
588
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
589
|
+
EXAMPLE_TOKEN_2,
|
|
590
|
+
1_000_000n,
|
|
591
|
+
false,
|
|
592
|
+
stableswapPool.datum,
|
|
593
|
+
context.systemParams,
|
|
594
|
+
context.lucid,
|
|
595
|
+
),
|
|
596
|
+
);
|
|
597
|
+
|
|
598
|
+
const redeemOtherIassetTx = await runAndAwaitTx(
|
|
599
|
+
context.lucid,
|
|
600
|
+
createStableswapOrder(
|
|
601
|
+
context.assetConfigs[1].iassetTokenNameAscii,
|
|
602
|
+
EXAMPLE_TOKEN_1,
|
|
603
|
+
1_000_000n,
|
|
604
|
+
false,
|
|
605
|
+
stableswapPool.datum,
|
|
606
|
+
context.systemParams,
|
|
607
|
+
context.lucid,
|
|
608
|
+
),
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
// Redemption order, can't be satisfied because of maxFeeRatio
|
|
612
|
+
const redeemOrderMaxFeeTx = await runAndAwaitTx(
|
|
613
|
+
context.lucid,
|
|
614
|
+
createStableswapOrder(
|
|
615
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
616
|
+
EXAMPLE_TOKEN_1,
|
|
617
|
+
1_000_000n,
|
|
618
|
+
false,
|
|
619
|
+
stableswapPool.datum,
|
|
620
|
+
context.systemParams,
|
|
621
|
+
context.lucid,
|
|
622
|
+
await context.lucid.wallet().address(),
|
|
623
|
+
undefined,
|
|
624
|
+
BASE_MAX_EXECUTION_FEE,
|
|
625
|
+
0n,
|
|
626
|
+
rationalZero,
|
|
627
|
+
),
|
|
628
|
+
);
|
|
629
|
+
|
|
630
|
+
// redemption order, can't process because max exec fee is low
|
|
631
|
+
const redemptionOrderMaxExecFeeTx = await runAndAwaitTx(
|
|
632
|
+
context.lucid,
|
|
633
|
+
createStableswapOrder(
|
|
634
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
635
|
+
EXAMPLE_TOKEN_1,
|
|
636
|
+
1_000_000n,
|
|
637
|
+
false,
|
|
638
|
+
stableswapPool.datum,
|
|
639
|
+
context.systemParams,
|
|
640
|
+
context.lucid,
|
|
641
|
+
await context.lucid.wallet().address(),
|
|
642
|
+
undefined,
|
|
643
|
+
1n,
|
|
644
|
+
),
|
|
645
|
+
);
|
|
646
|
+
|
|
647
|
+
// redemption order, can't process because not enough lovelaces
|
|
648
|
+
const redemptionOrderMinLovelacesTx = await runAndAwaitTx(
|
|
649
|
+
context.lucid,
|
|
650
|
+
createStableswapOrder(
|
|
651
|
+
context.assetConfigs[0].iassetTokenNameAscii,
|
|
652
|
+
EXAMPLE_TOKEN_1,
|
|
653
|
+
5_000_000n,
|
|
654
|
+
false,
|
|
655
|
+
stableswapPool.datum,
|
|
656
|
+
context.systemParams,
|
|
657
|
+
context.lucid,
|
|
658
|
+
await context.lucid.wallet().address(),
|
|
659
|
+
undefined,
|
|
660
|
+
BASE_MAX_EXECUTION_FEE,
|
|
661
|
+
-500_000n,
|
|
662
|
+
),
|
|
663
|
+
);
|
|
664
|
+
|
|
665
|
+
const stableswapOrders = await findAllStableswapOrders(
|
|
666
|
+
context.lucid,
|
|
667
|
+
context.systemParams.validatorHashes.stableswapHash,
|
|
668
|
+
);
|
|
669
|
+
|
|
670
|
+
await createUtxoAtTreasury(
|
|
671
|
+
mkLovelacesOf(2_000_000n),
|
|
672
|
+
context.systemParams,
|
|
673
|
+
context,
|
|
674
|
+
);
|
|
675
|
+
|
|
676
|
+
const treasuryUtxo = await findRandomTreasuryUtxoWithOnlyAda(
|
|
677
|
+
context.lucid,
|
|
678
|
+
context.systemParams,
|
|
679
|
+
);
|
|
680
|
+
|
|
681
|
+
const satisfiableOrders = pickValidSatisfiableOrders(
|
|
682
|
+
context.lucid,
|
|
683
|
+
stableswapOrders,
|
|
684
|
+
stableswapPool,
|
|
685
|
+
context.systemParams,
|
|
686
|
+
);
|
|
687
|
+
|
|
688
|
+
expect(satisfiableOrders.length, 'Only 2 orders are satisfiable').toEqual(2);
|
|
689
|
+
|
|
690
|
+
await runAndAwaitTx(
|
|
691
|
+
context.lucid,
|
|
692
|
+
batchProcessStableswapOrders(
|
|
693
|
+
satisfiableOrders.map((o) => o.utxo),
|
|
694
|
+
stableswapPool.utxo,
|
|
695
|
+
treasuryUtxo,
|
|
696
|
+
context.systemParams,
|
|
697
|
+
context.lucid,
|
|
698
|
+
),
|
|
699
|
+
);
|
|
700
|
+
|
|
701
|
+
///////////////////////////////////
|
|
702
|
+
// Checks after last transaction //
|
|
703
|
+
///////////////////////////////////
|
|
704
|
+
|
|
705
|
+
const remainingOrders = await findAllStableswapOrders(
|
|
706
|
+
context.lucid,
|
|
707
|
+
context.systemParams.validatorHashes.stableswapHash,
|
|
708
|
+
);
|
|
709
|
+
|
|
710
|
+
expect(
|
|
711
|
+
remainingOrders.map((o) => o.utxo.txHash),
|
|
712
|
+
'Expected different orders to not be processed',
|
|
713
|
+
).toEqual(
|
|
714
|
+
expect.arrayContaining([
|
|
715
|
+
mintOtherIassetTx,
|
|
716
|
+
mintOtherCollateralTx,
|
|
717
|
+
redeemOtherIassetTx,
|
|
718
|
+
redeemOtherCollateralTx,
|
|
719
|
+
redeemOrderMaxFeeTx,
|
|
720
|
+
redeemOrderTx0,
|
|
721
|
+
mintOrderMaxFeeTx,
|
|
722
|
+
mintOrderMaxExecFeeTx,
|
|
723
|
+
redemptionOrderMaxExecFeeTx,
|
|
724
|
+
redemptionOrderMinLovelacesTx,
|
|
725
|
+
mintOrderMinLovelacesTx,
|
|
726
|
+
]),
|
|
727
|
+
);
|
|
728
|
+
});
|
|
729
|
+
|
|
394
730
|
test<IndigoTestContext>('Stableswap - Batch a single order to mint with collateral asset in the pool', async (context: IndigoTestContext) => {
|
|
395
731
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
396
732
|
|
|
@@ -989,7 +1325,6 @@ test<IndigoTestContext>('Stableswap - Batch a single order to redeem emptying th
|
|
|
989
1325
|
priceOracleUtxo!,
|
|
990
1326
|
rationalFromInt(1n),
|
|
991
1327
|
context.assetConfigs[0].collateralAssets[0].oracleParams!,
|
|
992
|
-
context.emulator.slot,
|
|
993
1328
|
),
|
|
994
1329
|
);
|
|
995
1330
|
|
|
@@ -3549,7 +3884,6 @@ test<IndigoTestContext>('Stableswap - Batch an order to mint with an order to re
|
|
|
3549
3884
|
priceOracleUtxo!,
|
|
3550
3885
|
rationalFromInt(1n),
|
|
3551
3886
|
context.assetConfigs[0].collateralAssets[0].oracleParams!,
|
|
3552
|
-
context.emulator.slot,
|
|
3553
3887
|
),
|
|
3554
3888
|
);
|
|
3555
3889
|
|
package/tests/staking.test.ts
CHANGED
|
@@ -67,7 +67,6 @@ test<IndigoTestContext>('Staking - Adjust Position', async ({
|
|
|
67
67
|
1_000_000n,
|
|
68
68
|
systemParams,
|
|
69
69
|
lucid,
|
|
70
|
-
emulator.slot,
|
|
71
70
|
),
|
|
72
71
|
lucid,
|
|
73
72
|
emulator,
|
|
@@ -106,12 +105,7 @@ test.todo<IndigoTestContext>(
|
|
|
106
105
|
|
|
107
106
|
await benchmarkAndAwaitTx(
|
|
108
107
|
'Staking - Close Position',
|
|
109
|
-
await closeStakingPosition(
|
|
110
|
-
myStakingPosition.utxo,
|
|
111
|
-
systemParams,
|
|
112
|
-
lucid,
|
|
113
|
-
emulator.slot,
|
|
114
|
-
),
|
|
108
|
+
await closeStakingPosition(myStakingPosition.utxo, systemParams, lucid),
|
|
115
109
|
lucid,
|
|
116
110
|
emulator,
|
|
117
111
|
);
|
|
@@ -170,12 +164,7 @@ test<IndigoTestContext>('Staking - Distribute ADA to Stakers', async ({
|
|
|
170
164
|
() =>
|
|
171
165
|
runAndAwaitTx(
|
|
172
166
|
lucid,
|
|
173
|
-
closeStakingPosition(
|
|
174
|
-
myStakingPosition.utxo,
|
|
175
|
-
systemParams,
|
|
176
|
-
lucid,
|
|
177
|
-
emulator.slot,
|
|
178
|
-
),
|
|
167
|
+
closeStakingPosition(myStakingPosition.utxo, systemParams, lucid),
|
|
179
168
|
),
|
|
180
169
|
);
|
|
181
170
|
|
|
@@ -161,11 +161,7 @@ describe('Treasury', () => {
|
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
test<MyContext>('Merge (3 lovelace UTxOs)', async (context: MyContext) => {
|
|
164
|
-
const [sysParams, __] = await init(
|
|
165
|
-
context.lucid,
|
|
166
|
-
[iusdInitialAssetCfg()],
|
|
167
|
-
context.emulator.slot,
|
|
168
|
-
);
|
|
164
|
+
const [sysParams, __] = await init(context.lucid, [iusdInitialAssetCfg()]);
|
|
169
165
|
|
|
170
166
|
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
171
167
|
|
|
@@ -182,11 +178,7 @@ describe('Treasury', () => {
|
|
|
182
178
|
});
|
|
183
179
|
|
|
184
180
|
test<MyContext>('Merge (3 INDY UTxOs)', async (context: MyContext) => {
|
|
185
|
-
const [sysParams, __] = await init(
|
|
186
|
-
context.lucid,
|
|
187
|
-
[iusdInitialAssetCfg()],
|
|
188
|
-
context.emulator.slot,
|
|
189
|
-
);
|
|
181
|
+
const [sysParams, __] = await init(context.lucid, [iusdInitialAssetCfg()]);
|
|
190
182
|
|
|
191
183
|
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
192
184
|
|
|
@@ -212,11 +204,7 @@ describe('Treasury', () => {
|
|
|
212
204
|
});
|
|
213
205
|
|
|
214
206
|
test<MyContext>('Merge (fail, 1 lovelace, 2 INDY UTxOs)', async (context: MyContext) => {
|
|
215
|
-
const [sysParams, __] = await init(
|
|
216
|
-
context.lucid,
|
|
217
|
-
[iusdInitialAssetCfg()],
|
|
218
|
-
context.emulator.slot,
|
|
219
|
-
);
|
|
207
|
+
const [sysParams, __] = await init(context.lucid, [iusdInitialAssetCfg()]);
|
|
220
208
|
|
|
221
209
|
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
222
210
|
|
|
@@ -237,11 +225,7 @@ describe('Treasury', () => {
|
|
|
237
225
|
});
|
|
238
226
|
|
|
239
227
|
test<MyContext>('Split (12 assets)', async (context: MyContext) => {
|
|
240
|
-
const [sysParams, __] = await init(
|
|
241
|
-
context.lucid,
|
|
242
|
-
[iusdInitialAssetCfg()],
|
|
243
|
-
context.emulator.slot,
|
|
244
|
-
);
|
|
228
|
+
const [sysParams, __] = await init(context.lucid, [iusdInitialAssetCfg()]);
|
|
245
229
|
|
|
246
230
|
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
247
231
|
|
|
@@ -271,11 +255,7 @@ describe('Treasury', () => {
|
|
|
271
255
|
});
|
|
272
256
|
|
|
273
257
|
test<MyContext>('Split (fail, lovelace only)', async (context: MyContext) => {
|
|
274
|
-
const [sysParams, __] = await init(
|
|
275
|
-
context.lucid,
|
|
276
|
-
[iusdInitialAssetCfg()],
|
|
277
|
-
context.emulator.slot,
|
|
278
|
-
);
|
|
258
|
+
const [sysParams, __] = await init(context.lucid, [iusdInitialAssetCfg()]);
|
|
279
259
|
|
|
280
260
|
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
281
261
|
|
|
@@ -286,11 +266,7 @@ describe('Treasury', () => {
|
|
|
286
266
|
});
|
|
287
267
|
|
|
288
268
|
test<MyContext>('Collect non-positive amount or negative extra lovelaces fails', async (context: MyContext) => {
|
|
289
|
-
const [sysParams, __] = await init(
|
|
290
|
-
context.lucid,
|
|
291
|
-
[iusdInitialAssetCfg()],
|
|
292
|
-
context.emulator.slot,
|
|
293
|
-
);
|
|
269
|
+
const [sysParams, __] = await init(context.lucid, [iusdInitialAssetCfg()]);
|
|
294
270
|
|
|
295
271
|
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
296
272
|
|