@indigo-labs/indigo-sdk 0.1.3 → 0.1.4
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/package.json +4 -1
- package/.github/workflows/ci.yml +0 -62
- package/.github/workflows/test.yml +0 -44
- package/.husky/pre-commit +0 -1
- package/.nvmrc +0 -1
- package/.prettierrc +0 -6
- package/eslint.config.mjs +0 -35
- package/src/contracts/cdp.ts +0 -741
- 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/lrp.ts +0 -223
- package/src/contracts/one-shot.ts +0 -67
- package/src/contracts/stability-pool.ts +0 -684
- package/src/contracts/staking.ts +0 -348
- package/src/contracts/treasury.ts +0 -112
- package/src/helpers/asset-helpers.ts +0 -57
- package/src/helpers/helper-txs.ts +0 -30
- package/src/helpers/helpers.ts +0 -38
- package/src/helpers/indigo-helpers.ts +0 -19
- package/src/helpers/interest-oracle.ts +0 -57
- package/src/helpers/lucid-utils.ts +0 -70
- package/src/helpers/price-oracle-helpers.ts +0 -36
- package/src/helpers/stability-pool-helpers.ts +0 -207
- package/src/helpers/staking-helpers.ts +0 -94
- package/src/helpers/time-helpers.ts +0 -4
- package/src/helpers/value-helpers.ts +0 -16
- package/src/index.ts +0 -34
- package/src/scripts/always-fail-validator.ts +0 -7
- package/src/scripts/auth-token-policy.ts +0 -23
- package/src/scripts/cdp-creator-validator.ts +0 -53
- package/src/scripts/cdp-validator.ts +0 -9
- package/src/scripts/collector-validator.ts +0 -8
- package/src/scripts/execute-validator.ts +0 -52
- package/src/scripts/gov-validator.ts +0 -44
- package/src/scripts/iasset-policy.ts +0 -22
- package/src/scripts/interest-oracle-validator.ts +0 -23
- package/src/scripts/lrp-validator.ts +0 -23
- package/src/scripts/one-shot-policy.ts +0 -62
- package/src/scripts/poll-manager-validator.ts +0 -52
- package/src/scripts/poll-shard-validator.ts +0 -47
- package/src/scripts/price-oracle-validator.ts +0 -26
- package/src/scripts/stability-pool-validator.ts +0 -60
- package/src/scripts/staking-validator.ts +0 -8
- package/src/scripts/treasury-validator.ts +0 -8
- package/src/scripts/version-record-policy.ts +0 -26
- package/src/scripts/version-registry.ts +0 -15
- package/src/types/generic.ts +0 -106
- package/src/types/indigo/cdp-creator.ts +0 -46
- 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/interest-oracle.ts +0 -55
- package/src/types/indigo/lrp.ts +0 -54
- package/src/types/indigo/poll-manager.ts +0 -21
- package/src/types/indigo/poll-shard.ts +0 -16
- package/src/types/indigo/price-oracle.ts +0 -38
- package/src/types/indigo/stability-pool.ts +0 -233
- package/src/types/indigo/staking.ts +0 -99
- package/src/types/indigo/version-record.ts +0 -17
- package/src/types/on-chain-decimal.ts +0 -23
- package/src/types/one-shot.ts +0 -22
- package/src/types/system-params.ts +0 -246
- package/tests/data/system-params.json +0 -989
- package/tests/datums.test.ts +0 -286
- package/tests/endpoints/initialize.ts +0 -1013
- package/tests/hash-checks.test.ts +0 -73
- package/tests/indigo-test-helpers.ts +0 -115
- package/tests/initialize.test.ts +0 -27
- package/tests/interest-calculations.test.ts +0 -120
- package/tests/interest-oracle.test.ts +0 -90
- package/tests/lrp.test.ts +0 -149
- package/tests/queries/governance-queries.ts +0 -31
- package/tests/queries/iasset-queries.ts +0 -39
- package/tests/queries/interest-oracle-queries.ts +0 -13
- package/tests/queries/lrp-queries.ts +0 -39
- package/tests/queries/price-oracle-queries.ts +0 -27
- package/tests/queries/stability-pool-queries.ts +0 -75
- package/tests/queries/staking-queries.ts +0 -43
- package/tests/stability-pool.test.ts +0 -364
- package/tests/staking.test.ts +0 -105
- package/tests/test-helpers.ts +0 -38
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -16
- package/vitest.config.ts +0 -9
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { fromText, toText } from '@lucid-evolution/lucid';
|
|
2
|
-
import { AssetClass, CurrencySymbol, TokenName } from './generic';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* AssetClassSP used in System Params
|
|
6
|
-
*/
|
|
7
|
-
export type AssetClassSP = [CurrencySymbol, TokenName];
|
|
8
|
-
|
|
9
|
-
export interface SystemParams {
|
|
10
|
-
versionRecordParams: VersionRecordParams;
|
|
11
|
-
validatorHashes: ValidatorHashes;
|
|
12
|
-
treasuryParams: TreasuryParams;
|
|
13
|
-
startTime: StartTime;
|
|
14
|
-
stakingParams: StakingParams;
|
|
15
|
-
stabilityPoolParams: StabilityPoolParamsSP;
|
|
16
|
-
scriptReferences: ScriptReferences;
|
|
17
|
-
pollShardParams: PollShardParamsSP;
|
|
18
|
-
pollManagerParams: PollManagerParamsSP;
|
|
19
|
-
indyToken: AssetClassSP;
|
|
20
|
-
govParams: GovParamsSP;
|
|
21
|
-
executeParams: ExecuteParamsSP;
|
|
22
|
-
distributionParams: DistributionParams;
|
|
23
|
-
collectorParams: CollectorParams;
|
|
24
|
-
cdpParams: CdpParams;
|
|
25
|
-
cdpCreatorParams: CDPCreatorParamsSP;
|
|
26
|
-
}
|
|
27
|
-
export type ValidatorHashes = {
|
|
28
|
-
versionRegistryHash: string;
|
|
29
|
-
treasuryHash: string;
|
|
30
|
-
stakingHash: string;
|
|
31
|
-
stabilityPoolHash: string;
|
|
32
|
-
pollShardHash: string;
|
|
33
|
-
pollManagerHash: string;
|
|
34
|
-
govHash: string;
|
|
35
|
-
executeHash: string;
|
|
36
|
-
collectorHash: string;
|
|
37
|
-
cdpHash: string;
|
|
38
|
-
cdpCreatorHash: string;
|
|
39
|
-
};
|
|
40
|
-
export interface AddressCredential {
|
|
41
|
-
tag: string;
|
|
42
|
-
contents: PubKeyHash;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface ScriptCredential {
|
|
46
|
-
tag: string;
|
|
47
|
-
contents: {
|
|
48
|
-
tag: string;
|
|
49
|
-
contents: string;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export interface PubKeyHash {
|
|
53
|
-
getPubKeyHash: string;
|
|
54
|
-
}
|
|
55
|
-
export interface VersionRecordParams {
|
|
56
|
-
upgradeToken: AssetClassSP;
|
|
57
|
-
}
|
|
58
|
-
export interface TreasuryParams {
|
|
59
|
-
upgradeToken: AssetClassSP;
|
|
60
|
-
versionRecordToken: AssetClassSP;
|
|
61
|
-
treasuryUtxosStakeCredential?: ScriptCredential;
|
|
62
|
-
}
|
|
63
|
-
export interface StartTime {
|
|
64
|
-
slot: number;
|
|
65
|
-
blockHeader: string;
|
|
66
|
-
}
|
|
67
|
-
export interface StakingParams {
|
|
68
|
-
versionRecordToken: AssetClassSP;
|
|
69
|
-
stakingToken: AssetClassSP;
|
|
70
|
-
stakingManagerNFT: AssetClassSP;
|
|
71
|
-
pollToken: AssetClassSP;
|
|
72
|
-
indyToken: AssetClassSP;
|
|
73
|
-
collectorValHash: string;
|
|
74
|
-
}
|
|
75
|
-
export interface StabilityPoolParamsSP {
|
|
76
|
-
versionRecordToken: AssetClassSP;
|
|
77
|
-
stabilityPoolToken: AssetClassSP;
|
|
78
|
-
snapshotEpochToScaleToSumToken: AssetClassSP;
|
|
79
|
-
requestCollateralLovelaces: number;
|
|
80
|
-
iAssetAuthToken: AssetClassSP;
|
|
81
|
-
govNFT: AssetClassSP;
|
|
82
|
-
collectorValHash: string;
|
|
83
|
-
cdpToken: AssetClassSP;
|
|
84
|
-
assetSymbol: CurrencySymbol;
|
|
85
|
-
accountToken: AssetClassSP;
|
|
86
|
-
accountCreateFeeLovelaces: number;
|
|
87
|
-
accountAdjustmentFeeLovelaces: number;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface ScriptReferences {
|
|
91
|
-
vestingValidatorRef: ScriptReference;
|
|
92
|
-
versionRegistryValidatorRef: ScriptReference;
|
|
93
|
-
versionRecordTokenPolicyRef: ScriptReference;
|
|
94
|
-
treasuryValidatorRef: ScriptReference;
|
|
95
|
-
stakingValidatorRef: ScriptReference;
|
|
96
|
-
stabilityPoolValidatorRef: ScriptReference;
|
|
97
|
-
pollShardValidatorRef: ScriptReference;
|
|
98
|
-
pollManagerValidatorRef: ScriptReference;
|
|
99
|
-
liquidityValidatorRef: ScriptReference;
|
|
100
|
-
iAssetTokenPolicyRef: ScriptReference;
|
|
101
|
-
governanceValidatorRef: ScriptReference;
|
|
102
|
-
executeValidatorRef: ScriptReference;
|
|
103
|
-
collectorValidatorRef: ScriptReference;
|
|
104
|
-
cdpValidatorRef: ScriptReference;
|
|
105
|
-
cdpCreatorValidatorRef: ScriptReference;
|
|
106
|
-
authTokenPolicies: AuthTokenPolicies;
|
|
107
|
-
}
|
|
108
|
-
export interface Output {
|
|
109
|
-
scriptRef: ScriptRef;
|
|
110
|
-
output: ScriptOutput;
|
|
111
|
-
}
|
|
112
|
-
export interface ScriptRef {
|
|
113
|
-
tag: string;
|
|
114
|
-
contents?: string[] | null;
|
|
115
|
-
}
|
|
116
|
-
export interface ScriptOutput {
|
|
117
|
-
referenceScript: string;
|
|
118
|
-
datum: AddressCredentialOrDatum;
|
|
119
|
-
amount: Amount;
|
|
120
|
-
address: AddressSP;
|
|
121
|
-
}
|
|
122
|
-
export interface AddressCredentialOrDatum {
|
|
123
|
-
tag: string;
|
|
124
|
-
contents: string;
|
|
125
|
-
}
|
|
126
|
-
export interface Amount {
|
|
127
|
-
getValue?: ((CurrencySymbol | (number[] | null)[] | null)[] | null)[] | null;
|
|
128
|
-
}
|
|
129
|
-
export interface AddressSP {
|
|
130
|
-
addressStakingCredential?: null;
|
|
131
|
-
addressCredential: AddressCredentialOrDatum;
|
|
132
|
-
}
|
|
133
|
-
export interface Input {
|
|
134
|
-
transactionId: string;
|
|
135
|
-
index: number;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface ScriptReference {
|
|
139
|
-
output?: Output;
|
|
140
|
-
input: Input;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface AuthTokenPolicies {
|
|
144
|
-
upgradeTokenRef: ScriptReference;
|
|
145
|
-
stakingTokenRef: ScriptReference;
|
|
146
|
-
stabilityPoolTokenRef: ScriptReference;
|
|
147
|
-
snapshotEpochToScaleToSumTokenRef: ScriptReference;
|
|
148
|
-
pollManagerTokenRef: ScriptReference;
|
|
149
|
-
iAssetTokenRef: ScriptReference;
|
|
150
|
-
cdpAuthTokenRef: ScriptReference;
|
|
151
|
-
accountTokenRef: ScriptReference;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface PollShardParamsSP {
|
|
155
|
-
stakingValHash: string;
|
|
156
|
-
stakingToken: AssetClassSP;
|
|
157
|
-
pollToken: AssetClassSP;
|
|
158
|
-
indyAsset: AssetClassSP;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export interface PollManagerParamsSP {
|
|
162
|
-
upgradeToken: AssetClassSP;
|
|
163
|
-
treasuryValHash: string;
|
|
164
|
-
shardsValHash: string;
|
|
165
|
-
pollToken: AssetClassSP;
|
|
166
|
-
pBiasTime: bigint;
|
|
167
|
-
initialIndyDistribution: bigint;
|
|
168
|
-
indyAsset: AssetClassSP;
|
|
169
|
-
govNFT: AssetClassSP;
|
|
170
|
-
govExecuteValHash: string;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export interface GovParamsSP {
|
|
174
|
-
versionRecordToken: AssetClassSP;
|
|
175
|
-
upgradeToken: AssetClassSP;
|
|
176
|
-
pollToken: AssetClassSP;
|
|
177
|
-
pollManagerValHash: string;
|
|
178
|
-
indyAsset: AssetClassSP;
|
|
179
|
-
iAssetAuthToken: AssetClassSP;
|
|
180
|
-
govNFT: AssetClassSP;
|
|
181
|
-
gBiasTime: bigint;
|
|
182
|
-
daoIdentityToken: AssetClassSP;
|
|
183
|
-
}
|
|
184
|
-
export interface ExecuteParamsSP {
|
|
185
|
-
govNFT: AssetClassSP;
|
|
186
|
-
upgradeToken: AssetClassSP;
|
|
187
|
-
iAssetToken: AssetClassSP;
|
|
188
|
-
stabilityPoolToken: AssetClassSP;
|
|
189
|
-
versionRecordToken: AssetClassSP;
|
|
190
|
-
cdpValHash: string;
|
|
191
|
-
sPoolValHash: string;
|
|
192
|
-
versionRegistryValHash: string;
|
|
193
|
-
treasuryValHash: string;
|
|
194
|
-
indyAsset: AssetClassSP;
|
|
195
|
-
}
|
|
196
|
-
export interface DistributionParams {
|
|
197
|
-
treasuryIndyAmount: number;
|
|
198
|
-
totalINDYSupply: number;
|
|
199
|
-
initialIndyDistribution: number;
|
|
200
|
-
}
|
|
201
|
-
export interface CollectorParams {
|
|
202
|
-
versionRecordToken: AssetClassSP;
|
|
203
|
-
stakingToken: AssetClassSP;
|
|
204
|
-
stakingManagerNFT: AssetClassSP;
|
|
205
|
-
}
|
|
206
|
-
export interface CdpParams {
|
|
207
|
-
versionRecordToken: AssetClassSP;
|
|
208
|
-
upgradeToken: AssetClassSP;
|
|
209
|
-
treasuryValHash: string;
|
|
210
|
-
stabilityPoolAuthToken: AssetClassSP;
|
|
211
|
-
spValHash: string;
|
|
212
|
-
partialRedemptionExtraFeeLovelace: number;
|
|
213
|
-
minCollateralInLovelace: number;
|
|
214
|
-
iAssetAuthToken: AssetClassSP;
|
|
215
|
-
govNFT: AssetClassSP;
|
|
216
|
-
collectorValHash: string;
|
|
217
|
-
cdpAuthToken: AssetClassSP;
|
|
218
|
-
cdpAssetSymbol: CurrencySymbol;
|
|
219
|
-
biasTime: number;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export interface CDPCreatorParamsSP {
|
|
223
|
-
versionRecordToken: AssetClassSP;
|
|
224
|
-
minCollateralInLovelace: number;
|
|
225
|
-
iAssetAuthTk: AssetClassSP;
|
|
226
|
-
collectorValHash: string;
|
|
227
|
-
cdpScriptHash: string;
|
|
228
|
-
cdpCreatorNft: AssetClassSP;
|
|
229
|
-
cdpAuthTk: AssetClassSP;
|
|
230
|
-
cdpAssetCs: CurrencySymbol;
|
|
231
|
-
biasTime: bigint;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export function toSystemParamsAsset(asset: AssetClass): AssetClassSP {
|
|
235
|
-
return [
|
|
236
|
-
{ unCurrencySymbol: asset.currencySymbol },
|
|
237
|
-
{ unTokenName: toText(asset.tokenName) },
|
|
238
|
-
];
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export function fromSystemParamsAsset(asset: AssetClassSP): AssetClass {
|
|
242
|
-
return {
|
|
243
|
-
currencySymbol: asset[0].unCurrencySymbol,
|
|
244
|
-
tokenName: fromText(asset[1].unTokenName),
|
|
245
|
-
};
|
|
246
|
-
}
|