@indigo-labs/indigo-sdk 0.3.25 → 0.3.27
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 +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +99 -47
- package/dist/index.mjs +100 -49
- package/package.json +1 -1
- package/src/contracts/stability-pool/helpers.ts +5 -2
- package/src/contracts/stability-pool/transactions.ts +129 -47
- package/src/contracts/stableswap/helpers.ts +1 -1
- package/src/contracts/stableswap/transactions.ts +3 -2
- package/tests/stability-pool.test.ts +387 -198
- package/tests/stableswap/stableswap.test.ts +246 -0
- package/tests/utils/benchmark-utils.ts +49 -0
package/dist/index.d.mts
CHANGED
|
@@ -3244,7 +3244,7 @@ declare function spMul(a: SPInteger, b: SPInteger): SPInteger;
|
|
|
3244
3244
|
declare function spDiv(a: SPInteger, b: SPInteger): SPInteger;
|
|
3245
3245
|
declare function spZeroNegatives(a: SPInteger): SPInteger;
|
|
3246
3246
|
|
|
3247
|
-
declare const BASE_MAX_TX_FEE =
|
|
3247
|
+
declare const BASE_MAX_TX_FEE = 1250000n;
|
|
3248
3248
|
declare const MAX_E2S2S_ENTRIES_COUNT = 5;
|
|
3249
3249
|
declare const initSumVal: SPInteger;
|
|
3250
3250
|
declare const initSpState: StateSnapshot;
|
|
@@ -3266,6 +3266,10 @@ declare function createProcessRequestAccountRedeemer(e2s2sIdxs: [FindE2S2SIdxRes
|
|
|
3266
3266
|
e2s2sRefInputs: UTxO[];
|
|
3267
3267
|
mkProcessRequestAccountRedeemerContent: (poolInputIdx: bigint, accountInputIdx: bigint) => ProcessRequestAccountContent;
|
|
3268
3268
|
};
|
|
3269
|
+
/**
|
|
3270
|
+
* Sp account rewards per collateral asset.
|
|
3271
|
+
*/
|
|
3272
|
+
declare function rewardsPerAsset(poolAssetStates: readonly AssetState[], e2s2sIdxs: [FindE2S2SIdxResult, option.Option<FindE2S2SIdxResult>][], accountAssetSums: readonly (readonly [AssetClass, SPInteger])[], accountState: StateSnapshot): [AssetClass, bigint][];
|
|
3269
3273
|
declare function getUpdatedAccountDeposit(poolState: StateSnapshot, accountState: StateSnapshot): SPInteger;
|
|
3270
3274
|
declare function updateAccount(pool: StabilityPoolContent, account: AccountContent, e2s2sIdxs: [FindE2S2SIdxResult, option.Option<FindE2S2SIdxResult>][]): {
|
|
3271
3275
|
updatedAccountContent: AccountContent;
|
|
@@ -4514,7 +4518,7 @@ declare function attachOracle(iasset: Uint8Array<ArrayBufferLike>, collateralAss
|
|
|
4514
4518
|
referenceInputs: UTxO[];
|
|
4515
4519
|
}>;
|
|
4516
4520
|
|
|
4517
|
-
declare const BASE_MAX_EXECUTION_FEE =
|
|
4521
|
+
declare const BASE_MAX_EXECUTION_FEE = 1620000n;
|
|
4518
4522
|
declare function createDestinationDatum(datum: Data$1.Data | null, outRef: OutRef): string;
|
|
4519
4523
|
|
|
4520
4524
|
declare function createStableswapOrder(iasset: string, collateralAsset: AssetClass, amount: bigint, minting: boolean, poolDatum: StableswapPoolContent, params: SystemParams, lucid: LucidEvolution, destinationAddress?: Address, destinationInlineDatum?: Core.Data.Data, maxExecutionFee?: bigint, additionalLovelaces?: bigint, maxFeeRatio?: Rational): Promise<TxBuilder>;
|
|
@@ -4605,4 +4609,4 @@ declare function mkAuthTokenPolicy(ac: AssetClass, tn: string): MintingPolicy;
|
|
|
4605
4609
|
|
|
4606
4610
|
declare const alwaysFailValidator: SpendingValidator;
|
|
4607
4611
|
|
|
4608
|
-
export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, 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 StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findRelevantE2s2sIdxs, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, processSpRequest, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
|
|
4612
|
+
export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, 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 StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findRelevantE2s2sIdxs, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, processSpRequest, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, rewardsPerAsset, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
|
package/dist/index.d.ts
CHANGED
|
@@ -3244,7 +3244,7 @@ declare function spMul(a: SPInteger, b: SPInteger): SPInteger;
|
|
|
3244
3244
|
declare function spDiv(a: SPInteger, b: SPInteger): SPInteger;
|
|
3245
3245
|
declare function spZeroNegatives(a: SPInteger): SPInteger;
|
|
3246
3246
|
|
|
3247
|
-
declare const BASE_MAX_TX_FEE =
|
|
3247
|
+
declare const BASE_MAX_TX_FEE = 1250000n;
|
|
3248
3248
|
declare const MAX_E2S2S_ENTRIES_COUNT = 5;
|
|
3249
3249
|
declare const initSumVal: SPInteger;
|
|
3250
3250
|
declare const initSpState: StateSnapshot;
|
|
@@ -3266,6 +3266,10 @@ declare function createProcessRequestAccountRedeemer(e2s2sIdxs: [FindE2S2SIdxRes
|
|
|
3266
3266
|
e2s2sRefInputs: UTxO[];
|
|
3267
3267
|
mkProcessRequestAccountRedeemerContent: (poolInputIdx: bigint, accountInputIdx: bigint) => ProcessRequestAccountContent;
|
|
3268
3268
|
};
|
|
3269
|
+
/**
|
|
3270
|
+
* Sp account rewards per collateral asset.
|
|
3271
|
+
*/
|
|
3272
|
+
declare function rewardsPerAsset(poolAssetStates: readonly AssetState[], e2s2sIdxs: [FindE2S2SIdxResult, option.Option<FindE2S2SIdxResult>][], accountAssetSums: readonly (readonly [AssetClass, SPInteger])[], accountState: StateSnapshot): [AssetClass, bigint][];
|
|
3269
3273
|
declare function getUpdatedAccountDeposit(poolState: StateSnapshot, accountState: StateSnapshot): SPInteger;
|
|
3270
3274
|
declare function updateAccount(pool: StabilityPoolContent, account: AccountContent, e2s2sIdxs: [FindE2S2SIdxResult, option.Option<FindE2S2SIdxResult>][]): {
|
|
3271
3275
|
updatedAccountContent: AccountContent;
|
|
@@ -4514,7 +4518,7 @@ declare function attachOracle(iasset: Uint8Array<ArrayBufferLike>, collateralAss
|
|
|
4514
4518
|
referenceInputs: UTxO[];
|
|
4515
4519
|
}>;
|
|
4516
4520
|
|
|
4517
|
-
declare const BASE_MAX_EXECUTION_FEE =
|
|
4521
|
+
declare const BASE_MAX_EXECUTION_FEE = 1620000n;
|
|
4518
4522
|
declare function createDestinationDatum(datum: Data$1.Data | null, outRef: OutRef): string;
|
|
4519
4523
|
|
|
4520
4524
|
declare function createStableswapOrder(iasset: string, collateralAsset: AssetClass, amount: bigint, minting: boolean, poolDatum: StableswapPoolContent, params: SystemParams, lucid: LucidEvolution, destinationAddress?: Address, destinationInlineDatum?: Core.Data.Data, maxExecutionFee?: bigint, additionalLovelaces?: bigint, maxFeeRatio?: Rational): Promise<TxBuilder>;
|
|
@@ -4605,4 +4609,4 @@ declare function mkAuthTokenPolicy(ac: AssetClass, tn: string): MintingPolicy;
|
|
|
4605
4609
|
|
|
4606
4610
|
declare const alwaysFailValidator: SpendingValidator;
|
|
4607
4611
|
|
|
4608
|
-
export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, 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 StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findRelevantE2s2sIdxs, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, processSpRequest, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
|
|
4612
|
+
export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, 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 StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findRelevantE2s2sIdxs, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, processSpRequest, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, rewardsPerAsset, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
|
package/dist/index.js
CHANGED
|
@@ -314,6 +314,7 @@ __export(index_exports, {
|
|
|
314
314
|
requestSpAccountClosure: () => requestSpAccountClosure,
|
|
315
315
|
requestSpAccountCreation: () => requestSpAccountCreation,
|
|
316
316
|
rewardSnapshotPrecision: () => rewardSnapshotPrecision,
|
|
317
|
+
rewardsPerAsset: () => rewardsPerAsset,
|
|
317
318
|
robAmtToSpend: () => robAmtToSpend,
|
|
318
319
|
robBuyOrderFilledAssets: () => robBuyOrderFilledAssets,
|
|
319
320
|
robBuyOrderSummary: () => robBuyOrderSummary,
|
|
@@ -1389,7 +1390,7 @@ var mkStabilityPoolValidatorFromSP = (params) => {
|
|
|
1389
1390
|
};
|
|
1390
1391
|
|
|
1391
1392
|
// src/contracts/stability-pool/helpers.ts
|
|
1392
|
-
var BASE_MAX_TX_FEE =
|
|
1393
|
+
var BASE_MAX_TX_FEE = 1250000n;
|
|
1393
1394
|
var MAX_E2S2S_ENTRIES_COUNT = 5;
|
|
1394
1395
|
var newScaleMultiplier = 1000000000n;
|
|
1395
1396
|
var initSumVal = { value: 0n };
|
|
@@ -7224,10 +7225,16 @@ async function requestSpAccountCreation(assetAscii, amount, sysParams, lucid) {
|
|
|
7224
7225
|
lastRequestProcessingTime: 0n
|
|
7225
7226
|
};
|
|
7226
7227
|
return lucid.newTx().pay.ToContract(
|
|
7227
|
-
(0, import_lucid29.credentialToAddress)(
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7228
|
+
(0, import_lucid29.credentialToAddress)(
|
|
7229
|
+
lucid.config().network,
|
|
7230
|
+
{
|
|
7231
|
+
hash: sysParams.validatorHashes.stabilityPoolHash,
|
|
7232
|
+
type: "Script"
|
|
7233
|
+
},
|
|
7234
|
+
sysParams.stabilityPoolParams.stakeCredential != null ? fromSysParamsCredential(
|
|
7235
|
+
sysParams.stabilityPoolParams.stakeCredential
|
|
7236
|
+
) : void 0
|
|
7237
|
+
),
|
|
7231
7238
|
{
|
|
7232
7239
|
kind: "inline",
|
|
7233
7240
|
value: serialiseStabilityPoolDatum({ Account: datum })
|
|
@@ -7236,7 +7243,9 @@ async function requestSpAccountCreation(assetAscii, amount, sysParams, lucid) {
|
|
|
7236
7243
|
(0, import_cardano_offchain_common18.mkAssetsOf)(iassetAssetClass, amount),
|
|
7237
7244
|
(0, import_cardano_offchain_common18.mkLovelacesOf)(
|
|
7238
7245
|
// TODO: Calculate a more accurate amount to just cover costs.
|
|
7239
|
-
|
|
7246
|
+
// This should cover the account creation fee,
|
|
7247
|
+
// the minimum ADA for the account UTxO and the transaction fee.
|
|
7248
|
+
BigInt(sysParams.stabilityPoolParams.accountCreateFeeLovelaces) + 3000000n
|
|
7240
7249
|
)
|
|
7241
7250
|
)
|
|
7242
7251
|
).addSignerKey(pkh.hash);
|
|
@@ -7284,7 +7293,9 @@ async function requestSpAccountAdjustment(amount, accountUtxo, sysParams, lucid)
|
|
|
7284
7293
|
(0, import_lucid29.addAssets)(
|
|
7285
7294
|
(0, import_cardano_offchain_common18.mkLovelacesOf)(
|
|
7286
7295
|
// TODO: Calculate a more accurate amount to just cover costs.
|
|
7287
|
-
|
|
7296
|
+
// This should cover the minimum ADA for 2 UTxOs (account and
|
|
7297
|
+
// rewards withdrawal) and the transaction fee.
|
|
7298
|
+
5000000n
|
|
7288
7299
|
),
|
|
7289
7300
|
(0, import_cardano_offchain_common18.mkAssetsOf)(
|
|
7290
7301
|
fromSystemParamsAsset(sysParams.stabilityPoolParams.accountToken),
|
|
@@ -7337,7 +7348,8 @@ async function requestSpAccountClosure(accountUtxo, sysParams, lucid, maxTxFee =
|
|
|
7337
7348
|
(0, import_lucid29.addAssets)(
|
|
7338
7349
|
(0, import_cardano_offchain_common18.mkLovelacesOf)(
|
|
7339
7350
|
// TODO: Calculate a more accurate amount to just cover costs.
|
|
7340
|
-
|
|
7351
|
+
// This should cover the minimum ADA for the rewards UTxO and the transaction fee.
|
|
7352
|
+
3000000n
|
|
7341
7353
|
),
|
|
7342
7354
|
(0, import_cardano_offchain_common18.mkAssetsOf)(
|
|
7343
7355
|
fromSystemParamsAsset(sysParams.stabilityPoolParams.accountToken),
|
|
@@ -7346,7 +7358,7 @@ async function requestSpAccountClosure(accountUtxo, sysParams, lucid, maxTxFee =
|
|
|
7346
7358
|
)
|
|
7347
7359
|
).addSignerKey((0, import_lucid29.toHex)(oldAccountDatum.owner));
|
|
7348
7360
|
}
|
|
7349
|
-
async function
|
|
7361
|
+
async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, currentSlot, txFee) {
|
|
7350
7362
|
const network = lucid.config().network;
|
|
7351
7363
|
const currentTime = BigInt((0, import_lucid29.slotToUnixTime)(network, currentSlot));
|
|
7352
7364
|
const stabilityPoolScriptRef = (0, import_cardano_offchain_common18.matchSingle)(
|
|
@@ -7395,7 +7407,46 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
|
|
|
7395
7407
|
accountUtxo.assets,
|
|
7396
7408
|
iassetAssetClass
|
|
7397
7409
|
);
|
|
7398
|
-
const poolAddr =
|
|
7410
|
+
const poolAddr = (0, import_lucid29.credentialToAddress)(
|
|
7411
|
+
lucid.config().network,
|
|
7412
|
+
{
|
|
7413
|
+
hash: sysParams.validatorHashes.stabilityPoolHash,
|
|
7414
|
+
type: "Script"
|
|
7415
|
+
},
|
|
7416
|
+
sysParams.stabilityPoolParams.stakeCredential != null ? fromSysParamsCredential(
|
|
7417
|
+
sysParams.stabilityPoolParams.stakeCredential
|
|
7418
|
+
) : void 0
|
|
7419
|
+
);
|
|
7420
|
+
const accountOutputAdaAmt = (0, import_cardano_offchain_common18.lovelacesAmt)(accountUtxo.assets) - BigInt(sysParams.stabilityPoolParams.accountCreateFeeLovelaces) - txFee;
|
|
7421
|
+
const accountTokenVal = (0, import_cardano_offchain_common18.mkAssetsOf)(
|
|
7422
|
+
fromSystemParamsAsset(sysParams.stabilityPoolParams.accountToken),
|
|
7423
|
+
1n
|
|
7424
|
+
);
|
|
7425
|
+
const accountOutputDatum = serialiseStabilityPoolDatum({
|
|
7426
|
+
Account: {
|
|
7427
|
+
owner: accountDatum.owner,
|
|
7428
|
+
iasset: stabilityPoolDatum.iasset,
|
|
7429
|
+
state: {
|
|
7430
|
+
...stabilityPoolDatum.state,
|
|
7431
|
+
depositVal: mkSPInteger(requestDepositAmt)
|
|
7432
|
+
},
|
|
7433
|
+
assetSums: stabilityPoolDatum.assetStates.map(([key, val]) => [
|
|
7434
|
+
key,
|
|
7435
|
+
val.currentSumVal
|
|
7436
|
+
]),
|
|
7437
|
+
request: null,
|
|
7438
|
+
lastRequestProcessingTime: currentTime
|
|
7439
|
+
}
|
|
7440
|
+
});
|
|
7441
|
+
const accountOutMinUtxoLovelace = (0, import_cardano_offchain_common18.estimateUtxoMinLovelace)(
|
|
7442
|
+
lucid.config().protocolParameters,
|
|
7443
|
+
poolAddr,
|
|
7444
|
+
accountTokenVal,
|
|
7445
|
+
{ InlineDatum: { datum: accountOutputDatum } }
|
|
7446
|
+
);
|
|
7447
|
+
if (accountOutputAdaAmt < accountOutMinUtxoLovelace) {
|
|
7448
|
+
throw new Error("Request doesn't have enough ADA to be processed.");
|
|
7449
|
+
}
|
|
7399
7450
|
tx.readFrom([accountTokenScriptRef]).collectFrom([accountUtxo], {
|
|
7400
7451
|
kind: "selected",
|
|
7401
7452
|
inputs: [stabilityPoolUtxo, accountUtxo],
|
|
@@ -7407,13 +7458,7 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
|
|
|
7407
7458
|
currentTime
|
|
7408
7459
|
}
|
|
7409
7460
|
})
|
|
7410
|
-
}).mintAssets(
|
|
7411
|
-
(0, import_cardano_offchain_common18.mkAssetsOf)(
|
|
7412
|
-
fromSystemParamsAsset(sysParams.stabilityPoolParams.accountToken),
|
|
7413
|
-
1n
|
|
7414
|
-
),
|
|
7415
|
-
import_lucid29.Data.void()
|
|
7416
|
-
).pay.ToContract(
|
|
7461
|
+
}).mintAssets(accountTokenVal, import_lucid29.Data.void()).pay.ToContract(
|
|
7417
7462
|
poolAddr,
|
|
7418
7463
|
{
|
|
7419
7464
|
kind: "inline",
|
|
@@ -7446,31 +7491,10 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
|
|
|
7446
7491
|
poolAddr,
|
|
7447
7492
|
{
|
|
7448
7493
|
kind: "inline",
|
|
7449
|
-
value:
|
|
7450
|
-
Account: {
|
|
7451
|
-
owner: accountDatum.owner,
|
|
7452
|
-
iasset: stabilityPoolDatum.iasset,
|
|
7453
|
-
state: {
|
|
7454
|
-
...stabilityPoolDatum.state,
|
|
7455
|
-
depositVal: mkSPInteger(requestDepositAmt)
|
|
7456
|
-
},
|
|
7457
|
-
assetSums: stabilityPoolDatum.assetStates.map(([key, val]) => [
|
|
7458
|
-
key,
|
|
7459
|
-
val.currentSumVal
|
|
7460
|
-
]),
|
|
7461
|
-
request: null,
|
|
7462
|
-
lastRequestProcessingTime: currentTime
|
|
7463
|
-
}
|
|
7464
|
-
})
|
|
7494
|
+
value: accountOutputDatum
|
|
7465
7495
|
},
|
|
7466
|
-
(0, import_lucid29.addAssets)(
|
|
7467
|
-
|
|
7468
|
-
fromSystemParamsAsset(sysParams.stabilityPoolParams.accountToken),
|
|
7469
|
-
1n
|
|
7470
|
-
),
|
|
7471
|
-
(0, import_cardano_offchain_common18.mkLovelacesOf)((0, import_cardano_offchain_common18.lovelacesAmt)(accountUtxo.assets))
|
|
7472
|
-
)
|
|
7473
|
-
);
|
|
7496
|
+
(0, import_lucid29.addAssets)(accountTokenVal, (0, import_cardano_offchain_common18.mkLovelacesOf)(accountOutputAdaAmt))
|
|
7497
|
+
).setMinFee(txFee);
|
|
7474
7498
|
}).with({ Adjust: import_ts_pattern18.P.select() }, async (adjustContent) => {
|
|
7475
7499
|
const iassetDatum = parseIAssetDatumOrThrow(
|
|
7476
7500
|
getInlineDatumOrThrow(iAssetUtxo)
|
|
@@ -7594,7 +7618,7 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
|
|
|
7594
7618
|
accountOutputValWithoutAda,
|
|
7595
7619
|
{ InlineDatum: { datum: accountOutputDat } }
|
|
7596
7620
|
);
|
|
7597
|
-
const accountOutputAdaAmt = (0, import_cardano_offchain_common18.lovelacesAmt)(accountUtxo.assets) - extraOwnerOutputLovelacesAmt;
|
|
7621
|
+
const accountOutputAdaAmt = (0, import_cardano_offchain_common18.lovelacesAmt)(accountUtxo.assets) - extraOwnerOutputLovelacesAmt - txFee;
|
|
7598
7622
|
if (accountOutputAdaAmt < accountOutMinUtxoLovelace) {
|
|
7599
7623
|
throw new Error("Account doesn't have enough ADA to be processed.");
|
|
7600
7624
|
}
|
|
@@ -7615,8 +7639,11 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
|
|
|
7615
7639
|
value: ownerOutputDat
|
|
7616
7640
|
},
|
|
7617
7641
|
actualOwnerOutputVal
|
|
7618
|
-
);
|
|
7642
|
+
).setMinFee(txFee);
|
|
7619
7643
|
}).with({ Close: import_ts_pattern18.P.select() }, async (closeContent) => {
|
|
7644
|
+
if (txFee > closeContent.maxTxFee) {
|
|
7645
|
+
throw new Error("Account doesn't allow current transaction fee.");
|
|
7646
|
+
}
|
|
7620
7647
|
const accountTokenScriptRef = (0, import_cardano_offchain_common18.matchSingle)(
|
|
7621
7648
|
await lucid.utxosByOutRef([
|
|
7622
7649
|
fromSystemParamsScriptRef(
|
|
@@ -7713,14 +7740,38 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
|
|
|
7713
7740
|
})
|
|
7714
7741
|
},
|
|
7715
7742
|
(0, import_lucid29.addAssets)(
|
|
7716
|
-
(0, import_cardano_offchain_common18.mkLovelacesOf)((0, import_cardano_offchain_common18.lovelacesAmt)(accountUtxo.assets)),
|
|
7743
|
+
(0, import_cardano_offchain_common18.mkLovelacesOf)((0, import_cardano_offchain_common18.lovelacesAmt)(accountUtxo.assets) - txFee),
|
|
7717
7744
|
reward,
|
|
7718
7745
|
(0, import_cardano_offchain_common18.mkAssetsOf)(iassetAssetClass, withdrawnAmt - withdrawalFeeAmt)
|
|
7719
7746
|
)
|
|
7720
|
-
);
|
|
7747
|
+
).setMinFee(txFee);
|
|
7721
7748
|
}).exhaustive();
|
|
7722
7749
|
return tx;
|
|
7723
7750
|
}
|
|
7751
|
+
async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, currentSlot) {
|
|
7752
|
+
const draftTx = processSpRequestAuxiliary(
|
|
7753
|
+
stabilityPoolUtxo,
|
|
7754
|
+
accountUtxo,
|
|
7755
|
+
iAssetUtxo,
|
|
7756
|
+
allE2s2sSnapshotOrefs,
|
|
7757
|
+
sysParams,
|
|
7758
|
+
lucid,
|
|
7759
|
+
currentSlot,
|
|
7760
|
+
// Placeholder transation fee
|
|
7761
|
+
1n
|
|
7762
|
+
);
|
|
7763
|
+
const fee = (await (await draftTx).complete()).toTransaction().body().fee();
|
|
7764
|
+
return processSpRequestAuxiliary(
|
|
7765
|
+
stabilityPoolUtxo,
|
|
7766
|
+
accountUtxo,
|
|
7767
|
+
iAssetUtxo,
|
|
7768
|
+
allE2s2sSnapshotOrefs,
|
|
7769
|
+
sysParams,
|
|
7770
|
+
lucid,
|
|
7771
|
+
currentSlot,
|
|
7772
|
+
fee
|
|
7773
|
+
);
|
|
7774
|
+
}
|
|
7724
7775
|
async function createE2s2sSnapshots(stabilityPoolOref, sysParams, lucid) {
|
|
7725
7776
|
const stabilityPoolRefScriptUtxo = (0, import_cardano_offchain_common18.matchSingle)(
|
|
7726
7777
|
await lucid.utxosByOutRef([
|
|
@@ -11119,7 +11170,7 @@ function parseStableswapOrderRedeemerOrThrow(redeemerCborHex) {
|
|
|
11119
11170
|
|
|
11120
11171
|
// src/contracts/stableswap/helpers.ts
|
|
11121
11172
|
var import_evolution21 = require("@evolution-sdk/evolution");
|
|
11122
|
-
var BASE_MAX_EXECUTION_FEE =
|
|
11173
|
+
var BASE_MAX_EXECUTION_FEE = 1620000n;
|
|
11123
11174
|
function createDestinationDatum(datum, outRef) {
|
|
11124
11175
|
if (!datum) {
|
|
11125
11176
|
return serialiseStableswapOutputDatum([
|
|
@@ -11443,7 +11494,7 @@ async function batchProcessStableswapOrders(stableswapOrderOrefs, stableswapPool
|
|
|
11443
11494
|
stableswapPoolUtxo.assets,
|
|
11444
11495
|
(0, import_cardano_offchain_common30.mkAssetsOf)(collateralAc, collateralAmtChangePool)
|
|
11445
11496
|
) : stableswapPoolUtxo.assets
|
|
11446
|
-
).setMinFee(
|
|
11497
|
+
).setMinFee(stableswapOrderOrefs.length > 1 ? 1498875n : 1030000n);
|
|
11447
11498
|
if (amountToMint !== 0n) {
|
|
11448
11499
|
tx.mintAssets((0, import_cardano_offchain_common30.mkAssetsOf)(iassetAc, amountToMint), import_lucid67.Data.void());
|
|
11449
11500
|
}
|
|
@@ -11841,6 +11892,7 @@ async function updateStableswapPoolFees(stableswapPoolOutRef, stableswapFeeOutRe
|
|
|
11841
11892
|
requestSpAccountClosure,
|
|
11842
11893
|
requestSpAccountCreation,
|
|
11843
11894
|
rewardSnapshotPrecision,
|
|
11895
|
+
rewardsPerAsset,
|
|
11844
11896
|
robAmtToSpend,
|
|
11845
11897
|
robBuyOrderFilledAssets,
|
|
11846
11898
|
robBuyOrderSummary,
|