@indigo-labs/indigo-sdk 0.4.0 → 0.4.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/.claude/settings.local.json +7 -0
- package/.github/workflows/ci.yml +0 -1
- package/README.md +16 -0
- package/dist/index.d.mts +33 -3
- package/dist/index.d.ts +33 -3
- package/dist/index.js +587 -355
- package/dist/index.mjs +422 -187
- package/package.json +12 -20
- package/scripts/bench.sh +0 -0
- package/src/contracts/cdp-creator/queries.ts +30 -0
- package/src/contracts/iasset/queries.ts +102 -0
- package/src/contracts/initialize/actions.ts +12 -5
- package/{tests/interest-collection/interest-collector-queries.ts → src/contracts/interest-collection/queries.ts} +28 -12
- package/src/contracts/pyth-feed/helpers.ts +24 -0
- package/{tests/treasury/treasury-queries.ts → src/contracts/treasury/queries.ts} +15 -24
- package/src/index.ts +6 -1
- package/tests/cdp/actions.ts +1 -1
- package/tests/cdp/cdp-queries.ts +3 -23
- package/tests/cdp/transactions-mutated.ts +3 -4
- package/tests/gov/gov.test.ts +18 -18
- package/tests/interest-collection/interest-collection.test.ts +17 -62
- package/tests/queries/iasset-queries.ts +1 -84
- package/tests/rob/rob.test.ts +52 -52
- package/tests/stableswap/stableswap.test.ts +1 -1
- package/tests/treasury/actions.ts +1 -1
- package/tests/treasury/treasury.test.ts +1 -1
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
findAdminInterestCollectors,
|
|
13
13
|
findAllInterestCollectors,
|
|
14
14
|
findRandomNonAdminInterestCollector,
|
|
15
|
-
} from '
|
|
15
|
+
} from '../../src/contracts/interest-collection/queries';
|
|
16
16
|
import { benchmarkAndAwaitTx } from '../utils/benchmark-utils';
|
|
17
17
|
import {
|
|
18
18
|
batchCollectInterest,
|
|
@@ -60,10 +60,7 @@ describe('Interest Collection', () => {
|
|
|
60
60
|
test<IndigoTestContext>('Collect Interest - Cannot collect without interacting with a CDP', async (context: IndigoTestContext) => {
|
|
61
61
|
const interestCollectionUtxo = await findRandomNonAdminInterestCollector(
|
|
62
62
|
context.lucid,
|
|
63
|
-
context.systemParams
|
|
64
|
-
fromSystemParamsAsset(
|
|
65
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
66
|
-
),
|
|
63
|
+
context.systemParams,
|
|
67
64
|
);
|
|
68
65
|
|
|
69
66
|
await expectScriptFailure(
|
|
@@ -82,10 +79,7 @@ describe('Interest Collection', () => {
|
|
|
82
79
|
test<IndigoTestContext>('Collect Interest - Cannot collect from interest admin', async (context: IndigoTestContext) => {
|
|
83
80
|
const adminInterestCollectorUtxo = await findAdminInterestCollectors(
|
|
84
81
|
context.lucid,
|
|
85
|
-
context.systemParams
|
|
86
|
-
fromSystemParamsAsset(
|
|
87
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
88
|
-
),
|
|
82
|
+
context.systemParams,
|
|
89
83
|
);
|
|
90
84
|
|
|
91
85
|
const [iAssetConfig] = context.assetConfigs;
|
|
@@ -160,7 +154,7 @@ describe('Interest Collection', () => {
|
|
|
160
154
|
|
|
161
155
|
const interestCollectors = await findAllInterestCollectors(
|
|
162
156
|
context.lucid,
|
|
163
|
-
context.systemParams
|
|
157
|
+
context.systemParams,
|
|
164
158
|
);
|
|
165
159
|
|
|
166
160
|
const interestCollectorsUtxos = interestCollectors.filter(
|
|
@@ -225,10 +219,7 @@ describe('Interest Collection', () => {
|
|
|
225
219
|
|
|
226
220
|
const interestCollectionUtxo = await findRandomNonAdminInterestCollector(
|
|
227
221
|
context.lucid,
|
|
228
|
-
context.systemParams
|
|
229
|
-
fromSystemParamsAsset(
|
|
230
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
231
|
-
),
|
|
222
|
+
context.systemParams,
|
|
232
223
|
);
|
|
233
224
|
|
|
234
225
|
context.lucid.selectWallet.fromSeed(context.users.user.seedPhrase);
|
|
@@ -447,20 +438,14 @@ describe('Interest Collection', () => {
|
|
|
447
438
|
|
|
448
439
|
const interestDistributeUtxo = matchSingle(
|
|
449
440
|
(
|
|
450
|
-
await findAllInterestCollectors(
|
|
451
|
-
context.lucid,
|
|
452
|
-
context.systemParams.validatorHashes.interestCollectionHash,
|
|
453
|
-
)
|
|
441
|
+
await findAllInterestCollectors(context.lucid, context.systemParams)
|
|
454
442
|
).filter((utxo) => assetClassValueOf(utxo.assets, EXAMPLE_TOKEN_1)),
|
|
455
443
|
(_) => new Error('Expected a single interest distribute UTXO'),
|
|
456
444
|
);
|
|
457
445
|
|
|
458
446
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
459
447
|
context.lucid,
|
|
460
|
-
context.systemParams
|
|
461
|
-
fromSystemParamsAsset(
|
|
462
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
463
|
-
),
|
|
448
|
+
context.systemParams,
|
|
464
449
|
);
|
|
465
450
|
|
|
466
451
|
await benchmarkAndAwaitTx(
|
|
@@ -491,18 +476,12 @@ describe('Interest Collection', () => {
|
|
|
491
476
|
context.lucid.selectWallet.fromSeed(context.users.admin.seedPhrase);
|
|
492
477
|
|
|
493
478
|
const interestDistributeUtxos = (
|
|
494
|
-
await findAllInterestCollectors(
|
|
495
|
-
context.lucid,
|
|
496
|
-
context.systemParams.validatorHashes.interestCollectionHash,
|
|
497
|
-
)
|
|
479
|
+
await findAllInterestCollectors(context.lucid, context.systemParams)
|
|
498
480
|
).filter((utxo) => assetClassValueOf(utxo.assets, EXAMPLE_TOKEN_1));
|
|
499
481
|
|
|
500
482
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
501
483
|
context.lucid,
|
|
502
|
-
context.systemParams
|
|
503
|
-
fromSystemParamsAsset(
|
|
504
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
505
|
-
),
|
|
484
|
+
context.systemParams,
|
|
506
485
|
);
|
|
507
486
|
|
|
508
487
|
await benchmarkAndAwaitTx(
|
|
@@ -532,20 +511,14 @@ describe('Interest Collection', () => {
|
|
|
532
511
|
|
|
533
512
|
const interestDistributeUtxo = matchSingle(
|
|
534
513
|
(
|
|
535
|
-
await findAllInterestCollectors(
|
|
536
|
-
context.lucid,
|
|
537
|
-
context.systemParams.validatorHashes.interestCollectionHash,
|
|
538
|
-
)
|
|
514
|
+
await findAllInterestCollectors(context.lucid, context.systemParams)
|
|
539
515
|
).filter((utxo) => assetClassValueOf(utxo.assets, EXAMPLE_TOKEN_1)),
|
|
540
516
|
(_) => new Error('Expected a single interest distribute UTXO'),
|
|
541
517
|
);
|
|
542
518
|
|
|
543
519
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
544
520
|
context.lucid,
|
|
545
|
-
context.systemParams
|
|
546
|
-
fromSystemParamsAsset(
|
|
547
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
548
|
-
),
|
|
521
|
+
context.systemParams,
|
|
549
522
|
);
|
|
550
523
|
|
|
551
524
|
await expectScriptFailure(
|
|
@@ -565,10 +538,7 @@ describe('Interest Collection', () => {
|
|
|
565
538
|
test<IndigoTestContext>('Update Permissions', async (context: IndigoTestContext) => {
|
|
566
539
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
567
540
|
context.lucid,
|
|
568
|
-
context.systemParams
|
|
569
|
-
fromSystemParamsAsset(
|
|
570
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
571
|
-
),
|
|
541
|
+
context.systemParams,
|
|
572
542
|
);
|
|
573
543
|
|
|
574
544
|
const govUtxo = await findGov(
|
|
@@ -607,10 +577,7 @@ describe('Interest Collection', () => {
|
|
|
607
577
|
test<IndigoTestContext>('Update Permissions - all of multiple signers', async (context: IndigoTestContext) => {
|
|
608
578
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
609
579
|
context.lucid,
|
|
610
|
-
context.systemParams
|
|
611
|
-
fromSystemParamsAsset(
|
|
612
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
613
|
-
),
|
|
580
|
+
context.systemParams,
|
|
614
581
|
);
|
|
615
582
|
|
|
616
583
|
const govUtxo = await findGov(
|
|
@@ -665,10 +632,7 @@ describe('Interest Collection', () => {
|
|
|
665
632
|
test<IndigoTestContext>('Update Permissions - some of multiple signers', async (context: IndigoTestContext) => {
|
|
666
633
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
667
634
|
context.lucid,
|
|
668
|
-
context.systemParams
|
|
669
|
-
fromSystemParamsAsset(
|
|
670
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
671
|
-
),
|
|
635
|
+
context.systemParams,
|
|
672
636
|
);
|
|
673
637
|
|
|
674
638
|
const govUtxo = await findGov(
|
|
@@ -728,10 +692,7 @@ describe('Interest Collection', () => {
|
|
|
728
692
|
test<IndigoTestContext>('Update Permissions - nested multisig', async (context: IndigoTestContext) => {
|
|
729
693
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
730
694
|
context.lucid,
|
|
731
|
-
context.systemParams
|
|
732
|
-
fromSystemParamsAsset(
|
|
733
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
734
|
-
),
|
|
695
|
+
context.systemParams,
|
|
735
696
|
);
|
|
736
697
|
|
|
737
698
|
const govUtxo = await findGov(
|
|
@@ -798,10 +759,7 @@ describe('Interest Collection', () => {
|
|
|
798
759
|
test<IndigoTestContext>('Update Permissions - Fail when new admin is not signed', async (context: IndigoTestContext) => {
|
|
799
760
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
800
761
|
context.lucid,
|
|
801
|
-
context.systemParams
|
|
802
|
-
fromSystemParamsAsset(
|
|
803
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
804
|
-
),
|
|
762
|
+
context.systemParams,
|
|
805
763
|
);
|
|
806
764
|
|
|
807
765
|
const govUtxo = await findGov(
|
|
@@ -834,10 +792,7 @@ describe('Interest Collection', () => {
|
|
|
834
792
|
test<IndigoTestContext>('Update Permissions - Fail when not enough signers of new admin', async (context: IndigoTestContext) => {
|
|
835
793
|
const interestAdminUtxo = await findAdminInterestCollector(
|
|
836
794
|
context.lucid,
|
|
837
|
-
context.systemParams
|
|
838
|
-
fromSystemParamsAsset(
|
|
839
|
-
context.systemParams.interestCollectionParams.multisigUtxoNft,
|
|
840
|
-
),
|
|
795
|
+
context.systemParams,
|
|
841
796
|
);
|
|
842
797
|
|
|
843
798
|
const govUtxo = await findGov(
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
toText,
|
|
7
7
|
} from '@lucid-evolution/lucid';
|
|
8
8
|
import { createScriptAddress } from '../../src/utils/lucid-utils';
|
|
9
|
-
import {
|
|
9
|
+
import { matchSingle, SystemParams } from '../../src';
|
|
10
10
|
import { option as O, array as A, function as F } from 'fp-ts';
|
|
11
11
|
import {
|
|
12
12
|
AssetClass,
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
parseCollateralAssetDatum,
|
|
20
20
|
parseIAssetDatum,
|
|
21
21
|
} from '../../src/contracts/iasset/types';
|
|
22
|
-
import { LucidContext } from '../test-helpers';
|
|
23
22
|
|
|
24
23
|
// TODO: replace with the new variant defined below
|
|
25
24
|
export async function findIAsset(
|
|
@@ -56,44 +55,6 @@ export async function findIAsset(
|
|
|
56
55
|
);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
export async function findIAssetNew(
|
|
60
|
-
context: LucidContext,
|
|
61
|
-
sysParams: SystemParams,
|
|
62
|
-
// Ascii encoded
|
|
63
|
-
iassetName: string,
|
|
64
|
-
): Promise<IAssetOutput> {
|
|
65
|
-
const iassetUtxos = await context.lucid.utxosAtWithUnit(
|
|
66
|
-
createScriptAddress(
|
|
67
|
-
context.lucid.config().network!,
|
|
68
|
-
sysParams.validatorHashes.iassetHash,
|
|
69
|
-
),
|
|
70
|
-
assetClassToUnit(
|
|
71
|
-
fromSystemParamsAsset(sysParams.cdpParams.iAssetAuthToken),
|
|
72
|
-
),
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return matchSingle(
|
|
76
|
-
F.pipe(
|
|
77
|
-
iassetUtxos.map((utxo) =>
|
|
78
|
-
F.pipe(
|
|
79
|
-
O.fromNullable(utxo.datum),
|
|
80
|
-
O.flatMap(parseIAssetDatum),
|
|
81
|
-
O.flatMap((datum) => {
|
|
82
|
-
if (toHex(datum.assetName) === fromText(iassetName)) {
|
|
83
|
-
return O.some({ utxo, datum: datum });
|
|
84
|
-
} else {
|
|
85
|
-
return O.none;
|
|
86
|
-
}
|
|
87
|
-
}),
|
|
88
|
-
),
|
|
89
|
-
),
|
|
90
|
-
A.compact,
|
|
91
|
-
),
|
|
92
|
-
(res) =>
|
|
93
|
-
new Error('Expected a single IAsset UTXO.: ' + JSON.stringify(res)),
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
58
|
export async function findAllIAssets(
|
|
98
59
|
lucid: LucidEvolution,
|
|
99
60
|
iassetScriptHash: ScriptHash,
|
|
@@ -160,50 +121,6 @@ export async function findCollateralAsset(
|
|
|
160
121
|
);
|
|
161
122
|
}
|
|
162
123
|
|
|
163
|
-
export async function findCollateralAssetNew(
|
|
164
|
-
context: LucidContext,
|
|
165
|
-
sysParams: SystemParams,
|
|
166
|
-
// Ascii encoded
|
|
167
|
-
iassetName: string,
|
|
168
|
-
collateralAsset: AssetClass,
|
|
169
|
-
): Promise<CollateralAssetOutput> {
|
|
170
|
-
const collateralAssetUtxos = await context.lucid.utxosAtWithUnit(
|
|
171
|
-
createScriptAddress(
|
|
172
|
-
context.lucid.config().network!,
|
|
173
|
-
sysParams.validatorHashes.iassetHash,
|
|
174
|
-
),
|
|
175
|
-
assetClassToUnit(
|
|
176
|
-
fromSystemParamsAsset(sysParams.cdpParams.collateralAssetAuthToken),
|
|
177
|
-
),
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
return matchSingle(
|
|
181
|
-
F.pipe(
|
|
182
|
-
collateralAssetUtxos.map((utxo) =>
|
|
183
|
-
F.pipe(
|
|
184
|
-
O.fromNullable(utxo.datum),
|
|
185
|
-
O.flatMap(parseCollateralAssetDatum),
|
|
186
|
-
O.flatMap((datum) => {
|
|
187
|
-
if (
|
|
188
|
-
isSameAssetClass(datum.collateralAsset, collateralAsset) &&
|
|
189
|
-
fromText(iassetName) === toHex(datum.iasset)
|
|
190
|
-
) {
|
|
191
|
-
return O.some({ utxo, datum: datum });
|
|
192
|
-
} else {
|
|
193
|
-
return O.none;
|
|
194
|
-
}
|
|
195
|
-
}),
|
|
196
|
-
),
|
|
197
|
-
),
|
|
198
|
-
A.compact,
|
|
199
|
-
),
|
|
200
|
-
(res) =>
|
|
201
|
-
new Error(
|
|
202
|
-
'Expected a single Collateral Asset UTXO.: ' + JSON.stringify(res),
|
|
203
|
-
),
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
124
|
export async function findAllCollateralAssetsOfIAsset(
|
|
208
125
|
lucid: LucidEvolution,
|
|
209
126
|
iassetScriptHash: ScriptHash,
|
package/tests/rob/rob.test.ts
CHANGED
|
@@ -49,7 +49,6 @@ import {
|
|
|
49
49
|
findAllNecessaryOrefs,
|
|
50
50
|
findOwnCdpNew,
|
|
51
51
|
findPriceOracleFromCollateralAsset,
|
|
52
|
-
findRandomCdpCreatorNew,
|
|
53
52
|
} from '../cdp/cdp-queries';
|
|
54
53
|
import {
|
|
55
54
|
redeemWithCdpAdjust,
|
|
@@ -59,11 +58,7 @@ import {
|
|
|
59
58
|
} from './transactions-mutated';
|
|
60
59
|
import { expectScriptFailure, expectValue } from '../utils/asserts';
|
|
61
60
|
import { findGov } from '../gov/governance-queries';
|
|
62
|
-
import {
|
|
63
|
-
findCollateralAsset,
|
|
64
|
-
findCollateralAssetNew,
|
|
65
|
-
findIAssetNew,
|
|
66
|
-
} from '../queries/iasset-queries';
|
|
61
|
+
import { findCollateralAsset } from '../queries/iasset-queries';
|
|
67
62
|
import { processSuccessfulProposal } from '../gov/actions';
|
|
68
63
|
import { runOpenCdp } from '../cdp/actions';
|
|
69
64
|
import {
|
|
@@ -72,6 +67,11 @@ import {
|
|
|
72
67
|
} from '../price-oracle/actions';
|
|
73
68
|
import { runRedeemRob } from './actions';
|
|
74
69
|
import { calculateFeeFromRatio } from '../../src/utils/indigo-helpers';
|
|
70
|
+
import { findRandomCdpCreator as findRandomCdpCreatorNew } from '../../src/contracts/cdp-creator/queries';
|
|
71
|
+
import {
|
|
72
|
+
findCollateralAsset as findCollateralAssetNew,
|
|
73
|
+
findIAsset as findIAssetNew,
|
|
74
|
+
} from '../../src/contracts/iasset/queries';
|
|
75
75
|
import { benchmarkAndAwaitTx } from '../utils/benchmark-utils';
|
|
76
76
|
import { sendValueTo, totalValueAtAddress } from '../utils';
|
|
77
77
|
import { MAINNET_PROTOCOL_PARAMETERS } from '../indigo-test-helpers';
|
|
@@ -282,9 +282,9 @@ describe('ROB', () => {
|
|
|
282
282
|
calculateFeeFromRatio(
|
|
283
283
|
(
|
|
284
284
|
await findIAssetNew(
|
|
285
|
-
context,
|
|
285
|
+
context.lucid,
|
|
286
286
|
sysParams,
|
|
287
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
287
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
288
288
|
)
|
|
289
289
|
).datum.redemptionReimbursementRatio,
|
|
290
290
|
SINGLE_PAYOUT_IASSET_AMT,
|
|
@@ -629,9 +629,9 @@ describe('ROB', () => {
|
|
|
629
629
|
calculateFeeFromRatio(
|
|
630
630
|
(
|
|
631
631
|
await findIAssetNew(
|
|
632
|
-
context,
|
|
632
|
+
context.lucid,
|
|
633
633
|
sysParams,
|
|
634
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
634
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
635
635
|
)
|
|
636
636
|
).datum.redemptionReimbursementRatio,
|
|
637
637
|
SINGLE_PAYOUT_COLLATERAL_AMT,
|
|
@@ -768,9 +768,9 @@ describe('ROB', () => {
|
|
|
768
768
|
calculateFeeFromRatio(
|
|
769
769
|
(
|
|
770
770
|
await findIAssetNew(
|
|
771
|
-
context,
|
|
771
|
+
context.lucid,
|
|
772
772
|
sysParams,
|
|
773
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
773
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
774
774
|
)
|
|
775
775
|
).datum.redemptionReimbursementRatio,
|
|
776
776
|
SINGLE_PAYOUT_COLLATERAL_AMT,
|
|
@@ -913,7 +913,7 @@ describe('ROB', () => {
|
|
|
913
913
|
// everything that gets minted is sent to ROB
|
|
914
914
|
mintedAmt,
|
|
915
915
|
sysParams,
|
|
916
|
-
await findRandomCdpCreatorNew(context, sysParams),
|
|
916
|
+
await findRandomCdpCreatorNew(context.lucid, sysParams),
|
|
917
917
|
orefs.iasset.utxo,
|
|
918
918
|
orefs.collateralAsset.utxo,
|
|
919
919
|
priceOracleUtxo!,
|
|
@@ -945,9 +945,9 @@ describe('ROB', () => {
|
|
|
945
945
|
calculateFeeFromRatio(
|
|
946
946
|
(
|
|
947
947
|
await findIAssetNew(
|
|
948
|
-
context,
|
|
948
|
+
context.lucid,
|
|
949
949
|
sysParams,
|
|
950
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
950
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
951
951
|
)
|
|
952
952
|
).datum.debtMintingFeeRatio,
|
|
953
953
|
mintedAmt,
|
|
@@ -1029,7 +1029,7 @@ describe('ROB', () => {
|
|
|
1029
1029
|
// everything that gets minted is sent to ROB
|
|
1030
1030
|
mintedAmt,
|
|
1031
1031
|
sysParams,
|
|
1032
|
-
await findRandomCdpCreatorNew(context, sysParams),
|
|
1032
|
+
await findRandomCdpCreatorNew(context.lucid, sysParams),
|
|
1033
1033
|
orefs.iasset.utxo,
|
|
1034
1034
|
orefs.collateralAsset.utxo,
|
|
1035
1035
|
priceOracleUtxo!,
|
|
@@ -1059,9 +1059,9 @@ describe('ROB', () => {
|
|
|
1059
1059
|
calculateFeeFromRatio(
|
|
1060
1060
|
(
|
|
1061
1061
|
await findIAssetNew(
|
|
1062
|
-
context,
|
|
1062
|
+
context.lucid,
|
|
1063
1063
|
sysParams,
|
|
1064
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1064
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1065
1065
|
)
|
|
1066
1066
|
).datum.debtMintingFeeRatio,
|
|
1067
1067
|
mintedAmt,
|
|
@@ -1078,9 +1078,9 @@ describe('ROB', () => {
|
|
|
1078
1078
|
calculateFeeFromRatio(
|
|
1079
1079
|
(
|
|
1080
1080
|
await findIAssetNew(
|
|
1081
|
-
context,
|
|
1081
|
+
context.lucid,
|
|
1082
1082
|
sysParams,
|
|
1083
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1083
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1084
1084
|
)
|
|
1085
1085
|
).datum.redemptionReimbursementRatio,
|
|
1086
1086
|
SINGLE_PAYOUT_IASSET_AMT,
|
|
@@ -1443,9 +1443,9 @@ describe('ROB', () => {
|
|
|
1443
1443
|
calculateFeeFromRatio(
|
|
1444
1444
|
(
|
|
1445
1445
|
await findIAssetNew(
|
|
1446
|
-
context,
|
|
1446
|
+
context.lucid,
|
|
1447
1447
|
sysParams,
|
|
1448
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1448
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1449
1449
|
)
|
|
1450
1450
|
).datum.redemptionReimbursementRatio,
|
|
1451
1451
|
redemptionIAssetAmt,
|
|
@@ -1567,9 +1567,9 @@ describe('ROB', () => {
|
|
|
1567
1567
|
calculateFeeFromRatio(
|
|
1568
1568
|
(
|
|
1569
1569
|
await findIAssetNew(
|
|
1570
|
-
context,
|
|
1570
|
+
context.lucid,
|
|
1571
1571
|
sysParams,
|
|
1572
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1572
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1573
1573
|
)
|
|
1574
1574
|
).datum.redemptionReimbursementRatio,
|
|
1575
1575
|
redemptionIAssetAmt,
|
|
@@ -1718,9 +1718,9 @@ describe('ROB', () => {
|
|
|
1718
1718
|
calculateFeeFromRatio(
|
|
1719
1719
|
(
|
|
1720
1720
|
await findIAssetNew(
|
|
1721
|
-
context,
|
|
1721
|
+
context.lucid,
|
|
1722
1722
|
sysParams,
|
|
1723
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1723
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1724
1724
|
)
|
|
1725
1725
|
).datum.redemptionReimbursementRatio,
|
|
1726
1726
|
payoutCollateralAmt,
|
|
@@ -1906,9 +1906,9 @@ describe('ROB', () => {
|
|
|
1906
1906
|
calculateFeeFromRatio(
|
|
1907
1907
|
(
|
|
1908
1908
|
await findIAssetNew(
|
|
1909
|
-
context,
|
|
1909
|
+
context.lucid,
|
|
1910
1910
|
sysParams,
|
|
1911
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
1911
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
1912
1912
|
)
|
|
1913
1913
|
).datum.redemptionReimbursementRatio,
|
|
1914
1914
|
payoutCollateralAmt,
|
|
@@ -2060,9 +2060,9 @@ describe('ROB', () => {
|
|
|
2060
2060
|
calculateFeeFromRatio(
|
|
2061
2061
|
(
|
|
2062
2062
|
await findIAssetNew(
|
|
2063
|
-
context,
|
|
2063
|
+
context.lucid,
|
|
2064
2064
|
sysParams,
|
|
2065
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2065
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2066
2066
|
)
|
|
2067
2067
|
).datum.redemptionReimbursementRatio,
|
|
2068
2068
|
payoutCollateralAmt,
|
|
@@ -2303,9 +2303,9 @@ describe('ROB', () => {
|
|
|
2303
2303
|
calculateFeeFromRatio(
|
|
2304
2304
|
(
|
|
2305
2305
|
await findIAssetNew(
|
|
2306
|
-
context,
|
|
2306
|
+
context.lucid,
|
|
2307
2307
|
sysParams,
|
|
2308
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2308
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2309
2309
|
)
|
|
2310
2310
|
).datum.redemptionReimbursementRatio,
|
|
2311
2311
|
payoutIAssetAmt,
|
|
@@ -2634,9 +2634,9 @@ describe('ROB', () => {
|
|
|
2634
2634
|
calculateFeeFromRatio(
|
|
2635
2635
|
(
|
|
2636
2636
|
await findIAssetNew(
|
|
2637
|
-
context,
|
|
2637
|
+
context.lucid,
|
|
2638
2638
|
sysParams,
|
|
2639
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2639
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2640
2640
|
)
|
|
2641
2641
|
).datum.redemptionReimbursementRatio,
|
|
2642
2642
|
10_000_000n,
|
|
@@ -2654,9 +2654,9 @@ describe('ROB', () => {
|
|
|
2654
2654
|
calculateFeeFromRatio(
|
|
2655
2655
|
(
|
|
2656
2656
|
await findIAssetNew(
|
|
2657
|
-
context,
|
|
2657
|
+
context.lucid,
|
|
2658
2658
|
sysParams,
|
|
2659
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2659
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2660
2660
|
)
|
|
2661
2661
|
).datum.redemptionReimbursementRatio,
|
|
2662
2662
|
11_000_000n,
|
|
@@ -2806,9 +2806,9 @@ describe('ROB', () => {
|
|
|
2806
2806
|
calculateFeeFromRatio(
|
|
2807
2807
|
(
|
|
2808
2808
|
await findIAssetNew(
|
|
2809
|
-
context,
|
|
2809
|
+
context.lucid,
|
|
2810
2810
|
sysParams,
|
|
2811
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2811
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2812
2812
|
)
|
|
2813
2813
|
).datum.redemptionReimbursementRatio,
|
|
2814
2814
|
10_000_000n,
|
|
@@ -2827,9 +2827,9 @@ describe('ROB', () => {
|
|
|
2827
2827
|
calculateFeeFromRatio(
|
|
2828
2828
|
(
|
|
2829
2829
|
await findIAssetNew(
|
|
2830
|
-
context,
|
|
2830
|
+
context.lucid,
|
|
2831
2831
|
sysParams,
|
|
2832
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
2832
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
2833
2833
|
)
|
|
2834
2834
|
).datum.redemptionReimbursementRatio,
|
|
2835
2835
|
11_000_000n,
|
|
@@ -3047,24 +3047,24 @@ describe('ROB', () => {
|
|
|
3047
3047
|
await findPriceOracleFromCollateralAsset(
|
|
3048
3048
|
context.lucid,
|
|
3049
3049
|
await findCollateralAssetNew(
|
|
3050
|
-
context,
|
|
3050
|
+
context.lucid,
|
|
3051
3051
|
sysParams,
|
|
3052
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3052
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3053
3053
|
adaAssetClass,
|
|
3054
3054
|
),
|
|
3055
3055
|
),
|
|
3056
3056
|
(
|
|
3057
3057
|
await findIAssetNew(
|
|
3058
|
-
context,
|
|
3058
|
+
context.lucid,
|
|
3059
3059
|
sysParams,
|
|
3060
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3060
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3061
3061
|
)
|
|
3062
3062
|
).utxo,
|
|
3063
3063
|
(
|
|
3064
3064
|
await findCollateralAssetNew(
|
|
3065
|
-
context,
|
|
3065
|
+
context.lucid,
|
|
3066
3066
|
sysParams,
|
|
3067
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3067
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3068
3068
|
adaAssetClass,
|
|
3069
3069
|
)
|
|
3070
3070
|
).utxo,
|
|
@@ -3149,24 +3149,24 @@ describe('ROB', () => {
|
|
|
3149
3149
|
await findPriceOracleFromCollateralAsset(
|
|
3150
3150
|
context.lucid,
|
|
3151
3151
|
await findCollateralAssetNew(
|
|
3152
|
-
context,
|
|
3152
|
+
context.lucid,
|
|
3153
3153
|
sysParams,
|
|
3154
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3154
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3155
3155
|
adaAssetClass,
|
|
3156
3156
|
),
|
|
3157
3157
|
),
|
|
3158
3158
|
(
|
|
3159
3159
|
await findIAssetNew(
|
|
3160
|
-
context,
|
|
3160
|
+
context.lucid,
|
|
3161
3161
|
sysParams,
|
|
3162
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3162
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3163
3163
|
)
|
|
3164
3164
|
).utxo,
|
|
3165
3165
|
(
|
|
3166
3166
|
await findCollateralAssetNew(
|
|
3167
|
-
context,
|
|
3167
|
+
context.lucid,
|
|
3168
3168
|
sysParams,
|
|
3169
|
-
iusdAssetInfo.iassetTokenNameAscii,
|
|
3169
|
+
fromHex(fromText(iusdAssetInfo.iassetTokenNameAscii)),
|
|
3170
3170
|
adaAssetClass,
|
|
3171
3171
|
)
|
|
3172
3172
|
).utxo,
|
|
@@ -60,7 +60,7 @@ import { expectScriptFailure } from '../utils/asserts';
|
|
|
60
60
|
import {
|
|
61
61
|
findRandomTreasuryUtxoWithOnlyAda,
|
|
62
62
|
findRandomTreasuryUtxoWithAsset,
|
|
63
|
-
} from '
|
|
63
|
+
} from '../../src/contracts/treasury/queries';
|
|
64
64
|
import { createUtxoAtTreasury } from '../endpoints/treasury';
|
|
65
65
|
import { rationalFromInt, rationalZero } from '../../src/types/rational';
|
|
66
66
|
|
|
@@ -2,7 +2,7 @@ import { Assets, TxBuilder } from '@lucid-evolution/lucid';
|
|
|
2
2
|
import { LucidContext } from '../test-helpers';
|
|
3
3
|
import { createUtxoAtTreasury } from '../endpoints/treasury';
|
|
4
4
|
import { SystemParams, treasuryMerge, treasurySplit } from '../../src';
|
|
5
|
-
import { findAllTreasuryUtxos } from '
|
|
5
|
+
import { findAllTreasuryUtxos } from '../../src/contracts/treasury/queries';
|
|
6
6
|
import { assert } from 'vitest';
|
|
7
7
|
|
|
8
8
|
export async function treasuryMergeTx(
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
MAINNET_PROTOCOL_PARAMETERS,
|
|
18
18
|
} from '../indigo-test-helpers';
|
|
19
19
|
import { benchmarkAndAwaitTx } from '../utils/benchmark-utils';
|
|
20
|
-
import { findRandomTreasuryUtxoWithOnlyAda } from '
|
|
20
|
+
import { findRandomTreasuryUtxoWithOnlyAda } from '../../src/contracts/treasury/queries';
|
|
21
21
|
import {
|
|
22
22
|
adaAssetClass,
|
|
23
23
|
AssetClass,
|