@indigo-labs/indigo-sdk 0.2.36 → 0.2.37
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/dist/index.d.mts +575 -2
- package/dist/index.d.ts +575 -2
- package/dist/index.js +915 -0
- package/dist/index.mjs +896 -0
- package/package.json +6 -3
- package/src/contracts/initialize/helpers.ts +45 -0
- package/{tests/endpoints/initialize.ts → src/contracts/initialize/transactions.ts} +240 -264
- package/src/contracts/initialize/types.ts +42 -0
- package/src/contracts/vesting/helpers.ts +2 -2
- package/src/index.ts +7 -0
- package/src/utils/lucid-utils.ts +9 -0
- package/tests/cdp.test.ts +1 -1
- package/tests/gov.test.ts +1 -1
- package/tests/initialize.test.ts +1 -1
- package/tests/lrp-leverage.test.ts +1 -1
- package/tests/lrp.test.ts +1 -1
- package/tests/mock/assets-mock.ts +2 -29
- package/tests/stability-pool.test.ts +1 -1
- package/tests/staking.test.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
ACCOUNT_TOKEN_NAME: () => ACCOUNT_TOKEN_NAME,
|
|
34
|
+
ALWAYS_FAIL_VALIDATOR_HASH: () => ALWAYS_FAIL_VALIDATOR_HASH,
|
|
33
35
|
AccountContentSchema: () => AccountContentSchema,
|
|
34
36
|
ActionReturnDatum: () => ActionReturnDatum,
|
|
35
37
|
ActionReturnDatumSchema: () => ActionReturnDatumSchema,
|
|
@@ -41,16 +43,22 @@ __export(index_exports, {
|
|
|
41
43
|
CDPCreatorRedeemer: () => CDPCreatorRedeemer,
|
|
42
44
|
CDPDatumSchema: () => CDPDatumSchema,
|
|
43
45
|
CDPFeesSchema: () => CDPFeesSchema,
|
|
46
|
+
CDP_CREATOR_TOKEN_NAME: () => CDP_CREATOR_TOKEN_NAME,
|
|
47
|
+
CDP_TOKEN_NAME: () => CDP_TOKEN_NAME,
|
|
44
48
|
CredentialD: () => CredentialD,
|
|
45
49
|
CredentialSchema: () => CredentialSchema,
|
|
50
|
+
DAO_TOKEN_NAME: () => DAO_TOKEN_NAME,
|
|
46
51
|
EpochToScaleToSumSchema: () => EpochToScaleToSumSchema,
|
|
47
52
|
ExecuteDatum: () => ExecuteDatum,
|
|
48
53
|
ExecuteParams: () => ExecuteParams,
|
|
49
54
|
FeedInterestOracleRedeemerSchema: () => FeedInterestOracleRedeemerSchema,
|
|
55
|
+
GOV_NFT_TOKEN_NAME: () => GOV_NFT_TOKEN_NAME,
|
|
50
56
|
GovParams: () => GovParams,
|
|
51
57
|
GovRedeemer: () => GovRedeemer,
|
|
58
|
+
IASSET_TOKEN_NAME: () => IASSET_TOKEN_NAME,
|
|
52
59
|
IAssetContentSchema: () => IAssetContentSchema,
|
|
53
60
|
IAssetPriceInfoSchema: () => IAssetPriceInfoSchema,
|
|
61
|
+
INDY_TOKEN_NAME: () => INDY_TOKEN_NAME,
|
|
54
62
|
InterestOracleDatumSchema: () => InterestOracleDatumSchema,
|
|
55
63
|
InterestOracleParamsSchema: () => InterestOracleParamsSchema,
|
|
56
64
|
LRPDatumSchema: () => LRPDatumSchema,
|
|
@@ -58,26 +66,44 @@ __export(index_exports, {
|
|
|
58
66
|
LRPRedeemerSchema: () => LRPRedeemerSchema,
|
|
59
67
|
MAX_REDEMPTIONS_WITH_CDP_OPEN: () => MAX_REDEMPTIONS_WITH_CDP_OPEN,
|
|
60
68
|
MIN_LRP_COLLATERAL_AMT: () => MIN_LRP_COLLATERAL_AMT,
|
|
69
|
+
NUM_CDP_CREATORS: () => NUM_CDP_CREATORS,
|
|
70
|
+
NUM_COLLECTORS: () => NUM_COLLECTORS,
|
|
61
71
|
ONE_DAY: () => ONE_DAY,
|
|
62
72
|
ONE_HOUR: () => ONE_HOUR,
|
|
63
73
|
ONE_SECOND: () => ONE_SECOND,
|
|
64
74
|
ONE_YEAR: () => ONE_YEAR,
|
|
65
75
|
OracleAssetNftSchema: () => OracleAssetNftSchema,
|
|
66
76
|
OutputReferenceSchema: () => OutputReferenceSchema,
|
|
77
|
+
POLL_MANAGER_TOKEN_NAME: () => POLL_MANAGER_TOKEN_NAME,
|
|
78
|
+
PollDatum: () => PollDatum,
|
|
67
79
|
PollManagerParams: () => PollManagerParams,
|
|
68
80
|
PollManagerRedeemer: () => PollManagerRedeemer,
|
|
69
81
|
PollShardParams: () => PollShardParams,
|
|
70
82
|
PollShardRedeemer: () => PollShardRedeemer,
|
|
71
83
|
PriceOracleDatumSchema: () => PriceOracleDatumSchema,
|
|
72
84
|
PriceOracleParamsSchema: () => PriceOracleParamsSchema,
|
|
85
|
+
ProposalContent: () => ProposalContent,
|
|
86
|
+
ProposalContentSchema: () => ProposalContentSchema,
|
|
87
|
+
ProtocolParams: () => ProtocolParams,
|
|
88
|
+
ProtocolParamsSchema: () => ProtocolParamsSchema,
|
|
89
|
+
SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME: () => SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME,
|
|
73
90
|
SPIntegerSchema: () => SPIntegerSchema,
|
|
91
|
+
STABILITY_POOL_TOKEN_NAME: () => STABILITY_POOL_TOKEN_NAME,
|
|
92
|
+
STAKING_MANAGER_TOKEN_NAME: () => STAKING_MANAGER_TOKEN_NAME,
|
|
93
|
+
STAKING_TOKEN_NAME: () => STAKING_TOKEN_NAME,
|
|
74
94
|
SnapshotEpochToScaleToSumContentSchema: () => SnapshotEpochToScaleToSumContentSchema,
|
|
75
95
|
StabilityPoolContentSchema: () => StabilityPoolContentSchema,
|
|
76
96
|
StabilityPoolDatumSchema: () => StabilityPoolDatumSchema,
|
|
77
97
|
StabilityPoolParams: () => StabilityPoolParams,
|
|
78
98
|
StabilityPoolRedeemerSchema: () => StabilityPoolRedeemerSchema,
|
|
79
99
|
StakeCredentialSchema: () => StakeCredentialSchema,
|
|
100
|
+
TOTAL_INDY_SUPPLY: () => TOTAL_INDY_SUPPLY,
|
|
101
|
+
TREASURY_INDY_AMOUNT: () => TREASURY_INDY_AMOUNT,
|
|
102
|
+
TreasuryParams: () => TreasuryParams,
|
|
103
|
+
TreasuryParamsSchema: () => TreasuryParamsSchema,
|
|
80
104
|
TreasuryWithdrawalSchema: () => TreasuryWithdrawalSchema,
|
|
105
|
+
UPGRADE_TOKEN_NAME: () => UPGRADE_TOKEN_NAME,
|
|
106
|
+
VERSION_RECORD_TOKEN_NAME: () => VERSION_RECORD_TOKEN_NAME,
|
|
81
107
|
VerificationKeyHashSchema: () => VerificationKeyHashSchema,
|
|
82
108
|
VersionRecordTokenParams: () => VersionRecordTokenParams,
|
|
83
109
|
addrDetails: () => addrDetails,
|
|
@@ -116,6 +142,7 @@ __export(index_exports, {
|
|
|
116
142
|
castPriceOracleParams: () => castPriceOracleParams,
|
|
117
143
|
castStabilityPoolParams: () => castStabilityPoolParams,
|
|
118
144
|
castStakingParams: () => castStakingParams,
|
|
145
|
+
castTreasuryParams: () => castTreasuryParams,
|
|
119
146
|
castVersionRecordTokenParams: () => castVersionRecordTokenParams,
|
|
120
147
|
cdpCollateralRatioPercentage: () => cdpCollateralRatioPercentage,
|
|
121
148
|
claimLrp: () => claimLrp,
|
|
@@ -147,6 +174,7 @@ __export(index_exports, {
|
|
|
147
174
|
getInlineDatumOrThrow: () => getInlineDatumOrThrow,
|
|
148
175
|
getRandomElement: () => getRandomElement,
|
|
149
176
|
getSumFromEpochToScaleToSum: () => getSumFromEpochToScaleToSum,
|
|
177
|
+
init: () => init,
|
|
150
178
|
initEpochToScaleToSumMap: () => initEpochToScaleToSumMap,
|
|
151
179
|
initSpSnapshot: () => initSpSnapshot,
|
|
152
180
|
insertSorted: () => insertSorted,
|
|
@@ -198,12 +226,17 @@ __export(index_exports, {
|
|
|
198
226
|
parseInterestOracleDatum: () => parseInterestOracleDatum,
|
|
199
227
|
parseLrpDatum: () => parseLrpDatum,
|
|
200
228
|
parseLrpDatumOrThrow: () => parseLrpDatumOrThrow,
|
|
229
|
+
parsePollManager: () => parsePollManager,
|
|
230
|
+
parsePollManagerOrThrow: () => parsePollManagerOrThrow,
|
|
231
|
+
parsePollShard: () => parsePollShard,
|
|
232
|
+
parsePollShardOrThrow: () => parsePollShardOrThrow,
|
|
201
233
|
parsePriceOracleDatum: () => parsePriceOracleDatum,
|
|
202
234
|
parseSnapshotEpochToScaleToSumDatum: () => parseSnapshotEpochToScaleToSumDatum,
|
|
203
235
|
parseStabilityPoolDatum: () => parseStabilityPoolDatum,
|
|
204
236
|
parseStakingManagerDatum: () => parseStakingManagerDatum,
|
|
205
237
|
parseStakingPosition: () => parseStakingPosition,
|
|
206
238
|
parseStakingPositionOrThrow: () => parseStakingPositionOrThrow,
|
|
239
|
+
parseUpgradePaths: () => parseUpgradePaths,
|
|
207
240
|
processSpRequest: () => processSpRequest,
|
|
208
241
|
randomLrpsSubsetSatisfyingTargetLovelaces: () => randomLrpsSubsetSatisfyingTargetLovelaces,
|
|
209
242
|
redeemCdp: () => redeemCdp,
|
|
@@ -217,6 +250,7 @@ __export(index_exports, {
|
|
|
217
250
|
serialiseCDPCreatorRedeemer: () => serialiseCDPCreatorRedeemer,
|
|
218
251
|
serialiseCdpDatum: () => serialiseCdpDatum,
|
|
219
252
|
serialiseCdpRedeemer: () => serialiseCdpRedeemer,
|
|
253
|
+
serialiseCollectorRedeemer: () => serialiseCollectorRedeemer,
|
|
220
254
|
serialiseExecuteDatum: () => serialiseExecuteDatum,
|
|
221
255
|
serialiseFeedInterestOracleRedeemer: () => serialiseFeedInterestOracleRedeemer,
|
|
222
256
|
serialiseGovDatum: () => serialiseGovDatum,
|
|
@@ -225,6 +259,7 @@ __export(index_exports, {
|
|
|
225
259
|
serialiseInterestOracleDatum: () => serialiseInterestOracleDatum,
|
|
226
260
|
serialiseLrpDatum: () => serialiseLrpDatum,
|
|
227
261
|
serialiseLrpRedeemer: () => serialiseLrpRedeemer,
|
|
262
|
+
serialisePollDatum: () => serialisePollDatum,
|
|
228
263
|
serialisePollManagerRedeemer: () => serialisePollManagerRedeemer,
|
|
229
264
|
serialisePollShardRedeemer: () => serialisePollShardRedeemer,
|
|
230
265
|
serialisePriceOracleDatum: () => serialisePriceOracleDatum,
|
|
@@ -233,6 +268,10 @@ __export(index_exports, {
|
|
|
233
268
|
serialiseStabilityPoolRedeemer: () => serialiseStabilityPoolRedeemer,
|
|
234
269
|
serialiseStakingDatum: () => serialiseStakingDatum,
|
|
235
270
|
serialiseStakingRedeemer: () => serialiseStakingRedeemer,
|
|
271
|
+
serialiseTreasuryDatum: () => serialiseTreasuryDatum,
|
|
272
|
+
serialiseTreasuryRedeemer: () => serialiseTreasuryRedeemer,
|
|
273
|
+
serialiseUpgradePaths: () => serialiseUpgradePaths,
|
|
274
|
+
serialiseWithdrawalOutputDatum: () => serialiseWithdrawalOutputDatum,
|
|
236
275
|
setSumInEpochToScaleToSum: () => setSumInEpochToScaleToSum,
|
|
237
276
|
shuffle: () => shuffle,
|
|
238
277
|
spAdd: () => spAdd,
|
|
@@ -240,10 +279,12 @@ __export(index_exports, {
|
|
|
240
279
|
spMul: () => spMul,
|
|
241
280
|
spSub: () => spSub,
|
|
242
281
|
startInterestOracle: () => startInterestOracle,
|
|
282
|
+
submitAndAwaitTx: () => submitAndAwaitTx,
|
|
243
283
|
summarizeActualLeverageRedemptions: () => summarizeActualLeverageRedemptions,
|
|
244
284
|
toSystemParamsAsset: () => toSystemParamsAsset,
|
|
245
285
|
treasuryFeeTx: () => treasuryFeeTx,
|
|
246
286
|
updatePoolSnapshotWithdrawalFee: () => updatePoolSnapshotWithdrawalFee,
|
|
287
|
+
updateSlotConfigNetwork: () => updateSlotConfigNetwork,
|
|
247
288
|
updateStakingLockedAmount: () => updateStakingLockedAmount,
|
|
248
289
|
vote: () => vote,
|
|
249
290
|
withdrawCdp: () => withdrawCdp
|
|
@@ -340,6 +381,11 @@ async function scriptRef(ref, lucid) {
|
|
|
340
381
|
function balance(utxos) {
|
|
341
382
|
return utxos.reduce((acc, utxo) => (0, import_lucid2.addAssets)(acc, utxo.assets), {});
|
|
342
383
|
}
|
|
384
|
+
function updateSlotConfigNetwork(slotConfigNetwork) {
|
|
385
|
+
for (const [key, value] of Object.entries(slotConfigNetwork)) {
|
|
386
|
+
import_lucid2.SLOT_CONFIG_NETWORK[key] = value;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
343
389
|
|
|
344
390
|
// src/contracts/cdp/types.ts
|
|
345
391
|
var import_lucid6 = require("@lucid-evolution/lucid");
|
|
@@ -692,6 +738,7 @@ var ProtocolParamsSchema = import_lucid8.Data.Object({
|
|
|
692
738
|
/// Maximum amount of INDY that can be spent at once from the treasury.
|
|
693
739
|
maxTreasuryIndySpend: import_lucid8.Data.Integer()
|
|
694
740
|
});
|
|
741
|
+
var ProtocolParams = ProtocolParamsSchema;
|
|
695
742
|
var ProposeAssetContentSchema = import_lucid8.Data.Object({
|
|
696
743
|
asset: import_lucid8.Data.Bytes(),
|
|
697
744
|
priceOracleNft: OracleAssetNftSchema,
|
|
@@ -745,6 +792,7 @@ var ProposalContentSchema = import_lucid8.Data.Enum([
|
|
|
745
792
|
})
|
|
746
793
|
})
|
|
747
794
|
]);
|
|
795
|
+
var ProposalContent = ProposalContentSchema;
|
|
748
796
|
var UpgradePathSchema = import_evolution.Core.TSchema.Struct({
|
|
749
797
|
upgradeSymbol: import_evolution.Core.TSchema.ByteArray
|
|
750
798
|
});
|
|
@@ -756,6 +804,14 @@ var UpgradePathsSchema = import_evolution.Core.TSchema.Struct({
|
|
|
756
804
|
UpgradePathSchema
|
|
757
805
|
)
|
|
758
806
|
});
|
|
807
|
+
function serialiseUpgradePaths(d) {
|
|
808
|
+
return import_lucid8.Data.from(
|
|
809
|
+
import_evolution.Core.Data.withSchema(
|
|
810
|
+
UpgradePathsSchema,
|
|
811
|
+
DEFAULT_SCHEMA_OPTIONS
|
|
812
|
+
).toCBORHex(d)
|
|
813
|
+
);
|
|
814
|
+
}
|
|
759
815
|
function parseUpgradePaths(d) {
|
|
760
816
|
return import_evolution.Core.Data.withSchema(
|
|
761
817
|
UpgradePathsSchema,
|
|
@@ -1484,6 +1540,7 @@ var TreasuryParamsSchema = import_lucid16.Data.Object({
|
|
|
1484
1540
|
versionRecordToken: AssetClassSchema,
|
|
1485
1541
|
treasuryUtxosStakeCredential: import_lucid16.Data.Nullable(StakeCredentialSchema)
|
|
1486
1542
|
});
|
|
1543
|
+
var TreasuryParams = TreasuryParamsSchema;
|
|
1487
1544
|
var TreasuryRedeemerSchema = import_lucid16.Data.Enum([
|
|
1488
1545
|
import_lucid16.Data.Literal("Withdraw"),
|
|
1489
1546
|
import_lucid16.Data.Literal("PrepareWithdraw"),
|
|
@@ -1504,6 +1561,12 @@ function serialiseWithdrawalOutputDatum(d) {
|
|
|
1504
1561
|
function serialiseTreasuryRedeemer(redeemer) {
|
|
1505
1562
|
return import_lucid16.Data.to(redeemer, TreasuryRedeemer);
|
|
1506
1563
|
}
|
|
1564
|
+
function serialiseTreasuryDatum() {
|
|
1565
|
+
return import_lucid16.Data.void();
|
|
1566
|
+
}
|
|
1567
|
+
function castTreasuryParams(params) {
|
|
1568
|
+
return import_lucid16.Data.castTo(params, TreasuryParams);
|
|
1569
|
+
}
|
|
1507
1570
|
|
|
1508
1571
|
// src/contracts/treasury/transactions.ts
|
|
1509
1572
|
async function treasuryFeeTx(fee, lucid, sysParams, tx, treasury) {
|
|
@@ -6160,8 +6223,821 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6160
6223
|
}
|
|
6161
6224
|
return tx;
|
|
6162
6225
|
}
|
|
6226
|
+
|
|
6227
|
+
// src/contracts/initialize/helpers.ts
|
|
6228
|
+
var INDY_TOKEN_NAME = "INDY";
|
|
6229
|
+
var DAO_TOKEN_NAME = "DAO";
|
|
6230
|
+
var GOV_NFT_TOKEN_NAME = "GOV_NFT";
|
|
6231
|
+
var POLL_MANAGER_TOKEN_NAME = "POLL_MANAGER";
|
|
6232
|
+
var UPGRADE_TOKEN_NAME = "UPGRADE";
|
|
6233
|
+
var IASSET_TOKEN_NAME = "IASSET";
|
|
6234
|
+
var STABILITY_POOL_TOKEN_NAME = "STABILITY_POOL";
|
|
6235
|
+
var VERSION_RECORD_TOKEN_NAME = "VERSION_RECORD";
|
|
6236
|
+
var CDP_CREATOR_TOKEN_NAME = "CDP_CREATOR";
|
|
6237
|
+
var CDP_TOKEN_NAME = "CDP";
|
|
6238
|
+
var STAKING_MANAGER_TOKEN_NAME = "STAKING_MANAGER";
|
|
6239
|
+
var STAKING_TOKEN_NAME = "STAKING_POSITION";
|
|
6240
|
+
var SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME = "SNAPSHOT_EPOCH_TO_SCALE_TO_SUM";
|
|
6241
|
+
var ACCOUNT_TOKEN_NAME = "SP_ACCOUNT";
|
|
6242
|
+
var TOTAL_INDY_SUPPLY = 35000000000000n;
|
|
6243
|
+
var TREASURY_INDY_AMOUNT = 100000n;
|
|
6244
|
+
var NUM_CDP_CREATORS = 2n;
|
|
6245
|
+
var NUM_COLLECTORS = 2n;
|
|
6246
|
+
var ALWAYS_FAIL_VALIDATOR_HASH = "ea84d625650d066e1645e3e81d9c70a73f9ed837bd96dc49850ae744";
|
|
6247
|
+
async function submitAndAwaitTx(lucid, tx) {
|
|
6248
|
+
const txHash = await tx.complete().then((t) => t.sign.withWallet().complete()).then((t) => t.submit());
|
|
6249
|
+
await lucid.awaitTx(txHash);
|
|
6250
|
+
return txHash;
|
|
6251
|
+
}
|
|
6252
|
+
|
|
6253
|
+
// src/contracts/initialize/transactions.ts
|
|
6254
|
+
var import_lucid57 = require("@lucid-evolution/lucid");
|
|
6255
|
+
|
|
6256
|
+
// src/contracts/price-oracle/transactions.ts
|
|
6257
|
+
var import_lucid53 = require("@lucid-evolution/lucid");
|
|
6258
|
+
|
|
6259
|
+
// src/contracts/price-oracle/scripts.ts
|
|
6260
|
+
var import_lucid52 = require("@lucid-evolution/lucid");
|
|
6261
|
+
var priceOracleValidatorData = {
|
|
6262
|
+
type: "PlutusV2",
|
|
6263
|
+
cborHex: "590ba5590ba20100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323233027222232325335333006533357346074607e0022646605a60586ae84004dd69aba135744002607c00206e64a666ae68c0ecc1000044c8c8c848cc00400c008c0b8d5d09aba2002375a6ae84004c0fc0040e0dd50022999ab9a303a303f002132321233001003002357426ae88c0fc00cd5d0981f00101b8890008a99ab9c49103505435001637540086ea8004cc09c8888c8d4014888d40188c88c94cd54cd4ccd54c0d40e0c0a80a4c0ac01ccc0b08004d40048888888888880100e44cd5ce24812d546865207472616e73616374696f6e206973206e6f74207369676e6564206279206f7261636c65206f776e657200030132533553355335333553036039302b02a253335302135001202103e215333573466ebcc118cd5d0182319aba0375000a6ec4080cd5d01ba835500b03937620400022a66a666036446a0044466603e446a00444a666ae68c12c004400c4cc11848ccc00401c00c00800c00c0040c0cd54c0e80ec8d400488cc0e0008cd54c0f40f88d400488cc0ec008ccd4004dc0a4000e048cdc0800a400000266aa607407646a0024466070004666a002466aa607c07e46a0024466078004604600200244666038066004002466aa607c07e46a0024466078004604000200266602e05c666050400204e6a004404e0060784426a004444a66a0082a666ae68cdd78018238a999ab9a3375e00408e2a666ae68cdc4000a400006e2666ae68cdc4800a410125e80206a07006e06e44072064407e6044014074266ae712401024c310003103a1335738921156f757470757420646f6573206e6f74206d6174636800031153355333573466e2400d20001335738921165072696365206d75737420626520706f7369746976650003103a15335533535353301275a6a00407e06e44a666a00442a666ae68cdc419b8000100935500c03a0331333573466e24004d540300e80c40d00c80c84d4cc049d69a80101f911a801112999a99980980a980f19b8100900b0021533500113330120150030081333012015003008034133301201500300803003a13357389212345787069726174696f6e2074696d65206973206e6f742070726f7065726c792073657400031030030333025200102435302635533530270092100116036202402f302d350080393302f3016337000020060542a666a602e6aa66a60320022602602a442a66a0022004442602e032402e02842a66a6666666ae900048c94ccd5cd181d98200008991999aab9f001202d23233335573e002405e46666aae7cd5d1001119299a9999999aba400123253335734608660900022646666aae7c00480d48cccd55cf9aba20022533530203574200642605e00206a406c07a078608e0020646ea800880c880c880c880c80e4854cd4c070d5d08029098159981a8010008188181aba1005203003703635744004068607e0020546ea800880a880a880a880a80c48400405480548c94ccd5cd181b181d800899191919091998008028018011bad357426ae88008dd69aba10013574460760046ae84c0e80040ccdd50009111a801111a801912999a9998040038020010a99a8018800819814819911192999a80190a999a80190a999a80290980200b0980180a8a999a80210980200b0980180a80c0060a999a80210980180a8980100a0a999a80190980180a8980100a00b8a999a801100700b0068a999a80110a999a80210980180a8980100a0a999a80190980180a8980100a00b8058a999a80190980100a098008098a999a80110980100a0980080980b12999a80110a999a80210a999a802109998040038010008b0b0b0060a999a80190a999a801909998038030010008b0b0b00580691a80091111111003891999999980091199ab9a3370e00400204004644a666ae68cdc38010008098a999ab9a3371200400201401044666ae68cdc400100081001191199ab9a3371200400204004644666ae68cdc480100081181011199ab9a3371000400204604044a666ae68cdc480100088008801112999ab9a33712004002200420024464a666ae68c0c8c0dc0044c8c8cc0994ccd5cd181a181c801099813198038029aba130380023006357426ae88c0e00080c54ccd5cd181a181c800899813198038029aba130380013006357426ae88c0e00040c4dd51aba135744606e0046ea8d5d0981b0008179baa0012325333573460620020522a666ae68c0c000407c0b4c0d0dd50009119192999ab9a303300100815333573460640022601460086ae84c0d400854ccd5cd1818800803017181a8009baa00122233355302302702a335530260272350012233024002300b001333553023027223500222533533355302802b301d01c235001223300a002005006100313302e00400301c001335530260272350012233024002330382253350011300a003221350022253353300c002008112223300200a0041300600300400211009212223001004112220012230302253350011003221330060023004001212223003004233333335748002403040304030460206eb4008806007c94cd5ce2481286578706563746564206f6e6c7920612073696e676c6520636f6e74696e75696e67206f7574707574001615335738920117496e76616c696420646174756d20696e206f757470757400164988880088c8c94ccd5cd1813000899091118010021aba13028002153335734604a002264244460020086ae84c0a000854ccd5cd181200080201098140009baa00111003253353007001213335530150192235300535300935003019222200422353007350042222004225333573466ebc01000854ccd5cd19baf0030011330220060051005100500e3300d00735300f3500201b22222222222200a15335738921024c660016232533357346040604a0022646424660020060046ae84d5d118128011aba1302400101d3754002444006660024002eb4888cc09088cccd55cf80090071191980e9980a180398138009803181300098021aba2003357420040306eac0048c94ccd5cd180e181080089919191919190919998008038028018011aba1357440046ae84004d5d10011aba10013574460420046ae84c080004064dd5000919191999aa999ab9a3370e90030008990911118020029aba13020002153335734603c00226424444600400a6ae84c08000854ccd5cd180e8008990911118008029aba13020002153335734603800226424444600600a6ae84c0800080648034803480348ccd54c048054cc03c894cd40088400c400403494ccd5cd19baf002350010181300600100d3300923253335734603e60480022646424660020060046ae84d5d118120011aba1302300101c37540026a60166a00802e44444444444401860400026ea8d40040408488c00800c48cc004894cd400804c40040208cc02488ccd400c04c008004d400403488ccd5cd19baf002001004007223301c2233335573e002400c466028600a6ae84008c00cd5d10010081bac001100d23253335734602860320022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d1180c8011aba1301800101137540022002200c464a666ae68c044c0580044dd69aba1301500100e37540024424660020060044446006600400260244422444a66a00220044426600a004666aa600e01600a00800260224422444a66a00226a00600c442666a00a0186008004666aa600e01400a00800244002601e442244a66a00200c44266014600800466aa600c00e00800224002220024400444244660020080062a66ae712411f496e76616c696420646174756d20746f20636865636b4f776e4f757470757400161533573892010350543100162222222222220054c1014000370e90001b8748008dc3a40086e9520005573caae748c8c00400488cc00cc008008005"
|
|
6264
|
+
};
|
|
6265
|
+
function mkPriceOracleValidator(params) {
|
|
6266
|
+
return {
|
|
6267
|
+
type: priceOracleValidatorData.type,
|
|
6268
|
+
script: (0, import_lucid52.applyParamsToScript)(priceOracleValidatorData.cborHex, [
|
|
6269
|
+
castPriceOracleParams(params)
|
|
6270
|
+
])
|
|
6271
|
+
};
|
|
6272
|
+
}
|
|
6273
|
+
|
|
6274
|
+
// src/contracts/price-oracle/transactions.ts
|
|
6275
|
+
async function startPriceOracleTx(lucid, assetName, startPrice, oracleParams, now = Date.now(), refOutRef) {
|
|
6276
|
+
if (!refOutRef) {
|
|
6277
|
+
refOutRef = (await lucid.wallet().getUtxos())[0];
|
|
6278
|
+
}
|
|
6279
|
+
const [tx, oracleNftPolicyId] = await oneShotMintTx(lucid, {
|
|
6280
|
+
referenceOutRef: {
|
|
6281
|
+
txHash: refOutRef.txHash,
|
|
6282
|
+
outputIdx: BigInt(refOutRef.outputIndex)
|
|
6283
|
+
},
|
|
6284
|
+
mintAmounts: [
|
|
6285
|
+
{
|
|
6286
|
+
tokenName: (0, import_lucid53.fromText)(assetName),
|
|
6287
|
+
amount: 1n
|
|
6288
|
+
}
|
|
6289
|
+
]
|
|
6290
|
+
});
|
|
6291
|
+
const priceOracleNft = {
|
|
6292
|
+
currencySymbol: oracleNftPolicyId,
|
|
6293
|
+
tokenName: (0, import_lucid53.fromText)(assetName)
|
|
6294
|
+
};
|
|
6295
|
+
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
6296
|
+
const oracleDatum = {
|
|
6297
|
+
price: startPrice,
|
|
6298
|
+
expiration: BigInt(now) + oracleParams.expiration
|
|
6299
|
+
};
|
|
6300
|
+
tx.pay.ToContract(
|
|
6301
|
+
(0, import_lucid53.validatorToAddress)(lucid.config().network, oracleValidator),
|
|
6302
|
+
{ kind: "inline", value: serialisePriceOracleDatum(oracleDatum) },
|
|
6303
|
+
(0, import_lucid53.addAssets)(mkLovelacesOf(5000000n), mkAssetsOf(priceOracleNft, 1n))
|
|
6304
|
+
);
|
|
6305
|
+
return [tx, { oracleNft: priceOracleNft }];
|
|
6306
|
+
}
|
|
6307
|
+
|
|
6308
|
+
// src/scripts/auth-token-policy.ts
|
|
6309
|
+
var import_lucid54 = require("@lucid-evolution/lucid");
|
|
6310
|
+
var authPolicyData = {
|
|
6311
|
+
type: "PlutusV2",
|
|
6312
|
+
cborHex: "5904d95904d60100003232323232323232323232323232323232323232323232323232223232223232323253355335533357346042660166018a00200e03026464666ae68cdc419806980728019980b9999aa999ab9a3370e90030008990911118020029aba1302400215333573466e1d20040011321222230020053574260480042a666ae68c08c0044c848888c004014d5d098120010a999ab9a30220011321222230030053574260480040424c40024c4c016900100a80d98120009baa3500201d01813357389213d4d75737420636f6e73756d65204e4654206f7220746f6b656e2070726576696f75736c79206d696e746564207573696e67207468697320706f6c6963790001301415335738920103505435001613253335734604060460022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d118118011aba1302200101f37546a002036a666ae68c078c0840084c8c848cc00400c008d5d09aba2302100335742604000403aa666ae68c074c080dd500180880e1baa00153335734603260380022646601e6ae84004d5d09aba2001301b00101837540044464646603a4466a0029000111a801112999ab9a3375e0040102660464466a0029000111a801112999ab9a3375e00401a20022600c0060022600c0060086a00402a6a0020264666aa6020026660144466aa601c02a46a002446601e00466aa602203046a0024466024004666a0026e012000700466e0000520000013355300e015235001223300f00233350012335530120192350012233013002300e0010012233300a0090020012335530120192350012233013002301000100133300500400200100e232333008200133008200175a6aa666ae68c05cc0680044c8c8c8c8c8c848cccc00401c01400c008d5d09aba2002357420026ae88008d5d08009aba2301a00235742603200202c44440066ea8d400404ccc06488cccd55cf800900891919809a999ab9a3019301c001132321233001003002357426ae88c070008d5d0980d80080c18021aba200337546ae84008054dd61a80091111111111100611199ab9a3375e00400201c010444666aa601602601e66aa601802646a002446601a0046010002666aa6016026446a00444a66a666aa602802e6601c4466601402e004002601002c46a002446601400400a00c200626602600800601c00266aa601802646a002446601a0046603844a66a002260180064426a00444a66a6601800401022444660040140082600c00600800446600244a66a004018200200a4244460060084446602c446666aae7c00480388c8cc040cc02cc01cc064004c018c060004c010d5d10019aba1002012375600242444600200820142014442466002006004601c4422444a66a00220044426600a004666aa600e01e00a008002601a442244a66a00200a44266012600800466aa600c01a00800220022006442446600200800660124422444a66a00226a00600e442666a00a0106008004666aa600e01400a0080024400444002240022a66ae71241035054310016370e90001b874800955cf2ab9d2323001001223300330020020011"
|
|
6313
|
+
};
|
|
6314
|
+
function mkAuthTokenPolicy(ac, tn) {
|
|
6315
|
+
return {
|
|
6316
|
+
type: authPolicyData.type,
|
|
6317
|
+
script: (0, import_lucid54.applyParamsToScript)(authPolicyData.cborHex, [
|
|
6318
|
+
new import_lucid54.Constr(0, [ac.currencySymbol, ac.tokenName]),
|
|
6319
|
+
tn
|
|
6320
|
+
])
|
|
6321
|
+
};
|
|
6322
|
+
}
|
|
6323
|
+
|
|
6324
|
+
// src/scripts/iasset-policy.ts
|
|
6325
|
+
var import_lucid55 = require("@lucid-evolution/lucid");
|
|
6326
|
+
var iassetPolicyData = {
|
|
6327
|
+
type: "PlutusV2",
|
|
6328
|
+
cborHex: "59047b590478010000323232323232323232323232323232323232323232323232323232323232330102223253353300453335734603e60426ea800c04c0794ccd5cd180f98108008991909198008018011aba13574460420046ae84c08000407804c54cd5ce248103505435001637540026602044464a66aa666ae68cdc419803199aa980d00e803919980810008079a98071a80080e9003998089192999ab9a30213023001132321233001003002357426ae88c08c008d5d098110008101baa00135500122222222222200c004480084ccd5cd19b8748008cc018ccd54c06807401c8ccc040800403cd4004801ccc044034d5400488888888888802801006004805c05c4cd5ce24910434450546f6b656e206d697373696e670001213253335734603e60420022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d118108011aba1302000101e37546a002034464a666ae68c074c07c0044c8c848cc00400c008d5d09aba2301f00235742603c0020386ea800488800c88c8c8cc08088cd400520002235002225333573466ebc0080204cc09888cd400520002235002225333573466ebc00803440044c01800c0044c01800c010d4008064d400405ccc02488cd54c0440608d400488cc038008cd54c05006c8d400488cc044008ccd4004dc024000e008cdc0000a400000266aa602203046a002446601c004666a002466aa602a03846a0024466024004601a00200244666012010004002466aa602a03846a0024466024004601c00200266600800600400202244666ae68cdd7801000809006111199aa980780b80999aa980800b91a80091198068011804000999aa980780b911a80111299a999aa980c00d998071119980500d801000980400d11a8009119805001002803080189980b80200180900099aa980800b91a80091198068011980f91299a800898058019109a80111299a9980600100408911198010050020980300180200111980091299a80100808008049091118018021091118008021192999ab9a301430160011323232323232123333001007005003002357426ae88008d5d08009aba2002357420026ae88c058008d5d0980a8008099baa00133001200175a4446602c446666aae7c004803c8c8cc044cc020c01cc064004c018c060004c010d5d10019aba100201337560024424660020060044466026446666aae7c00480308cc034c014d5d080118019aba200201037580022014201444460066004002601a4422444a66a00220044426600a004666aa600e01e00a0080026018442244a66a00200a44266012600800466aa600c01a00800220022006442446600200800660104422444a66a00226a00600e442666a00a0106008004666aa600e01400a0080024400444002240022a66ae71241035054310016370e90002ab9e5573a4646002002446600660040040021"
|
|
6329
|
+
};
|
|
6330
|
+
function mkIAssetTokenPolicy(ac) {
|
|
6331
|
+
return {
|
|
6332
|
+
type: iassetPolicyData.type,
|
|
6333
|
+
script: (0, import_lucid55.applyParamsToScript)(iassetPolicyData.cborHex, [
|
|
6334
|
+
new import_lucid55.Constr(0, [ac.currencySymbol, ac.tokenName])
|
|
6335
|
+
])
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
|
|
6339
|
+
// src/contracts/gov/scripts.ts
|
|
6340
|
+
var import_lucid56 = require("@lucid-evolution/lucid");
|
|
6341
|
+
|
|
6342
|
+
// src/validators/governance-validator.ts
|
|
6343
|
+
var _governanceValidator = {
|
|
6344
|
+
type: "PlutusScriptV2",
|
|
6345
|
+
description: "Generated by Aiken",
|
|
6346
|
+
cborHex: "592a2c592a290100003232323232323232223232323223232323232323232253330113232325333014300a3016375400226464646464a666032602c60366ea80044c8c8c8c8c8c94ccc07ccc00d24113496e636f727265637420476f7620696e70757400330013756600a60446ea8c014c088dd5003180518111baa01e132323232323232323232323232323232323232323232325323233303830350191323232333332323232323232323232323232323232222232323232533305333225333055304b3057375400e29444c8c94ccc15ccc0ed2401415472656173757279207769746864726177616c2063616e6e6f742062652061626f7665207769746864726177616c206c696d697420666f72206c6f76656c6163650033712666074002910100488100004153330573303b49013d5472656173757279207769746864726177616c2063616e6e6f742062652061626f7665207769746864726177616c206c696d697420666f7220494e4459003371266050002602c60b46ea815800c54ccc15ccc0ed2401295472656173757279207769746864726177616c2076616c75652063616e6e6f7420626520656d707479003330573375e6e98005300101a0004a094454ccc15ccc0ed241355472656173757279207769746864726177616c2063616e6e6f7420726571756573742044414f206964656e7469747920746f6b656e003054330280013015305a37540ac2a6660ae6607692012f5472656173757279207769746864726177616c2063616e20636f6e7461696e206d6178206f66203820617373657473003371260346eb0c0f4c168dd5001240202660769201355472656173757279207769746864726177616c2063616e20636f6e7461696e206f6e6c7920706f73697469766520616d6f756e74730032330010013758607c60b66ea800c894ccc174004528899299982d19b8848000dd6983018309830982e9baa306000213300300300114a060c000229405280a5014a02940c8cc004004c8cc004004dd6181f182d9baa00322533305d00114bd7009982f1ba7323233060306100233060306100133060306130620014bd701830800982e1baa305f00133002002306000122533305c00114bd6f7b6300999119199911299982f182d800880289999981d002801991900119198008008011129998328008a4c264a6660cc002293099192999832183098331baa3303e375c60cc60d40086eb8c1980084cc014014cc1a400800454cc195241326b65797320696e206173736f63696174697665206c697374206172656e277420696e20617363656e64696e67206f726465720016306a0023068001306800133063337606ea4008dd4000a5eb7bdb180888c94ccc188c0f4004530103d87a80001304c33067374c00297ae03333303e001005004222325333065306200114c103d87a80001304f3306a375000297ae0337000020040760706eb8c18400cdd718308009bad306130620013061002375860bc0026600400460be00260b660b06ea801cdd69808182b1baa3039305637540a26eb4c078c158dd5181c982b1baa051153330533303749011b496e636f727265637420476f7665726e616e6365206f75747075740033333027004301d330580384bd70180e1982c19191918201982d9ba8301b375a608260b26ea8150cc16cc17000ccc16cc170008cc16cc170004cc16cdd4180d9bad3023305937540a860ba60ba00260b800260b600260b460ac6ea81452f5c0604a607c60ac6ea8149300103d87a8000153330533303749127546865207472616e73616374696f6e206d757374206265207369676e6564206279206f776e657200330233758602060ac6ea810402054ccc14ccc0dd24012850726f706f73616c20696e636f6d70617469626c6520776974682063757272656e7420737461746500533305330453055375400e266e1cdd6981f182b1baa30593056375400e60306eb4c0a8c158dd50288a5115333053330374910d496e76616c6964207054696d650032325333055325333056304900114a22a6660ac60980022944528182b9baa33017304030583754004608060b06ea80044c94ccc158c14c0045288a99982b18260008a5114a060ae6ea8cc05cc0ecc160dd5001181d982c1baa00114a0602a607c660b2607c660b2603c660b26ea0cdc08039bad3014305737540a697ae0330593330544a298103d87a80004c0103d87980004bd701982c981f1982c980f1982c9ba83004375a602860ae6ea814d2f5c0660b26660a8945300103d87a80004c0103d87980004bd7025eb80c050c044c158dd50208a9998299981ba481245472616e73616374696f6e206d696e742065786163746c79203120706f6c6c546f6b656e003375e6e98c0c8dd59810182b1baa041374c604a607260ac6ea814854ccc14ccc0dd24113496e76616c696420506f6c6c206f75747075740033333027004301d33058303d33058301d33058301f305637540a497ae0330584c103d87a80004bd7025eb80c070cc1600052f5c066056604a607260ac6ea8148c8ccc09cdd7181f982b9baa001375c607460ae6ea8004cdc11bad303f30573754607460ae6ea8148c03cdd69810982b9baa0523012305637540a498103d87a800013253330543051001132323232323232323232533305e3333333330163064008306400730640063064005306400430640033064002306400130643065001132533305f305c375a603c60c46ea817452889919299983298340010992999831182c18321baa001132325333068306b002132330494912469417373657420776974682073616d65206e616d6520616c726561647920657869737473005333065533306532533306a306900115333066305c306800114a22a6660cc60c660d000229405858dd5183598361836183618361836183618361836183618361836183618341baa002130433303f010375c60a060d06ea80085280a51153330653375e6607e0206eb8c140c1a0dd5001260103d87b8000132533306630633068375400226088660800226eb8c1b0c1a4dd50008a51306b306c306c306c306c306c306c306c306c306c306c306c306c306c3068375400429414ccc190c184c198dd5000899191919191919191919191919191919191919191919191919191919299984200984380801099191919191919191919191924c64a6661180261120200226464a66612402612a020042930b1bae309301001308f01375401a2a666118026104020022a66612002611e026ea80345261616308d013754018610c0201e610a0202061080202261060202461040202661020202861000202a60fe02c60fc02e60f203060ea0322c610a02002610a0200464a666104026102020022a6660fc60e8610002002294454ccc1f8c1ecc200040045280b0b1baa308301001308301002308101001308101002307f001307f002307d001307d002307b001307b0023079001307900230770013077002307500130750023073001307300230710013071002306f001306f002306d001306d002375c60d600260ce6ea80045858c1a4004c194dd50008b1817981c18321baa3047306437540022c60cc00266605c002603860c46ea8179300103d87980003758608860c26ea813052818320009831800983100098308009830000982f800982f000982e982e982e8011bae305b001305737540102a6660a860940022646464646464646466666666602860c401060c400e60c400c60c400a60c400860c400660c400460c400260c460c600260c400260c200260c000260be00260bc00260ba00260b800260b660b660b660ae6ea802054ccc150c11c0044c94ccc154cc0e52412a50726f706f73616c206465706f73697420696e2072616e6765205b302c2031305f30303020494e44595d005333055302a375a608060b06ea80044cdc49bad30403058375400201e294054cc8cc158cc0e9240128566f74696e6720706572696f6420696e2072616e6765205b3120686f75722c2031206d6f6e74685d0053330563371290405d5b819bad303c30593754004266e24dd6981e182c9baa00200114a02a6660ac66074921264566666563746976652064656c617920696e2072616e6765205b302c20313220686f7572735d005333056302b375a605a60b26ea80084cdc49bad302d3059375400466e092080bab703480605280a99982b1981d24812b45787069726174696f6e20706572696f6420696e2072616e6765205b31206461792c2031206d6f6e74685d0053330563371290407859291bad301530593754004266e24dd6980a982c9baa00200114a02a6660ac660749212d436f6c6c61746572616c206665652070657263656e7461676520696e2072616e6765205b30252c20313030255d005333056302b375a608260b26ea8c08cc164dd5001099b89375a608260b26ea8c08cc164dd50010078a50153330563303a4912b50726f706f73696e6720706572696f6420696e2072616e6765205b3120686f75722c2031206d6f6e74685d0053330563371290405d5b819bad302230593754004266e24dd69811182c9baa00200114a02a6660ac660749212950726f706f73696e6720706572696f64203c20566f74696e6720706572696f64202d203120686f757200337106eb4c088c164dd500119b80375a607860b26ea800920ffb9b703153330563303a49011f546f74616c2073686172647320696e2072616e6765205b312c20313030305d0053330563371290011bad301630593754004266e24dd6980b182c9baa002483403c5280a99982b1981d2481234d696e2071756f72756d20696e2072616e6765205b302c2031306d696c20494e44595d005333056302b375a602860b26ea80084cdc49bad30143059375400466e092080dac4094820225e85280a99982b1981d2481384d6178207472656173757279206c6f76656c616365207370656e6420696e2072616e6765205b302c2034352062696c6c696f6e204144415d005333056302b375a602660b26ea80084cdc49bad30133059375400466e09208088aca3cf024820225e852809981d249354d617820747265617375727920494e4459207370656e6420696e2072616e6765205b302c203335206d696c6c696f6e20494e44595d005333056302b375a604260b26ea80084cdc49bad30213059375400466e092080bbb0214820225e85280a5014a029405280a5014a0294052819b8248203c2c949203c14a02940c168c15cdd50040a99982a18230008991981ca4811d43616e6e6f7420636f6e7461696e206475706c6963617465206b657973003375e6e9cc02c004dd380099198008009bab305b305c3058375460b660b06ea8024894ccc16800452f5c02660b66ea4dd7182c182e00099801001182e80089981c24811e5465787450726f706f73616c2773206c656e677468206973203c3d20363400337126e34dd7182d182b9baa0084820004c154dd50038a5014a029405280a5014a02940c0f0cc15cc0f0cc15cdd4180b9bad303d305537540a0660ae6ea401ccc15c018cc15c010cc15d300106d8799f0000ff00330573750002660ae981010000330574c101000033057301230553754607060aa6ea8140cc15cdd418011bad301e30553754607060aa6ea8140cc15cdd419b80001375a602260aa6ea8c0e0c154dd50281982b9814982a9baa05033057301030553754607060aa6ea81412f5c097ae03001375a606e60a86ea8c0dcc150dd50279b80003375860aa60ac60ac60a46ea80f4c004004894ccc13c00452f5c0264660a26ea4004cc00c00cc8cc004004c15000c894ccc14800452f5c026464a6660a06660a066e3c0080152825113305537520046600800800226600800800260ac0046eb8c150004dd718288009111111112999198291981b2491d4d52206973206265747765656e205b313030252c2031305f303030255d0053330523001375a607a60aa6ea80244cdc49bad303d30553754012018294054ccc148cc0d924011e524d52206973206265747765656e205b313030252c2031305f303030255d0053330523001375a607a60aa6ea80284cdc49bad303d30553754014018294054ccc148cc0d924011f4d61696e74656e616e636520726174696f206d757374206265203e3d204c5200337126eb4c0f4c154dd50041bad303d305537540122a6660a46606c921214c69717569646174696f6e20726174696f206d757374206265203e3d2031303025003001375a607a60aa6ea802054ccc148cc0d924013144656274206d696e74696e67206665652070657263656e74616765206973206265747765656e205b30252c20313030255d0053330523027375a607a60aa6ea801c4cdc49bad303d3055375400e016294054ccc148cc0d92401394c69717569646174696f6e2070726f63657373696e67206665652070657263656e74616765206973206265747765656e205b30252c2035255d0053330523027375a607a60aa6ea80184cdc49bad303d3055375400c66e09200a4820225e85280a9998291981b24813e53746162696c69747920706f6f6c207769746864726177616c206665652070657263656e74616765206973206265747765656e205b30252c20313030255d0053330523027375a607a60aa6ea80144cdc49bad303d3055375400a016294054ccc148cc0d9240138526564656d7074696f6e207265696d62757273656d656e742070657263656e7461676520696e206265747765656e205b30252c203235255d0053330523027375a607a60aa6ea80104cdc49bad303d3055375400866e0920324820225e85280a9998291981b248139526564656d7074696f6e2070726f63657373696e67206665652070657263656e7461676520696e206265747765656e205b30252c203130255d0053330523027375a607a60aa6ea800c4cdc49bad303d3055375400666e0920144820225e852809981b2493b496e74657265737420636f6c6c6563746f7220706f7274696f6e2070657263656e7461676520696e206265747765656e205b30252c20313030255d0053330523027375a607a60aa6ea80084cdc49bad303d3055375400401629405280a5014a029405280a5014a02940dc48050a5033704906400a410112f466e0920a09c014820225e8c004004894c8ccc11cc0052010153330473001480005200013371c91108010204081020408000002153330473001481004cdc124100086600600666e00009200f1337049040404040101980180199b80002480fcdc4000918251825982598259825982598259825982580091824982518251825182518251825182500091824182498249824800918239824182418241824182418240009181519822992999820981b98219baa00113253330423253330473046001153330433039304500114a22a6660866080608a00229405858dd5181418229baa302d30453754006260186608e6ea00052f5c0260186608e6ea0c01c0052f5c06eb4c11cc110dd50008800981598219baa302b304337540026608a64a666082606e60866ea80044c94ccc108c94ccc11cc11800454ccc10cc0e4c1140045288a999821982018228008a50161637546050608a6ea8c0a0c114dd500189806198239ba80014bd7009806198239ba8337000029000a5eb80dd6982398221baa0011001302b30433754604c60866ea80052f5c04464a666082607c0022a666082607c60866ea80085300103d87a800014c103d879800015333041303400115333041303430433754004298103d87a800014c103d87b80001323253330433039001132533304433710006002298103d879800015333044337100020062980103d87b800014c103d87a8000375a6092608c6ea801054ccc10cc100004530103d87b800014c103d8798000304437540066eb4c11cc110dd500198211baa00230010012253330420011480004c00ccc008008c114004dc0240046eb8c104008c104004dd698208019820982100098208009820000981d9baa03115333038302e0191323232533303f30420021533303b3301f49010e4d697865642076657273696f6e73003375e604c607c6ea8c098c0f8dd51810981f1baa0013005330403007303e375407497ae01533303b3301f4912e706f6c6c206d616e6167657220696e707574206d75737420757365207468652072696768742072656465656d65720032323375e004604e660846ea00152f5c064a66607a607400226464a666086608c0042930b1bad3044001304037540042a66607a606600226464a666086608c0042930b1bad3044001304037540042a66607a606000226464a666086608c0042930b1bad3044001304037540042c607c6ea8004c94ccc0f0c0e4c0f8dd500089821181f9baa001153303d490117436f756c64206e6f742066696e642072656465656d657200163232330010013756601060806ea80ac894ccc1080045300103d87a8000132323253330413375e00c6086006260566608c00297ae01330050050023043002304600230440013005330403026303e375400297ae01533303b3301f490114496e636f727265637420676f76206f7574707574003333300f37586024607c6ea80a4c014cc1000812f5c060086608064646464605266088608a00866088608a00666088608a00466088608a002660886ea0cdc01bad300c3042375407a900098231823000982280098220009821800981f1baa0394bd7018069813181f1baa03a4c0103d87a800013301f49013b4d757374206275726e203120706f6c6c20746f6b656e20616e64206f7074696f6e616c6c79206d696e7420616e207570677261646520746f6b656e0032533303c3375e6e98004dd31980a180a98071811181f9baa03b300e3013303f375407629444cdd79ba6001374c602a601c6044607e6ea80ecc068dd59804181f1baa02914a029405280b18200009998041bac3024303c375404e603e60786ea80e1300103d8798000375a607c60766ea80c454ccc0e0c0ac0644cc07124011d5370656e642065786163746c792031205570677261646520546f6b656e00302e332232330010010032253330400011480004cdc0198010011821800998069bab3022303f37546044607e6ea8c10800400cdd61811981d9baa026300f303b375406e266646464446464646464a666084607e60886ea80044c94ccc10cc0e4c114dd500089919192999825182680109919192999824982318259baa00113302d3300f3304e37526e612401084d697373696e6720003304e37526e60038cc138dd49b984901172075706772616465206d696e74696e6720706f6c696379004bd70249003301930103028009375c609e60986ea800454cc128cc03ccc138dd49b98491084d697373696e6720003304e37526e60038cc138dd49b9849010d20757067726164652070617468004bd702490016325333049303f304b3754002298103d87a8000130333304e37526eb8c130c8cdd81828000982818288009bac304f304c375400297ae032330010013756605e60986ea800c894ccc1380045300103d87a800013232533304c3371e6eb8c1380080244c0d8cc144dd399828982700119828982780125eb812f5c026600800800260a400460a0002a66608e608860926ea80044c8c8c8c94ccc13cc1480084c9263303f001232375c60a00046eb8c13800458dd5982800098280011bad304e001304a37540022c6028603a60926ea8c0b0c124dd50008b1825800999809802804260103d8798000375c6092608c6ea800458c0b4c114dd5181698229baa3028304537546090608a6ea800458cc0a8dd618238020169bab30463047304730470023758608a002608a00260806ea80ac88dcc99191998008008022441002225333044002100113233300400430480035333041303e371a00426e600044cdc500119b8a00537300026e64dd718230011b98001300100122533303e00114bd7009981f981e1820000998010011820800a4903476f76003005303b375406e6e952004374a90011181e181e981e981e981e981e981e981e981e981e8009181d981e181e181e181e181e0009181d181d981d981d981d800929998199813181a9baa00113039303637540022a66068921134e6f7420616e20696e6c696e6520646174756d0016222323300b00423002301c30393754002a6660686062606c6ea800448cc05cdd5980d981c1baa0010031233710900019980c1bab301b303837540026eb8c080c0e0dd50019bae301b3038375400644646600200200644a66607000229404c94ccc0d4cdc79bae303b00200414a22660060060026076002446660280046eb8c070c0d0dd50009bae30173034375400246660046eb8c068c0c8dd50009bae3015303237540029001111299981818168008a5eb7bdb1804c8c8cc0040052f5bded8c044a66606e00226607066ec0dd48031ba60034bd6f7b630099191919299981b980a9980880500109981e19bb037520146e9801c01454ccc0dccdc780500109981e19bb037520146e9801c00c4cc0f0cdd81ba9002374c0026600c00c0066eacc0e400cdd7181b801181d801181c8009919800800a5eb7bdb180894ccc0d80044cc0dccdd81ba9004375000697adef6c60132323232533303630143301000800213303b337606ea4020dd40038028a99981b19b8f00800213303b337606ea4020dd400380189981d99bb037520046ea0004cc01801800cdd6981c0019bae3036002303a0023038001222223233001001330080065333032302f3034375400a264466ebcc07cc0dcdd5180f981b9baa00100230383035375400a264466ebcc07cc0dcdd5000801181c181a9baa00522533303700114a0264a66606864a66606a66ebcc030c0e0dd5000803899299981d0008a511533303a303d001132323253330393019375c607e0062a66607260320022a666072606c60766ea802454ccc0e4c0380084cdc48012410137dc0429404c0380085280a50375c607c607e0046eb4c0f4c0f8c0f8004dd6181e0008a5032330010013300e3756603860726ea8008c03c01c894ccc0ec00452f5c0264666444646600200200644a6660820022006264660866e9ccc10cdd4803198219ba9375c6080002660866ea0dd69820800a5eb80cc00c00cc114008c10c004dd7181d0009bab303b00133003003303f002303d00114a0607400429444cc00c00c004c0e8004dc4a400044646600200200644a666064002297ae013232533303030050021330350023300400400113300400400130360023034001230303031303100122323330010010030022225333031002100113233300400430350033333300a002375c60600026eacc0c4004888c94ccc0c8c034004530103d87a80001301c33037374c00297ae03233300100100300222253330380021001132333004004303c00333333012002375c606e0026eb4c0e0004888c94ccc0e4c0d80045300103d87a8000130233303e375000297ae03370000400201e607400401060660044646600200200444a66605c002297adef6c6013233030337606ea4dd718168009ba632330010013756605e00444a666062002297adef6c6013233033337606ea4dd718180009ba83370290001bad30310013300300330350023033001330030033032002303000122533302833720004002298103d8798000153330283371e0040022980103d87a800014c103d87b80002533302a00114a2294088888c8cc004004018894ccc0bc0044cc0c0cdd81ba9006374c00a97adef6c60132323232533302f300d3300700a002133034337606ea4028dd30048028a99981799b8f00a0021325333030302d3032375400226606a66ec0dd4805981b18199baa001004100433300800a009001133034337606ea4008dd3000998030030019bab3031003375c605e0046066004606200244444646600200200c44a66605c00226605e66ec0dd48031ba80054bd6f7b630099191919299981718061980380500109981999bb037520146ea002401454ccc0b8cdc78050010992999817981618189baa001133034337606ea402cc0d4c0c8dd5000802080219980400500480089981999bb037520046ea0004cc01801800cdd698180019bae302e00230320023030001375e98103d87980002323300100100222533302800114bd6f7b63009919191929998141804001080189981699bb037520046e98004cc01801800cdd598150019bae3028002302c002302a001371e9110030213754030294088c058ccc00c008dd7180598119baa001375c600c60466ea8004888c94ccc084c05cc08cdd50008a400026eb4c09cc090dd5000992999810980b98119baa00114c103d87a80001323300100137566050604a6ea8008894ccc09c004530103d87a8000132323253330263371e00e6eb8c0a000c4c040cc0acdd4000a5eb804cc014014008dd698140011815801181480099198008008021129998130008a6103d87a8000132323253330253371e00e6eb8c09c00c4c03ccc0a8dd3000a5eb804cc014014008dd598138011815001181400091299980f19980f000a504a22a6603e00420022002600c603c6ea8c004c078dd5001118109811000980f980e1baa00116330013758600660366ea801801088c8cc00400400c894ccc07c004530103d87a800013232533301d3375e601060406ea80080144c01ccc0880092f5c0266008008002604600460420026e9520002301c001301a301737540022c60326034004603000260286ea80045261365632325333011300e00113232323232323232533301d302000213232498c94ccc06cc0600044c8c94ccc084c0900084c926533301d301a301f3754002264646464a66604a605000426464931980b00112999811981018129baa0011323232323232533302d3030002149858dd6981700098170011bae302c001302c002375c6054002604c6ea8004594ccc084c078c08cdd5001899191919299981498160010991924c64a66604e604800226464a66605a6060004264931929998151813800899192999818181980109924c603a0022c6062002605a6ea800854ccc0a8c0800044c8c8c8c8c8c94ccc0d0c0dc00852616375a606a002606a0046eb4c0cc004c0cc008dd6981880098169baa00216302b37540022c605c00260546ea800c54ccc09cc07400454ccc0acc0a8dd50018a4c2c2c60506ea8008c05800c58c0a8004c0a8008c0a0004c090dd50018b0b1bac302600130260023024001302037540022c2c6044002603c6ea800c54ccc06cc04400454ccc07cc078dd50018a4c2c2c60386ea8008c94ccc068c05c0044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc0d8c0e40084c8c8c8c8c8c8c8c8c8c8c926303800b303700c303600d303500e303400f3033010303201130310123030013302b01430290151630370013037002303500130350023033001303300230310013031002302f001302f002302d001302d002302b001302b00230290013029002302700130270023025001302500230230013023002375c6042002603a6ea801054ccc068c0400044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc0d8c0e40084c8c8c8c8c8c8c8c8c8c8c926303800b303700c303600d303500e303400f3033010303201130310123030013302b01430270151630370013037002303500130350023033001303300230310013031002302f001302f002302d001302d002302b001302b00230290013029002302700130270023025001302500230230013023002375c6042002603a6ea801054ccc068c0340044c8c94ccc080c08c0084c9263017001163021001301d37540082a666034601800226464a666040604600426493299980e180c980f1baa00113232323253330243027002132498cc0500048c8c94ccc08cc080c094dd500089919299981498160010a4c2c6eb8c0a8004c098dd50008b18128011bae3023001163756604a002604a0046eb4c08c004c07cdd50008b0b1810800980e9baa0041533301a3370e900400089919299981018118010a4c2c6eb8c084004c074dd50020b180d9baa00316301e001301e002301c001301c002375c603400260340046eb4c060004c050dd50050a999808980380089919299980b980d0010a4c2c6eb4c060004c050dd50050a99980898020008a99980a980a1baa00a14985854ccc044c00c00454ccc054c050dd50050a4c2c2c60246ea80248c94ccc044c0380044c8c94ccc05cc06800852616375c603000260286ea800854ccc044c01c0044c8c94ccc05cc06800852616375c603000260286ea800858c048dd50009b8748018dc3a400844646600200200644a66602800229309919801801980c0011801980b00091929998069805000899192999809980b00109924c60160022c602800260206ea800854ccc034c00c0044c8c94ccc04cc0580084c9263006001163014001301037540042c601c6ea8004dc3a40044a666014600e60186ea80044c8c94ccc040c04c0084c9263004001163011001300d37540022c4a666012600c60166ea80044c8c8c8c94ccc044c05000852616375c602400260240046eb8c040004c030dd50008b2999803180198041baa004132323232323232323232323253330163019002132498c03402458dd6980b800980b8011bad30150013015002375a602600260260046eb4c044004c044008c03c004c03c008dd6980680098049baa004162533300630033008375400226464646464646464646464646464646464646464a66603c604200426493180b0058b1bad301f001301f002375a603a002603a0046eb4c06c004c06c008dd6980c800980c8011bad3017001301700230150013015002375a602600260260046eb4c044004c044008dd6980780098078011bad300d001300937540022c4a66600a6004600e6ea80044c8c94ccc02cc03800852616375a601800260106ea800458dc3a4000ae695ce2ab9d5573caae7d5d02ba157441"
|
|
6347
|
+
};
|
|
6348
|
+
|
|
6349
|
+
// src/contracts/gov/scripts.ts
|
|
6350
|
+
var mkGovValidatorFromSP = (params) => {
|
|
6351
|
+
return {
|
|
6352
|
+
type: "PlutusV2",
|
|
6353
|
+
script: (0, import_lucid56.applyParamsToScript)(_governanceValidator.cborHex, [
|
|
6354
|
+
castGovParams({
|
|
6355
|
+
gBiasTime: BigInt(params.gBiasTime),
|
|
6356
|
+
govNFT: fromSystemParamsAsset(params.govNFT),
|
|
6357
|
+
pollToken: fromSystemParamsAsset(params.pollToken),
|
|
6358
|
+
upgradeToken: fromSystemParamsAsset(params.upgradeToken),
|
|
6359
|
+
indyAsset: fromSystemParamsAsset(params.indyAsset),
|
|
6360
|
+
versionRecordToken: fromSystemParamsAsset(params.versionRecordToken),
|
|
6361
|
+
pollManagerValHash: params.pollManagerValHash,
|
|
6362
|
+
daoIdentityToken: fromSystemParamsAsset(params.daoIdentityToken),
|
|
6363
|
+
iAssetAuthToken: fromSystemParamsAsset(params.iAssetAuthToken)
|
|
6364
|
+
})
|
|
6365
|
+
])
|
|
6366
|
+
};
|
|
6367
|
+
};
|
|
6368
|
+
|
|
6369
|
+
// src/contracts/initialize/transactions.ts
|
|
6370
|
+
async function mintOneTimeToken(lucid, tokenName, amount) {
|
|
6371
|
+
const utxos = await lucid.wallet().getUtxos();
|
|
6372
|
+
return await runOneShotMintTx(lucid, {
|
|
6373
|
+
referenceOutRef: {
|
|
6374
|
+
txHash: utxos[0].txHash,
|
|
6375
|
+
outputIdx: BigInt(utxos[0].outputIndex)
|
|
6376
|
+
},
|
|
6377
|
+
mintAmounts: [{ tokenName, amount }]
|
|
6378
|
+
});
|
|
6379
|
+
}
|
|
6380
|
+
async function initScriptRef(lucid, validator) {
|
|
6381
|
+
const tx = lucid.newTx().pay.ToContract(
|
|
6382
|
+
(0, import_lucid57.credentialToAddress)(lucid.config().network, {
|
|
6383
|
+
hash: ALWAYS_FAIL_VALIDATOR_HASH,
|
|
6384
|
+
type: "Script"
|
|
6385
|
+
}),
|
|
6386
|
+
void 0,
|
|
6387
|
+
void 0,
|
|
6388
|
+
validator
|
|
6389
|
+
);
|
|
6390
|
+
const txHash = await submitAndAwaitTx(lucid, tx);
|
|
6391
|
+
return { transactionId: txHash, index: 0 };
|
|
6392
|
+
}
|
|
6393
|
+
async function initCollector(lucid, collectorParams) {
|
|
6394
|
+
const tx = lucid.newTx();
|
|
6395
|
+
for (let i = 0; i < Number(NUM_COLLECTORS); i++) {
|
|
6396
|
+
tx.pay.ToContract(
|
|
6397
|
+
createScriptAddress(
|
|
6398
|
+
lucid.config().network,
|
|
6399
|
+
(0, import_lucid57.validatorToScriptHash)(mkCollectorValidatorFromSP(collectorParams))
|
|
6400
|
+
),
|
|
6401
|
+
{
|
|
6402
|
+
kind: "inline",
|
|
6403
|
+
value: import_lucid57.Data.to(new import_lucid57.Constr(0, []))
|
|
6404
|
+
}
|
|
6405
|
+
);
|
|
6406
|
+
}
|
|
6407
|
+
await submitAndAwaitTx(lucid, tx);
|
|
6408
|
+
}
|
|
6409
|
+
async function initCDPCreator(lucid, cdpCreatorParams) {
|
|
6410
|
+
const tx = lucid.newTx();
|
|
6411
|
+
for (let i = 0; i < Number(NUM_CDP_CREATORS); i++) {
|
|
6412
|
+
tx.pay.ToContract(
|
|
6413
|
+
(0, import_lucid57.credentialToAddress)(lucid.config().network, {
|
|
6414
|
+
hash: (0, import_lucid57.validatorToScriptHash)(
|
|
6415
|
+
mkCDPCreatorValidatorFromSP(cdpCreatorParams)
|
|
6416
|
+
),
|
|
6417
|
+
type: "Script"
|
|
6418
|
+
}),
|
|
6419
|
+
{ kind: "inline", value: import_lucid57.Data.to(new import_lucid57.Constr(0, [])) },
|
|
6420
|
+
{
|
|
6421
|
+
[cdpCreatorParams.cdpCreatorNft[0].unCurrencySymbol + (0, import_lucid57.fromText)(cdpCreatorParams.cdpCreatorNft[1].unTokenName)]: 1n
|
|
6422
|
+
}
|
|
6423
|
+
);
|
|
6424
|
+
}
|
|
6425
|
+
await submitAndAwaitTx(lucid, tx);
|
|
6426
|
+
}
|
|
6427
|
+
async function initTreasury(lucid, treasuryParams, daoAsset, indyAsset, treasuryIndyAmount) {
|
|
6428
|
+
const tx = lucid.newTx().pay.ToContract(
|
|
6429
|
+
(0, import_lucid57.credentialToAddress)(lucid.config().network, {
|
|
6430
|
+
hash: (0, import_lucid57.validatorToScriptHash)(mkTreasuryValidatorFromSP(treasuryParams)),
|
|
6431
|
+
type: "Script"
|
|
6432
|
+
}),
|
|
6433
|
+
{ kind: "inline", value: import_lucid57.Data.to(new import_lucid57.Constr(0, [])) },
|
|
6434
|
+
{
|
|
6435
|
+
[daoAsset.currencySymbol + daoAsset.tokenName]: 1n,
|
|
6436
|
+
[indyAsset.currencySymbol + indyAsset.tokenName]: treasuryIndyAmount
|
|
6437
|
+
}
|
|
6438
|
+
);
|
|
6439
|
+
await submitAndAwaitTx(lucid, tx);
|
|
6440
|
+
}
|
|
6441
|
+
async function initStakingManager(lucid, stakingParams) {
|
|
6442
|
+
const tx = lucid.newTx().pay.ToContract(
|
|
6443
|
+
createScriptAddress(
|
|
6444
|
+
lucid.config().network,
|
|
6445
|
+
(0, import_lucid57.validatorToScriptHash)(mkStakingValidatorFromSP(stakingParams))
|
|
6446
|
+
),
|
|
6447
|
+
{
|
|
6448
|
+
kind: "inline",
|
|
6449
|
+
value: serialiseStakingDatum({
|
|
6450
|
+
totalStake: 0n,
|
|
6451
|
+
managerSnapshot: { snapshotAda: 0n }
|
|
6452
|
+
})
|
|
6453
|
+
},
|
|
6454
|
+
{
|
|
6455
|
+
lovelace: 5000000n,
|
|
6456
|
+
[stakingParams.stakingManagerNFT[0].unCurrencySymbol + (0, import_lucid57.fromText)(stakingParams.stakingManagerNFT[1].unTokenName)]: 1n
|
|
6457
|
+
}
|
|
6458
|
+
);
|
|
6459
|
+
await submitAndAwaitTx(lucid, tx);
|
|
6460
|
+
}
|
|
6461
|
+
async function initializeAsset(lucid, cdpParams, iassetToken, stabilityPoolParams, stabilityPoolToken, asset, now = Date.now()) {
|
|
6462
|
+
const [pkh] = await addrDetails(lucid);
|
|
6463
|
+
const priceOracleParams = {
|
|
6464
|
+
owner: pkh.hash,
|
|
6465
|
+
biasTime: asset.priceOracle.params.biasTime,
|
|
6466
|
+
expiration: asset.priceOracle.params.expirationTime
|
|
6467
|
+
};
|
|
6468
|
+
const [priceOracleStartTx, priceOracleNft] = await startPriceOracleTx(
|
|
6469
|
+
lucid,
|
|
6470
|
+
asset.name + "_ORACLE",
|
|
6471
|
+
{
|
|
6472
|
+
getOnChainInt: asset.priceOracle.startPrice
|
|
6473
|
+
},
|
|
6474
|
+
priceOracleParams,
|
|
6475
|
+
now
|
|
6476
|
+
);
|
|
6477
|
+
await submitAndAwaitTx(lucid, priceOracleStartTx);
|
|
6478
|
+
const interestOracleTokenName = asset.name + "_ORACLE";
|
|
6479
|
+
const [startInterestOracleTx, interestOracleNft] = await startInterestOracle(
|
|
6480
|
+
0n,
|
|
6481
|
+
asset.interestOracle.initialInterestRate,
|
|
6482
|
+
0n,
|
|
6483
|
+
{
|
|
6484
|
+
owner: pkh.hash,
|
|
6485
|
+
biasTime: asset.priceOracle.params.biasTime
|
|
6486
|
+
},
|
|
6487
|
+
lucid,
|
|
6488
|
+
interestOracleTokenName
|
|
6489
|
+
);
|
|
6490
|
+
await submitAndAwaitTx(lucid, startInterestOracleTx);
|
|
6491
|
+
const iassetDatum = {
|
|
6492
|
+
assetName: (0, import_lucid57.fromText)(asset.name),
|
|
6493
|
+
price: {
|
|
6494
|
+
Oracle: {
|
|
6495
|
+
content: priceOracleNft
|
|
6496
|
+
}
|
|
6497
|
+
},
|
|
6498
|
+
interestOracleNft,
|
|
6499
|
+
redemptionRatio: { getOnChainInt: asset.redemptionRatioPercentage },
|
|
6500
|
+
maintenanceRatio: { getOnChainInt: asset.maintenanceRatioPercentage },
|
|
6501
|
+
liquidationRatio: { getOnChainInt: asset.liquidationRatioPercentage },
|
|
6502
|
+
debtMintingFeePercentage: { getOnChainInt: asset.debtMintingFeePercentage },
|
|
6503
|
+
liquidationProcessingFeePercentage: {
|
|
6504
|
+
getOnChainInt: asset.liquidationProcessingFeePercentage
|
|
6505
|
+
},
|
|
6506
|
+
stabilityPoolWithdrawalFeePercentage: {
|
|
6507
|
+
getOnChainInt: asset.stabilityPoolWithdrawalFeePercentage
|
|
6508
|
+
},
|
|
6509
|
+
redemptionReimbursementPercentage: {
|
|
6510
|
+
getOnChainInt: asset.redemptionReimbursementPercentage
|
|
6511
|
+
},
|
|
6512
|
+
redemptionProcessingFeePercentage: {
|
|
6513
|
+
getOnChainInt: asset.redemptionProcessingFeePercentage
|
|
6514
|
+
},
|
|
6515
|
+
interestCollectorPortionPercentage: {
|
|
6516
|
+
getOnChainInt: asset.interestCollectorPortionPercentage
|
|
6517
|
+
},
|
|
6518
|
+
firstIAsset: true,
|
|
6519
|
+
nextIAsset: asset.nextAsset ? (0, import_lucid57.fromText)(asset.nextAsset) : null
|
|
6520
|
+
};
|
|
6521
|
+
const assetTx = lucid.newTx().pay.ToContract(
|
|
6522
|
+
createScriptAddress(
|
|
6523
|
+
lucid.config().network,
|
|
6524
|
+
(0, import_lucid57.validatorToScriptHash)(mkCdpValidatorFromSP(cdpParams))
|
|
6525
|
+
),
|
|
6526
|
+
{ kind: "inline", value: serialiseIAssetDatum(iassetDatum) },
|
|
6527
|
+
{ [iassetToken.currencySymbol + iassetToken.tokenName]: 1n }
|
|
6528
|
+
);
|
|
6529
|
+
await submitAndAwaitTx(lucid, assetTx);
|
|
6530
|
+
const stabilityPoolDatum = {
|
|
6531
|
+
asset: (0, import_lucid57.fromHex)((0, import_lucid57.fromText)(asset.name)),
|
|
6532
|
+
poolSnapshot: initSpSnapshot,
|
|
6533
|
+
epochToScaleToSum: initEpochToScaleToSumMap()
|
|
6534
|
+
};
|
|
6535
|
+
const spTx = lucid.newTx().pay.ToContract(
|
|
6536
|
+
(0, import_lucid57.credentialToAddress)(lucid.config().network, {
|
|
6537
|
+
hash: (0, import_lucid57.validatorToScriptHash)(
|
|
6538
|
+
mkStabilityPoolValidatorFromSP(stabilityPoolParams)
|
|
6539
|
+
),
|
|
6540
|
+
type: "Script"
|
|
6541
|
+
}),
|
|
6542
|
+
{
|
|
6543
|
+
kind: "inline",
|
|
6544
|
+
value: serialiseStabilityPoolDatum({ StabilityPool: stabilityPoolDatum })
|
|
6545
|
+
},
|
|
6546
|
+
{
|
|
6547
|
+
[stabilityPoolToken.currencySymbol + stabilityPoolToken.tokenName]: 1n
|
|
6548
|
+
}
|
|
6549
|
+
);
|
|
6550
|
+
await submitAndAwaitTx(lucid, spTx);
|
|
6551
|
+
return { iassetTokenNameAscii: asset.name, oracleParams: priceOracleParams };
|
|
6552
|
+
}
|
|
6553
|
+
async function initGovernance(lucid, governanceParams, govToken, initialAssets) {
|
|
6554
|
+
const datum = {
|
|
6555
|
+
currentProposal: 0n,
|
|
6556
|
+
currentVersion: 0n,
|
|
6557
|
+
protocolParams: {
|
|
6558
|
+
effectiveDelay: 1000n,
|
|
6559
|
+
expirationPeriod: 180000n,
|
|
6560
|
+
proposalDeposit: 1000n,
|
|
6561
|
+
proposingPeriod: 100000n,
|
|
6562
|
+
collateralFeePercentage: {
|
|
6563
|
+
getOnChainInt: 1500000n
|
|
6564
|
+
},
|
|
6565
|
+
votingPeriod: 1000000n,
|
|
6566
|
+
totalShards: 4n,
|
|
6567
|
+
minimumQuorum: 100000n,
|
|
6568
|
+
maxTreasuryLovelaceSpend: 10000000n,
|
|
6569
|
+
maxTreasuryIndySpend: 10000000n
|
|
6570
|
+
},
|
|
6571
|
+
activeProposals: 0n,
|
|
6572
|
+
treasuryIndyWithdrawnAmt: 0n,
|
|
6573
|
+
iassetsCount: BigInt(initialAssets.length)
|
|
6574
|
+
};
|
|
6575
|
+
const tx = lucid.newTx().pay.ToContract(
|
|
6576
|
+
(0, import_lucid57.credentialToAddress)(lucid.config().network, {
|
|
6577
|
+
hash: (0, import_lucid57.validatorToScriptHash)(mkGovValidatorFromSP(governanceParams)),
|
|
6578
|
+
type: "Script"
|
|
6579
|
+
}),
|
|
6580
|
+
{ kind: "inline", value: serialiseGovDatum(datum) },
|
|
6581
|
+
{
|
|
6582
|
+
[govToken.currencySymbol + govToken.tokenName]: 1n
|
|
6583
|
+
}
|
|
6584
|
+
);
|
|
6585
|
+
await submitAndAwaitTx(lucid, tx);
|
|
6586
|
+
}
|
|
6587
|
+
async function mintAuthTokenDirect(lucid, asset, tokenName, amount) {
|
|
6588
|
+
const script = mkAuthTokenPolicy(asset, (0, import_lucid57.fromText)(tokenName));
|
|
6589
|
+
const policyId = (0, import_lucid57.mintingPolicyToId)(script);
|
|
6590
|
+
const address = await lucid.wallet().address();
|
|
6591
|
+
const utxos = await lucid.utxosAtWithUnit(
|
|
6592
|
+
address,
|
|
6593
|
+
asset.currencySymbol + asset.tokenName
|
|
6594
|
+
);
|
|
6595
|
+
if (utxos.length === 0) {
|
|
6596
|
+
throw new Error("No utxos found");
|
|
6597
|
+
}
|
|
6598
|
+
const tx = lucid.newTx().attach.MintingPolicy(script).collectFrom(utxos).mintAssets(
|
|
6599
|
+
{
|
|
6600
|
+
[policyId + (0, import_lucid57.fromText)(tokenName)]: amount
|
|
6601
|
+
},
|
|
6602
|
+
import_lucid57.Data.to(new import_lucid57.Constr(0, []))
|
|
6603
|
+
);
|
|
6604
|
+
await submitAndAwaitTx(lucid, tx);
|
|
6605
|
+
}
|
|
6606
|
+
async function init(lucid, initialAssets, now = Date.now()) {
|
|
6607
|
+
const indyAsset = {
|
|
6608
|
+
currencySymbol: await mintOneTimeToken(
|
|
6609
|
+
lucid,
|
|
6610
|
+
(0, import_lucid57.fromText)(INDY_TOKEN_NAME),
|
|
6611
|
+
TOTAL_INDY_SUPPLY
|
|
6612
|
+
),
|
|
6613
|
+
tokenName: (0, import_lucid57.fromText)(INDY_TOKEN_NAME)
|
|
6614
|
+
};
|
|
6615
|
+
const daoAsset = {
|
|
6616
|
+
currencySymbol: await mintOneTimeToken(lucid, (0, import_lucid57.fromText)(DAO_TOKEN_NAME), 1n),
|
|
6617
|
+
tokenName: (0, import_lucid57.fromText)(DAO_TOKEN_NAME)
|
|
6618
|
+
};
|
|
6619
|
+
const govNftAsset = {
|
|
6620
|
+
currencySymbol: await mintOneTimeToken(
|
|
6621
|
+
lucid,
|
|
6622
|
+
(0, import_lucid57.fromText)(GOV_NFT_TOKEN_NAME),
|
|
6623
|
+
1n
|
|
6624
|
+
),
|
|
6625
|
+
tokenName: (0, import_lucid57.fromText)(GOV_NFT_TOKEN_NAME)
|
|
6626
|
+
};
|
|
6627
|
+
const pollTokenPolicy = mkAuthTokenPolicy(
|
|
6628
|
+
govNftAsset,
|
|
6629
|
+
(0, import_lucid57.fromText)(POLL_MANAGER_TOKEN_NAME)
|
|
6630
|
+
);
|
|
6631
|
+
const pollToken = {
|
|
6632
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(pollTokenPolicy),
|
|
6633
|
+
tokenName: (0, import_lucid57.fromText)(POLL_MANAGER_TOKEN_NAME)
|
|
6634
|
+
};
|
|
6635
|
+
const upgradeTokenPolicy = mkAuthTokenPolicy(
|
|
6636
|
+
pollToken,
|
|
6637
|
+
(0, import_lucid57.fromText)(UPGRADE_TOKEN_NAME)
|
|
6638
|
+
);
|
|
6639
|
+
const upgradeToken = {
|
|
6640
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(upgradeTokenPolicy),
|
|
6641
|
+
tokenName: (0, import_lucid57.fromText)(UPGRADE_TOKEN_NAME)
|
|
6642
|
+
};
|
|
6643
|
+
const iassetTokenPolicy = mkAuthTokenPolicy(
|
|
6644
|
+
upgradeToken,
|
|
6645
|
+
(0, import_lucid57.fromText)(IASSET_TOKEN_NAME)
|
|
6646
|
+
);
|
|
6647
|
+
const iassetToken = {
|
|
6648
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(iassetTokenPolicy),
|
|
6649
|
+
tokenName: (0, import_lucid57.fromText)(IASSET_TOKEN_NAME)
|
|
6650
|
+
};
|
|
6651
|
+
const stabilityPoolTokenPolicy = mkAuthTokenPolicy(
|
|
6652
|
+
upgradeToken,
|
|
6653
|
+
(0, import_lucid57.fromText)(STABILITY_POOL_TOKEN_NAME)
|
|
6654
|
+
);
|
|
6655
|
+
const stabilityPoolToken = {
|
|
6656
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(stabilityPoolTokenPolicy),
|
|
6657
|
+
tokenName: (0, import_lucid57.fromText)(STABILITY_POOL_TOKEN_NAME)
|
|
6658
|
+
};
|
|
6659
|
+
const versionRecordParams = {
|
|
6660
|
+
upgradeToken: toSystemParamsAsset(upgradeToken)
|
|
6661
|
+
};
|
|
6662
|
+
const versionRecordTokenPolicy = mkVersionRecordTokenPolicy({
|
|
6663
|
+
upgradeToken
|
|
6664
|
+
});
|
|
6665
|
+
const versionRecordToken = {
|
|
6666
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(versionRecordTokenPolicy),
|
|
6667
|
+
tokenName: (0, import_lucid57.fromText)(VERSION_RECORD_TOKEN_NAME)
|
|
6668
|
+
};
|
|
6669
|
+
const versionRegistryValidator = mkVersionRegistryValidator();
|
|
6670
|
+
const versionRegistryValHash = (0, import_lucid57.validatorToScriptHash)(
|
|
6671
|
+
versionRegistryValidator
|
|
6672
|
+
);
|
|
6673
|
+
const cdpCreatorAsset = {
|
|
6674
|
+
currencySymbol: await mintOneTimeToken(
|
|
6675
|
+
lucid,
|
|
6676
|
+
(0, import_lucid57.fromText)(CDP_CREATOR_TOKEN_NAME),
|
|
6677
|
+
NUM_CDP_CREATORS
|
|
6678
|
+
),
|
|
6679
|
+
tokenName: (0, import_lucid57.fromText)(CDP_CREATOR_TOKEN_NAME)
|
|
6680
|
+
};
|
|
6681
|
+
const cdpTokenPolicy = mkAuthTokenPolicy(
|
|
6682
|
+
cdpCreatorAsset,
|
|
6683
|
+
(0, import_lucid57.fromText)(CDP_TOKEN_NAME)
|
|
6684
|
+
);
|
|
6685
|
+
const cdpToken = {
|
|
6686
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(cdpTokenPolicy),
|
|
6687
|
+
tokenName: (0, import_lucid57.fromText)(CDP_TOKEN_NAME)
|
|
6688
|
+
};
|
|
6689
|
+
const stakingManagerAsset = {
|
|
6690
|
+
currencySymbol: await mintOneTimeToken(
|
|
6691
|
+
lucid,
|
|
6692
|
+
(0, import_lucid57.fromText)(STAKING_MANAGER_TOKEN_NAME),
|
|
6693
|
+
1n
|
|
6694
|
+
),
|
|
6695
|
+
tokenName: (0, import_lucid57.fromText)(STAKING_MANAGER_TOKEN_NAME)
|
|
6696
|
+
};
|
|
6697
|
+
const stakingTokenPolicy = mkAuthTokenPolicy(
|
|
6698
|
+
stakingManagerAsset,
|
|
6699
|
+
(0, import_lucid57.fromText)(STAKING_TOKEN_NAME)
|
|
6700
|
+
);
|
|
6701
|
+
const stakingToken = {
|
|
6702
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(stakingTokenPolicy),
|
|
6703
|
+
tokenName: (0, import_lucid57.fromText)(STAKING_TOKEN_NAME)
|
|
6704
|
+
};
|
|
6705
|
+
const collectorParams = {
|
|
6706
|
+
stakingManagerNFT: toSystemParamsAsset(stakingManagerAsset),
|
|
6707
|
+
stakingToken: toSystemParamsAsset(stakingToken),
|
|
6708
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken)
|
|
6709
|
+
};
|
|
6710
|
+
const collectorValidator = mkCollectorValidatorFromSP(collectorParams);
|
|
6711
|
+
const collectorValHash = (0, import_lucid57.validatorToScriptHash)(collectorValidator);
|
|
6712
|
+
const stakingParams = {
|
|
6713
|
+
stakingManagerNFT: toSystemParamsAsset(stakingManagerAsset),
|
|
6714
|
+
stakingToken: toSystemParamsAsset(stakingToken),
|
|
6715
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken),
|
|
6716
|
+
pollToken: toSystemParamsAsset(pollToken),
|
|
6717
|
+
indyToken: toSystemParamsAsset(indyAsset),
|
|
6718
|
+
collectorValHash
|
|
6719
|
+
};
|
|
6720
|
+
const stakingValHash = (0, import_lucid57.validatorToScriptHash)(
|
|
6721
|
+
mkStakingValidatorFromSP(stakingParams)
|
|
6722
|
+
);
|
|
6723
|
+
await initStakingManager(lucid, stakingParams);
|
|
6724
|
+
const assetSymbolPolicy = mkIAssetTokenPolicy(cdpToken);
|
|
6725
|
+
const assetSymbol = (0, import_lucid57.mintingPolicyToId)(assetSymbolPolicy);
|
|
6726
|
+
const snapshotEpochToScaleToSumTokenPolicy = mkAuthTokenPolicy(
|
|
6727
|
+
stabilityPoolToken,
|
|
6728
|
+
(0, import_lucid57.fromText)(SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME)
|
|
6729
|
+
);
|
|
6730
|
+
const snapshotEpochToScaleToSumToken = {
|
|
6731
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(snapshotEpochToScaleToSumTokenPolicy),
|
|
6732
|
+
tokenName: (0, import_lucid57.fromText)(SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME)
|
|
6733
|
+
};
|
|
6734
|
+
const accountTokenPolicy = mkAuthTokenPolicy(
|
|
6735
|
+
stabilityPoolToken,
|
|
6736
|
+
(0, import_lucid57.fromText)(ACCOUNT_TOKEN_NAME)
|
|
6737
|
+
);
|
|
6738
|
+
const accountToken = {
|
|
6739
|
+
currencySymbol: (0, import_lucid57.mintingPolicyToId)(accountTokenPolicy),
|
|
6740
|
+
tokenName: (0, import_lucid57.fromText)(ACCOUNT_TOKEN_NAME)
|
|
6741
|
+
};
|
|
6742
|
+
const stabilityPoolParams = {
|
|
6743
|
+
assetSymbol: { unCurrencySymbol: assetSymbol },
|
|
6744
|
+
stabilityPoolToken: toSystemParamsAsset(stabilityPoolToken),
|
|
6745
|
+
snapshotEpochToScaleToSumToken: toSystemParamsAsset(
|
|
6746
|
+
snapshotEpochToScaleToSumToken
|
|
6747
|
+
),
|
|
6748
|
+
accountToken: toSystemParamsAsset(accountToken),
|
|
6749
|
+
cdpToken: toSystemParamsAsset(cdpToken),
|
|
6750
|
+
iAssetAuthToken: toSystemParamsAsset(iassetToken),
|
|
6751
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken),
|
|
6752
|
+
collectorValHash,
|
|
6753
|
+
govNFT: toSystemParamsAsset(govNftAsset),
|
|
6754
|
+
accountCreateFeeLovelaces: 5e6,
|
|
6755
|
+
accountAdjustmentFeeLovelaces: 5e6,
|
|
6756
|
+
requestCollateralLovelaces: 5e6
|
|
6757
|
+
};
|
|
6758
|
+
const stabilityPoolValidator = mkStabilityPoolValidatorFromSP(stabilityPoolParams);
|
|
6759
|
+
const stabilityPoolValHash = (0, import_lucid57.validatorToScriptHash)(stabilityPoolValidator);
|
|
6760
|
+
const treasuryParams = {
|
|
6761
|
+
upgradeToken: toSystemParamsAsset(upgradeToken),
|
|
6762
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken),
|
|
6763
|
+
treasuryUtxosStakeCredential: void 0
|
|
6764
|
+
};
|
|
6765
|
+
const treasuryValidator = mkTreasuryValidatorFromSP(treasuryParams);
|
|
6766
|
+
const treasuryValHash = (0, import_lucid57.validatorToScriptHash)(treasuryValidator);
|
|
6767
|
+
await initTreasury(
|
|
6768
|
+
lucid,
|
|
6769
|
+
treasuryParams,
|
|
6770
|
+
daoAsset,
|
|
6771
|
+
indyAsset,
|
|
6772
|
+
TREASURY_INDY_AMOUNT
|
|
6773
|
+
);
|
|
6774
|
+
const cdpParams = {
|
|
6775
|
+
cdpAuthToken: toSystemParamsAsset(cdpToken),
|
|
6776
|
+
cdpAssetSymbol: { unCurrencySymbol: assetSymbol },
|
|
6777
|
+
iAssetAuthToken: toSystemParamsAsset(iassetToken),
|
|
6778
|
+
stabilityPoolAuthToken: toSystemParamsAsset(stabilityPoolToken),
|
|
6779
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken),
|
|
6780
|
+
upgradeToken: toSystemParamsAsset(upgradeToken),
|
|
6781
|
+
collectorValHash,
|
|
6782
|
+
spValHash: stabilityPoolValHash,
|
|
6783
|
+
govNFT: toSystemParamsAsset(govNftAsset),
|
|
6784
|
+
minCollateralInLovelace: 1e7,
|
|
6785
|
+
partialRedemptionExtraFeeLovelace: 1e7,
|
|
6786
|
+
biasTime: 18e4,
|
|
6787
|
+
treasuryValHash
|
|
6788
|
+
};
|
|
6789
|
+
const cdpValHash = (0, import_lucid57.validatorToScriptHash)(mkCdpValidatorFromSP(cdpParams));
|
|
6790
|
+
const cdpCreatorParams = {
|
|
6791
|
+
cdpCreatorNft: toSystemParamsAsset(cdpCreatorAsset),
|
|
6792
|
+
cdpAssetCs: { unCurrencySymbol: assetSymbol },
|
|
6793
|
+
cdpAuthTk: toSystemParamsAsset(cdpToken),
|
|
6794
|
+
iAssetAuthTk: toSystemParamsAsset(iassetToken),
|
|
6795
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken),
|
|
6796
|
+
cdpScriptHash: cdpValHash,
|
|
6797
|
+
collectorValHash,
|
|
6798
|
+
minCollateralInLovelace: 1e7,
|
|
6799
|
+
biasTime: 180000n
|
|
6800
|
+
};
|
|
6801
|
+
const cdpCreatorValidator = mkCDPCreatorValidatorFromSP(cdpCreatorParams);
|
|
6802
|
+
const cdpCreatorValHash = (0, import_lucid57.validatorToScriptHash)(cdpCreatorValidator);
|
|
6803
|
+
await initCDPCreator(lucid, cdpCreatorParams);
|
|
6804
|
+
await initCollector(lucid, collectorParams);
|
|
6805
|
+
const assetInfos = [];
|
|
6806
|
+
if (initialAssets.length > 0) {
|
|
6807
|
+
await mintAuthTokenDirect(lucid, govNftAsset, POLL_MANAGER_TOKEN_NAME, 1n);
|
|
6808
|
+
await mintAuthTokenDirect(lucid, pollToken, UPGRADE_TOKEN_NAME, 1n);
|
|
6809
|
+
for (const asset of initialAssets) {
|
|
6810
|
+
await mintAuthTokenDirect(lucid, upgradeToken, IASSET_TOKEN_NAME, 1n);
|
|
6811
|
+
await mintAuthTokenDirect(
|
|
6812
|
+
lucid,
|
|
6813
|
+
upgradeToken,
|
|
6814
|
+
STABILITY_POOL_TOKEN_NAME,
|
|
6815
|
+
1n
|
|
6816
|
+
);
|
|
6817
|
+
const assetInfo = await initializeAsset(
|
|
6818
|
+
lucid,
|
|
6819
|
+
cdpParams,
|
|
6820
|
+
iassetToken,
|
|
6821
|
+
stabilityPoolParams,
|
|
6822
|
+
stabilityPoolToken,
|
|
6823
|
+
asset,
|
|
6824
|
+
now
|
|
6825
|
+
);
|
|
6826
|
+
assetInfos.push(assetInfo);
|
|
6827
|
+
}
|
|
6828
|
+
await mintAuthTokenDirect(lucid, pollToken, UPGRADE_TOKEN_NAME, -1n);
|
|
6829
|
+
await mintAuthTokenDirect(lucid, govNftAsset, POLL_MANAGER_TOKEN_NAME, -1n);
|
|
6830
|
+
}
|
|
6831
|
+
const executeParams = {
|
|
6832
|
+
govNFT: toSystemParamsAsset(govNftAsset),
|
|
6833
|
+
upgradeToken: toSystemParamsAsset(upgradeToken),
|
|
6834
|
+
iAssetToken: toSystemParamsAsset(iassetToken),
|
|
6835
|
+
stabilityPoolToken: toSystemParamsAsset(stabilityPoolToken),
|
|
6836
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken),
|
|
6837
|
+
cdpValHash,
|
|
6838
|
+
sPoolValHash: stabilityPoolValHash,
|
|
6839
|
+
versionRegistryValHash,
|
|
6840
|
+
treasuryValHash,
|
|
6841
|
+
indyAsset: toSystemParamsAsset(indyAsset)
|
|
6842
|
+
};
|
|
6843
|
+
const executeValidator = mkExecuteValidatorFromSP(executeParams);
|
|
6844
|
+
const executeValHash = (0, import_lucid57.validatorToScriptHash)(executeValidator);
|
|
6845
|
+
const pollShardParams = {
|
|
6846
|
+
pollToken: toSystemParamsAsset(pollToken),
|
|
6847
|
+
stakingToken: toSystemParamsAsset(stakingToken),
|
|
6848
|
+
indyAsset: toSystemParamsAsset(indyAsset),
|
|
6849
|
+
stakingValHash
|
|
6850
|
+
};
|
|
6851
|
+
const pollShardValidator = mkPollShardValidatorFromSP(pollShardParams);
|
|
6852
|
+
const pollShardValHash = (0, import_lucid57.validatorToScriptHash)(pollShardValidator);
|
|
6853
|
+
const pollManagerParams = {
|
|
6854
|
+
govNFT: toSystemParamsAsset(govNftAsset),
|
|
6855
|
+
pollToken: toSystemParamsAsset(pollToken),
|
|
6856
|
+
upgradeToken: toSystemParamsAsset(upgradeToken),
|
|
6857
|
+
indyAsset: toSystemParamsAsset(indyAsset),
|
|
6858
|
+
govExecuteValHash: executeValHash,
|
|
6859
|
+
pBiasTime: 120000n,
|
|
6860
|
+
shardsValHash: pollShardValHash,
|
|
6861
|
+
treasuryValHash,
|
|
6862
|
+
initialIndyDistribution: 1575000000000n
|
|
6863
|
+
};
|
|
6864
|
+
const pollManagerValidator = mkPollManagerValidatorFromSP(pollManagerParams);
|
|
6865
|
+
const pollManagerValHash = (0, import_lucid57.validatorToScriptHash)(pollManagerValidator);
|
|
6866
|
+
const govParams = {
|
|
6867
|
+
gBiasTime: 120000n,
|
|
6868
|
+
govNFT: toSystemParamsAsset(govNftAsset),
|
|
6869
|
+
pollToken: toSystemParamsAsset(pollToken),
|
|
6870
|
+
upgradeToken: toSystemParamsAsset(upgradeToken),
|
|
6871
|
+
indyAsset: toSystemParamsAsset(indyAsset),
|
|
6872
|
+
versionRecordToken: toSystemParamsAsset(versionRecordToken),
|
|
6873
|
+
pollManagerValHash,
|
|
6874
|
+
daoIdentityToken: toSystemParamsAsset(daoAsset),
|
|
6875
|
+
iAssetAuthToken: toSystemParamsAsset(iassetToken)
|
|
6876
|
+
};
|
|
6877
|
+
const govValidator = mkGovValidatorFromSP(govParams);
|
|
6878
|
+
const govValHash = (0, import_lucid57.validatorToScriptHash)(govValidator);
|
|
6879
|
+
await initGovernance(lucid, govParams, govNftAsset, initialAssets);
|
|
6880
|
+
const lrpParams = {
|
|
6881
|
+
iassetNft: cdpParams.iAssetAuthToken,
|
|
6882
|
+
iassetPolicyId: cdpParams.cdpAssetSymbol,
|
|
6883
|
+
minRedemptionLovelacesAmt: 10000000n,
|
|
6884
|
+
versionRecordToken: cdpParams.versionRecordToken
|
|
6885
|
+
};
|
|
6886
|
+
const lrpValidator = mkLrpValidatorFromSP(lrpParams);
|
|
6887
|
+
const lrpValHash = (0, import_lucid57.validatorToScriptHash)(lrpValidator);
|
|
6888
|
+
const scriptRefCalls = [
|
|
6889
|
+
() => initScriptRef(lucid, lrpValidator),
|
|
6890
|
+
() => initScriptRef(lucid, cdpCreatorValidator),
|
|
6891
|
+
() => initScriptRef(lucid, mkCdpValidatorFromSP(cdpParams)),
|
|
6892
|
+
() => initScriptRef(lucid, collectorValidator),
|
|
6893
|
+
() => initScriptRef(lucid, executeValidator),
|
|
6894
|
+
() => initScriptRef(lucid, govValidator),
|
|
6895
|
+
() => initScriptRef(lucid, pollShardValidator),
|
|
6896
|
+
() => initScriptRef(lucid, pollManagerValidator),
|
|
6897
|
+
() => initScriptRef(lucid, assetSymbolPolicy),
|
|
6898
|
+
() => initScriptRef(lucid, mkStakingValidatorFromSP(stakingParams)),
|
|
6899
|
+
() => initScriptRef(lucid, stabilityPoolValidator),
|
|
6900
|
+
() => initScriptRef(lucid, treasuryValidator),
|
|
6901
|
+
() => initScriptRef(lucid, govValidator),
|
|
6902
|
+
() => initScriptRef(lucid, versionRegistryValidator),
|
|
6903
|
+
() => initScriptRef(
|
|
6904
|
+
lucid,
|
|
6905
|
+
versionRecordTokenPolicy
|
|
6906
|
+
),
|
|
6907
|
+
() => initScriptRef(lucid, cdpTokenPolicy),
|
|
6908
|
+
() => initScriptRef(lucid, iassetTokenPolicy),
|
|
6909
|
+
() => initScriptRef(lucid, accountTokenPolicy),
|
|
6910
|
+
() => initScriptRef(
|
|
6911
|
+
lucid,
|
|
6912
|
+
stabilityPoolTokenPolicy
|
|
6913
|
+
),
|
|
6914
|
+
() => initScriptRef(lucid, pollTokenPolicy),
|
|
6915
|
+
() => initScriptRef(lucid, stakingTokenPolicy),
|
|
6916
|
+
() => initScriptRef(
|
|
6917
|
+
lucid,
|
|
6918
|
+
versionRecordTokenPolicy
|
|
6919
|
+
),
|
|
6920
|
+
() => initScriptRef(lucid, assetSymbolPolicy),
|
|
6921
|
+
() => initScriptRef(lucid, upgradeTokenPolicy),
|
|
6922
|
+
() => initScriptRef(
|
|
6923
|
+
lucid,
|
|
6924
|
+
stabilityPoolTokenPolicy
|
|
6925
|
+
),
|
|
6926
|
+
() => initScriptRef(
|
|
6927
|
+
lucid,
|
|
6928
|
+
snapshotEpochToScaleToSumTokenPolicy
|
|
6929
|
+
)
|
|
6930
|
+
];
|
|
6931
|
+
const scriptRefInputs = [];
|
|
6932
|
+
for (const fn of scriptRefCalls) {
|
|
6933
|
+
scriptRefInputs.push(await fn());
|
|
6934
|
+
}
|
|
6935
|
+
const [
|
|
6936
|
+
lrpValidatorRef,
|
|
6937
|
+
cdpCreatorValidatorRef,
|
|
6938
|
+
cdpValidatorRef,
|
|
6939
|
+
collectorValidatorRef,
|
|
6940
|
+
executeValidatorRef,
|
|
6941
|
+
govValidatorRef,
|
|
6942
|
+
pollShardValidatorRef,
|
|
6943
|
+
pollManagerValidatorRef,
|
|
6944
|
+
iAssetTokenPolicyRef,
|
|
6945
|
+
stakingValidatorRef,
|
|
6946
|
+
stabilityPoolValidatorRef,
|
|
6947
|
+
treasuryValidatorRef,
|
|
6948
|
+
governanceValidatorRef,
|
|
6949
|
+
versionRegistryValidatorRef,
|
|
6950
|
+
versionRecordTokenPolicyRef,
|
|
6951
|
+
cdpAuthTokenRef,
|
|
6952
|
+
iAssetAuthTokenRef,
|
|
6953
|
+
accountTokenRef,
|
|
6954
|
+
stabilityPoolAuthTokenRef,
|
|
6955
|
+
pollManagerTokenRef,
|
|
6956
|
+
stakingTokenRef,
|
|
6957
|
+
versionRecordTokenRef,
|
|
6958
|
+
iAssetTokenRef,
|
|
6959
|
+
upgradeTokenRef,
|
|
6960
|
+
stabilityPoolTokenRef,
|
|
6961
|
+
snapshotEpochToScaleToSumTokenRef
|
|
6962
|
+
] = scriptRefInputs;
|
|
6963
|
+
return [
|
|
6964
|
+
{
|
|
6965
|
+
cdpParams,
|
|
6966
|
+
cdpCreatorParams,
|
|
6967
|
+
collectorParams,
|
|
6968
|
+
executeParams,
|
|
6969
|
+
govParams,
|
|
6970
|
+
stakingParams,
|
|
6971
|
+
stabilityPoolParams,
|
|
6972
|
+
treasuryParams,
|
|
6973
|
+
pollShardParams,
|
|
6974
|
+
pollManagerParams,
|
|
6975
|
+
indyToken: toSystemParamsAsset(indyAsset),
|
|
6976
|
+
distributionParams: {
|
|
6977
|
+
treasuryIndyAmount: 1575e9,
|
|
6978
|
+
totalINDYSupply: 35e12,
|
|
6979
|
+
initialIndyDistribution: 1575e9
|
|
6980
|
+
},
|
|
6981
|
+
lrpParams,
|
|
6982
|
+
versionRecordParams,
|
|
6983
|
+
startTime: {
|
|
6984
|
+
slot: 0,
|
|
6985
|
+
blockHeader: ""
|
|
6986
|
+
},
|
|
6987
|
+
scriptReferences: {
|
|
6988
|
+
lrpValidatorRef: { input: lrpValidatorRef },
|
|
6989
|
+
cdpCreatorValidatorRef: { input: cdpCreatorValidatorRef },
|
|
6990
|
+
cdpValidatorRef: { input: cdpValidatorRef },
|
|
6991
|
+
collectorValidatorRef: { input: collectorValidatorRef },
|
|
6992
|
+
executeValidatorRef: { input: executeValidatorRef },
|
|
6993
|
+
govValidatorRef: { input: govValidatorRef },
|
|
6994
|
+
pollShardValidatorRef: { input: pollShardValidatorRef },
|
|
6995
|
+
pollManagerValidatorRef: { input: pollManagerValidatorRef },
|
|
6996
|
+
iAssetTokenPolicyRef: { input: iAssetTokenPolicyRef },
|
|
6997
|
+
stakingValidatorRef: { input: stakingValidatorRef },
|
|
6998
|
+
stabilityPoolValidatorRef: { input: stabilityPoolValidatorRef },
|
|
6999
|
+
treasuryValidatorRef: { input: treasuryValidatorRef },
|
|
7000
|
+
governanceValidatorRef: { input: governanceValidatorRef },
|
|
7001
|
+
versionRegistryValidatorRef: { input: versionRegistryValidatorRef },
|
|
7002
|
+
versionRecordTokenPolicyRef: { input: versionRecordTokenPolicyRef },
|
|
7003
|
+
authTokenPolicies: {
|
|
7004
|
+
cdpAuthTokenRef: { input: cdpAuthTokenRef },
|
|
7005
|
+
iAssetAuthTokenRef: { input: iAssetAuthTokenRef },
|
|
7006
|
+
accountTokenRef: { input: accountTokenRef },
|
|
7007
|
+
stabilityPoolAuthTokenRef: { input: stabilityPoolAuthTokenRef },
|
|
7008
|
+
pollManagerTokenRef: { input: pollManagerTokenRef },
|
|
7009
|
+
stakingTokenRef: { input: stakingTokenRef },
|
|
7010
|
+
versionRecordTokenRef: { input: versionRecordTokenRef },
|
|
7011
|
+
iAssetTokenRef: { input: iAssetTokenRef },
|
|
7012
|
+
upgradeTokenRef: { input: upgradeTokenRef },
|
|
7013
|
+
stabilityPoolTokenRef: { input: stabilityPoolTokenRef },
|
|
7014
|
+
snapshotEpochToScaleToSumTokenRef: {
|
|
7015
|
+
input: snapshotEpochToScaleToSumTokenRef
|
|
7016
|
+
}
|
|
7017
|
+
}
|
|
7018
|
+
},
|
|
7019
|
+
validatorHashes: {
|
|
7020
|
+
cdpCreatorHash: cdpCreatorValHash,
|
|
7021
|
+
cdpHash: cdpValHash,
|
|
7022
|
+
executeHash: executeValHash,
|
|
7023
|
+
govHash: govValHash,
|
|
7024
|
+
pollShardHash: pollShardValHash,
|
|
7025
|
+
pollManagerHash: pollManagerValHash,
|
|
7026
|
+
treasuryHash: treasuryValHash,
|
|
7027
|
+
stabilityPoolHash: stabilityPoolValHash,
|
|
7028
|
+
stakingHash: stakingValHash,
|
|
7029
|
+
collectorHash: collectorValHash,
|
|
7030
|
+
versionRegistryHash: versionRegistryValHash,
|
|
7031
|
+
lrpHash: lrpValHash
|
|
7032
|
+
}
|
|
7033
|
+
},
|
|
7034
|
+
assetInfos
|
|
7035
|
+
];
|
|
7036
|
+
}
|
|
6163
7037
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6164
7038
|
0 && (module.exports = {
|
|
7039
|
+
ACCOUNT_TOKEN_NAME,
|
|
7040
|
+
ALWAYS_FAIL_VALIDATOR_HASH,
|
|
6165
7041
|
AccountContentSchema,
|
|
6166
7042
|
ActionReturnDatum,
|
|
6167
7043
|
ActionReturnDatumSchema,
|
|
@@ -6173,16 +7049,22 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6173
7049
|
CDPCreatorRedeemer,
|
|
6174
7050
|
CDPDatumSchema,
|
|
6175
7051
|
CDPFeesSchema,
|
|
7052
|
+
CDP_CREATOR_TOKEN_NAME,
|
|
7053
|
+
CDP_TOKEN_NAME,
|
|
6176
7054
|
CredentialD,
|
|
6177
7055
|
CredentialSchema,
|
|
7056
|
+
DAO_TOKEN_NAME,
|
|
6178
7057
|
EpochToScaleToSumSchema,
|
|
6179
7058
|
ExecuteDatum,
|
|
6180
7059
|
ExecuteParams,
|
|
6181
7060
|
FeedInterestOracleRedeemerSchema,
|
|
7061
|
+
GOV_NFT_TOKEN_NAME,
|
|
6182
7062
|
GovParams,
|
|
6183
7063
|
GovRedeemer,
|
|
7064
|
+
IASSET_TOKEN_NAME,
|
|
6184
7065
|
IAssetContentSchema,
|
|
6185
7066
|
IAssetPriceInfoSchema,
|
|
7067
|
+
INDY_TOKEN_NAME,
|
|
6186
7068
|
InterestOracleDatumSchema,
|
|
6187
7069
|
InterestOracleParamsSchema,
|
|
6188
7070
|
LRPDatumSchema,
|
|
@@ -6190,26 +7072,44 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6190
7072
|
LRPRedeemerSchema,
|
|
6191
7073
|
MAX_REDEMPTIONS_WITH_CDP_OPEN,
|
|
6192
7074
|
MIN_LRP_COLLATERAL_AMT,
|
|
7075
|
+
NUM_CDP_CREATORS,
|
|
7076
|
+
NUM_COLLECTORS,
|
|
6193
7077
|
ONE_DAY,
|
|
6194
7078
|
ONE_HOUR,
|
|
6195
7079
|
ONE_SECOND,
|
|
6196
7080
|
ONE_YEAR,
|
|
6197
7081
|
OracleAssetNftSchema,
|
|
6198
7082
|
OutputReferenceSchema,
|
|
7083
|
+
POLL_MANAGER_TOKEN_NAME,
|
|
7084
|
+
PollDatum,
|
|
6199
7085
|
PollManagerParams,
|
|
6200
7086
|
PollManagerRedeemer,
|
|
6201
7087
|
PollShardParams,
|
|
6202
7088
|
PollShardRedeemer,
|
|
6203
7089
|
PriceOracleDatumSchema,
|
|
6204
7090
|
PriceOracleParamsSchema,
|
|
7091
|
+
ProposalContent,
|
|
7092
|
+
ProposalContentSchema,
|
|
7093
|
+
ProtocolParams,
|
|
7094
|
+
ProtocolParamsSchema,
|
|
7095
|
+
SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME,
|
|
6205
7096
|
SPIntegerSchema,
|
|
7097
|
+
STABILITY_POOL_TOKEN_NAME,
|
|
7098
|
+
STAKING_MANAGER_TOKEN_NAME,
|
|
7099
|
+
STAKING_TOKEN_NAME,
|
|
6206
7100
|
SnapshotEpochToScaleToSumContentSchema,
|
|
6207
7101
|
StabilityPoolContentSchema,
|
|
6208
7102
|
StabilityPoolDatumSchema,
|
|
6209
7103
|
StabilityPoolParams,
|
|
6210
7104
|
StabilityPoolRedeemerSchema,
|
|
6211
7105
|
StakeCredentialSchema,
|
|
7106
|
+
TOTAL_INDY_SUPPLY,
|
|
7107
|
+
TREASURY_INDY_AMOUNT,
|
|
7108
|
+
TreasuryParams,
|
|
7109
|
+
TreasuryParamsSchema,
|
|
6212
7110
|
TreasuryWithdrawalSchema,
|
|
7111
|
+
UPGRADE_TOKEN_NAME,
|
|
7112
|
+
VERSION_RECORD_TOKEN_NAME,
|
|
6213
7113
|
VerificationKeyHashSchema,
|
|
6214
7114
|
VersionRecordTokenParams,
|
|
6215
7115
|
addrDetails,
|
|
@@ -6248,6 +7148,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6248
7148
|
castPriceOracleParams,
|
|
6249
7149
|
castStabilityPoolParams,
|
|
6250
7150
|
castStakingParams,
|
|
7151
|
+
castTreasuryParams,
|
|
6251
7152
|
castVersionRecordTokenParams,
|
|
6252
7153
|
cdpCollateralRatioPercentage,
|
|
6253
7154
|
claimLrp,
|
|
@@ -6279,6 +7180,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6279
7180
|
getInlineDatumOrThrow,
|
|
6280
7181
|
getRandomElement,
|
|
6281
7182
|
getSumFromEpochToScaleToSum,
|
|
7183
|
+
init,
|
|
6282
7184
|
initEpochToScaleToSumMap,
|
|
6283
7185
|
initSpSnapshot,
|
|
6284
7186
|
insertSorted,
|
|
@@ -6330,12 +7232,17 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6330
7232
|
parseInterestOracleDatum,
|
|
6331
7233
|
parseLrpDatum,
|
|
6332
7234
|
parseLrpDatumOrThrow,
|
|
7235
|
+
parsePollManager,
|
|
7236
|
+
parsePollManagerOrThrow,
|
|
7237
|
+
parsePollShard,
|
|
7238
|
+
parsePollShardOrThrow,
|
|
6333
7239
|
parsePriceOracleDatum,
|
|
6334
7240
|
parseSnapshotEpochToScaleToSumDatum,
|
|
6335
7241
|
parseStabilityPoolDatum,
|
|
6336
7242
|
parseStakingManagerDatum,
|
|
6337
7243
|
parseStakingPosition,
|
|
6338
7244
|
parseStakingPositionOrThrow,
|
|
7245
|
+
parseUpgradePaths,
|
|
6339
7246
|
processSpRequest,
|
|
6340
7247
|
randomLrpsSubsetSatisfyingTargetLovelaces,
|
|
6341
7248
|
redeemCdp,
|
|
@@ -6349,6 +7256,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6349
7256
|
serialiseCDPCreatorRedeemer,
|
|
6350
7257
|
serialiseCdpDatum,
|
|
6351
7258
|
serialiseCdpRedeemer,
|
|
7259
|
+
serialiseCollectorRedeemer,
|
|
6352
7260
|
serialiseExecuteDatum,
|
|
6353
7261
|
serialiseFeedInterestOracleRedeemer,
|
|
6354
7262
|
serialiseGovDatum,
|
|
@@ -6357,6 +7265,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6357
7265
|
serialiseInterestOracleDatum,
|
|
6358
7266
|
serialiseLrpDatum,
|
|
6359
7267
|
serialiseLrpRedeemer,
|
|
7268
|
+
serialisePollDatum,
|
|
6360
7269
|
serialisePollManagerRedeemer,
|
|
6361
7270
|
serialisePollShardRedeemer,
|
|
6362
7271
|
serialisePriceOracleDatum,
|
|
@@ -6365,6 +7274,10 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6365
7274
|
serialiseStabilityPoolRedeemer,
|
|
6366
7275
|
serialiseStakingDatum,
|
|
6367
7276
|
serialiseStakingRedeemer,
|
|
7277
|
+
serialiseTreasuryDatum,
|
|
7278
|
+
serialiseTreasuryRedeemer,
|
|
7279
|
+
serialiseUpgradePaths,
|
|
7280
|
+
serialiseWithdrawalOutputDatum,
|
|
6368
7281
|
setSumInEpochToScaleToSum,
|
|
6369
7282
|
shuffle,
|
|
6370
7283
|
spAdd,
|
|
@@ -6372,10 +7285,12 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6372
7285
|
spMul,
|
|
6373
7286
|
spSub,
|
|
6374
7287
|
startInterestOracle,
|
|
7288
|
+
submitAndAwaitTx,
|
|
6375
7289
|
summarizeActualLeverageRedemptions,
|
|
6376
7290
|
toSystemParamsAsset,
|
|
6377
7291
|
treasuryFeeTx,
|
|
6378
7292
|
updatePoolSnapshotWithdrawalFee,
|
|
7293
|
+
updateSlotConfigNetwork,
|
|
6379
7294
|
updateStakingLockedAmount,
|
|
6380
7295
|
vote,
|
|
6381
7296
|
withdrawCdp
|