@indigo-labs/indigo-sdk 0.2.41 → 0.3.0
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/.github/workflows/ci.yml +4 -2
- package/dist/index.d.mts +3008 -2194
- package/dist/index.d.ts +3008 -2194
- package/dist/index.js +9827 -6194
- package/dist/index.mjs +8591 -4809
- package/package.json +14 -3
- package/src/contracts/cdp/helpers.ts +68 -72
- package/src/contracts/cdp/scripts.ts +50 -13
- package/src/contracts/cdp/transactions.ts +831 -545
- package/src/contracts/cdp/types-new.ts +256 -0
- package/src/contracts/cdp/types.ts +26 -144
- package/src/contracts/cdp-creator/scripts.ts +15 -9
- package/src/contracts/cdp-creator/types-new.ts +50 -0
- package/src/contracts/cdp-creator/types.ts +5 -31
- package/src/contracts/collector/scripts.ts +1 -1
- package/src/contracts/collector/transactions.ts +23 -13
- package/src/contracts/collector/types-new.ts +17 -0
- package/src/contracts/execute/scripts.ts +19 -10
- package/src/contracts/execute/types-new.ts +44 -0
- package/src/contracts/execute/types.ts +5 -38
- package/src/contracts/gov/helpers.ts +187 -51
- package/src/contracts/gov/scripts.ts +17 -10
- package/src/contracts/gov/transactions.ts +599 -271
- package/src/contracts/gov/types-new.ts +253 -100
- package/src/contracts/gov/types.ts +4 -71
- package/src/contracts/iasset/helpers.ts +172 -0
- package/src/contracts/iasset/scripts.ts +38 -0
- package/src/contracts/iasset/types.ts +154 -0
- package/src/contracts/initialize/actions.ts +768 -0
- package/src/contracts/initialize/helpers.ts +611 -36
- package/src/contracts/initialize/types.ts +102 -28
- package/src/contracts/interest-collection/helpers.ts +19 -0
- package/src/contracts/interest-collection/scripts.ts +44 -0
- package/src/contracts/interest-collection/transactions.ts +436 -0
- package/src/contracts/interest-collection/types-new.ts +50 -0
- package/src/contracts/interest-collection/types.ts +26 -0
- package/src/contracts/interest-oracle/helpers.ts +2 -30
- package/src/contracts/interest-oracle/scripts.ts +1 -1
- package/src/contracts/interest-oracle/transactions.ts +21 -16
- package/src/contracts/interest-oracle/types-new.ts +32 -0
- package/src/contracts/interest-oracle/types.ts +1 -40
- package/src/contracts/one-shot/transactions.ts +1 -2
- package/src/contracts/poll/helpers.ts +5 -23
- package/src/contracts/poll/scripts.ts +12 -13
- package/src/contracts/poll/types-poll-manager.ts +1 -19
- package/src/contracts/poll/types-poll-new.ts +170 -0
- package/src/contracts/poll/types-poll-shard.ts +2 -24
- package/src/contracts/price-oracle/helpers.ts +1 -4
- package/src/contracts/price-oracle/scripts.ts +3 -8
- package/src/contracts/price-oracle/transactions.ts +32 -25
- package/src/contracts/price-oracle/types-new.ts +50 -0
- package/src/contracts/price-oracle/types.ts +2 -36
- package/src/contracts/pyth-feed/helpers.ts +58 -0
- package/src/contracts/pyth-feed/scripts.ts +15 -0
- package/src/contracts/pyth-feed/types.ts +181 -0
- package/src/contracts/rob/helpers.ts +405 -0
- package/src/contracts/rob/scripts.ts +35 -0
- package/src/contracts/rob/transactions.ts +410 -0
- package/src/contracts/rob/types-new.ts +128 -0
- package/src/contracts/rob/types.ts +16 -0
- package/src/contracts/rob-leverage/helpers.ts +424 -0
- package/src/contracts/{leverage → rob-leverage}/transactions.ts +68 -48
- package/src/contracts/stability-pool/helpers.ts +714 -230
- package/src/contracts/stability-pool/scripts.ts +20 -15
- package/src/contracts/stability-pool/transactions.ts +625 -495
- package/src/contracts/stability-pool/types-new.ts +237 -100
- package/src/contracts/stability-pool/types.ts +5 -22
- package/src/contracts/stableswap/helpers.ts +22 -0
- package/src/contracts/stableswap/scripts.ts +37 -0
- package/src/contracts/stableswap/transactions.ts +647 -0
- package/src/contracts/stableswap/types-new.ts +131 -0
- package/src/contracts/stableswap/types.ts +17 -0
- package/src/contracts/staking/helpers.ts +49 -34
- package/src/contracts/staking/scripts.ts +1 -1
- package/src/contracts/staking/transactions.ts +85 -130
- package/src/contracts/staking/types-new.ts +60 -28
- package/src/contracts/staking/types.ts +1 -28
- package/src/contracts/treasury/helpers.ts +21 -0
- package/src/contracts/treasury/scripts.ts +16 -26
- package/src/contracts/treasury/transactions.ts +256 -27
- package/src/contracts/treasury/types-new.ts +69 -0
- package/src/contracts/treasury/types.ts +2 -43
- package/src/contracts/version-registry/scripts.ts +2 -2
- package/src/contracts/version-registry/types-new.ts +6 -7
- package/src/index.ts +37 -20
- package/src/scripts/auth-token-policy.ts +3 -2
- package/src/scripts/iasset-policy.ts +3 -2
- package/src/types/evolution-schema-options.ts +3 -3
- package/src/types/generic.ts +17 -89
- package/src/types/multisig.ts +48 -0
- package/src/types/on-chain-decimal.ts +14 -7
- package/src/types/rational.ts +61 -0
- package/src/types/system-params.ts +237 -41
- package/src/utils/array-utils.ts +70 -1
- package/src/utils/bigint-utils.ts +12 -0
- package/src/utils/indigo-helpers.ts +8 -10
- package/src/utils/lucid-utils.ts +47 -40
- package/src/utils/oracle-helpers.ts +62 -0
- package/src/utils/pyth/decode.ts +223 -0
- package/src/utils/pyth/encode.ts +262 -0
- package/src/utils/pyth/index.ts +14 -0
- package/src/utils/pyth/types.ts +87 -0
- package/src/validators/always-succeed-validator.ts +6 -0
- package/src/validators/cdp-creator-validator.ts +2 -2
- package/src/validators/cdp-redeem-validator.ts +7 -0
- package/src/validators/cdp-validator.ts +2 -2
- package/src/validators/collector-validator.ts +2 -2
- package/src/validators/execute-validator.ts +2 -2
- package/src/validators/governance-validator.ts +2 -2
- package/src/validators/iasset-validator.ts +7 -0
- package/src/validators/interest-collection-validator.ts +7 -0
- package/src/validators/interest-oracle-validator.ts +2 -2
- package/src/validators/poll-manager-validator.ts +2 -2
- package/src/validators/poll-shard-validator.ts +2 -2
- package/src/validators/price-oracle-validator.ts +7 -0
- package/src/validators/pyth-feed-validator.ts +7 -0
- package/src/validators/rob-validator.ts +7 -0
- package/src/validators/stability-pool-validator.ts +2 -2
- package/src/validators/stableswap-validator.ts +7 -0
- package/src/validators/staking-validator.ts +2 -2
- package/src/validators/treasury-validator.ts +2 -2
- package/src/validators/version-record-policy.ts +2 -2
- package/src/validators/version-registry-validator.ts +2 -2
- package/tests/always-succeed/script.ts +7 -0
- package/tests/bigint-utils.test.ts +41 -0
- package/tests/cdp/actions.ts +611 -0
- package/tests/cdp/cdp-helpers.ts +55 -0
- package/tests/cdp/cdp-queries.ts +440 -0
- package/tests/cdp/cdp.test.ts +6087 -0
- package/tests/cdp/transactions-mutated.ts +1729 -0
- package/tests/data/system-params.json +177 -34
- package/tests/datums.test.ts +209 -210
- package/tests/endpoints/initialize.ts +68 -0
- package/tests/endpoints/interest-collector.ts +37 -0
- package/tests/endpoints/treasury.ts +70 -0
- package/tests/gov/actions.ts +406 -0
- package/tests/gov/gov.test.ts +4450 -0
- package/tests/{queries → gov}/governance-queries.ts +6 -3
- package/tests/hash-checks.test.ts +38 -11
- package/tests/indigo-test-helpers.ts +100 -0
- package/tests/initialize.test.ts +61 -9
- package/tests/interest-collection/interest-collection.test.ts +892 -0
- package/tests/interest-collection/interest-collector-queries.ts +49 -0
- package/tests/interest-collection/transactions-mutated.ts +260 -0
- package/tests/interest-oracle.test.ts +43 -35
- package/tests/mock/assets-mock.ts +234 -23
- package/tests/mock/protocol-params-mock.ts +21 -0
- package/tests/price-oracle/actions.ts +163 -0
- package/tests/price-oracle/price-oracle-queries.ts +12 -0
- package/tests/price-oracle/price-oracle.test.ts +240 -0
- package/tests/price-oracle/transactions-mutated.ts +62 -0
- package/tests/pyth/endpoints.ts +96 -0
- package/tests/pyth/helpers.ts +37 -0
- package/tests/pyth/pyth-encoding.test.ts +376 -0
- package/tests/pyth/pyth-indigo.test.ts +509 -0
- package/tests/pyth/pyth.test.ts +300 -0
- package/tests/queries/execute-queries.ts +6 -5
- package/tests/queries/iasset-queries.ts +175 -5
- package/tests/queries/interest-oracle-queries.ts +4 -2
- package/tests/queries/poll-queries.ts +8 -9
- package/tests/queries/stability-pool-queries.ts +95 -48
- package/tests/queries/staking-queries.ts +4 -2
- package/tests/queries/treasury-queries.ts +80 -5
- package/tests/rob/actions.ts +58 -0
- package/tests/{lrp-leverage.test.ts → rob/rob-leverage.test.ts} +393 -296
- package/tests/rob/rob-queries.ts +95 -0
- package/tests/rob/rob.test.ts +3762 -0
- package/tests/rob/transactions-mutated.ts +853 -0
- package/tests/script-size.test.ts +240 -0
- package/tests/setup.ts +135 -0
- package/tests/stability-pool/actions.ts +210 -0
- package/tests/stability-pool.test.ts +5469 -666
- package/tests/stableswap/stableswap-actions.ts +84 -0
- package/tests/stableswap/stableswap-queries.ts +89 -0
- package/tests/stableswap/stableswap.test.ts +3891 -0
- package/tests/stableswap/transactions-mutated.ts +348 -0
- package/tests/staking.test.ts +82 -99
- package/tests/test-helpers.ts +58 -11
- package/tests/treasury.test.ts +242 -0
- package/tests/utils/asserts.ts +74 -0
- package/tests/utils/benchmark-utils.ts +81 -0
- package/tests/utils/index.ts +122 -4
- package/tsconfig.json +9 -1
- package/vitest.config.ts +3 -1
- package/src/contracts/collector/types.ts +0 -16
- package/src/contracts/initialize/transactions.ts +0 -891
- package/src/contracts/leverage/helpers.ts +0 -424
- package/src/contracts/lrp/helpers.ts +0 -294
- package/src/contracts/lrp/scripts.ts +0 -27
- package/src/contracts/lrp/transactions.ts +0 -250
- package/src/contracts/lrp/types.ts +0 -131
- package/src/contracts/poll/types-poll.ts +0 -88
- package/src/contracts/vesting/helpers.ts +0 -218
- package/src/utils/value-helpers.ts +0 -37
- package/src/validators/lrp-validator.ts +0 -7
- package/tests/cdp.test.ts +0 -1528
- package/tests/gov.test.ts +0 -2011
- package/tests/lrp.test.ts +0 -673
- package/tests/queries/cdp-queries.ts +0 -220
- package/tests/queries/lrp-queries.ts +0 -76
- package/tests/queries/price-oracle-queries.ts +0 -10
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Data } from '@lucid-evolution/lucid';
|
|
2
|
+
import { AssetClassSchema } from '../../types/generic';
|
|
3
|
+
|
|
4
|
+
export const InterestCollectionParamsSchema = Data.Object({
|
|
5
|
+
versionRecordNft: AssetClassSchema,
|
|
6
|
+
multisigUtxoNft: AssetClassSchema,
|
|
7
|
+
cdpAuthTk: AssetClassSchema,
|
|
8
|
+
collateralAssetAuthTk: AssetClassSchema,
|
|
9
|
+
govAuthTk: AssetClassSchema,
|
|
10
|
+
cdpAssetSymbol: Data.Bytes(),
|
|
11
|
+
cdpBiasTime: Data.Integer(),
|
|
12
|
+
interestSettlementCooldown: Data.Integer(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type InterestCollectionParams = Data.Static<
|
|
16
|
+
typeof InterestCollectionParamsSchema
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
const InterestCollectionParams =
|
|
20
|
+
InterestCollectionParamsSchema as unknown as InterestCollectionParams;
|
|
21
|
+
|
|
22
|
+
export function castInterestCollectionParams(
|
|
23
|
+
params: InterestCollectionParams,
|
|
24
|
+
): Data {
|
|
25
|
+
return Data.castTo(params, InterestCollectionParams);
|
|
26
|
+
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { InterestOracleDatum } from './types';
|
|
2
1
|
import { ONE_YEAR } from '../../utils/time-helpers';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ocdAdd,
|
|
6
|
-
ocdCeil,
|
|
7
|
-
ocdMul,
|
|
8
|
-
OnChainDecimal,
|
|
9
|
-
} from '../../types/on-chain-decimal';
|
|
2
|
+
import { OCD_DECIMAL_UNIT } from '../../types/on-chain-decimal';
|
|
3
|
+
import { InterestOracleDatum } from './types-new';
|
|
10
4
|
|
|
11
5
|
const unitaryInterestPrecision = 1_000_000_000_000_000_000n;
|
|
12
6
|
|
|
@@ -61,25 +55,3 @@ export function calculateAccruedInterest(
|
|
|
61
55
|
);
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Calculate the amount of interest needed to achieve 100% collateral ratio.
|
|
67
|
-
*/
|
|
68
|
-
export function computeInterestLovelacesFor100PercentCR(
|
|
69
|
-
collateral: bigint,
|
|
70
|
-
mintedAmt: bigint,
|
|
71
|
-
price: OnChainDecimal,
|
|
72
|
-
): bigint {
|
|
73
|
-
const amt = ocdCeil(
|
|
74
|
-
ocdAdd(
|
|
75
|
-
{ getOnChainInt: collateral * OCD_DECIMAL_UNIT },
|
|
76
|
-
ocdMul({ getOnChainInt: -mintedAmt * OCD_DECIMAL_UNIT }, price),
|
|
77
|
-
),
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
if (amt <= 0) {
|
|
81
|
-
return 0n;
|
|
82
|
-
} else {
|
|
83
|
-
return amt;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -10,7 +10,7 @@ export function mkInterestOracleValidator(
|
|
|
10
10
|
params: InterestOracleParams,
|
|
11
11
|
): SpendingValidator {
|
|
12
12
|
return {
|
|
13
|
-
type: '
|
|
13
|
+
type: 'PlutusV3',
|
|
14
14
|
script: applyParamsToScript(_interestOracleValidator.cborHex, [
|
|
15
15
|
castInterestOracleParams(params),
|
|
16
16
|
]),
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
+
fromHex,
|
|
2
3
|
fromText,
|
|
3
4
|
LucidEvolution,
|
|
5
|
+
OutRef,
|
|
6
|
+
slotToUnixTime,
|
|
4
7
|
toUnit,
|
|
5
8
|
TxBuilder,
|
|
6
9
|
UTxO,
|
|
7
10
|
validatorToAddress,
|
|
8
11
|
} from '@lucid-evolution/lucid';
|
|
9
|
-
import {
|
|
10
|
-
import { AssetClass } from '../../types/generic';
|
|
11
|
-
import {
|
|
12
|
-
InterestOracleParams,
|
|
13
|
-
parseInterestOracleDatum,
|
|
14
|
-
serialiseFeedInterestOracleRedeemer,
|
|
15
|
-
serialiseInterestOracleDatum,
|
|
16
|
-
} from './types';
|
|
12
|
+
import { InterestOracleParams } from './types';
|
|
17
13
|
import { oneShotMintTx } from '../one-shot/transactions';
|
|
18
14
|
import { mkInterestOracleValidator } from './scripts';
|
|
19
15
|
import { findInterestOracle } from '../../../tests/queries/interest-oracle-queries';
|
|
20
16
|
import { ONE_SECOND } from '../../utils/time-helpers';
|
|
21
17
|
import { calculateUnitaryInterestSinceOracleLastUpdated } from '../interest-oracle/helpers';
|
|
22
18
|
import { getInlineDatumOrThrow } from '../../utils/lucid-utils';
|
|
19
|
+
import { AssetClass } from '@3rd-eye-labs/cardano-offchain-common';
|
|
20
|
+
import {
|
|
21
|
+
parseInterestOracleDatum,
|
|
22
|
+
serialiseFeedInterestOracleRedeemer,
|
|
23
|
+
serialiseInterestOracleDatum,
|
|
24
|
+
} from './types-new';
|
|
23
25
|
|
|
24
26
|
export async function startInterestOracle(
|
|
25
27
|
initialUnitaryInterest: bigint,
|
|
@@ -29,19 +31,19 @@ export async function startInterestOracle(
|
|
|
29
31
|
lucid: LucidEvolution,
|
|
30
32
|
interestTokenName?: string,
|
|
31
33
|
withScriptRef: boolean = false,
|
|
32
|
-
|
|
34
|
+
refOutRef?: OutRef,
|
|
33
35
|
): Promise<[TxBuilder, AssetClass]> {
|
|
34
36
|
const network = lucid.config().network!;
|
|
35
37
|
|
|
36
38
|
const tokenName = interestTokenName ?? 'INTEREST_ORACLE';
|
|
37
|
-
if (!
|
|
38
|
-
|
|
39
|
+
if (!refOutRef) {
|
|
40
|
+
refOutRef = (await lucid.wallet().getUtxos())[0];
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
const [tx, policyId] = await oneShotMintTx(lucid, {
|
|
42
44
|
referenceOutRef: {
|
|
43
|
-
txHash:
|
|
44
|
-
outputIdx: BigInt(
|
|
45
|
+
txHash: refOutRef.txHash,
|
|
46
|
+
outputIdx: BigInt(refOutRef.outputIndex),
|
|
45
47
|
},
|
|
46
48
|
mintAmounts: [
|
|
47
49
|
{
|
|
@@ -83,8 +85,8 @@ export async function startInterestOracle(
|
|
|
83
85
|
return [
|
|
84
86
|
tx,
|
|
85
87
|
{
|
|
86
|
-
currencySymbol: policyId,
|
|
87
|
-
tokenName: fromText(tokenName),
|
|
88
|
+
currencySymbol: fromHex(policyId),
|
|
89
|
+
tokenName: fromHex(fromText(tokenName)),
|
|
88
90
|
},
|
|
89
91
|
];
|
|
90
92
|
}
|
|
@@ -93,6 +95,7 @@ export async function feedInterestOracle(
|
|
|
93
95
|
params: InterestOracleParams,
|
|
94
96
|
newInterestRate: bigint,
|
|
95
97
|
lucid: LucidEvolution,
|
|
98
|
+
currentSlot: number,
|
|
96
99
|
assetClass?: AssetClass,
|
|
97
100
|
utxo?: UTxO,
|
|
98
101
|
scriptRef?: UTxO,
|
|
@@ -103,7 +106,9 @@ export async function feedInterestOracle(
|
|
|
103
106
|
utxo = await findInterestOracle(lucid, assetClass);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
const
|
|
109
|
+
const network = lucid.config().network!;
|
|
110
|
+
const now = BigInt(slotToUnixTime(network, currentSlot));
|
|
111
|
+
|
|
107
112
|
const tx = lucid.newTx();
|
|
108
113
|
const datum = parseInterestOracleDatum(getInlineDatumOrThrow(utxo!));
|
|
109
114
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TSchema, Data } from '@evolution-sdk/evolution';
|
|
2
|
+
import { OnChainDecimalSchema } from '../../types/on-chain-decimal';
|
|
3
|
+
|
|
4
|
+
export const InterestOracleDatumSchema = TSchema.Struct({
|
|
5
|
+
unitaryInterest: TSchema.Integer,
|
|
6
|
+
interestRate: OnChainDecimalSchema,
|
|
7
|
+
lastUpdated: TSchema.Integer,
|
|
8
|
+
});
|
|
9
|
+
export type InterestOracleDatum = typeof InterestOracleDatumSchema.Type;
|
|
10
|
+
|
|
11
|
+
const InterestOracleRedeemerSchema = TSchema.Struct({
|
|
12
|
+
newInterestRate: OnChainDecimalSchema,
|
|
13
|
+
currentTime: TSchema.Integer,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type InterestOracleRedeemer = typeof InterestOracleRedeemerSchema.Type;
|
|
17
|
+
|
|
18
|
+
export function serialiseFeedInterestOracleRedeemer(
|
|
19
|
+
redeemer: InterestOracleRedeemer,
|
|
20
|
+
): string {
|
|
21
|
+
return Data.withSchema(InterestOracleRedeemerSchema).toCBORHex(redeemer);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function parseInterestOracleDatum(datum: string): InterestOracleDatum {
|
|
25
|
+
return Data.withSchema(InterestOracleDatumSchema).fromCBORHex(datum);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function serialiseInterestOracleDatum(
|
|
29
|
+
datum: InterestOracleDatum,
|
|
30
|
+
): string {
|
|
31
|
+
return Data.withSchema(InterestOracleDatumSchema).toCBORHex(datum);
|
|
32
|
+
}
|
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
import { Data
|
|
2
|
-
import { OnChainDecimalSchema } from '../../types/on-chain-decimal';
|
|
3
|
-
|
|
4
|
-
export const InterestOracleDatumSchema = Data.Object({
|
|
5
|
-
unitaryInterest: Data.Integer(),
|
|
6
|
-
interestRate: OnChainDecimalSchema,
|
|
7
|
-
lastUpdated: Data.Integer(),
|
|
8
|
-
});
|
|
9
|
-
export type InterestOracleDatum = Data.Static<typeof InterestOracleDatumSchema>;
|
|
10
|
-
const InterestOracleDatum =
|
|
11
|
-
InterestOracleDatumSchema as unknown as InterestOracleDatum;
|
|
12
|
-
|
|
13
|
-
export function parseInterestOracleDatum(datum: Datum): InterestOracleDatum {
|
|
14
|
-
return Data.from<InterestOracleDatum>(datum, InterestOracleDatum);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function serialiseInterestOracleDatum(
|
|
18
|
-
datum: InterestOracleDatum,
|
|
19
|
-
): Datum {
|
|
20
|
-
return Data.to<InterestOracleDatum>(datum, InterestOracleDatum);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const FeedInterestOracleRedeemerSchema = Data.Object({
|
|
24
|
-
newInterestRate: OnChainDecimalSchema,
|
|
25
|
-
currentTime: Data.Integer(),
|
|
26
|
-
});
|
|
27
|
-
export type FeedInterestOracleRedeemer = Data.Static<
|
|
28
|
-
typeof FeedInterestOracleRedeemerSchema
|
|
29
|
-
>;
|
|
30
|
-
const FeedInterestOracleRedeemer =
|
|
31
|
-
FeedInterestOracleRedeemerSchema as unknown as FeedInterestOracleRedeemer;
|
|
32
|
-
|
|
33
|
-
export function serialiseFeedInterestOracleRedeemer(
|
|
34
|
-
redeemer: FeedInterestOracleRedeemer,
|
|
35
|
-
): Datum {
|
|
36
|
-
return Data.to<FeedInterestOracleRedeemer>(
|
|
37
|
-
redeemer,
|
|
38
|
-
FeedInterestOracleRedeemer,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
1
|
+
import { Data } from '@lucid-evolution/lucid';
|
|
41
2
|
|
|
42
3
|
export const InterestOracleParamsSchema = Data.Object({
|
|
43
4
|
/** Milliseconds */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addAssets,
|
|
3
3
|
Assets,
|
|
4
|
-
Constr,
|
|
5
4
|
Data,
|
|
6
5
|
LucidEvolution,
|
|
7
6
|
mintingPolicyToId,
|
|
@@ -45,7 +44,7 @@ export async function oneShotMintTx(
|
|
|
45
44
|
[toUnit(policyId, entry.tokenName)]: entry.amount,
|
|
46
45
|
}),
|
|
47
46
|
)(params.mintAmounts),
|
|
48
|
-
Data.
|
|
47
|
+
Data.void(),
|
|
49
48
|
)
|
|
50
49
|
.attach.MintingPolicy(oneShotPolicy),
|
|
51
50
|
policyId,
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
calculateTotalVestedRewards,
|
|
3
|
-
calculateTotalVestedTeam,
|
|
4
|
-
} from '../vesting/helpers';
|
|
5
|
-
import { PollStatus } from './types-poll';
|
|
6
1
|
import { ocdDiv, OnChainDecimal } from '../../types/on-chain-decimal';
|
|
2
|
+
import { PollStatus } from './types-poll-new';
|
|
7
3
|
|
|
8
|
-
function q(
|
|
9
|
-
initialIndyDist: bigint,
|
|
10
|
-
pollStatus: PollStatus,
|
|
11
|
-
currentTime: bigint,
|
|
12
|
-
treasuryIndyWithdrawnAmt: bigint,
|
|
13
|
-
): OnChainDecimal {
|
|
4
|
+
function q(pollStatus: PollStatus, e: bigint): OnChainDecimal {
|
|
14
5
|
if (pollStatus.yesVotes + pollStatus.noVotes === 0n)
|
|
15
6
|
return { getOnChainInt: 0n };
|
|
16
7
|
else {
|
|
17
|
-
const e =
|
|
18
|
-
treasuryIndyWithdrawnAmt +
|
|
19
|
-
calculateTotalVestedRewards(currentTime) +
|
|
20
|
-
calculateTotalVestedTeam(currentTime) +
|
|
21
|
-
initialIndyDist;
|
|
22
|
-
|
|
23
8
|
const q =
|
|
24
9
|
ocdDiv(
|
|
25
10
|
{ getOnChainInt: pollStatus.yesVotes },
|
|
@@ -36,20 +21,17 @@ function q(
|
|
|
36
21
|
},
|
|
37
22
|
).getOnChainInt;
|
|
38
23
|
|
|
39
|
-
return { getOnChainInt: BigInt(q)
|
|
24
|
+
return { getOnChainInt: BigInt(q) };
|
|
40
25
|
}
|
|
41
26
|
}
|
|
42
27
|
|
|
43
28
|
export function pollPassQuorum(
|
|
44
|
-
initialIndyDist: bigint,
|
|
45
29
|
pollStatus: PollStatus,
|
|
46
|
-
|
|
30
|
+
electorate: bigint,
|
|
47
31
|
minQuorum: bigint,
|
|
48
|
-
treasuryIndyWithdrawnAmt: bigint,
|
|
49
32
|
): boolean {
|
|
50
33
|
return (
|
|
51
34
|
pollStatus.yesVotes + pollStatus.noVotes >= minQuorum &&
|
|
52
|
-
q(
|
|
53
|
-
.getOnChainInt > 50_000n
|
|
35
|
+
q(pollStatus, electorate).getOnChainInt > 50_000n
|
|
54
36
|
);
|
|
55
37
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
PollManagerParamsSP,
|
|
8
8
|
PollShardParamsSP,
|
|
9
|
-
|
|
9
|
+
fromSystemParamsAssetLucid,
|
|
10
10
|
} from '../../types/system-params';
|
|
11
11
|
import { castPollShardParams, PollShardParams } from './types-poll-shard';
|
|
12
12
|
import { _pollManagerValidator } from '../../validators/poll-manager-validator';
|
|
@@ -16,7 +16,7 @@ export const mkPollManagerValidator = (
|
|
|
16
16
|
params: PollManagerParams,
|
|
17
17
|
): SpendingValidator => {
|
|
18
18
|
return {
|
|
19
|
-
type: '
|
|
19
|
+
type: 'PlutusV3',
|
|
20
20
|
script: applyParamsToScript(_pollManagerValidator.cborHex, [
|
|
21
21
|
castPollManagerParams(params),
|
|
22
22
|
]),
|
|
@@ -27,18 +27,17 @@ export const mkPollManagerValidatorFromSP = (
|
|
|
27
27
|
params: PollManagerParamsSP,
|
|
28
28
|
): SpendingValidator => {
|
|
29
29
|
return {
|
|
30
|
-
type: '
|
|
30
|
+
type: 'PlutusV3',
|
|
31
31
|
script: applyParamsToScript(_pollManagerValidator.cborHex, [
|
|
32
32
|
castPollManagerParams({
|
|
33
|
-
govNFT:
|
|
34
|
-
pollToken:
|
|
35
|
-
upgradeToken:
|
|
36
|
-
indyAsset:
|
|
33
|
+
govNFT: fromSystemParamsAssetLucid(params.govNFT),
|
|
34
|
+
pollToken: fromSystemParamsAssetLucid(params.pollToken),
|
|
35
|
+
upgradeToken: fromSystemParamsAssetLucid(params.upgradeToken),
|
|
36
|
+
indyAsset: fromSystemParamsAssetLucid(params.indyAsset),
|
|
37
37
|
govExecuteValHash: params.govExecuteValHash,
|
|
38
38
|
pBiasTime: BigInt(params.pBiasTime),
|
|
39
39
|
shardValHash: params.shardsValHash,
|
|
40
40
|
treasuryValHash: params.treasuryValHash,
|
|
41
|
-
initialIndyDistribution: BigInt(params.initialIndyDistribution),
|
|
42
41
|
}),
|
|
43
42
|
]),
|
|
44
43
|
};
|
|
@@ -48,7 +47,7 @@ export const mkPollShardValidator = (
|
|
|
48
47
|
params: PollShardParams,
|
|
49
48
|
): SpendingValidator => {
|
|
50
49
|
return {
|
|
51
|
-
type: '
|
|
50
|
+
type: 'PlutusV3',
|
|
52
51
|
script: applyParamsToScript(_pollShardValidator.cborHex, [
|
|
53
52
|
castPollShardParams(params),
|
|
54
53
|
]),
|
|
@@ -59,12 +58,12 @@ export const mkPollShardValidatorFromSP = (
|
|
|
59
58
|
params: PollShardParamsSP,
|
|
60
59
|
): SpendingValidator => {
|
|
61
60
|
return {
|
|
62
|
-
type: '
|
|
61
|
+
type: 'PlutusV3',
|
|
63
62
|
script: applyParamsToScript(_pollShardValidator.cborHex, [
|
|
64
63
|
castPollShardParams({
|
|
65
|
-
pollToken:
|
|
66
|
-
stakingToken:
|
|
67
|
-
indyAsset:
|
|
64
|
+
pollToken: fromSystemParamsAssetLucid(params.pollToken),
|
|
65
|
+
stakingToken: fromSystemParamsAssetLucid(params.stakingToken),
|
|
66
|
+
indyAsset: fromSystemParamsAssetLucid(params.indyAsset),
|
|
68
67
|
stakingValHash: params.stakingValHash,
|
|
69
68
|
}),
|
|
70
69
|
]),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Data
|
|
1
|
+
import { Data } from '@lucid-evolution/lucid';
|
|
2
2
|
import { AssetClassSchema } from '../../types/generic';
|
|
3
3
|
|
|
4
4
|
const PollManagerParamsSchema = Data.Object({
|
|
@@ -10,29 +10,11 @@ const PollManagerParamsSchema = Data.Object({
|
|
|
10
10
|
pBiasTime: Data.Integer(),
|
|
11
11
|
shardValHash: Data.Bytes(),
|
|
12
12
|
treasuryValHash: Data.Bytes(),
|
|
13
|
-
initialIndyDistribution: Data.Integer(),
|
|
14
13
|
});
|
|
15
14
|
export type PollManagerParams = Data.Static<typeof PollManagerParamsSchema>;
|
|
16
15
|
export const PollManagerParams =
|
|
17
16
|
PollManagerParamsSchema as unknown as PollManagerParams;
|
|
18
17
|
|
|
19
|
-
const PollManagerRedeemerSchema = Data.Enum([
|
|
20
|
-
Data.Object({
|
|
21
|
-
EndPoll: Data.Object({ currentTime: Data.Integer() }),
|
|
22
|
-
}),
|
|
23
|
-
Data.Object({ CreateShards: Data.Object({ currentTime: Data.Integer() }) }),
|
|
24
|
-
Data.Object({
|
|
25
|
-
MergeShardsManager: Data.Object({ currentTime: Data.Integer() }),
|
|
26
|
-
}),
|
|
27
|
-
]);
|
|
28
|
-
export type PollManagerRedeemer = Data.Static<typeof PollManagerRedeemerSchema>;
|
|
29
|
-
export const PollManagerRedeemer =
|
|
30
|
-
PollManagerRedeemerSchema as unknown as PollManagerRedeemer;
|
|
31
|
-
|
|
32
|
-
export function serialisePollManagerRedeemer(r: PollManagerRedeemer): Redeemer {
|
|
33
|
-
return Data.to<PollManagerRedeemer>(r, PollManagerRedeemer);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
18
|
export function castPollManagerParams(params: PollManagerParams): Data {
|
|
37
19
|
return Data.castTo(params, PollManagerParams);
|
|
38
20
|
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { TSchema, Data } from '@evolution-sdk/evolution';
|
|
2
|
+
import {
|
|
3
|
+
ProposalContentSchema,
|
|
4
|
+
TreasuryWithdrawalSchema,
|
|
5
|
+
} from '../gov/types-new';
|
|
6
|
+
import {
|
|
7
|
+
AddressSchema,
|
|
8
|
+
OutputReferenceSchema,
|
|
9
|
+
} from '@3rd-eye-labs/cardano-offchain-common';
|
|
10
|
+
import { option as O, function as F } from 'fp-ts';
|
|
11
|
+
import { match, P } from 'ts-pattern';
|
|
12
|
+
import { DEFAULT_SCHEMA_OPTIONS } from '../../types/evolution-schema-options';
|
|
13
|
+
|
|
14
|
+
const PollStatusSchema = TSchema.Struct({
|
|
15
|
+
yesVotes: TSchema.Integer,
|
|
16
|
+
noVotes: TSchema.Integer,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type PollStatus = typeof PollStatusSchema.Type;
|
|
20
|
+
|
|
21
|
+
const PollManagerContentSchema = TSchema.Struct({
|
|
22
|
+
pollId: TSchema.Integer,
|
|
23
|
+
pollOwner: TSchema.ByteArray,
|
|
24
|
+
content: ProposalContentSchema,
|
|
25
|
+
treasuryWithdrawal: TSchema.NullOr(TreasuryWithdrawalSchema),
|
|
26
|
+
status: PollStatusSchema,
|
|
27
|
+
votingEndTime: TSchema.Integer,
|
|
28
|
+
createdShardsCount: TSchema.Integer,
|
|
29
|
+
talliedShardsCount: TSchema.Integer,
|
|
30
|
+
totalShardsCount: TSchema.Integer,
|
|
31
|
+
proposingEndTime: TSchema.Integer,
|
|
32
|
+
expirationTime: TSchema.Integer,
|
|
33
|
+
protocolVersion: TSchema.Integer,
|
|
34
|
+
minimumQuorum: TSchema.Integer,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type PollManagerContent = typeof PollManagerContentSchema.Type;
|
|
38
|
+
|
|
39
|
+
const PollShardContentSchema = TSchema.Struct({
|
|
40
|
+
pollId: TSchema.Integer,
|
|
41
|
+
status: PollStatusSchema,
|
|
42
|
+
votingEndTime: TSchema.Integer,
|
|
43
|
+
managerAddress: AddressSchema,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export type PollShardContent = typeof PollShardContentSchema.Type;
|
|
47
|
+
|
|
48
|
+
const PollDatumSchema = TSchema.Union(
|
|
49
|
+
TSchema.Struct(
|
|
50
|
+
{
|
|
51
|
+
PollManager: PollManagerContentSchema,
|
|
52
|
+
},
|
|
53
|
+
{ flatInUnion: true },
|
|
54
|
+
),
|
|
55
|
+
TSchema.Struct({ PollShard: PollShardContentSchema }, { flatInUnion: true }),
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export type PollDatum = typeof PollDatumSchema.Type;
|
|
59
|
+
|
|
60
|
+
const VoteOptionSchema = TSchema.Union(
|
|
61
|
+
TSchema.Literal('Yes', { flatInUnion: true }),
|
|
62
|
+
TSchema.Literal('No', { flatInUnion: true }),
|
|
63
|
+
);
|
|
64
|
+
export type VoteOption = typeof VoteOptionSchema.Type;
|
|
65
|
+
|
|
66
|
+
const PollShardRedeemerSchema = TSchema.Union(
|
|
67
|
+
TSchema.Struct({ Vote: VoteOptionSchema }, { flatInUnion: true }),
|
|
68
|
+
TSchema.Struct(
|
|
69
|
+
{
|
|
70
|
+
MergeShards: TSchema.Struct(
|
|
71
|
+
{
|
|
72
|
+
currentTime: TSchema.Integer,
|
|
73
|
+
pollManagerRef: OutputReferenceSchema,
|
|
74
|
+
},
|
|
75
|
+
{ flatFields: true },
|
|
76
|
+
),
|
|
77
|
+
},
|
|
78
|
+
{ flatInUnion: true },
|
|
79
|
+
),
|
|
80
|
+
);
|
|
81
|
+
export type PollShardRedeemer = typeof PollShardRedeemerSchema.Type;
|
|
82
|
+
|
|
83
|
+
const PollManagerRedeemerSchema = TSchema.Union(
|
|
84
|
+
TSchema.Struct(
|
|
85
|
+
{
|
|
86
|
+
EndPoll: TSchema.Struct(
|
|
87
|
+
{ currentTime: TSchema.Integer },
|
|
88
|
+
{ flatFields: true },
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
{ flatInUnion: true },
|
|
92
|
+
),
|
|
93
|
+
TSchema.Struct(
|
|
94
|
+
{
|
|
95
|
+
CreateShards: TSchema.Struct(
|
|
96
|
+
{ currentTime: TSchema.Integer },
|
|
97
|
+
{ flatFields: true },
|
|
98
|
+
),
|
|
99
|
+
},
|
|
100
|
+
{ flatInUnion: true },
|
|
101
|
+
),
|
|
102
|
+
TSchema.Struct(
|
|
103
|
+
{
|
|
104
|
+
MergeShardsManager: TSchema.Struct(
|
|
105
|
+
{ currentTime: TSchema.Integer },
|
|
106
|
+
{ flatFields: true },
|
|
107
|
+
),
|
|
108
|
+
},
|
|
109
|
+
{ flatInUnion: true },
|
|
110
|
+
),
|
|
111
|
+
);
|
|
112
|
+
export type PollManagerRedeemer = typeof PollManagerRedeemerSchema.Type;
|
|
113
|
+
|
|
114
|
+
export function serialisePollManagerRedeemer(r: PollManagerRedeemer): string {
|
|
115
|
+
return Data.withSchema(PollManagerRedeemerSchema).toCBORHex(r);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function serialisePollShardRedeemer(r: PollShardRedeemer): string {
|
|
119
|
+
return Data.withSchema(PollShardRedeemerSchema).toCBORHex(r);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function parsePollManager(datum: string): O.Option<PollManagerContent> {
|
|
123
|
+
try {
|
|
124
|
+
return match(
|
|
125
|
+
Data.withSchema(PollDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
126
|
+
datum,
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
.with({ PollManager: P.select() }, (res) => O.some(res))
|
|
130
|
+
.otherwise(() => O.none);
|
|
131
|
+
} catch (_) {
|
|
132
|
+
return O.none;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function parsePollManagerOrThrow(datum: string): PollManagerContent {
|
|
137
|
+
return F.pipe(
|
|
138
|
+
parsePollManager(datum),
|
|
139
|
+
O.match(() => {
|
|
140
|
+
throw new Error('Expected a poll manager datum.');
|
|
141
|
+
}, F.identity),
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function parsePollShard(datum: string): O.Option<PollShardContent> {
|
|
146
|
+
try {
|
|
147
|
+
return match(
|
|
148
|
+
Data.withSchema(PollDatumSchema, DEFAULT_SCHEMA_OPTIONS).fromCBORHex(
|
|
149
|
+
datum,
|
|
150
|
+
),
|
|
151
|
+
)
|
|
152
|
+
.with({ PollShard: P.select() }, (res) => O.some(res))
|
|
153
|
+
.otherwise(() => O.none);
|
|
154
|
+
} catch (_) {
|
|
155
|
+
return O.none;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function parsePollShardOrThrow(datum: string): PollShardContent {
|
|
160
|
+
return F.pipe(
|
|
161
|
+
parsePollShard(datum),
|
|
162
|
+
O.match(() => {
|
|
163
|
+
throw new Error('Expected a poll shard datum.');
|
|
164
|
+
}, F.identity),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function serialisePollDatum(d: PollDatum): string {
|
|
169
|
+
return Data.withSchema(PollDatumSchema).toCBORHex(d);
|
|
170
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Data
|
|
2
|
-
import { AssetClassSchema
|
|
1
|
+
import { Data } from '@lucid-evolution/lucid';
|
|
2
|
+
import { AssetClassSchema } from '../../types/generic';
|
|
3
3
|
|
|
4
4
|
const PollShardParamsSchema = Data.Object({
|
|
5
5
|
pollToken: AssetClassSchema,
|
|
@@ -11,28 +11,6 @@ export type PollShardParams = Data.Static<typeof PollShardParamsSchema>;
|
|
|
11
11
|
export const PollShardParams =
|
|
12
12
|
PollShardParamsSchema as unknown as PollShardParams;
|
|
13
13
|
|
|
14
|
-
const VoteOptionSchema = Data.Enum([Data.Literal('Yes'), Data.Literal('No')]);
|
|
15
|
-
export type VoteOption = Data.Static<typeof VoteOptionSchema>;
|
|
16
|
-
|
|
17
|
-
const PollShardRedeemerSchema = Data.Enum([
|
|
18
|
-
Data.Object({ Vote: Data.Object({ content: VoteOptionSchema }) }),
|
|
19
|
-
Data.Object({
|
|
20
|
-
MergeShards: Data.Object({
|
|
21
|
-
currentTime: Data.Integer(),
|
|
22
|
-
pollManagerRef: OutputReferenceSchema,
|
|
23
|
-
}),
|
|
24
|
-
}),
|
|
25
|
-
]);
|
|
26
|
-
export type PollShardRedeemer = Data.Static<typeof PollShardRedeemerSchema>;
|
|
27
|
-
export const PollShardRedeemer =
|
|
28
|
-
PollShardRedeemerSchema as unknown as PollShardRedeemer;
|
|
29
|
-
|
|
30
|
-
export function serialisePollShardRedeemer(
|
|
31
|
-
redeemer: PollShardRedeemer,
|
|
32
|
-
): Redeemer {
|
|
33
|
-
return Data.to<PollShardRedeemer>(redeemer, PollShardRedeemer);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
14
|
export function castPollShardParams(params: PollShardParams): Data {
|
|
37
15
|
return Data.castTo(params, PollShardParams);
|
|
38
16
|
}
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
slotToUnixTime,
|
|
4
4
|
unixTimeToSlot,
|
|
5
5
|
} from '@lucid-evolution/lucid';
|
|
6
|
-
import { ONE_SECOND } from '../../utils/time-helpers';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Calculates the validity range based on the oracle expiration,
|
|
@@ -18,9 +17,7 @@ export function oracleExpirationAwareValidity(
|
|
|
18
17
|
validFrom: number;
|
|
19
18
|
validTo: number;
|
|
20
19
|
} {
|
|
21
|
-
const validateFrom =
|
|
22
|
-
slotToUnixTime(network, currentSlot - 1) -
|
|
23
|
-
Math.min(120 * ONE_SECOND, biasTime - ONE_SECOND);
|
|
20
|
+
const validateFrom = slotToUnixTime(network, currentSlot - 1);
|
|
24
21
|
const defaultValidateTo = validateFrom + biasTime;
|
|
25
22
|
/// Take the oracle expiration time - 1 slot which is the last acceptable non-expired valid_to time
|
|
26
23
|
/// for the current oracle.
|
|
@@ -4,19 +4,14 @@ import {
|
|
|
4
4
|
SpendingValidator,
|
|
5
5
|
} from '@lucid-evolution/lucid';
|
|
6
6
|
import { castPriceOracleParams, PriceOracleParams } from './types';
|
|
7
|
-
|
|
8
|
-
const priceOracleValidatorData = {
|
|
9
|
-
type: 'PlutusV2' as ScriptType,
|
|
10
|
-
cborHex:
|
|
11
|
-
'590ba5590ba20100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323233027222232325335333006533357346074607e0022646605a60586ae84004dd69aba135744002607c00206e64a666ae68c0ecc1000044c8c8c848cc00400c008c0b8d5d09aba2002375a6ae84004c0fc0040e0dd50022999ab9a303a303f002132321233001003002357426ae88c0fc00cd5d0981f00101b8890008a99ab9c49103505435001637540086ea8004cc09c8888c8d4014888d40188c88c94cd54cd4ccd54c0d40e0c0a80a4c0ac01ccc0b08004d40048888888888880100e44cd5ce24812d546865207472616e73616374696f6e206973206e6f74207369676e6564206279206f7261636c65206f776e657200030132533553355335333553036039302b02a253335302135001202103e215333573466ebcc118cd5d0182319aba0375000a6ec4080cd5d01ba835500b03937620400022a66a666036446a0044466603e446a00444a666ae68c12c004400c4cc11848ccc00401c00c00800c00c0040c0cd54c0e80ec8d400488cc0e0008cd54c0f40f88d400488cc0ec008ccd4004dc0a4000e048cdc0800a400000266aa607407646a0024466070004666a002466aa607c07e46a0024466078004604600200244666038066004002466aa607c07e46a0024466078004604000200266602e05c666050400204e6a004404e0060784426a004444a66a0082a666ae68cdd78018238a999ab9a3375e00408e2a666ae68cdc4000a400006e2666ae68cdc4800a410125e80206a07006e06e44072064407e6044014074266ae712401024c310003103a1335738921156f757470757420646f6573206e6f74206d6174636800031153355333573466e2400d20001335738921165072696365206d75737420626520706f7369746976650003103a15335533535353301275a6a00407e06e44a666a00442a666ae68cdc419b8000100935500c03a0331333573466e24004d540300e80c40d00c80c84d4cc049d69a80101f911a801112999a99980980a980f19b8100900b0021533500113330120150030081333012015003008034133301201500300803003a13357389212345787069726174696f6e2074696d65206973206e6f742070726f7065726c792073657400031030030333025200102435302635533530270092100116036202402f302d350080393302f3016337000020060542a666a602e6aa66a60320022602602a442a66a0022004442602e032402e02842a66a6666666ae900048c94ccd5cd181d98200008991999aab9f001202d23233335573e002405e46666aae7cd5d1001119299a9999999aba400123253335734608660900022646666aae7c00480d48cccd55cf9aba20022533530203574200642605e00206a406c07a078608e0020646ea800880c880c880c880c80e4854cd4c070d5d08029098159981a8010008188181aba1005203003703635744004068607e0020546ea800880a880a880a880a80c48400405480548c94ccd5cd181b181d800899191919091998008028018011bad357426ae88008dd69aba10013574460760046ae84c0e80040ccdd50009111a801111a801912999a9998040038020010a99a8018800819814819911192999a80190a999a80190a999a80290980200b0980180a8a999a80210980200b0980180a80c0060a999a80210980180a8980100a0a999a80190980180a8980100a00b8a999a801100700b0068a999a80110a999a80210980180a8980100a0a999a80190980180a8980100a00b8058a999a80190980100a098008098a999a80110980100a0980080980b12999a80110a999a80210a999a802109998040038010008b0b0b0060a999a80190a999a801909998038030010008b0b0b00580691a80091111111003891999999980091199ab9a3370e00400204004644a666ae68cdc38010008098a999ab9a3371200400201401044666ae68cdc400100081001191199ab9a3371200400204004644666ae68cdc480100081181011199ab9a3371000400204604044a666ae68cdc480100088008801112999ab9a33712004002200420024464a666ae68c0c8c0dc0044c8c8cc0994ccd5cd181a181c801099813198038029aba130380023006357426ae88c0e00080c54ccd5cd181a181c800899813198038029aba130380013006357426ae88c0e00040c4dd51aba135744606e0046ea8d5d0981b0008179baa0012325333573460620020522a666ae68c0c000407c0b4c0d0dd50009119192999ab9a303300100815333573460640022601460086ae84c0d400854ccd5cd1818800803017181a8009baa00122233355302302702a335530260272350012233024002300b001333553023027223500222533533355302802b301d01c235001223300a002005006100313302e00400301c001335530260272350012233024002330382253350011300a003221350022253353300c002008112223300200a0041300600300400211009212223001004112220012230302253350011003221330060023004001212223003004233333335748002403040304030460206eb4008806007c94cd5ce2481286578706563746564206f6e6c7920612073696e676c6520636f6e74696e75696e67206f7574707574001615335738920117496e76616c696420646174756d20696e206f757470757400164988880088c8c94ccd5cd1813000899091118010021aba13028002153335734604a002264244460020086ae84c0a000854ccd5cd181200080201098140009baa00111003253353007001213335530150192235300535300935003019222200422353007350042222004225333573466ebc01000854ccd5cd19baf0030011330220060051005100500e3300d00735300f3500201b22222222222200a15335738921024c660016232533357346040604a0022646424660020060046ae84d5d118128011aba1302400101d3754002444006660024002eb4888cc09088cccd55cf80090071191980e9980a180398138009803181300098021aba2003357420040306eac0048c94ccd5cd180e181080089919191919190919998008038028018011aba1357440046ae84004d5d10011aba10013574460420046ae84c080004064dd5000919191999aa999ab9a3370e90030008990911118020029aba13020002153335734603c00226424444600400a6ae84c08000854ccd5cd180e8008990911118008029aba13020002153335734603800226424444600600a6ae84c0800080648034803480348ccd54c048054cc03c894cd40088400c400403494ccd5cd19baf002350010181300600100d3300923253335734603e60480022646424660020060046ae84d5d118120011aba1302300101c37540026a60166a00802e44444444444401860400026ea8d40040408488c00800c48cc004894cd400804c40040208cc02488ccd400c04c008004d400403488ccd5cd19baf002001004007223301c2233335573e002400c466028600a6ae84008c00cd5d10010081bac001100d23253335734602860320022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d1180c8011aba1301800101137540022002200c464a666ae68c044c0580044dd69aba1301500100e37540024424660020060044446006600400260244422444a66a00220044426600a004666aa600e01600a00800260224422444a66a00226a00600c442666a00a0186008004666aa600e01400a00800244002601e442244a66a00200c44266014600800466aa600c00e00800224002220024400444244660020080062a66ae712411f496e76616c696420646174756d20746f20636865636b4f776e4f757470757400161533573892010350543100162222222222220054c1014000370e90001b8748008dc3a40086e9520005573caae748c8c00400488cc00cc008008005',
|
|
12
|
-
};
|
|
7
|
+
import { _priceOracleValidator } from '../../validators/price-oracle-validator';
|
|
13
8
|
|
|
14
9
|
export function mkPriceOracleValidator(
|
|
15
10
|
params: PriceOracleParams,
|
|
16
11
|
): SpendingValidator {
|
|
17
12
|
return {
|
|
18
|
-
type:
|
|
19
|
-
script: applyParamsToScript(
|
|
13
|
+
type: 'PlutusV3' as ScriptType,
|
|
14
|
+
script: applyParamsToScript(_priceOracleValidator.cborHex, [
|
|
20
15
|
castPriceOracleParams(params),
|
|
21
16
|
]),
|
|
22
17
|
};
|