@indigo-labs/indigo-sdk 0.1.21 → 0.1.22

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.
Files changed (135) hide show
  1. package/.github/workflows/ci.yml +3 -8
  2. package/.github/workflows/test.yml +44 -0
  3. package/dist/index.d.mts +670 -1291
  4. package/dist/index.d.ts +670 -1291
  5. package/dist/index.js +2235 -4669
  6. package/dist/index.mjs +2216 -4618
  7. package/eslint.config.mjs +1 -7
  8. package/package.json +4 -9
  9. package/src/contracts/cdp.ts +746 -0
  10. package/src/contracts/collector.ts +98 -0
  11. package/src/contracts/gov.ts +1 -0
  12. package/src/contracts/interest-oracle.ts +149 -0
  13. package/src/contracts/{lrp/transactions.ts → lrp.ts} +14 -14
  14. package/src/contracts/{one-shot/transactions.ts → one-shot.ts} +3 -3
  15. package/src/contracts/stability-pool.ts +690 -0
  16. package/src/contracts/staking.ts +348 -0
  17. package/src/contracts/treasury.ts +112 -0
  18. package/src/helpers/asset-helpers.ts +57 -0
  19. package/src/{utils → helpers}/helper-txs.ts +0 -1
  20. package/src/{utils/utils.ts → helpers/helpers.ts} +10 -0
  21. package/src/{contracts/interest-oracle/helpers.ts → helpers/interest-oracle.ts} +9 -37
  22. package/src/{contracts/stability-pool/helpers.ts → helpers/stability-pool-helpers.ts} +6 -110
  23. package/src/helpers/staking-helpers.ts +94 -0
  24. package/src/helpers/time-helpers.ts +4 -0
  25. package/src/{utils → helpers}/value-helpers.ts +0 -10
  26. package/src/index.ts +33 -38
  27. package/src/{validators → scripts}/cdp-creator-validator.ts +50 -4
  28. package/src/{validators → scripts}/cdp-validator.ts +5 -3
  29. package/src/{validators → scripts}/collector-validator.ts +3 -2
  30. package/src/scripts/execute-validator.ts +52 -0
  31. package/src/{validators/governance-validator.ts → scripts/gov-validator.ts} +40 -3
  32. package/src/{validators → scripts}/interest-oracle-validator.ts +20 -4
  33. package/src/scripts/lrp-validator.ts +40 -0
  34. package/src/{contracts/one-shot/scripts.ts → scripts/one-shot-policy.ts} +1 -1
  35. package/src/scripts/poll-manager-validator.ts +52 -0
  36. package/src/{validators → scripts}/poll-shard-validator.ts +43 -3
  37. package/src/{contracts/price-oracle/scripts.ts → scripts/price-oracle-validator.ts} +4 -1
  38. package/src/{validators → scripts}/stability-pool-validator.ts +57 -4
  39. package/src/{validators → scripts}/staking-validator.ts +3 -2
  40. package/src/{validators → scripts}/treasury-validator.ts +3 -2
  41. package/src/{validators → scripts}/version-record-policy.ts +23 -4
  42. package/src/{validators/execute-validator.ts → scripts/version-registry.ts} +11 -3
  43. package/src/types/generic.ts +60 -78
  44. package/src/{contracts/cdp-creator/types.ts → types/indigo/cdp-creator.ts} +4 -6
  45. package/src/types/indigo/cdp.ts +88 -0
  46. package/src/types/indigo/execute.ts +21 -0
  47. package/src/types/indigo/gov.ts +51 -0
  48. package/src/{contracts/interest-oracle/types.ts → types/indigo/interest-oracle.ts} +1 -1
  49. package/src/{contracts/lrp/types.ts → types/indigo/lrp.ts} +2 -2
  50. package/src/types/indigo/poll-manager.ts +21 -0
  51. package/src/types/indigo/poll-shard.ts +16 -0
  52. package/src/{contracts/price-oracle/types.ts → types/indigo/price-oracle.ts} +4 -16
  53. package/src/types/indigo/stability-pool.ts +233 -0
  54. package/src/types/indigo/staking.ts +99 -0
  55. package/src/{contracts/version-registry/types.ts → types/indigo/version-record.ts} +1 -1
  56. package/src/types/on-chain-decimal.ts +0 -22
  57. package/src/types/system-params.ts +11 -22
  58. package/tests/datums.test.ts +108 -125
  59. package/tests/endpoints/initialize.ts +338 -240
  60. package/tests/hash-checks.test.ts +21 -26
  61. package/tests/indigo-test-helpers.ts +55 -1
  62. package/tests/initialize.test.ts +5 -10
  63. package/tests/interest-calculations.test.ts +18 -18
  64. package/tests/interest-oracle.test.ts +18 -20
  65. package/tests/lrp.test.ts +65 -191
  66. package/tests/queries/governance-queries.ts +16 -19
  67. package/tests/queries/iasset-queries.ts +23 -46
  68. package/tests/queries/interest-oracle-queries.ts +6 -3
  69. package/tests/queries/lrp-queries.ts +2 -2
  70. package/tests/queries/price-oracle-queries.ts +22 -5
  71. package/tests/queries/stability-pool-queries.ts +8 -10
  72. package/tests/queries/staking-queries.ts +19 -28
  73. package/tests/stability-pool.test.ts +71 -186
  74. package/tests/staking.test.ts +23 -30
  75. package/tests/test-helpers.ts +2 -11
  76. package/tsconfig.json +1 -3
  77. package/vitest.config.ts +1 -1
  78. package/src/contracts/cdp/helpers.ts +0 -167
  79. package/src/contracts/cdp/scripts.ts +0 -33
  80. package/src/contracts/cdp/transactions.ts +0 -1310
  81. package/src/contracts/cdp/types.ts +0 -161
  82. package/src/contracts/cdp-creator/scripts.ts +0 -39
  83. package/src/contracts/collector/scripts.ts +0 -32
  84. package/src/contracts/collector/transactions.ts +0 -44
  85. package/src/contracts/execute/scripts.ts +0 -48
  86. package/src/contracts/execute/types.ts +0 -57
  87. package/src/contracts/gov/helpers.ts +0 -157
  88. package/src/contracts/gov/scripts.ts +0 -34
  89. package/src/contracts/gov/transactions.ts +0 -1224
  90. package/src/contracts/gov/types-new.ts +0 -115
  91. package/src/contracts/gov/types.ts +0 -89
  92. package/src/contracts/interest-oracle/scripts.ts +0 -18
  93. package/src/contracts/interest-oracle/transactions.ts +0 -149
  94. package/src/contracts/lrp/scripts.ts +0 -27
  95. package/src/contracts/poll/helpers.ts +0 -55
  96. package/src/contracts/poll/scripts.ts +0 -72
  97. package/src/contracts/poll/types-poll-manager.ts +0 -38
  98. package/src/contracts/poll/types-poll-shard.ts +0 -38
  99. package/src/contracts/poll/types-poll.ts +0 -88
  100. package/src/contracts/price-oracle/transactions.ts +0 -112
  101. package/src/contracts/stability-pool/scripts.ts +0 -46
  102. package/src/contracts/stability-pool/transactions.ts +0 -660
  103. package/src/contracts/stability-pool/types-new.ts +0 -208
  104. package/src/contracts/stability-pool/types.ts +0 -42
  105. package/src/contracts/staking/helpers.ts +0 -116
  106. package/src/contracts/staking/scripts.ts +0 -41
  107. package/src/contracts/staking/transactions.ts +0 -268
  108. package/src/contracts/staking/types-new.ts +0 -81
  109. package/src/contracts/staking/types.ts +0 -41
  110. package/src/contracts/treasury/scripts.ts +0 -37
  111. package/src/contracts/treasury/transactions.ts +0 -44
  112. package/src/contracts/treasury/types.ts +0 -55
  113. package/src/contracts/version-registry/scripts.ts +0 -29
  114. package/src/contracts/version-registry/types-new.ts +0 -19
  115. package/src/contracts/vesting/helpers.ts +0 -267
  116. package/src/types/evolution-schema-options.ts +0 -16
  117. package/src/utils/bigint-utils.ts +0 -7
  118. package/src/utils/time-helpers.ts +0 -4
  119. package/src/validators/lrp-validator.ts +0 -7
  120. package/src/validators/poll-manager-validator.ts +0 -7
  121. package/src/validators/version-registry-validator.ts +0 -7
  122. package/tests/cdp.test.ts +0 -1565
  123. package/tests/gov.test.ts +0 -1874
  124. package/tests/mock/assets-mock.ts +0 -59
  125. package/tests/queries/cdp-queries.ts +0 -144
  126. package/tests/queries/collector-queries.ts +0 -26
  127. package/tests/queries/execute-queries.ts +0 -46
  128. package/tests/queries/poll-queries.ts +0 -97
  129. package/tests/queries/treasury-queries.ts +0 -19
  130. package/tests/utils/asserts.ts +0 -13
  131. package/tests/utils/index.ts +0 -50
  132. /package/src/{utils → helpers}/indigo-helpers.ts +0 -0
  133. /package/src/{utils → helpers}/lucid-utils.ts +0 -0
  134. /package/src/{contracts/price-oracle/helpers.ts → helpers/price-oracle-helpers.ts} +0 -0
  135. /package/src/{contracts/one-shot/types.ts → types/one-shot.ts} +0 -0
