@indigo-labs/indigo-sdk 0.2.41 → 0.2.43
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 +35 -47
- package/dist/index.d.ts +35 -47
- package/dist/index.js +127 -160
- package/dist/index.mjs +96 -126
- package/package.json +1 -1
- package/src/contracts/gov/transactions.ts +5 -5
- package/src/contracts/stability-pool/transactions.ts +1 -3
- package/src/index.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -161,7 +161,6 @@ __export(index_exports, {
|
|
|
161
161
|
endProposal: () => endProposal,
|
|
162
162
|
executeProposal: () => executeProposal,
|
|
163
163
|
feedInterestOracle: () => feedInterestOracle,
|
|
164
|
-
feedPriceOracleTx: () => feedPriceOracleTx,
|
|
165
164
|
findStakingManager: () => findStakingManager,
|
|
166
165
|
findStakingManagerByOutRef: () => findStakingManagerByOutRef,
|
|
167
166
|
findStakingPositionByOutRef: () => findStakingPositionByOutRef,
|
|
@@ -215,7 +214,6 @@ __export(index_exports, {
|
|
|
215
214
|
openCdp: () => openCdp,
|
|
216
215
|
openLrp: () => openLrp,
|
|
217
216
|
openStakingPosition: () => openStakingPosition,
|
|
218
|
-
oracleExpirationAwareValidity: () => oracleExpirationAwareValidity,
|
|
219
217
|
parseAccountDatum: () => parseAccountDatum,
|
|
220
218
|
parseCdpDatum: () => parseCdpDatum,
|
|
221
219
|
parseCdpDatumOrThrow: () => parseCdpDatumOrThrow,
|
|
@@ -281,7 +279,6 @@ __export(index_exports, {
|
|
|
281
279
|
spMul: () => spMul,
|
|
282
280
|
spSub: () => spSub,
|
|
283
281
|
startInterestOracle: () => startInterestOracle,
|
|
284
|
-
startPriceOracleTx: () => startPriceOracleTx,
|
|
285
282
|
submitAndAwaitTx: () => submitAndAwaitTx,
|
|
286
283
|
summarizeActualLeverageRedemptions: () => summarizeActualLeverageRedemptions,
|
|
287
284
|
toSystemParamsAsset: () => toSystemParamsAsset,
|
|
@@ -3438,7 +3435,7 @@ async function createProposal(proposalContent, treasuryWithdrawal, sysParams, lu
|
|
|
3438
3435
|
)
|
|
3439
3436
|
)
|
|
3440
3437
|
)
|
|
3441
|
-
).validFrom(Number(currentTime) - ONE_SECOND).validTo(Number(currentTime + sysParams.govParams.gBiasTime) - ONE_SECOND).addSigner(ownAddr),
|
|
3438
|
+
).validFrom(Number(currentTime) - ONE_SECOND).validTo(Number(currentTime) + Number(sysParams.govParams.gBiasTime) - ONE_SECOND).addSigner(ownAddr),
|
|
3442
3439
|
newPollId
|
|
3443
3440
|
];
|
|
3444
3441
|
}
|
|
@@ -3483,7 +3480,7 @@ async function createShardsChunks(chunkSize, pollManager, sysParams, currentSlot
|
|
|
3483
3480
|
);
|
|
3484
3481
|
const pollNft = fromSystemParamsAsset(sysParams.govParams.pollToken);
|
|
3485
3482
|
const tx = lucid.newTx().validFrom(Number(currentTime) - ONE_SECOND).validTo(
|
|
3486
|
-
Number(currentTime + sysParams.pollManagerParams.pBiasTime) - ONE_SECOND
|
|
3483
|
+
Number(currentTime) + Number(sysParams.pollManagerParams.pBiasTime) - ONE_SECOND
|
|
3487
3484
|
).mintAssets(mkAssetsOf(pollNft, shardsCount), import_lucid31.Data.void()).readFrom([pollAuthTokenPolicyRefScriptUtxo, pollManagerRefScriptUtxo]).collectFrom(
|
|
3488
3485
|
[pollManagerUtxo],
|
|
3489
3486
|
serialisePollManagerRedeemer({ CreateShards: { currentTime } })
|
|
@@ -3677,7 +3674,7 @@ async function mergeShards(pollManager, shardsOutRefs, sysParams, lucid, current
|
|
|
3677
3674
|
)(shardUtxos);
|
|
3678
3675
|
const pollNft = fromSystemParamsAsset(sysParams.govParams.pollToken);
|
|
3679
3676
|
return lucid.newTx().validFrom(Number(currentTime) - ONE_SECOND).validTo(
|
|
3680
|
-
Number(currentTime + sysParams.pollManagerParams.pBiasTime) - ONE_SECOND
|
|
3677
|
+
Number(currentTime) + Number(sysParams.pollManagerParams.pBiasTime) - ONE_SECOND
|
|
3681
3678
|
).readFrom([
|
|
3682
3679
|
pollShardRefScriptUtxo,
|
|
3683
3680
|
pollManagerRefScriptUtxo,
|
|
@@ -3778,7 +3775,7 @@ async function endProposal(pollManager, gov, sysParams, lucid, currentSlot) {
|
|
|
3778
3775
|
1n
|
|
3779
3776
|
);
|
|
3780
3777
|
const tx = lucid.newTx().validFrom(Number(currentTime) - ONE_SECOND).validTo(
|
|
3781
|
-
Number(currentTime + sysParams.pollManagerParams.pBiasTime) - ONE_SECOND
|
|
3778
|
+
Number(currentTime) + Number(sysParams.pollManagerParams.pBiasTime) - ONE_SECOND
|
|
3782
3779
|
).readFrom([
|
|
3783
3780
|
pollManagerRefScriptUtxo,
|
|
3784
3781
|
govRefScriptUtxo,
|
|
@@ -4186,7 +4183,7 @@ async function executeProposal(execute, gov, treasuryWithdrawal, allIAssetOrefs,
|
|
|
4186
4183
|
govUtxo.assets
|
|
4187
4184
|
);
|
|
4188
4185
|
}).exhaustive();
|
|
4189
|
-
tx.readFrom([upgradeTokenPolicyRefScriptUtxo, executeRefScriptUtxo]).validFrom(Number(currentTime) - ONE_SECOND).validTo(Number(currentTime + sysParams.govParams.gBiasTime) - ONE_SECOND).collectFrom([executeUtxo], import_lucid31.Data.void()).mintAssets(
|
|
4186
|
+
tx.readFrom([upgradeTokenPolicyRefScriptUtxo, executeRefScriptUtxo]).validFrom(Number(currentTime) - ONE_SECOND).validTo(Number(currentTime) + Number(sysParams.govParams.gBiasTime) - ONE_SECOND).collectFrom([executeUtxo], import_lucid31.Data.void()).mintAssets(
|
|
4190
4187
|
mkAssetsOf(fromSystemParamsAsset(sysParams.govParams.upgradeToken), -1n),
|
|
4191
4188
|
import_lucid31.Data.void()
|
|
4192
4189
|
).addSigner(ownAddr);
|
|
@@ -4597,7 +4594,7 @@ async function processSpRequest(asset, stabilityPoolUtxo, accountUtxo, govUtxo,
|
|
|
4597
4594
|
{
|
|
4598
4595
|
lovelace: stabilityPoolUtxo.assets.lovelace + BigInt(params.stabilityPoolParams.accountAdjustmentFeeLovelaces) - reward,
|
|
4599
4596
|
[params.stabilityPoolParams.stabilityPoolToken[0].unCurrencySymbol + (0, import_lucid34.fromText)(params.stabilityPoolParams.stabilityPoolToken[1].unTokenName)]: 1n,
|
|
4600
|
-
[params.stabilityPoolParams.assetSymbol.unCurrencySymbol + (0, import_lucid34.fromText)(asset)]: stabilityPoolUtxo.assets[params.stabilityPoolParams.assetSymbol.unCurrencySymbol + (0, import_lucid34.fromText)(asset)] + balanceChange + withdrawalFee
|
|
4597
|
+
[params.stabilityPoolParams.assetSymbol.unCurrencySymbol + (0, import_lucid34.fromText)(asset)]: stabilityPoolUtxo.assets[params.stabilityPoolParams.assetSymbol.unCurrencySymbol + (0, import_lucid34.fromText)(asset)] ?? 0n + balanceChange + withdrawalFee
|
|
4601
4598
|
}
|
|
4602
4599
|
);
|
|
4603
4600
|
tx.pay.ToContract(
|
|
@@ -5241,97 +5238,18 @@ async function feedInterestOracle(params, newInterestRate, lucid, assetClass, ut
|
|
|
5241
5238
|
return tx;
|
|
5242
5239
|
}
|
|
5243
5240
|
|
|
5244
|
-
// src/contracts/price-oracle/transactions.ts
|
|
5245
|
-
var import_lucid42 = require("@lucid-evolution/lucid");
|
|
5246
|
-
|
|
5247
|
-
// src/contracts/price-oracle/scripts.ts
|
|
5248
|
-
var import_lucid41 = require("@lucid-evolution/lucid");
|
|
5249
|
-
var priceOracleValidatorData = {
|
|
5250
|
-
type: "PlutusV2",
|
|
5251
|
-
cborHex: "590ba5590ba20100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323233027222232325335333006533357346074607e0022646605a60586ae84004dd69aba135744002607c00206e64a666ae68c0ecc1000044c8c8c848cc00400c008c0b8d5d09aba2002375a6ae84004c0fc0040e0dd50022999ab9a303a303f002132321233001003002357426ae88c0fc00cd5d0981f00101b8890008a99ab9c49103505435001637540086ea8004cc09c8888c8d4014888d40188c88c94cd54cd4ccd54c0d40e0c0a80a4c0ac01ccc0b08004d40048888888888880100e44cd5ce24812d546865207472616e73616374696f6e206973206e6f74207369676e6564206279206f7261636c65206f776e657200030132533553355335333553036039302b02a253335302135001202103e215333573466ebcc118cd5d0182319aba0375000a6ec4080cd5d01ba835500b03937620400022a66a666036446a0044466603e446a00444a666ae68c12c004400c4cc11848ccc00401c00c00800c00c0040c0cd54c0e80ec8d400488cc0e0008cd54c0f40f88d400488cc0ec008ccd4004dc0a4000e048cdc0800a400000266aa607407646a0024466070004666a002466aa607c07e46a0024466078004604600200244666038066004002466aa607c07e46a0024466078004604000200266602e05c666050400204e6a004404e0060784426a004444a66a0082a666ae68cdd78018238a999ab9a3375e00408e2a666ae68cdc4000a400006e2666ae68cdc4800a410125e80206a07006e06e44072064407e6044014074266ae712401024c310003103a1335738921156f757470757420646f6573206e6f74206d6174636800031153355333573466e2400d20001335738921165072696365206d75737420626520706f7369746976650003103a15335533535353301275a6a00407e06e44a666a00442a666ae68cdc419b8000100935500c03a0331333573466e24004d540300e80c40d00c80c84d4cc049d69a80101f911a801112999a99980980a980f19b8100900b0021533500113330120150030081333012015003008034133301201500300803003a13357389212345787069726174696f6e2074696d65206973206e6f742070726f7065726c792073657400031030030333025200102435302635533530270092100116036202402f302d350080393302f3016337000020060542a666a602e6aa66a60320022602602a442a66a0022004442602e032402e02842a66a6666666ae900048c94ccd5cd181d98200008991999aab9f001202d23233335573e002405e46666aae7cd5d1001119299a9999999aba400123253335734608660900022646666aae7c00480d48cccd55cf9aba20022533530203574200642605e00206a406c07a078608e0020646ea800880c880c880c880c80e4854cd4c070d5d08029098159981a8010008188181aba1005203003703635744004068607e0020546ea800880a880a880a880a80c48400405480548c94ccd5cd181b181d800899191919091998008028018011bad357426ae88008dd69aba10013574460760046ae84c0e80040ccdd50009111a801111a801912999a9998040038020010a99a8018800819814819911192999a80190a999a80190a999a80290980200b0980180a8a999a80210980200b0980180a80c0060a999a80210980180a8980100a0a999a80190980180a8980100a00b8a999a801100700b0068a999a80110a999a80210980180a8980100a0a999a80190980180a8980100a00b8058a999a80190980100a098008098a999a80110980100a0980080980b12999a80110a999a80210a999a802109998040038010008b0b0b0060a999a80190a999a801909998038030010008b0b0b00580691a80091111111003891999999980091199ab9a3370e00400204004644a666ae68cdc38010008098a999ab9a3371200400201401044666ae68cdc400100081001191199ab9a3371200400204004644666ae68cdc480100081181011199ab9a3371000400204604044a666ae68cdc480100088008801112999ab9a33712004002200420024464a666ae68c0c8c0dc0044c8c8cc0994ccd5cd181a181c801099813198038029aba130380023006357426ae88c0e00080c54ccd5cd181a181c800899813198038029aba130380013006357426ae88c0e00040c4dd51aba135744606e0046ea8d5d0981b0008179baa0012325333573460620020522a666ae68c0c000407c0b4c0d0dd50009119192999ab9a303300100815333573460640022601460086ae84c0d400854ccd5cd1818800803017181a8009baa00122233355302302702a335530260272350012233024002300b001333553023027223500222533533355302802b301d01c235001223300a002005006100313302e00400301c001335530260272350012233024002330382253350011300a003221350022253353300c002008112223300200a0041300600300400211009212223001004112220012230302253350011003221330060023004001212223003004233333335748002403040304030460206eb4008806007c94cd5ce2481286578706563746564206f6e6c7920612073696e676c6520636f6e74696e75696e67206f7574707574001615335738920117496e76616c696420646174756d20696e206f757470757400164988880088c8c94ccd5cd1813000899091118010021aba13028002153335734604a002264244460020086ae84c0a000854ccd5cd181200080201098140009baa00111003253353007001213335530150192235300535300935003019222200422353007350042222004225333573466ebc01000854ccd5cd19baf0030011330220060051005100500e3300d00735300f3500201b22222222222200a15335738921024c660016232533357346040604a0022646424660020060046ae84d5d118128011aba1302400101d3754002444006660024002eb4888cc09088cccd55cf80090071191980e9980a180398138009803181300098021aba2003357420040306eac0048c94ccd5cd180e181080089919191919190919998008038028018011aba1357440046ae84004d5d10011aba10013574460420046ae84c080004064dd5000919191999aa999ab9a3370e90030008990911118020029aba13020002153335734603c00226424444600400a6ae84c08000854ccd5cd180e8008990911118008029aba13020002153335734603800226424444600600a6ae84c0800080648034803480348ccd54c048054cc03c894cd40088400c400403494ccd5cd19baf002350010181300600100d3300923253335734603e60480022646424660020060046ae84d5d118120011aba1302300101c37540026a60166a00802e44444444444401860400026ea8d40040408488c00800c48cc004894cd400804c40040208cc02488ccd400c04c008004d400403488ccd5cd19baf002001004007223301c2233335573e002400c466028600a6ae84008c00cd5d10010081bac001100d23253335734602860320022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d1180c8011aba1301800101137540022002200c464a666ae68c044c0580044dd69aba1301500100e37540024424660020060044446006600400260244422444a66a00220044426600a004666aa600e01600a00800260224422444a66a00226a00600c442666a00a0186008004666aa600e01400a00800244002601e442244a66a00200c44266014600800466aa600c00e00800224002220024400444244660020080062a66ae712411f496e76616c696420646174756d20746f20636865636b4f776e4f757470757400161533573892010350543100162222222222220054c1014000370e90001b8748008dc3a40086e9520005573caae748c8c00400488cc00cc008008005"
|
|
5252
|
-
};
|
|
5253
|
-
function mkPriceOracleValidator(params) {
|
|
5254
|
-
return {
|
|
5255
|
-
type: priceOracleValidatorData.type,
|
|
5256
|
-
script: (0, import_lucid41.applyParamsToScript)(priceOracleValidatorData.cborHex, [
|
|
5257
|
-
castPriceOracleParams(params)
|
|
5258
|
-
])
|
|
5259
|
-
};
|
|
5260
|
-
}
|
|
5261
|
-
|
|
5262
|
-
// src/contracts/price-oracle/transactions.ts
|
|
5263
|
-
async function startPriceOracleTx(lucid, assetName, startPrice, oracleParams, now = Date.now(), refOutRef) {
|
|
5264
|
-
if (!refOutRef) {
|
|
5265
|
-
refOutRef = (await lucid.wallet().getUtxos())[0];
|
|
5266
|
-
}
|
|
5267
|
-
const [tx, oracleNftPolicyId] = await oneShotMintTx(lucid, {
|
|
5268
|
-
referenceOutRef: {
|
|
5269
|
-
txHash: refOutRef.txHash,
|
|
5270
|
-
outputIdx: BigInt(refOutRef.outputIndex)
|
|
5271
|
-
},
|
|
5272
|
-
mintAmounts: [
|
|
5273
|
-
{
|
|
5274
|
-
tokenName: (0, import_lucid42.fromText)(assetName),
|
|
5275
|
-
amount: 1n
|
|
5276
|
-
}
|
|
5277
|
-
]
|
|
5278
|
-
});
|
|
5279
|
-
const priceOracleNft = {
|
|
5280
|
-
currencySymbol: oracleNftPolicyId,
|
|
5281
|
-
tokenName: (0, import_lucid42.fromText)(assetName)
|
|
5282
|
-
};
|
|
5283
|
-
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
5284
|
-
const oracleDatum = {
|
|
5285
|
-
price: startPrice,
|
|
5286
|
-
expiration: BigInt(now) + oracleParams.expiration
|
|
5287
|
-
};
|
|
5288
|
-
tx.pay.ToContract(
|
|
5289
|
-
(0, import_lucid42.validatorToAddress)(lucid.config().network, oracleValidator),
|
|
5290
|
-
{ kind: "inline", value: serialisePriceOracleDatum(oracleDatum) },
|
|
5291
|
-
(0, import_lucid42.addAssets)(mkLovelacesOf(5000000n), mkAssetsOf(priceOracleNft, 1n))
|
|
5292
|
-
);
|
|
5293
|
-
return [tx, { oracleNft: priceOracleNft }];
|
|
5294
|
-
}
|
|
5295
|
-
async function feedPriceOracleTx(lucid, oracle, newPrice, oracleParams, currentSlot) {
|
|
5296
|
-
const network = lucid.config().network;
|
|
5297
|
-
const currentTime = BigInt((0, import_lucid42.slotToUnixTime)(network, currentSlot));
|
|
5298
|
-
const priceOracleUtxo = await resolveUtxo(
|
|
5299
|
-
oracle,
|
|
5300
|
-
lucid,
|
|
5301
|
-
"Expected a single price oracle UTXO"
|
|
5302
|
-
);
|
|
5303
|
-
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
5304
|
-
return lucid.newTx().validFrom(Number(currentTime - oracleParams.biasTime) + ONE_SECOND).validTo(Number(currentTime + oracleParams.biasTime) - ONE_SECOND).attach.SpendingValidator(oracleValidator).collectFrom(
|
|
5305
|
-
[priceOracleUtxo],
|
|
5306
|
-
serialisePriceOracleRedeemer({
|
|
5307
|
-
currentTime,
|
|
5308
|
-
newPrice
|
|
5309
|
-
})
|
|
5310
|
-
).pay.ToContract(
|
|
5311
|
-
priceOracleUtxo.address,
|
|
5312
|
-
{
|
|
5313
|
-
kind: "inline",
|
|
5314
|
-
value: serialisePriceOracleDatum({
|
|
5315
|
-
price: newPrice,
|
|
5316
|
-
expiration: currentTime + oracleParams.expiration
|
|
5317
|
-
})
|
|
5318
|
-
},
|
|
5319
|
-
priceOracleUtxo.assets
|
|
5320
|
-
).addSignerKey(oracleParams.owner);
|
|
5321
|
-
}
|
|
5322
|
-
|
|
5323
5241
|
// src/contracts/version-registry/types.ts
|
|
5324
|
-
var
|
|
5325
|
-
var VersionRecordTokenParamsSchema =
|
|
5242
|
+
var import_lucid41 = require("@lucid-evolution/lucid");
|
|
5243
|
+
var VersionRecordTokenParamsSchema = import_lucid41.Data.Object({
|
|
5326
5244
|
upgradeToken: AssetClassSchema
|
|
5327
5245
|
});
|
|
5328
5246
|
var VersionRecordTokenParams = VersionRecordTokenParamsSchema;
|
|
5329
5247
|
function castVersionRecordTokenParams(params) {
|
|
5330
|
-
return
|
|
5248
|
+
return import_lucid41.Data.castTo(params, VersionRecordTokenParams);
|
|
5331
5249
|
}
|
|
5332
5250
|
|
|
5333
5251
|
// src/contracts/version-registry/scripts.ts
|
|
5334
|
-
var
|
|
5252
|
+
var import_lucid42 = require("@lucid-evolution/lucid");
|
|
5335
5253
|
|
|
5336
5254
|
// src/validators/version-record-policy.ts
|
|
5337
5255
|
var _versionRecordTokenPolicy = {
|
|
@@ -5351,7 +5269,7 @@ var _versionRegistryValidator = {
|
|
|
5351
5269
|
function mkVersionRecordTokenPolicy(params) {
|
|
5352
5270
|
return {
|
|
5353
5271
|
type: "PlutusV2",
|
|
5354
|
-
script: (0,
|
|
5272
|
+
script: (0, import_lucid42.applyParamsToScript)(_versionRecordTokenPolicy.cborHex, [
|
|
5355
5273
|
castVersionRecordTokenParams(params)
|
|
5356
5274
|
])
|
|
5357
5275
|
};
|
|
@@ -5364,7 +5282,7 @@ var mkVersionRegistryValidator = () => {
|
|
|
5364
5282
|
};
|
|
5365
5283
|
|
|
5366
5284
|
// src/contracts/collector/scripts.ts
|
|
5367
|
-
var
|
|
5285
|
+
var import_lucid43 = require("@lucid-evolution/lucid");
|
|
5368
5286
|
|
|
5369
5287
|
// src/validators/collector-validator.ts
|
|
5370
5288
|
var _collectorValidator = {
|
|
@@ -5377,19 +5295,19 @@ var _collectorValidator = {
|
|
|
5377
5295
|
var mkCollectorValidatorFromSP = (params) => {
|
|
5378
5296
|
return {
|
|
5379
5297
|
type: "PlutusV2",
|
|
5380
|
-
script: (0,
|
|
5381
|
-
new
|
|
5382
|
-
new
|
|
5298
|
+
script: (0, import_lucid43.applyParamsToScript)(_collectorValidator.cborHex, [
|
|
5299
|
+
new import_lucid43.Constr(0, [
|
|
5300
|
+
new import_lucid43.Constr(0, [
|
|
5383
5301
|
params.stakingManagerNFT[0].unCurrencySymbol,
|
|
5384
|
-
(0,
|
|
5302
|
+
(0, import_lucid43.fromText)(params.stakingManagerNFT[1].unTokenName)
|
|
5385
5303
|
]),
|
|
5386
|
-
new
|
|
5304
|
+
new import_lucid43.Constr(0, [
|
|
5387
5305
|
params.stakingToken[0].unCurrencySymbol,
|
|
5388
|
-
(0,
|
|
5306
|
+
(0, import_lucid43.fromText)(params.stakingToken[1].unTokenName)
|
|
5389
5307
|
]),
|
|
5390
|
-
new
|
|
5308
|
+
new import_lucid43.Constr(0, [
|
|
5391
5309
|
params.versionRecordToken[0].unCurrencySymbol,
|
|
5392
|
-
(0,
|
|
5310
|
+
(0, import_lucid43.fromText)(params.versionRecordToken[1].unTokenName)
|
|
5393
5311
|
])
|
|
5394
5312
|
])
|
|
5395
5313
|
])
|
|
@@ -5397,7 +5315,7 @@ var mkCollectorValidatorFromSP = (params) => {
|
|
|
5397
5315
|
};
|
|
5398
5316
|
|
|
5399
5317
|
// src/contracts/treasury/scripts.ts
|
|
5400
|
-
var
|
|
5318
|
+
var import_lucid44 = require("@lucid-evolution/lucid");
|
|
5401
5319
|
|
|
5402
5320
|
// src/validators/treasury-validator.ts
|
|
5403
5321
|
var _treasuryValidator = {
|
|
@@ -5410,30 +5328,30 @@ var _treasuryValidator = {
|
|
|
5410
5328
|
var mkTreasuryValidatorFromSP = (params) => {
|
|
5411
5329
|
return {
|
|
5412
5330
|
type: "PlutusV2",
|
|
5413
|
-
script: (0,
|
|
5414
|
-
new
|
|
5415
|
-
new
|
|
5331
|
+
script: (0, import_lucid44.applyParamsToScript)(_treasuryValidator.cborHex, [
|
|
5332
|
+
new import_lucid44.Constr(0, [
|
|
5333
|
+
new import_lucid44.Constr(0, [
|
|
5416
5334
|
params.upgradeToken[0].unCurrencySymbol,
|
|
5417
|
-
(0,
|
|
5335
|
+
(0, import_lucid44.fromText)(params.upgradeToken[1].unTokenName)
|
|
5418
5336
|
]),
|
|
5419
|
-
new
|
|
5337
|
+
new import_lucid44.Constr(0, [
|
|
5420
5338
|
params.versionRecordToken[0].unCurrencySymbol,
|
|
5421
|
-
(0,
|
|
5339
|
+
(0, import_lucid44.fromText)(params.versionRecordToken[1].unTokenName)
|
|
5422
5340
|
]),
|
|
5423
|
-
params.treasuryUtxosStakeCredential ? new
|
|
5424
|
-
new
|
|
5425
|
-
new
|
|
5341
|
+
params.treasuryUtxosStakeCredential ? new import_lucid44.Constr(0, [
|
|
5342
|
+
new import_lucid44.Constr(0, [
|
|
5343
|
+
new import_lucid44.Constr(1, [
|
|
5426
5344
|
params.treasuryUtxosStakeCredential.contents.contents
|
|
5427
5345
|
])
|
|
5428
5346
|
])
|
|
5429
|
-
]) : new
|
|
5347
|
+
]) : new import_lucid44.Constr(1, [])
|
|
5430
5348
|
])
|
|
5431
5349
|
])
|
|
5432
5350
|
};
|
|
5433
5351
|
};
|
|
5434
5352
|
|
|
5435
5353
|
// src/contracts/execute/scripts.ts
|
|
5436
|
-
var
|
|
5354
|
+
var import_lucid45 = require("@lucid-evolution/lucid");
|
|
5437
5355
|
|
|
5438
5356
|
// src/validators/execute-validator.ts
|
|
5439
5357
|
var _executeValidator = {
|
|
@@ -5446,8 +5364,8 @@ var _executeValidator = {
|
|
|
5446
5364
|
var mkExecuteValidator = (params) => {
|
|
5447
5365
|
return {
|
|
5448
5366
|
type: "PlutusV2",
|
|
5449
|
-
script: (0,
|
|
5450
|
-
(0,
|
|
5367
|
+
script: (0, import_lucid45.applySingleCborEncoding)(
|
|
5368
|
+
(0, import_lucid45.applyParamsToScript)(_executeValidator.cborHex, [
|
|
5451
5369
|
castExecuteParams(params)
|
|
5452
5370
|
])
|
|
5453
5371
|
)
|
|
@@ -5456,8 +5374,8 @@ var mkExecuteValidator = (params) => {
|
|
|
5456
5374
|
var mkExecuteValidatorFromSP = (params) => {
|
|
5457
5375
|
return {
|
|
5458
5376
|
type: "PlutusV2",
|
|
5459
|
-
script: (0,
|
|
5460
|
-
(0,
|
|
5377
|
+
script: (0, import_lucid45.applySingleCborEncoding)(
|
|
5378
|
+
(0, import_lucid45.applyParamsToScript)(_executeValidator.cborHex, [
|
|
5461
5379
|
castExecuteParams({
|
|
5462
5380
|
govNFT: fromSystemParamsAsset(params.govNFT),
|
|
5463
5381
|
upgradeToken: fromSystemParamsAsset(params.upgradeToken),
|
|
@@ -5476,49 +5394,49 @@ var mkExecuteValidatorFromSP = (params) => {
|
|
|
5476
5394
|
};
|
|
5477
5395
|
|
|
5478
5396
|
// src/contracts/lrp/helpers.ts
|
|
5479
|
-
var
|
|
5397
|
+
var import_lucid47 = require("@lucid-evolution/lucid");
|
|
5480
5398
|
|
|
5481
5399
|
// src/contracts/lrp/types.ts
|
|
5482
|
-
var
|
|
5400
|
+
var import_lucid46 = require("@lucid-evolution/lucid");
|
|
5483
5401
|
var import_fp_ts11 = require("fp-ts");
|
|
5484
5402
|
var import_ts_pattern12 = require("ts-pattern");
|
|
5485
|
-
var LRPParamsSchema =
|
|
5403
|
+
var LRPParamsSchema = import_lucid46.Data.Object({
|
|
5486
5404
|
versionRecordToken: AssetClassSchema,
|
|
5487
5405
|
iassetNft: AssetClassSchema,
|
|
5488
|
-
iassetPolicyId:
|
|
5489
|
-
minRedemptionLovelacesAmt:
|
|
5406
|
+
iassetPolicyId: import_lucid46.Data.Bytes(),
|
|
5407
|
+
minRedemptionLovelacesAmt: import_lucid46.Data.Integer()
|
|
5490
5408
|
});
|
|
5491
5409
|
var LRPParams = LRPParamsSchema;
|
|
5492
|
-
var LRPDatumSchema =
|
|
5493
|
-
owner:
|
|
5494
|
-
iasset:
|
|
5410
|
+
var LRPDatumSchema = import_lucid46.Data.Object({
|
|
5411
|
+
owner: import_lucid46.Data.Bytes(),
|
|
5412
|
+
iasset: import_lucid46.Data.Bytes(),
|
|
5495
5413
|
maxPrice: OnChainDecimalSchema,
|
|
5496
5414
|
/**
|
|
5497
5415
|
* The amount of lovelaces that is available to be spent.
|
|
5498
5416
|
* This doesn't correspond to the lovelaces in UTXO's value,
|
|
5499
5417
|
* since that can contain fees, too.
|
|
5500
5418
|
*/
|
|
5501
|
-
lovelacesToSpend:
|
|
5419
|
+
lovelacesToSpend: import_lucid46.Data.Integer()
|
|
5502
5420
|
});
|
|
5503
5421
|
var LRPDatum = LRPDatumSchema;
|
|
5504
|
-
var LRPRedeemerSchema =
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
RedeemAuxiliary:
|
|
5508
|
-
continuingOutputIdx:
|
|
5422
|
+
var LRPRedeemerSchema = import_lucid46.Data.Enum([
|
|
5423
|
+
import_lucid46.Data.Object({ Redeem: import_lucid46.Data.Object({ continuingOutputIdx: import_lucid46.Data.Integer() }) }),
|
|
5424
|
+
import_lucid46.Data.Object({
|
|
5425
|
+
RedeemAuxiliary: import_lucid46.Data.Object({
|
|
5426
|
+
continuingOutputIdx: import_lucid46.Data.Integer(),
|
|
5509
5427
|
mainRedeemOutRef: OutputReferenceSchema,
|
|
5510
|
-
asset:
|
|
5428
|
+
asset: import_lucid46.Data.Bytes(),
|
|
5511
5429
|
assetPrice: OnChainDecimalSchema,
|
|
5512
5430
|
redemptionReimbursementPercentage: OnChainDecimalSchema
|
|
5513
5431
|
})
|
|
5514
5432
|
}),
|
|
5515
|
-
|
|
5516
|
-
|
|
5433
|
+
import_lucid46.Data.Literal("Cancel"),
|
|
5434
|
+
import_lucid46.Data.Literal("UpgradeVersion")
|
|
5517
5435
|
]);
|
|
5518
5436
|
var LRPRedeemer = LRPRedeemerSchema;
|
|
5519
5437
|
function parseLrpDatum(datum) {
|
|
5520
5438
|
try {
|
|
5521
|
-
return import_fp_ts11.option.some(
|
|
5439
|
+
return import_fp_ts11.option.some(import_lucid46.Data.from(datum, LRPDatum));
|
|
5522
5440
|
} catch (_) {
|
|
5523
5441
|
return import_fp_ts11.option.none;
|
|
5524
5442
|
}
|
|
@@ -5532,12 +5450,12 @@ function parseLrpDatumOrThrow(datum) {
|
|
|
5532
5450
|
);
|
|
5533
5451
|
}
|
|
5534
5452
|
function serialiseLrpDatum(datum, serialisationOptions = { _tag: "noReplace" }) {
|
|
5535
|
-
const d =
|
|
5453
|
+
const d = import_lucid46.Data.to(datum, LRPDatum);
|
|
5536
5454
|
return (0, import_ts_pattern12.match)(serialisationOptions).returnType().with({ _tag: "noReplace" }, () => d).with(
|
|
5537
5455
|
{ _tag: "adaptiveReplace", spentLrpDatum: import_ts_pattern12.P.select() },
|
|
5538
5456
|
(spentLrpDatum) => {
|
|
5539
5457
|
const isSpentDatumCanonical = spentLrpDatum.includes(
|
|
5540
|
-
|
|
5458
|
+
import_lucid46.Data.to(
|
|
5541
5459
|
parseLrpDatumOrThrow(spentLrpDatum).maxPrice,
|
|
5542
5460
|
OnChainDecimal,
|
|
5543
5461
|
{
|
|
@@ -5546,12 +5464,12 @@ function serialiseLrpDatum(datum, serialisationOptions = { _tag: "noReplace" })
|
|
|
5546
5464
|
)
|
|
5547
5465
|
);
|
|
5548
5466
|
if (isSpentDatumCanonical) {
|
|
5549
|
-
const ocdSerialisedCanonical =
|
|
5467
|
+
const ocdSerialisedCanonical = import_lucid46.Data.to(
|
|
5550
5468
|
datum.maxPrice,
|
|
5551
5469
|
OnChainDecimal,
|
|
5552
5470
|
{ canonical: true }
|
|
5553
5471
|
);
|
|
5554
|
-
const ocdSerialisedNonCanonical =
|
|
5472
|
+
const ocdSerialisedNonCanonical = import_lucid46.Data.to(
|
|
5555
5473
|
datum.maxPrice,
|
|
5556
5474
|
OnChainDecimal,
|
|
5557
5475
|
{ canonical: false }
|
|
@@ -5563,10 +5481,10 @@ function serialiseLrpDatum(datum, serialisationOptions = { _tag: "noReplace" })
|
|
|
5563
5481
|
).exhaustive();
|
|
5564
5482
|
}
|
|
5565
5483
|
function serialiseLrpRedeemer(redeemer) {
|
|
5566
|
-
return
|
|
5484
|
+
return import_lucid46.Data.to(redeemer, LRPRedeemer);
|
|
5567
5485
|
}
|
|
5568
5486
|
function castLrpParams(params) {
|
|
5569
|
-
return
|
|
5487
|
+
return import_lucid46.Data.castTo(params, LRPParams);
|
|
5570
5488
|
}
|
|
5571
5489
|
|
|
5572
5490
|
// src/contracts/lrp/helpers.ts
|
|
@@ -5647,7 +5565,7 @@ function buildRedemptionsTx(redemptions, price, redemptionReimbursementPercentag
|
|
|
5647
5565
|
);
|
|
5648
5566
|
const lrpRawInlineDatum = getInlineDatumOrThrow(lrpUtxo);
|
|
5649
5567
|
const lrpDatum = parseLrpDatumOrThrow(lrpRawInlineDatum);
|
|
5650
|
-
const resultVal = (0,
|
|
5568
|
+
const resultVal = (0, import_lucid47.addAssets)(
|
|
5651
5569
|
lrpUtxo.assets,
|
|
5652
5570
|
mkLovelacesOf(-lovelacesForRedemption + reimburstmentLovelaces),
|
|
5653
5571
|
mkAssetsOf(
|
|
@@ -5774,7 +5692,7 @@ function randomLrpsSubsetSatisfyingTargetLovelaces(iasset, targetLovelacesToSpen
|
|
|
5774
5692
|
}
|
|
5775
5693
|
|
|
5776
5694
|
// src/contracts/lrp/transactions.ts
|
|
5777
|
-
var
|
|
5695
|
+
var import_lucid48 = require("@lucid-evolution/lucid");
|
|
5778
5696
|
var import_Array2 = require("fp-ts/lib/Array");
|
|
5779
5697
|
async function openLrp(assetTokenName, lovelacesAmt2, maxPrice, lucid, sysParams, lrpStakeCredential) {
|
|
5780
5698
|
const network = lucid.config().network;
|
|
@@ -5844,9 +5762,9 @@ async function redeemLrp(redemptionLrpsData, priceOracle, iasset, lucid, sysPara
|
|
|
5844
5762
|
0n
|
|
5845
5763
|
);
|
|
5846
5764
|
return lucid.newTx().validTo(
|
|
5847
|
-
(0,
|
|
5765
|
+
(0, import_lucid48.slotToUnixTime)(
|
|
5848
5766
|
network,
|
|
5849
|
-
(0,
|
|
5767
|
+
(0, import_lucid48.unixTimeToSlot)(network, Number(priceOracleDatum.expiration)) - 1
|
|
5850
5768
|
)
|
|
5851
5769
|
).readFrom([lrpScriptRefUtxo]).readFrom([iassetUtxo, priceOracleUtxo]).compose(tx);
|
|
5852
5770
|
}
|
|
@@ -5887,7 +5805,7 @@ async function adjustLrp(lucid, lrp, lovelacesAdjustAmt, newMaxPrice, sysParams)
|
|
|
5887
5805
|
maxPrice: newMaxPrice ? newMaxPrice : lrpDatum.maxPrice
|
|
5888
5806
|
})
|
|
5889
5807
|
},
|
|
5890
|
-
(0,
|
|
5808
|
+
(0, import_lucid48.addAssets)(
|
|
5891
5809
|
lrpUtxo.assets,
|
|
5892
5810
|
mkAssetsOf(rewardAssetClass, -rewardAssetsAmt),
|
|
5893
5811
|
mkLovelacesOf(lovelacesAdjustAmt)
|
|
@@ -5899,7 +5817,7 @@ async function claimLrp(lucid, lrp, sysParams) {
|
|
|
5899
5817
|
}
|
|
5900
5818
|
|
|
5901
5819
|
// src/contracts/lrp/scripts.ts
|
|
5902
|
-
var
|
|
5820
|
+
var import_lucid49 = require("@lucid-evolution/lucid");
|
|
5903
5821
|
|
|
5904
5822
|
// src/validators/lrp-validator.ts
|
|
5905
5823
|
var _lrpValidator = {
|
|
@@ -5912,13 +5830,13 @@ var _lrpValidator = {
|
|
|
5912
5830
|
var mkLrpValidator = (params) => {
|
|
5913
5831
|
return {
|
|
5914
5832
|
type: "PlutusV2",
|
|
5915
|
-
script: (0,
|
|
5833
|
+
script: (0, import_lucid49.applyParamsToScript)(_lrpValidator.cborHex, [castLrpParams(params)])
|
|
5916
5834
|
};
|
|
5917
5835
|
};
|
|
5918
5836
|
var mkLrpValidatorFromSP = (params) => {
|
|
5919
5837
|
return {
|
|
5920
5838
|
type: "PlutusV2",
|
|
5921
|
-
script: (0,
|
|
5839
|
+
script: (0, import_lucid49.applyParamsToScript)(_lrpValidator.cborHex, [
|
|
5922
5840
|
castLrpParams({
|
|
5923
5841
|
versionRecordToken: fromSystemParamsAsset(params.versionRecordToken),
|
|
5924
5842
|
iassetNft: fromSystemParamsAsset(params.iassetNft),
|
|
@@ -5930,7 +5848,7 @@ var mkLrpValidatorFromSP = (params) => {
|
|
|
5930
5848
|
};
|
|
5931
5849
|
|
|
5932
5850
|
// src/utils/helper-txs.ts
|
|
5933
|
-
var
|
|
5851
|
+
var import_lucid50 = require("@lucid-evolution/lucid");
|
|
5934
5852
|
|
|
5935
5853
|
// src/scripts/always-fail-validator.ts
|
|
5936
5854
|
var alwaysFailValidator = {
|
|
@@ -5940,14 +5858,14 @@ var alwaysFailValidator = {
|
|
|
5940
5858
|
|
|
5941
5859
|
// src/utils/helper-txs.ts
|
|
5942
5860
|
async function runCreateScriptRefTx(lucid, scriptRefValidator, network) {
|
|
5943
|
-
const scriptAddr = (0,
|
|
5861
|
+
const scriptAddr = (0, import_lucid50.validatorToAddress)(network, alwaysFailValidator);
|
|
5944
5862
|
const txHash = await lucid.newTx().pay.ToAddressWithData(scriptAddr, void 0, {}, scriptRefValidator).complete().then((tx) => tx.sign.withWallet().complete()).then((tx) => tx.submit());
|
|
5945
5863
|
await lucid.awaitTx(txHash);
|
|
5946
5864
|
return { txHash, outputIndex: 0 };
|
|
5947
5865
|
}
|
|
5948
5866
|
|
|
5949
5867
|
// src/contracts/leverage/transactions.ts
|
|
5950
|
-
var
|
|
5868
|
+
var import_lucid51 = require("@lucid-evolution/lucid");
|
|
5951
5869
|
|
|
5952
5870
|
// src/contracts/leverage/helpers.ts
|
|
5953
5871
|
var import_fp_ts14 = require("fp-ts");
|
|
@@ -6124,7 +6042,7 @@ function calculateLeverageFromCollateralRatio(iasset, collateralRatioPercentage,
|
|
|
6124
6042
|
// src/contracts/leverage/transactions.ts
|
|
6125
6043
|
async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset, cdpCreator, interestOracle, collector, sysParams, lucid, allLrps, currentSlot) {
|
|
6126
6044
|
const network = lucid.config().network;
|
|
6127
|
-
const currentTime = BigInt((0,
|
|
6045
|
+
const currentTime = BigInt((0, import_lucid51.slotToUnixTime)(network, currentSlot));
|
|
6128
6046
|
const [pkh, skh] = await addrDetails(lucid);
|
|
6129
6047
|
const lrpScriptRefUtxo = matchSingle(
|
|
6130
6048
|
await lucid.utxosByOutRef([
|
|
@@ -6254,7 +6172,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6254
6172
|
cdpAuthTokenPolicyRefScriptUtxo,
|
|
6255
6173
|
iAssetTokenPolicyRefScriptUtxo,
|
|
6256
6174
|
lrpScriptRefUtxo
|
|
6257
|
-
]).mintAssets(cdpNftVal,
|
|
6175
|
+
]).mintAssets(cdpNftVal, import_lucid51.Data.void()).mintAssets(iassetTokensVal, import_lucid51.Data.void()).collectFrom(
|
|
6258
6176
|
[cdpCreatorUtxo],
|
|
6259
6177
|
serialiseCDPCreatorRedeemer({
|
|
6260
6178
|
CreateCDP: {
|
|
@@ -6283,10 +6201,10 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracle, iasset,
|
|
|
6283
6201
|
}
|
|
6284
6202
|
})
|
|
6285
6203
|
},
|
|
6286
|
-
(0,
|
|
6204
|
+
(0, import_lucid51.addAssets)(cdpNftVal, mkLovelacesOf(collateralAmt))
|
|
6287
6205
|
).pay.ToContract(
|
|
6288
6206
|
cdpCreatorUtxo.address,
|
|
6289
|
-
{ kind: "inline", value:
|
|
6207
|
+
{ kind: "inline", value: import_lucid51.Data.void() },
|
|
6290
6208
|
cdpCreatorUtxo.assets
|
|
6291
6209
|
).addSignerKey(pkh.hash);
|
|
6292
6210
|
buildRedemptionsTx(
|
|
@@ -6335,6 +6253,58 @@ async function submitAndAwaitTx(lucid, tx) {
|
|
|
6335
6253
|
// src/contracts/initialize/transactions.ts
|
|
6336
6254
|
var import_lucid57 = require("@lucid-evolution/lucid");
|
|
6337
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
|
+
|
|
6338
6308
|
// src/scripts/auth-token-policy.ts
|
|
6339
6309
|
var import_lucid54 = require("@lucid-evolution/lucid");
|
|
6340
6310
|
var authPolicyData = {
|
|
@@ -7197,7 +7167,6 @@ async function init(lucid, initialAssets, now = Date.now()) {
|
|
|
7197
7167
|
endProposal,
|
|
7198
7168
|
executeProposal,
|
|
7199
7169
|
feedInterestOracle,
|
|
7200
|
-
feedPriceOracleTx,
|
|
7201
7170
|
findStakingManager,
|
|
7202
7171
|
findStakingManagerByOutRef,
|
|
7203
7172
|
findStakingPositionByOutRef,
|
|
@@ -7251,7 +7220,6 @@ async function init(lucid, initialAssets, now = Date.now()) {
|
|
|
7251
7220
|
openCdp,
|
|
7252
7221
|
openLrp,
|
|
7253
7222
|
openStakingPosition,
|
|
7254
|
-
oracleExpirationAwareValidity,
|
|
7255
7223
|
parseAccountDatum,
|
|
7256
7224
|
parseCdpDatum,
|
|
7257
7225
|
parseCdpDatumOrThrow,
|
|
@@ -7317,7 +7285,6 @@ async function init(lucid, initialAssets, now = Date.now()) {
|
|
|
7317
7285
|
spMul,
|
|
7318
7286
|
spSub,
|
|
7319
7287
|
startInterestOracle,
|
|
7320
|
-
startPriceOracleTx,
|
|
7321
7288
|
submitAndAwaitTx,
|
|
7322
7289
|
summarizeActualLeverageRedemptions,
|
|
7323
7290
|
toSystemParamsAsset,
|