@indigo-labs/indigo-sdk 0.1.28 → 0.2.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/.github/workflows/ci.yml +8 -3
- package/dist/index.d.mts +1300 -671
- package/dist/index.d.ts +1300 -671
- package/dist/index.js +4663 -2220
- package/dist/index.mjs +4594 -2190
- package/eslint.config.mjs +7 -1
- package/package.json +9 -4
- package/src/contracts/cdp/helpers.ts +167 -0
- package/src/contracts/cdp/scripts.ts +33 -0
- package/src/contracts/cdp/transactions.ts +1310 -0
- package/src/contracts/cdp/types.ts +161 -0
- package/src/contracts/cdp-creator/scripts.ts +39 -0
- package/src/{types/indigo/cdp-creator.ts → contracts/cdp-creator/types.ts} +6 -4
- package/src/contracts/collector/scripts.ts +32 -0
- package/src/contracts/collector/transactions.ts +44 -0
- package/src/contracts/execute/scripts.ts +48 -0
- package/src/contracts/execute/types.ts +57 -0
- package/src/contracts/gov/helpers.ts +157 -0
- package/src/contracts/gov/scripts.ts +34 -0
- package/src/contracts/gov/transactions.ts +1224 -0
- package/src/contracts/gov/types-new.ts +115 -0
- package/src/contracts/gov/types.ts +89 -0
- package/src/{helpers/interest-oracle.ts → contracts/interest-oracle/helpers.ts} +37 -9
- package/src/contracts/interest-oracle/scripts.ts +18 -0
- package/src/contracts/interest-oracle/transactions.ts +149 -0
- package/src/{types/indigo/interest-oracle.ts → contracts/interest-oracle/types.ts} +1 -1
- package/src/contracts/lrp/scripts.ts +27 -0
- package/src/contracts/{lrp.ts → lrp/transactions.ts} +14 -14
- package/src/{types/indigo/lrp.ts → contracts/lrp/types.ts} +2 -2
- package/src/{scripts/one-shot-policy.ts → contracts/one-shot/scripts.ts} +1 -1
- package/src/contracts/{one-shot.ts → one-shot/transactions.ts} +3 -3
- package/src/contracts/poll/helpers.ts +55 -0
- package/src/contracts/poll/scripts.ts +72 -0
- package/src/contracts/poll/types-poll-manager.ts +38 -0
- package/src/contracts/poll/types-poll-shard.ts +38 -0
- package/src/contracts/poll/types-poll.ts +88 -0
- package/src/{scripts/price-oracle-validator.ts → contracts/price-oracle/scripts.ts} +1 -4
- package/src/contracts/price-oracle/transactions.ts +112 -0
- package/src/{types/indigo/price-oracle.ts → contracts/price-oracle/types.ts} +16 -4
- package/src/{helpers/stability-pool-helpers.ts → contracts/stability-pool/helpers.ts} +110 -6
- package/src/contracts/stability-pool/scripts.ts +46 -0
- package/src/contracts/stability-pool/transactions.ts +676 -0
- package/src/contracts/stability-pool/types-new.ts +208 -0
- package/src/contracts/stability-pool/types.ts +42 -0
- package/src/contracts/staking/helpers.ts +116 -0
- package/src/contracts/staking/scripts.ts +41 -0
- package/src/contracts/staking/transactions.ts +268 -0
- package/src/contracts/staking/types-new.ts +81 -0
- package/src/contracts/staking/types.ts +41 -0
- package/src/contracts/treasury/scripts.ts +37 -0
- package/src/contracts/treasury/transactions.ts +44 -0
- package/src/contracts/treasury/types.ts +55 -0
- package/src/contracts/version-registry/scripts.ts +29 -0
- package/src/contracts/version-registry/types-new.ts +19 -0
- package/src/{types/indigo/version-record.ts → contracts/version-registry/types.ts} +1 -1
- package/src/contracts/vesting/helpers.ts +267 -0
- package/src/index.ts +39 -33
- package/src/types/evolution-schema-options.ts +16 -0
- package/src/types/generic.ts +78 -60
- package/src/types/on-chain-decimal.ts +22 -0
- package/src/types/system-params.ts +22 -11
- package/src/utils/bigint-utils.ts +7 -0
- package/src/{helpers → utils}/helper-txs.ts +1 -0
- package/src/utils/time-helpers.ts +4 -0
- package/src/{helpers/helpers.ts → utils/utils.ts} +0 -10
- package/src/{helpers → utils}/value-helpers.ts +10 -0
- package/src/{scripts → validators}/cdp-creator-validator.ts +4 -50
- package/src/{scripts → validators}/cdp-validator.ts +3 -5
- package/src/{scripts → validators}/collector-validator.ts +2 -3
- package/src/{scripts/version-registry.ts → validators/execute-validator.ts} +3 -11
- package/src/{scripts/gov-validator.ts → validators/governance-validator.ts} +3 -40
- package/src/{scripts → validators}/interest-oracle-validator.ts +4 -20
- package/src/validators/lrp-validator.ts +7 -0
- package/src/validators/poll-manager-validator.ts +7 -0
- package/src/{scripts → validators}/poll-shard-validator.ts +3 -43
- package/src/{scripts → validators}/stability-pool-validator.ts +4 -57
- package/src/{scripts → validators}/staking-validator.ts +2 -3
- package/src/{scripts → validators}/treasury-validator.ts +2 -3
- package/src/{scripts → validators}/version-record-policy.ts +4 -23
- package/src/validators/version-registry-validator.ts +7 -0
- package/tests/cdp.test.ts +1565 -0
- package/tests/datums.test.ts +125 -108
- package/tests/endpoints/initialize.ts +240 -338
- package/tests/gov.test.ts +1874 -0
- package/tests/hash-checks.test.ts +26 -21
- package/tests/indigo-test-helpers.ts +1 -55
- package/tests/initialize.test.ts +10 -5
- package/tests/interest-calculations.test.ts +18 -18
- package/tests/interest-oracle.test.ts +20 -18
- package/tests/lrp.test.ts +191 -65
- package/tests/mock/assets-mock.ts +59 -0
- package/tests/queries/cdp-queries.ts +144 -0
- package/tests/queries/collector-queries.ts +26 -0
- package/tests/queries/execute-queries.ts +46 -0
- package/tests/queries/governance-queries.ts +19 -16
- package/tests/queries/iasset-queries.ts +46 -23
- package/tests/queries/interest-oracle-queries.ts +3 -6
- package/tests/queries/lrp-queries.ts +2 -2
- package/tests/queries/poll-queries.ts +97 -0
- package/tests/queries/price-oracle-queries.ts +5 -22
- package/tests/queries/stability-pool-queries.ts +10 -8
- package/tests/queries/staking-queries.ts +28 -19
- package/tests/queries/treasury-queries.ts +19 -0
- package/tests/stability-pool.test.ts +186 -71
- package/tests/staking.test.ts +30 -23
- package/tests/test-helpers.ts +11 -2
- package/tests/utils/asserts.ts +13 -0
- package/tests/utils/index.ts +50 -0
- package/tsconfig.json +3 -1
- package/vitest.config.ts +1 -1
- package/.github/workflows/test.yml +0 -44
- package/src/contracts/cdp.ts +0 -752
- package/src/contracts/collector.ts +0 -98
- package/src/contracts/gov.ts +0 -1
- package/src/contracts/interest-oracle.ts +0 -149
- package/src/contracts/stability-pool.ts +0 -690
- package/src/contracts/staking.ts +0 -348
- package/src/contracts/treasury.ts +0 -112
- package/src/helpers/asset-helpers.ts +0 -62
- package/src/helpers/staking-helpers.ts +0 -94
- package/src/helpers/time-helpers.ts +0 -4
- package/src/scripts/execute-validator.ts +0 -52
- package/src/scripts/lrp-validator.ts +0 -40
- package/src/scripts/poll-manager-validator.ts +0 -52
- package/src/types/indigo/cdp.ts +0 -88
- package/src/types/indigo/execute.ts +0 -21
- package/src/types/indigo/gov.ts +0 -51
- package/src/types/indigo/poll-manager.ts +0 -21
- package/src/types/indigo/poll-shard.ts +0 -16
- package/src/types/indigo/stability-pool.ts +0 -233
- package/src/types/indigo/staking.ts +0 -99
- /package/src/{types/one-shot.ts → contracts/one-shot/types.ts} +0 -0
- /package/src/{helpers/price-oracle-helpers.ts → contracts/price-oracle/helpers.ts} +0 -0
- /package/src/{helpers → utils}/indigo-helpers.ts +0 -0
- /package/src/{helpers → utils}/lucid-utils.ts +0 -0
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Data, Datum, Redeemer } from '@lucid-evolution/lucid';
|
|
2
|
-
import { AssetClassSchema } from '../generic';
|
|
3
|
-
import { match, P } from 'ts-pattern';
|
|
4
|
-
|
|
5
|
-
const StakingParamsSchema = Data.Object({
|
|
6
|
-
stakingManagerNft: AssetClassSchema,
|
|
7
|
-
stakingToken: AssetClassSchema,
|
|
8
|
-
indyToken: AssetClassSchema,
|
|
9
|
-
pollToken: AssetClassSchema,
|
|
10
|
-
versionRecordToken: AssetClassSchema,
|
|
11
|
-
collectorValHash: Data.Bytes(),
|
|
12
|
-
});
|
|
13
|
-
type StakingParams = Data.Static<typeof StakingParamsSchema>;
|
|
14
|
-
const StakingParams = StakingParamsSchema as unknown as StakingParams;
|
|
15
|
-
|
|
16
|
-
const StakingRedeemerSchema = Data.Enum([
|
|
17
|
-
Data.Object({
|
|
18
|
-
CreateStakingPosition: Data.Object({
|
|
19
|
-
creatorPkh: Data.Bytes(),
|
|
20
|
-
}),
|
|
21
|
-
}),
|
|
22
|
-
Data.Literal('UpdateTotalStake'),
|
|
23
|
-
Data.Literal('Distribute'),
|
|
24
|
-
Data.Object({
|
|
25
|
-
AdjustStakedAmount: Data.Object({
|
|
26
|
-
adjustAmount: Data.Integer(),
|
|
27
|
-
}),
|
|
28
|
-
}),
|
|
29
|
-
Data.Literal('Unstake'),
|
|
30
|
-
Data.Literal('Lock'),
|
|
31
|
-
Data.Literal('UpgradeVersion'),
|
|
32
|
-
]);
|
|
33
|
-
export type StakingRedeemer = Data.Static<typeof StakingRedeemerSchema>;
|
|
34
|
-
const StakingRedeemer = StakingRedeemerSchema as unknown as StakingRedeemer;
|
|
35
|
-
|
|
36
|
-
const RewardSnapshotSchema = Data.Object({ snapshotAda: Data.Integer() });
|
|
37
|
-
|
|
38
|
-
const StakingManagerContentSchema = Data.Object({
|
|
39
|
-
totalStake: Data.Integer(),
|
|
40
|
-
managerSnapshot: RewardSnapshotSchema,
|
|
41
|
-
});
|
|
42
|
-
export type StakingManagerContent = Data.Static<
|
|
43
|
-
typeof StakingManagerContentSchema
|
|
44
|
-
>;
|
|
45
|
-
|
|
46
|
-
const StakingPositionContentSchema = Data.Object({
|
|
47
|
-
owner: Data.Bytes(),
|
|
48
|
-
lockedAmount: Data.Map(
|
|
49
|
-
Data.Integer(),
|
|
50
|
-
Data.Tuple([Data.Integer(), Data.Integer()], {
|
|
51
|
-
hasConstr: true,
|
|
52
|
-
}),
|
|
53
|
-
),
|
|
54
|
-
positionSnapshot: RewardSnapshotSchema,
|
|
55
|
-
});
|
|
56
|
-
export type StakingPositionContent = Data.Static<
|
|
57
|
-
typeof StakingPositionContentSchema
|
|
58
|
-
>;
|
|
59
|
-
|
|
60
|
-
const StakingDatumSchema = Data.Enum([
|
|
61
|
-
Data.Object({
|
|
62
|
-
StakingManager: Data.Object({ content: StakingManagerContentSchema }),
|
|
63
|
-
}),
|
|
64
|
-
Data.Object({
|
|
65
|
-
StakingPosition: Data.Object({ content: StakingPositionContentSchema }),
|
|
66
|
-
}),
|
|
67
|
-
]);
|
|
68
|
-
export type StakingDatum = Data.Static<typeof StakingDatumSchema>;
|
|
69
|
-
const StakingDatum = StakingDatumSchema as unknown as StakingDatum;
|
|
70
|
-
|
|
71
|
-
export function parseStakingPositionDatum(
|
|
72
|
-
datum: Datum,
|
|
73
|
-
): StakingPositionContent {
|
|
74
|
-
return match(Data.from<StakingDatum>(datum, StakingDatum))
|
|
75
|
-
.with({ StakingPosition: { content: P.select() } }, (res) => res)
|
|
76
|
-
.otherwise(() => {
|
|
77
|
-
throw new Error('Expected a StakingPosition datum.');
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function parseStakingManagerDatum(datum: Datum): StakingManagerContent {
|
|
82
|
-
return match(Data.from<StakingDatum>(datum, StakingDatum))
|
|
83
|
-
.with({ StakingManager: { content: P.select() } }, (res) => res)
|
|
84
|
-
.otherwise(() => {
|
|
85
|
-
throw new Error('Expected a StakingPosition datum.');
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export function serialiseStakingRedeemer(redeemer: StakingRedeemer): Redeemer {
|
|
90
|
-
return Data.to<StakingRedeemer>(redeemer, StakingRedeemer);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function serialiseStakingDatum(d: StakingDatum): Datum {
|
|
94
|
-
return Data.to<StakingDatum>(d, StakingDatum);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function castStakingParams(params: StakingParams): Data {
|
|
98
|
-
return Data.castTo(params, StakingParams);
|
|
99
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|