@@ -0,0 +1,233 @@
1
+ import { Data, Datum } from '@lucid-evolution/lucid';
2
+ import { match, P } from 'ts-pattern';
3
+ import {
4
+ AddressSchema,
5
+ AssetClassSchema,
6
+ OutputReferenceSchema,
7
+ } from '../generic';
8
+
9
+ export const SPIntegerSchema = Data.Object({
10
+ value: Data.Integer(),
11
+ });
12
+
13
+ export type SPInteger = Data.Static<typeof SPIntegerSchema>;
14
+ export const SPInteger = SPIntegerSchema as unknown as SPInteger;
15
+
16
+ const StabilityPoolSnapshotSchema = Data.Object({
17
+ productVal: SPIntegerSchema,
18
+ depositVal: SPIntegerSchema,
19
+ sumVal: SPIntegerSchema,
20
+ epoch: Data.Integer(),
21
+ scale: Data.Integer(),
22
+ });
23
+
24
+ export type StabilityPoolSnapshot = Data.Static<
25
+ typeof StabilityPoolSnapshotSchema
26
+ >;
27
+ export const StabilityPoolSnapshot =
28
+ StabilityPoolSnapshotSchema as unknown as StabilityPoolSnapshot;
29
+
30
+ export const EpochToScaleToSumSchema = Data.Map(
31
+ Data.Object({ epoch: Data.Integer(), scale: Data.Integer() }),
32
+ SPIntegerSchema,
33
+ { minItems: 0 },
34
+ );
35
+
36
+ export type EpochToScaleToSum = Data.Static<typeof EpochToScaleToSumSchema>;
37
+ export const EpochToScaleToSum =
38
+ EpochToScaleToSumSchema as unknown as EpochToScaleToSum;
39
+
40
+ export const StabilityPoolContentSchema = Data.Object({
41
+ asset: Data.Bytes(),
42
+ snapshot: StabilityPoolSnapshotSchema,
43
+ epochToScaleToSum: EpochToScaleToSumSchema,
44
+ });
45
+
46
+ export type StabilityPoolContent = Data.Static<
47
+ typeof StabilityPoolContentSchema
48
+ >;
49
+ export const StabilityPoolContent =
50
+ StabilityPoolContentSchema as unknown as StabilityPoolContent;
51
+
52
+ export const AccountActionSchema = Data.Enum([
53
+ Data.Literal('Create'),
54
+ Data.Object({
55
+ Adjust: Data.Object({
56
+ amount: Data.Integer(),
57
+ outputAddress: AddressSchema,
58
+ }),
59
+ }),
60
+ Data.Object({ Close: Data.Object({ outputAddress: AddressSchema }) }),
61
+ ]);
62
+
63
+ export type AccountAction = Data.Static<typeof AccountActionSchema>;
64
+ export const AccountAction = AccountActionSchema as unknown as AccountAction;
65
+
66
+ export const AccountContentSchema = Data.Object({
67
+ owner: Data.Bytes(),
68
+ asset: Data.Bytes(),
69
+ snapshot: StabilityPoolSnapshotSchema,
70
+ request: Data.Nullable(AccountActionSchema),
71
+ });
72
+
73
+ export type AccountContent = Data.Static<typeof AccountContentSchema>;
74
+ export const AccountContent = AccountContentSchema as unknown as AccountContent;
75
+
76
+ export const SnapshotEpochToScaleToSumContentSchema = Data.Object({
77
+ asset: Data.Bytes(),
78
+ snapshot: EpochToScaleToSumSchema,
79
+ });
80
+
81
+ export type SnapshotEpochToScaleToSumContent = Data.Static<
82
+ typeof SnapshotEpochToScaleToSumContentSchema
83
+ >;
84
+ export const SnapshotEpochToScaleToSumContent =
85
+ SnapshotEpochToScaleToSumContentSchema as unknown as SnapshotEpochToScaleToSumContent;
86
+
87
+ export const StabilityPoolDatumSchema = Data.Enum([
88
+ Data.Object({
89
+ StabilityPool: Data.Object({ content: StabilityPoolContentSchema }),
90
+ }),
91
+ Data.Object({ Account: Data.Object({ content: AccountContentSchema }) }),
92
+ Data.Object({
93
+ SnapshotEpochToScaleToSum: Data.Object({
94
+ content: SnapshotEpochToScaleToSumContentSchema,
95
+ }),
96
+ }),
97
+ ]);
98
+
99
+ export type StabilityPoolDatum = Data.Static<typeof StabilityPoolDatumSchema>;
100
+ export const StabilityPoolDatum =
101
+ StabilityPoolDatumSchema as unknown as StabilityPoolDatum;
102
+
103
+ export const ActionReturnDatumSchema = Data.Enum([
104
+ Data.Object({
105
+ IndigoStabilityPoolAccountAdjustment: Data.Object({
106
+ spent_account: OutputReferenceSchema,
107
+ }),
108
+ }),
109
+ Data.Object({
110
+ IndigoStabilityPoolAccountClosure: Data.Object({
111
+ closed_account: OutputReferenceSchema,
112
+ }),
113
+ }),
114
+ ]);
115
+
116
+ export type ActionReturnDatum = Data.Static<typeof ActionReturnDatumSchema>;
117
+ export const ActionReturnDatum =
118
+ ActionReturnDatumSchema as unknown as ActionReturnDatum;
119
+
120
+ export const StabilityPoolRedeemerSchema = Data.Enum([
121
+ Data.Object({ RequestAction: Data.Object({ action: AccountActionSchema }) }),
122
+ Data.Object({
123
+ ProcessRequest: Data.Object({ requestRef: OutputReferenceSchema }),
124
+ }),
125
+ Data.Object({ AnnulRequest: Data.Object({}) }),
126
+ Data.Object({ LiquidateCDP: Data.Object({}) }),
127
+ Data.Object({ RecordEpochToScaleToSum: Data.Object({}) }),
128
+ Data.Object({ UpgradeVersion: Data.Object({}) }),
129
+ ]);
130
+
131
+ export type StabilityPoolRedeemer = Data.Static<
132
+ typeof StabilityPoolRedeemerSchema
133
+ >;
134
+ export const StabilityPoolRedeemer =
135
+ StabilityPoolRedeemerSchema as unknown as StabilityPoolRedeemer;
136
+
137
+ export function parseStabilityPoolDatum(datum: Datum): StabilityPoolContent {
138
+ return match(Data.from<StabilityPoolDatum>(datum, StabilityPoolDatum))
139
+ .with({ StabilityPool: { content: P.select() } }, (res) => res)
140
+ .otherwise(() => {
141
+ throw new Error('Expected a Stability Pool datum.');
142
+ });
143
+ }
144
+
145
+ export function parseAccountDatum(datum: Datum): AccountContent {
146
+ return match(Data.from<StabilityPoolDatum>(datum, StabilityPoolDatum))
147
+ .with({ Account: { content: P.select() } }, (res) => res)
148
+ .otherwise(() => {
149
+ throw new Error('Expected a StakingPosition datum.');
150
+ });
151
+ }
152
+
153
+ export function parseSnapshotEpochToScaleToSumDatum(
154
+ datum: Datum,
155
+ ): SnapshotEpochToScaleToSumContent {
156
+ return match(Data.from<StabilityPoolDatum>(datum, StabilityPoolDatum))
157
+ .with({ SnapshotEpochToScaleToSum: { content: P.select() } }, (res) => res)
158
+ .otherwise(() => {
159
+ throw new Error('Expected a SnapshotEpochToScaleToSum datum.');
160
+ });
161
+ }
162
+
163
+ export function serialiseStabilityPoolDatum(d: StabilityPoolDatum): Datum {
164
+ let cbor = Data.to<StabilityPoolDatum>(d, StabilityPoolDatum);
165
+ if ('StabilityPool' in d) {
166
+ if (cbor.includes('bf')) {
167
+ if (d.StabilityPool.content.epochToScaleToSum.size > 0) {
168
+ cbor = cbor.replace(
169
+ 'bf',
170
+ 'a' + d.StabilityPool.content.epochToScaleToSum.size,
171
+ );
172
+ cbor = cbor.replace('ffffff', 'ffff');
173
+ }
174
+ }
175
+ }
176
+ return cbor;
177
+ }
178
+
179
+ export function serialiseStabilityPoolRedeemer(
180
+ params: StabilityPoolRedeemer,
181
+ ): string {
182
+ return Data.to<StabilityPoolRedeemer>(params, StabilityPoolRedeemer);
183
+ }
184
+
185
+ /** SP Parameters */
186
+ const StabilityPoolParamsSchema = Data.Object({
187
+ assetSymbol: Data.Bytes(),
188
+ stabilityPoolToken: AssetClassSchema,
189
+ snapshotEpochToScaleToSumToken: AssetClassSchema,
190
+ accountToken: AssetClassSchema,
191
+ cdpToken: AssetClassSchema,
192
+ iAssetAuthToken: AssetClassSchema,
193
+ versionRecordToken: AssetClassSchema,
194
+ collectorValHash: Data.Bytes(),
195
+ govNFT: AssetClassSchema,
196
+ accountCreateFeeLovelaces: Data.Integer(),
197
+ accountAdjustmentFeeLovelaces: Data.Integer(),
198
+ requestCollateralLovelaces: Data.Integer(),
199
+ });
200
+ export type StabilityPoolParams = Data.Static<typeof StabilityPoolParamsSchema>;
201
+ export const StabilityPoolParams =
202
+ StabilityPoolParamsSchema as unknown as StabilityPoolParams;
203
+
204
+ export function castStabilityPoolParams(params: StabilityPoolParams): Data {
205
+ return Data.castTo(params, StabilityPoolParams);
206
+ }
207
+
208
+ /** SP Integer */
209
+ const spPrecision: bigint = 1000000000000000000n;
210
+
211
+ export function mkSPInteger(value: bigint): SPInteger {
212
+ return { value: value * spPrecision };
213
+ }
214
+
215
+ export function fromSPInteger(value: SPInteger): bigint {
216
+ return value.value / spPrecision;
217
+ }
218
+
219
+ export function spAdd(a: SPInteger, b: SPInteger): SPInteger {
220
+ return { value: a.value + b.value };
221
+ }
222
+
223
+ export function spSub(a: SPInteger, b: SPInteger): SPInteger {
224
+ return { value: a.value - b.value };
225
+ }
226
+
227
+ export function spMul(a: SPInteger, b: SPInteger): SPInteger {
228
+ return { value: (a.value * b.value) / spPrecision };
229
+ }
230
+
231
+ export function spDiv(a: SPInteger, b: SPInteger): SPInteger {
232
+ return { value: (a.value * spPrecision) / b.value };
233
+ }
@@ -0,0 +1,99 @@
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
+ }
@@ -1,5 +1,5 @@
1
1
  import { Data } from '@lucid-evolution/lucid';
