@indigo-labs/indigo-sdk
Version:
Indigo SDK for interacting with Indigo endpoints via lucid-evolution
1,012 lines (985 loc) • 679 kB
JavaScript
// src/contracts/cdp/transactions.ts
import {
addAssets as addAssets6,
credentialToRewardAddress as credentialToRewardAddress2,
Data as Data20,
fromHex as fromHex7,
getInputIndices as getInputIndices3,
scriptHashToCredential as scriptHashToCredential3,
slotToUnixTime as slotToUnixTime5,
toHex as toHex7
} from "@lucid-evolution/lucid";
// src/types/system-params.ts
import {
fromHex,
fromText,
toHex,
toText
} from "@lucid-evolution/lucid";
// src/contracts/pyth-feed/types.ts
import { TSchema as TSchema2, Data, Schema } from "@evolution-sdk/evolution";
// src/types/evolution-schema-options.ts
var DEFAULT_SCHEMA_OPTIONS = {
mode: "custom",
useIndefiniteArrays: true,
// This is important to match aiken's Map encoding.
useIndefiniteMaps: false,
useDefiniteForEmpty: true,
sortMapKeys: false,
useMinimalEncoding: true,
mapsAsObjects: false,
encodeMapAsPairs: false
};
// src/types/rational.ts
import { TSchema } from "@evolution-sdk/evolution";
// src/utils/bigint-utils.ts
import { array as A } from "fp-ts";
function divideOnChainCompatible(a, b) {
const res = a / b;
return res + (res < 0n ? -1n : 0n);
}
function bigintMax(a, b) {
return a > b ? a : b;
}
function bigintMin(a, b) {
return a < b ? a : b;
}
function sum(arr) {
return A.reduce(0n, (acc, val) => acc + val)(arr);
}
function fromDecimal(val) {
return BigInt(val.toString());
}
function zeroNegatives(a) {
return bigintMax(0n, a);
}
var BigIntOrd = {
equals: (x, y) => x === y,
compare: (first, second) => first < second ? -1 : first > second ? 1 : 0
};
// src/types/rational.ts
var RationalSchema = TSchema.Struct({
numerator: TSchema.Integer,
denominator: TSchema.Integer
});
var rationalZero = { numerator: 0n, denominator: 1n };
function rationalFromInt(a) {
return { numerator: a, denominator: 1n };
}
function rationalFloor(a) {
return divideOnChainCompatible(a.numerator, a.denominator);
}
function rationalCeil(a) {
const intDiv = a.numerator / a.denominator;
return a.numerator % a.denominator > 0n ? intDiv + 1n : intDiv;
}
function rationalNegate(a) {
return { numerator: -a.numerator, denominator: a.denominator };
}
function rationalAdd(a, b) {
return {
numerator: a.numerator * b.denominator + b.numerator * a.denominator,
denominator: a.denominator * b.denominator
};
}
function rationalSub(a, b) {
return {
numerator: a.numerator * b.denominator - b.numerator * a.denominator,
denominator: a.denominator * b.denominator
};
}
function rationalMul(a, b) {
return {
numerator: a.numerator * b.numerator,
denominator: a.denominator * b.denominator
};
}
function rationalDiv(a, b) {
if (b.numerator === 0n) throw new Error("Cannot divide by zero.");
return {
numerator: a.numerator * b.denominator,
denominator: a.denominator * b.numerator
};
}
function rationalToFloat(a) {
return Number(a.numerator) / Number(a.denominator);
}
// src/contracts/pyth-feed/types.ts
var PythConfigurationSchema = TSchema2.Struct({
priceFeedId: TSchema2.Integer
});
var OpaqueData = Schema.typeSchema(Data.DataSchema);
var DerivedPythPriceSchema = TSchema2.Union(
TSchema2.Struct(
{
Value: TSchema2.Struct(
{ configuration: PythConfigurationSchema },
{ flatFields: true }
)
},
{ flatInUnion: true }
),
TSchema2.Struct(
{
Inverse: TSchema2.Struct({ value: OpaqueData }, { flatFields: true })
},
{ flatInUnion: true }
),
TSchema2.Struct(
{
Divide: TSchema2.Struct(
{ x: OpaqueData, y: OpaqueData },
{ flatFields: true }
)
},
{ flatInUnion: true }
)
);
function fromDataDerivedPythPrice(data) {
return Data.withSchema(DerivedPythPriceSchema).fromCBORHex(
Data.toCBORHex(data)
);
}
function toDataDerivedPythPrice(derivedPythPrice) {
return Data.withSchema(DerivedPythPriceSchema).toData(derivedPythPrice);
}
var PythFeedParamsSchema = TSchema2.Struct({
config: DerivedPythPriceSchema,
pythStatePolicyId: TSchema2.ByteArray
});
function serialisePythFeedParams(params) {
return Data.withSchema(PythFeedParamsSchema).toData(params);
}
var PythFeedRedeemerSchema = TSchema2.Struct(
{
price: RationalSchema,
auxiliaryData: OpaqueData
},
{ flatInUnion: true }
);
function serialisePythFeedRedeemer(r) {
return Data.withSchema(
PythFeedRedeemerSchema,
DEFAULT_SCHEMA_OPTIONS
).toCBORHex(r);
}
var AikenIntervalIntervalBoundType = TSchema2.Union(
TSchema2.TaggedStruct("NegativeInfinity", {}, { flatInUnion: true }),
TSchema2.TaggedStruct(
"Finite",
{ finite: TSchema2.Integer },
{ flatInUnion: true }
),
TSchema2.TaggedStruct("PositiveInfinity", {}, { flatInUnion: true })
);
var AikenIntervalIntervalBound = TSchema2.Struct({
bound_type: AikenIntervalIntervalBoundType,
is_inclusive: TSchema2.Boolean
});
var CardanoTransactionValidityRange = TSchema2.Struct({
lower_bound: AikenIntervalIntervalBound,
upper_bound: AikenIntervalIntervalBound
});
var PythStateDatumSchema = TSchema2.Struct(
{
governance: TSchema2.Struct(
{
wormhole: TSchema2.ByteArray,
emitterChain: TSchema2.Integer,
emitterAddress: TSchema2.ByteArray,
seenSequence: TSchema2.Integer
},
{ flatInUnion: true }
),
trustedSigners: TSchema2.Map(
TSchema2.ByteArray,
CardanoTransactionValidityRange
),
deprecatedWithdrawScripts: TSchema2.Map(
CardanoTransactionValidityRange,
TSchema2.ByteArray
),
withdraw_script: TSchema2.ByteArray
},
{ flatInUnion: true }
);
function serialisePythStateDatum(r) {
return Data.withSchema(
PythStateDatumSchema,
DEFAULT_SCHEMA_OPTIONS
).toCBORHex(r);
}
function parsePythStateDatum(datum) {
return Data.withSchema(
PythStateDatumSchema,
DEFAULT_SCHEMA_OPTIONS
).fromCBORHex(datum);
}
var PythUpdatesRedeemerSchema = TSchema2.Array(TSchema2.ByteArray);
function serialisePythUpdatesRedeemer(r) {
return Data.withSchema(
PythUpdatesRedeemerSchema,
DEFAULT_SCHEMA_OPTIONS
).toCBORHex(r);
}
// src/types/system-params.ts
import { match } from "ts-pattern";
import { P } from "ts-pattern";
function fromSysParamsDerivedPythPrice(cfg) {
return match(cfg).returnType().with({ tag: "value", val: P.select() }, (val) => {
return {
Value: {
configuration: {
priceFeedId: BigInt(val.priceFeedId)
}
}
};
}).with({ tag: "inverse", val: P.select() }, (val) => {
return {
Inverse: {
value: toDataDerivedPythPrice(fromSysParamsDerivedPythPrice(val))
}
};
}).with({ tag: "divide", val: P.select() }, (val) => {
return {
Divide: {
x: toDataDerivedPythPrice(fromSysParamsDerivedPythPrice(val[0])),
y: toDataDerivedPythPrice(fromSysParamsDerivedPythPrice(val[1]))
}
};
}).exhaustive();
}
function fromSysParamsPythFeedParams(params) {
return {
config: fromSysParamsDerivedPythPrice(params.config),
pythStatePolicyId: fromHex(params.pythStatePolicyId.unCurrencySymbol)
};
}
function getPythFeedConfig(cfg, iasset, collateralAsset) {
const res = cfg.pythFeeds[`${toText(toHex(iasset))}/${toHex(collateralAsset.currencySymbol)}.${toHex(collateralAsset.tokenName)}`];
if (res == null)
throw new Error("No Pyth config known for such assets combination");
return res;
}
function toSystemParamsAsset(asset) {
return [
{ unCurrencySymbol: toHex(asset.currencySymbol) },
{ unTokenName: toText(toHex(asset.tokenName)) }
];
}
function fromSystemParamsAsset(asset) {
return {
currencySymbol: fromHex(asset[0].unCurrencySymbol),
tokenName: fromHex(fromText(asset[1].unTokenName))
};
}
function fromSystemParamsAssetLucid(asset) {
return {
currencySymbol: asset[0].unCurrencySymbol,
tokenName: fromText(asset[1].unTokenName)
};
}
function fromSystemParamsScriptRef(ref) {
return { outputIndex: ref.input.index, txHash: ref.input.transactionId };
}
function fromSysParamsCredential(cred) {
if (cred.contents.tag === "PublicKeyCredential") {
return { type: "Key", hash: cred.contents.contents };
}
return { type: "Script", hash: cred.contents.contents };
}
function fromSysParamsStakeCredential(cred) {
return {
Inline: [
cred.contents.tag === "PublicKeyCredential" ? {
PublicKeyCredential: [cred.contents.contents]
} : {
ScriptCredential: [cred.contents.contents]
}
]
};
}
// src/utils/lucid-utils.ts
import {
addAssets,
calculateMinLovelaceFromUTxO,
credentialToAddress,
Data as Data2,
paymentCredentialOf,
scriptHashToCredential,
stakeCredentialOf
} from "@lucid-evolution/lucid";
import { match as match2, P as P2 } from "ts-pattern";
function getInlineDatumOrThrow(utxo) {
if (utxo.datum != null) {
return utxo.datum;
}
throw new Error(
"Expected an inline datum for OutRef: " + JSON.stringify({
txHash: utxo.txHash,
outputIndex: utxo.outputIndex
})
);
}
async function addrDetails(lucid) {
const addr = await lucid.wallet().address();
let stakeCredential = void 0;
try {
stakeCredential = stakeCredentialOf(addr);
} catch (_) {
}
return [paymentCredentialOf(addr), stakeCredential];
}
function createScriptAddress(network, scriptHash, stakeCredential) {
return credentialToAddress(
network,
scriptHashToCredential(scriptHash),
stakeCredential
);
}
async function scriptRef(ref, lucid) {
const utxos = await lucid.utxosByOutRef([
{ txHash: ref.input.transactionId, outputIndex: ref.input.index }
]);
if (utxos.length === 0) throw Error("Unable to locate script ref.");
return utxos[0];
}
async function submitTx(lucid, tx) {
const txHash = await tx.complete().then((t) => t.sign.withWallet().complete()).then((t) => t.submit());
await lucid.awaitTx(txHash);
}
function balance(utxos) {
return utxos.reduce((acc, utxo) => addAssets(acc, utxo.assets), {});
}
function estimateUtxoMinLovelace(protocolParameters, destinationAddr, assets, destinationDatum = void 0, scriptRef2 = void 0) {
return calculateMinLovelaceFromUTxO(protocolParameters.coinsPerUtxoByte, {
address: destinationAddr,
datumHash: match2(destinationDatum).with({ kind: "hash", value: P2.select() }, (dHash) => dHash).otherwise(() => null),
datum: match2(destinationDatum).with({ kind: "inline", value: P2.select() }, (data) => Data2.to(data)).otherwise(() => null),
assets,
// Use dummy tx hash and out idx
txHash: "0000000000000000000000000000000000000000000000000000000000000000",
outputIndex: 0,
scriptRef: scriptRef2 ?? null
});
}
// src/utils/utils.ts
import * as fs from "fs";
import { match as match3, P as P3 } from "ts-pattern";
function matchSingle(xs, mkErr) {
return match3(xs).with([P3.select()], (res) => res).otherwise(() => {
throw mkErr(xs);
});
}
function loadSystemParamsFromFile(file) {
return JSON.parse(fs.readFileSync(file, "utf-8"));
}
function loadSystemParamsFromUrl(url) {
return fetch(url).then((res) => res.json()).then((data) => data);
}
// src/utils/time-helpers.ts
var ONE_SECOND = 1e3;
var ONE_HOUR = 3600000n;
var ONE_DAY = 86400000n;
var ONE_YEAR = 31536000000n;
// src/types/on-chain-decimal.ts
import { TSchema as TSchema3 } from "@evolution-sdk/evolution";
var OCD_DECIMAL_UNIT = 1000000n;
var OnChainDecimalSchema = TSchema3.Struct({
getOnChainInt: TSchema3.Integer
});
function ocdDiv(a, b) {
return {
getOnChainInt: divideOnChainCompatible(
a.getOnChainInt * OCD_DECIMAL_UNIT,
b.getOnChainInt
)
};
}
// src/contracts/interest-oracle/helpers.ts
var unitaryInterestPrecision = 1000000000000000000n;
function calculateUnitaryInterest(timePeriod, interestRate) {
return timePeriod * interestRate * unitaryInterestPrecision / ONE_YEAR / OCD_DECIMAL_UNIT;
}
function calculateUnitaryInterestSinceOracleLastUpdated(now, oracleDatum) {
return calculateUnitaryInterest(
now - oracleDatum.lastUpdated,
oracleDatum.interestRate.getOnChainInt
);
}
function calculateAccruedInterest(now, unitaryInterestSnapshot, mintedAmount, interestLastSettled, interestOracleDatum) {
if (interestOracleDatum.unitaryInterest >= unitaryInterestSnapshot) {
const interestFromPreviousRates = (interestOracleDatum.unitaryInterest - unitaryInterestSnapshot) * mintedAmount / unitaryInterestPrecision;
const lastRateInterest = (now - interestOracleDatum.lastUpdated) * interestOracleDatum.interestRate.getOnChainInt * mintedAmount / ONE_YEAR / OCD_DECIMAL_UNIT;
return interestFromPreviousRates + lastRateInterest;
} else {
return (now - interestLastSettled) * interestOracleDatum.interestRate.getOnChainInt * mintedAmount / ONE_YEAR / OCD_DECIMAL_UNIT;
}
}
// src/contracts/price-oracle/helpers.ts
import {
slotToUnixTime,
unixTimeToSlot
} from "@lucid-evolution/lucid";
function oracleExpirationAwareValidity(currentSlot, biasTime, oracleExpiration, network) {
const validateFrom = slotToUnixTime(network, currentSlot - 1);
const defaultValidateTo = validateFrom + biasTime;
const cappedValidateTo = slotToUnixTime(
network,
unixTimeToSlot(network, oracleExpiration) - 1
);
const isOracleActuallyExpired = cappedValidateTo <= validateFrom;
return {
validFrom: validateFrom,
validTo: isOracleActuallyExpired ? defaultValidateTo : Math.min(defaultValidateTo, cappedValidateTo)
};
}
// src/contracts/cdp/transactions.ts
import { match as match13, P as P13 } from "ts-pattern";
// src/contracts/cdp/helpers.ts
import { slotToUnixTime as slotToUnixTime2 } from "@lucid-evolution/lucid";
import { match as match4, P as P4 } from "ts-pattern";
// src/utils/indigo-helpers.ts
function calculateFeeFromRatio(feeRatio, amount) {
if (amount < 0) {
return 0n;
}
return rationalFloor(rationalMul(rationalFromInt(amount), feeRatio));
}
// src/contracts/cdp/helpers.ts
import { assetClassValueOf } from "@3rd-eye-labs/cardano-offchain-common";
function iassetValueOfCollateral(collateralAmt, oraclePrice) {
return rationalFloor(
rationalDiv(rationalFromInt(collateralAmt), oraclePrice)
);
}
function cdpCollateralRatioPercentage(currentSlot, iassetPrice, cdpUtxo, cdpContent, interestOracleDatum, network) {
const currentTime = BigInt(slotToUnixTime2(network, currentSlot));
return match4(cdpContent.cdpFees).with({ ActiveCDPInterestTracking: P4.select() }, (interest) => {
const interestAmt = calculateAccruedInterest(
currentTime,
interest.unitaryInterestSnapshot,
cdpContent.mintedAmt,
interest.lastSettled,
interestOracleDatum
);
const collateral = assetClassValueOf(
cdpUtxo.assets,
cdpContent.collateralAsset
);
const ratio = rationalDiv(
rationalFromInt(collateral),
rationalMul(
rationalFromInt(cdpContent.mintedAmt + interestAmt),
iassetPrice
)
);
return Number(ratio.numerator * 100n / ratio.denominator);
}).with({ FrozenCDPAccumulatedFees: P4.any }, () => 0).exhaustive();
}
function calculateIAssetRedemptionAmt(collateralAmt, mintedAmt, price, rmr) {
return rationalCeil(
rationalDiv(
rationalAdd(
rationalNegate(rationalDiv(rationalFromInt(collateralAmt), price)),
rationalMul(rmr, rationalFromInt(mintedAmt))
),
rationalSub(rmr, rationalFromInt(1n))
)
);
}
function calculateMinCollateralCappedIAssetRedemptionAmt(collateralAmt, mintedAmt, price, rmr, reimbursementRatio, minCollateral) {
const uncappedMaxIAssetRedemptionAmt = calculateIAssetRedemptionAmt(
collateralAmt,
mintedAmt,
price,
rmr
);
const uncappedMaxRedemptionLovelacesAmt = rationalFloor(
rationalMul(price, rationalFromInt(uncappedMaxIAssetRedemptionAmt))
);
const maxReimburstment = calculateFeeFromRatio(
reimbursementRatio,
uncappedMaxRedemptionLovelacesAmt
);
const doesMaxBreakMinCollateral = collateralAmt - uncappedMaxRedemptionLovelacesAmt + maxReimburstment < minCollateral;
if (!doesMaxBreakMinCollateral) {
return {
uncappedIAssetRedemptionAmt: uncappedMaxIAssetRedemptionAmt,
cappedIAssetRedemptionAmt: uncappedMaxIAssetRedemptionAmt
};
} else if (collateralAmt <= minCollateral) {
return {
uncappedIAssetRedemptionAmt: uncappedMaxIAssetRedemptionAmt,
cappedIAssetRedemptionAmt: 0n
};
} else {
const resLovelaces = rationalDiv(
rationalFromInt(minCollateral - collateralAmt),
rationalSub(reimbursementRatio, rationalFromInt(1n))
);
const resIAsset = rationalDiv(resLovelaces, price);
return {
uncappedIAssetRedemptionAmt: uncappedMaxIAssetRedemptionAmt,
cappedIAssetRedemptionAmt: rationalFloor(resIAsset)
};
}
}
function adjustPriceToDecimals(extraDecimals, price) {
return extraDecimals === 0n ? price : extraDecimals > 0n ? rationalMul(price, rationalFromInt(10n ** extraDecimals)) : rationalDiv(price, rationalFromInt(10n ** -extraDecimals));
}
// src/contracts/stability-pool/types-new.ts
import { TSchema as TSchema4, Data as Data3 } from "@evolution-sdk/evolution";
import { match as match5, P as P5 } from "ts-pattern";
import { option as O, function as F } from "fp-ts";
import {
AddressSchema,
AssetClassSchema,
OutputReferenceSchema
} from "@3rd-eye-labs/cardano-offchain-common";
var SPIntegerSchema = TSchema4.Struct({
value: TSchema4.Integer
});
var AccountActionSchema = TSchema4.Union(
TSchema4.Literal("Create", { flatInUnion: true }),
TSchema4.Struct(
{
Adjust: TSchema4.Struct(
{
amount: TSchema4.Integer,
outputAddress: AddressSchema
},
{ flatFields: true }
)
},
{ flatInUnion: true }
),
TSchema4.Struct(
{
Close: TSchema4.Struct(
{ outputAddress: AddressSchema, maxTxFee: TSchema4.Integer },
{ flatFields: true }
)
},
{ flatInUnion: true }
)
);
var SumSnapshotSchema = TSchema4.Struct({
sumVal: SPIntegerSchema,
isLastInEpoch: TSchema4.Boolean,
isFirstSnapshot: TSchema4.Boolean
});
var EpochToScaleKeySchema = TSchema4.Struct({
epoch: TSchema4.Integer,
scale: TSchema4.Integer
});
var EpochToScaleToSumEntrySchema = TSchema4.Tuple([
EpochToScaleKeySchema,
SumSnapshotSchema
]);
var StateSnapshotSchema = TSchema4.Struct({
productVal: SPIntegerSchema,
depositVal: SPIntegerSchema,
epoch: TSchema4.Integer,
scale: TSchema4.Integer
});
var AssetSnapshotSchema = TSchema4.Struct({
currentSumVal: SPIntegerSchema,
epoch2scale2sum: TSchema4.Array(EpochToScaleToSumEntrySchema)
});
var AssetStateSchema = TSchema4.Tuple([AssetClassSchema, AssetSnapshotSchema]);
var StabilityPoolContentSchema = TSchema4.Struct({
iasset: TSchema4.ByteArray,
state: StateSnapshotSchema,
assetStates: TSchema4.Array(AssetStateSchema)
});
var AccountContentSchema = TSchema4.Struct({
owner: TSchema4.ByteArray,
iasset: TSchema4.ByteArray,
state: StateSnapshotSchema,
assetSums: TSchema4.Array(TSchema4.Tuple([AssetClassSchema, SPIntegerSchema])),
request: TSchema4.NullOr(AccountActionSchema),
lastRequestProcessingTime: TSchema4.Integer
});
var SnapshotEpochToScaleToSumContentSchema = TSchema4.Struct({
snapshot: TSchema4.Array(EpochToScaleToSumEntrySchema),
iasset: TSchema4.ByteArray,
collateralAsset: AssetClassSchema
});
var StabilityPoolDatumSchema = TSchema4.Union(
TSchema4.Struct(
{ StabilityPool: StabilityPoolContentSchema },
{ flatInUnion: true }
),
TSchema4.Struct({ Account: AccountContentSchema }, { flatInUnion: true }),
TSchema4.Struct(
{ SnapshotEpochToScaleToSum: SnapshotEpochToScaleToSumContentSchema },
{ flatInUnion: true }
)
);
var E2S2SIndexSchema = TSchema4.Union(
TSchema4.Struct(
{ StabilityPoolListIdx: TSchema4.Integer },
{ flatInUnion: true }
),
TSchema4.Struct(
{
RefInputIdx: TSchema4.Struct(
{
refInputIdx: TSchema4.Integer,
snapshotListIdx: TSchema4.Integer
},
{ flatFields: true }
)
},
{ flatInUnion: true }
)
);
var E2S2SIndicesPerAssetSchema = TSchema4.Array(
TSchema4.Tuple([E2S2SIndexSchema, TSchema4.NullOr(E2S2SIndexSchema)])
);
var ProcessRequestAccountContentSchema = TSchema4.Struct(
{
poolInputIdx: TSchema4.Integer,
accountInputIdx: TSchema4.Integer,
e2s2sIdxs: E2S2SIndicesPerAssetSchema,
currentTime: TSchema4.Integer
},
{ flatFields: true }
);
var StabilityPoolRedeemerSchema = TSchema4.Union(
TSchema4.Struct({ RequestAction: AccountActionSchema }, { flatInUnion: true }),
TSchema4.Struct(
{
ProcessRequestPool: TSchema4.Struct(
{
poolInputIdx: TSchema4.Integer,
accountInputIdx: TSchema4.Integer
},
{ flatFields: true }
)
},
{ flatInUnion: true }
),
TSchema4.Struct(
{
ProcessRequestAccount: ProcessRequestAccountContentSchema
},
{ flatInUnion: true }
),
TSchema4.Literal("AnnulRequest", { flatInUnion: true }),
TSchema4.Struct(
{
LiquidateCDP: TSchema4.Struct(
{
cdpIdx: TSchema4.Integer
},
{ flatFields: true }
)
},
{ flatInUnion: true }
),
TSchema4.Literal("RecordEpochToScaleToSum", { flatInUnion: true }),
TSchema4.Literal("UpgradeVersion", { flatInUnion: true })
);
var ActionReturnDatumSchema = TSchema4.Union(
TSchema4.Struct(
{
IndigoStabilityPoolAccountAdjustment: OutputReferenceSchema
},
{ flatInUnion: true }
),
TSchema4.Struct(
{
IndigoStabilityPoolAccountClosure: OutputReferenceSchema
},
{ flatInUnion: true }
)
);
function serialiseActionReturnDatum(d) {
return Data3.withSchema(
ActionReturnDatumSchema,
DEFAULT_SCHEMA_OPTIONS
).toCBORHex(d);
}
function serialiseStabilityPoolRedeemer(r) {
return Data3.withSchema(
StabilityPoolRedeemerSchema,
DEFAULT_SCHEMA_OPTIONS
).toCBORHex(r);
}
function parseStabilityPoolRedeemer(datum) {
try {
return O.some(
Data3.withSchema(
StabilityPoolRedeemerSchema,
DEFAULT_SCHEMA_OPTIONS
).fromCBORHex(datum)
);
} catch (_) {
return O.none;
}
}
function parseStabilityPoolRedeemerOrThrow(datum) {
return F.pipe(
parseStabilityPoolRedeemer(datum),
O.match(() => {
throw new Error("Expected a StabilityPoolRedeemer datum.");
}, F.identity)
);
}
function serialiseStabilityPoolDatum(d, useIndefiniteMaps = false) {
return Data3.withSchema(StabilityPoolDatumSchema, {
...DEFAULT_SCHEMA_OPTIONS,
useIndefiniteMaps
}).toCBORHex(d);
}
function parseStabilityPoolDatum(datum) {
try {
return match5(
Data3.withSchema(
StabilityPoolDatumSchema,
DEFAULT_SCHEMA_OPTIONS
).fromCBORHex(datum)
).with({ StabilityPool: P5.select() }, (res) => O.some(res)).otherwise(() => O.none);
} catch (_) {
return O.none;
}
}
function parseStabilityPoolDatumOrThrow(datum) {
return F.pipe(
parseStabilityPoolDatum(datum),
O.match(() => {
throw new Error("Expected stability pool datum.");
}, F.identity)
);
}
function parseAccountDatum(datum) {
try {
return match5(
Data3.withSchema(
StabilityPoolDatumSchema,
DEFAULT_SCHEMA_OPTIONS
).fromCBORHex(datum)
).with({ Account: P5.select() }, (res) => O.some(res)).otherwise(() => O.none);
} catch (_) {
return O.none;
}
}
function parseAccountDatumOrThrow(datum) {
return F.pipe(
parseAccountDatum(datum),
O.match(() => {
throw new Error("Expected account datum.");
}, F.identity)
);
}
function parseSnapshotEpochToScaleToSumDatum(datum) {
try {
return match5(
Data3.withSchema(
StabilityPoolDatumSchema,
DEFAULT_SCHEMA_OPTIONS
).fromCBORHex(datum)
).with({ SnapshotEpochToScaleToSum: P5.select() }, (res) => O.some(res)).otherwise(() => O.none);
} catch (_) {
return O.none;
}
}
function parseSnapshotEpochToScaleToSumDatumOrThrow(datum) {
return F.pipe(
parseSnapshotEpochToScaleToSumDatum(datum),
O.match(() => {
throw new Error("Expected snapshot e2s2s datum.");
}, F.identity)
);
}
var spPrecision = 1000000000000000000n;
function mkSPInteger(value) {
return { value: value * spPrecision };
}
function fromSPInteger(value) {
return divideOnChainCompatible(value.value, spPrecision);
}
function spAdd(a, b) {
return { value: a.value + b.value };
}
function spSub(a, b) {
return { value: a.value - b.value };
}
function spMul(a, b) {
return { value: divideOnChainCompatible(a.value * b.value, spPrecision) };
}
function spDiv(a, b) {
return { value: divideOnChainCompatible(a.value * spPrecision, b.value) };
}
function spZeroNegatives(a) {
return { value: zeroNegatives(a.value) };
}
// src/contracts/stability-pool/helpers.ts
import {
addAssets as addAssets2,
credentialToAddress as credentialToAddress2,
getInputIndices,
toHex as toHex3,
validatorToScriptHash
} from "@lucid-evolution/lucid";
import {
readonlyArray as RA2,
array as A3,
function as F3,
option as O3
} from "fp-ts";
import {
getInlineDatumOrThrow as getInlineDatumOrThrow2,
isSameAssetClass,
isSameOutRef,
mkAssetsOf
} from "@3rd-eye-labs/cardano-offchain-common";
// src/utils/array-utils.ts
import {
array as A2,
readonlyArray as RA,
option as O2,
function as F2
} from "fp-ts";
function shuffle(arr) {
const source = [...arr];
for (let i = source.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[source[i], source[j]] = [source[j], source[i]];
}
return source;
}
function insertSorted(arr, item, ord) {
if (arr.length === 0) {
return [item];
}
const arrOrd = ord.compare(arr[0], arr[arr.length - 1]);
if (arrOrd === 0) {
if (ord.compare(arr[0], item) === -1) {
return [...arr, item];
} else {
return [item, ...arr];
}
}
for (let i = 0; i < arr.length; i++) {
if (ord.compare(arr[i], item) !== arrOrd) {
return [...A2.takeLeft(i)(arr), item, ...A2.takeRight(arr.length - i)(arr)];
}
}
return [...arr, item];
}
var repsertReadonlyArr = (predicate, val, mkKey) => (arr) => {
const idx = F2.pipe(
arr,
RA.findIndex(([key, _]) => predicate(key))
);
const res = F2.pipe(
idx,
O2.chain(
(i) => F2.pipe(
arr,
RA.modifyAt(i, ([key, _]) => [key, val])
)
)
);
return F2.pipe(
res,
O2.getOrElse(() => [
...arr,
[mkKey(), val]
])
);
};
var repsertWithReadonlyArr = (predicate, replaceVal, newVal, mkKey) => (arr) => {
const idx = F2.pipe(
arr,
RA.findIndex(([key, _]) => predicate(key))
);
const res = F2.pipe(
idx,
O2.chain(
(i) => F2.pipe(
arr,
RA.modifyAt(i, ([key, oldVal]) => [key, replaceVal(oldVal)])
)
)
);
return F2.pipe(
res,
O2.getOrElse(() => [
...arr,
[mkKey(), newVal()]
])
);
};
// src/contracts/stability-pool/helpers.ts
import { match as match6, P as P6 } from "ts-pattern";
// src/contracts/stability-pool/scripts.ts
import { applyParamsToScript } from "@lucid-evolution/lucid";
// src/contracts/stability-pool/types.ts
import { Data as Data5 } from "@lucid-evolution/lucid";
// src/types/generic.ts
import { Data as Data4, fromHex as fromHex2, toHex as toHex2 } from "@lucid-evolution/lucid";
var AssetClassSchema2 = Data4.Object({
currencySymbol: Data4.Bytes(),
/** Use the HEX encoding */
tokenName: Data4.Bytes()
});
function toAssetClassFromLucid(asset) {
return {
currencySymbol: fromHex2(asset.currencySymbol),
tokenName: fromHex2(asset.tokenName)
};
}
function getAssetClassComparisonStr(asset) {
return `${toHex2(asset.currencySymbol)}${toHex2(asset.tokenName)}`;
}
var VerificationKeyHashSchema = Data4.Bytes();
var CredentialSchema = Data4.Enum([
Data4.Object({
PublicKeyCredential: Data4.Tuple([VerificationKeyHashSchema])
}),
Data4.Object({
ScriptCredential: Data4.Tuple([Data4.Bytes()])
})
]);
var CredentialD = CredentialSchema;
var StakeCredentialSchema = Data4.Enum([
Data4.Object({ Inline: Data4.Tuple([CredentialSchema]) }),
Data4.Object({
Pointer: Data4.Tuple([
Data4.Object({
slotNumber: Data4.Integer(),
transactionIndex: Data4.Integer(),
certificateIndex: Data4.Integer()
})
])
})
]);
var StakeCredential = StakeCredentialSchema;
// src/contracts/stability-pool/types.ts
var StabilityPoolParamsSchema = Data5.Object({
assetSymbol: Data5.Bytes(),
stabilityPoolToken: AssetClassSchema2,
snapshotEpochToScaleToSumToken: AssetClassSchema2,
accountToken: AssetClassSchema2,
cdpToken: AssetClassSchema2,
iAssetAuthToken: AssetClassSchema2,
versionRecordToken: AssetClassSchema2,
iassetValHash: Data5.Bytes(),
accountCreateFeeLovelaces: Data5.Integer(),
accountProcessingCooldownMs: Data5.Integer(),
accountProcessingBiasMs: Data5.Integer(),
stakeCredential: Data5.Nullable(StakeCredentialSchema)
});
var StabilityPoolParams = StabilityPoolParamsSchema;
function castStabilityPoolParams(params) {
return Data5.castTo(params, StabilityPoolParams);
}
// src/validators/stability-pool-validator.ts
var _stabilityPoolValidator = {
type: "PlutusScriptV3",
description: "Generated by Aiken",
cborHex: "593c97593c94010100229800aba4aba2aba1aba0aab9faab9eaab9dab9cab9a4888888888c96600264653001300a00198051805800cdc3a4005300a0024888966002600460146ea800e33001300b3754007370e90004dc3a4009223233001001003223300300130020029b874801a6e1d20089b874802a6e1d200c48888888a6002602c0113016301700891192cc004c02800626464b3001301c0028024590191bae301a001301637540071598009806800c4c8c96600260380050048b2032375c6034002602c6ea800e2c8099013180a1baa00291192cc004c02800626464b3001301c0028024590191bad301a001301637540071598009806800c4c8c8cc8966002603c0070068b2036375a60360026eb4c06c008c06c004c058dd5001c590132026301437540049111191919198008098cc0048c078c07c00644b30013233001001003225980099b8f375c604200200714a31330020023022001406d149a2c80ca4603c603e603e603e603e003222323322330020020012259800800c00e26464b30013372200c00315980099b8f00600189bad3022002802a03e8998020021813001a03e375c604000260460028108c8c8cc0040040188966002003003899192cc004cdc8804000c56600266e3c02000626eacc08c00a00a8102266008008604e0068100dd718108009812000a04414bd6f7b6300a40012232330010010032259800800c52f5c11332259800980280144cc088008cc01001000626600800800280e8c084004c08800501f4dc4240012301e301f301f00192cc004c038c068dd5000c4c078c06cdd5000c590184dd7a6103d87a80009ba548001222222222232332259800980a98131baa02089919912cc004c084c0a4dd5000c4cc8966002606000313259800981098161baa00189919912cc004c0d00062660446eb0c0cc004896600200513259800981398191baa00189925133018300b3756602e60666ea80a4dd7181b18199baa0018b206032330010013758603260666ea801c896600200314c103d87a80008992cc006600260260034a14a281922003133003003303900240c864b30013371e6eb8c0e000402e260246606e6070607200297ae08a6103d87a800040c86eb0c0dc00503544c8c8cc8966002607400713005303a0068b206e375c606e0026eb8c0dc008c0dc004dd6181a80120668b2062375a60620026064002605a6ea80062c8150c02cc030c0b0dd5180918161baa302f0018b205a375c605a60546ea800660026eb0c040c0a8dd50104c0b4c0b8c0b8c0b8c0b8c0b8c0b8c0a8dd5018d30103d8798000401516409c6002002605660506ea8c0acc0a0dd5198011bac302b3028375403c02a44b30010018a5eb822660566050605800266004004605a00281522b3001301b3026375402719800981518139baa013912cc004c074c0a0dd500144c8c966002605e0050038b2058375a605a00260526ea800a2c81326e252004912cc004c074c0a0dd500144c8c8cc896600260620070058b205c375a605c0026eb4c0b8008c0b8004c0a4dd500145902648966002603a60506ea800a264646644b30013031003802c5902e1bae302e001375c605c004605c00260526ea800a2c813122222332233223322598009813000c4c966002606e00313300530360010038b2068303237540171598009814800c4c966002606e00313259800981418199baa00189919191919194c004dd6981e800cdd7181e8034dd7181e802cdd6181e801cc0f40092222259800982180344cc048c1080244cc0c4008896600200513259800981b000c4c966002608e00313302b30460010138b208830423754009159800981c800c56600260846ea801202516410d1640fc81f8c100dd5001c4c8c8c9660026090005133019304700313301c0011300430480058b208a304600130460013758608800482122c8200607a002607800260760026074002607200260686ea80062c8188c0d80062c81a0c0c8dd5005c566002604a00313259800981b800c4cc010c0d800400e2c81a0c0c8dd5005c5902f205e40bc33001302f3754013370090014966002604a60606ea8006246466ebcc0d8c0ccdd5181b18199baa00200130353032375400512323375e606c60666ea8008004c0d4c0c8dd5001205c91119914c004c9660026054606a6ea800626eb4c0d8c0e4dd5981c981b1baa0018a40008198c0e00066eac00a6ebcc0e0c0e400644b3001302e3036375400b13371200200515980099b89001002899b890023370000290404df7014528206840d091112cc00400e2b300130020068998008022400114a081b2264b30013375e98101400030390018acc004cc008014dd6981d181e9bab303a001898019ba6303e0048a5040dd15980099801002a4001130030078a5040dc81b8c0f000d03a0dd3001194c004006009223303800233038374c00297ae04004444b3001002899800a6103d87a80004bd6f7b63044c8cc896600266e452201000028acc004cdc7a44100002899802180b1981d981c801a5eb80006266008980103d87a800000540d9198008034006446600c0046607a00a00280310361bae3036001303b003303900240dd23034303530353035001914c00400a6eb8c0d4c0c8dd5000cdd7180c18191baa0014055374a900148c0d0c0d4c0d4c0d4c0d4c0d4c0d4c0d4c0d4c0d4006446606866ec0dd48011ba80014bd6f7b63048c038cc0ccdd419b82001482020283dbd2b36f806d2f5c122300f33034375066e0ccdc11bad303530323754004904040507b7a566df00d9bad30353032375400297ae09118079981a1ba8337026eb4c0d4c0c8dd50011bad30353032375400297ae09118079981a1ba83370666e08dd6981a98191baa002375a606a60646ea8005208080a0f6f4acdbe01b4bd70488c03ccc0d0dd419b80375a606a60646ea8008dd6981a98191baa0014bd70488c8cc00400400c896600200314bd7044cc0d8dd398019bac303700133002002303800140d52259800800c40062a660600042002817a4464b30013027001899192cc004c0e400a0091640d86eb8c0dc004c0ccdd5001c566002605400315980098199baa00380145903445903020603031375400537009000cdd780ecdd7980a18181baa0269ba5480112222222222222222222229800912cc0040062900044c058cc008008c12c005048488888c8c8cc00400401c896600200314a1159800992cc004c0100062b30013375e605c609c6ea800401e2b300198009bab3034304e3754003006802a03689816180d18271baa0018a50412d14a0825a294104b1828000c528c4cc008008c14400504a209c30180049119191980080080191192cc004cdd78021825000c4c12c006266006006609e0048240c134004c044cc1240092f5c122259800981e000c52f5bded8c113304a337606ea400cdd319808001000a5eb7bdb181045489660020031480022602c6600400460960028242444b3001301f0018cc00400e60986098005337000029001a0068acc004cdc4a400400319800801cc13000a600e002801a2b3001303c00189825801454cc1192401146578706563745f61743a206e6f7420666f756e6400164114822904524444453001300600694c004dd7182798261baa0019bae3032304c3754003480090044c00800a60020029111192cc004c11c08233001305330503754053304f3754093223303400223375e60ac60a66ea8c158c14cdd5181c98299baa0010029182a182a982a982a982a982a982a982a982a800c966002606400310018a400082724444646600200200a44b300100189982c19bb0375200a6ea00112f5bded8c113233225980099b910080028acc004cdc7804001466002011375a60b200700791982e19bb037520126ea000400a200280322660b666ec0dd48041ba8007004415913305b0033300500500141586eb8c158004c16c008c16400505748888c8cc0040040148966002003133058337606ea4014dd300225eb7bdb1822646644b30013372201000515980099b8f0080028cc0040226eacc16400e00f23305c337606ea4024dd30008014400500644cc16ccdd81ba9008374c00e00882b22660b60066600a00a00282b0dd7182b000982d801182c800a0ae9b81480026ebd300101a0004888888888c8c966002609e01513298009bac305f0019bac305f30603060001982f982e1baa05548896600260ac60bc6ea8c10cc17cdd5007c4c96600260c800313259800980f983218309baa0018992cc004c198cc040018c194c188dd5000c4c96600266048921014100300b3047306337540b313259800982d800c4cc0952410142009800803cc0b8cc19800d2f5c1302033066302e330663232323230453306a306b0043306a306b0033306a306b0023306a306b0013306a30453306a00a4bd701836183600098358009835000983480098321baa0144bd7025eb83300130183030306437540d7375c60ce60c86ea81ae6eb8c128c190dd500a4c040dd6983398321baa00640294c0103d87a80004079159800982b800c4cc09524010143009800803cc0b8cc19800d2f5c1302033066302e330663232323230453306a306b0043306a306b0033306a306b0023306a306b0013306a30453306a00a4bd701836183600098358009835000983480098321baa0144bd7025eb826030606060c86ea81ae980103d87a8000407914a0830906118311baa0058a5041806608e6eb0c03cc188dd502c1bae30653062375402516418c60c860c26ea8c11cc184dd5000c5905e1831800c590614c00400e605660be6ea819a980103d879800040e9153305d4910c3c65787065637465643e204e00164170305b37540a3159800982700546600260b66ea8152466e0cdd6982f982e1baa001482020283dbd2b36f806e444b300130350018cc00400e60c460c4005337000029001a0068acc004cdc4a400400319800801cc18800a603a002801a2b3001305200189bac30610028a9982e249146578706563745f61743a206e6f7420666f756e640016416c82d905b488cc88cc896600260b060c06ea8c190c194c194c184dd518321832803456600266e2000400a29462b30013370e0040031337106eb4c190c19400cdd698321832802452820bc417914a082f0dd698310011bad3062001305d375460c000460ba6ea800644b30013051305c3754005132323322598009832801c0162c8310dd698310009bad30620023062001305d37540051641692232598009829000c56600260a460ba6ea800a298103d87a80008a6103d8798000416d1598009828800c56600260a260ba6ea800a2980103d87a80008a6103d87b8000416d1332259800982b800c4c96600266e2000c0062980103d87980008acc004cdc4000801c530103d87b80008a6103d87a8000417882f0dd6983198301baa0048acc004c150006298103d87b80008a6103d8798000417482e8dd69830982f1baa003305d375400482d905b182e1baa0029181c9982f192cc004c150c170dd5000c4c96600260aa60ba6ea8c110c178dd51830982f1baa00389814198301ba80014bd7044c0a0cc180dd41816800a5eb8105b1bad3060305d37540031001416860be60b86ea8c17cc170dd50009982f192cc004c150c170dd5000c4c96600260aa60ba6ea8c110c178dd51822182f1baa00389814198301ba80014bd7044c0a0cc180dd4180e800a5eb8105b1bad3060305d37540031001416860be60b86ea8c108c170dd5000a5eb8253001001a44100a4410040fd2298008015220100a44100800a00691194c0040060070024004444b30010028800c4ca60020093065003cc00400a6eb8c1800066eacc1840064444464b3001300f374c00300289801800a0c832329800800c01a00a80088896600200510018994c00401260de00798008014dd71835000cdd69835800c0150162008306d00241aca01a8059004183180120c2911112cc004cc0b80100162b30013375e608060c06ea801400e2b300198009bab30463060375400b002800a05a8981f181618301baa0058a50417514a082ea294105d48c8cc004004008896600200314bd6f7b63044c8cc184cdd8182f0009ba63233001001375660c000444b30010018a5eb7bdb182264660c866ec0c184004dd418059bad3062001330030033066002306400141886600600660c600460c200282fa44b300130510028800c4c8c0eccc180cc088c184c178dd5001198109812a400466048002608860bc6ea8008cc180cc084c110c178dd500100098311831182f1baa00230240024169232598009828982e1baa00189830182e9baa0018a9982da481263c65787065637465643e2044656e6f6d696e61746f722063616e6e6f74206265207a65726f2e001641686644b300130520018a6103d87a80008acc004cdc4000a40011303b33060303b330603750600e004660c06ea0c01c0052f5c097ae08981d99830181d998301ba800233060375000297ae04bd7020b6416c6eb4c17cc170dd50009bad3042305c3754003225980099b89001480022900044c8cdc19bad3061001375a60c260c400260ba6ea8cc88c0f0cc184dd419b82375a60c40046eb4c188004cc184dd419b82375a60c460c60046eb4c188c18c0052f5c060ba6ea8c0e8cc17cdd40009982fa6010101004bd70182e9baa0024169259800981e9bad305f305c375400310018a60105d8799f00ff0041652305f30603060306030603060306030600019182f9830183018301830183018301830183018301830000c8c17cc180c180c180c180c18000660b66ea8145222222222222222222229800983980a4dd6983900a4c04804a4444602e660726606e6606c66070008004660726607000600860749040546b5c83982c98399baa0013076307337540032259800983298381baa00289919191919191919194c004c1f40066eb8c1f40266eb4c1f402260fa00d307d005983e8024c1f400e64b3001307b0018acc004c148c1e80062d13072307a00141e11641f06ea8c1f40092222222259800984300804c4cc08cc2140403c4cc08c0144cc08c0104cc08c00c4cc08c0084cc10802004a2c84180860fa00260f800260f600260f400260f200260f000260ee00260ec00260e26ea800a2c83726eb0c1c800660e460e660e660e660e660e660e660e600291111114c004c1e801e6eb4c1e401e444444b30013070307b375400913300b003375a60fe60f86ea8012264646644b300133041491015a003305c375660cc6100026ea8c198c20004dd5001002c4c96600260e86100026ea8006264b30013086010018991982a0008acc004cc11124010159005980099b8f375c60d26106026ea8004036266ebcc18cc20c04dd500080645282100028998091bac308601308301375400200916420004610a0200316420c046102026ea80062c83f0c17cc180c20004dd518331840009baa0028b20fa33030004001375a6102026104020046eb4c20004004c1f0dd500220f2488a60026eb0c1f000e6eb4c1f0c1f400e444446644646610602646460c06610a02610c020046610a02610c020026610a026460c26610c02610e020026610c02b3001337106eb4c21c04c21004dd50021bad30870130840137546609460d46108026ea8014c12d2080a8d6b9078a6105d8799f00ff008802210202308801308801001308301375460d26106026ea8028cc21404dd3998229bac3063308301375401446610c02610e020026610c02610e026108026ea8c21c04c220040052f5c0610e02610e02610e02002610c020026102026ea801ccc20c04dd3194c0040073001375c610a026104026ea80266eb0c188c20804dd5004cdd618271841009baa00898311841009baa00548888ca6002003004806400d00111112cc00400e297ae08cc004dd6184680801cc2380400e6eb0c2340400a611c0200530673308c01306a308a013754016661180260ac6114026ea802d2f5c130673308c01306a308a01375401666118026ea0c164dd6982b1845009baa00b4bd70244444466446644b300100b899191984c009ba73309801006330980137513001001acc004c22804c25404dd5001c4c96600266ebcc268040040222613402612e026ea8c26804c26c040062c84a008dd6184c80984b009baa0038acc00566002611a02612a026ea8c26404c2680400a2611a02612a026ea8c1f0c25804dd5183e00244cc0e001001d09301440062c84980909301530105d8799f00ff0080ba0484bd704c004042017009806a0203098010015980099baf30970100200689984b00984b80984a009baa30970130980100233096019800a51a6103d87a8000a60103d879800042440497ae08acc004cc155241015800330360020068a5eb8505d8799f00ff008103d8798000459091012122028992cc004cdd7802984c00800c4c8c96600266ebcc26804014026266132026e9ccc2640401ccc26404dd44c004006b3001308e013096013754613402613602005159800984700984b009baa0048800c59094014566002611602612c026ea8012264b30013375e6136020020131309b013098013754613602613802003164254046eb0c26804c25c04dd500245909401212802984d00984d80801c06102525eb82600202300c8054c26c0403901145909401184c80800984a809baa3098013099010038b2124023758612e0201684a80a6002021002984a808034dd6183c1849009baa00180b403501a192cc004c22804c24804dd5000c5300103d87a8000898381984a809ba79800808c00e612c026126026ea80066eb0c1e4c24c04dd5001405e01c80d92f5c0848008c25404c25804018c24c04018c24c04c250040188458094bd6f7b63020022225980080144006330010039844008014c8ca6002007375c611202610c026ea80066eb8c1b0c21804dd5000cdd698448098450080120583088010013758610e0200480190850125eb816600266e20dd698301840009baa001375a60c06100026ea800a298105d8799f00ff008acc004cdc42400466e04dd698261840009baa002375a60986100026ea8006298105d8799f00ff008acc004cdc41bad304c30800137540026eb4c130c20004dd500144cc118cc110c198c20004dd50009841809840009baa002305d3308201375066e08dd69841809840009baa30830130800137540029040546b5c83a5eb8226608c6608860cc6100026ea8004c20c04c20004dd50011841809840009baa00141f483e907d1832183f1baa005305e307e37540093302b0050024888966002607661000260fa6ea80062b30013303e49010141003322598009839983f1baa0028acc004c1ccc1f8dd5184100983f9baa00289839998251bab3065307f375460ca60fe6ea800cc12cc1fcdd504300c00507c400507c1830983e9baa02d133059375660c660fa6ea8c18cc1f4dd50009824983e9baa084018992cc004cc0fd24010142003305a375660c860fc6ea8c190c1f8dd50009832183f1baa08501899912cc004c1d0c1fcdd5000c4c966002610a020031323305400115980099821a49014300332259800992cc004c1e000629462b3001307c0018a518a50420804841008c20c04dd5198121843809842009baa002308701308401375400313259800983c800c528c56600260f800314a314a0841009082011841809baa33024306a308401375400460d46108026ea800629410810118108069810982f9984200982f9984200982619842009ba8337020106eb4c058c20804dd504480a5eb80cc21006600294698103d87a8000a60103d879800041fc97ae03308401305f3308401304c3308401375066e00020dd6980b1841009baa089014bd701984200cc00528d300103d87a8000a60103d879800041fc97ae04bd70456600266086920101440032332259800983e00144c96600260fa610a026ea8c1b0c21804dd51844809843009baa011899b88002001899b89002001420c046eb4c22004c21404dd5001c56600260f200514a114a2841009082011841009baa001337006eb4c058c20c04dd50199bad304c308301375411402610a026104026ea8c21404c20804dd5006c4c966002660889210145003001375c60d26106026ea80ce2b3001330444901014600307630380058acc004cc111241014700323306b00113375e002609c6610c026ea0050cc21804dd4006a5eb80cc0f0c21804c20c04dd50031bab304c30830137540f313259800983d9841809baa0018b44c8cc896600260f600519800983219844809845009843809baa308a01308701375460da610e026ea8028cc22404c22804c22c04c22c04c22c04c22c04c22c04c22c04c22c04c22c04c22c04c22c04c22c04c21c04dd504700a5eb833001375660da610e026ea8c1b4c21c04dd5005cdd71845009843809baa08e019bae308a01308701375400c83526eb0c19cc21c04dd503ea444b30013304b4910148003047374c607c60ac6114026ea8244062b30013304b4901014900307d303d3233001001375660e26116026ea8c1c4c22c04dd5007912cc004006297ae08991991199119801001000912cc00400620071323309401374e66128026ea4014cc25004c24404004cc25004c248040052f5c066006006612c02004612802002849008dd59847808019bae308c0100133003003309101002308f0100142340515980099825a49014a00306b0028acc004cc12d241014b009800984680800cc150cc2300400d2f5c130463308c0130673308c01980099183419846809847008009984680991834998470098478080099847009982798391846009baa3072308c01375401660a60086120026120020026116026ea8c1c4c22c04dd50051847809847808009845009baa009a6106d8799f4040ff00a4001375a606e6114026ea82440503b25eb812f5c13302798009bab3070308a01375460e06114026ea80366eb8c23404c22804dd504880cdd71846809845009baa0098012060375a606e6114026ea82440698103d8798000409513304b4901014c009800984680984700800cc150cc2300400d2f5c130463308c0130543308c0130673308c01308d01308a0137540746611802611a026114026ea8024cc23004c8c1a0cc23404c23804004cc23404c14800cc23c04c23c04004c22804dd518381845009baa0093308c01374e660986eb0c1a8c22804dd50049198468098470080099846809847009845809baa308e01308f010014bd701984600a60103d87a80003308c01375002097ae04bd7025eb826604e607c60ac6114026ea824404cdc098021bad3037308a013754122026eb4c158c22804dd504000d300103d87a8000409514a084380a2941087014528210e028a50421c048acc004c1e800a2653001308b010019bad308b01308c01001cc004dd618371844009baa07e980d9844009baa08f01a60103d8798000418c9112cc004c23c04006264b30013375e60ac6611c0260426118026ea824c052f5c0611e026118026ea8c23c04c23004dd518391846009baa0018992cc004c20404c23004dd5000c4c9660026124020031323301c00115980098069bae309201308f0137540031323233229800acc004c21c04dd6984b009849809baa0028a400113302a302b3077309301375400a00284800a6eb0c1ccc24c04dd504480cdd5984b00984b808022444b3001330574910148003053374c6060609460c4612c026ea8274062b3001330574901014900337126eb4c188c25804dd504600806c566002660ae9201014a009800984c808014c180cc26004c26404c25804dd5183e184b009baa0194bd704c148cc26004c1cccc26004c8c1d0cc26404c26804004cc26404cc0c0010c8c1d4cc26804c26c04004cc2680401cc27004c27004004c25c04dd5183e984b809baa016309b01309b01001309601375402a97ae04bd7066002660646eacc1f0c25804dd5183e184b009baa01930300019bae309901309601375413a03375c613202612c026ea805666e00c0fc01000d03c530103d879800040c51330574901014b009800984c80984d008014c180cc260040392f5c13052330980130603309801309901309601375403497ae04bd70660026606600260206eb4c188c25804dd504600cdd7184c80984b009baa09d019bae309901309601375402b3370200800681e2980103d87a800040c514a084980a294109301452821260218139982b183b9848809baa30773091013754020002607a606a00261260200264661240260ec6120026ea8c1c0c24004dd51849808009984900984980984a00800a5eb82600201d03f80b4dd6183a9847809baa0850184b00a0288b2118023091010018b211e02308d0137540031642280460d660d86118026ea8c1c8c23004dd5000c5908901184700800c5908c010c21c04dd5001c4ca60026eb4c22c0400661160261180200398009bac306e30880137540fd301b308801375411e034c0103d8798000418d308b01308801375460dc6110026ea802d22225980098480080144c96600266ebcc15ccc23c04c088c23404dd504a00a5eb80c24004c23404dd51848009846809baa3073308d013754003132598009841009846809baa0018992cc004c24c040062646603a0022b3001300e375c6126026120026ea8006266453001309501002984b00800ccdc4a400001491119194c00566002b30010038a5189845809bad309a01309701375400284a00a2900044cc0b8c0bcc1ecc25c04dd500418200012128029bab309a01309b01007984d00984d808022444b30013305b4910148003042307e309a013754120031598009982da4810149009800984e80803cc190cc2700403d2f5c130563309c0130643309c01323230793309e01309f010023309e01309f010013309e0132307a3309f0130a0010013309f0133060308301309d01375460fa613a026ea802cc190020c28404c28404004c27004dd5183e184e009baa00a3309e01309f0130a00130a0010013309e014c0103d87a80003309e01375004497ae0309f01001309a01375401097ae04bd704cc0dcc138c198c26804dd50508099b813014375a60cc6134026ea824004cdc0981c1bab308001309a01375400260700054c103d87a800040d51598009982da49014a009800984e80804cc190cc2700403d2f5c130563309c0130773309c013230783309d01309e010013309d01330340043230793309e01309f010013309e0100630a00130a001001309b0137546102026136026ea8068c27c04c27c04004c26804dd500ca5eb812f5c198009981b1bab308001309a0137546100026134026ea8074c0d000a6eb8c27404c26804dd505080cdd7184e80984d009baa01999b8000500341014c103d87a800040d513305b4901014b009800800cc190cc270040452f5c130563309c0130773309c01309d01309a01375403c97ae04bd7056600200d10028cc00400a6eb8c27404c26804dd505080cdd7184e80984d009baa01999b813043005003410084b80a980103d87a800040d514a084b80a2941097014528212e0218161982c983e184b009baa307c309601375402a60ba002b30010018806c4c96600266e2000403a201d1001424c04607c607260f6612a026ea8c1d4c25404dd5001a124024c00403e0810179bac3076309001375410c030970140546eb0c1c0c24004dd504300c5908d01184900800c59090011847009baa0018b211602306c306d308d01375460e6611a026ea80062c845008c23c0400a2c846808610e026ea800d0840121080230840137540026e04c08cdd598359842809baa306b3085013754012610e026108026ea80050810118339841809baa0338a5042000514a084000a2941080011b8f375c610a026104026ea8006294107f452820fe3084010018b21040230800137540031641f46605801461020260fc6ea8c20404c1f8dd51832183f1baa002305d305e307e375460c860fc6ea80062c83d8cc0bc0240362c83d22c83d022b3001304c00a89919192cc004c188cc030008c184c178dd5000c4c96600266040920101410030073043305f37540ab13259800982b982f9baa0018b456600260a860be6ea8c18cc180dd5000c528c4cc085240101420098009bac306330643064005981519831001a5eb826038660c46054660c4646464646082660cc60ce008660cc60ce006660cc60ce004660cc60ce002660cc980103d87a8000306830680013067001306600130650013060375402097ae04bd704c050c0b0c180dd5033d30103d87a8000406882e905d1821982f9baa00f8a504170660866eb0c02cc178dd502a1bae3061305e375401d16417c60c060ba6ea8cc0dc004128dd6182f800982d9baa0518b20b0416082c088896600260a400310048cc0040120073302600200191111192cc004c030dd3000c00a26006002830a600200900