@indigo-labs/indigo-sdk 0.2.38 → 0.2.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +35 -47
- package/dist/index.d.ts +35 -47
- package/dist/index.js +48 -81
- package/dist/index.mjs +48 -78
- package/package.json +1 -1
- package/src/index.ts +0 -3
package/dist/index.d.mts
CHANGED
|
@@ -1736,52 +1736,6 @@ declare const mkVersionRegistryValidator: () => SpendingValidator;
|
|
|
1736
1736
|
|
|
1737
1737
|
declare function treasuryFeeTx(fee: bigint, lucid: LucidEvolution, sysParams: SystemParams, tx: TxBuilder, treasury: UtxoOrOutRef): Promise<void>;
|
|
1738
1738
|
|
|
1739
|
-
declare const OracleAssetNftSchema: _lucid_evolution_lucid.TObject<{
|
|
1740
|
-
oracleNft: _lucid_evolution_lucid.TObject<{
|
|
1741
|
-
currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1742
|
-
tokenName: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1743
|
-
}>;
|
|
1744
|
-
}>;
|
|
1745
|
-
type OracleAssetNft = Data.Static<typeof OracleAssetNftSchema>;
|
|
1746
|
-
declare const PriceOracleParamsSchema: _lucid_evolution_lucid.TObject<{
|
|
1747
|
-
owner: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1748
|
-
/** Milliseconds */
|
|
1749
|
-
biasTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1750
|
-
/** Milliseconds */
|
|
1751
|
-
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1752
|
-
}>;
|
|
1753
|
-
type PriceOracleParams = Data.Static<typeof PriceOracleParamsSchema>;
|
|
1754
|
-
declare const PriceOracleDatumSchema: _lucid_evolution_lucid.TObject<{
|
|
1755
|
-
price: _lucid_evolution_lucid.TObject<{
|
|
1756
|
-
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1757
|
-
}>;
|
|
1758
|
-
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1759
|
-
}>;
|
|
1760
|
-
type PriceOracleDatum = Data.Static<typeof PriceOracleDatumSchema>;
|
|
1761
|
-
declare const PriceOracleRedeemerSchema: _lucid_evolution_lucid.TObject<{
|
|
1762
|
-
currentTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1763
|
-
newPrice: _lucid_evolution_lucid.TObject<{
|
|
1764
|
-
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1765
|
-
}>;
|
|
1766
|
-
}>;
|
|
1767
|
-
type PriceOracleRedeemer = Data.Static<typeof PriceOracleRedeemerSchema>;
|
|
1768
|
-
declare function serialisePriceOracleRedeemer(r: PriceOracleRedeemer): Redeemer;
|
|
1769
|
-
declare function parsePriceOracleDatum(datum: Datum): PriceOracleDatum;
|
|
1770
|
-
declare function serialisePriceOracleDatum(datum: PriceOracleDatum): Datum;
|
|
1771
|
-
declare function castPriceOracleParams(params: PriceOracleParams): Data;
|
|
1772
|
-
|
|
1773
|
-
declare function startPriceOracleTx(lucid: LucidEvolution, assetName: string, startPrice: OnChainDecimal, oracleParams: PriceOracleParams, now?: number, refOutRef?: OutRef): Promise<[TxBuilder, OracleAssetNft]>;
|
|
1774
|
-
declare function feedPriceOracleTx(lucid: LucidEvolution, oracle: UtxoOrOutRef, newPrice: OnChainDecimal, oracleParams: PriceOracleParams, currentSlot: number): Promise<TxBuilder>;
|
|
1775
|
-
|
|
1776
|
-
/**
|
|
1777
|
-
* Calculates the validity range based on the oracle expiration,
|
|
1778
|
-
* and caps the upper bound when necessary.
|
|
1779
|
-
*/
|
|
1780
|
-
declare function oracleExpirationAwareValidity(currentSlot: number, biasTime: number, oracleExpiration: number, network: Network): {
|
|
1781
|
-
validFrom: number;
|
|
1782
|
-
validTo: number;
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
1739
|
declare const initSpSnapshot: StabilityPoolSnapshot;
|
|
1786
1740
|
declare const initEpochToScaleToSumMap: () => EpochToScaleToSum;
|
|
1787
1741
|
declare function getSumFromEpochToScaleToSum(e2s2s: EpochToScaleToSum, epoch: bigint, scale: bigint): SPInteger | undefined;
|
|
@@ -2039,6 +1993,40 @@ declare function castExecuteParams(params: ExecuteParams): Data;
|
|
|
2039
1993
|
declare const mkExecuteValidator: (params: ExecuteParams) => SpendingValidator;
|
|
2040
1994
|
declare const mkExecuteValidatorFromSP: (params: ExecuteParamsSP) => SpendingValidator;
|
|
2041
1995
|
|
|
1996
|
+
declare const OracleAssetNftSchema: _lucid_evolution_lucid.TObject<{
|
|
1997
|
+
oracleNft: _lucid_evolution_lucid.TObject<{
|
|
1998
|
+
currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1999
|
+
tokenName: _lucid_evolution_lucid.TUnsafe<string>;
|
|
2000
|
+
}>;
|
|
2001
|
+
}>;
|
|
2002
|
+
type OracleAssetNft = Data.Static<typeof OracleAssetNftSchema>;
|
|
2003
|
+
declare const PriceOracleParamsSchema: _lucid_evolution_lucid.TObject<{
|
|
2004
|
+
owner: _lucid_evolution_lucid.TUnsafe<string>;
|
|
2005
|
+
/** Milliseconds */
|
|
2006
|
+
biasTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2007
|
+
/** Milliseconds */
|
|
2008
|
+
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2009
|
+
}>;
|
|
2010
|
+
type PriceOracleParams = Data.Static<typeof PriceOracleParamsSchema>;
|
|
2011
|
+
declare const PriceOracleDatumSchema: _lucid_evolution_lucid.TObject<{
|
|
2012
|
+
price: _lucid_evolution_lucid.TObject<{
|
|
2013
|
+
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2014
|
+
}>;
|
|
2015
|
+
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2016
|
+
}>;
|
|
2017
|
+
type PriceOracleDatum = Data.Static<typeof PriceOracleDatumSchema>;
|
|
2018
|
+
declare const PriceOracleRedeemerSchema: _lucid_evolution_lucid.TObject<{
|
|
2019
|
+
currentTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2020
|
+
newPrice: _lucid_evolution_lucid.TObject<{
|
|
2021
|
+
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2022
|
+
}>;
|
|
2023
|
+
}>;
|
|
2024
|
+
type PriceOracleRedeemer = Data.Static<typeof PriceOracleRedeemerSchema>;
|
|
2025
|
+
declare function serialisePriceOracleRedeemer(r: PriceOracleRedeemer): Redeemer;
|
|
2026
|
+
declare function parsePriceOracleDatum(datum: Datum): PriceOracleDatum;
|
|
2027
|
+
declare function serialisePriceOracleDatum(datum: PriceOracleDatum): Datum;
|
|
2028
|
+
declare function castPriceOracleParams(params: PriceOracleParams): Data;
|
|
2029
|
+
|
|
2042
2030
|
declare const ActionReturnDatumSchema: _lucid_evolution_lucid.TUnion<(_lucid_evolution_lucid.TObject<{
|
|
2043
2031
|
IndigoStabilityPoolAccountAdjustment: _lucid_evolution_lucid.TObject<{
|
|
2044
2032
|
spent_account: _lucid_evolution_lucid.TObject<{
|
|
@@ -2829,4 +2817,4 @@ declare function submitAndAwaitTx(lucid: LucidEvolution, tx: TxBuilder): Promise
|
|
|
2829
2817
|
|
|
2830
2818
|
declare function init(lucid: LucidEvolution, initialAssets: InitialAsset[], now?: number): Promise<[SystemParams, AssetInfo[]]>;
|
|
2831
2819
|
|
|
2832
|
-
export { ACCOUNT_TOKEN_NAME, ALWAYS_FAIL_VALIDATOR_HASH, type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AssetInfo, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, CDP_CREATOR_TOKEN_NAME, CDP_TOKEN_NAME, type CdpParams, type CdpParamsSP, type CollectorParamsSP, type CollectorRedeemer, CredentialD, CredentialSchema, type CurrencySymbol, DAO_TOKEN_NAME, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GOV_NFT_TOKEN_NAME, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, IASSET_TOKEN_NAME, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, INDY_TOKEN_NAME, type InitialAsset, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, NUM_CDP_CREATORS, NUM_COLLECTORS, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, POLL_MANAGER_TOKEN_NAME, PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PollStatus, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, ProposalContent, ProposalContentSchema, type ProposeAssetContent, ProtocolParams, ProtocolParamsSchema, type PubKeyHash, SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME, type SPInteger, SPIntegerSchema, STABILITY_POOL_TOKEN_NAME, STAKING_MANAGER_TOKEN_NAME, STAKING_TOKEN_NAME, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type SystemParams, TOTAL_INDY_SUPPLY, TREASURY_INDY_AMOUNT, type TokenName, TreasuryParams, type TreasuryParamsSP, TreasuryParamsSchema, type TreasuryRedeemer, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, UPGRADE_TOKEN_NAME, type UpgradePaths, type UtxoOrOutRef, VERSION_RECORD_TOKEN_NAME, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, type WithdrawalOutputDatum, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, annulRequest, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castTreasuryParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, computeInterestLovelacesFor100PercentCR, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle,
|
|
2820
|
+
export { ACCOUNT_TOKEN_NAME, ALWAYS_FAIL_VALIDATOR_HASH, type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AssetInfo, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, CDP_CREATOR_TOKEN_NAME, CDP_TOKEN_NAME, type CdpParams, type CdpParamsSP, type CollectorParamsSP, type CollectorRedeemer, CredentialD, CredentialSchema, type CurrencySymbol, DAO_TOKEN_NAME, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GOV_NFT_TOKEN_NAME, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, IASSET_TOKEN_NAME, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, INDY_TOKEN_NAME, type InitialAsset, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, NUM_CDP_CREATORS, NUM_COLLECTORS, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, POLL_MANAGER_TOKEN_NAME, PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PollStatus, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, ProposalContent, ProposalContentSchema, type ProposeAssetContent, ProtocolParams, ProtocolParamsSchema, type PubKeyHash, SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME, type SPInteger, SPIntegerSchema, STABILITY_POOL_TOKEN_NAME, STAKING_MANAGER_TOKEN_NAME, STAKING_TOKEN_NAME, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type SystemParams, TOTAL_INDY_SUPPLY, TREASURY_INDY_AMOUNT, type TokenName, TreasuryParams, type TreasuryParamsSP, TreasuryParamsSchema, type TreasuryRedeemer, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, UPGRADE_TOKEN_NAME, type UpgradePaths, type UtxoOrOutRef, VERSION_RECORD_TOKEN_NAME, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, type WithdrawalOutputDatum, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, annulRequest, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castTreasuryParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, computeInterestLovelacesFor100PercentCR, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, init, initEpochToScaleToSumMap, initSpSnapshot, insertSorted, isAssetsZero, leverageCdpWithLrp, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, lovelacesAmt, lrpRedeemableLovelacesInclReimb, matchSingle, mergeCdps, mergeShards, mintCdp, mkAssetsOf, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkInterestOracleValidator, mkLovelacesOf, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, negateAssets, oneShotMintTx, openCdp, openLrp, openStakingPosition, parseAccountDatum, parseCdpDatum, parseCdpDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestOracleDatum, parseLrpDatum, parseLrpDatumOrThrow, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseUpgradePaths, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, resolveUtxo, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, serialiseTreasuryDatum, serialiseTreasuryRedeemer, serialiseUpgradePaths, serialiseWithdrawalOutputDatum, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, submitAndAwaitTx, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateSlotConfigNetwork, updateStakingLockedAmount, vote, withdrawCdp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1736,52 +1736,6 @@ declare const mkVersionRegistryValidator: () => SpendingValidator;
|
|
|
1736
1736
|
|
|
1737
1737
|
declare function treasuryFeeTx(fee: bigint, lucid: LucidEvolution, sysParams: SystemParams, tx: TxBuilder, treasury: UtxoOrOutRef): Promise<void>;
|
|
1738
1738
|
|
|
1739
|
-
declare const OracleAssetNftSchema: _lucid_evolution_lucid.TObject<{
|
|
1740
|
-
oracleNft: _lucid_evolution_lucid.TObject<{
|
|
1741
|
-
currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1742
|
-
tokenName: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1743
|
-
}>;
|
|
1744
|
-
}>;
|
|
1745
|
-
type OracleAssetNft = Data.Static<typeof OracleAssetNftSchema>;
|
|
1746
|
-
declare const PriceOracleParamsSchema: _lucid_evolution_lucid.TObject<{
|
|
1747
|
-
owner: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1748
|
-
/** Milliseconds */
|
|
1749
|
-
biasTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1750
|
-
/** Milliseconds */
|
|
1751
|
-
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1752
|
-
}>;
|
|
1753
|
-
type PriceOracleParams = Data.Static<typeof PriceOracleParamsSchema>;
|
|
1754
|
-
declare const PriceOracleDatumSchema: _lucid_evolution_lucid.TObject<{
|
|
1755
|
-
price: _lucid_evolution_lucid.TObject<{
|
|
1756
|
-
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1757
|
-
}>;
|
|
1758
|
-
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1759
|
-
}>;
|
|
1760
|
-
type PriceOracleDatum = Data.Static<typeof PriceOracleDatumSchema>;
|
|
1761
|
-
declare const PriceOracleRedeemerSchema: _lucid_evolution_lucid.TObject<{
|
|
1762
|
-
currentTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1763
|
-
newPrice: _lucid_evolution_lucid.TObject<{
|
|
1764
|
-
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
1765
|
-
}>;
|
|
1766
|
-
}>;
|
|
1767
|
-
type PriceOracleRedeemer = Data.Static<typeof PriceOracleRedeemerSchema>;
|
|
1768
|
-
declare function serialisePriceOracleRedeemer(r: PriceOracleRedeemer): Redeemer;
|
|
1769
|
-
declare function parsePriceOracleDatum(datum: Datum): PriceOracleDatum;
|
|
1770
|
-
declare function serialisePriceOracleDatum(datum: PriceOracleDatum): Datum;
|
|
1771
|
-
declare function castPriceOracleParams(params: PriceOracleParams): Data;
|
|
1772
|
-
|
|
1773
|
-
declare function startPriceOracleTx(lucid: LucidEvolution, assetName: string, startPrice: OnChainDecimal, oracleParams: PriceOracleParams, now?: number, refOutRef?: OutRef): Promise<[TxBuilder, OracleAssetNft]>;
|
|
1774
|
-
declare function feedPriceOracleTx(lucid: LucidEvolution, oracle: UtxoOrOutRef, newPrice: OnChainDecimal, oracleParams: PriceOracleParams, currentSlot: number): Promise<TxBuilder>;
|
|
1775
|
-
|
|
1776
|
-
/**
|
|
1777
|
-
* Calculates the validity range based on the oracle expiration,
|
|
1778
|
-
* and caps the upper bound when necessary.
|
|
1779
|
-
*/
|
|
1780
|
-
declare function oracleExpirationAwareValidity(currentSlot: number, biasTime: number, oracleExpiration: number, network: Network): {
|
|
1781
|
-
validFrom: number;
|
|
1782
|
-
validTo: number;
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
1739
|
declare const initSpSnapshot: StabilityPoolSnapshot;
|
|
1786
1740
|
declare const initEpochToScaleToSumMap: () => EpochToScaleToSum;
|
|
1787
1741
|
declare function getSumFromEpochToScaleToSum(e2s2s: EpochToScaleToSum, epoch: bigint, scale: bigint): SPInteger | undefined;
|
|
@@ -2039,6 +1993,40 @@ declare function castExecuteParams(params: ExecuteParams): Data;
|
|
|
2039
1993
|
declare const mkExecuteValidator: (params: ExecuteParams) => SpendingValidator;
|
|
2040
1994
|
declare const mkExecuteValidatorFromSP: (params: ExecuteParamsSP) => SpendingValidator;
|
|
2041
1995
|
|
|
1996
|
+
declare const OracleAssetNftSchema: _lucid_evolution_lucid.TObject<{
|
|
1997
|
+
oracleNft: _lucid_evolution_lucid.TObject<{
|
|
1998
|
+
currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
|
|
1999
|
+
tokenName: _lucid_evolution_lucid.TUnsafe<string>;
|
|
2000
|
+
}>;
|
|
2001
|
+
}>;
|
|
2002
|
+
type OracleAssetNft = Data.Static<typeof OracleAssetNftSchema>;
|
|
2003
|
+
declare const PriceOracleParamsSchema: _lucid_evolution_lucid.TObject<{
|
|
2004
|
+
owner: _lucid_evolution_lucid.TUnsafe<string>;
|
|
2005
|
+
/** Milliseconds */
|
|
2006
|
+
biasTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2007
|
+
/** Milliseconds */
|
|
2008
|
+
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2009
|
+
}>;
|
|
2010
|
+
type PriceOracleParams = Data.Static<typeof PriceOracleParamsSchema>;
|
|
2011
|
+
declare const PriceOracleDatumSchema: _lucid_evolution_lucid.TObject<{
|
|
2012
|
+
price: _lucid_evolution_lucid.TObject<{
|
|
2013
|
+
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2014
|
+
}>;
|
|
2015
|
+
expiration: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2016
|
+
}>;
|
|
2017
|
+
type PriceOracleDatum = Data.Static<typeof PriceOracleDatumSchema>;
|
|
2018
|
+
declare const PriceOracleRedeemerSchema: _lucid_evolution_lucid.TObject<{
|
|
2019
|
+
currentTime: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2020
|
+
newPrice: _lucid_evolution_lucid.TObject<{
|
|
2021
|
+
getOnChainInt: _lucid_evolution_lucid.TUnsafe<bigint>;
|
|
2022
|
+
}>;
|
|
2023
|
+
}>;
|
|
2024
|
+
type PriceOracleRedeemer = Data.Static<typeof PriceOracleRedeemerSchema>;
|
|
2025
|
+
declare function serialisePriceOracleRedeemer(r: PriceOracleRedeemer): Redeemer;
|
|
2026
|
+
declare function parsePriceOracleDatum(datum: Datum): PriceOracleDatum;
|
|
2027
|
+
declare function serialisePriceOracleDatum(datum: PriceOracleDatum): Datum;
|
|
2028
|
+
declare function castPriceOracleParams(params: PriceOracleParams): Data;
|
|
2029
|
+
|
|
2042
2030
|
declare const ActionReturnDatumSchema: _lucid_evolution_lucid.TUnion<(_lucid_evolution_lucid.TObject<{
|
|
2043
2031
|
IndigoStabilityPoolAccountAdjustment: _lucid_evolution_lucid.TObject<{
|
|
2044
2032
|
spent_account: _lucid_evolution_lucid.TObject<{
|
|
@@ -2829,4 +2817,4 @@ declare function submitAndAwaitTx(lucid: LucidEvolution, tx: TxBuilder): Promise
|
|
|
2829
2817
|
|
|
2830
2818
|
declare function init(lucid: LucidEvolution, initialAssets: InitialAsset[], now?: number): Promise<[SystemParams, AssetInfo[]]>;
|
|
2831
2819
|
|
|
2832
|
-
export { ACCOUNT_TOKEN_NAME, ALWAYS_FAIL_VALIDATOR_HASH, type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AssetInfo, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, CDP_CREATOR_TOKEN_NAME, CDP_TOKEN_NAME, type CdpParams, type CdpParamsSP, type CollectorParamsSP, type CollectorRedeemer, CredentialD, CredentialSchema, type CurrencySymbol, DAO_TOKEN_NAME, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GOV_NFT_TOKEN_NAME, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, IASSET_TOKEN_NAME, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, INDY_TOKEN_NAME, type InitialAsset, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, NUM_CDP_CREATORS, NUM_COLLECTORS, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, POLL_MANAGER_TOKEN_NAME, PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PollStatus, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, ProposalContent, ProposalContentSchema, type ProposeAssetContent, ProtocolParams, ProtocolParamsSchema, type PubKeyHash, SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME, type SPInteger, SPIntegerSchema, STABILITY_POOL_TOKEN_NAME, STAKING_MANAGER_TOKEN_NAME, STAKING_TOKEN_NAME, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type SystemParams, TOTAL_INDY_SUPPLY, TREASURY_INDY_AMOUNT, type TokenName, TreasuryParams, type TreasuryParamsSP, TreasuryParamsSchema, type TreasuryRedeemer, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, UPGRADE_TOKEN_NAME, type UpgradePaths, type UtxoOrOutRef, VERSION_RECORD_TOKEN_NAME, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, type WithdrawalOutputDatum, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, annulRequest, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castTreasuryParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, computeInterestLovelacesFor100PercentCR, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle,
|
|
2820
|
+
export { ACCOUNT_TOKEN_NAME, ALWAYS_FAIL_VALIDATOR_HASH, type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AssetInfo, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, CDP_CREATOR_TOKEN_NAME, CDP_TOKEN_NAME, type CdpParams, type CdpParamsSP, type CollectorParamsSP, type CollectorRedeemer, CredentialD, CredentialSchema, type CurrencySymbol, DAO_TOKEN_NAME, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GOV_NFT_TOKEN_NAME, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, IASSET_TOKEN_NAME, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, INDY_TOKEN_NAME, type InitialAsset, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, NUM_CDP_CREATORS, NUM_COLLECTORS, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, POLL_MANAGER_TOKEN_NAME, PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PollStatus, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, ProposalContent, ProposalContentSchema, type ProposeAssetContent, ProtocolParams, ProtocolParamsSchema, type PubKeyHash, SNAPSHOT_EPOCH_TO_SCALE_TO_SUM_TOKEN_NAME, type SPInteger, SPIntegerSchema, STABILITY_POOL_TOKEN_NAME, STAKING_MANAGER_TOKEN_NAME, STAKING_TOKEN_NAME, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type SystemParams, TOTAL_INDY_SUPPLY, TREASURY_INDY_AMOUNT, type TokenName, TreasuryParams, type TreasuryParamsSP, TreasuryParamsSchema, type TreasuryRedeemer, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, UPGRADE_TOKEN_NAME, type UpgradePaths, type UtxoOrOutRef, VERSION_RECORD_TOKEN_NAME, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, type WithdrawalOutputDatum, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, annulRequest, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castTreasuryParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, computeInterestLovelacesFor100PercentCR, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, init, initEpochToScaleToSumMap, initSpSnapshot, insertSorted, isAssetsZero, leverageCdpWithLrp, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, lovelacesAmt, lrpRedeemableLovelacesInclReimb, matchSingle, mergeCdps, mergeShards, mintCdp, mkAssetsOf, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkInterestOracleValidator, mkLovelacesOf, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, negateAssets, oneShotMintTx, openCdp, openLrp, openStakingPosition, parseAccountDatum, parseCdpDatum, parseCdpDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestOracleDatum, parseLrpDatum, parseLrpDatumOrThrow, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseUpgradePaths, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, resolveUtxo, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, serialiseTreasuryDatum, serialiseTreasuryRedeemer, serialiseUpgradePaths, serialiseWithdrawalOutputDatum, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, submitAndAwaitTx, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateSlotConfigNetwork, updateStakingLockedAmount, vote, withdrawCdp };
|
package/dist/index.js
CHANGED
|
@@ -79708,7 +79708,6 @@ __export(index_exports, {
|
|
|
79708
79708
|
endProposal: () => endProposal,
|
|
79709
79709
|
executeProposal: () => executeProposal,
|
|
79710
79710
|
feedInterestOracle: () => feedInterestOracle,
|
|
79711
|
-
feedPriceOracleTx: () => feedPriceOracleTx,
|
|
79712
79711
|
findStakingManager: () => findStakingManager,
|
|
79713
79712
|
findStakingManagerByOutRef: () => findStakingManagerByOutRef,
|
|
79714
79713
|
findStakingPositionByOutRef: () => findStakingPositionByOutRef,
|
|
@@ -79762,7 +79761,6 @@ __export(index_exports, {
|
|
|
79762
79761
|
openCdp: () => openCdp,
|
|
79763
79762
|
openLrp: () => openLrp,
|
|
79764
79763
|
openStakingPosition: () => openStakingPosition,
|
|
79765
|
-
oracleExpirationAwareValidity: () => oracleExpirationAwareValidity,
|
|
79766
79764
|
parseAccountDatum: () => parseAccountDatum,
|
|
79767
79765
|
parseCdpDatum: () => parseCdpDatum,
|
|
79768
79766
|
parseCdpDatumOrThrow: () => parseCdpDatumOrThrow,
|
|
@@ -79828,7 +79826,6 @@ __export(index_exports, {
|
|
|
79828
79826
|
spMul: () => spMul,
|
|
79829
79827
|
spSub: () => spSub,
|
|
79830
79828
|
startInterestOracle: () => startInterestOracle,
|
|
79831
|
-
startPriceOracleTx: () => startPriceOracleTx,
|
|
79832
79829
|
submitAndAwaitTx: () => submitAndAwaitTx,
|
|
79833
79830
|
summarizeActualLeverageRedemptions: () => summarizeActualLeverageRedemptions,
|
|
79834
79831
|
toSystemParamsAsset: () => toSystemParamsAsset,
|
|
@@ -119013,81 +119010,6 @@ var mkVersionRegistryValidator = () => {
|
|
|
119013
119010
|
};
|
|
119014
119011
|
};
|
|
119015
119012
|
|
|
119016
|
-
// src/contracts/price-oracle/scripts.ts
|
|
119017
|
-
var priceOracleValidatorData = {
|
|
119018
|
-
type: "PlutusV2",
|
|
119019
|
-
cborHex: "590ba5590ba20100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323233027222232325335333006533357346074607e0022646605a60586ae84004dd69aba135744002607c00206e64a666ae68c0ecc1000044c8c8c848cc00400c008c0b8d5d09aba2002375a6ae84004c0fc0040e0dd50022999ab9a303a303f002132321233001003002357426ae88c0fc00cd5d0981f00101b8890008a99ab9c49103505435001637540086ea8004cc09c8888c8d4014888d40188c88c94cd54cd4ccd54c0d40e0c0a80a4c0ac01ccc0b08004d40048888888888880100e44cd5ce24812d546865207472616e73616374696f6e206973206e6f74207369676e6564206279206f7261636c65206f776e657200030132533553355335333553036039302b02a253335302135001202103e215333573466ebcc118cd5d0182319aba0375000a6ec4080cd5d01ba835500b03937620400022a66a666036446a0044466603e446a00444a666ae68c12c004400c4cc11848ccc00401c00c00800c00c0040c0cd54c0e80ec8d400488cc0e0008cd54c0f40f88d400488cc0ec008ccd4004dc0a4000e048cdc0800a400000266aa607407646a0024466070004666a002466aa607c07e46a0024466078004604600200244666038066004002466aa607c07e46a0024466078004604000200266602e05c666050400204e6a004404e0060784426a004444a66a0082a666ae68cdd78018238a999ab9a3375e00408e2a666ae68cdc4000a400006e2666ae68cdc4800a410125e80206a07006e06e44072064407e6044014074266ae712401024c310003103a1335738921156f757470757420646f6573206e6f74206d6174636800031153355333573466e2400d20001335738921165072696365206d75737420626520706f7369746976650003103a15335533535353301275a6a00407e06e44a666a00442a666ae68cdc419b8000100935500c03a0331333573466e24004d540300e80c40d00c80c84d4cc049d69a80101f911a801112999a99980980a980f19b8100900b0021533500113330120150030081333012015003008034133301201500300803003a13357389212345787069726174696f6e2074696d65206973206e6f742070726f7065726c792073657400031030030333025200102435302635533530270092100116036202402f302d350080393302f3016337000020060542a666a602e6aa66a60320022602602a442a66a0022004442602e032402e02842a66a6666666ae900048c94ccd5cd181d98200008991999aab9f001202d23233335573e002405e46666aae7cd5d1001119299a9999999aba400123253335734608660900022646666aae7c00480d48cccd55cf9aba20022533530203574200642605e00206a406c07a078608e0020646ea800880c880c880c880c80e4854cd4c070d5d08029098159981a8010008188181aba1005203003703635744004068607e0020546ea800880a880a880a880a80c48400405480548c94ccd5cd181b181d800899191919091998008028018011bad357426ae88008dd69aba10013574460760046ae84c0e80040ccdd50009111a801111a801912999a9998040038020010a99a8018800819814819911192999a80190a999a80190a999a80290980200b0980180a8a999a80210980200b0980180a80c0060a999a80210980180a8980100a0a999a80190980180a8980100a00b8a999a801100700b0068a999a80110a999a80210980180a8980100a0a999a80190980180a8980100a00b8058a999a80190980100a098008098a999a80110980100a0980080980b12999a80110a999a80210a999a802109998040038010008b0b0b0060a999a80190a999a801909998038030010008b0b0b00580691a80091111111003891999999980091199ab9a3370e00400204004644a666ae68cdc38010008098a999ab9a3371200400201401044666ae68cdc400100081001191199ab9a3371200400204004644666ae68cdc480100081181011199ab9a3371000400204604044a666ae68cdc480100088008801112999ab9a33712004002200420024464a666ae68c0c8c0dc0044c8c8cc0994ccd5cd181a181c801099813198038029aba130380023006357426ae88c0e00080c54ccd5cd181a181c800899813198038029aba130380013006357426ae88c0e00040c4dd51aba135744606e0046ea8d5d0981b0008179baa0012325333573460620020522a666ae68c0c000407c0b4c0d0dd50009119192999ab9a303300100815333573460640022601460086ae84c0d400854ccd5cd1818800803017181a8009baa00122233355302302702a335530260272350012233024002300b001333553023027223500222533533355302802b301d01c235001223300a002005006100313302e00400301c001335530260272350012233024002330382253350011300a003221350022253353300c002008112223300200a0041300600300400211009212223001004112220012230302253350011003221330060023004001212223003004233333335748002403040304030460206eb4008806007c94cd5ce2481286578706563746564206f6e6c7920612073696e676c6520636f6e74696e75696e67206f7574707574001615335738920117496e76616c696420646174756d20696e206f757470757400164988880088c8c94ccd5cd1813000899091118010021aba13028002153335734604a002264244460020086ae84c0a000854ccd5cd181200080201098140009baa00111003253353007001213335530150192235300535300935003019222200422353007350042222004225333573466ebc01000854ccd5cd19baf0030011330220060051005100500e3300d00735300f3500201b22222222222200a15335738921024c660016232533357346040604a0022646424660020060046ae84d5d118128011aba1302400101d3754002444006660024002eb4888cc09088cccd55cf80090071191980e9980a180398138009803181300098021aba2003357420040306eac0048c94ccd5cd180e181080089919191919190919998008038028018011aba1357440046ae84004d5d10011aba10013574460420046ae84c080004064dd5000919191999aa999ab9a3370e90030008990911118020029aba13020002153335734603c00226424444600400a6ae84c08000854ccd5cd180e8008990911118008029aba13020002153335734603800226424444600600a6ae84c0800080648034803480348ccd54c048054cc03c894cd40088400c400403494ccd5cd19baf002350010181300600100d3300923253335734603e60480022646424660020060046ae84d5d118120011aba1302300101c37540026a60166a00802e44444444444401860400026ea8d40040408488c00800c48cc004894cd400804c40040208cc02488ccd400c04c008004d400403488ccd5cd19baf002001004007223301c2233335573e002400c466028600a6ae84008c00cd5d10010081bac001100d23253335734602860320022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d1180c8011aba1301800101137540022002200c464a666ae68c044c0580044dd69aba1301500100e37540024424660020060044446006600400260244422444a66a00220044426600a004666aa600e01600a00800260224422444a66a00226a00600c442666a00a0186008004666aa600e01400a00800244002601e442244a66a00200c44266014600800466aa600c00e00800224002220024400444244660020080062a66ae712411f496e76616c696420646174756d20746f20636865636b4f776e4f757470757400161533573892010350543100162222222222220054c1014000370e90001b8748008dc3a40086e9520005573caae748c8c00400488cc00cc008008005"
|
|
119020
|
-
};
|
|
119021
|
-
function mkPriceOracleValidator(params) {
|
|
119022
|
-
return {
|
|
119023
|
-
type: priceOracleValidatorData.type,
|
|
119024
|
-
script: applyParamsToScript(priceOracleValidatorData.cborHex, [
|
|
119025
|
-
castPriceOracleParams(params)
|
|
119026
|
-
])
|
|
119027
|
-
};
|
|
119028
|
-
}
|
|
119029
|
-
|
|
119030
|
-
// src/contracts/price-oracle/transactions.ts
|
|
119031
|
-
async function startPriceOracleTx(lucid3, assetName, startPrice, oracleParams, now2 = Date.now(), refOutRef) {
|
|
119032
|
-
if (!refOutRef) {
|
|
119033
|
-
refOutRef = (await lucid3.wallet().getUtxos())[0];
|
|
119034
|
-
}
|
|
119035
|
-
const [tx, oracleNftPolicyId] = await oneShotMintTx(lucid3, {
|
|
119036
|
-
referenceOutRef: {
|
|
119037
|
-
txHash: refOutRef.txHash,
|
|
119038
|
-
outputIdx: BigInt(refOutRef.outputIndex)
|
|
119039
|
-
},
|
|
119040
|
-
mintAmounts: [
|
|
119041
|
-
{
|
|
119042
|
-
tokenName: fromText(assetName),
|
|
119043
|
-
amount: 1n
|
|
119044
|
-
}
|
|
119045
|
-
]
|
|
119046
|
-
});
|
|
119047
|
-
const priceOracleNft = {
|
|
119048
|
-
currencySymbol: oracleNftPolicyId,
|
|
119049
|
-
tokenName: fromText(assetName)
|
|
119050
|
-
};
|
|
119051
|
-
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
119052
|
-
const oracleDatum = {
|
|
119053
|
-
price: startPrice,
|
|
119054
|
-
expiration: BigInt(now2) + oracleParams.expiration
|
|
119055
|
-
};
|
|
119056
|
-
tx.pay.ToContract(
|
|
119057
|
-
validatorToAddress(lucid3.config().network, oracleValidator),
|
|
119058
|
-
{ kind: "inline", value: serialisePriceOracleDatum(oracleDatum) },
|
|
119059
|
-
addAssets(mkLovelacesOf(5000000n), mkAssetsOf(priceOracleNft, 1n))
|
|
119060
|
-
);
|
|
119061
|
-
return [tx, { oracleNft: priceOracleNft }];
|
|
119062
|
-
}
|
|
119063
|
-
async function feedPriceOracleTx(lucid3, oracle, newPrice, oracleParams, currentSlot) {
|
|
119064
|
-
const network = lucid3.config().network;
|
|
119065
|
-
const currentTime = BigInt(slotToUnixTime(network, currentSlot));
|
|
119066
|
-
const priceOracleUtxo = await resolveUtxo(
|
|
119067
|
-
oracle,
|
|
119068
|
-
lucid3,
|
|
119069
|
-
"Expected a single price oracle UTXO"
|
|
119070
|
-
);
|
|
119071
|
-
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
119072
|
-
return lucid3.newTx().validFrom(Number(currentTime - oracleParams.biasTime) + ONE_SECOND).validTo(Number(currentTime + oracleParams.biasTime) - ONE_SECOND).attach.SpendingValidator(oracleValidator).collectFrom(
|
|
119073
|
-
[priceOracleUtxo],
|
|
119074
|
-
serialisePriceOracleRedeemer({
|
|
119075
|
-
currentTime,
|
|
119076
|
-
newPrice
|
|
119077
|
-
})
|
|
119078
|
-
).pay.ToContract(
|
|
119079
|
-
priceOracleUtxo.address,
|
|
119080
|
-
{
|
|
119081
|
-
kind: "inline",
|
|
119082
|
-
value: serialisePriceOracleDatum({
|
|
119083
|
-
price: newPrice,
|
|
119084
|
-
expiration: currentTime + oracleParams.expiration
|
|
119085
|
-
})
|
|
119086
|
-
},
|
|
119087
|
-
priceOracleUtxo.assets
|
|
119088
|
-
).addSignerKey(oracleParams.owner);
|
|
119089
|
-
}
|
|
119090
|
-
|
|
119091
119013
|
// src/validators/collector-validator.ts
|
|
119092
119014
|
var _collectorValidator = {
|
|
119093
119015
|
type: "PlutusScriptV2",
|
|
@@ -120034,6 +119956,54 @@ async function submitAndAwaitTx(lucid3, tx) {
|
|
|
120034
119956
|
return txHash;
|
|
120035
119957
|
}
|
|
120036
119958
|
|
|
119959
|
+
// src/contracts/price-oracle/scripts.ts
|
|
119960
|
+
var priceOracleValidatorData = {
|
|
119961
|
+
type: "PlutusV2",
|
|
119962
|
+
cborHex: "590ba5590ba20100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323233027222232325335333006533357346074607e0022646605a60586ae84004dd69aba135744002607c00206e64a666ae68c0ecc1000044c8c8c848cc00400c008c0b8d5d09aba2002375a6ae84004c0fc0040e0dd50022999ab9a303a303f002132321233001003002357426ae88c0fc00cd5d0981f00101b8890008a99ab9c49103505435001637540086ea8004cc09c8888c8d4014888d40188c88c94cd54cd4ccd54c0d40e0c0a80a4c0ac01ccc0b08004d40048888888888880100e44cd5ce24812d546865207472616e73616374696f6e206973206e6f74207369676e6564206279206f7261636c65206f776e657200030132533553355335333553036039302b02a253335302135001202103e215333573466ebcc118cd5d0182319aba0375000a6ec4080cd5d01ba835500b03937620400022a66a666036446a0044466603e446a00444a666ae68c12c004400c4cc11848ccc00401c00c00800c00c0040c0cd54c0e80ec8d400488cc0e0008cd54c0f40f88d400488cc0ec008ccd4004dc0a4000e048cdc0800a400000266aa607407646a0024466070004666a002466aa607c07e46a0024466078004604600200244666038066004002466aa607c07e46a0024466078004604000200266602e05c666050400204e6a004404e0060784426a004444a66a0082a666ae68cdd78018238a999ab9a3375e00408e2a666ae68cdc4000a400006e2666ae68cdc4800a410125e80206a07006e06e44072064407e6044014074266ae712401024c310003103a1335738921156f757470757420646f6573206e6f74206d6174636800031153355333573466e2400d20001335738921165072696365206d75737420626520706f7369746976650003103a15335533535353301275a6a00407e06e44a666a00442a666ae68cdc419b8000100935500c03a0331333573466e24004d540300e80c40d00c80c84d4cc049d69a80101f911a801112999a99980980a980f19b8100900b0021533500113330120150030081333012015003008034133301201500300803003a13357389212345787069726174696f6e2074696d65206973206e6f742070726f7065726c792073657400031030030333025200102435302635533530270092100116036202402f302d350080393302f3016337000020060542a666a602e6aa66a60320022602602a442a66a0022004442602e032402e02842a66a6666666ae900048c94ccd5cd181d98200008991999aab9f001202d23233335573e002405e46666aae7cd5d1001119299a9999999aba400123253335734608660900022646666aae7c00480d48cccd55cf9aba20022533530203574200642605e00206a406c07a078608e0020646ea800880c880c880c880c80e4854cd4c070d5d08029098159981a8010008188181aba1005203003703635744004068607e0020546ea800880a880a880a880a80c48400405480548c94ccd5cd181b181d800899191919091998008028018011bad357426ae88008dd69aba10013574460760046ae84c0e80040ccdd50009111a801111a801912999a9998040038020010a99a8018800819814819911192999a80190a999a80190a999a80290980200b0980180a8a999a80210980200b0980180a80c0060a999a80210980180a8980100a0a999a80190980180a8980100a00b8a999a801100700b0068a999a80110a999a80210980180a8980100a0a999a80190980180a8980100a00b8058a999a80190980100a098008098a999a80110980100a0980080980b12999a80110a999a80210a999a802109998040038010008b0b0b0060a999a80190a999a801909998038030010008b0b0b00580691a80091111111003891999999980091199ab9a3370e00400204004644a666ae68cdc38010008098a999ab9a3371200400201401044666ae68cdc400100081001191199ab9a3371200400204004644666ae68cdc480100081181011199ab9a3371000400204604044a666ae68cdc480100088008801112999ab9a33712004002200420024464a666ae68c0c8c0dc0044c8c8cc0994ccd5cd181a181c801099813198038029aba130380023006357426ae88c0e00080c54ccd5cd181a181c800899813198038029aba130380013006357426ae88c0e00040c4dd51aba135744606e0046ea8d5d0981b0008179baa0012325333573460620020522a666ae68c0c000407c0b4c0d0dd50009119192999ab9a303300100815333573460640022601460086ae84c0d400854ccd5cd1818800803017181a8009baa00122233355302302702a335530260272350012233024002300b001333553023027223500222533533355302802b301d01c235001223300a002005006100313302e00400301c001335530260272350012233024002330382253350011300a003221350022253353300c002008112223300200a0041300600300400211009212223001004112220012230302253350011003221330060023004001212223003004233333335748002403040304030460206eb4008806007c94cd5ce2481286578706563746564206f6e6c7920612073696e676c6520636f6e74696e75696e67206f7574707574001615335738920117496e76616c696420646174756d20696e206f757470757400164988880088c8c94ccd5cd1813000899091118010021aba13028002153335734604a002264244460020086ae84c0a000854ccd5cd181200080201098140009baa00111003253353007001213335530150192235300535300935003019222200422353007350042222004225333573466ebc01000854ccd5cd19baf0030011330220060051005100500e3300d00735300f3500201b22222222222200a15335738921024c660016232533357346040604a0022646424660020060046ae84d5d118128011aba1302400101d3754002444006660024002eb4888cc09088cccd55cf80090071191980e9980a180398138009803181300098021aba2003357420040306eac0048c94ccd5cd180e181080089919191919190919998008038028018011aba1357440046ae84004d5d10011aba10013574460420046ae84c080004064dd5000919191999aa999ab9a3370e90030008990911118020029aba13020002153335734603c00226424444600400a6ae84c08000854ccd5cd180e8008990911118008029aba13020002153335734603800226424444600600a6ae84c0800080648034803480348ccd54c048054cc03c894cd40088400c400403494ccd5cd19baf002350010181300600100d3300923253335734603e60480022646424660020060046ae84d5d118120011aba1302300101c37540026a60166a00802e44444444444401860400026ea8d40040408488c00800c48cc004894cd400804c40040208cc02488ccd400c04c008004d400403488ccd5cd19baf002001004007223301c2233335573e002400c466028600a6ae84008c00cd5d10010081bac001100d23253335734602860320022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d1180c8011aba1301800101137540022002200c464a666ae68c044c0580044dd69aba1301500100e37540024424660020060044446006600400260244422444a66a00220044426600a004666aa600e01600a00800260224422444a66a00226a00600c442666a00a0186008004666aa600e01400a00800244002601e442244a66a00200c44266014600800466aa600c00e00800224002220024400444244660020080062a66ae712411f496e76616c696420646174756d20746f20636865636b4f776e4f757470757400161533573892010350543100162222222222220054c1014000370e90001b8748008dc3a40086e9520005573caae748c8c00400488cc00cc008008005"
|
|
119963
|
+
};
|
|
119964
|
+
function mkPriceOracleValidator(params) {
|
|
119965
|
+
return {
|
|
119966
|
+
type: priceOracleValidatorData.type,
|
|
119967
|
+
script: applyParamsToScript(priceOracleValidatorData.cborHex, [
|
|
119968
|
+
castPriceOracleParams(params)
|
|
119969
|
+
])
|
|
119970
|
+
};
|
|
119971
|
+
}
|
|
119972
|
+
|
|
119973
|
+
// src/contracts/price-oracle/transactions.ts
|
|
119974
|
+
async function startPriceOracleTx(lucid3, assetName, startPrice, oracleParams, now2 = Date.now(), refOutRef) {
|
|
119975
|
+
if (!refOutRef) {
|
|
119976
|
+
refOutRef = (await lucid3.wallet().getUtxos())[0];
|
|
119977
|
+
}
|
|
119978
|
+
const [tx, oracleNftPolicyId] = await oneShotMintTx(lucid3, {
|
|
119979
|
+
referenceOutRef: {
|
|
119980
|
+
txHash: refOutRef.txHash,
|
|
119981
|
+
outputIdx: BigInt(refOutRef.outputIndex)
|
|
119982
|
+
},
|
|
119983
|
+
mintAmounts: [
|
|
119984
|
+
{
|
|
119985
|
+
tokenName: fromText(assetName),
|
|
119986
|
+
amount: 1n
|
|
119987
|
+
}
|
|
119988
|
+
]
|
|
119989
|
+
});
|
|
119990
|
+
const priceOracleNft = {
|
|
119991
|
+
currencySymbol: oracleNftPolicyId,
|
|
119992
|
+
tokenName: fromText(assetName)
|
|
119993
|
+
};
|
|
119994
|
+
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
119995
|
+
const oracleDatum = {
|
|
119996
|
+
price: startPrice,
|
|
119997
|
+
expiration: BigInt(now2) + oracleParams.expiration
|
|
119998
|
+
};
|
|
119999
|
+
tx.pay.ToContract(
|
|
120000
|
+
validatorToAddress(lucid3.config().network, oracleValidator),
|
|
120001
|
+
{ kind: "inline", value: serialisePriceOracleDatum(oracleDatum) },
|
|
120002
|
+
addAssets(mkLovelacesOf(5000000n), mkAssetsOf(priceOracleNft, 1n))
|
|
120003
|
+
);
|
|
120004
|
+
return [tx, { oracleNft: priceOracleNft }];
|
|
120005
|
+
}
|
|
120006
|
+
|
|
120037
120007
|
// src/scripts/auth-token-policy.ts
|
|
120038
120008
|
var authPolicyData = {
|
|
120039
120009
|
type: "PlutusV2",
|
|
@@ -120891,7 +120861,6 @@ async function init(lucid3, initialAssets, now2 = Date.now()) {
|
|
|
120891
120861
|
endProposal,
|
|
120892
120862
|
executeProposal,
|
|
120893
120863
|
feedInterestOracle,
|
|
120894
|
-
feedPriceOracleTx,
|
|
120895
120864
|
findStakingManager,
|
|
120896
120865
|
findStakingManagerByOutRef,
|
|
120897
120866
|
findStakingPositionByOutRef,
|
|
@@ -120945,7 +120914,6 @@ async function init(lucid3, initialAssets, now2 = Date.now()) {
|
|
|
120945
120914
|
openCdp,
|
|
120946
120915
|
openLrp,
|
|
120947
120916
|
openStakingPosition,
|
|
120948
|
-
oracleExpirationAwareValidity,
|
|
120949
120917
|
parseAccountDatum,
|
|
120950
120918
|
parseCdpDatum,
|
|
120951
120919
|
parseCdpDatumOrThrow,
|
|
@@ -121011,7 +120979,6 @@ async function init(lucid3, initialAssets, now2 = Date.now()) {
|
|
|
121011
120979
|
spMul,
|
|
121012
120980
|
spSub,
|
|
121013
120981
|
startInterestOracle,
|
|
121014
|
-
startPriceOracleTx,
|
|
121015
120982
|
submitAndAwaitTx,
|
|
121016
120983
|
summarizeActualLeverageRedemptions,
|
|
121017
120984
|
toSystemParamsAsset,
|
package/dist/index.mjs
CHANGED
|
@@ -118758,81 +118758,6 @@ var mkVersionRegistryValidator = () => {
|
|
|
118758
118758
|
};
|
|
118759
118759
|
};
|
|
118760
118760
|
|
|
118761
|
-
// src/contracts/price-oracle/scripts.ts
|
|
118762
|
-
var priceOracleValidatorData = {
|
|
118763
|
-
type: "PlutusV2",
|
|
118764
|
-
cborHex: "590ba5590ba20100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323233027222232325335333006533357346074607e0022646605a60586ae84004dd69aba135744002607c00206e64a666ae68c0ecc1000044c8c8c848cc00400c008c0b8d5d09aba2002375a6ae84004c0fc0040e0dd50022999ab9a303a303f002132321233001003002357426ae88c0fc00cd5d0981f00101b8890008a99ab9c49103505435001637540086ea8004cc09c8888c8d4014888d40188c88c94cd54cd4ccd54c0d40e0c0a80a4c0ac01ccc0b08004d40048888888888880100e44cd5ce24812d546865207472616e73616374696f6e206973206e6f74207369676e6564206279206f7261636c65206f776e657200030132533553355335333553036039302b02a253335302135001202103e215333573466ebcc118cd5d0182319aba0375000a6ec4080cd5d01ba835500b03937620400022a66a666036446a0044466603e446a00444a666ae68c12c004400c4cc11848ccc00401c00c00800c00c0040c0cd54c0e80ec8d400488cc0e0008cd54c0f40f88d400488cc0ec008ccd4004dc0a4000e048cdc0800a400000266aa607407646a0024466070004666a002466aa607c07e46a0024466078004604600200244666038066004002466aa607c07e46a0024466078004604000200266602e05c666050400204e6a004404e0060784426a004444a66a0082a666ae68cdd78018238a999ab9a3375e00408e2a666ae68cdc4000a400006e2666ae68cdc4800a410125e80206a07006e06e44072064407e6044014074266ae712401024c310003103a1335738921156f757470757420646f6573206e6f74206d6174636800031153355333573466e2400d20001335738921165072696365206d75737420626520706f7369746976650003103a15335533535353301275a6a00407e06e44a666a00442a666ae68cdc419b8000100935500c03a0331333573466e24004d540300e80c40d00c80c84d4cc049d69a80101f911a801112999a99980980a980f19b8100900b0021533500113330120150030081333012015003008034133301201500300803003a13357389212345787069726174696f6e2074696d65206973206e6f742070726f7065726c792073657400031030030333025200102435302635533530270092100116036202402f302d350080393302f3016337000020060542a666a602e6aa66a60320022602602a442a66a0022004442602e032402e02842a66a6666666ae900048c94ccd5cd181d98200008991999aab9f001202d23233335573e002405e46666aae7cd5d1001119299a9999999aba400123253335734608660900022646666aae7c00480d48cccd55cf9aba20022533530203574200642605e00206a406c07a078608e0020646ea800880c880c880c880c80e4854cd4c070d5d08029098159981a8010008188181aba1005203003703635744004068607e0020546ea800880a880a880a880a80c48400405480548c94ccd5cd181b181d800899191919091998008028018011bad357426ae88008dd69aba10013574460760046ae84c0e80040ccdd50009111a801111a801912999a9998040038020010a99a8018800819814819911192999a80190a999a80190a999a80290980200b0980180a8a999a80210980200b0980180a80c0060a999a80210980180a8980100a0a999a80190980180a8980100a00b8a999a801100700b0068a999a80110a999a80210980180a8980100a0a999a80190980180a8980100a00b8058a999a80190980100a098008098a999a80110980100a0980080980b12999a80110a999a80210a999a802109998040038010008b0b0b0060a999a80190a999a801909998038030010008b0b0b00580691a80091111111003891999999980091199ab9a3370e00400204004644a666ae68cdc38010008098a999ab9a3371200400201401044666ae68cdc400100081001191199ab9a3371200400204004644666ae68cdc480100081181011199ab9a3371000400204604044a666ae68cdc480100088008801112999ab9a33712004002200420024464a666ae68c0c8c0dc0044c8c8cc0994ccd5cd181a181c801099813198038029aba130380023006357426ae88c0e00080c54ccd5cd181a181c800899813198038029aba130380013006357426ae88c0e00040c4dd51aba135744606e0046ea8d5d0981b0008179baa0012325333573460620020522a666ae68c0c000407c0b4c0d0dd50009119192999ab9a303300100815333573460640022601460086ae84c0d400854ccd5cd1818800803017181a8009baa00122233355302302702a335530260272350012233024002300b001333553023027223500222533533355302802b301d01c235001223300a002005006100313302e00400301c001335530260272350012233024002330382253350011300a003221350022253353300c002008112223300200a0041300600300400211009212223001004112220012230302253350011003221330060023004001212223003004233333335748002403040304030460206eb4008806007c94cd5ce2481286578706563746564206f6e6c7920612073696e676c6520636f6e74696e75696e67206f7574707574001615335738920117496e76616c696420646174756d20696e206f757470757400164988880088c8c94ccd5cd1813000899091118010021aba13028002153335734604a002264244460020086ae84c0a000854ccd5cd181200080201098140009baa00111003253353007001213335530150192235300535300935003019222200422353007350042222004225333573466ebc01000854ccd5cd19baf0030011330220060051005100500e3300d00735300f3500201b22222222222200a15335738921024c660016232533357346040604a0022646424660020060046ae84d5d118128011aba1302400101d3754002444006660024002eb4888cc09088cccd55cf80090071191980e9980a180398138009803181300098021aba2003357420040306eac0048c94ccd5cd180e181080089919191919190919998008038028018011aba1357440046ae84004d5d10011aba10013574460420046ae84c080004064dd5000919191999aa999ab9a3370e90030008990911118020029aba13020002153335734603c00226424444600400a6ae84c08000854ccd5cd180e8008990911118008029aba13020002153335734603800226424444600600a6ae84c0800080648034803480348ccd54c048054cc03c894cd40088400c400403494ccd5cd19baf002350010181300600100d3300923253335734603e60480022646424660020060046ae84d5d118120011aba1302300101c37540026a60166a00802e44444444444401860400026ea8d40040408488c00800c48cc004894cd400804c40040208cc02488ccd400c04c008004d400403488ccd5cd19baf002001004007223301c2233335573e002400c466028600a6ae84008c00cd5d10010081bac001100d23253335734602860320022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d1180c8011aba1301800101137540022002200c464a666ae68c044c0580044dd69aba1301500100e37540024424660020060044446006600400260244422444a66a00220044426600a004666aa600e01600a00800260224422444a66a00226a00600c442666a00a0186008004666aa600e01400a00800244002601e442244a66a00200c44266014600800466aa600c00e00800224002220024400444244660020080062a66ae712411f496e76616c696420646174756d20746f20636865636b4f776e4f757470757400161533573892010350543100162222222222220054c1014000370e90001b8748008dc3a40086e9520005573caae748c8c00400488cc00cc008008005"
|
|
118765
|
-
};
|
|
118766
|
-
function mkPriceOracleValidator(params) {
|
|
118767
|
-
return {
|
|
118768
|
-
type: priceOracleValidatorData.type,
|
|
118769
|
-
script: applyParamsToScript(priceOracleValidatorData.cborHex, [
|
|
118770
|
-
castPriceOracleParams(params)
|
|
118771
|
-
])
|
|
118772
|
-
};
|
|
118773
|
-
}
|
|
118774
|
-
|
|
118775
|
-
// src/contracts/price-oracle/transactions.ts
|
|
118776
|
-
async function startPriceOracleTx(lucid3, assetName, startPrice, oracleParams, now2 = Date.now(), refOutRef) {
|
|
118777
|
-
if (!refOutRef) {
|
|
118778
|
-
refOutRef = (await lucid3.wallet().getUtxos())[0];
|
|
118779
|
-
}
|
|
118780
|
-
const [tx, oracleNftPolicyId] = await oneShotMintTx(lucid3, {
|
|
118781
|
-
referenceOutRef: {
|
|
118782
|
-
txHash: refOutRef.txHash,
|
|
118783
|
-
outputIdx: BigInt(refOutRef.outputIndex)
|
|
118784
|
-
},
|
|
118785
|
-
mintAmounts: [
|
|
118786
|
-
{
|
|
118787
|
-
tokenName: fromText(assetName),
|
|
118788
|
-
amount: 1n
|
|
118789
|
-
}
|
|
118790
|
-
]
|
|
118791
|
-
});
|
|
118792
|
-
const priceOracleNft = {
|
|
118793
|
-
currencySymbol: oracleNftPolicyId,
|
|
118794
|
-
tokenName: fromText(assetName)
|
|
118795
|
-
};
|
|
118796
|
-
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
118797
|
-
const oracleDatum = {
|
|
118798
|
-
price: startPrice,
|
|
118799
|
-
expiration: BigInt(now2) + oracleParams.expiration
|
|
118800
|
-
};
|
|
118801
|
-
tx.pay.ToContract(
|
|
118802
|
-
validatorToAddress(lucid3.config().network, oracleValidator),
|
|
118803
|
-
{ kind: "inline", value: serialisePriceOracleDatum(oracleDatum) },
|
|
118804
|
-
addAssets(mkLovelacesOf(5000000n), mkAssetsOf(priceOracleNft, 1n))
|
|
118805
|
-
);
|
|
118806
|
-
return [tx, { oracleNft: priceOracleNft }];
|
|
118807
|
-
}
|
|
118808
|
-
async function feedPriceOracleTx(lucid3, oracle, newPrice, oracleParams, currentSlot) {
|
|
118809
|
-
const network = lucid3.config().network;
|
|
118810
|
-
const currentTime = BigInt(slotToUnixTime(network, currentSlot));
|
|
118811
|
-
const priceOracleUtxo = await resolveUtxo(
|
|
118812
|
-
oracle,
|
|
118813
|
-
lucid3,
|
|
118814
|
-
"Expected a single price oracle UTXO"
|
|
118815
|
-
);
|
|
118816
|
-
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
118817
|
-
return lucid3.newTx().validFrom(Number(currentTime - oracleParams.biasTime) + ONE_SECOND).validTo(Number(currentTime + oracleParams.biasTime) - ONE_SECOND).attach.SpendingValidator(oracleValidator).collectFrom(
|
|
118818
|
-
[priceOracleUtxo],
|
|
118819
|
-
serialisePriceOracleRedeemer({
|
|
118820
|
-
currentTime,
|
|
118821
|
-
newPrice
|
|
118822
|
-
})
|
|
118823
|
-
).pay.ToContract(
|
|
118824
|
-
priceOracleUtxo.address,
|
|
118825
|
-
{
|
|
118826
|
-
kind: "inline",
|
|
118827
|
-
value: serialisePriceOracleDatum({
|
|
118828
|
-
price: newPrice,
|
|
118829
|
-
expiration: currentTime + oracleParams.expiration
|
|
118830
|
-
})
|
|
118831
|
-
},
|
|
118832
|
-
priceOracleUtxo.assets
|
|
118833
|
-
).addSignerKey(oracleParams.owner);
|
|
118834
|
-
}
|
|
118835
|
-
|
|
118836
118761
|
// src/validators/collector-validator.ts
|
|
118837
118762
|
var _collectorValidator = {
|
|
118838
118763
|
type: "PlutusScriptV2",
|
|
@@ -119779,6 +119704,54 @@ async function submitAndAwaitTx(lucid3, tx) {
|
|
|
119779
119704
|
return txHash;
|
|
119780
119705
|
}
|
|
119781
119706
|
|
|
119707
|
+
// src/contracts/price-oracle/scripts.ts
|
|
119708
|
+
var priceOracleValidatorData = {
|
|
119709
|
+
type: "PlutusV2",
|
|
119710
|
+
cborHex: "590ba5590ba20100003232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323233027222232325335333006533357346074607e0022646605a60586ae84004dd69aba135744002607c00206e64a666ae68c0ecc1000044c8c8c848cc00400c008c0b8d5d09aba2002375a6ae84004c0fc0040e0dd50022999ab9a303a303f002132321233001003002357426ae88c0fc00cd5d0981f00101b8890008a99ab9c49103505435001637540086ea8004cc09c8888c8d4014888d40188c88c94cd54cd4ccd54c0d40e0c0a80a4c0ac01ccc0b08004d40048888888888880100e44cd5ce24812d546865207472616e73616374696f6e206973206e6f74207369676e6564206279206f7261636c65206f776e657200030132533553355335333553036039302b02a253335302135001202103e215333573466ebcc118cd5d0182319aba0375000a6ec4080cd5d01ba835500b03937620400022a66a666036446a0044466603e446a00444a666ae68c12c004400c4cc11848ccc00401c00c00800c00c0040c0cd54c0e80ec8d400488cc0e0008cd54c0f40f88d400488cc0ec008ccd4004dc0a4000e048cdc0800a400000266aa607407646a0024466070004666a002466aa607c07e46a0024466078004604600200244666038066004002466aa607c07e46a0024466078004604000200266602e05c666050400204e6a004404e0060784426a004444a66a0082a666ae68cdd78018238a999ab9a3375e00408e2a666ae68cdc4000a400006e2666ae68cdc4800a410125e80206a07006e06e44072064407e6044014074266ae712401024c310003103a1335738921156f757470757420646f6573206e6f74206d6174636800031153355333573466e2400d20001335738921165072696365206d75737420626520706f7369746976650003103a15335533535353301275a6a00407e06e44a666a00442a666ae68cdc419b8000100935500c03a0331333573466e24004d540300e80c40d00c80c84d4cc049d69a80101f911a801112999a99980980a980f19b8100900b0021533500113330120150030081333012015003008034133301201500300803003a13357389212345787069726174696f6e2074696d65206973206e6f742070726f7065726c792073657400031030030333025200102435302635533530270092100116036202402f302d350080393302f3016337000020060542a666a602e6aa66a60320022602602a442a66a0022004442602e032402e02842a66a6666666ae900048c94ccd5cd181d98200008991999aab9f001202d23233335573e002405e46666aae7cd5d1001119299a9999999aba400123253335734608660900022646666aae7c00480d48cccd55cf9aba20022533530203574200642605e00206a406c07a078608e0020646ea800880c880c880c880c80e4854cd4c070d5d08029098159981a8010008188181aba1005203003703635744004068607e0020546ea800880a880a880a880a80c48400405480548c94ccd5cd181b181d800899191919091998008028018011bad357426ae88008dd69aba10013574460760046ae84c0e80040ccdd50009111a801111a801912999a9998040038020010a99a8018800819814819911192999a80190a999a80190a999a80290980200b0980180a8a999a80210980200b0980180a80c0060a999a80210980180a8980100a0a999a80190980180a8980100a00b8a999a801100700b0068a999a80110a999a80210980180a8980100a0a999a80190980180a8980100a00b8058a999a80190980100a098008098a999a80110980100a0980080980b12999a80110a999a80210a999a802109998040038010008b0b0b0060a999a80190a999a801909998038030010008b0b0b00580691a80091111111003891999999980091199ab9a3370e00400204004644a666ae68cdc38010008098a999ab9a3371200400201401044666ae68cdc400100081001191199ab9a3371200400204004644666ae68cdc480100081181011199ab9a3371000400204604044a666ae68cdc480100088008801112999ab9a33712004002200420024464a666ae68c0c8c0dc0044c8c8cc0994ccd5cd181a181c801099813198038029aba130380023006357426ae88c0e00080c54ccd5cd181a181c800899813198038029aba130380013006357426ae88c0e00040c4dd51aba135744606e0046ea8d5d0981b0008179baa0012325333573460620020522a666ae68c0c000407c0b4c0d0dd50009119192999ab9a303300100815333573460640022601460086ae84c0d400854ccd5cd1818800803017181a8009baa00122233355302302702a335530260272350012233024002300b001333553023027223500222533533355302802b301d01c235001223300a002005006100313302e00400301c001335530260272350012233024002330382253350011300a003221350022253353300c002008112223300200a0041300600300400211009212223001004112220012230302253350011003221330060023004001212223003004233333335748002403040304030460206eb4008806007c94cd5ce2481286578706563746564206f6e6c7920612073696e676c6520636f6e74696e75696e67206f7574707574001615335738920117496e76616c696420646174756d20696e206f757470757400164988880088c8c94ccd5cd1813000899091118010021aba13028002153335734604a002264244460020086ae84c0a000854ccd5cd181200080201098140009baa00111003253353007001213335530150192235300535300935003019222200422353007350042222004225333573466ebc01000854ccd5cd19baf0030011330220060051005100500e3300d00735300f3500201b22222222222200a15335738921024c660016232533357346040604a0022646424660020060046ae84d5d118128011aba1302400101d3754002444006660024002eb4888cc09088cccd55cf80090071191980e9980a180398138009803181300098021aba2003357420040306eac0048c94ccd5cd180e181080089919191919190919998008038028018011aba1357440046ae84004d5d10011aba10013574460420046ae84c080004064dd5000919191999aa999ab9a3370e90030008990911118020029aba13020002153335734603c00226424444600400a6ae84c08000854ccd5cd180e8008990911118008029aba13020002153335734603800226424444600600a6ae84c0800080648034803480348ccd54c048054cc03c894cd40088400c400403494ccd5cd19baf002350010181300600100d3300923253335734603e60480022646424660020060046ae84d5d118120011aba1302300101c37540026a60166a00802e44444444444401860400026ea8d40040408488c00800c48cc004894cd400804c40040208cc02488ccd400c04c008004d400403488ccd5cd19baf002001004007223301c2233335573e002400c466028600a6ae84008c00cd5d10010081bac001100d23253335734602860320022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d1180c8011aba1301800101137540022002200c464a666ae68c044c0580044dd69aba1301500100e37540024424660020060044446006600400260244422444a66a00220044426600a004666aa600e01600a00800260224422444a66a00226a00600c442666a00a0186008004666aa600e01400a00800244002601e442244a66a00200c44266014600800466aa600c00e00800224002220024400444244660020080062a66ae712411f496e76616c696420646174756d20746f20636865636b4f776e4f757470757400161533573892010350543100162222222222220054c1014000370e90001b8748008dc3a40086e9520005573caae748c8c00400488cc00cc008008005"
|
|
119711
|
+
};
|
|
119712
|
+
function mkPriceOracleValidator(params) {
|
|
119713
|
+
return {
|
|
119714
|
+
type: priceOracleValidatorData.type,
|
|
119715
|
+
script: applyParamsToScript(priceOracleValidatorData.cborHex, [
|
|
119716
|
+
castPriceOracleParams(params)
|
|
119717
|
+
])
|
|
119718
|
+
};
|
|
119719
|
+
}
|
|
119720
|
+
|
|
119721
|
+
// src/contracts/price-oracle/transactions.ts
|
|
119722
|
+
async function startPriceOracleTx(lucid3, assetName, startPrice, oracleParams, now2 = Date.now(), refOutRef) {
|
|
119723
|
+
if (!refOutRef) {
|
|
119724
|
+
refOutRef = (await lucid3.wallet().getUtxos())[0];
|
|
119725
|
+
}
|
|
119726
|
+
const [tx, oracleNftPolicyId] = await oneShotMintTx(lucid3, {
|
|
119727
|
+
referenceOutRef: {
|
|
119728
|
+
txHash: refOutRef.txHash,
|
|
119729
|
+
outputIdx: BigInt(refOutRef.outputIndex)
|
|
119730
|
+
},
|
|
119731
|
+
mintAmounts: [
|
|
119732
|
+
{
|
|
119733
|
+
tokenName: fromText(assetName),
|
|
119734
|
+
amount: 1n
|
|
119735
|
+
}
|
|
119736
|
+
]
|
|
119737
|
+
});
|
|
119738
|
+
const priceOracleNft = {
|
|
119739
|
+
currencySymbol: oracleNftPolicyId,
|
|
119740
|
+
tokenName: fromText(assetName)
|
|
119741
|
+
};
|
|
119742
|
+
const oracleValidator = mkPriceOracleValidator(oracleParams);
|
|
119743
|
+
const oracleDatum = {
|
|
119744
|
+
price: startPrice,
|
|
119745
|
+
expiration: BigInt(now2) + oracleParams.expiration
|
|
119746
|
+
};
|
|
119747
|
+
tx.pay.ToContract(
|
|
119748
|
+
validatorToAddress(lucid3.config().network, oracleValidator),
|
|
119749
|
+
{ kind: "inline", value: serialisePriceOracleDatum(oracleDatum) },
|
|
119750
|
+
addAssets(mkLovelacesOf(5000000n), mkAssetsOf(priceOracleNft, 1n))
|
|
119751
|
+
);
|
|
119752
|
+
return [tx, { oracleNft: priceOracleNft }];
|
|
119753
|
+
}
|
|
119754
|
+
|
|
119782
119755
|
// src/scripts/auth-token-policy.ts
|
|
119783
119756
|
var authPolicyData = {
|
|
119784
119757
|
type: "PlutusV2",
|
|
@@ -120635,7 +120608,6 @@ export {
|
|
|
120635
120608
|
endProposal,
|
|
120636
120609
|
executeProposal,
|
|
120637
120610
|
feedInterestOracle,
|
|
120638
|
-
feedPriceOracleTx,
|
|
120639
120611
|
findStakingManager,
|
|
120640
120612
|
findStakingManagerByOutRef,
|
|
120641
120613
|
findStakingPositionByOutRef,
|
|
@@ -120689,7 +120661,6 @@ export {
|
|
|
120689
120661
|
openCdp,
|
|
120690
120662
|
openLrp,
|
|
120691
120663
|
openStakingPosition,
|
|
120692
|
-
oracleExpirationAwareValidity,
|
|
120693
120664
|
parseAccountDatum,
|
|
120694
120665
|
parseCdpDatum,
|
|
120695
120666
|
parseCdpDatumOrThrow,
|
|
@@ -120755,7 +120726,6 @@ export {
|
|
|
120755
120726
|
spMul,
|
|
120756
120727
|
spSub,
|
|
120757
120728
|
startInterestOracle,
|
|
120758
|
-
startPriceOracleTx,
|
|
120759
120729
|
submitAndAwaitTx,
|
|
120760
120730
|
summarizeActualLeverageRedemptions,
|
|
120761
120731
|
toSystemParamsAsset,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -23,9 +23,6 @@ export * from './contracts/interest-oracle/helpers';
|
|
|
23
23
|
export * from './contracts/version-registry/types';
|
|
24
24
|
export * from './contracts/version-registry/scripts';
|
|
25
25
|
export * from './contracts/treasury/transactions';
|
|
26
|
-
export * from './contracts/price-oracle/transactions';
|
|
27
|
-
export * from './contracts/price-oracle/types';
|
|
28
|
-
export * from './contracts/price-oracle/helpers';
|
|
29
26
|
export * from './utils/lucid-utils';
|
|
30
27
|
export * from './contracts/stability-pool/helpers';
|
|
31
28
|
export * from './utils/time-helpers';
|