@indigo-labs/indigo-sdk 0.5.8 → 0.5.10
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 +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +139 -143
- package/dist/index.mjs +127 -131
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -455,7 +455,7 @@ function oracleExpirationAwareValidity(lucid, biasTime, oracleExpiration) {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
// src/contracts/cdp/transactions.ts
|
|
458
|
-
import { match as match13, P as
|
|
458
|
+
import { match as match13, P as P14 } from "ts-pattern";
|
|
459
459
|
|
|
460
460
|
// src/contracts/cdp/helpers.ts
|
|
461
461
|
import { match as match4, P as P4 } from "ts-pattern";
|
|
@@ -940,7 +940,7 @@ var repsertWithReadonlyArr = (predicate, replaceVal, newVal, mkKey) => (arr) =>
|
|
|
940
940
|
};
|
|
941
941
|
|
|
942
942
|
// src/contracts/stability-pool/helpers.ts
|
|
943
|
-
import { match as match6, P as
|
|
943
|
+
import { match as match6, P as P7 } from "ts-pattern";
|
|
944
944
|
|
|
945
945
|
// src/contracts/stability-pool/scripts.ts
|
|
946
946
|
import { applyParamsToScript } from "@lucid-evolution/lucid";
|
|
@@ -1237,13 +1237,13 @@ function createProcessRequestAccountRedeemer(e2s2sIdxs, otherRefInputs, currentT
|
|
|
1237
1237
|
const allE2s2sSnapshotRefInputs = F3.pipe(
|
|
1238
1238
|
e2s2sIdxs,
|
|
1239
1239
|
A3.flatMap(([s1, s2]) => {
|
|
1240
|
-
const s1RefInput = match6(s1).with({ snapshotUtxo:
|
|
1240
|
+
const s1RefInput = match6(s1).with({ snapshotUtxo: P7.select() }, (utxo) => O3.some(utxo)).otherwise(() => O3.none);
|
|
1241
1241
|
const s2RefInput = F3.pipe(
|
|
1242
1242
|
s2,
|
|
1243
1243
|
O3.match(
|
|
1244
1244
|
() => [],
|
|
1245
1245
|
(s) => match6(s).with(
|
|
1246
|
-
{ snapshotUtxo:
|
|
1246
|
+
{ snapshotUtxo: P7.select() },
|
|
1247
1247
|
(utxo) => F3.pipe(
|
|
1248
1248
|
s1RefInput,
|
|
1249
1249
|
O3.match(
|
|
@@ -1262,9 +1262,9 @@ function createProcessRequestAccountRedeemer(e2s2sIdxs, otherRefInputs, currentT
|
|
|
1262
1262
|
...otherRefInputs,
|
|
1263
1263
|
...allE2s2sSnapshotRefInputs
|
|
1264
1264
|
]);
|
|
1265
|
-
const createE2s2sIdx = (s) => match6(s).returnType().with({ spListIdx:
|
|
1265
|
+
const createE2s2sIdx = (s) => match6(s).returnType().with({ spListIdx: P7.select() }, (spListIdx) => ({
|
|
1266
1266
|
StabilityPoolListIdx: BigInt(spListIdx)
|
|
1267
|
-
})).with({ snapshotUtxo:
|
|
1267
|
+
})).with({ snapshotUtxo: P7.any }, (obj) => {
|
|
1268
1268
|
const idxForIdx = F3.pipe(
|
|
1269
1269
|
allE2s2sSnapshotRefInputs,
|
|
1270
1270
|
A3.findIndex((input) => isSameOutRef(input, obj.snapshotUtxo)),
|
|
@@ -1319,10 +1319,10 @@ function calculateReward(s1, s2, accountSumVal, accountState) {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
function getE2s2sEntry(idx, assetState) {
|
|
1321
1321
|
return match6(idx).returnType().with(
|
|
1322
|
-
{ spListIdx:
|
|
1322
|
+
{ spListIdx: P7.select() },
|
|
1323
1323
|
(spIdx) => assetState.epoch2scale2sum[spIdx]
|
|
1324
1324
|
).with(
|
|
1325
|
-
{ snapshotUtxo:
|
|
1325
|
+
{ snapshotUtxo: P7.any },
|
|
1326
1326
|
(obj) => obj.snapshotDatum.snapshot[obj.snapshotListIdx]
|
|
1327
1327
|
).exhaustive();
|
|
1328
1328
|
}
|
|
@@ -1514,7 +1514,7 @@ function liquidationHelper(poolContent, collateralAsset, iassetBurnAmt, reward)
|
|
|
1514
1514
|
key,
|
|
1515
1515
|
{
|
|
1516
1516
|
...assetSnap,
|
|
1517
|
-
epoch2scale2sum: match6(assetSnap.epoch2scale2sum).returnType().with([[
|
|
1517
|
+
epoch2scale2sum: match6(assetSnap.epoch2scale2sum).returnType().with([[P7.any, P7.any], ...P7.array()], ([[key2, val], ...rest]) => {
|
|
1518
1518
|
const newScaleEntry = [
|
|
1519
1519
|
{
|
|
1520
1520
|
epoch: poolContent.state.epoch,
|
|
@@ -1697,7 +1697,7 @@ import {
|
|
|
1697
1697
|
AssetClassSchema as AssetClassSchema3,
|
|
1698
1698
|
OutputReferenceSchema as OutputReferenceSchema2
|
|
1699
1699
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
1700
|
-
import { match as match7, P as
|
|
1700
|
+
import { match as match7, P as P8 } from "ts-pattern";
|
|
1701
1701
|
|
|
1702
1702
|
// src/contracts/price-oracle/types-new.ts
|
|
1703
1703
|
import { TSchema as TSchema7, Data as Data8 } from "@evolution-sdk/evolution";
|
|
@@ -1919,7 +1919,7 @@ function parseCdpDatum(datum) {
|
|
|
1919
1919
|
Data9.withSchema(CDPDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
1920
1920
|
datum
|
|
1921
1921
|
)
|
|
1922
|
-
).with({ CDP:
|
|
1922
|
+
).with({ CDP: P8.select() }, (res) => O4.some(res)).otherwise(() => O4.none);
|
|
1923
1923
|
} catch (_) {
|
|
1924
1924
|
return O4.none;
|
|
1925
1925
|
}
|
|
@@ -1938,7 +1938,7 @@ function parseStableswapPoolDatum(datum) {
|
|
|
1938
1938
|
Data9.withSchema(CDPDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
1939
1939
|
datum
|
|
1940
1940
|
)
|
|
1941
|
-
).with({ StableswapPool:
|
|
1941
|
+
).with({ StableswapPool: P8.select() }, (res) => O4.some(res)).otherwise(() => O4.none);
|
|
1942
1942
|
} catch (_) {
|
|
1943
1943
|
return O4.none;
|
|
1944
1944
|
}
|
|
@@ -1974,14 +1974,14 @@ function serialiseInterestOracleDatum(datum) {
|
|
|
1974
1974
|
}
|
|
1975
1975
|
|
|
1976
1976
|
// src/contracts/interest-collection/transactions.ts
|
|
1977
|
-
import { match as match9, P as
|
|
1977
|
+
import { match as match9, P as P10 } from "ts-pattern";
|
|
1978
1978
|
import { array as A4, function as F6 } from "fp-ts";
|
|
1979
1979
|
|
|
1980
1980
|
// src/contracts/iasset/types.ts
|
|
1981
1981
|
import { TSchema as TSchema10, Data as Data11 } from "@evolution-sdk/evolution";
|
|
1982
1982
|
import { option as O5, function as F5 } from "fp-ts";
|
|
1983
1983
|
import { AssetClassSchema as AssetClassSchema4 } from "@3rd-eye-labs/cardano-offchain-common";
|
|
1984
|
-
import { match as match8, P as
|
|
1984
|
+
import { match as match8, P as P9 } from "ts-pattern";
|
|
1985
1985
|
var IAssetPriceInfoSchema = TSchema10.Union(
|
|
1986
1986
|
TSchema10.Struct(
|
|
1987
1987
|
{
|
|
@@ -2063,7 +2063,7 @@ function parseIAssetDatum(datum) {
|
|
|
2063
2063
|
Data11.withSchema(IAssetDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
2064
2064
|
datum
|
|
2065
2065
|
)
|
|
2066
|
-
).with({ IAssetContent:
|
|
2066
|
+
).with({ IAssetContent: P9.select() }, (content) => O5.some(content)).otherwise(() => O5.none);
|
|
2067
2067
|
} catch (_) {
|
|
2068
2068
|
return O5.none;
|
|
2069
2069
|
}
|
|
@@ -2083,7 +2083,7 @@ function parseCollateralAssetDatum(datum) {
|
|
|
2083
2083
|
datum
|
|
2084
2084
|
)
|
|
2085
2085
|
).with(
|
|
2086
|
-
{ CollateralAssetContent:
|
|
2086
|
+
{ CollateralAssetContent: P9.select() },
|
|
2087
2087
|
(content) => O5.some(content)
|
|
2088
2088
|
).otherwise(() => O5.none);
|
|
2089
2089
|
} catch (_) {
|
|
@@ -2154,9 +2154,9 @@ async function batchCollectInterest(collateralAssetOref, interestCollectorOutRef
|
|
|
2154
2154
|
throw new Error("Expected certain number of CDPs");
|
|
2155
2155
|
}
|
|
2156
2156
|
function getAccruedInterest(cdpDatum) {
|
|
2157
|
-
return match9(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees:
|
|
2157
|
+
return match9(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees: P10.any }, () => {
|
|
2158
2158
|
throw new Error("CDP fees wrong");
|
|
2159
|
-
}).with({ ActiveCDPInterestTracking:
|
|
2159
|
+
}).with({ ActiveCDPInterestTracking: P10.select() }, (interest) => {
|
|
2160
2160
|
return calculateAccruedInterest(
|
|
2161
2161
|
currentTime,
|
|
2162
2162
|
interest.unitaryInterestSnapshot,
|
|
@@ -2779,7 +2779,6 @@ function parseExecuteDatumOrThrow(datum) {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
|
|
2781
2781
|
// src/contracts/gov/helpers.ts
|
|
2782
|
-
import { pipe } from "fp-ts/lib/function";
|
|
2783
2782
|
import {
|
|
2784
2783
|
array as A5,
|
|
2785
2784
|
option as O8,
|
|
@@ -2822,7 +2821,7 @@ async function findRelativeAssetForInsertion(newAsset, allIAssetOrefs, lucid, as
|
|
|
2822
2821
|
return { datum, utxo };
|
|
2823
2822
|
})
|
|
2824
2823
|
);
|
|
2825
|
-
return pipe(
|
|
2824
|
+
return F9.pipe(
|
|
2826
2825
|
parsedUtxos,
|
|
2827
2826
|
// Sort by the asset names
|
|
2828
2827
|
A5.sort(
|
|
@@ -2884,7 +2883,7 @@ async function findFirstAsset(allIAssetOrefs, lucid, assetOrd, getComparisonAsse
|
|
|
2884
2883
|
return { datum, utxo };
|
|
2885
2884
|
})
|
|
2886
2885
|
);
|
|
2887
|
-
return pipe(
|
|
2886
|
+
return F9.pipe(
|
|
2888
2887
|
parsedUtxos,
|
|
2889
2888
|
// Sort by the asset names
|
|
2890
2889
|
A5.sort(
|
|
@@ -3249,10 +3248,10 @@ import {
|
|
|
3249
3248
|
scriptHashToCredential as scriptHashToCredential2,
|
|
3250
3249
|
toHex as toHex6
|
|
3251
3250
|
} from "@lucid-evolution/lucid";
|
|
3252
|
-
import { match as match11, P as
|
|
3251
|
+
import { match as match11, P as P12 } from "ts-pattern";
|
|
3253
3252
|
|
|
3254
3253
|
// src/contracts/pyth-feed/helpers.ts
|
|
3255
|
-
import { match as match10, P as
|
|
3254
|
+
import { match as match10, P as P11 } from "ts-pattern";
|
|
3256
3255
|
|
|
3257
3256
|
// src/utils/pyth/types.ts
|
|
3258
3257
|
var PRICE_UPDATE_MAGIC = new Uint8Array([117, 211, 199, 147]);
|
|
@@ -3690,12 +3689,12 @@ async function encodeSignedPythMessage(update, secretKey) {
|
|
|
3690
3689
|
import { fromHex as fromHex5 } from "@lucid-evolution/lucid";
|
|
3691
3690
|
import { array as A7, function as F11 } from "fp-ts";
|
|
3692
3691
|
function collectPriceFeedIds(derivedPythPrice) {
|
|
3693
|
-
const ids = match10(derivedPythPrice).with({ Value:
|
|
3692
|
+
const ids = match10(derivedPythPrice).with({ Value: P11.select() }, (value) => [
|
|
3694
3693
|
BigInt(value.configuration.priceFeedId)
|
|
3695
3694
|
]).with(
|
|
3696
|
-
{ Inverse:
|
|
3695
|
+
{ Inverse: P11.select() },
|
|
3697
3696
|
(inverse) => collectPriceFeedIds(fromDataDerivedPythPrice(inverse.value))
|
|
3698
|
-
).with({ Divide:
|
|
3697
|
+
).with({ Divide: P11.select() }, (divide) => [
|
|
3699
3698
|
...collectPriceFeedIds(fromDataDerivedPythPrice(divide.x)),
|
|
3700
3699
|
...collectPriceFeedIds(fromDataDerivedPythPrice(divide.y))
|
|
3701
3700
|
]).exhaustive();
|
|
@@ -3705,7 +3704,7 @@ function derivePythPrice(derivedPythPrice, messageHex) {
|
|
|
3705
3704
|
const decodedMessage = decodePythMessage(fromHex5(messageHex));
|
|
3706
3705
|
const pricePayload = decodePriceUpdate(decodedMessage.payload);
|
|
3707
3706
|
return match10(derivedPythPrice).with(
|
|
3708
|
-
{ Value:
|
|
3707
|
+
{ Value: P11.select() },
|
|
3709
3708
|
(value) => {
|
|
3710
3709
|
const payload = pricePayload.priceFeeds.find(
|
|
3711
3710
|
(p) => p.priceFeedId === Number(value.configuration.priceFeedId)
|
|
@@ -3724,13 +3723,13 @@ function derivePythPrice(derivedPythPrice, messageHex) {
|
|
|
3724
3723
|
}
|
|
3725
3724
|
return { numerator: price, denominator: 10n ** BigInt(-exp) };
|
|
3726
3725
|
}
|
|
3727
|
-
).with({ Inverse:
|
|
3726
|
+
).with({ Inverse: P11.select() }, (inverse) => {
|
|
3728
3727
|
const inner = derivePythPrice(
|
|
3729
3728
|
fromDataDerivedPythPrice(inverse.value),
|
|
3730
3729
|
messageHex
|
|
3731
3730
|
);
|
|
3732
3731
|
return { numerator: inner.denominator, denominator: inner.numerator };
|
|
3733
|
-
}).with({ Divide:
|
|
3732
|
+
}).with({ Divide: P11.select() }, (divide) => {
|
|
3734
3733
|
const x = derivePythPrice(fromDataDerivedPythPrice(divide.x), messageHex);
|
|
3735
3734
|
const y = derivePythPrice(fromDataDerivedPythPrice(divide.y), messageHex);
|
|
3736
3735
|
return {
|
|
@@ -3744,7 +3743,7 @@ function derivePythPrice(derivedPythPrice, messageHex) {
|
|
|
3744
3743
|
import * as Core from "@evolution-sdk/evolution";
|
|
3745
3744
|
var MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET = 9;
|
|
3746
3745
|
function attachOracle(iasset, collateralAsset, priceInfo, priceOracleOref, pythStateOref, pythMessage, pythConfig, biasTime, lucid, tx) {
|
|
3747
|
-
return match11(priceInfo).returnType().with({ Delisted:
|
|
3746
|
+
return match11(priceInfo).returnType().with({ Delisted: P12.any }, () => {
|
|
3748
3747
|
const currentTime = BigInt(lucid.slotToUnixTime(lucid.currentSlot()));
|
|
3749
3748
|
const validFrom = Number(currentTime - BigInt(biasTime / 2n));
|
|
3750
3749
|
const validTo = Number(currentTime + BigInt(biasTime / 2n));
|
|
@@ -3755,7 +3754,7 @@ function attachOracle(iasset, collateralAsset, priceInfo, priceOracleOref, pythS
|
|
|
3755
3754
|
},
|
|
3756
3755
|
referenceInputs: []
|
|
3757
3756
|
});
|
|
3758
|
-
}).with({ OracleNft:
|
|
3757
|
+
}).with({ OracleNft: P12.any }, async () => {
|
|
3759
3758
|
if (!priceOracleOref) throw new Error("Missing price oracle");
|
|
3760
3759
|
const priceOracleUtxo = matchSingle(
|
|
3761
3760
|
await lucid.utxosByOutRef([priceOracleOref]),
|
|
@@ -3773,7 +3772,7 @@ function attachOracle(iasset, collateralAsset, priceInfo, priceOracleOref, pythS
|
|
|
3773
3772
|
referenceInputs: [priceOracleUtxo]
|
|
3774
3773
|
};
|
|
3775
3774
|
}).with(
|
|
3776
|
-
{ DeferredValidation: { feedValHash:
|
|
3775
|
+
{ DeferredValidation: { feedValHash: P12.select() } },
|
|
3777
3776
|
async (feedValHash) => {
|
|
3778
3777
|
if (priceOracleOref) throw new Error("Cannot pass price oracle oref");
|
|
3779
3778
|
if (!pythMessage) throw new Error("Missing Pyth message");
|
|
@@ -3837,13 +3836,13 @@ function attachOracle(iasset, collateralAsset, priceInfo, priceOracleOref, pythS
|
|
|
3837
3836
|
}
|
|
3838
3837
|
|
|
3839
3838
|
// src/utils/oracle-helpers.ts
|
|
3840
|
-
import { match as match12, P as
|
|
3839
|
+
import { match as match12, P as P13 } from "ts-pattern";
|
|
3841
3840
|
import {
|
|
3842
3841
|
getInlineDatumOrThrow as getInlineDatumOrThrow4,
|
|
3843
3842
|
matchSingle as matchSingle2
|
|
3844
3843
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
3845
3844
|
async function retrieveAdjustedPrice(iasset, collateralAsset, priceInfo, extraDecimals, priceOracleOref, pythMessage, pythConfig, lucid) {
|
|
3846
|
-
const [oraclePrice, maybePriceOracleUtxo] = await match12(priceInfo).with({ OracleNft:
|
|
3845
|
+
const [oraclePrice, maybePriceOracleUtxo] = await match12(priceInfo).with({ OracleNft: P13.any }, async () => {
|
|
3847
3846
|
if (!priceOracleOref) throw new Error("Missing price oracle");
|
|
3848
3847
|
const priceOracleUtxo = matchSingle2(
|
|
3849
3848
|
await lucid.utxosByOutRef([priceOracleOref]),
|
|
@@ -3853,7 +3852,7 @@ async function retrieveAdjustedPrice(iasset, collateralAsset, priceInfo, extraDe
|
|
|
3853
3852
|
getInlineDatumOrThrow4(priceOracleUtxo)
|
|
3854
3853
|
);
|
|
3855
3854
|
return [priceOracleDatum.price, priceOracleUtxo];
|
|
3856
|
-
}).with({ Delisted:
|
|
3855
|
+
}).with({ Delisted: P13.select() }, (price) => [price.price, void 0]).with({ DeferredValidation: P13.select() }, () => {
|
|
3857
3856
|
if (!pythMessage) throw new Error("Missing Pyth message");
|
|
3858
3857
|
return [
|
|
3859
3858
|
derivePythPrice(
|
|
@@ -3925,7 +3924,7 @@ async function openCdp(collateralAmount, mintedAmount, sysParams, cdpCreatorOref
|
|
|
3925
3924
|
await lucid.utxosByOutRef([cdpCreatorOref]),
|
|
3926
3925
|
(_) => new Error("Expected a single CDP creator UTXO")
|
|
3927
3926
|
);
|
|
3928
|
-
match13(collateralAssetDatum.priceInfo).with({ Delisted:
|
|
3927
|
+
match13(collateralAssetDatum.priceInfo).with({ Delisted: P14.any }, () => {
|
|
3929
3928
|
throw new Error("Can't open CDP of delisted asset");
|
|
3930
3929
|
}).otherwise(() => {
|
|
3931
3930
|
});
|
|
@@ -4084,9 +4083,9 @@ async function adjustCdp(collateralAdjustment, debtAdjustment, cdpOref, iassetOr
|
|
|
4084
4083
|
const interestOracleDatum = parseInterestOracleDatum(
|
|
4085
4084
|
getInlineDatumOrThrow(interestOracleUtxo)
|
|
4086
4085
|
);
|
|
4087
|
-
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees:
|
|
4086
|
+
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees: P14.any }, () => {
|
|
4088
4087
|
throw new Error("CDP fees wrong");
|
|
4089
|
-
}).with({ ActiveCDPInterestTracking:
|
|
4088
|
+
}).with({ ActiveCDPInterestTracking: P14.select() }, (interest) => {
|
|
4090
4089
|
return calculateAccruedInterest(
|
|
4091
4090
|
currentTime,
|
|
4092
4091
|
interest.unitaryInterestSnapshot,
|
|
@@ -4339,9 +4338,9 @@ async function closeCdp(cdpOref, collateralAssetOref, interestOracleOref, intere
|
|
|
4339
4338
|
throw new Error("Expected active CDP");
|
|
4340
4339
|
}
|
|
4341
4340
|
tx.addSignerKey(toHex7(cdpDatum.cdpOwner));
|
|
4342
|
-
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees:
|
|
4341
|
+
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees: P14.any }, () => {
|
|
4343
4342
|
throw new Error("CDP fees wrong");
|
|
4344
|
-
}).with({ ActiveCDPInterestTracking:
|
|
4343
|
+
}).with({ ActiveCDPInterestTracking: P14.select() }, (interest) => {
|
|
4345
4344
|
return calculateAccruedInterest(
|
|
4346
4345
|
currentTime,
|
|
4347
4346
|
interest.unitaryInterestSnapshot,
|
|
@@ -4412,7 +4411,7 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, coll
|
|
|
4412
4411
|
const collateralAssetDatum = parseCollateralAssetDatumOrThrow(
|
|
4413
4412
|
getInlineDatumOrThrow(collateralAssetUtxo)
|
|
4414
4413
|
);
|
|
4415
|
-
const isDelisted = match13(collateralAssetDatum.priceInfo).with({ Delisted:
|
|
4414
|
+
const isDelisted = match13(collateralAssetDatum.priceInfo).with({ Delisted: P14.any }, () => true).otherwise(() => false);
|
|
4416
4415
|
if (!isDelisted && priceOracleOref === void 0) {
|
|
4417
4416
|
throw new Error("Missing price oracle");
|
|
4418
4417
|
}
|
|
@@ -4438,9 +4437,9 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, coll
|
|
|
4438
4437
|
(_) => new Error("Expected a single gov UTXO")
|
|
4439
4438
|
);
|
|
4440
4439
|
const govDatum = parseGovDatumOrThrow(getInlineDatumOrThrow(govUtxo));
|
|
4441
|
-
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees:
|
|
4440
|
+
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees: P14.any }, () => {
|
|
4442
4441
|
throw new Error("CDP fees wrong");
|
|
4443
|
-
}).with({ ActiveCDPInterestTracking:
|
|
4442
|
+
}).with({ ActiveCDPInterestTracking: P14.select() }, (interest) => {
|
|
4444
4443
|
return calculateAccruedInterest(
|
|
4445
4444
|
currentTime,
|
|
4446
4445
|
interest.unitaryInterestSnapshot,
|
|
@@ -4664,9 +4663,9 @@ async function freezeCdp(cdpOref, iassetOref, collateralAssetOref, priceOracleOr
|
|
|
4664
4663
|
const interestOracleDatum = parseInterestOracleDatum(
|
|
4665
4664
|
getInlineDatumOrThrow(interestOracleUtxo)
|
|
4666
4665
|
);
|
|
4667
|
-
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees:
|
|
4666
|
+
const interestAmt = match13(cdpDatum.cdpFees).with({ FrozenCDPAccumulatedFees: P14.any }, () => {
|
|
4668
4667
|
throw new Error("CDP fees wrong");
|
|
4669
|
-
}).with({ ActiveCDPInterestTracking:
|
|
4668
|
+
}).with({ ActiveCDPInterestTracking: P14.select() }, (interest) => {
|
|
4670
4669
|
return calculateAccruedInterest(
|
|
4671
4670
|
currentTime,
|
|
4672
4671
|
interest.unitaryInterestSnapshot,
|
|
@@ -4779,10 +4778,10 @@ async function liquidateCdp(cdpOref, stabilityPoolOref, interestCollectorOref, t
|
|
|
4779
4778
|
(_) => new Error("Expected a single stability pool UTXO")
|
|
4780
4779
|
);
|
|
4781
4780
|
const spDatum = parseStabilityPoolDatumOrThrow(getInlineDatumOrThrow(spUtxo));
|
|
4782
|
-
const [frozenInterest, collateralForTreasury] = match13(cdpDatum.cdpFees).returnType().with({ FrozenCDPAccumulatedFees:
|
|
4781
|
+
const [frozenInterest, collateralForTreasury] = match13(cdpDatum.cdpFees).returnType().with({ FrozenCDPAccumulatedFees: P14.select() }, (fees) => [
|
|
4783
4782
|
fees.iassetInterest,
|
|
4784
4783
|
fees.collateralTreasury
|
|
4785
|
-
]).with({ ActiveCDPInterestTracking:
|
|
4784
|
+
]).with({ ActiveCDPInterestTracking: P14.any }, () => {
|
|
4786
4785
|
throw new Error("CDP fees wrong");
|
|
4787
4786
|
}).exhaustive();
|
|
4788
4787
|
const cdpNftAc = fromSystemParamsAsset(sysParams.cdpParams.cdpAuthToken);
|
|
@@ -4918,7 +4917,7 @@ async function mergeCdps(cdpsToMergeUtxos, sysParams, lucid) {
|
|
|
4918
4917
|
cdpDatums,
|
|
4919
4918
|
A8.reduce(
|
|
4920
4919
|
{ aggregatedCollateralTreasury: 0n, aggregatedInterest: 0n },
|
|
4921
|
-
(acc, cdpDat) => match13(cdpDat.cdpFees).returnType().with({ FrozenCDPAccumulatedFees:
|
|
4920
|
+
(acc, cdpDat) => match13(cdpDat.cdpFees).returnType().with({ FrozenCDPAccumulatedFees: P14.select() }, (fees) => ({
|
|
4922
4921
|
aggregatedCollateralTreasury: acc.aggregatedCollateralTreasury + fees.collateralTreasury,
|
|
4923
4922
|
aggregatedInterest: acc.aggregatedInterest + fees.iassetInterest
|
|
4924
4923
|
})).otherwise(() => acc)
|
|
@@ -4926,7 +4925,7 @@ async function mergeCdps(cdpsToMergeUtxos, sysParams, lucid) {
|
|
|
4926
4925
|
);
|
|
4927
4926
|
const [[mainMergeUtxo, mainCdpDatum], otherMergeUtxos] = match13(
|
|
4928
4927
|
A8.zip(cdpUtxos, cdpDatums)
|
|
4929
|
-
).returnType().with([
|
|
4928
|
+
).returnType().with([P14._, ...P14.array()], ([main, ...other]) => [
|
|
4930
4929
|
main,
|
|
4931
4930
|
other.map((a) => a[0])
|
|
4932
4931
|
]).otherwise(() => {
|
|
@@ -5316,14 +5315,13 @@ import {
|
|
|
5316
5315
|
negateAssets as negateAssets3
|
|
5317
5316
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
5318
5317
|
import { Data as Data30 } from "@lucid-evolution/lucid";
|
|
5319
|
-
import { pipe as pipe2 } from "fp-ts/lib/function";
|
|
5320
5318
|
import { array as A9, option as O13, function as F16 } from "fp-ts";
|
|
5321
|
-
import { match as match16, P as
|
|
5319
|
+
import { match as match16, P as P17 } from "ts-pattern";
|
|
5322
5320
|
|
|
5323
5321
|
// src/contracts/staking/types-new.ts
|
|
5324
5322
|
import { TSchema as TSchema16, Data as Data27 } from "@evolution-sdk/evolution";
|
|
5325
5323
|
import { option as O11, function as F14 } from "fp-ts";
|
|
5326
|
-
import { match as match14, P as
|
|
5324
|
+
import { match as match14, P as P15 } from "ts-pattern";
|
|
5327
5325
|
var StakingPosLockedAmtSchema = TSchema16.Array(
|
|
5328
5326
|
TSchema16.Tuple([
|
|
5329
5327
|
TSchema16.Integer,
|
|
@@ -5406,7 +5404,7 @@ function parseStakingPosition(datum) {
|
|
|
5406
5404
|
Data27.withSchema(StakingDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
5407
5405
|
datum
|
|
5408
5406
|
)
|
|
5409
|
-
).with({ owner:
|
|
5407
|
+
).with({ owner: P15.any }, (res) => O11.some(res)).otherwise(() => O11.none);
|
|
5410
5408
|
} catch (_) {
|
|
5411
5409
|
return O11.none;
|
|
5412
5410
|
}
|
|
@@ -5424,7 +5422,7 @@ function parseStakingManagerDatum(datum) {
|
|
|
5424
5422
|
Data27.withSchema(StakingDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
5425
5423
|
datum
|
|
5426
5424
|
)
|
|
5427
|
-
).with({ totalStake:
|
|
5425
|
+
).with({ totalStake: P15.any }, (res) => res).otherwise(() => {
|
|
5428
5426
|
throw new Error("Expected a StakingPosition datum.");
|
|
5429
5427
|
});
|
|
5430
5428
|
}
|
|
@@ -5599,7 +5597,7 @@ import {
|
|
|
5599
5597
|
OutputReferenceSchema as OutputReferenceSchema5
|
|
5600
5598
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
5601
5599
|
import { option as O12, function as F15 } from "fp-ts";
|
|
5602
|
-
import { match as match15, P as
|
|
5600
|
+
import { match as match15, P as P16 } from "ts-pattern";
|
|
5603
5601
|
var PollStatusSchema = TSchema18.Struct({
|
|
5604
5602
|
yesVotes: TSchema18.Integer,
|
|
5605
5603
|
noVotes: TSchema18.Integer
|
|
@@ -5714,7 +5712,7 @@ function parsePollManager(datum) {
|
|
|
5714
5712
|
Data29.withSchema(PollDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
5715
5713
|
datum
|
|
5716
5714
|
)
|
|
5717
|
-
).with({ PollManager:
|
|
5715
|
+
).with({ PollManager: P16.select() }, (res) => O12.some(res)).otherwise(() => O12.none);
|
|
5718
5716
|
} catch (_) {
|
|
5719
5717
|
return O12.none;
|
|
5720
5718
|
}
|
|
@@ -5733,7 +5731,7 @@ function parsePollShard(datum) {
|
|
|
5733
5731
|
Data29.withSchema(PollDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
5734
5732
|
datum
|
|
5735
5733
|
)
|
|
5736
|
-
).with({ PollShard:
|
|
5734
|
+
).with({ PollShard: P16.select() }, (res) => O12.some(res)).otherwise(() => O12.none);
|
|
5737
5735
|
} catch (_) {
|
|
5738
5736
|
return O12.none;
|
|
5739
5737
|
}
|
|
@@ -5790,7 +5788,7 @@ async function createProposal(proposalContent, treasuryWithdrawal, sysParams, lu
|
|
|
5790
5788
|
);
|
|
5791
5789
|
const newPollId = govDatum.currentProposal + 1n;
|
|
5792
5790
|
const tx = lucid.newTx();
|
|
5793
|
-
await match16(proposalContent).with({ ProposeIAsset: { asset:
|
|
5791
|
+
await match16(proposalContent).with({ ProposeIAsset: { asset: P17.select() } }, async (newAsset) => {
|
|
5794
5792
|
if (allIAssetOrefs === void 0) {
|
|
5795
5793
|
throw new Error("Missing iAsset orefs");
|
|
5796
5794
|
}
|
|
@@ -5799,7 +5797,7 @@ async function createProposal(proposalContent, treasuryWithdrawal, sysParams, lu
|
|
|
5799
5797
|
allIAssetOrefs,
|
|
5800
5798
|
lucid
|
|
5801
5799
|
);
|
|
5802
|
-
|
|
5800
|
+
F16.pipe(
|
|
5803
5801
|
relativeIAsset,
|
|
5804
5802
|
O13.match(
|
|
5805
5803
|
() => {
|
|
@@ -6286,7 +6284,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6286
6284
|
getInlineDatumOrThrow(executeUtxo)
|
|
6287
6285
|
);
|
|
6288
6286
|
const tx = lucid.newTx();
|
|
6289
|
-
await
|
|
6287
|
+
await F16.pipe(
|
|
6290
6288
|
O13.fromNullable(executeDatum.treasuryWithdrawal),
|
|
6291
6289
|
O13.match(
|
|
6292
6290
|
() => {
|
|
@@ -6349,7 +6347,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6349
6347
|
}
|
|
6350
6348
|
)
|
|
6351
6349
|
);
|
|
6352
|
-
await match16(executeDatum.content).with({ ProposeIAsset:
|
|
6350
|
+
await match16(executeDatum.content).with({ ProposeIAsset: P17.select() }, async (proposeContent) => {
|
|
6353
6351
|
const iassetTokenPolicyRefScriptUtxo = matchSingle(
|
|
6354
6352
|
await lucid.utxosByOutRef([
|
|
6355
6353
|
fromSystemParamsScriptRef(
|
|
@@ -6476,7 +6474,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6476
6474
|
)
|
|
6477
6475
|
)
|
|
6478
6476
|
);
|
|
6479
|
-
}).with({ ModifyIAsset:
|
|
6477
|
+
}).with({ ModifyIAsset: P17.select() }, async (modifyContent) => {
|
|
6480
6478
|
const iassetRefScriptUtxo = matchSingle(
|
|
6481
6479
|
await lucid.utxosByOutRef([
|
|
6482
6480
|
fromSystemParamsScriptRef(
|
|
@@ -6523,7 +6521,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6523
6521
|
},
|
|
6524
6522
|
iassetUtxo.assets
|
|
6525
6523
|
).readFrom([govUtxo]).setMinFee(900000n);
|
|
6526
|
-
}).with({ AddCollateralAsset:
|
|
6524
|
+
}).with({ AddCollateralAsset: P17.select() }, async (addCollateralContent) => {
|
|
6527
6525
|
const collateralAssetTokenPolicyRefScriptUtxo = matchSingle(
|
|
6528
6526
|
await lucid.utxosByOutRef([
|
|
6529
6527
|
fromSystemParamsScriptRef(
|
|
@@ -6673,7 +6671,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6673
6671
|
);
|
|
6674
6672
|
}
|
|
6675
6673
|
}).with(
|
|
6676
|
-
{ UpdateCollateralAsset:
|
|
6674
|
+
{ UpdateCollateralAsset: P17.select() },
|
|
6677
6675
|
async (updateCollateralContent) => {
|
|
6678
6676
|
const iassetRefScriptUtxo = matchSingle(
|
|
6679
6677
|
await lucid.utxosByOutRef([
|
|
@@ -6728,9 +6726,9 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6728
6726
|
collateralAssetUtxo.assets
|
|
6729
6727
|
).readFrom([govUtxo]).setMinFee(900000n);
|
|
6730
6728
|
}
|
|
6731
|
-
).with({ TextProposal:
|
|
6729
|
+
).with({ TextProposal: P17.any }, () => {
|
|
6732
6730
|
tx.readFrom([govUtxo]);
|
|
6733
|
-
}).with({ ProposeStableswapPool:
|
|
6731
|
+
}).with({ ProposeStableswapPool: P17.select() }, async (proposeContent) => {
|
|
6734
6732
|
const cdpCreatorRefScriptUtxo = matchSingle(
|
|
6735
6733
|
await lucid.utxosByOutRef([
|
|
6736
6734
|
fromSystemParamsScriptRef(
|
|
@@ -6804,7 +6802,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6804
6802
|
},
|
|
6805
6803
|
cdpAuthVal
|
|
6806
6804
|
);
|
|
6807
|
-
}).with({ ModifyStableswapPool:
|
|
6805
|
+
}).with({ ModifyStableswapPool: P17.select() }, async (modifyContent) => {
|
|
6808
6806
|
const cdpRefScriptUtxo = matchSingle(
|
|
6809
6807
|
await lucid.utxosByOutRef([
|
|
6810
6808
|
fromSystemParamsScriptRef(sysParams.scriptReferences.cdpValidatorRef)
|
|
@@ -6849,7 +6847,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6849
6847
|
stableswapPoolUtxo.assets
|
|
6850
6848
|
).setMinFee(1416197n);
|
|
6851
6849
|
}).with(
|
|
6852
|
-
{ ModifyProtocolParams: { newParams:
|
|
6850
|
+
{ ModifyProtocolParams: { newParams: P17.select() } },
|
|
6853
6851
|
(newProtocolParams) => {
|
|
6854
6852
|
tx.readFrom([govRefScriptUtxo]).collectFrom([govUtxo], serialiseGovRedeemer("UpgradeGov")).pay.ToContract(
|
|
6855
6853
|
govUtxo.address,
|
|
@@ -6863,7 +6861,7 @@ async function executeProposal(executeOref, govOref, treasuryWithdrawalOref, all
|
|
|
6863
6861
|
govUtxo.assets
|
|
6864
6862
|
);
|
|
6865
6863
|
}
|
|
6866
|
-
).with({ UpgradeProtocol:
|
|
6864
|
+
).with({ UpgradeProtocol: P17.select() }, async (d) => {
|
|
6867
6865
|
const versionRecordTokenPolicyRefScriptUtxo = matchSingle(
|
|
6868
6866
|
await lucid.utxosByOutRef([
|
|
6869
6867
|
fromSystemParamsScriptRef(
|
|
@@ -7298,7 +7296,7 @@ function mkOneShotPolicy(params) {
|
|
|
7298
7296
|
}
|
|
7299
7297
|
|
|
7300
7298
|
// src/contracts/one-shot/transactions.ts
|
|
7301
|
-
import {
|
|
7299
|
+
import { array as A10 } from "fp-ts";
|
|
7302
7300
|
async function oneShotMintTx(lucid, params) {
|
|
7303
7301
|
const oneShotPolicy = mkOneShotPolicy(params);
|
|
7304
7302
|
const policyId = mintingPolicyToId(oneShotPolicy);
|
|
@@ -7315,7 +7313,7 @@ async function oneShotMintTx(lucid, params) {
|
|
|
7315
7313
|
);
|
|
7316
7314
|
return [
|
|
7317
7315
|
lucid.newTx().collectFrom([refUtxo]).mintAssets(
|
|
7318
|
-
reduce(
|
|
7316
|
+
A10.reduce(
|
|
7319
7317
|
{},
|
|
7320
7318
|
(acc, entry) => addAssets10(acc, {
|
|
7321
7319
|
[toUnit(policyId, entry.tokenName)]: entry.amount
|
|
@@ -7428,7 +7426,7 @@ async function feedInterestOracle(params, newInterestRate, lucid, assetClass, ut
|
|
|
7428
7426
|
tx.readFrom([scriptRef2]);
|
|
7429
7427
|
} else {
|
|
7430
7428
|
const validator = scriptOverrideCborHex ? {
|
|
7431
|
-
type: "
|
|
7429
|
+
type: "PlutusV2",
|
|
7432
7430
|
script: applyParamsToScript9(scriptOverrideCborHex, [
|
|
7433
7431
|
castInterestOracleParams(params)
|
|
7434
7432
|
])
|
|
@@ -7862,7 +7860,7 @@ import {
|
|
|
7862
7860
|
assetClassToUnit as assetClassToUnit5,
|
|
7863
7861
|
matchSingle as matchSingle4
|
|
7864
7862
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
7865
|
-
import { option as O16, array as
|
|
7863
|
+
import { option as O16, array as A11, function as F19 } from "fp-ts";
|
|
7866
7864
|
async function findStabilityPool(lucid, sysParams, iassetName) {
|
|
7867
7865
|
const spUtxos = await lucid.utxosAtWithUnit(
|
|
7868
7866
|
{ hash: sysParams.validatorHashes.stabilityPoolHash, type: "Script" },
|
|
@@ -7885,7 +7883,7 @@ async function findStabilityPool(lucid, sysParams, iassetName) {
|
|
|
7885
7883
|
})
|
|
7886
7884
|
)
|
|
7887
7885
|
),
|
|
7888
|
-
|
|
7886
|
+
A11.compact
|
|
7889
7887
|
),
|
|
7890
7888
|
(res) => new Error(
|
|
7891
7889
|
"Expected a single Stability Pool UTXO.: " + JSON.stringify(res)
|
|
@@ -7912,7 +7910,7 @@ async function findStabilityPoolAccount(lucid, sysParams, owner, iassetName) {
|
|
|
7912
7910
|
})
|
|
7913
7911
|
)
|
|
7914
7912
|
),
|
|
7915
|
-
|
|
7913
|
+
A11.compact
|
|
7916
7914
|
),
|
|
7917
7915
|
(res) => new Error("Expected a single Account UTXO.: " + JSON.stringify(res))
|
|
7918
7916
|
);
|
|
@@ -7940,7 +7938,7 @@ async function findE2s2sSnapshots(lucid, sysParams, iassetName) {
|
|
|
7940
7938
|
})
|
|
7941
7939
|
)
|
|
7942
7940
|
),
|
|
7943
|
-
|
|
7941
|
+
A11.compact
|
|
7944
7942
|
);
|
|
7945
7943
|
}
|
|
7946
7944
|
|
|
@@ -7965,7 +7963,7 @@ import {
|
|
|
7965
7963
|
mkLovelacesOf as mkLovelacesOf5,
|
|
7966
7964
|
negateAssets as negateAssets4
|
|
7967
7965
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
7968
|
-
import { match as match17, P as
|
|
7966
|
+
import { match as match17, P as P18 } from "ts-pattern";
|
|
7969
7967
|
async function requestSpAccountCreation(assetAscii, amount, sysParams, lucid) {
|
|
7970
7968
|
const [pkh, _skh] = await addrDetails(lucid);
|
|
7971
7969
|
const iasset = fromHex11(fromText8(assetAscii));
|
|
@@ -8254,7 +8252,7 @@ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetU
|
|
|
8254
8252
|
},
|
|
8255
8253
|
addAssets11(accountTokenVal, mkLovelacesOf5(accountOutputAdaAmt))
|
|
8256
8254
|
).setMinFee(txFee);
|
|
8257
|
-
}).with({ Adjust:
|
|
8255
|
+
}).with({ Adjust: P18.select() }, async (adjustContent) => {
|
|
8258
8256
|
const iassetDatum = parseIAssetDatumOrThrow(
|
|
8259
8257
|
getInlineDatumOrThrow(iAssetUtxo)
|
|
8260
8258
|
);
|
|
@@ -8399,7 +8397,7 @@ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetU
|
|
|
8399
8397
|
},
|
|
8400
8398
|
actualOwnerOutputVal
|
|
8401
8399
|
).setMinFee(txFee);
|
|
8402
|
-
}).with({ Close:
|
|
8400
|
+
}).with({ Close: P18.select() }, async (closeContent) => {
|
|
8403
8401
|
if (txFee > closeContent.maxTxFee) {
|
|
8404
8402
|
throw new Error("Account doesn't allow current transaction fee.");
|
|
8405
8403
|
}
|
|
@@ -8741,12 +8739,12 @@ function parseRobRedeemerOrThrow(redeemerCborHex) {
|
|
|
8741
8739
|
// src/contracts/rob/helpers.ts
|
|
8742
8740
|
import {
|
|
8743
8741
|
readonlyArray as RA3,
|
|
8744
|
-
array as
|
|
8742
|
+
array as A12,
|
|
8745
8743
|
function as F21,
|
|
8746
8744
|
option as O18,
|
|
8747
8745
|
ord as Ord4
|
|
8748
8746
|
} from "fp-ts";
|
|
8749
|
-
import { match as match18, P as
|
|
8747
|
+
import { match as match18, P as P19 } from "ts-pattern";
|
|
8750
8748
|
import {
|
|
8751
8749
|
adaAssetClass as adaAssetClass5,
|
|
8752
8750
|
assetClassValueOf as assetClassValueOf9,
|
|
@@ -8798,7 +8796,7 @@ function calculateSpendAmtWhenRobSellOrder(purchaseIassetAmt, redemptionReimburs
|
|
|
8798
8796
|
);
|
|
8799
8797
|
}
|
|
8800
8798
|
function robCollateralAmtToSpend(robAssets, robOrderType) {
|
|
8801
|
-
return match18(robOrderType).returnType().with({ BuyIAssetOrder:
|
|
8799
|
+
return match18(robOrderType).returnType().with({ BuyIAssetOrder: P19.select() }, (content) => {
|
|
8802
8800
|
if (isSameAssetClass3(adaAssetClass5, content.collateralAsset)) {
|
|
8803
8801
|
return zeroNegatives(lovelacesAmt3(robAssets) - MIN_ROB_COLLATERAL_AMT);
|
|
8804
8802
|
} else {
|
|
@@ -8809,7 +8807,7 @@ function robCollateralAmtToSpend(robAssets, robOrderType) {
|
|
|
8809
8807
|
});
|
|
8810
8808
|
}
|
|
8811
8809
|
function robIAssetAmtToSpend(robAssets, robOrderType, robIasset) {
|
|
8812
|
-
return match18(robOrderType).returnType().with({ SellIAssetOrder:
|
|
8810
|
+
return match18(robOrderType).returnType().with({ SellIAssetOrder: P19.any }, (_) => {
|
|
8813
8811
|
return assetClassValueOf9(robAssets, robIasset);
|
|
8814
8812
|
}).otherwise(() => {
|
|
8815
8813
|
throw new Error("IAssets to spend is relevant only for Sell orders.");
|
|
@@ -8817,15 +8815,15 @@ function robIAssetAmtToSpend(robAssets, robOrderType, robIasset) {
|
|
|
8817
8815
|
}
|
|
8818
8816
|
function robAmtToSpend(robAssets, robOrderType, robIasset) {
|
|
8819
8817
|
return match18(robOrderType).with(
|
|
8820
|
-
{ BuyIAssetOrder:
|
|
8818
|
+
{ BuyIAssetOrder: P19.any },
|
|
8821
8819
|
() => robCollateralAmtToSpend(robAssets, robOrderType)
|
|
8822
8820
|
).with(
|
|
8823
|
-
{ SellIAssetOrder:
|
|
8821
|
+
{ SellIAssetOrder: P19.any },
|
|
8824
8822
|
() => robIAssetAmtToSpend(robAssets, robOrderType, robIasset)
|
|
8825
8823
|
).exhaustive();
|
|
8826
8824
|
}
|
|
8827
8825
|
function robBuyOrderFilledAssets(robAssets, robOrderType, robIasset) {
|
|
8828
|
-
return match18(robOrderType).returnType().with({ BuyIAssetOrder:
|
|
8826
|
+
return match18(robOrderType).returnType().with({ BuyIAssetOrder: P19.any }, () => {
|
|
8829
8827
|
return {
|
|
8830
8828
|
asset: robIasset,
|
|
8831
8829
|
filledAmt: assetClassValueOf9(robAssets, robIasset)
|
|
@@ -8835,7 +8833,7 @@ function robBuyOrderFilledAssets(robAssets, robOrderType, robIasset) {
|
|
|
8835
8833
|
});
|
|
8836
8834
|
}
|
|
8837
8835
|
function robSellOrderFilledAssets(robAssets, robOrderType) {
|
|
8838
|
-
return match18(robOrderType).returnType().with({ SellIAssetOrder:
|
|
8836
|
+
return match18(robOrderType).returnType().with({ SellIAssetOrder: P19.select() }, (content) => {
|
|
8839
8837
|
return content.allowedCollateralAssets.map(([asset, _]) => {
|
|
8840
8838
|
return {
|
|
8841
8839
|
asset,
|
|
@@ -8860,9 +8858,9 @@ function isBuyOrderFullyRedeemed(robAssets, robOrderType, oraclePrice) {
|
|
|
8860
8858
|
}
|
|
8861
8859
|
function isFullyRedeemed(robAssets, robOrderType, robIasset) {
|
|
8862
8860
|
return match18(robOrderType).returnType().with(
|
|
8863
|
-
{ BuyIAssetOrder:
|
|
8861
|
+
{ BuyIAssetOrder: P19.select() },
|
|
8864
8862
|
(content) => isBuyOrderFullyRedeemed(robAssets, robOrderType, content.maxPrice)
|
|
8865
|
-
).with({ SellIAssetOrder:
|
|
8863
|
+
).with({ SellIAssetOrder: P19.select() }, (content) => {
|
|
8866
8864
|
const iassetToSpend = robIAssetAmtToSpend(
|
|
8867
8865
|
robAssets,
|
|
8868
8866
|
robOrderType,
|
|
@@ -8878,7 +8876,7 @@ function isFullyRedeemed(robAssets, robOrderType, robIasset) {
|
|
|
8878
8876
|
function buildRedemptionsTx(redemptions, iasset, collateralAsset, price, redemptionReimbursementRatio, sysParams, tx, txOutputsBeforeCount, collateralAssetRefInputIdx, iassetRefInputIdx, oracleIdx) {
|
|
8879
8877
|
return F21.pipe(
|
|
8880
8878
|
redemptions,
|
|
8881
|
-
|
|
8879
|
+
A12.reduceWithIndex(
|
|
8882
8880
|
tx,
|
|
8883
8881
|
(idx, acc, [robUtxo, payoutAmt]) => {
|
|
8884
8882
|
const robDatum = parseRobDatumOrThrow(getInlineDatumOrThrow(robUtxo));
|
|
@@ -8887,7 +8885,7 @@ function buildRedemptionsTx(redemptions, iasset, collateralAsset, price, redempt
|
|
|
8887
8885
|
}
|
|
8888
8886
|
const [robOutputVal, sellOrderAllowedAssetsIdx] = match18(
|
|
8889
8887
|
robDatum.orderType
|
|
8890
|
-
).returnType().with({ BuyIAssetOrder:
|
|
8888
|
+
).returnType().with({ BuyIAssetOrder: P19.select() }, (content) => {
|
|
8891
8889
|
if (!isSameAssetClass3(content.collateralAsset, collateralAsset)) {
|
|
8892
8890
|
throw new Error("Only same collateral asset");
|
|
8893
8891
|
}
|
|
@@ -8911,7 +8909,7 @@ function buildRedemptionsTx(redemptions, iasset, collateralAsset, price, redempt
|
|
|
8911
8909
|
)
|
|
8912
8910
|
);
|
|
8913
8911
|
return [resultVal, 0n];
|
|
8914
|
-
}).with({ SellIAssetOrder:
|
|
8912
|
+
}).with({ SellIAssetOrder: P19.select() }, (content) => {
|
|
8915
8913
|
const allowedAssetIdx = F21.pipe(
|
|
8916
8914
|
content.allowedCollateralAssets,
|
|
8917
8915
|
RA3.findIndex(
|
|
@@ -8980,9 +8978,9 @@ function buildRedemptionsTx(redemptions, iasset, collateralAsset, price, redempt
|
|
|
8980
8978
|
function calculateTotalCollateralForRedemption(iasset, collateralAsset, iassetPrice, allRobs, maxRobsInTx) {
|
|
8981
8979
|
return F21.pipe(
|
|
8982
8980
|
allRobs,
|
|
8983
|
-
|
|
8981
|
+
A12.filterMap(([utxo, datum]) => {
|
|
8984
8982
|
const isCorrectOrder = match18(datum.orderType).returnType().with(
|
|
8985
|
-
{ BuyIAssetOrder:
|
|
8983
|
+
{ BuyIAssetOrder: P19.select() },
|
|
8986
8984
|
(content) => isSameAssetClass3(content.collateralAsset, collateralAsset) && rationalToFloat(content.maxPrice) >= rationalToFloat(iassetPrice) && !isBuyOrderFullyRedeemed(utxo.assets, datum.orderType, iassetPrice)
|
|
8987
8985
|
).otherwise(() => false);
|
|
8988
8986
|
if (toHex13(datum.iasset) !== toHex13(iasset) || !isCorrectOrder) {
|
|
@@ -8995,9 +8993,9 @@ function calculateTotalCollateralForRedemption(iasset, collateralAsset, iassetPr
|
|
|
8995
8993
|
return O18.some(collateralToSpend);
|
|
8996
8994
|
}),
|
|
8997
8995
|
// From largest to smallest
|
|
8998
|
-
|
|
8996
|
+
A12.sort(Ord4.reverse(BigIntOrd)),
|
|
8999
8997
|
// We can fit only this number of redemptions with CDP open into a single Tx.
|
|
9000
|
-
|
|
8998
|
+
A12.takeLeft(maxRobsInTx),
|
|
9001
8999
|
sum
|
|
9002
9000
|
);
|
|
9003
9001
|
}
|
|
@@ -9008,9 +9006,9 @@ function randomRobsSubsetSatisfyingTargetCollateral(iasset, collateralAsset, tar
|
|
|
9008
9006
|
const shuffled = randomiseFn(
|
|
9009
9007
|
F21.pipe(
|
|
9010
9008
|
allLrps,
|
|
9011
|
-
|
|
9009
|
+
A12.filter(
|
|
9012
9010
|
([utxo, datum]) => toHex13(datum.iasset) === toHex13(iasset) && match18(datum.orderType).with(
|
|
9013
|
-
{ BuyIAssetOrder:
|
|
9011
|
+
{ BuyIAssetOrder: P19.select() },
|
|
9014
9012
|
(content) => isSameAssetClass3(collateralAsset, content.collateralAsset) && rationalToFloat(content.maxPrice) >= rationalToFloat(iassetPrice)
|
|
9015
9013
|
).otherwise(() => false) && !isBuyOrderFullyRedeemed(utxo.assets, datum.orderType, iassetPrice)
|
|
9016
9014
|
)
|
|
@@ -9094,11 +9092,10 @@ import {
|
|
|
9094
9092
|
} from "@lucid-evolution/lucid";
|
|
9095
9093
|
import {
|
|
9096
9094
|
readonlyArray as RA4,
|
|
9097
|
-
array as
|
|
9095
|
+
array as A13,
|
|
9098
9096
|
function as F22,
|
|
9099
9097
|
option as O19
|
|
9100
9098
|
} from "fp-ts";
|
|
9101
|
-
import { unzip, zip } from "fp-ts/lib/Array";
|
|
9102
9099
|
import {
|
|
9103
9100
|
adaAssetClass as adaAssetClass6,
|
|
9104
9101
|
assetClassValueOf as assetClassValueOf10,
|
|
@@ -9107,7 +9104,7 @@ import {
|
|
|
9107
9104
|
mkLovelacesOf as mkLovelacesOf6,
|
|
9108
9105
|
negateAssets as negateAssets5
|
|
9109
9106
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
9110
|
-
import { match as match19, P as
|
|
9107
|
+
import { match as match19, P as P20 } from "ts-pattern";
|
|
9111
9108
|
async function openRob(assetTokenNameAscii, depositAmt, orderType, lucid, sysParams, robStakeCredential) {
|
|
9112
9109
|
const network = lucid.config().network;
|
|
9113
9110
|
const [ownPkh, _] = await addrDetails(lucid);
|
|
@@ -9123,10 +9120,10 @@ async function openRob(assetTokenNameAscii, depositAmt, orderType, lucid, sysPar
|
|
|
9123
9120
|
}
|
|
9124
9121
|
};
|
|
9125
9122
|
const depositVal = match19(orderType).with(
|
|
9126
|
-
{ BuyIAssetOrder:
|
|
9123
|
+
{ BuyIAssetOrder: P20.select() },
|
|
9127
9124
|
(buyContent) => mkAssetsOf10(buyContent.collateralAsset, depositAmt)
|
|
9128
9125
|
).with(
|
|
9129
|
-
{ SellIAssetOrder:
|
|
9126
|
+
{ SellIAssetOrder: P20.any },
|
|
9130
9127
|
(_2) => mkAssetsOf10(
|
|
9131
9128
|
{
|
|
9132
9129
|
currencySymbol: fromHex13(
|
|
@@ -9185,7 +9182,7 @@ async function redeemRob(redemptionRobsData, priceOracleOutRef, iassetOutRef, co
|
|
|
9185
9182
|
const collateralAssetDatum = parseCollateralAssetDatumOrThrow(
|
|
9186
9183
|
getInlineDatumOrThrow(collateralAssetUtxo)
|
|
9187
9184
|
);
|
|
9188
|
-
const [robsToRedeemOutRefs, robRedemptionIAssetAmt] = unzip(redemptionRobsData);
|
|
9185
|
+
const [robsToRedeemOutRefs, robRedemptionIAssetAmt] = A13.unzip(redemptionRobsData);
|
|
9189
9186
|
const [adjustedPrice, _] = await retrieveAdjustedPrice(
|
|
9190
9187
|
iassetDatum.assetName,
|
|
9191
9188
|
collateralAssetDatum.collateralAsset,
|
|
@@ -9196,7 +9193,7 @@ async function redeemRob(redemptionRobsData, priceOracleOutRef, iassetOutRef, co
|
|
|
9196
9193
|
sysParams.pythConfig,
|
|
9197
9194
|
lucid
|
|
9198
9195
|
);
|
|
9199
|
-
const redemptionRobs = await lucid.utxosByOutRef(robsToRedeemOutRefs).then((val) => zip(val, robRedemptionIAssetAmt));
|
|
9196
|
+
const redemptionRobs = await lucid.utxosByOutRef(robsToRedeemOutRefs).then((val) => A13.zip(val, robRedemptionIAssetAmt));
|
|
9200
9197
|
const allRefInputs = [robScriptRefUtxo, iassetUtxo, collateralAssetUtxo];
|
|
9201
9198
|
const tx = lucid.newTx();
|
|
9202
9199
|
const { interval, referenceInputs } = await attachOracle(
|
|
@@ -9268,10 +9265,10 @@ async function adjustRob(lucid, robOutRef, adjustmentAmt, newLimitPrice, sysPara
|
|
|
9268
9265
|
),
|
|
9269
9266
|
tokenName: robDatum.iasset
|
|
9270
9267
|
};
|
|
9271
|
-
const [depositAsset, rewardVal] = match19(robDatum.orderType).returnType().with({ BuyIAssetOrder:
|
|
9268
|
+
const [depositAsset, rewardVal] = match19(robDatum.orderType).returnType().with({ BuyIAssetOrder: P20.select() }, (buyContent) => {
|
|
9272
9269
|
const reward = assetClassValueOf10(robUtxo.assets, iassetAc);
|
|
9273
9270
|
return [buyContent.collateralAsset, mkAssetsOf10(iassetAc, reward)];
|
|
9274
|
-
}).with({ SellIAssetOrder:
|
|
9271
|
+
}).with({ SellIAssetOrder: P20.select() }, (content) => {
|
|
9275
9272
|
const reward = F22.pipe(
|
|
9276
9273
|
content.allowedCollateralAssets,
|
|
9277
9274
|
RA4.reduce(
|
|
@@ -9291,8 +9288,8 @@ async function adjustRob(lucid, robOutRef, adjustmentAmt, newLimitPrice, sysPara
|
|
|
9291
9288
|
kind: "inline",
|
|
9292
9289
|
value: serialiseRobDatum({
|
|
9293
9290
|
...robDatum,
|
|
9294
|
-
orderType: newLimitPrice == null ? robDatum.orderType : match19(robDatum.orderType).returnType().with({ BuyIAssetOrder:
|
|
9295
|
-
const newPrice = match19(newLimitPrice).with({ BuyOrder:
|
|
9291
|
+
orderType: newLimitPrice == null ? robDatum.orderType : match19(robDatum.orderType).returnType().with({ BuyIAssetOrder: P20.select() }, (content) => {
|
|
9292
|
+
const newPrice = match19(newLimitPrice).with({ BuyOrder: P20.select() }, (price) => price).otherwise(() => {
|
|
9296
9293
|
throw new Error(
|
|
9297
9294
|
"Must use buy order price change on buy order."
|
|
9298
9295
|
);
|
|
@@ -9300,9 +9297,9 @@ async function adjustRob(lucid, robOutRef, adjustmentAmt, newLimitPrice, sysPara
|
|
|
9300
9297
|
return {
|
|
9301
9298
|
BuyIAssetOrder: { ...content, maxPrice: newPrice }
|
|
9302
9299
|
};
|
|
9303
|
-
}).with({ SellIAssetOrder:
|
|
9300
|
+
}).with({ SellIAssetOrder: P20.select() }, (content) => {
|
|
9304
9301
|
const newPrices = match19(newLimitPrice).with(
|
|
9305
|
-
{ SellOrder: { newLimitPrices:
|
|
9302
|
+
{ SellOrder: { newLimitPrices: P20.select() } },
|
|
9306
9303
|
(prices) => prices
|
|
9307
9304
|
).otherwise(() => {
|
|
9308
9305
|
throw new Error(
|
|
@@ -9314,7 +9311,7 @@ async function adjustRob(lucid, robOutRef, adjustmentAmt, newLimitPrice, sysPara
|
|
|
9314
9311
|
allowedCollateralAssets: content.allowedCollateralAssets.map(
|
|
9315
9312
|
(entry) => F22.pipe(
|
|
9316
9313
|
newPrices,
|
|
9317
|
-
|
|
9314
|
+
A13.findFirst(
|
|
9318
9315
|
(newPrice) => isSameAssetClass4(newPrice[0], entry[0])
|
|
9319
9316
|
),
|
|
9320
9317
|
O19.match(
|
|
@@ -9387,7 +9384,7 @@ import {
|
|
|
9387
9384
|
} from "@lucid-evolution/lucid";
|
|
9388
9385
|
|
|
9389
9386
|
// src/contracts/rob-leverage/helpers.ts
|
|
9390
|
-
import { array as
|
|
9387
|
+
import { array as A14, function as F23 } from "fp-ts";
|
|
9391
9388
|
import { Decimal as Decimal2 } from "decimal.js";
|
|
9392
9389
|
var MAX_REDEMPTIONS_WITH_CDP_OPEN = 4;
|
|
9393
9390
|
function approximateLeverageRedemptions(baseCollateral, targetLeverage, redemptionReimbursementRatio, debtMintingFeeRatio) {
|
|
@@ -9415,7 +9412,7 @@ function approximateLeverageRedemptions(baseCollateral, targetLeverage, redempti
|
|
|
9415
9412
|
function summarizeActualLeverageRedemptions(lovelacesForRedemptionWithReimbursement, redemptionReimbursementRatio, iassetPrice, redemptionLrps) {
|
|
9416
9413
|
const redemptionDetails = F23.pipe(
|
|
9417
9414
|
redemptionLrps,
|
|
9418
|
-
|
|
9415
|
+
A14.reduce(
|
|
9419
9416
|
{
|
|
9420
9417
|
remainingCollateralToSpend: lovelacesForRedemptionWithReimbursement,
|
|
9421
9418
|
redemptions: []
|
|
@@ -9471,7 +9468,7 @@ function summarizeActualLeverageRedemptions(lovelacesForRedemptionWithReimbursem
|
|
|
9471
9468
|
);
|
|
9472
9469
|
const res = F23.pipe(
|
|
9473
9470
|
redemptionDetails.redemptions,
|
|
9474
|
-
|
|
9471
|
+
A14.reduce(
|
|
9475
9472
|
{
|
|
9476
9473
|
redeemedCollateral: 0n,
|
|
9477
9474
|
payoutIAssets: 0n,
|
|
@@ -10003,7 +10000,7 @@ var mkIAssetValidatorFromSP = (params) => {
|
|
|
10003
10000
|
import { match as match20 } from "ts-pattern";
|
|
10004
10001
|
|
|
10005
10002
|
// tests/test-helpers.ts
|
|
10006
|
-
import { array as
|
|
10003
|
+
import { array as A15, function as F24, option as O20 } from "fp-ts";
|
|
10007
10004
|
async function runAndAwaitTxBuilder(lucid, transaction, extraSigners = []) {
|
|
10008
10005
|
const bTx = await transaction.complete();
|
|
10009
10006
|
const signatures = [await bTx.partialSign.withWallet()];
|
|
@@ -10455,7 +10452,7 @@ function castStableswapParams(params) {
|
|
|
10455
10452
|
var _stableswapValidator = {
|
|
10456
10453
|
type: "PlutusScriptV3",
|
|
10457
10454
|
description: "Generated by Aiken",
|
|
10458
|
-
cborHex: "5923e65923e3010100229800aba4aba2aba1aba0aab9faab9eaab9dab9cab9a488888888a60022a660049201343c65787065637465643e2054686520646174756d2069732074686520737461626c657377617020706f6f6c20636f6e74656e742e00168a99801249233c65787065637465643e204d7573742068617665206120706f6f6c20636f6e74656e7400168a99801249333c65787065637465643e2054686520706f6f6c206d75737420686176652074686520636f72726563742072656465656d65722e00168a99801249333c65787065637465643e20546865206d61696e206f72646572206861732074686520636f72726563742072656465656d65722e00168a998012491e3c65787065637465643e204f7264657220697320746f6f20736d616c6c2e00168a998012491d3c65787065637465643e2053696e676c6520706f6f6c20696e7075742e001648888896600264653001300f00198079808000cdc3a4005300f00248889660026004601e6ea800e3300130103754007370e90034dc3a4011370e90024dc3a4001300f37540089111111991192cc004c0140122b30013019375401b0018b20348acc004c02c012264646644b30013021003802c5901e1bad301e001375a603c004603c00260326ea80362b300130060048acc004c064dd5006c0062c80d22b300130080048acc004c064dd5006c0062c80d22b300130070048acc004c064dd5006c0062c80d22c80b1016202c405880b06600246038603a603a603a603a603a603a603a603a0032301c301d00191119199119801001000912cc004006007132325980099b910060018acc004cdc7803000c4dd69810001401501d44cc010010c09000d01d1bae301e0013021001407c64646600200200c44b3001001801c4c8c96600266e440200062b30013371e0100031375660420050054079133004004302500340786eb8c07c004c0880050200a5eb7bdb18052000911919800800801912cc004006297ae0899912cc004c01400a26604000466008008003133004004001406c603e002604000280ea6e21200092cc004c018c060dd5000c4c070c064dd5000c5901648c070c074c074c074c07400646038603a603a603a603a603a603a603a603a603a003370290004dd2a40012598009802980c1baa001891919baf301e301b3754603c60366ea8008004c074c068dd5001448c8cdd7980f180d9baa002001301d301a375400480b246038603a603a0032301c301d301d301d0019baf4c103d87a8000912cc004006200315330180021001405d222332233004337046eb4c080008dd69810181080099b82375a60400026eb4c080c084008c06cdd5001980d9baa0019ba54800a602e6ea80326e9520049b89480112222222222222222222298009119198008009bac3017302f375400644b30010018a508acc004cdc79bae30330010038a51899801001181a000a05a40c52232330010010032259800800c5a264b30013375e606860626ea80040122603060626ea8006266006006606a0048170c0cc0050314888c8cc0540108c008c060c0c4dd5000acc004c06cc0b8dd5000c48c08a60026eacc05cc0c0dd5000cdd7181998181baa0039bae30173030375400680b224602930013756602e60606ea80066eb8c0ccc0c0dd5001cdd7180b98181baa00340588162464b3001301a302d375400313031302e3754003153302c491263c65787065637465643e2044656e6f6d696e61746f722063616e6e6f74206265207a65726f2e001640ac6644b3001301b0018a6103d87a80008acc004cdc4000a40011300e33031300e330313750601e004660626ea0c03c0052f5c097ae089807198189807198189ba800233031375000297ae04bd70205840b06eb4c0c0c0b4dd50009bad3014302d375400322233229800992cc004c078c0c4dd5000c4dd69819181a9bab30353032375400314800102f181a000cdd58014dd7981a181a800c8966002604a60646ea8016266e2400400a2b30013371200200513371200466e0000520809bee028a5040c08181222259800801c566002600400d13300100448002294103244c96600266ebd30101400030350018acc004cc008014dd6981b181c9bab3036001898019ba6303a0048a5040cd15980099801002a4001130030078a5040cc8198c0e000d0360dd3001194c004006009223303400233034374c00297ae04004444b3001002899800a6103d87a80004bd6f7b63044c8cc896600266e452201000028acc004cdc7a44100002899802180a1981b981a801a5eb80006266008980103d87a800000540c9198008034006446600c0046607200a00280310321bae30320013037003303500240cd2300c3302f37500026605e98010101004bd70488c8c8cc00400400c88c96600266ebc010c0c400626064003133003003303600240bc6068002600c6606000497ae048888888c96600260460171323259800acc004c088c0d4dd500fc5284528a0668992cc00400605d13259800981e00144c96600200315980099b8748040c0e0dd5000c4c9660020030348992cc00400606b03581ac4c966002608000713259800800c566002605e60786ea8006264b300100181cc4c9660020031598009821801466002003132598009816181f9baa00189919912cc00400a2b300130353042375400513259800800c102264b30010018acc004c12400a330010018acc004cc07d2401155369676e656420627920666565206d616e6167657200330190360038acc004cc8966002660429201274d696e74696e672066656520726174696f206973206265747765656e205b30252c20313030255d0059800cc005300106d8799f0001ff009119b8900200180120408cc00400a4466e24008006602c900120408a50411113302149012a526564656d7074696f6e2066656520726174696f206973206265747765656e205b30252c20313030255d0059800cc005300106d8799f0001ff009119b89002001800a0408cc0040064466e24008006602c900120408a50411114a08220c058c084c114dd5000980b181398229baa00189980fa4916537461626c657377617020706f6f6c206f7574707574009800802cc074cc11cc120c114dd5181618229baa00e4bd704c06ccc11cc074cc11cc8c8c8c09ccc128c12c00ccc128c12c008cc128c12c004cc128c090c120dd500219825181518241baa004304c304c304c001304b001304a0013045375400e97ae04bd704dd5981618229baa302c3045375401d4c103d8798000404914a082122941042410501041050464106083041820a0943047001411460866ea800a07e820207f03f81fc0fd0481812180f18209baa001375c608860826ea8008c10cdd6180e98201baa0318a9981f24812a3c65787065637465643e2054686520666565206d616e61676572206d75737420686176652076616c7565001640f460846086608660866086608660866086607e6ea80060748052074820207503a81d40e90441820800a07e303d375400303840e903881c40e20708210c07cc064c0f0dd51811981e1baa00581b207a375a0030354100607a00281d8c0e4dd5000c0cd03640ce067033819a07c33006303b303837540026eacc064c0e0dd5014c0bd039181d000a07098009bac30393036375404f301d3036375407b4c103d879800040211533034491203c65787065637465643e20446174756d206d757374206265204e6f446174756d001640cc444b300130243037375400713259800800c00a264b3001001801c00e007003899912cc00400600b13259800800c4c9660020030078992cc004006264b3001001804c4c96600200313259800800c02e264b30010018992cc00400601b13259800800c4c966002608c003159800980d9822800c03e26644b3001001808c4c966002003132598009825000c566002603e6092003013899912cc00400602b13259800800c4c9660020030178992cc00400603101880c44cc896600200301a8992cc00400603701b80dc4cc896600200301d8992cc00400603d01e80f407a264b3001305a0038acc004c108c154dd500d44c9660020030208992cc004006043021810c08626644b3001001811c4c9660020030248124092049132598009830001c6600203d1980080e466002035132598009824800c4c9660020030278992cc00400605102881440a2264b3001306400381540a50611bae001419060c200282f8c174dd5008c566002609e003159800982e9baa011813c09905e409905a20b4305b375402102540a102540a102540a102541746eb8005060182e800a0b6375c00260b800482e8c168005058182b1baa01a80fa0a680fa0ae375c00282d0c15c0050551bad001305600280da0ae305400141486eb4004c14c00a03082a0c14400504f1828801405a02d01680b20a4304f001413460786092002609c006823a0268258dd5000c04a025012809209c304b00141246070608a0026094006821a01e8238dd5000c03a01d00e807209430470014114608e00500c80640320188240c1140050431822801402a01500a805208c30430014104608600500880440220108220c10400503f1820801401a00d0068032084303f00140f46eb8004c0f800903f181e000a0743038375400700140d4444b300130233036375400713259800800c00a264b3001001801c00e0071332259800800c016264b3001001803401a00d132598009820801c02200e81f0dd6800c019041181f000a078375a002607a00500340f8607600281c8c0dcdd5001c005034456600260440171323322598009814981b1baa001899912cc004c0f4006264b30013026303937540031323322598009820800c4c8cc004004dd61820801112cc004006264b3001302c303f3754003132324a2b30013233001001300d3756604860846ea80cc896600266e3cdd71823000801c528c4cc008008c11c00504045268b207c375c608660806ea80062c81e8c8cc004004dd6181398201baa0072259800800c530103d87a80008992cc0066002603a0034a14a281fa2003133003003304600240fc64b30013371e6eb8c11400402e2604266088608a608c00297ae08a6103d87a800040fc6eb0c11000504244c8c8cc8966002608e00713300600630470058b2088375c60880026eb8c110008c110004dd61821000a0808b207c375a607c002607e00260746ea80062c81b8c070c058c0e4dd51810181c9baa303c0018b2074375c6074606e6ea800660026eb0c078c0dcdd50144c050c0dcdd501f530103d879800040251640d060020026070606a6ea8c0e0c0d4dd5198041bac30383035375404c03e44b30010018a5eb82266070606a607200266004004607400281ba2b300130203033375403b19800981b981a1baa01d91192cc004c08c00626464b3001303d00280245903a1bae303b001303737540071598009814800c4c8c966002607a0050048b2074375c6076002606e6ea800e2c81a1034181a9baa002912cc004c088c0d4dd500144c8c8cc8966002607c0070058b2076375c60760026eb8c0ec008c0ec004c0d8dd5001459033489660026044606a6ea800a264646644b3001303e003802c5903b1bad303b001375a60760046076002606c6ea800a2c819922223233001005132598009813000c66002446607c66ec0dd48011ba80014bd6f7b630488cc88c074cc100dd419b82375a60820046eb4c104004cc100dd419b82375a608260840046eb4c104c1080052f5c060786ea8008c0f0dd5000c88cc0840088cdd79820181e9baa3040303d37546048607a6ea800400a4607c607e607e607e607e607e607e003232337066eb4c0fc004dd6981f9820000981d9baa0019181f181f981f981f981f981f800c8966002605060766ea800a260246607c607e60786ea80092f5c1130123303e374e6607c98011150496e6469676f537461626c6573776170003303e0014bd7025eb810394a600200348900a44100408598009bac303d303a37540573021303a37540834c0103d879800040309111111114c004888966002606600310048991919800800803112cc00400626609866ec0dd48031ba60034bd6f7b63044c8cc896600266e4402400a2b30013371e0120051325980099baf4c101a000374c003100289982819bb037520146e9800400904b19198008009bab304e0042259800800c4cc144cdd81ba900a375001297adef6c6089919912cc004cdc8806801456600266e3c03400a264b30013370e002606601b100289982a99bb0375201c6ea0cdc000080680120a0375a60a4007133054337606ea4034dd4006002209e89982a00199802802800a09e375c609e00260a800460a4002828226609e66ec0dd48049ba6006004412913304f0033300500500141286eb8c128004c13c008c13400504b19806801000a0889112cc004c0c8006297adef6c6089982419bb037520066e98cc0300080052f5bded8c0821a4464b300130383045375400314c103d87a8000898129982419805801982498231baa0014bd7020863233225980099b88002480022604e66094604e660946ea0c0a0004cc128dd4181400125eb812f5c1159800981600144c09ccc128c09ccc128dd4000998251ba80024bd7025eb82298103d87a800041148228dd698248009bad3049304a00130453754003225980099b89001480022900044c01ccc028c0500040090422444464b300100681fc4c966002609a00f15980099baf304c30493754609860926ea8c0c0c124dd5000981099825981298249baa0504bd7044c96600266e1d201030493754003132598009827800c4cc8966002607e60986ea8006264b30013052001899192cc004c0f0c13cdd500144c8c8c8c8c8c8c8c8c8c8ca60026eb8c1780066eb8c17802e60bc013305e008982f003cc96600260b80031598009818982d800c5a2609c60b600282ca2c82e8dd5182f0034c96600260b80031598009818982d800c5a2609c60b600282ca2c82e8dd5182f002cc1780126eb4c17800e6eb4c1780092222222222598009834805c4cc0bcc1a00504cc0b80204cc0b801c4cc0b80184c96600260a40031323259800983600140662c8348dd7183500098331baa0048acc004c1600062b3001306637540090178b20ce8b20c6418c60c86ea800e2c833060bc00260ba00260b800260b600260b400260b200260b000260ae00260ac00260aa00260a06ea800a2c82684c8c8c8c8c8c8c8cc896600266064921274e6f7420656e6f75676820636f6c6c61746572616c20617373657420696e2074686520706f6f6c0033712607000330013756607e60b06ea8c0fcc160dd50084dd7182d982c1baa303f30583754015375c607e60b06ea8c0fcc160dd5005207c8acc004cc0c92411957726f6e67206d696e7465642f6275726e65642076616c7565003375e6e9a60026eb8c16cc160dd502fcdd7182d982c1baa02499b80337026eb4c16c010dd6982d8030012028303a305837540931598009981924811c57726f6e672061646465642f72656465656d656420746f20706f6f6c009800982d9bac30353058375409330303305a305b30583754607e60b06ea80412f5c1303530583754607e60b06ea804330013756607e60b06ea8c0fcc160dd50084dd7182d982c1baa303f30583754015375c607e60b06ea8c0fcc160dd500540050155300103d8798000409513303249011b57726f6e672070616964206665657320746f2074726561737572790098009bac305b305837540933758606a60b06ea81266eacc0e4c160dd5024cdd7181d182c1baa05f9982d181b9982d182d982c1baa05f3305a305b3058375401497ae03305a375066e00008dd6982d982e001a5eb8260b660b06ea8041222222323298009bad30630019bad3063306400198318012444b30013047003899192cc00400626530013044001cc00660026eb8c1a4c198dd50024dd7182698331baa0048032044a4500a44100802a046981e1983418229983426103d87a8000330680094bd7025eb8122232330010010112259800800c528456600264b300130060018acc004cdd7982498361baa0010048acc00660026eacc14cc1b0dd5000c016980103d87a800040f1130473048306c375400314a0834a2941069452820d2306e0018a518998010011837800a0d041b03044330670024bd70456600260d2003132332259800982a000c56600260d06ea800e0051641a5159800982d000c56600260d06ea800e0051641a5159800982a800c56600260d06ea800e0051641a5159800982b800c56600260d06ea800e0051641a5159800982b000c4c8c8c8ca600260de003375a60de007375a60de0049112cc004c1cc01226607260e400e2b3001305b306e375400713232332259800983b801c0362c83a0dd6983a0009bae30740023074001306f37540071641b11641c0306f001306e001306d0013068375400715980099b87480280062b3001306837540070028b20d28b20ca4194832906520ca4194266ebc004cdd2a4010660d0008660d06ea0018cc1a0dd400299834004a5eb80c194dd500099819983418329baa306800100b8b20cc4198660500180026076660ca6ea40212f5c114a2830060c600264b30015980099b89001480022942294105c44cc18530106d8799f4040ff00330614c1010000330614c10100004bd7044cc184c18800ccc184dd400099830a610100004bd7020b8375a60c260c40048a50415514a082aa29410551bad3059001337026eb4c164014dd6982c801982c800982c000982b800982b000994c0040066602c6eb0c154c148dd5021982a98291baa3055305237546604a6eb0c154c148dd502181e4cc151301010000330544c1010000330544c1010000330544c1010000330544c1010000330544c101000033054374e60ac6eb0c0bcc148dd5021a5eb810011112cc00400a200319800801cc16000a66453001305a0019bad30590019bab303d30563754607a60ac6ea800a6072606660ac6ea8c0f4c158dd5001244446464653001375a60c0003375860c060c2003375a60c0015375a60c000f375a60c0007375a60c0004911111198158050992cc004c1a0006264653001375c60d2003375a60d260d4003375c60d20049112cc0056600266e3cdd7183618349baa01b375c60d860d26ea8042266ebcc140c1a4dd500d982818349baa0108a504199198009836005cc1b402e6074605860d26ea804122259800acc0056600266e3c010dd7183798361baa3053306c375402713371e00c6eb8c14cc1b0dd5182998361baa0138a5041a514a3159800acc004cdc78021bae306f306c37540e713371e00c6eb8c1bcc1b0dd5009c52820d28a508a9983524811457726f6e6720737570706c696564206173736574001641a4834a26644646644b3001306330703754606460e26ea808e2b3001337126eb4c164c1c4dd5011805456600330010049119b8900200180320948acc0066002011304933073304d3071375403097ae099818982998389baa01830743071375403b9800981519b813030375660b060e26ea8c160c1c4dd500e9bad303230713754031375c60e860e26ea81e26eb8c1d0c1c4dd500c400902e5300103d87a800040f9133073375066e00048004cc1ccdd400d198399ba801133073375066e00040008cc1ccdd419b8000f003330733750028660e66e9c01d2f5c1153306f4913b3c65787065637465643e204d696e74656420616d6f756e742077726f6e676c792073656e7420746f206f726465722064657374696e6174696f6e2e001641b9153306f491383c65787065637465643e20506f6f6c206d696e74696e67206665652065786365656473206f72646572206d61782066656520726174696f2e001641b906941b9153306f4901223c65787065637465643e204d696e74696e67206973206e6f7420656e61626c65642e001641b866e0400c0056600203f1008899192cc004c174c1c0dd5000c56600330013370e606660e860e26ea800401694294506e4402a200483722c8370cc0acc0fc004084c0c4cc0d0c0f800c08106c198140008012cc004072200b13259800982c98361baa00189817983818369baa0018b20d433027303b00501d41a4607a609060d86ea807a26464646464b3001306330703754606860e26ea808e2b3001337126eb4c148c1c4dd5011805456600330010059119b8900200180320948acc0066002011304933073304d3071375403097ae099818982998389baa01830743071375403b9800981519b813030375660b060e26ea8c160c1c4dd500e9bad303230713754031375c60e860e26ea8c160c1c4dd5011cdd7182c18389baa30583071375404700240b94c103d87a800040f91330733750024660e66ea0cdc000d000998399ba833700022004660e66ea0040cc1ccdd4007998399ba833700028008660e66e9c01d2f5c1153306f4913d3c65787065637465643e2052656465656d656420616d6f756e742077726f6e676c792073656e7420746f206f726465722064657374696e6174696f6e2e001641b9153306f4913b3c65787065637465643e20506f6f6c20726564656d7074696f6e206665652065786365656473206f72646572206d61782066656520726174696f2e001641b906941b9153306f4901243c65787065637465643e2052656465656d696e67206973206e6f7420656e61626c65642e001641b8b3001020880144c96600260ba60e06ea8006264b3001980099b873034330373041001023003a50a5141bd10048800a0de30333074307137540031641b866056607e00204283696600203f1001898189981a181f00081020d83370200e0026604e00200c607a609c60d86ea807906922a660ce9212b3c65787065637465643e2057726f6e67206f72646572203c3e20706f6f6c20636f6d62696e6174696f6e2e001641983069001375860ce0031641946466002002646600200201a44b30010018a5eb7bdb1822646644b3001337229101000028acc004cdc7a441000028800c401106644cc1ac00ccc0140140050661bae3066001306b0023069001419c44b30010018a5eb82264664466446600400400244b30010018801c4c8cc1b4dd3998369ba90053306d306a0013306d306b0014bd701980180198378011836800a0d6375660d00066eb8c194004cc00c00cc1a8008c1a00050660c180004c17c004c17801060ae00460b000280190551815999119912cc004cdc4001000c5300103d87980008acc004cdc40008014530103d87b80008a6103d87a800041448288cdc11bad3055002375a60aa60ac00266e08dd6982a8009bad305530560023050375400260a06ea8c07d20023020302c304f375400260a200316413c609a6ea80062c8250dd698270009817181418259baa3032304b375400716413060946ea80062c8238cc05cc130c124dd50009bab302a3049375407515330474911a3c65787065637465643e204d697865642076657273696f6e732e001641190404128609600c8248a600291100a44100800a00822b3001302c0018991991192cc004cdd79820981f1baa00102889919912cc00400a2b3001302d3040375400515980098209baa00289980da4811057726f6e67206d61696e206f72646572003375e608860826ea8c110c104dd5181418209baa00300181d208481d207c81d40ea07503a41186601a6084607e6ea8004dd59810181f9baa0303042303f37546084607e6ea8c098c0fcdd5001198019bac3041303e375405e6eb4c104c10800a2a66078921413c65787065637465643e205468652070726f766964656420696e70757420696e64657820636f72726573706f6e647320746f20746865206f776e20696e7075742e001640ec660046eb0c100c0f4dd50171bad30400013001001303b375405e444b300130120018cc00400e60826082005337000029001a0068acc004cdc4a400400319800801cc10400a66e000052001400d1598009814800c4c10000a2a66076921146578706563745f61743a206e6f7420666f756e64001640e881d103a4566002604e0031330144911854782069736e2774207369676e6564206279206f776e6572003300e02b375c602e60746ea801a2a6607092010452646d72001640dc81b9037181c1baa02d22598009813181c9baa0028991919191919194c004c1100066eb8c11001e6eb8c110016608800930440039bad3044002488888966002609600f133011304a00c13259800981a18239baa00489919192cc004c13c00a26602c609c006264b300130380018992cc004c14400626464b3001303b0018992cc004c15000626603660a6002013164144609e6ea800a2b3001304100189919194c004dd6982a800cdd6982a801cdd6982a8012444b300130590048074590560c154004c150004c13cdd500145904c2098304d375400260a000316413860986ea800a2b3001303e0018acc004c130dd500140162c826a2c824904918251baa0018b2098304d001304d0013048375400916411426644b30013035001899192cc004c13c00a009164130609a00260926ea80122b3001303b0018acc004c124dd5002400a2c82522c823104609980800300718231baa0028b209018220009821800982100098208009820000981f800981d1baa0028b206e459031206240c444444b3001330160040058acc004cdd7980a981c1baa0050038acc00660026eacc07cc0e0dd5002c00a002804226026602860706ea801629410354528206a8a5040d4180c803180c980d00322c8068601e00260146ea804229344d9590071"
|
|
10455
|
+
cborHex: "59240d59240a010100229800aba4aba2aba1aba0aab9faab9eaab9dab9cab9a488888888a60022a660049201343c65787065637465643e2054686520646174756d2069732074686520737461626c657377617020706f6f6c20636f6e74656e742e00168a99801249233c65787065637465643e204d7573742068617665206120706f6f6c20636f6e74656e7400168a99801249333c65787065637465643e2054686520706f6f6c206d75737420686176652074686520636f72726563742072656465656d65722e00168a99801249333c65787065637465643e20546865206d61696e206f72646572206861732074686520636f72726563742072656465656d65722e00168a998012491e3c65787065637465643e204f7264657220697320746f6f20736d616c6c2e00168a998012491d3c65787065637465643e2053696e676c6520706f6f6c20696e7075742e001648888896600264653001300f00198079808000cdc3a4005300f00248889660026004601e6ea800e3300130103754007370e90034dc3a4011370e90024dc3a4001300f37540089111111991192cc004c0140122b30013019375401b0018b20348acc004c02c012264646644b30013021003802c5901e1bad301e001375a603c004603c00260326ea80362b300130060048acc004c064dd5006c0062c80d22b300130080048acc004c064dd5006c0062c80d22b300130070048acc004c064dd5006c0062c80d22c80b1016202c405880b06600246038603a603a603a603a603a603a603a603a0032301c301d00191119199119801001000912cc004006007132325980099b910060018acc004cdc7803000c4dd69810001401501d44cc010010c09000d01d1bae301e0013021001407c64646600200200c44b3001001801c4c8c96600266e440200062b30013371e0100031375660420050054079133004004302500340786eb8c07c004c0880050200a5eb7bdb18052000911919800800801912cc004006297ae0899912cc004c01400a26604000466008008003133004004001406c603e002604000280ea6e21200092cc004c018c060dd5000c4c070c064dd5000c5901648c070c074c074c074c07400646038603a603a603a603a603a603a603a603a603a003370290004dd2a40012598009802980c1baa001891919baf301e301b3754603c60366ea8008004c074c068dd5001448c8cdd7980f180d9baa002001301d301a375400480b246038603a603a0032301c301d301d301d0019baf4c103d87a8000912cc004006200315330180021001405d222332233004337046eb4c080008dd69810181080099b82375a60400026eb4c080c084008c06cdd5001980d9baa0019ba54800a602e6ea80326e9520049b89480112222222222222222222298009119198008009bac3017302f375400644b30010018a508acc004cdc79bae30330010038a51899801001181a000a05a40c52232330010010032259800800c5a264b30013375e606860626ea80040122603060626ea8006266006006606a0048170c0cc0050314888c8cc0540108c008c060c0c4dd5000acc004c06cc0b8dd5000c48c08a60026eacc05cc0c0dd5000cdd7181998181baa0039bae30173030375400680b224602930013756602e60606ea80066eb8c0ccc0c0dd5001cdd7180b98181baa00340588162464b3001301a302d375400313031302e3754003153302c491263c65787065637465643e2044656e6f6d696e61746f722063616e6e6f74206265207a65726f2e001640ac6644b3001301b0018a6103d87a80008acc004cdc4000a40011300e33031300e330313750601e004660626ea0c03c0052f5c097ae089807198189807198189ba800233031375000297ae04bd70205840b06eb4c0c0c0b4dd50009bad3014302d375400322233229800992cc004c078c0c4dd5000c4dd69819181a9bab30353032375400314800102f181a000cdd58014dd7981a181a800c8966002604a60646ea8016266e2400400a2b30013371200200513371200466e0000520809bee028a5040c08181222259800801c566002600400d13300100448002294103244c96600266ebd30101400030350018acc004cc008014dd6981b181c9bab3036001898019ba6303a0048a5040cd15980099801002a4001130030078a5040cc8198c0e000d0360dd3001194c004006009223303400233034374c00297ae04004444b3001002899800a6103d87a80004bd6f7b63044c8cc896600266e452201000028acc004cdc7a44100002899802180a1981b981a801a5eb80006266008980103d87a800000540c9198008034006446600c0046607200a00280310321bae30320013037003303500240cd2300c3302f37500026605e98010101004bd70488c8c8cc00400400c88c96600266ebc010c0c400626064003133003003303600240bc6068002600c6606000497ae048888888c96600260460171323259800acc004c088c0d4dd500fc5284528a0668992cc00400605d13259800981e00144c96600200315980099b8748040c0e0dd5000c4c9660020030348992cc00400606b03581ac4c966002608000713259800800c566002605e60786ea8006264b300100181cc4c9660020031598009821801466002003132598009816181f9baa00189919912cc00400a2b300130353042375400513259800800c102264b30010018acc004c12400a330010018acc004cc07d2401155369676e656420627920666565206d616e6167657200330190360038acc004cc8966002660429201274d696e74696e672066656520726174696f206973206265747765656e205b30252c20313030255d0059800cc005300106d8799f0001ff009119b8900200180120408cc00400a4466e24008006602c900120408a50411113302149012a526564656d7074696f6e2066656520726174696f206973206265747765656e205b30252c20313030255d0059800cc005300106d8799f0001ff009119b89002001800a0408cc0040064466e24008006602c900120408a50411114a08220c058c084c114dd5000980b181398229baa0018acc004cc07d2410a4e6f206d696e74696e67003375e604e608a6ea80d9300101a00089980fa48116537461626c657377617020706f6f6c206f7574707574009800802cc074cc11cc120c114dd5181618229baa00e4bd704c06ccc11cc074cc11cc8c8c8c09ccc128c12c00ccc128c12c008cc128c12c004cc128c090c120dd500219825181518241baa004304c304c304c001304b001304a0013045375400e97ae04bd704dd5981618229baa302c3045375401d4c103d8798000404914a08212294104245282084820a020820a08c820c1060830414128608e0028228c10cdd500140fd04040fe07f03f81fa0903024301e304137540026eb8c110c104dd500118219bac301d30403754063153303e49012a3c65787065637465643e2054686520666565206d616e61676572206d75737420686176652076616c7565001640f460846086608660866086608660866086607e6ea80060748052074820207503a81d40e90441820800a07e303d375400303840e903881c40e20708210c07cc064c0f0dd51811981e1baa00581b207a375a0030354100607a00281d8c0e4dd5000c0cd03640ce067033819a07c33006303b303837540026eacc064c0e0dd5014c0bd039181d000a07098009bac30393036375404f301d3036375407b4c103d879800040211533034491203c65787065637465643e20446174756d206d757374206265204e6f446174756d001640cc444b300130243037375400713259800800c00a264b3001001801c00e007003899912cc00400600b13259800800c4c9660020030078992cc004006264b3001001804c4c96600200313259800800c02e264b30010018992cc00400601b13259800800c4c966002608c003159800980d9822800c03e26644b3001001808c4c966002003132598009825000c566002603e6092003013899912cc00400602b13259800800c4c9660020030178992cc00400603101880c44cc896600200301a8992cc00400603701b80dc4cc896600200301d8992cc00400603d01e80f407a264b3001305a0038acc004c108c154dd500d44c9660020030208992cc004006043021810c08626644b3001001811c4c9660020030248124092049132598009830001c6600203d1980080e466002035132598009824800c4c9660020030278992cc00400605102881440a2264b3001306400381540a50611bae001419060c200282f8c174dd5008c566002609e003159800982e9baa011813c09905e409905a20b4305b375402102540a102540a102540a102541746eb8005060182e800a0b6375c00260b800482e8c168005058182b1baa01a80fa0a680fa0ae375c00282d0c15c0050551bad001305600280da0ae305400141486eb4004c14c00a03082a0c14400504f1828801405a02d01680b20a4304f001413460786092002609c006823a0268258dd5000c04a025012809209c304b00141246070608a0026094006821a01e8238dd5000c03a01d00e807209430470014114608e00500c80640320188240c1140050431822801402a01500a805208c30430014104608600500880440220108220c10400503f1820801401a00d0068032084303f00140f46eb8004c0f800903f181e000a0743038375400700140d4444b300130233036375400713259800800c00a264b3001001801c00e0071332259800800c016264b3001001803401a00d132598009820801c02200e81f0dd6800c019041181f000a078375a002607a00500340f8607600281c8c0dcdd5001c005034456600260440171323322598009814981b1baa001899912cc004c0f4006264b30013026303937540031323322598009820800c4c8cc004004dd61820801112cc004006264b3001302c303f3754003132324a2b30013233001001300d3756604860846ea80cc896600266e3cdd71823000801c528c4cc008008c11c00504045268b207c375c608660806ea80062c81e8c8cc004004dd6181398201baa0072259800800c530103d87a80008992cc0066002603a0034a14a281fa2003133003003304600240fc64b30013371e6eb8c11400402e2604266088608a608c00297ae08a6103d87a800040fc6eb0c11000504244c8c8cc8966002608e00713300600630470058b2088375c60880026eb8c110008c110004dd61821000a0808b207c375a607c002607e00260746ea80062c81b8c070c058c0e4dd51810181c9baa303c0018b2074375c6074606e6ea800660026eb0c078c0dcdd50144c050c0dcdd501f530103d879800040251640d060020026070606a6ea8c0e0c0d4dd5198041bac30383035375404c03e44b30010018a5eb82266070606a607200266004004607400281ba2b300130203033375403b19800981b981a1baa01d91192cc004c08c00626464b3001303d00280245903a1bae303b001303737540071598009814800c4c8c966002607a0050048b2074375c6076002606e6ea800e2c81a1034181a9baa002912cc004c088c0d4dd500144c8c8cc8966002607c0070058b2076375c60760026eb8c0ec008c0ec004c0d8dd5001459033489660026044606a6ea800a264646644b3001303e003802c5903b1bad303b001375a60760046076002606c6ea800a2c819922223233001005132598009813000c66002446607c66ec0dd48011ba80014bd6f7b630488cc88c074cc100dd419b82375a60820046eb4c104004cc100dd419b82375a608260840046eb4c104c1080052f5c060786ea8008c0f0dd5000c88cc0840088cdd79820181e9baa3040303d37546048607a6ea800400a4607c607e607e607e607e607e607e003232337066eb4c0fc004dd6981f9820000981d9baa0019181f181f981f981f981f981f800c8966002605060766ea800a260246607c607e60786ea80092f5c1130123303e374e6607c98011150496e6469676f537461626c6573776170003303e0014bd7025eb810394a600200348900a44100408598009bac303d303a37540573021303a37540834c0103d879800040309111111114c004888966002606600310048991919800800803112cc00400626609866ec0dd48031ba60034bd6f7b63044c8cc896600266e4402400a2b30013371e0120051325980099baf4c101a000374c003100289982819bb037520146e9800400904b19198008009bab304e0042259800800c4cc144cdd81ba900a375001297adef6c6089919912cc004cdc8806801456600266e3c03400a264b30013370e002606601b100289982a99bb0375201c6ea0cdc000080680120a0375a60a4007133054337606ea4034dd4006002209e89982a00199802802800a09e375c609e00260a800460a4002828226609e66ec0dd48049ba6006004412913304f0033300500500141286eb8c128004c13c008c13400504b19806801000a0889112cc004c0c8006297adef6c6089982419bb037520066e98cc0300080052f5bded8c0821a4464b300130383045375400314c103d87a8000898129982419805801982498231baa0014bd7020863233225980099b88002480022604e66094604e660946ea0c0a0004cc128dd4181400125eb812f5c1159800981600144c09ccc128c09ccc128dd4000998251ba80024bd7025eb82298103d87a800041148228dd698248009bad3049304a00130453754003225980099b89001480022900044c01ccc028c0500040090422444464b300100681fc4c966002609a00f15980099baf304c30493754609860926ea8c0c0c124dd5000981099825981298249baa0504bd7044c96600266e1d201030493754003132598009827800c4cc8966002607e60986ea8006264b30013052001899192cc004c0f0c13cdd500144c8c8c8c8c8c8c8c8c8c8ca60026eb8c1780066eb8c17802e60bc013305e008982f003cc96600260b80031598009818982d800c5a2609c60b600282ca2c82e8dd5182f0034c96600260b80031598009818982d800c5a2609c60b600282ca2c82e8dd5182f002cc1780126eb4c17800e6eb4c1780092222222222598009834805c4cc0bcc1a00504cc0b80204cc0b801c4cc0b80184c96600260a40031323259800983600140662c8348dd7183500098331baa0048acc004c1600062b3001306637540090178b20ce8b20c6418c60c86ea800e2c833060bc00260ba00260b800260b600260b400260b200260b000260ae00260ac00260aa00260a06ea800a2c82684c8c8c8c8c8c8c8cc896600266064921274e6f7420656e6f75676820636f6c6c61746572616c20617373657420696e2074686520706f6f6c0033712607000330013756607e60b06ea8c0fcc160dd50084dd7182d982c1baa303f30583754015375c607e60b06ea8c0fcc160dd5005207c8acc004cc0c92411957726f6e67206d696e7465642f6275726e65642076616c7565003375e6e9a60026eb8c16cc160dd502fcdd7182d982c1baa02499b80337026eb4c16c010dd6982d8030012028303a305837540931598009981924811c57726f6e672061646465642f72656465656d656420746f20706f6f6c009800982d9bac30353058375409330303305a305b30583754607e60b06ea80412f5c1303530583754607e60b06ea804330013756607e60b06ea8c0fcc160dd50084dd7182d982c1baa303f30583754015375c607e60b06ea8c0fcc160dd500540050155300103d8798000409513303249011b57726f6e672070616964206665657320746f2074726561737572790098009bac305b305837540933758606a60b06ea81266eacc0e4c160dd5024cdd7181d182c1baa05f9982d181b9982d182d982c1baa05f3305a305b3058375401497ae03305a375066e00008dd6982d982e001a5eb8260b660b06ea8041222222323298009bad30630019bad3063306400198318012444b30013047003899192cc00400626530013044001cc00660026eb8c1a4c198dd50024dd7182698331baa0048032044a4500a44100802a046981e1983418229983426103d87a8000330680094bd7025eb8122232330010010112259800800c528456600264b300130060018acc004cdd7982498361baa0010048acc00660026eacc14cc1b0dd5000c016980103d87a800040f1130473048306c375400314a0834a2941069452820d2306e0018a518998010011837800a0d041b03044330670024bd70456600260d2003132332259800982a000c56600260d06ea800e0051641a5159800982d000c56600260d06ea800e0051641a5159800982a800c56600260d06ea800e0051641a5159800982b800c56600260d06ea800e0051641a5159800982b000c4c8c8c8ca600260de003375a60de007375a60de0049112cc004c1cc01226607260e400e2b3001305b306e375400713232332259800983b801c0362c83a0dd6983a0009bae30740023074001306f37540071641b11641c0306f001306e001306d0013068375400715980099b87480280062b3001306837540070028b20d28b20ca4194832906520ca4194266ebc004cdd2a4010660d0008660d06ea0018cc1a0dd400299834004a5eb80c194dd500099819983418329baa306800100b8b20cc4198660500180026076660ca6ea40212f5c114a2830060c600264b30015980099b89001480022942294105c44cc18530106d8799f4040ff00330614c1010000330614c10100004bd7044cc184c18800ccc184dd400099830a610100004bd7020b8375a60c260c40048a50415514a082aa29410551bad3059001337026eb4c164014dd6982c801982c800982c000982b800982b000994c0040066602c6eb0c154c148dd5021982a98291baa3055305237546604a6eb0c154c148dd502181e4cc151301010000330544c1010000330544c1010000330544c1010000330544c1010000330544c101000033054374e60ac6eb0c0bcc148dd5021a5eb810011112cc00400a200319800801cc16000a66453001305a0019bad30590019bab303d30563754607a60ac6ea800a6072606660ac6ea8c0f4c158dd5001244446464653001375a60c0003375860c060c2003375a60c0015375a60c000f375a60c0007375a60c0004911111198158050992cc004c1a0006264653001375c60d2003375a60d260d4003375c60d20049112cc0056600266e3cdd7183618349baa01b375c60d860d26ea8042266ebcc140c1a4dd500d982818349baa0108a504199198009836005cc1b402e6074605860d26ea804122259800acc0056600266e3c010dd7183798361baa3053306c375402713371e00c6eb8c14cc1b0dd5182998361baa0138a5041a514a3159800acc004cdc78021bae306f306c37540e713371e00c6eb8c1bcc1b0dd5009c52820d28a508a9983524811457726f6e6720737570706c696564206173736574001641a4834a26644646644b3001306330703754606460e26ea808e2b3001337126eb4c164c1c4dd5011805456600330010049119b8900200180320948acc0066002011304933073304d3071375403097ae099818982998389baa01830743071375403b9800981519b813030375660b060e26ea8c160c1c4dd500e9bad303230713754031375c60e860e26ea81e26eb8c1d0c1c4dd500c400902e5300103d87a800040f9133073375066e00048004cc1ccdd400d198399ba801133073375066e00040008cc1ccdd419b8000f003330733750028660e66e9c01d2f5c1153306f4913b3c65787065637465643e204d696e74656420616d6f756e742077726f6e676c792073656e7420746f206f726465722064657374696e6174696f6e2e001641b9153306f491383c65787065637465643e20506f6f6c206d696e74696e67206665652065786365656473206f72646572206d61782066656520726174696f2e001641b906941b9153306f4901223c65787065637465643e204d696e74696e67206973206e6f7420656e61626c65642e001641b866e0400c0056600203f1008899192cc004c174c1c0dd5000c56600330013370e606660e860e26ea800401694294506e4402a200483722c8370cc0acc0fc004084c0c4cc0d0c0f800c08106c198140008012cc004072200b13259800982c98361baa00189817983818369baa0018b20d433027303b00501d41a4607a609060d86ea807a26464646464b3001306330703754606860e26ea808e2b3001337126eb4c148c1c4dd5011805456600330010059119b8900200180320948acc0066002011304933073304d3071375403097ae099818982998389baa01830743071375403b9800981519b813030375660b060e26ea8c160c1c4dd500e9bad303230713754031375c60e860e26ea8c160c1c4dd5011cdd7182c18389baa30583071375404700240b94c103d87a800040f91330733750024660e66ea0cdc000d000998399ba833700022004660e66ea0040cc1ccdd4007998399ba833700028008660e66e9c01d2f5c1153306f4913d3c65787065637465643e2052656465656d656420616d6f756e742077726f6e676c792073656e7420746f206f726465722064657374696e6174696f6e2e001641b9153306f4913b3c65787065637465643e20506f6f6c20726564656d7074696f6e206665652065786365656473206f72646572206d61782066656520726174696f2e001641b906941b9153306f4901243c65787065637465643e2052656465656d696e67206973206e6f7420656e61626c65642e001641b8b3001020880144c96600260ba60e06ea8006264b3001980099b873034330373041001023003a50a5141bd10048800a0de30333074307137540031641b866056607e00204283696600203f1001898189981a181f00081020d83370200e0026604e00200c607a609c60d86ea807906922a660ce9212b3c65787065637465643e2057726f6e67206f72646572203c3e20706f6f6c20636f6d62696e6174696f6e2e001641983069001375860ce0031641946466002002646600200201a44b30010018a5eb7bdb1822646644b3001337229101000028acc004cdc7a441000028800c401106644cc1ac00ccc0140140050661bae3066001306b0023069001419c44b30010018a5eb82264664466446600400400244b30010018801c4c8cc1b4dd3998369ba90053306d306a0013306d306b0014bd701980180198378011836800a0d6375660d00066eb8c194004cc00c00cc1a8008c1a00050660c180004c17c004c17801060ae00460b000280190551815999119912cc004cdc4001000c5300103d87980008acc004cdc40008014530103d87b80008a6103d87a800041448288cdc11bad3055002375a60aa60ac00266e08dd6982a8009bad305530560023050375400260a06ea8c07d20023020302c304f375400260a200316413c609a6ea80062c8250dd698270009817181418259baa3032304b375400716413060946ea80062c8238cc05cc130c124dd50009bab302a3049375407515330474911a3c65787065637465643e204d697865642076657273696f6e732e001641190404128609600c8248a600291100a44100800a00822b3001302c0018991991192cc004cdd79820981f1baa00102889919912cc00400a2b3001302d3040375400515980098209baa00289980da4811057726f6e67206d61696e206f72646572003375e608860826ea8c110c104dd5181418209baa00300181d208481d207c81d40ea07503a41186601a6084607e6ea8004dd59810181f9baa0303042303f37546084607e6ea8c098c0fcdd5001198019bac3041303e375405e6eb4c104c10800a2a66078921413c65787065637465643e205468652070726f766964656420696e70757420696e64657820636f72726573706f6e647320746f20746865206f776e20696e7075742e001640ec660046eb0c100c0f4dd50171bad30400013001001303b375405e444b300130120018cc00400e60826082005337000029001a0068acc004cdc4a400400319800801cc10400a66e000052001400d1598009814800c4c10000a2a66076921146578706563745f61743a206e6f7420666f756e64001640e881d103a4566002604e0031330144911854782069736e2774207369676e6564206279206f776e6572003300e02b375c602e60746ea801a2a6607092010452646d72001640dc81b9037181c1baa02d22598009813181c9baa0028991919191919194c004c1100066eb8c11001e6eb8c110016608800930440039bad3044002488888966002609600f133011304a00c13259800981a18239baa00489919192cc004c13c00a26602c609c006264b300130380018992cc004c14400626464b3001303b0018992cc004c15000626603660a6002013164144609e6ea800a2b3001304100189919194c004dd6982a800cdd6982a801cdd6982a8012444b300130590048074590560c154004c150004c13cdd500145904c2098304d375400260a000316413860986ea800a2b3001303e0018acc004c130dd500140162c826a2c824904918251baa0018b2098304d001304d0013048375400916411426644b30013035001899192cc004c13c00a009164130609a00260926ea80122b3001303b0018acc004c124dd5002400a2c82522c823104609980800300718231baa0028b209018220009821800982100098208009820000981f800981d1baa0028b206e459031206240c444444b3001330160040058acc004cdd7980a981c1baa0050038acc00660026eacc07cc0e0dd5002c00a002804226026602860706ea801629410354528206a8a5040d4180c803180c980d00322c8068601e00260146ea804229344d9590071"
|
|
10459
10456
|
};
|
|
10460
10457
|
|
|
10461
10458
|
// src/contracts/stableswap/scripts.ts
|
|
@@ -11207,7 +11204,7 @@ import {
|
|
|
11207
11204
|
isSameAssetClass as isSameAssetClass5,
|
|
11208
11205
|
matchSingle as matchSingle6
|
|
11209
11206
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
11210
|
-
import { option as O21, array as
|
|
11207
|
+
import { option as O21, array as A16, function as F25 } from "fp-ts";
|
|
11211
11208
|
async function findIAsset(lucid, sysParams, iassetName) {
|
|
11212
11209
|
const iassetUtxos = await lucid.utxosAtWithUnit(
|
|
11213
11210
|
createScriptAddress(
|
|
@@ -11233,7 +11230,7 @@ async function findIAsset(lucid, sysParams, iassetName) {
|
|
|
11233
11230
|
})
|
|
11234
11231
|
)
|
|
11235
11232
|
),
|
|
11236
|
-
|
|
11233
|
+
A16.compact
|
|
11237
11234
|
),
|
|
11238
11235
|
(res) => new Error("Expected a single IAsset UTXO.: " + JSON.stringify(res))
|
|
11239
11236
|
);
|
|
@@ -11263,7 +11260,7 @@ async function findCollateralAsset(lucid, sysParams, iassetName, collateralAsset
|
|
|
11263
11260
|
})
|
|
11264
11261
|
)
|
|
11265
11262
|
),
|
|
11266
|
-
|
|
11263
|
+
A16.compact
|
|
11267
11264
|
),
|
|
11268
11265
|
(res) => new Error(
|
|
11269
11266
|
"Expected a single Collateral Asset UTXO.: " + JSON.stringify(res)
|
|
@@ -11277,7 +11274,7 @@ import {
|
|
|
11277
11274
|
fromText as fromText14,
|
|
11278
11275
|
toHex as toHex19
|
|
11279
11276
|
} from "@lucid-evolution/lucid";
|
|
11280
|
-
import { array as
|
|
11277
|
+
import { array as A17, ord as Ord5, function as F27 } from "fp-ts";
|
|
11281
11278
|
|
|
11282
11279
|
// src/contracts/stableswap/types-new.ts
|
|
11283
11280
|
import {
|
|
@@ -11637,13 +11634,13 @@ function pickValidSatisfiableOrders(lucid, orders, pool, sysParams, psmProcessin
|
|
|
11637
11634
|
});
|
|
11638
11635
|
const { left: mintingOrders, right: redeemingOrdersSortedDesc } = F27.pipe(
|
|
11639
11636
|
validOrders,
|
|
11640
|
-
|
|
11637
|
+
A17.partition((o) => o.orderType === "REDEEMING"),
|
|
11641
11638
|
({ left, right }) => ({
|
|
11642
11639
|
left,
|
|
11643
11640
|
// Sort the redeeming orders descending.
|
|
11644
11641
|
right: F27.pipe(
|
|
11645
11642
|
right,
|
|
11646
|
-
|
|
11643
|
+
A17.sort(
|
|
11647
11644
|
Ord5.contramap(
|
|
11648
11645
|
(o) => o.swapInfo.owedCollateralAsset
|
|
11649
11646
|
)(Ord5.reverse(BigIntOrd))
|
|
@@ -11653,7 +11650,7 @@ function pickValidSatisfiableOrders(lucid, orders, pool, sysParams, psmProcessin
|
|
|
11653
11650
|
);
|
|
11654
11651
|
const totalCollateralDiff = F27.pipe(
|
|
11655
11652
|
validOrders,
|
|
11656
|
-
|
|
11653
|
+
A17.reduce(
|
|
11657
11654
|
0n,
|
|
11658
11655
|
(acc, order) => acc + order.swapInfo.suppliedCollateralAsset - order.swapInfo.owedCollateralAsset
|
|
11659
11656
|
)
|
|
@@ -11663,11 +11660,11 @@ function pickValidSatisfiableOrders(lucid, orders, pool, sysParams, psmProcessin
|
|
|
11663
11660
|
}
|
|
11664
11661
|
const collateralFromMinting = F27.pipe(
|
|
11665
11662
|
mintingOrders,
|
|
11666
|
-
|
|
11663
|
+
A17.reduce(0n, (acc, o) => acc + o.swapInfo.suppliedCollateralAsset)
|
|
11667
11664
|
);
|
|
11668
11665
|
const { selected } = F27.pipe(
|
|
11669
11666
|
redeemingOrdersSortedDesc,
|
|
11670
|
-
|
|
11667
|
+
A17.reduce(
|
|
11671
11668
|
{
|
|
11672
11669
|
intermediateCollateralAmt: psmAvailableLiq + collateralFromMinting,
|
|
11673
11670
|
selected: []
|
|
@@ -11703,8 +11700,7 @@ import {
|
|
|
11703
11700
|
isSameOutRef as isSameOutRef2,
|
|
11704
11701
|
assetClassValueOf as assetClassValueOf13
|
|
11705
11702
|
} from "@3rd-eye-labs/cardano-offchain-common";
|
|
11706
|
-
import { array as
|
|
11707
|
-
import { isEmpty } from "fp-ts/lib/Array";
|
|
11703
|
+
import { array as A18, function as F28 } from "fp-ts";
|
|
11708
11704
|
async function createStableswapOrder(iasset, collateralAsset, amount, minting, poolDatum, params, lucid, destinationAddress, destinationInlineDatum, maxExecutionFee = BASE_MAX_EXECUTION_FEE, additionalLovelaces = 0n, maxFeeRatio) {
|
|
11709
11705
|
const myAddress = await lucid.wallet().address();
|
|
11710
11706
|
const pkh = paymentCredentialOf3(myAddress);
|
|
@@ -11792,7 +11788,7 @@ async function batchProcessStableswapOrders(stableswapOrderOrefs, stableswapPool
|
|
|
11792
11788
|
]),
|
|
11793
11789
|
(_) => new Error("Expected a single iasset token policy Ref Script UTXO")
|
|
11794
11790
|
);
|
|
11795
|
-
if (isEmpty(stableswapOrderOrefs)) {
|
|
11791
|
+
if (A18.isEmpty(stableswapOrderOrefs)) {
|
|
11796
11792
|
throw new Error("At least one order must be provided.");
|
|
11797
11793
|
}
|
|
11798
11794
|
const stableswapOrderUtxos = await lucid.utxosByOutRef(stableswapOrderOrefs);
|
|
@@ -11841,7 +11837,7 @@ async function batchProcessStableswapOrders(stableswapOrderOrefs, stableswapPool
|
|
|
11841
11837
|
);
|
|
11842
11838
|
const totalSwapInfo = F28.pipe(
|
|
11843
11839
|
ordersInfo,
|
|
11844
|
-
|
|
11840
|
+
A18.reduce(
|
|
11845
11841
|
{
|
|
11846
11842
|
suppliedCollateralAsset: 0n,
|
|
11847
11843
|
suppliedIasset: 0n,
|
|
@@ -11897,7 +11893,7 @@ async function batchProcessStableswapOrders(stableswapOrderOrefs, stableswapPool
|
|
|
11897
11893
|
}
|
|
11898
11894
|
F28.pipe(
|
|
11899
11895
|
ordersInfo,
|
|
11900
|
-
|
|
11896
|
+
A18.reduce(tx, (acc, orderInfo) => {
|
|
11901
11897
|
return acc.collectFrom(
|
|
11902
11898
|
[orderInfo.order.utxo],
|
|
11903
11899
|
isSameOutRef2(orderInfo.order.utxo, mainOrderUtxo) ? serialiseStableswapOrderRedeemer("BatchProcessStableswapOrders") : {
|