@indigo-labs/indigo-sdk 0.4.3 → 0.5.0
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/.claude/settings.local.json +7 -0
- package/dist/index.d.mts +992 -905
- package/dist/index.d.ts +992 -905
- package/dist/index.js +2346 -2155
- package/dist/index.mjs +1925 -1750
- package/package.json +13 -21
- package/scripts/bench.sh +0 -0
- package/src/contracts/cdp/helpers.ts +7 -6
- package/src/contracts/cdp/transactions.ts +8 -29
- package/src/contracts/gov/transactions.ts +15 -17
- 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/{tests/queries/stability-pool-queries.ts → src/contracts/stability-pool/queries.ts} +22 -14
- package/src/contracts/stability-pool/transactions.ts +2 -8
- package/src/contracts/stableswap/helpers.ts +369 -1
- package/src/contracts/stableswap/transactions.ts +43 -191
- package/src/contracts/staking/transactions.ts +2 -7
- package/src/index.ts +4 -3
- package/tests/cdp/actions.ts +0 -11
- package/tests/cdp/cdp-helpers.ts +2 -2
- package/tests/cdp/cdp-queries.ts +8 -5
- package/tests/cdp/cdp.test.ts +409 -620
- 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 +0 -1
- 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-feeds.test.ts +943 -0
- 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 +31 -22
- package/tests/stability-pool.test.ts +226 -319
- package/tests/stableswap/stableswap-actions.ts +0 -1
- package/tests/stableswap/stableswap.test.ts +226 -4
- package/tests/staking.test.ts +2 -13
- package/tests/treasury/treasury.test.ts +6 -30
|
@@ -12,11 +12,9 @@ import {
|
|
|
12
12
|
requestSpAccountCreation,
|
|
13
13
|
fromSystemParamsAsset,
|
|
14
14
|
MAX_E2S2S_ENTRIES_COUNT,
|
|
15
|
-
} from '../src';
|
|
16
|
-
import {
|
|
17
|
-
findStabilityPoolAccount,
|
|
18
15
|
findStabilityPool,
|
|
19
|
-
|
|
16
|
+
findStabilityPoolAccount,
|
|
17
|
+
} from '../src';
|
|
20
18
|
import {
|
|
21
19
|
readonlyArray as RA,
|
|
22
20
|
function as F,
|
|
@@ -264,11 +262,9 @@ describe('Stability pool', () => {
|
|
|
264
262
|
|
|
265
263
|
test<MyContext>('Create Account', async (context: MyContext) => {
|
|
266
264
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
267
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
context.emulator.slot,
|
|
271
|
-
);
|
|
265
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
266
|
+
iusdInitialAssetCfg(),
|
|
267
|
+
]);
|
|
272
268
|
|
|
273
269
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
274
270
|
|
|
@@ -330,11 +326,9 @@ describe('Stability pool', () => {
|
|
|
330
326
|
describe('Annul', () => {
|
|
331
327
|
test<MyContext>('Stability Pool - Create Account - Annul', async (context: MyContext) => {
|
|
332
328
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
333
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
context.emulator.slot,
|
|
337
|
-
);
|
|
329
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
330
|
+
iusdInitialAssetCfg(),
|
|
331
|
+
]);
|
|
338
332
|
|
|
339
333
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
340
334
|
const [pkh, _] = await addrDetails(context.lucid);
|
|
@@ -365,7 +359,7 @@ describe('Stability pool', () => {
|
|
|
365
359
|
context.lucid,
|
|
366
360
|
sysParams,
|
|
367
361
|
pkh.hash,
|
|
368
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
362
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
369
363
|
);
|
|
370
364
|
|
|
371
365
|
await benchmarkAndAwaitTx(
|
|
@@ -378,11 +372,9 @@ describe('Stability pool', () => {
|
|
|
378
372
|
|
|
379
373
|
test<MyContext>('Stability Pool - Adjust Account - Annul', async (context: MyContext) => {
|
|
380
374
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
381
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
context.emulator.slot,
|
|
385
|
-
);
|
|
375
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
376
|
+
iusdInitialAssetCfg(),
|
|
377
|
+
]);
|
|
386
378
|
|
|
387
379
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
388
380
|
|
|
@@ -434,7 +426,7 @@ describe('Stability pool', () => {
|
|
|
434
426
|
context.lucid,
|
|
435
427
|
sysParams,
|
|
436
428
|
pkh.hash,
|
|
437
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
429
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
438
430
|
);
|
|
439
431
|
|
|
440
432
|
await benchmarkAndAwaitTx(
|
|
@@ -447,11 +439,9 @@ describe('Stability pool', () => {
|
|
|
447
439
|
|
|
448
440
|
test<MyContext>('Stability Pool - Close Account - Annul', async (context: MyContext) => {
|
|
449
441
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
450
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
context.emulator.slot,
|
|
454
|
-
);
|
|
442
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
443
|
+
iusdInitialAssetCfg(),
|
|
444
|
+
]);
|
|
455
445
|
|
|
456
446
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
457
447
|
|
|
@@ -502,7 +492,7 @@ describe('Stability pool', () => {
|
|
|
502
492
|
context.lucid,
|
|
503
493
|
sysParams,
|
|
504
494
|
pkh.hash,
|
|
505
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
495
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
506
496
|
);
|
|
507
497
|
|
|
508
498
|
await benchmarkAndAwaitTx(
|
|
@@ -517,11 +507,9 @@ describe('Stability pool', () => {
|
|
|
517
507
|
describe('Adjust', () => {
|
|
518
508
|
test<MyContext>('Deposit Account no liquidation reward', async (context: MyContext) => {
|
|
519
509
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
520
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
context.emulator.slot,
|
|
524
|
-
);
|
|
510
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
511
|
+
iusdInitialAssetCfg(),
|
|
512
|
+
]);
|
|
525
513
|
|
|
526
514
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
527
515
|
|
|
@@ -617,11 +605,9 @@ describe('Stability pool', () => {
|
|
|
617
605
|
|
|
618
606
|
test<MyContext>('Deposit Account ADA liquidation reward', async (context: MyContext) => {
|
|
619
607
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
620
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
context.emulator.slot,
|
|
624
|
-
);
|
|
608
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
609
|
+
iusdInitialAssetCfg(),
|
|
610
|
+
]);
|
|
625
611
|
|
|
626
612
|
const ACCOUNT_DEPOSIT = 20_000_000n;
|
|
627
613
|
for (const u of [context.users.user1, context.users.user2]) {
|
|
@@ -753,16 +739,12 @@ describe('Stability pool', () => {
|
|
|
753
739
|
|
|
754
740
|
test<MyContext>('Deposit Account non ADA liquidation reward', async (context: MyContext) => {
|
|
755
741
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
756
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
},
|
|
763
|
-
],
|
|
764
|
-
context.emulator.slot,
|
|
765
|
-
);
|
|
742
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
743
|
+
{
|
|
744
|
+
...iusdInitialAssetCfg(),
|
|
745
|
+
collateralAssets: [mkBaseCollateralAsset(collateralAssetA, 0n)],
|
|
746
|
+
},
|
|
747
|
+
]);
|
|
766
748
|
|
|
767
749
|
const ACCOUNT_DEPOSIT = 20_000_000n;
|
|
768
750
|
for (const u of [context.users.user1, context.users.user2]) {
|
|
@@ -916,11 +898,9 @@ describe('Stability pool', () => {
|
|
|
916
898
|
|
|
917
899
|
test<MyContext>('Withdraw Account no liquidation reward', async (context: MyContext) => {
|
|
918
900
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
919
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
context.emulator.slot,
|
|
923
|
-
);
|
|
901
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
902
|
+
iusdInitialAssetCfg(),
|
|
903
|
+
]);
|
|
924
904
|
|
|
925
905
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
926
906
|
|
|
@@ -1040,11 +1020,9 @@ describe('Stability pool', () => {
|
|
|
1040
1020
|
|
|
1041
1021
|
test<MyContext>('Withdraw Account ADA liquidation reward', async (context: MyContext) => {
|
|
1042
1022
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1043
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
context.emulator.slot,
|
|
1047
|
-
);
|
|
1023
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1024
|
+
iusdInitialAssetCfg(),
|
|
1025
|
+
]);
|
|
1048
1026
|
|
|
1049
1027
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
1050
1028
|
|
|
@@ -1185,16 +1163,12 @@ describe('Stability pool', () => {
|
|
|
1185
1163
|
|
|
1186
1164
|
test<MyContext>('Withdraw Account non ADA liquidation reward', async (context: MyContext) => {
|
|
1187
1165
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1188
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
},
|
|
1195
|
-
],
|
|
1196
|
-
context.emulator.slot,
|
|
1197
|
-
);
|
|
1166
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1167
|
+
{
|
|
1168
|
+
...iusdInitialAssetCfg(),
|
|
1169
|
+
collateralAssets: [mkBaseCollateralAsset(collateralAssetA, 0n)],
|
|
1170
|
+
},
|
|
1171
|
+
]);
|
|
1198
1172
|
|
|
1199
1173
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
1200
1174
|
|
|
@@ -1358,11 +1332,9 @@ describe('Stability pool', () => {
|
|
|
1358
1332
|
test<MyContext>('Stability Pool - Close Account with expired oracle', async (context: MyContext) => {
|
|
1359
1333
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1360
1334
|
|
|
1361
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
context.emulator.slot,
|
|
1365
|
-
);
|
|
1335
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1336
|
+
iusdInitialAssetCfg(),
|
|
1337
|
+
]);
|
|
1366
1338
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
1367
1339
|
|
|
1368
1340
|
const [pkh, _] = await addrDetails(context.lucid);
|
|
@@ -1452,11 +1424,9 @@ describe('Stability pool', () => {
|
|
|
1452
1424
|
test<MyContext>('Stability Pool - Close Account with delisted collateral asset', async (context: MyContext) => {
|
|
1453
1425
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1454
1426
|
|
|
1455
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
context.emulator.slot,
|
|
1459
|
-
);
|
|
1427
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1428
|
+
iusdInitialAssetCfg(),
|
|
1429
|
+
]);
|
|
1460
1430
|
|
|
1461
1431
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
1462
1432
|
const [pkh, _] = await addrDetails(context.lucid);
|
|
@@ -1526,7 +1496,6 @@ describe('Stability pool', () => {
|
|
|
1526
1496
|
null,
|
|
1527
1497
|
sysParams,
|
|
1528
1498
|
context.lucid,
|
|
1529
|
-
context.emulator.slot,
|
|
1530
1499
|
(
|
|
1531
1500
|
await findGov(
|
|
1532
1501
|
context.lucid,
|
|
@@ -1585,11 +1554,9 @@ describe('Stability pool', () => {
|
|
|
1585
1554
|
|
|
1586
1555
|
test<MyContext>('Close Account no rewards (last SP account)', async (context: MyContext) => {
|
|
1587
1556
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1588
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
context.emulator.slot,
|
|
1592
|
-
);
|
|
1557
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1558
|
+
iusdInitialAssetCfg(),
|
|
1559
|
+
]);
|
|
1593
1560
|
|
|
1594
1561
|
context.lucid.selectWallet.fromSeed(context.users.user1.seedPhrase);
|
|
1595
1562
|
|
|
@@ -1640,11 +1607,9 @@ describe('Stability pool', () => {
|
|
|
1640
1607
|
|
|
1641
1608
|
test<MyContext>('Close Account no rewards (more SP accounts)', async (context: MyContext) => {
|
|
1642
1609
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1643
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
context.emulator.slot,
|
|
1647
|
-
);
|
|
1610
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1611
|
+
iusdInitialAssetCfg(),
|
|
1612
|
+
]);
|
|
1648
1613
|
|
|
1649
1614
|
for (const u of [context.users.user1, context.users.user2]) {
|
|
1650
1615
|
context.lucid.selectWallet.fromSeed(u.seedPhrase);
|
|
@@ -1715,11 +1680,9 @@ describe('Stability pool', () => {
|
|
|
1715
1680
|
|
|
1716
1681
|
test<MyContext>('Close Account with ADA liquidation rewards (more SP accounts)', async (context: MyContext) => {
|
|
1717
1682
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1718
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
context.emulator.slot,
|
|
1722
|
-
);
|
|
1683
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1684
|
+
iusdInitialAssetCfg(0n),
|
|
1685
|
+
]);
|
|
1723
1686
|
|
|
1724
1687
|
const ACCOUNT_DEPOSIT = 20_000_000n;
|
|
1725
1688
|
|
|
@@ -1778,13 +1741,13 @@ describe('Stability pool', () => {
|
|
|
1778
1741
|
context.lucid,
|
|
1779
1742
|
sysParams,
|
|
1780
1743
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
1781
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1744
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1782
1745
|
);
|
|
1783
1746
|
|
|
1784
1747
|
const stabilityPoolBefore = await findStabilityPool(
|
|
1785
1748
|
context.lucid,
|
|
1786
1749
|
sysParams,
|
|
1787
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1750
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1788
1751
|
);
|
|
1789
1752
|
|
|
1790
1753
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
@@ -1813,7 +1776,7 @@ describe('Stability pool', () => {
|
|
|
1813
1776
|
const stabilityPoolAfter = await findStabilityPool(
|
|
1814
1777
|
context.lucid,
|
|
1815
1778
|
sysParams,
|
|
1816
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1779
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1817
1780
|
);
|
|
1818
1781
|
|
|
1819
1782
|
const iasset = await findIAsset(
|
|
@@ -1896,16 +1859,12 @@ describe('Stability pool', () => {
|
|
|
1896
1859
|
test<MyContext>('Close Account with non ADA liquidation rewards (more SP accounts)', async (context: MyContext) => {
|
|
1897
1860
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
1898
1861
|
|
|
1899
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
},
|
|
1906
|
-
],
|
|
1907
|
-
context.emulator.slot,
|
|
1908
|
-
);
|
|
1862
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
1863
|
+
{
|
|
1864
|
+
...iusdInitialAssetCfg(),
|
|
1865
|
+
collateralAssets: [mkBaseCollateralAsset(collateralAssetA, 0n)],
|
|
1866
|
+
},
|
|
1867
|
+
]);
|
|
1909
1868
|
|
|
1910
1869
|
const ACCOUNT_DEPOSIT = 20_000_000n;
|
|
1911
1870
|
for (const u of [context.users.user1, context.users.user2]) {
|
|
@@ -1982,13 +1941,13 @@ describe('Stability pool', () => {
|
|
|
1982
1941
|
context.lucid,
|
|
1983
1942
|
sysParams,
|
|
1984
1943
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
1985
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1944
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1986
1945
|
);
|
|
1987
1946
|
|
|
1988
1947
|
const stabilityPoolBefore = await findStabilityPool(
|
|
1989
1948
|
context.lucid,
|
|
1990
1949
|
sysParams,
|
|
1991
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1950
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1992
1951
|
);
|
|
1993
1952
|
|
|
1994
1953
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
@@ -2017,7 +1976,7 @@ describe('Stability pool', () => {
|
|
|
2017
1976
|
const stabilityPoolAfter = await findStabilityPool(
|
|
2018
1977
|
context.lucid,
|
|
2019
1978
|
sysParams,
|
|
2020
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1979
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2021
1980
|
);
|
|
2022
1981
|
|
|
2023
1982
|
const iasset = await findIAsset(
|
|
@@ -2120,18 +2079,14 @@ describe('Stability pool', () => {
|
|
|
2120
2079
|
10,
|
|
2121
2080
|
);
|
|
2122
2081
|
|
|
2123
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
},
|
|
2132
|
-
],
|
|
2133
|
-
context.emulator.slot,
|
|
2134
|
-
);
|
|
2082
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
2083
|
+
{
|
|
2084
|
+
...iusdInitialAssetCfg(),
|
|
2085
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
2086
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
2087
|
+
),
|
|
2088
|
+
},
|
|
2089
|
+
]);
|
|
2135
2090
|
|
|
2136
2091
|
await createMultipleUtxosAtTreasury(
|
|
2137
2092
|
mkLovelacesOf(2n),
|
|
@@ -2233,7 +2188,7 @@ describe('Stability pool', () => {
|
|
|
2233
2188
|
const sp = await findStabilityPool(
|
|
2234
2189
|
context.lucid,
|
|
2235
2190
|
sysParams,
|
|
2236
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2191
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2237
2192
|
);
|
|
2238
2193
|
|
|
2239
2194
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -2286,7 +2241,7 @@ describe('Stability pool', () => {
|
|
|
2286
2241
|
const sp = await findStabilityPool(
|
|
2287
2242
|
context.lucid,
|
|
2288
2243
|
sysParams,
|
|
2289
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2244
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2290
2245
|
);
|
|
2291
2246
|
|
|
2292
2247
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -2317,18 +2272,14 @@ describe('Stability pool', () => {
|
|
|
2317
2272
|
10,
|
|
2318
2273
|
);
|
|
2319
2274
|
|
|
2320
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
},
|
|
2329
|
-
],
|
|
2330
|
-
context.emulator.slot,
|
|
2331
|
-
);
|
|
2275
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
2276
|
+
{
|
|
2277
|
+
...iusdInitialAssetCfg(),
|
|
2278
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
2279
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
2280
|
+
),
|
|
2281
|
+
},
|
|
2282
|
+
]);
|
|
2332
2283
|
|
|
2333
2284
|
await createMultipleUtxosAtTreasury(
|
|
2334
2285
|
mkLovelacesOf(2n),
|
|
@@ -2431,7 +2382,7 @@ describe('Stability pool', () => {
|
|
|
2431
2382
|
const sp = await findStabilityPool(
|
|
2432
2383
|
context.lucid,
|
|
2433
2384
|
sysParams,
|
|
2434
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2385
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2435
2386
|
);
|
|
2436
2387
|
|
|
2437
2388
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -2481,7 +2432,7 @@ describe('Stability pool', () => {
|
|
|
2481
2432
|
const sp = await findStabilityPool(
|
|
2482
2433
|
context.lucid,
|
|
2483
2434
|
sysParams,
|
|
2484
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2435
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2485
2436
|
);
|
|
2486
2437
|
|
|
2487
2438
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -2512,18 +2463,14 @@ describe('Stability pool', () => {
|
|
|
2512
2463
|
10,
|
|
2513
2464
|
);
|
|
2514
2465
|
|
|
2515
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
},
|
|
2524
|
-
],
|
|
2525
|
-
context.emulator.slot,
|
|
2526
|
-
);
|
|
2466
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
2467
|
+
{
|
|
2468
|
+
...iusdInitialAssetCfg(),
|
|
2469
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
2470
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
2471
|
+
),
|
|
2472
|
+
},
|
|
2473
|
+
]);
|
|
2527
2474
|
|
|
2528
2475
|
await createMultipleUtxosAtTreasury(
|
|
2529
2476
|
mkLovelacesOf(2n),
|
|
@@ -2623,7 +2570,7 @@ describe('Stability pool', () => {
|
|
|
2623
2570
|
const sp = await findStabilityPool(
|
|
2624
2571
|
context.lucid,
|
|
2625
2572
|
sysParams,
|
|
2626
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2573
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2627
2574
|
);
|
|
2628
2575
|
|
|
2629
2576
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -2674,7 +2621,7 @@ describe('Stability pool', () => {
|
|
|
2674
2621
|
const sp = await findStabilityPool(
|
|
2675
2622
|
context.lucid,
|
|
2676
2623
|
sysParams,
|
|
2677
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2624
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2678
2625
|
);
|
|
2679
2626
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(1n);
|
|
2680
2627
|
expect(sp.datum.state.scale, 'Unexpected scale').toEqual(0n);
|
|
@@ -2708,18 +2655,14 @@ describe('Stability pool', () => {
|
|
|
2708
2655
|
10,
|
|
2709
2656
|
);
|
|
2710
2657
|
|
|
2711
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
},
|
|
2720
|
-
],
|
|
2721
|
-
context.emulator.slot,
|
|
2722
|
-
);
|
|
2658
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
2659
|
+
{
|
|
2660
|
+
...iusdInitialAssetCfg(),
|
|
2661
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
2662
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
2663
|
+
),
|
|
2664
|
+
},
|
|
2665
|
+
]);
|
|
2723
2666
|
|
|
2724
2667
|
await createMultipleUtxosAtTreasury(
|
|
2725
2668
|
mkLovelacesOf(2n),
|
|
@@ -2874,7 +2817,7 @@ describe('Stability pool', () => {
|
|
|
2874
2817
|
const sp = await findStabilityPool(
|
|
2875
2818
|
context.lucid,
|
|
2876
2819
|
sysParams,
|
|
2877
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2820
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2878
2821
|
);
|
|
2879
2822
|
|
|
2880
2823
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -2927,7 +2870,7 @@ describe('Stability pool', () => {
|
|
|
2927
2870
|
const sp = await findStabilityPool(
|
|
2928
2871
|
context.lucid,
|
|
2929
2872
|
sysParams,
|
|
2930
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2873
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2931
2874
|
);
|
|
2932
2875
|
|
|
2933
2876
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -2967,18 +2910,14 @@ describe('Stability pool', () => {
|
|
|
2967
2910
|
14,
|
|
2968
2911
|
);
|
|
2969
2912
|
|
|
2970
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
},
|
|
2979
|
-
],
|
|
2980
|
-
context.emulator.slot,
|
|
2981
|
-
);
|
|
2913
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
2914
|
+
{
|
|
2915
|
+
...iusdInitialAssetCfg(),
|
|
2916
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
2917
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
2918
|
+
),
|
|
2919
|
+
},
|
|
2920
|
+
]);
|
|
2982
2921
|
|
|
2983
2922
|
await createMultipleUtxosAtTreasury(
|
|
2984
2923
|
mkLovelacesOf(2n),
|
|
@@ -3110,7 +3049,7 @@ describe('Stability pool', () => {
|
|
|
3110
3049
|
const sp = await findStabilityPool(
|
|
3111
3050
|
context.lucid,
|
|
3112
3051
|
sysParams,
|
|
3113
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3052
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3114
3053
|
);
|
|
3115
3054
|
|
|
3116
3055
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(4n);
|
|
@@ -3143,7 +3082,7 @@ describe('Stability pool', () => {
|
|
|
3143
3082
|
const sp = await findStabilityPool(
|
|
3144
3083
|
context.lucid,
|
|
3145
3084
|
sysParams,
|
|
3146
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3085
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3147
3086
|
);
|
|
3148
3087
|
|
|
3149
3088
|
expect(
|
|
@@ -3176,18 +3115,14 @@ describe('Stability pool', () => {
|
|
|
3176
3115
|
|
|
3177
3116
|
expect(initialAssets.length, 'Unexpected reward assets count').toEqual(9);
|
|
3178
3117
|
|
|
3179
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
},
|
|
3188
|
-
],
|
|
3189
|
-
context.emulator.slot,
|
|
3190
|
-
);
|
|
3118
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
3119
|
+
{
|
|
3120
|
+
...iusdInitialAssetCfg(),
|
|
3121
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
3122
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
3123
|
+
),
|
|
3124
|
+
},
|
|
3125
|
+
]);
|
|
3191
3126
|
|
|
3192
3127
|
await createMultipleUtxosAtTreasury(
|
|
3193
3128
|
mkLovelacesOf(2n),
|
|
@@ -3341,21 +3276,17 @@ describe('Stability pool', () => {
|
|
|
3341
3276
|
// TODO: also test when multiple epochs
|
|
3342
3277
|
test<MyContext>('Deposit Account from scale 0, when now theres scale 4; collecting rewards only from scale 0 and 1', async (context: MyContext) => {
|
|
3343
3278
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
3344
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
},
|
|
3356
|
-
],
|
|
3357
|
-
context.emulator.slot,
|
|
3358
|
-
);
|
|
3279
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
3280
|
+
{
|
|
3281
|
+
...iusdInitialAssetCfg(),
|
|
3282
|
+
collateralAssets: mkCollateralAssetsChain([
|
|
3283
|
+
mkBaseCollateralAsset(collateralAssetA, 0n),
|
|
3284
|
+
mkBaseCollateralAsset(collateralAssetB, 0n),
|
|
3285
|
+
mkBaseCollateralAsset(collateralAssetC, 0n),
|
|
3286
|
+
mkBaseCollateralAsset(adaAssetClass, 0n),
|
|
3287
|
+
]),
|
|
3288
|
+
},
|
|
3289
|
+
]);
|
|
3359
3290
|
|
|
3360
3291
|
await createMultipleUtxosAtTreasury(
|
|
3361
3292
|
mkLovelacesOf(2n),
|
|
@@ -3502,7 +3433,7 @@ describe('Stability pool', () => {
|
|
|
3502
3433
|
await findStabilityPool(
|
|
3503
3434
|
context.lucid,
|
|
3504
3435
|
sysParams,
|
|
3505
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3436
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3506
3437
|
)
|
|
3507
3438
|
).datum.state.scale,
|
|
3508
3439
|
'Unexpected scale',
|
|
@@ -3573,18 +3504,14 @@ describe('Stability pool', () => {
|
|
|
3573
3504
|
|
|
3574
3505
|
test<MyContext>('Cross snapshot deposit referencing 1 e2s2s snapshots; deposit account from scale 3 (4th entry), where the pools scale is 8, i.e. 0-3 scale are in a snapshot, 4-8 scale are in the pool datum', async (context: MyContext) => {
|
|
3575
3506
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
3576
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
},
|
|
3585
|
-
],
|
|
3586
|
-
context.emulator.slot,
|
|
3587
|
-
);
|
|
3507
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
3508
|
+
{
|
|
3509
|
+
...iusdInitialAssetCfg(),
|
|
3510
|
+
collateralAssets: mkCollateralAssetsChain([
|
|
3511
|
+
mkBaseCollateralAsset(collateralAssetA, 0n),
|
|
3512
|
+
]),
|
|
3513
|
+
},
|
|
3514
|
+
]);
|
|
3588
3515
|
|
|
3589
3516
|
await createMultipleUtxosAtTreasury(
|
|
3590
3517
|
mkLovelacesOf(2n),
|
|
@@ -3723,7 +3650,7 @@ describe('Stability pool', () => {
|
|
|
3723
3650
|
await findStabilityPool(
|
|
3724
3651
|
context.lucid,
|
|
3725
3652
|
sysParams,
|
|
3726
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3653
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3727
3654
|
)
|
|
3728
3655
|
).datum.state.scale,
|
|
3729
3656
|
'Unexpected scale',
|
|
@@ -3903,7 +3830,7 @@ describe('Stability pool', () => {
|
|
|
3903
3830
|
await findStabilityPool(
|
|
3904
3831
|
context.lucid,
|
|
3905
3832
|
sysParams,
|
|
3906
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3833
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3907
3834
|
)
|
|
3908
3835
|
).datum.assetStates.every(
|
|
3909
3836
|
([_, assetState]) =>
|
|
@@ -3926,7 +3853,7 @@ describe('Stability pool', () => {
|
|
|
3926
3853
|
await findStabilityPool(
|
|
3927
3854
|
context.lucid,
|
|
3928
3855
|
sysParams,
|
|
3929
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3856
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3930
3857
|
)
|
|
3931
3858
|
).datum.assetStates.every(
|
|
3932
3859
|
([_, assetState]) => assetState.epoch2scale2sum.length === 1,
|
|
@@ -4012,7 +3939,7 @@ describe('Stability pool', () => {
|
|
|
4012
3939
|
const sp = await findStabilityPool(
|
|
4013
3940
|
context.lucid,
|
|
4014
3941
|
sysParams,
|
|
4015
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3942
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4016
3943
|
);
|
|
4017
3944
|
|
|
4018
3945
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -4036,7 +3963,7 @@ describe('Stability pool', () => {
|
|
|
4036
3963
|
context.lucid,
|
|
4037
3964
|
sysParams,
|
|
4038
3965
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
4039
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3966
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4040
3967
|
);
|
|
4041
3968
|
|
|
4042
3969
|
expect(
|
|
@@ -4084,7 +4011,7 @@ describe('Stability pool', () => {
|
|
|
4084
4011
|
const sp = await findStabilityPool(
|
|
4085
4012
|
context.lucid,
|
|
4086
4013
|
sysParams,
|
|
4087
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4014
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4088
4015
|
);
|
|
4089
4016
|
|
|
4090
4017
|
const spCollateralAssets = sp.datum.assetStates.map(([key, _]) => key);
|
|
@@ -4107,18 +4034,14 @@ describe('Stability pool', () => {
|
|
|
4107
4034
|
|
|
4108
4035
|
test<MyContext>('Worst case cross snapshot account deposit referencing 2 e2s2s snapshots; 1 reward asset; deposit account from scale 3 (4th entry), where the pools scale is 12, i.e. 0-3 scale are in a 1st snapshot, 4-7 in 2nd snapshot, 8-12 scale are in the pool datum', async (context: MyContext) => {
|
|
4109
4036
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
4110
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
},
|
|
4119
|
-
],
|
|
4120
|
-
context.emulator.slot,
|
|
4121
|
-
);
|
|
4037
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
4038
|
+
{
|
|
4039
|
+
...iusdInitialAssetCfg(),
|
|
4040
|
+
collateralAssets: mkCollateralAssetsChain([
|
|
4041
|
+
mkBaseCollateralAsset(collateralAssetA, 0n),
|
|
4042
|
+
]),
|
|
4043
|
+
},
|
|
4044
|
+
]);
|
|
4122
4045
|
|
|
4123
4046
|
await createMultipleUtxosAtTreasury(
|
|
4124
4047
|
mkLovelacesOf(2n),
|
|
@@ -4257,7 +4180,7 @@ describe('Stability pool', () => {
|
|
|
4257
4180
|
await findStabilityPool(
|
|
4258
4181
|
context.lucid,
|
|
4259
4182
|
sysParams,
|
|
4260
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4183
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4261
4184
|
)
|
|
4262
4185
|
).datum.state.scale,
|
|
4263
4186
|
'Unexpected scale',
|
|
@@ -4365,7 +4288,7 @@ describe('Stability pool', () => {
|
|
|
4365
4288
|
await findStabilityPool(
|
|
4366
4289
|
context.lucid,
|
|
4367
4290
|
sysParams,
|
|
4368
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4291
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4369
4292
|
)
|
|
4370
4293
|
).datum.assetStates.every(
|
|
4371
4294
|
([_, assetState]) =>
|
|
@@ -4388,7 +4311,7 @@ describe('Stability pool', () => {
|
|
|
4388
4311
|
await findStabilityPool(
|
|
4389
4312
|
context.lucid,
|
|
4390
4313
|
sysParams,
|
|
4391
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4314
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4392
4315
|
)
|
|
4393
4316
|
).datum.assetStates.every(
|
|
4394
4317
|
([_, assetState]) => assetState.epoch2scale2sum.length === 1,
|
|
@@ -4460,7 +4383,7 @@ describe('Stability pool', () => {
|
|
|
4460
4383
|
const sp = await findStabilityPool(
|
|
4461
4384
|
context.lucid,
|
|
4462
4385
|
sysParams,
|
|
4463
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4386
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4464
4387
|
);
|
|
4465
4388
|
|
|
4466
4389
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -4479,7 +4402,7 @@ describe('Stability pool', () => {
|
|
|
4479
4402
|
await findStabilityPool(
|
|
4480
4403
|
context.lucid,
|
|
4481
4404
|
sysParams,
|
|
4482
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4405
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4483
4406
|
)
|
|
4484
4407
|
).datum.assetStates.every(
|
|
4485
4408
|
([_, assetState]) =>
|
|
@@ -4502,7 +4425,7 @@ describe('Stability pool', () => {
|
|
|
4502
4425
|
await findStabilityPool(
|
|
4503
4426
|
context.lucid,
|
|
4504
4427
|
sysParams,
|
|
4505
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4428
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4506
4429
|
)
|
|
4507
4430
|
).datum.assetStates.every(
|
|
4508
4431
|
([_, assetState]) => assetState.epoch2scale2sum.length === 1,
|
|
@@ -4574,7 +4497,7 @@ describe('Stability pool', () => {
|
|
|
4574
4497
|
const sp = await findStabilityPool(
|
|
4575
4498
|
context.lucid,
|
|
4576
4499
|
sysParams,
|
|
4577
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4500
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4578
4501
|
);
|
|
4579
4502
|
|
|
4580
4503
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -4601,7 +4524,7 @@ describe('Stability pool', () => {
|
|
|
4601
4524
|
context.lucid,
|
|
4602
4525
|
sysParams,
|
|
4603
4526
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
4604
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4527
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4605
4528
|
);
|
|
4606
4529
|
|
|
4607
4530
|
expect(
|
|
@@ -4648,7 +4571,7 @@ describe('Stability pool', () => {
|
|
|
4648
4571
|
const sp = await findStabilityPool(
|
|
4649
4572
|
context.lucid,
|
|
4650
4573
|
sysParams,
|
|
4651
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4574
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4652
4575
|
);
|
|
4653
4576
|
|
|
4654
4577
|
const spCollateralAssets = sp.datum.assetStates.map(([key, _]) => key);
|
|
@@ -4686,18 +4609,14 @@ describe('Stability pool', () => {
|
|
|
4686
4609
|
|
|
4687
4610
|
expect(initialAssets.length, 'Unexpected reward assets count').toEqual(9);
|
|
4688
4611
|
|
|
4689
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
},
|
|
4698
|
-
],
|
|
4699
|
-
context.emulator.slot,
|
|
4700
|
-
);
|
|
4612
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
4613
|
+
{
|
|
4614
|
+
...iusdInitialAssetCfg(),
|
|
4615
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
4616
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
4617
|
+
),
|
|
4618
|
+
},
|
|
4619
|
+
]);
|
|
4701
4620
|
|
|
4702
4621
|
await createMultipleUtxosAtTreasury(
|
|
4703
4622
|
mkLovelacesOf(2n),
|
|
@@ -4867,7 +4786,7 @@ describe('Stability pool', () => {
|
|
|
4867
4786
|
await findStabilityPool(
|
|
4868
4787
|
context.lucid,
|
|
4869
4788
|
sysParams,
|
|
4870
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4789
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4871
4790
|
)
|
|
4872
4791
|
).datum.state.scale,
|
|
4873
4792
|
'Unexpected scale',
|
|
@@ -4974,7 +4893,7 @@ describe('Stability pool', () => {
|
|
|
4974
4893
|
const sp = await findStabilityPool(
|
|
4975
4894
|
context.lucid,
|
|
4976
4895
|
sysParams,
|
|
4977
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4896
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
4978
4897
|
);
|
|
4979
4898
|
|
|
4980
4899
|
expect(
|
|
@@ -5005,7 +4924,7 @@ describe('Stability pool', () => {
|
|
|
5005
4924
|
await findStabilityPool(
|
|
5006
4925
|
context.lucid,
|
|
5007
4926
|
sysParams,
|
|
5008
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4927
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5009
4928
|
)
|
|
5010
4929
|
).datum.assetStates.every(
|
|
5011
4930
|
([_, assetState]) => assetState.epoch2scale2sum.length === 1,
|
|
@@ -5077,7 +4996,7 @@ describe('Stability pool', () => {
|
|
|
5077
4996
|
const sp = await findStabilityPool(
|
|
5078
4997
|
context.lucid,
|
|
5079
4998
|
sysParams,
|
|
5080
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
4999
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5081
5000
|
);
|
|
5082
5001
|
|
|
5083
5002
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -5096,7 +5015,7 @@ describe('Stability pool', () => {
|
|
|
5096
5015
|
await findStabilityPool(
|
|
5097
5016
|
context.lucid,
|
|
5098
5017
|
sysParams,
|
|
5099
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5018
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5100
5019
|
)
|
|
5101
5020
|
).datum.assetStates.every(
|
|
5102
5021
|
([_, assetState]) =>
|
|
@@ -5119,7 +5038,7 @@ describe('Stability pool', () => {
|
|
|
5119
5038
|
await findStabilityPool(
|
|
5120
5039
|
context.lucid,
|
|
5121
5040
|
sysParams,
|
|
5122
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5041
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5123
5042
|
)
|
|
5124
5043
|
).datum.assetStates.every(
|
|
5125
5044
|
([_, assetState]) => assetState.epoch2scale2sum.length === 1,
|
|
@@ -5191,7 +5110,7 @@ describe('Stability pool', () => {
|
|
|
5191
5110
|
const sp = await findStabilityPool(
|
|
5192
5111
|
context.lucid,
|
|
5193
5112
|
sysParams,
|
|
5194
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5113
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5195
5114
|
);
|
|
5196
5115
|
|
|
5197
5116
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -5218,7 +5137,7 @@ describe('Stability pool', () => {
|
|
|
5218
5137
|
context.lucid,
|
|
5219
5138
|
sysParams,
|
|
5220
5139
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
5221
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5140
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5222
5141
|
);
|
|
5223
5142
|
|
|
5224
5143
|
expect(
|
|
@@ -5270,7 +5189,7 @@ describe('Stability pool', () => {
|
|
|
5270
5189
|
const sp = await findStabilityPool(
|
|
5271
5190
|
context.lucid,
|
|
5272
5191
|
sysParams,
|
|
5273
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5192
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5274
5193
|
);
|
|
5275
5194
|
|
|
5276
5195
|
const spCollateralAssets = sp.datum.assetStates.map(([key, _]) => key);
|
|
@@ -5304,18 +5223,14 @@ describe('Stability pool', () => {
|
|
|
5304
5223
|
|
|
5305
5224
|
expect(initialAssets.length, 'Unexpected reward assets count').toEqual(9);
|
|
5306
5225
|
|
|
5307
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
},
|
|
5316
|
-
],
|
|
5317
|
-
context.emulator.slot,
|
|
5318
|
-
);
|
|
5226
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
5227
|
+
{
|
|
5228
|
+
...iusdInitialAssetCfg(),
|
|
5229
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
5230
|
+
initialAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
5231
|
+
),
|
|
5232
|
+
},
|
|
5233
|
+
]);
|
|
5319
5234
|
|
|
5320
5235
|
await createMultipleUtxosAtTreasury(
|
|
5321
5236
|
mkLovelacesOf(2n),
|
|
@@ -5461,7 +5376,7 @@ describe('Stability pool', () => {
|
|
|
5461
5376
|
await findStabilityPool(
|
|
5462
5377
|
context.lucid,
|
|
5463
5378
|
sysParams,
|
|
5464
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5379
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5465
5380
|
)
|
|
5466
5381
|
).datum.state.scale,
|
|
5467
5382
|
'Unexpected scale',
|
|
@@ -5623,7 +5538,7 @@ describe('Stability pool', () => {
|
|
|
5623
5538
|
await findStabilityPool(
|
|
5624
5539
|
context.lucid,
|
|
5625
5540
|
sysParams,
|
|
5626
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5541
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5627
5542
|
)
|
|
5628
5543
|
).datum.state.scale,
|
|
5629
5544
|
'Unexpected scale',
|
|
@@ -5640,7 +5555,7 @@ describe('Stability pool', () => {
|
|
|
5640
5555
|
const sp = await findStabilityPool(
|
|
5641
5556
|
context.lucid,
|
|
5642
5557
|
sysParams,
|
|
5643
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5558
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5644
5559
|
);
|
|
5645
5560
|
|
|
5646
5561
|
expect(
|
|
@@ -5670,7 +5585,7 @@ describe('Stability pool', () => {
|
|
|
5670
5585
|
await findStabilityPool(
|
|
5671
5586
|
context.lucid,
|
|
5672
5587
|
sysParams,
|
|
5673
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5588
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5674
5589
|
)
|
|
5675
5590
|
).datum.assetStates.some(
|
|
5676
5591
|
([_, assetState]) =>
|
|
@@ -5745,7 +5660,7 @@ describe('Stability pool', () => {
|
|
|
5745
5660
|
const sp = await findStabilityPool(
|
|
5746
5661
|
context.lucid,
|
|
5747
5662
|
sysParams,
|
|
5748
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5663
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5749
5664
|
);
|
|
5750
5665
|
|
|
5751
5666
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -5780,7 +5695,7 @@ describe('Stability pool', () => {
|
|
|
5780
5695
|
await findStabilityPool(
|
|
5781
5696
|
context.lucid,
|
|
5782
5697
|
sysParams,
|
|
5783
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5698
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5784
5699
|
)
|
|
5785
5700
|
).datum.assetStates.some(
|
|
5786
5701
|
([_, assetState]) =>
|
|
@@ -5855,7 +5770,7 @@ describe('Stability pool', () => {
|
|
|
5855
5770
|
const sp = await findStabilityPool(
|
|
5856
5771
|
context.lucid,
|
|
5857
5772
|
sysParams,
|
|
5858
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5773
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5859
5774
|
);
|
|
5860
5775
|
|
|
5861
5776
|
expect(sp.datum.state.epoch, 'Unexpected epoch').toEqual(0n);
|
|
@@ -5882,7 +5797,7 @@ describe('Stability pool', () => {
|
|
|
5882
5797
|
context.lucid,
|
|
5883
5798
|
sysParams,
|
|
5884
5799
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
5885
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5800
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5886
5801
|
);
|
|
5887
5802
|
|
|
5888
5803
|
expect(
|
|
@@ -5934,7 +5849,7 @@ describe('Stability pool', () => {
|
|
|
5934
5849
|
const sp = await findStabilityPool(
|
|
5935
5850
|
context.lucid,
|
|
5936
5851
|
sysParams,
|
|
5937
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
5852
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
5938
5853
|
);
|
|
5939
5854
|
|
|
5940
5855
|
const spCollateralAssets = sp.datum.assetStates.map(([key, _]) => key);
|
|
@@ -5960,18 +5875,14 @@ describe('Stability pool', () => {
|
|
|
5960
5875
|
collateralAssetB,
|
|
5961
5876
|
];
|
|
5962
5877
|
|
|
5963
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
},
|
|
5972
|
-
],
|
|
5973
|
-
context.emulator.slot,
|
|
5974
|
-
);
|
|
5878
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
5879
|
+
{
|
|
5880
|
+
...iusdInitialAssetCfg(),
|
|
5881
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
5882
|
+
initialCollateralAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
5883
|
+
),
|
|
5884
|
+
},
|
|
5885
|
+
]);
|
|
5975
5886
|
|
|
5976
5887
|
await createMultipleUtxosAtTreasury(
|
|
5977
5888
|
mkLovelacesOf(2n),
|
|
@@ -6239,7 +6150,7 @@ describe('Stability pool', () => {
|
|
|
6239
6150
|
const sp = await findStabilityPool(
|
|
6240
6151
|
context.lucid,
|
|
6241
6152
|
sysParams,
|
|
6242
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
6153
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
6243
6154
|
);
|
|
6244
6155
|
|
|
6245
6156
|
const spCollateralAssets = sp.datum.assetStates.map(([key, _]) => key);
|
|
@@ -6266,7 +6177,7 @@ describe('Stability pool', () => {
|
|
|
6266
6177
|
context.lucid,
|
|
6267
6178
|
sysParams,
|
|
6268
6179
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
6269
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
6180
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
6270
6181
|
);
|
|
6271
6182
|
|
|
6272
6183
|
expect(
|
|
@@ -6287,18 +6198,14 @@ describe('Stability pool', () => {
|
|
|
6287
6198
|
collateralAssetB,
|
|
6288
6199
|
];
|
|
6289
6200
|
|
|
6290
|
-
const [sysParams, [iusdAssetInfo]] = await init(
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
},
|
|
6299
|
-
],
|
|
6300
|
-
context.emulator.slot,
|
|
6301
|
-
);
|
|
6201
|
+
const [sysParams, [iusdAssetInfo]] = await init(context.lucid, [
|
|
6202
|
+
{
|
|
6203
|
+
...iusdInitialAssetCfg(),
|
|
6204
|
+
collateralAssets: mkCollateralAssetsChain(
|
|
6205
|
+
initialCollateralAssets.map((a) => mkBaseCollateralAsset(a, 0n)),
|
|
6206
|
+
),
|
|
6207
|
+
},
|
|
6208
|
+
]);
|
|
6302
6209
|
|
|
6303
6210
|
await createMultipleUtxosAtTreasury(
|
|
6304
6211
|
mkLovelacesOf(2n),
|
|
@@ -6421,7 +6328,7 @@ describe('Stability pool', () => {
|
|
|
6421
6328
|
const sp = await findStabilityPool(
|
|
6422
6329
|
context.lucid,
|
|
6423
6330
|
sysParams,
|
|
6424
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
6331
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
6425
6332
|
);
|
|
6426
6333
|
|
|
6427
6334
|
expect(sp.datum.state.epoch, 'Unexpected sp epoch').toEqual(0n);
|
|
@@ -6489,7 +6396,7 @@ describe('Stability pool', () => {
|
|
|
6489
6396
|
const sp = await findStabilityPool(
|
|
6490
6397
|
context.lucid,
|
|
6491
6398
|
sysParams,
|
|
6492
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
6399
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
6493
6400
|
);
|
|
6494
6401
|
|
|
6495
6402
|
expect(sp.datum.state.epoch, 'Unexpected sp epoch').toEqual(0n);
|
|
@@ -6505,7 +6412,7 @@ describe('Stability pool', () => {
|
|
|
6505
6412
|
context.lucid,
|
|
6506
6413
|
sysParams,
|
|
6507
6414
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
6508
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
6415
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
6509
6416
|
);
|
|
6510
6417
|
|
|
6511
6418
|
expect(account.datum.state.epoch, 'Expected account epoch').toEqual(0n);
|
|
@@ -6543,7 +6450,7 @@ describe('Stability pool', () => {
|
|
|
6543
6450
|
const sp = await findStabilityPool(
|
|
6544
6451
|
context.lucid,
|
|
6545
6452
|
sysParams,
|
|
6546
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
6453
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
6547
6454
|
);
|
|
6548
6455
|
|
|
6549
6456
|
const spCollateralAssets = sp.datum.assetStates.map(([key, _]) => key);
|
|
@@ -6566,7 +6473,7 @@ describe('Stability pool', () => {
|
|
|
6566
6473
|
context.lucid,
|
|
6567
6474
|
sysParams,
|
|
6568
6475
|
paymentCredentialOf(context.users.user1.address).hash,
|
|
6569
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
6476
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
6570
6477
|
);
|
|
6571
6478
|
|
|
6572
6479
|
expect(account.datum.state.epoch, 'Expected account epoch').toEqual(0n);
|