@indigo-labs/indigo-sdk 0.2.11 → 0.2.12

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
@@ -1613,6 +1613,14 @@ declare function feedInterestOracle(params: InterestOracleParams, newInterestRat
1613
1613
 
1614
1614
  declare function mkInterestOracleValidator(params: InterestOracleParams): SpendingValidator;
1615
1615
 
1616
+ declare function calculateUnitaryInterest(timePeriod: bigint, interestRate: bigint): bigint;
1617
+ declare function calculateUnitaryInterestSinceOracleLastUpdated(now: bigint, oracleDatum: InterestOracleDatum): bigint;
1618
+ declare function calculateAccruedInterest(now: bigint, unitaryInterestSnapshot: bigint, mintedAmount: bigint, interestLastSettled: bigint, interestOracleDatum: InterestOracleDatum): bigint;
1619
+ /**
1620
+ * Calculate the amount of interest needed to achieve 100% collateral ratio.
1621
+ */
1622
+ declare function computeInterestLovelacesFor100PercentCR(collateral: bigint, mintedAmt: bigint, price: OnChainDecimal): bigint;
1623
+
1616
1624
  declare const VersionRecordTokenParamsSchema: _lucid_evolution_lucid.TObject<{
1617
1625
  upgradeToken: _lucid_evolution_lucid.TObject<{
1618
1626
  currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
@@ -2212,4 +2220,4 @@ declare function calculateCollateralRatioFromLeverage(iasset: string, leverage:
2212
2220
  */
2213
2221
  declare function calculateLeverageFromCollateralRatio(iasset: string, collateralRatioPercentage: OnChainDecimal, baseCollateral: bigint, iassetPrice: OnChainDecimal, debtMintingFeePercentage: OnChainDecimal, redemptionReimbursementPercentage: OnChainDecimal, lrpParams: LrpParamsSP, allLrps: [UTxO, LRPDatum][]): number | undefined;
2214
2222
 
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 };
2223
+ 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, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, 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, 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
@@ -1613,6 +1613,14 @@ declare function feedInterestOracle(params: InterestOracleParams, newInterestRat
1613
1613
 
1614
1614
  declare function mkInterestOracleValidator(params: InterestOracleParams): SpendingValidator;
1615
1615
 
1616
+ declare function calculateUnitaryInterest(timePeriod: bigint, interestRate: bigint): bigint;
1617
+ declare function calculateUnitaryInterestSinceOracleLastUpdated(now: bigint, oracleDatum: InterestOracleDatum): bigint;
1618
+ declare function calculateAccruedInterest(now: bigint, unitaryInterestSnapshot: bigint, mintedAmount: bigint, interestLastSettled: bigint, interestOracleDatum: InterestOracleDatum): bigint;
1619
+ /**
1620
+ * Calculate the amount of interest needed to achieve 100% collateral ratio.
1621
+ */
1622
+ declare function computeInterestLovelacesFor100PercentCR(collateral: bigint, mintedAmt: bigint, price: OnChainDecimal): bigint;
1623
+
1616
1624
  declare const VersionRecordTokenParamsSchema: _lucid_evolution_lucid.TObject<{
1617
1625
  upgradeToken: _lucid_evolution_lucid.TObject<{
1618
1626
  currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
@@ -2212,4 +2220,4 @@ declare function calculateCollateralRatioFromLeverage(iasset: string, leverage:
2212
2220
  */
2213
2221
  declare function calculateLeverageFromCollateralRatio(iasset: string, collateralRatioPercentage: OnChainDecimal, baseCollateral: bigint, iassetPrice: OnChainDecimal, debtMintingFeePercentage: OnChainDecimal, redemptionReimbursementPercentage: OnChainDecimal, lrpParams: LrpParamsSP, allLrps: [UTxO, LRPDatum][]): number | undefined;
2214
2222
 
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 };
2223
+ 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, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, 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, 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
@@ -95,12 +95,15 @@ __export(index_exports, {
95
95
  balance: () => balance,
96
96
  buildRedemptionsTx: () => buildRedemptionsTx,
97
97
  burnCdp: () => burnCdp,
98
+ calculateAccruedInterest: () => calculateAccruedInterest,
98
99
  calculateAdaReward: () => calculateAdaReward,
99
100
  calculateCollateralRatioFromLeverage: () => calculateCollateralRatioFromLeverage,
100
101
  calculateIAssetRedemptionAmt: () => calculateIAssetRedemptionAmt,
101
102
  calculateLeverageFromCollateralRatio: () => calculateLeverageFromCollateralRatio,
102
103
  calculateMinCollateralCappedIAssetRedemptionAmt: () => calculateMinCollateralCappedIAssetRedemptionAmt,
103
104
  calculateTotalAdaForRedemption: () => calculateTotalAdaForRedemption,
105
+ calculateUnitaryInterest: () => calculateUnitaryInterest,
106
+ calculateUnitaryInterestSinceOracleLastUpdated: () => calculateUnitaryInterestSinceOracleLastUpdated,
104
107
  cancelLrp: () => cancelLrp,
105
108
  castCDPCreatorParams: () => castCDPCreatorParams,
106
109
  castCdpParams: () => castCdpParams,
@@ -120,6 +123,7 @@ __export(index_exports, {
120
123
  closeSpAccount: () => closeSpAccount,
121
124
  closeStakingPosition: () => closeStakingPosition,
122
125
  collectorFeeTx: () => collectorFeeTx,
126
+ computeInterestLovelacesFor100PercentCR: () => computeInterestLovelacesFor100PercentCR,
123
127
  createProposal: () => createProposal,
124
128
  createScriptAddress: () => createScriptAddress,
125
129
  createShardsChunks: () => createShardsChunks,
@@ -4735,10 +4739,7 @@ async function annulRequest(accountUtxo, params, lucid) {
4735
4739
  const oldAccountDatum = parseAccountDatum(
4736
4740
  getInlineDatumOrThrow(accountUtxo)
4737
4741
  );
4738
- const tx = lucid.newTx().readFrom([stabilityPoolScriptRef]).collectFrom(
4739
- [accountUtxo],
4740
- serialiseStabilityPoolRedeemer("AnnulRequest")
4741
- ).addSignerKey((0, import_lucid34.toHex)(oldAccountDatum.owner));
4742
+ const tx = lucid.newTx().readFrom([stabilityPoolScriptRef]).collectFrom([accountUtxo], serialiseStabilityPoolRedeemer("AnnulRequest")).addSignerKey((0, import_lucid34.toHex)(oldAccountDatum.owner));
4742
4743
  if (oldAccountDatum.request !== "Create") {
4743
4744
  tx.pay.ToContract(
4744
4745
  (0, import_lucid34.credentialToAddress)(lucid.config().network, {
@@ -4756,7 +4757,10 @@ async function annulRequest(accountUtxo, params, lucid) {
4756
4757
  }
4757
4758
  })
4758
4759
  },
4759
- mkAssetsOf(fromSystemParamsAsset(params.stabilityPoolParams.accountToken), 1n)
4760
+ mkAssetsOf(
4761
+ fromSystemParamsAsset(params.stabilityPoolParams.accountToken),
4762
+ 1n
4763
+ )
4760
4764
  );
4761
4765
  }
4762
4766
  return tx;
@@ -6200,12 +6204,15 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
6200
6204
  balance,
6201
6205
  buildRedemptionsTx,
6202
6206
  burnCdp,
6207
+ calculateAccruedInterest,
6203
6208
  calculateAdaReward,
6204
6209
  calculateCollateralRatioFromLeverage,
6205
6210
  calculateIAssetRedemptionAmt,
6206
6211
  calculateLeverageFromCollateralRatio,
6207
6212
  calculateMinCollateralCappedIAssetRedemptionAmt,
6208
6213
  calculateTotalAdaForRedemption,
6214
+ calculateUnitaryInterest,
6215
+ calculateUnitaryInterestSinceOracleLastUpdated,
6209
6216
  cancelLrp,
6210
6217
  castCDPCreatorParams,
6211
6218
  castCdpParams,
@@ -6225,6 +6232,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
6225
6232
  closeSpAccount,
6226
6233
  closeStakingPosition,
6227
6234
  collectorFeeTx,
6235
+ computeInterestLovelacesFor100PercentCR,
6228
6236
  createProposal,
6229
6237
  createScriptAddress,
6230
6238
  createShardsChunks,
package/dist/index.mjs CHANGED
@@ -4544,10 +4544,7 @@ async function annulRequest(accountUtxo, params, lucid) {
4544
4544
  const oldAccountDatum = parseAccountDatum(
4545
4545
  getInlineDatumOrThrow(accountUtxo)
4546
4546
  );
4547
- const tx = lucid.newTx().readFrom([stabilityPoolScriptRef]).collectFrom(
4548
- [accountUtxo],
4549
- serialiseStabilityPoolRedeemer("AnnulRequest")
4550
- ).addSignerKey(toHex(oldAccountDatum.owner));
4547
+ const tx = lucid.newTx().readFrom([stabilityPoolScriptRef]).collectFrom([accountUtxo], serialiseStabilityPoolRedeemer("AnnulRequest")).addSignerKey(toHex(oldAccountDatum.owner));
4551
4548
  if (oldAccountDatum.request !== "Create") {
4552
4549
  tx.pay.ToContract(
4553
4550
  credentialToAddress3(lucid.config().network, {
@@ -4565,7 +4562,10 @@ async function annulRequest(accountUtxo, params, lucid) {
4565
4562
  }
4566
4563
  })
4567
4564
  },
4568
- mkAssetsOf(fromSystemParamsAsset(params.stabilityPoolParams.accountToken), 1n)
4565
+ mkAssetsOf(
4566
+ fromSystemParamsAsset(params.stabilityPoolParams.accountToken),
4567
+ 1n
4568
+ )
4569
4569
  );
4570
4570
  }
4571
4571
  return tx;
@@ -6051,12 +6051,15 @@ export {
6051
6051
  balance,
6052
6052
  buildRedemptionsTx,
6053
6053
  burnCdp,
6054
+ calculateAccruedInterest,
6054
6055
  calculateAdaReward,
6055
6056
  calculateCollateralRatioFromLeverage,
6056
6057
  calculateIAssetRedemptionAmt,
6057
6058
  calculateLeverageFromCollateralRatio,
6058
6059
  calculateMinCollateralCappedIAssetRedemptionAmt,
6059
6060
  calculateTotalAdaForRedemption,
6061
+ calculateUnitaryInterest,
6062
+ calculateUnitaryInterestSinceOracleLastUpdated,
6060
6063
  cancelLrp,
6061
6064
  castCDPCreatorParams,
6062
6065
  castCdpParams,
@@ -6076,6 +6079,7 @@ export {
6076
6079
  closeSpAccount,
6077
6080
  closeStakingPosition,
6078
6081
  collectorFeeTx,
6082
+ computeInterestLovelacesFor100PercentCR,
6079
6083
  createProposal,
6080
6084
  createScriptAddress,
6081
6085
  createShardsChunks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigo-labs/indigo-sdk",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
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",
@@ -689,13 +689,10 @@ export async function annulRequest(
689
689
  const tx = lucid
690
690
  .newTx()
691
691
  .readFrom([stabilityPoolScriptRef])
692
- .collectFrom(
693
- [accountUtxo],
694
- serialiseStabilityPoolRedeemer('AnnulRequest'),
695
- )
692
+ .collectFrom([accountUtxo], serialiseStabilityPoolRedeemer('AnnulRequest'))
696
693
  .addSignerKey(toHex(oldAccountDatum.owner));
697
694
 
698
- if (oldAccountDatum.request !== "Create") {
695
+ if (oldAccountDatum.request !== 'Create') {
699
696
  tx.pay.ToContract(
700
697
  credentialToAddress(lucid.config().network!, {
701
698
  hash: validatorToScriptHash(
@@ -712,9 +709,12 @@ export async function annulRequest(
712
709
  },
713
710
  }),
714
711
  },
715
- mkAssetsOf(fromSystemParamsAsset(params.stabilityPoolParams.accountToken), 1n),
716
- )
712
+ mkAssetsOf(
713
+ fromSystemParamsAsset(params.stabilityPoolParams.accountToken),
714
+ 1n,
715
+ ),
716
+ );
717
717
  }
718
718
 
719
719
  return tx;
720
- }
720
+ }
@@ -131,5 +131,8 @@ export function calculateAdaReward(
131
131
  oldSnapshotAda: bigint,
132
132
  existingIndyAmount: bigint,
133
133
  ): bigint {
134
- return ((currentSnapshotAda - oldSnapshotAda) * existingIndyAmount) / rewardSnapshotPrecision;
135
- }
134
+ return (
135
+ ((currentSnapshotAda - oldSnapshotAda) * existingIndyAmount) /
136
+ rewardSnapshotPrecision
137
+ );
138
+ }
package/src/index.ts CHANGED
@@ -17,6 +17,7 @@ export * from './contracts/staking/types-new';
17
17
  export * from './contracts/interest-oracle/transactions';
18
18
  export * from './contracts/interest-oracle/types';
19
19
  export * from './contracts/interest-oracle/scripts';
20
+ export * from './contracts/interest-oracle/helpers';
20
21
  export * from './contracts/version-registry/types';
21
22
  export * from './contracts/version-registry/scripts';
22
23
  export * from './contracts/treasury/transactions';
@@ -42,7 +42,9 @@ export async function addrDetails(
42
42
  let stakeCredential = undefined;
43
43
  try {
44
44
  stakeCredential = stakeCredentialOf(addr);
45
- } catch (_) {}
45
+ } catch (_) {
46
+ // No stake credential
47
+ }
46
48
  return [paymentCredentialOf(addr), stakeCredential];
47
49
  }
48
50
 
@@ -397,7 +397,6 @@ test<MyContext>('Stability Pool - Adjust Account', async ({
397
397
  );
398
398
  });
399
399
 
400
-
401
400
  test<MyContext>('Stability Pool - Annul Request', async ({
402
401
  lucid,
403
402
  users,
@@ -548,14 +547,7 @@ test<MyContext>('Stability Pool - Annul Request', async ({
548
547
  iusdInfo.iassetTokenNameAscii,
549
548
  );
550
549
 
551
- await runAndAwaitTx(
552
- lucid,
553
- annulRequest(
554
- accountUtxo,
555
- systemParams,
556
- lucid,
557
- ),
558
- );
550
+ await runAndAwaitTx(lucid, annulRequest(accountUtxo, systemParams, lucid));
559
551
  });
560
552
 
561
553
  test<MyContext>('Stability Pool - Close Account', async ({