@indigo-labs/indigo-sdk 0.3.28 → 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 +610 -364
- package/dist/index.mjs +445 -196
- package/package.json +14 -22
- 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 +38 -15
- 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
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,
|