2
- import { AssetClassSchema } from '../../types/generic';
2
+ import { AssetClassSchema } from '../generic';
3
3
 
4
4
  const VersionRecordTokenParamsSchema = Data.Object({
5
5
  upgradeToken: AssetClassSchema,
@@ -7,16 +7,6 @@ export const OnChainDecimalSchema = Data.Object({
7
7
  });
8
8
  export type OnChainDecimal = Data.Static<typeof OnChainDecimalSchema>;
9
9
 
10
- export function ocdCeil(a: OnChainDecimal): bigint {
11
- const whole = a.getOnChainInt / OCD_DECIMAL_UNIT;
12
-
13
- return a.getOnChainInt > whole * OCD_DECIMAL_UNIT ? whole + 1n : whole;
14
- }
15
-
16
- export function ocdNegate(a: OnChainDecimal): OnChainDecimal {
17
- return { getOnChainInt: -a.getOnChainInt };
18
- }
19
-
20
10
  export function ocdMul(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
21
11
  return {
22
12
  getOnChainInt: (a.getOnChainInt * b.getOnChainInt) / OCD_DECIMAL_UNIT,
@@ -29,17 +19,5 @@ export function ocdDiv(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
29
19
  };
30
20
  }
31
21
 
32
- export function ocdAdd(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
33
- return {
34
- getOnChainInt: a.getOnChainInt + b.getOnChainInt,
35
- };
36
- }
37
-
38
- export function ocdSub(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
39
- return {
40
- getOnChainInt: a.getOnChainInt - b.getOnChainInt,
41
- };
42
- }
43
-
44
22
  export const OCD_ONE: OnChainDecimal = { getOnChainInt: 1_000_000n };
45
23
  export const OCD_ZERO: OnChainDecimal = { getOnChainInt: 0n };
@@ -1,4 +1,4 @@
1
- import { Credential, fromText, OutRef, toText } from '@lucid-evolution/lucid';
1
+ import { fromText, toText } from '@lucid-evolution/lucid';
2
2
  import { AssetClass, CurrencySymbol, TokenName } from './generic';
3
3
 
4
4
  /**
@@ -9,9 +9,9 @@ export type AssetClassSP = [CurrencySymbol, TokenName];
9
9
  export interface SystemParams {
10
10
  versionRecordParams: VersionRecordParams;
11
11
  validatorHashes: ValidatorHashes;
12
- treasuryParams: TreasuryParamsSP;
12
+ treasuryParams: TreasuryParams;
13
13
  startTime: StartTime;
14
- stakingParams: StakingParamsSP;
14
+ stakingParams: StakingParams;
15
15
  stabilityPoolParams: StabilityPoolParamsSP;
16
16
  scriptReferences: ScriptReferences;
17
17
  pollShardParams: PollShardParamsSP;
@@ -21,8 +21,8 @@ export interface SystemParams {
21
21
  govParams: GovParamsSP;
22
22
  executeParams: ExecuteParamsSP;
23
23
  distributionParams: DistributionParams;
24
- collectorParams: CollectorParamsSP;
25
- cdpParams: CdpParamsSP;
24
+ collectorParams: CollectorParams;
25
+ cdpParams: CdpParams;
26
26
  cdpCreatorParams: CDPCreatorParamsSP;
27
27
  }
28
28
  export type ValidatorHashes = {
@@ -57,7 +57,7 @@ export interface PubKeyHash {
57
57
  export interface VersionRecordParams {
58
58
  upgradeToken: AssetClassSP;
59
59
  }
60
- export interface TreasuryParamsSP {
60
+ export interface TreasuryParams {
61
61
  upgradeToken: AssetClassSP;
62
62
  versionRecordToken: AssetClassSP;
63
63
  treasuryUtxosStakeCredential?: ScriptCredential;
@@ -66,7 +66,7 @@ export interface StartTime {
66
66
  slot: number;
67
67
  blockHeader: string;
68
68
  }
69
- export interface StakingParamsSP {
69
+ export interface StakingParams {
70
70
  versionRecordToken: AssetClassSP;
71
71
  stakingToken: AssetClassSP;
72
72
  stakingManagerNFT: AssetClassSP;
@@ -90,6 +90,7 @@ export interface StabilityPoolParamsSP {
90
90
  }
91
91
 
92
92
  export interface ScriptReferences {
93
+ vestingValidatorRef: ScriptReference;
93
94
  versionRegistryValidatorRef: ScriptReference;
94
95
  versionRecordTokenPolicyRef: ScriptReference;
95
96
  treasuryValidatorRef: ScriptReference;
@@ -98,6 +99,7 @@ export interface ScriptReferences {
98
99
  pollShardValidatorRef: ScriptReference;
99
100
  pollManagerValidatorRef: ScriptReference;
100
101
  lrpValidatorRef: ScriptReference;
102
+ liquidityValidatorRef: ScriptReference;
101
103
  iAssetTokenPolicyRef: ScriptReference;
102
104
  governanceValidatorRef: ScriptReference;
103
105
  executeValidatorRef: ScriptReference;
@@ -145,10 +147,8 @@ export interface AuthTokenPolicies {
145
147
  upgradeTokenRef: ScriptReference;
146
148
  stakingTokenRef: ScriptReference;
147
149
  stabilityPoolTokenRef: ScriptReference;
148
- stabilityPoolAuthTokenRef: ScriptReference;
149
150
  snapshotEpochToScaleToSumTokenRef: ScriptReference;
150
151
  pollManagerTokenRef: ScriptReference;
151
- iAssetAuthTokenRef: ScriptReference;
152
152
  iAssetTokenRef: ScriptReference;
153
153
  cdpAuthTokenRef: ScriptReference;
154
154
  accountTokenRef: ScriptReference;
@@ -191,7 +191,6 @@ export interface GovParamsSP {
191
191
  gBiasTime: bigint;
192
192
  daoIdentityToken: AssetClassSP;
193
193
  }
194
-
195
194
  export interface ExecuteParamsSP {
196
195
  govNFT: AssetClassSP;
197
196
  upgradeToken: AssetClassSP;
@@ -209,12 +208,12 @@ export interface DistributionParams {
209
208
  totalINDYSupply: number;
210
209
  initialIndyDistribution: number;
211
210
  }
212
- export interface CollectorParamsSP {
211
+ export interface CollectorParams {
213
212
  versionRecordToken: AssetClassSP;
214
213
  stakingToken: AssetClassSP;
215
214
  stakingManagerNFT: AssetClassSP;
216
215
  }
217
- export interface CdpParamsSP {
216
+ export interface CdpParams {
218
217
  versionRecordToken: AssetClassSP;
219
218
  upgradeToken: AssetClassSP;
220
219
  treasuryValHash: string;
@@ -255,13 +254,3 @@ export function fromSystemParamsAsset(asset: AssetClassSP): AssetClass {
255
254
  tokenName: fromText(asset[1].unTokenName),
256
255
  };
257
256
  }
258
-
259
- export function fromSystemParamsScriptRef(ref: ScriptReference): OutRef {
260
- return { outputIndex: ref.input.index, txHash: ref.input.transactionId };
261
- }
262
-
263
- export function fromSysParamsScriptCredential(
264
- cred: ScriptCredential,
265
- ): Credential {
266
- return { type: 'Script', hash: cred.contents.contents };
267
- }