@indigo-labs/indigo-sdk 0.2.9 → 0.2.11

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 CHANGED
@@ -1153,6 +1153,7 @@ declare function createSpAccount(asset: string, amount: bigint, params: SystemPa
1153
1153
  declare function adjustSpAccount(asset: string, amount: bigint, accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1154
1154
  declare function closeSpAccount(accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1155
1155
  declare function processSpRequest(asset: string, stabilityPoolUtxo: UTxO, accountUtxo: UTxO, govUtxo: UTxO, iAssetUtxo: UTxO, newSnapshotUtxo: UTxO | undefined, params: SystemParams, lucid: LucidEvolution, collectorOref: OutRef): Promise<TxBuilder>;
1156
+ declare function annulRequest(accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1156
1157
 
1157
1158
  declare const SPIntegerSchema: Core.TSchema.Struct<{
1158
1159
  value: Core.TSchema.Integer;
@@ -1565,8 +1566,8 @@ declare function distributeReward(snapshotAda: bigint, adaReward: bigint, totalS
1565
1566
  declare function calculateAdaReward(currentSnapshotAda: bigint, oldSnapshotAda: bigint, existingIndyAmount: bigint): bigint;
1566
1567
 
1567
1568
  declare function openStakingPosition(amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1568
- declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
- declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
+ declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
+ declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
1571
  declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1571
1572
 
1572
1573
  declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
@@ -2211,4 +2212,4 @@ declare function calculateCollateralRatioFromLeverage(iasset: string, leverage:
2211
2212
  */
2212
2213
  declare function calculateLeverageFromCollateralRatio(iasset: string, collateralRatioPercentage: OnChainDecimal, baseCollateral: bigint, iassetPrice: OnChainDecimal, debtMintingFeePercentage: OnChainDecimal, redemptionReimbursementPercentage: OnChainDecimal, lrpParams: LrpParamsSP, allLrps: [UTxO, LRPDatum][]): number | undefined;
2213
2214
 
2214
- export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, 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, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, type SPInteger, SPIntegerSchema, 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, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, 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, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateStakingLockedAmount, vote, withdrawCdp };
2215
+ export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, 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, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, type SPInteger, SPIntegerSchema, 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, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, annulRequest, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, 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, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateStakingLockedAmount, vote, withdrawCdp };
package/dist/index.d.ts CHANGED
@@ -1153,6 +1153,7 @@ declare function createSpAccount(asset: string, amount: bigint, params: SystemPa
1153
1153
  declare function adjustSpAccount(asset: string, amount: bigint, accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1154
1154
  declare function closeSpAccount(accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1155
1155
  declare function processSpRequest(asset: string, stabilityPoolUtxo: UTxO, accountUtxo: UTxO, govUtxo: UTxO, iAssetUtxo: UTxO, newSnapshotUtxo: UTxO | undefined, params: SystemParams, lucid: LucidEvolution, collectorOref: OutRef): Promise<TxBuilder>;
1156
+ declare function annulRequest(accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1156
1157
 
1157
1158
  declare const SPIntegerSchema: Core.TSchema.Struct<{
1158
1159
  value: Core.TSchema.Integer;
@@ -1565,8 +1566,8 @@ declare function distributeReward(snapshotAda: bigint, adaReward: bigint, totalS
1565
1566
  declare function calculateAdaReward(currentSnapshotAda: bigint, oldSnapshotAda: bigint, existingIndyAmount: bigint): bigint;
1566
1567
 
1567
1568
  declare function openStakingPosition(amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1568
- declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
- declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
+ declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
+ declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
1571
  declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1571
1572
 
1572
1573
  declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
@@ -2211,4 +2212,4 @@ declare function calculateCollateralRatioFromLeverage(iasset: string, leverage:
2211
2212
  */
2212
2213
  declare function calculateLeverageFromCollateralRatio(iasset: string, collateralRatioPercentage: OnChainDecimal, baseCollateral: bigint, iassetPrice: OnChainDecimal, debtMintingFeePercentage: OnChainDecimal, redemptionReimbursementPercentage: OnChainDecimal, lrpParams: LrpParamsSP, allLrps: [UTxO, LRPDatum][]): number | undefined;
2213
2214
 
2214
- export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, 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, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, type SPInteger, SPIntegerSchema, 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, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, 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, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateStakingLockedAmount, vote, withdrawCdp };
2215
+ export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, 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, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, type SPInteger, SPIntegerSchema, 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, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, annulRequest, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, 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, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateStakingLockedAmount, vote, withdrawCdp };
package/dist/index.js CHANGED
@@ -88,6 +88,7 @@ __export(index_exports, {
88
88
  adjustSpAccount: () => adjustSpAccount,
89
89
  adjustStakingPosition: () => adjustStakingPosition,
90
90
  adjustmentHelper: () => adjustmentHelper,
91
+ annulRequest: () => annulRequest,
91
92
  approximateLeverageRedemptions: () => approximateLeverageRedemptions,
92
93
  assetClassToUnit: () => assetClassToUnit,
93
94
  assetClassValueOf: () => assetClassValueOf,
@@ -4726,6 +4727,40 @@ async function processSpRequest(asset, stabilityPoolUtxo, accountUtxo, govUtxo,
4726
4727
  }
4727
4728
  return tx;
4728
4729
  }
4730
+ async function annulRequest(accountUtxo, params, lucid) {
4731
+ const stabilityPoolScriptRef = await scriptRef(
4732
+ params.scriptReferences.stabilityPoolValidatorRef,
4733
+ lucid
4734
+ );
4735
+ const oldAccountDatum = parseAccountDatum(
4736
+ getInlineDatumOrThrow(accountUtxo)
4737
+ );
4738
+ const tx = lucid.newTx().readFrom([stabilityPoolScriptRef]).collectFrom(
4739
+ [accountUtxo],
4740
+ serialiseStabilityPoolRedeemer("AnnulRequest")
4741
+ ).addSignerKey((0, import_lucid34.toHex)(oldAccountDatum.owner));
4742
+ if (oldAccountDatum.request !== "Create") {
4743
+ tx.pay.ToContract(
4744
+ (0, import_lucid34.credentialToAddress)(lucid.config().network, {
4745
+ hash: (0, import_lucid34.validatorToScriptHash)(
4746
+ mkStabilityPoolValidatorFromSP(params.stabilityPoolParams)
4747
+ ),
4748
+ type: "Script"
4749
+ }),
4750
+ {
4751
+ kind: "inline",
4752
+ value: serialiseStabilityPoolDatum({
4753
+ Account: {
4754
+ ...oldAccountDatum,
4755
+ request: null
4756
+ }
4757
+ })
4758
+ },
4759
+ mkAssetsOf(fromSystemParamsAsset(params.stabilityPoolParams.accountToken), 1n)
4760
+ );
4761
+ }
4762
+ return tx;
4763
+ }
4729
4764
 
4730
4765
  // src/contracts/staking/transactions.ts
4731
4766
  var import_lucid35 = require("@lucid-evolution/lucid");
@@ -4785,9 +4820,8 @@ async function openStakingPosition(amount, params, lucid, stakingManagerRef) {
4785
4820
  }
4786
4821
  ).addSignerKey(pkh.hash);
4787
4822
  }
4788
- async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, stakingManagerRef) {
4823
+ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, currentSlot, stakingManagerRef) {
4789
4824
  const network = lucid.config().network;
4790
- const currentSlot = lucid.currentSlot();
4791
4825
  const currentTime = (0, import_lucid35.slotToUnixTime)(network, currentSlot) - ONE_SECOND;
4792
4826
  const stakingPositionOut = await findStakingPositionByOutRef(
4793
4827
  stakingPositionRef,
@@ -4847,9 +4881,8 @@ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid,
4847
4881
  }
4848
4882
  ).addSignerKey((0, import_lucid35.toHex)(stakingPositionOut.datum.owner));
4849
4883
  }
4850
- async function closeStakingPosition(stakingPositionRef, params, lucid, stakingManagerRef) {
4884
+ async function closeStakingPosition(stakingPositionRef, params, lucid, currentSlot, stakingManagerRef) {
4851
4885
  const network = lucid.config().network;
4852
- const currentSlot = lucid.currentSlot();
4853
4886
  const currentTime = (0, import_lucid35.slotToUnixTime)(network, currentSlot) - ONE_SECOND;
4854
4887
  const stakingPositionOut = await findStakingPositionByOutRef(
4855
4888
  stakingPositionRef,
@@ -6160,6 +6193,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
6160
6193
  adjustSpAccount,
6161
6194
  adjustStakingPosition,
6162
6195
  adjustmentHelper,
6196
+ annulRequest,
6163
6197
  approximateLeverageRedemptions,
6164
6198
  assetClassToUnit,
6165
6199
  assetClassValueOf,
package/dist/index.mjs CHANGED
@@ -4536,6 +4536,40 @@ async function processSpRequest(asset, stabilityPoolUtxo, accountUtxo, govUtxo,
4536
4536
  }
4537
4537
  return tx;
4538
4538
  }
4539
+ async function annulRequest(accountUtxo, params, lucid) {
4540
+ const stabilityPoolScriptRef = await scriptRef(
4541
+ params.scriptReferences.stabilityPoolValidatorRef,
4542
+ lucid
4543
+ );
4544
+ const oldAccountDatum = parseAccountDatum(
4545
+ getInlineDatumOrThrow(accountUtxo)
4546
+ );
4547
+ const tx = lucid.newTx().readFrom([stabilityPoolScriptRef]).collectFrom(
4548
+ [accountUtxo],
4549
+ serialiseStabilityPoolRedeemer("AnnulRequest")
4550
+ ).addSignerKey(toHex(oldAccountDatum.owner));
4551
+ if (oldAccountDatum.request !== "Create") {
4552
+ tx.pay.ToContract(
4553
+ credentialToAddress3(lucid.config().network, {
4554
+ hash: validatorToScriptHash2(
4555
+ mkStabilityPoolValidatorFromSP(params.stabilityPoolParams)
4556
+ ),
4557
+ type: "Script"
4558
+ }),
4559
+ {
4560
+ kind: "inline",
4561
+ value: serialiseStabilityPoolDatum({
4562
+ Account: {
4563
+ ...oldAccountDatum,
4564
+ request: null
4565
+ }
4566
+ })
4567
+ },
4568
+ mkAssetsOf(fromSystemParamsAsset(params.stabilityPoolParams.accountToken), 1n)
4569
+ );
4570
+ }
4571
+ return tx;
4572
+ }
4539
4573
 
4540
4574
  // src/contracts/staking/transactions.ts
4541
4575
  import {
@@ -4603,9 +4637,8 @@ async function openStakingPosition(amount, params, lucid, stakingManagerRef) {
4603
4637
  }
4604
4638
  ).addSignerKey(pkh.hash);
4605
4639
  }
4606
- async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, stakingManagerRef) {
4640
+ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, currentSlot, stakingManagerRef) {
4607
4641
  const network = lucid.config().network;
4608
- const currentSlot = lucid.currentSlot();
4609
4642
  const currentTime = slotToUnixTime5(network, currentSlot) - ONE_SECOND;
4610
4643
  const stakingPositionOut = await findStakingPositionByOutRef(
4611
4644
  stakingPositionRef,
@@ -4665,9 +4698,8 @@ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid,
4665
4698
  }
4666
4699
  ).addSignerKey(toHex2(stakingPositionOut.datum.owner));
4667
4700
  }
4668
- async function closeStakingPosition(stakingPositionRef, params, lucid, stakingManagerRef) {
4701
+ async function closeStakingPosition(stakingPositionRef, params, lucid, currentSlot, stakingManagerRef) {
4669
4702
  const network = lucid.config().network;
4670
- const currentSlot = lucid.currentSlot();
4671
4703
  const currentTime = slotToUnixTime5(network, currentSlot) - ONE_SECOND;
4672
4704
  const stakingPositionOut = await findStakingPositionByOutRef(
4673
4705
  stakingPositionRef,
@@ -6012,6 +6044,7 @@ export {
6012
6044
  adjustSpAccount,
6013
6045
  adjustStakingPosition,
6014
6046
  adjustmentHelper,
6047
+ annulRequest,
6015
6048
  approximateLeverageRedemptions,
6016
6049
  assetClassToUnit,
6017
6050
  assetClassValueOf,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigo-labs/indigo-sdk",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Indigo SDK for interacting with Indigo endpoints via lucid-evolution",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -12,7 +12,7 @@ import {
12
12
  toHex,
13
13
  } from '@lucid-evolution/lucid';
14
14
  import { ActionReturnDatum } from './types';
15
- import { SystemParams } from '../../types/system-params';
15
+ import { fromSystemParamsAsset, SystemParams } from '../../types/system-params';
16
16
  import {
17
17
  addrDetails,
18
18
  getInlineDatumOrThrow,
@@ -49,6 +49,7 @@ import {
49
49
  StabilityPoolSnapshot,
50
50
  } from './types-new';
51
51
  import { collectorFeeTx } from '../collector/transactions';
52
+ import { mkAssetsOf } from '../../utils/value-helpers';
52
53
 
53
54
  export async function createSpAccount(
54
55
  asset: string,
@@ -670,3 +671,50 @@ export async function processSpRequest(
670
671
 
671
672
  return tx;
672
673
  }
674
+
675
+ export async function annulRequest(
676
+ accountUtxo: UTxO,
677
+ params: SystemParams,
678
+ lucid: LucidEvolution,
679
+ ): Promise<TxBuilder> {
680
+ const stabilityPoolScriptRef = await scriptRef(
681
+ params.scriptReferences.stabilityPoolValidatorRef,
682
+ lucid,
683
+ );
684
+
685
+ const oldAccountDatum: AccountContent = parseAccountDatum(
686
+ getInlineDatumOrThrow(accountUtxo),
687
+ );
688
+
689
+ const tx = lucid
690
+ .newTx()
691
+ .readFrom([stabilityPoolScriptRef])
692
+ .collectFrom(
693
+ [accountUtxo],
694
+ serialiseStabilityPoolRedeemer('AnnulRequest'),
695
+ )
696
+ .addSignerKey(toHex(oldAccountDatum.owner));
697
+
698
+ if (oldAccountDatum.request !== "Create") {
699
+ tx.pay.ToContract(
700
+ credentialToAddress(lucid.config().network!, {
701
+ hash: validatorToScriptHash(
702
+ mkStabilityPoolValidatorFromSP(params.stabilityPoolParams),
703
+ ),
704
+ type: 'Script',
705
+ }),
706
+ {
707
+ kind: 'inline',
708
+ value: serialiseStabilityPoolDatum({
709
+ Account: {
710
+ ...oldAccountDatum,
711
+ request: null,
712
+ },
713
+ }),
714
+ },
715
+ mkAssetsOf(fromSystemParamsAsset(params.stabilityPoolParams.accountToken), 1n),
716
+ )
717
+ }
718
+
719
+ return tx;
720
+ }
@@ -121,11 +121,10 @@ export async function adjustStakingPosition(
121
121
  amount: bigint,
122
122
  params: SystemParams,
123
123
  lucid: LucidEvolution,
124
+ currentSlot: number,
124
125
  stakingManagerRef?: OutRef,
125
126
  ): Promise<TxBuilder> {
126
-
127
127
  const network = lucid.config().network!;
128
- const currentSlot = lucid.currentSlot();
129
128
  const currentTime = slotToUnixTime(network, currentSlot) - ONE_SECOND;
130
129
 
131
130
  const stakingPositionOut = await findStakingPositionByOutRef(
@@ -215,10 +214,10 @@ export async function closeStakingPosition(
215
214
  stakingPositionRef: OutRef,
216
215
  params: SystemParams,
217
216
  lucid: LucidEvolution,
217
+ currentSlot: number,
218
218
  stakingManagerRef?: OutRef,
219
219
  ): Promise<TxBuilder> {
220
220
  const network = lucid.config().network!;
221
- const currentSlot = lucid.currentSlot();
222
221
  const currentTime = slotToUnixTime(network, currentSlot) - ONE_SECOND;
223
222
 
224
223
  const stakingPositionOut = await findStakingPositionByOutRef(
@@ -7,6 +7,7 @@ import { init } from './endpoints/initialize';
7
7
  import {
8
8
  addrDetails,
9
9
  adjustSpAccount,
10
+ annulRequest,
10
11
  closeSpAccount,
11
12
  createSpAccount,
12
13
  fromSystemParamsAsset,
@@ -396,6 +397,167 @@ test<MyContext>('Stability Pool - Adjust Account', async ({
396
397
  );
397
398
  });
398
399
 
400
+
401
+ test<MyContext>('Stability Pool - Annul Request', async ({
402
+ lucid,
403
+ users,
404
+ emulator,
405
+ }: MyContext) => {
406
+ lucid.selectWallet.fromSeed(users.admin.seedPhrase);
407
+ const [systemParams, [iusdInfo]] = await init(lucid, [iusdInitialAssetCfg]);
408
+ lucid.selectWallet.fromSeed(users.user.seedPhrase);
409
+ const [pkh, _] = await addrDetails(lucid);
410
+
411
+ const iasset = await findIAsset(
412
+ lucid,
413
+ systemParams.validatorHashes.cdpHash,
414
+ fromSystemParamsAsset(systemParams.cdpParams.iAssetAuthToken),
415
+ iusdInfo.iassetTokenNameAscii,
416
+ );
417
+
418
+ await runAndAwaitTx(
419
+ lucid,
420
+ openCdp(
421
+ 1_000_000_000n,
422
+ 20n,
423
+ systemParams,
424
+ await findRandomCdpCreator(
425
+ lucid,
426
+ systemParams.validatorHashes.cdpCreatorHash,
427
+ fromSystemParamsAsset(systemParams.cdpCreatorParams.cdpCreatorNft),
428
+ ),
429
+ iasset.utxo,
430
+ await findPriceOracle(
431
+ lucid,
432
+ match(iasset.datum.price)
433
+ .with({ Oracle: { content: P.select() } }, (oracleNft) => oracleNft)
434
+ .otherwise(() => {
435
+ throw new Error('Expected active oracle');
436
+ }),
437
+ ),
438
+ await findInterestOracle(lucid, iasset.datum.interestOracleNft),
439
+ await findRandomCollector(
440
+ lucid,
441
+ systemParams.validatorHashes.collectorHash,
442
+ ),
443
+ lucid,
444
+ emulator.slot,
445
+ ),
446
+ );
447
+
448
+ await runAndAwaitTx(
449
+ lucid,
450
+ createSpAccount(iusdInfo.iassetTokenNameAscii, 10n, systemParams, lucid),
451
+ );
452
+
453
+ lucid.selectWallet.fromSeed(users.admin.seedPhrase);
454
+
455
+ let stabilityPoolUtxo = await findStabilityPool(
456
+ lucid,
457
+ systemParams.validatorHashes.stabilityPoolHash,
458
+ {
459
+ currencySymbol:
460
+ systemParams.stabilityPoolParams.stabilityPoolToken[0].unCurrencySymbol,
461
+ tokenName: fromText(
462
+ systemParams.stabilityPoolParams.stabilityPoolToken[1].unTokenName,
463
+ ),
464
+ },
465
+ iusdInfo.iassetTokenNameAscii,
466
+ );
467
+
468
+ let accountUtxo = await findStabilityPoolAccount(
469
+ lucid,
470
+ systemParams.validatorHashes.stabilityPoolHash,
471
+ pkh.hash,
472
+ iusdInfo.iassetTokenNameAscii,
473
+ );
474
+
475
+ const assetUtxo = await findIAsset(
476
+ lucid,
477
+ systemParams.validatorHashes.cdpHash,
478
+ {
479
+ currencySymbol:
480
+ systemParams.cdpParams.iAssetAuthToken[0].unCurrencySymbol,
481
+ tokenName: fromText(
482
+ systemParams.cdpParams.iAssetAuthToken[1].unTokenName,
483
+ ),
484
+ },
485
+ iusdInfo.iassetTokenNameAscii,
486
+ );
487
+
488
+ const govUtxo = await findGov(lucid, systemParams.validatorHashes.govHash, {
489
+ currencySymbol: systemParams.govParams.govNFT[0].unCurrencySymbol,
490
+ tokenName: fromText(systemParams.govParams.govNFT[1].unTokenName),
491
+ });
492
+
493
+ await runAndAwaitTx(
494
+ lucid,
495
+ processSpRequest(
496
+ iusdInfo.iassetTokenNameAscii,
497
+ stabilityPoolUtxo,
498
+ accountUtxo,
499
+ govUtxo.utxo,
500
+ assetUtxo.utxo,
501
+ undefined,
502
+ systemParams,
503
+ lucid,
504
+ await findRandomCollector(
505
+ lucid,
506
+ systemParams.validatorHashes.collectorHash,
507
+ ),
508
+ ),
509
+ );
510
+
511
+ lucid.selectWallet.fromSeed(users.user.seedPhrase);
512
+
513
+ stabilityPoolUtxo = await findStabilityPool(
514
+ lucid,
515
+ systemParams.validatorHashes.stabilityPoolHash,
516
+ {
517
+ currencySymbol:
518
+ systemParams.stabilityPoolParams.stabilityPoolToken[0].unCurrencySymbol,
519
+ tokenName: fromText(
520
+ systemParams.stabilityPoolParams.stabilityPoolToken[1].unTokenName,
521
+ ),
522
+ },
523
+ iusdInfo.iassetTokenNameAscii,
524
+ );
525
+
526
+ accountUtxo = await findStabilityPoolAccount(
527
+ lucid,
528
+ systemParams.validatorHashes.stabilityPoolHash,
529
+ pkh.hash,
530
+ iusdInfo.iassetTokenNameAscii,
531
+ );
532
+
533
+ await runAndAwaitTx(
534
+ lucid,
535
+ adjustSpAccount(
536
+ iusdInfo.iassetTokenNameAscii,
537
+ 10n,
538
+ accountUtxo,
539
+ systemParams,
540
+ lucid,
541
+ ),
542
+ );
543
+
544
+ accountUtxo = await findStabilityPoolAccount(
545
+ lucid,
546
+ systemParams.validatorHashes.stabilityPoolHash,
547
+ pkh.hash,
548
+ iusdInfo.iassetTokenNameAscii,
549
+ );
550
+
551
+ await runAndAwaitTx(
552
+ lucid,
553
+ annulRequest(
554
+ accountUtxo,
555
+ systemParams,
556
+ lucid,
557
+ ),
558
+ );
559
+ });
560
+
399
561
  test<MyContext>('Stability Pool - Close Account', async ({
400
562
  lucid,
401
563
  users,