@perena/vault-sdk 1.0.54 → 1.0.56

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.ts CHANGED
@@ -13749,7 +13749,12 @@ interface SimulateDryRunSettlementParams {
13749
13749
  updates: HoldingUpdatePreview[];
13750
13750
  nowSecs: bigint;
13751
13751
  }
13752
- declare function simulateDryRunSettlement({ client, signer, vault, vaultState, updates, nowSecs, }: SimulateDryRunSettlementParams): Promise<SettlementSimulation>;
13752
+ declare function simulateDryRunSettlement(args: SimulateDryRunSettlementParams): Promise<SettlementSimulation>;
13753
+ /** Assess both this report on its own and what current consensus would settle. */
13754
+ declare function simulateOraclePublication(args: SimulateDryRunSettlementParams): Promise<{
13755
+ consensus: SettlementSimulation;
13756
+ proposed: SettlementSimulation;
13757
+ }>;
13753
13758
 
13754
13759
  declare function buildUpdates(yieldTracker: YieldTracker | undefined, reportableHoldings: ConsensusHoldingEntry[], inputs: VaultPricingInputs): Promise<HoldingUpdatePreview[]>;
13755
13760
  declare function buildHoldingUpdate(yieldTracker: YieldTracker | undefined, entry: ConsensusHoldingEntry, inputs: VaultPricingInputs): Promise<HoldingUpdatePreview>;
@@ -13760,6 +13765,10 @@ declare function resolveTrackedAmounts(yieldTracker: YieldTracker | undefined, c
13760
13765
  yieldAmount: bigint;
13761
13766
  }>;
13762
13767
 
13768
+ declare const MAX_ORACLE_IMPLIED_APY_BPS = 2000n;
13769
+ /** Independent of the configured on-chain cap and its high-water-mark gate. */
13770
+ declare function assertOracleImpliedApy(vault: Address, simulation: SettlementSimulation, label: "proposed report" | "current consensus"): void;
13771
+
13763
13772
  /**
13764
13773
  * Step 1 of a pass: keep active permissionless price sources warm so they
13765
13774
  * cannot block the NAV crank after the consensus report lands. Prices are
@@ -13793,8 +13802,6 @@ interface ManagerWalletReconciliation {
13793
13802
  previousNav: bigint;
13794
13803
  candidateNav: bigint;
13795
13804
  adjustedNav?: bigint;
13796
- /** Diagnostic candidate only; never publish this unless accepted is true. */
13797
- walletUpdates?: HoldingUpdatePreview[];
13798
13805
  }
13799
13806
  /**
13800
13807
  * Rebuild from sourced external amounts every pass. Never carry forward a prior
@@ -14198,6 +14205,8 @@ interface SimulateSettlementArgs {
14198
14205
  physicalShareSupply?: bigint;
14199
14206
  physicalJuniorSupply?: bigint;
14200
14207
  physicalSeniorSupply?: bigint;
14208
+ /** Hypothetical report-quality check, independent of standing peer reports. */
14209
+ assumeProposedUpdatesApplied?: boolean;
14201
14210
  }
14202
14211
  /**
14203
14212
  * Check the reports actually published on chain, without overlaying a proposed
@@ -14635,4 +14644,4 @@ declare function decodeNestDepositRequest(args: {
14635
14644
  txBase64: string;
14636
14645
  }): Promise<NestDepositPlan>;
14637
14646
 
14638
- export { ASSET_DECIMALS, ASSET_REBALANCE_COOLDOWN_SECS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AddAprCashflowUpdateParams, type AddCashflowUpdateParams, type AddIncentiveRecipientArgs, AddIncentiveRecipientBuilder, type AddIncentiveRecipientIxArgs, AddIncentiveRecipientV3Builder, type AddIncentiveRecipientV3IxArgs, type AddIncentiveRecipientV3TxArgs, type AddNavCashflowUpdateParams, type AprAccountBalanceResponse, type AprAccountYieldResponse, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type AssetType, BALANCE_CHANGE_BASELINE_MAX_AGE_SECS, type Bankineco, type BasicAuthCredentials, type Bigintish, type BuildMarginfiWithdrawInteractionArgs, CONSENSUS_ORACLE_VARIANT, type CancelIncentiveProposalArgs, CancelIncentiveProposalBuilder, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, ClaimIncentiveBuilder, type ClaimIncentiveIxArgs, type ClaimIncentiveTxArgs, ClaimIncentiveV3Builder, type ClaimIncentiveV3IxArgs, type ClaimIncentiveV3TxArgs, type Clock, type CollectSamplesOptions, type ConsensusAssetUpdate, type ConsensusHoldingEntry, type ConsensusHoldingSimulation, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, CreateIncentiveBuilder, type CreateIncentiveIxArgs, type CreateIncentiveTxArgs, CreateIncentiveV3Builder, type CreateIncentiveV3IxArgs, type CreateIncentiveV3TxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_CU_PRICE_MICRO_LAMPORTS, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_MAX_ACCOUNTS, DEFAULT_MINTS, DEFAULT_MIN_AMOUNT_UI, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_SECS, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_REBALANCE_BAND_BPS, DEFAULT_SLIPPAGE_BPS, DEFAULT_TARGET_LOCAL_BPS, DEFAULT_TARGET_LOCAL_USDC_TVL_BPS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DecodedVaultTrancheState, type DeleteAccountParams, DepositCuratorFeesBuilder, type DepositCuratorFeesIxArgs, type DepositCuratorFeesTxArgs, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, DistributeIncentiveBuilder, type DistributeIncentiveIxArgs, type DistributeIncentiveTxArgs, DistributeIncentiveV3Builder, type DistributeIncentiveV3IxArgs, type DistributeIncentiveV3TxArgs, EXTERNAL_POSITION_SAMPLES, ExecuteDepositBuilder, type ExecuteDepositIxArgs, type ExecuteDepositTxArgs, ExecuteShareSwapBuilder, type ExecuteShareSwapIxArgs, type ExecuteShareSwapTxArgs, ExecuteTrancheDepositBuilder, type ExecuteTrancheDepositIxArgs, type ExecuteTrancheDepositTxArgs, ExecuteTrancheWithdrawBuilder, type ExecuteTrancheWithdrawIxArgs, type ExecuteTrancheWithdrawTxArgs, ExecuteWithdrawBuilder, type ExecuteWithdrawIxArgs, type ExecuteWithdrawTxArgs, type ExternalLiquidityIntegrityOptions, type ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, type FetchNestTokenPriceOptions, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingNavContribution, type HoldingUpdatePreview, IDL, IDLE_RESERVE_FLOOR_BPS, IDLE_RESERVE_TARGET_BPS, type IdleLiquidityOptions, type IdleLiquidityResult, IdleLiquidityService, type IdleLiquidityStatus, type IncentiveRecipient, type IncentiveTotals, type IncentiveUsdUpdateArgs, type IncentiveV3OracleState, type IncentiveV3Recipient, type IncentiveV3Totals, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, LIVE_ORACLE_VARIANTS, LIVE_PRICE_REFRESH_INTERVAL_SECS, LOCAL_PROTOCOL_ADMIN, LargeBalanceChangeError, type LargeBalanceChangeViolation, type LiveConsensusOracleDepsOptions, LivePriceSource, type LivePriceSourceOptions, MANAGER_WALLET_NAV_DROP_TRIGGER_BPS, MANAGER_WALLET_NAV_TOLERANCE_BPS, MAX_APY_ANCHOR_WINDOW_SECS, MAX_APY_PREVIOUS_ANCHOR_AGE_SECS, MAX_BALANCE_CHANGE_BPS, MAX_CONSENSUS_SIGNERS, MAX_INCENTIVE_RECIPIENTS, MAX_INCENTIVE_REPORT_TTL, MAX_MANAGER_WITHDRAW_DESTINATIONS, MAX_PRICE_STALENESS_THRESHOLD_SECS, MIN_EXTERNAL_POSITION_SAMPLES, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, type ManagerWalletBalanceSource, type ManagerWalletReconciliation, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MaxApyAnchorSnapshot, type MintConfig, type MintIdentifier, type MintInfo, MintRegistry, type MintRegistryOptions, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type MpcWalletBalanceSource, type MpcWalletBalances, type MpcWalletConfig, NEST_API_BASE_URL, NEST_RWA_SHARE_MINT, NEST_VAULT_SLUG, type NavAccountBalanceResponse, type NavAccountValueResponse, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, type NavPriceConfig, type NavYieldAccount, NestApiError, type NestApiOptions, type NestDepositPlan, NestPriceSource, type NestPriceSourceOptions, type NestRedemptionQuote, type NestRedemptionStatus, ORACLE_ENTRIES_OFFSET, ORACLE_ENTRY_SIZE, ORACLE_SETTLED_NAV_TS_OFFSET, OracleService, PRICE_ORACLE_TYPES_BY_INDEX, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PdaClient, type PendingConsensusSignerSet, type PreparedDirectTransaction, type PreparedSquadsTransaction, type PreparedVaultTransaction, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, REPORTABLE_ORACLE_VARIANTS, type RealizedApySimulation, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, ReportIncentiveV3Builder, type ReportIncentiveV3IxArgs, type ReportIncentiveV3TxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type ResolveExternalWithdrawArgs, type ResolvedExternalWithdraw, type ResolvedSquadsWalletRoute, type RollingLimitConfig, type RollingRebalanceLimitConfig, RpcManagerWalletBalanceSource, RpcMpcWalletBalanceSource, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SYSTEM_PROGRAM, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, type SetIncentiveLimitsArgs, SetIncentiveLimitsBuilder, type SetIncentiveLimitsV3Args, SetIncentiveLimitsV3Builder, SetManagerWithdrawDestinationBuilder, type SetManagerWithdrawDestinationIxArgs, type SetManagerWithdrawDestinationTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, SettleIncentiveV3Builder, type SettleIncentiveV3IxArgs, type SettleIncentiveV3TxArgs, type SettleVaultParams, type SettleVaultResult, type SettlementSimulation, type SettlementSimulationSnapshot, type SimulateDryRunSettlementParams, type SimulateSettlementArgs, type SimulatedShareClass, SquadsProposalExecutionSimulationError, type SquadsProposalUpload, type SquadsWalletRouteConfig, type StaleBalanceChangeBypass, StaticPositionProvider, SubmitIncentiveBuilder, type SubmitIncentiveIxArgs, type SubmitIncentiveTxArgs, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TimelockSettlementKind, type TimelockSettlementOptions, type TimelockSettlementRecord, TimelockSettlementService, type TimelockSettlementSummary, type TrackedAccountValue, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultIncentiveAccount, type VaultIncentiveAccountData, type VaultIncentiveV3Account, type VaultIncentiveV3AccountData, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, WITHDRAWABLE_RESERVE_FLOOR_BPS, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldCashflow, type YieldPaymentResponse, type YieldPaymentSnapshot, type YieldTracker, type YieldValuationModel, accountingUnitPriceToUsd, addCashflowUpdate, applyEffectiveApy, assertNoLargeBalanceChanges, assertNoUnconfirmedYieldPayments, buildHoldingUpdate, buildMarginfiWithdrawInteraction, buildNestDepositRequest, buildNestWithdrawalRequest, buildUpdates, candidateGrossNav, coerceBool, collectSamples, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, decodeNestDepositRequest, decodeNestWithdrawalRequest, decodePendingConsensusSigners, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, fetchExternalPositions, fetchNestRedemptionQuote, fetchNestRedemptionStatus, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getIncentiveRecipientShareAtas, getIncentiveRecipients, getIncentiveReportRecipients, getIncentiveTotals, getIncentiveV3OracleState, getIncentiveV3RecipientShareAtas, getIncentiveV3Recipients, getIncentiveV3Totals, getNavValue, getRpcUrl, getTotalOutstandingYield, getTotalTrackedValue, getTotalYield, getTrackedValue, getVaultProgramId, getYield, getYieldPayments, indexConfigByMint, isNavAccountBalance, isNavAccountValue, isNavYieldAccount, isVaultEnv, keypairAddress, loadKeypair, logProspectiveApy, makeProvider, managerReconciliationStateKey, mintTokensTo, mints, mostFrequent, parseExternalLiquidityRefs, planRebalance, prepareSquadsProposalUpload, prepareVaultTransaction, previousPhysicalNav, priceInAccountingUnit, publishedConsensusBlockers, readI64LE, readSplMintSupply, reconcileManagerWalletBalances, refreshLiveOraclePrices, resolveExternalWithdraw, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, simulateSquadsProposalExecution, sumPositionsByMint, systemClock, toBigInt, toUiAmount, toWeb3AccountMeta, trackedValueFromResponse, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, withDiscoveredYieldAccounts };
14647
+ export { ASSET_DECIMALS, ASSET_REBALANCE_COOLDOWN_SECS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AddAprCashflowUpdateParams, type AddCashflowUpdateParams, type AddIncentiveRecipientArgs, AddIncentiveRecipientBuilder, type AddIncentiveRecipientIxArgs, AddIncentiveRecipientV3Builder, type AddIncentiveRecipientV3IxArgs, type AddIncentiveRecipientV3TxArgs, type AddNavCashflowUpdateParams, type AprAccountBalanceResponse, type AprAccountYieldResponse, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type AssetType, BALANCE_CHANGE_BASELINE_MAX_AGE_SECS, type Bankineco, type BasicAuthCredentials, type Bigintish, type BuildMarginfiWithdrawInteractionArgs, CONSENSUS_ORACLE_VARIANT, type CancelIncentiveProposalArgs, CancelIncentiveProposalBuilder, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, ClaimIncentiveBuilder, type ClaimIncentiveIxArgs, type ClaimIncentiveTxArgs, ClaimIncentiveV3Builder, type ClaimIncentiveV3IxArgs, type ClaimIncentiveV3TxArgs, type Clock, type CollectSamplesOptions, type ConsensusAssetUpdate, type ConsensusHoldingEntry, type ConsensusHoldingSimulation, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, CreateIncentiveBuilder, type CreateIncentiveIxArgs, type CreateIncentiveTxArgs, CreateIncentiveV3Builder, type CreateIncentiveV3IxArgs, type CreateIncentiveV3TxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_CU_PRICE_MICRO_LAMPORTS, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_MAX_ACCOUNTS, DEFAULT_MINTS, DEFAULT_MIN_AMOUNT_UI, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_SECS, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_REBALANCE_BAND_BPS, DEFAULT_SLIPPAGE_BPS, DEFAULT_TARGET_LOCAL_BPS, DEFAULT_TARGET_LOCAL_USDC_TVL_BPS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DecodedVaultTrancheState, type DeleteAccountParams, DepositCuratorFeesBuilder, type DepositCuratorFeesIxArgs, type DepositCuratorFeesTxArgs, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, DistributeIncentiveBuilder, type DistributeIncentiveIxArgs, type DistributeIncentiveTxArgs, DistributeIncentiveV3Builder, type DistributeIncentiveV3IxArgs, type DistributeIncentiveV3TxArgs, EXTERNAL_POSITION_SAMPLES, ExecuteDepositBuilder, type ExecuteDepositIxArgs, type ExecuteDepositTxArgs, ExecuteShareSwapBuilder, type ExecuteShareSwapIxArgs, type ExecuteShareSwapTxArgs, ExecuteTrancheDepositBuilder, type ExecuteTrancheDepositIxArgs, type ExecuteTrancheDepositTxArgs, ExecuteTrancheWithdrawBuilder, type ExecuteTrancheWithdrawIxArgs, type ExecuteTrancheWithdrawTxArgs, ExecuteWithdrawBuilder, type ExecuteWithdrawIxArgs, type ExecuteWithdrawTxArgs, type ExternalLiquidityIntegrityOptions, type ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, type FetchNestTokenPriceOptions, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingNavContribution, type HoldingUpdatePreview, IDL, IDLE_RESERVE_FLOOR_BPS, IDLE_RESERVE_TARGET_BPS, type IdleLiquidityOptions, type IdleLiquidityResult, IdleLiquidityService, type IdleLiquidityStatus, type IncentiveRecipient, type IncentiveTotals, type IncentiveUsdUpdateArgs, type IncentiveV3OracleState, type IncentiveV3Recipient, type IncentiveV3Totals, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, LIVE_ORACLE_VARIANTS, LIVE_PRICE_REFRESH_INTERVAL_SECS, LOCAL_PROTOCOL_ADMIN, LargeBalanceChangeError, type LargeBalanceChangeViolation, type LiveConsensusOracleDepsOptions, LivePriceSource, type LivePriceSourceOptions, MANAGER_WALLET_NAV_DROP_TRIGGER_BPS, MANAGER_WALLET_NAV_TOLERANCE_BPS, MAX_APY_ANCHOR_WINDOW_SECS, MAX_APY_PREVIOUS_ANCHOR_AGE_SECS, MAX_BALANCE_CHANGE_BPS, MAX_CONSENSUS_SIGNERS, MAX_INCENTIVE_RECIPIENTS, MAX_INCENTIVE_REPORT_TTL, MAX_MANAGER_WITHDRAW_DESTINATIONS, MAX_ORACLE_IMPLIED_APY_BPS, MAX_PRICE_STALENESS_THRESHOLD_SECS, MIN_EXTERNAL_POSITION_SAMPLES, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, type ManagerWalletBalanceSource, type ManagerWalletReconciliation, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MaxApyAnchorSnapshot, type MintConfig, type MintIdentifier, type MintInfo, MintRegistry, type MintRegistryOptions, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type MpcWalletBalanceSource, type MpcWalletBalances, type MpcWalletConfig, NEST_API_BASE_URL, NEST_RWA_SHARE_MINT, NEST_VAULT_SLUG, type NavAccountBalanceResponse, type NavAccountValueResponse, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, type NavPriceConfig, type NavYieldAccount, NestApiError, type NestApiOptions, type NestDepositPlan, NestPriceSource, type NestPriceSourceOptions, type NestRedemptionQuote, type NestRedemptionStatus, ORACLE_ENTRIES_OFFSET, ORACLE_ENTRY_SIZE, ORACLE_SETTLED_NAV_TS_OFFSET, OracleService, PRICE_ORACLE_TYPES_BY_INDEX, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PdaClient, type PendingConsensusSignerSet, type PreparedDirectTransaction, type PreparedSquadsTransaction, type PreparedVaultTransaction, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, REPORTABLE_ORACLE_VARIANTS, type RealizedApySimulation, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, ReportIncentiveV3Builder, type ReportIncentiveV3IxArgs, type ReportIncentiveV3TxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type ResolveExternalWithdrawArgs, type ResolvedExternalWithdraw, type ResolvedSquadsWalletRoute, type RollingLimitConfig, type RollingRebalanceLimitConfig, RpcManagerWalletBalanceSource, RpcMpcWalletBalanceSource, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SYSTEM_PROGRAM, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, type SetIncentiveLimitsArgs, SetIncentiveLimitsBuilder, type SetIncentiveLimitsV3Args, SetIncentiveLimitsV3Builder, SetManagerWithdrawDestinationBuilder, type SetManagerWithdrawDestinationIxArgs, type SetManagerWithdrawDestinationTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, SettleIncentiveV3Builder, type SettleIncentiveV3IxArgs, type SettleIncentiveV3TxArgs, type SettleVaultParams, type SettleVaultResult, type SettlementSimulation, type SettlementSimulationSnapshot, type SimulateDryRunSettlementParams, type SimulateSettlementArgs, type SimulatedShareClass, SquadsProposalExecutionSimulationError, type SquadsProposalUpload, type SquadsWalletRouteConfig, type StaleBalanceChangeBypass, StaticPositionProvider, SubmitIncentiveBuilder, type SubmitIncentiveIxArgs, type SubmitIncentiveTxArgs, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TimelockSettlementKind, type TimelockSettlementOptions, type TimelockSettlementRecord, TimelockSettlementService, type TimelockSettlementSummary, type TrackedAccountValue, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultIncentiveAccount, type VaultIncentiveAccountData, type VaultIncentiveV3Account, type VaultIncentiveV3AccountData, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, WITHDRAWABLE_RESERVE_FLOOR_BPS, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldCashflow, type YieldPaymentResponse, type YieldPaymentSnapshot, type YieldTracker, type YieldValuationModel, accountingUnitPriceToUsd, addCashflowUpdate, applyEffectiveApy, assertNoLargeBalanceChanges, assertNoUnconfirmedYieldPayments, assertOracleImpliedApy, buildHoldingUpdate, buildMarginfiWithdrawInteraction, buildNestDepositRequest, buildNestWithdrawalRequest, buildUpdates, candidateGrossNav, coerceBool, collectSamples, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, decodeNestDepositRequest, decodeNestWithdrawalRequest, decodePendingConsensusSigners, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, fetchExternalPositions, fetchNestRedemptionQuote, fetchNestRedemptionStatus, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getIncentiveRecipientShareAtas, getIncentiveRecipients, getIncentiveReportRecipients, getIncentiveTotals, getIncentiveV3OracleState, getIncentiveV3RecipientShareAtas, getIncentiveV3Recipients, getIncentiveV3Totals, getNavValue, getRpcUrl, getTotalOutstandingYield, getTotalTrackedValue, getTotalYield, getTrackedValue, getVaultProgramId, getYield, getYieldPayments, indexConfigByMint, isNavAccountBalance, isNavAccountValue, isNavYieldAccount, isVaultEnv, keypairAddress, loadKeypair, logProspectiveApy, makeProvider, managerReconciliationStateKey, mintTokensTo, mints, mostFrequent, parseExternalLiquidityRefs, planRebalance, prepareSquadsProposalUpload, prepareVaultTransaction, previousPhysicalNav, priceInAccountingUnit, publishedConsensusBlockers, readI64LE, readSplMintSupply, reconcileManagerWalletBalances, refreshLiveOraclePrices, resolveExternalWithdraw, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, simulateOraclePublication, simulateSquadsProposalExecution, sumPositionsByMint, systemClock, toBigInt, toUiAmount, toWeb3AccountMeta, trackedValueFromResponse, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, withDiscoveredYieldAccounts };
package/dist/index.js CHANGED
@@ -3349,6 +3349,7 @@ __export(index_exports, {
3349
3349
  MAX_INCENTIVE_RECIPIENTS: () => MAX_INCENTIVE_RECIPIENTS,
3350
3350
  MAX_INCENTIVE_REPORT_TTL: () => MAX_INCENTIVE_REPORT_TTL,
3351
3351
  MAX_MANAGER_WITHDRAW_DESTINATIONS: () => MAX_MANAGER_WITHDRAW_DESTINATIONS,
3352
+ MAX_ORACLE_IMPLIED_APY_BPS: () => MAX_ORACLE_IMPLIED_APY_BPS,
3352
3353
  MAX_PRICE_STALENESS_THRESHOLD_SECS: () => MAX_PRICE_STALENESS_THRESHOLD_SECS,
3353
3354
  MIN_EXTERNAL_POSITION_SAMPLES: () => MIN_EXTERNAL_POSITION_SAMPLES,
3354
3355
  ManagerRedepositAssetBuilder: () => ManagerRedepositAssetBuilder,
@@ -3424,6 +3425,7 @@ __export(index_exports, {
3424
3425
  applyEffectiveApy: () => applyEffectiveApy,
3425
3426
  assertNoLargeBalanceChanges: () => assertNoLargeBalanceChanges,
3426
3427
  assertNoUnconfirmedYieldPayments: () => assertNoUnconfirmedYieldPayments,
3428
+ assertOracleImpliedApy: () => assertOracleImpliedApy,
3427
3429
  buildHoldingUpdate: () => buildHoldingUpdate,
3428
3430
  buildMarginfiWithdrawInteraction: () => buildMarginfiWithdrawInteraction,
3429
3431
  buildNestDepositRequest: () => buildNestDepositRequest,
@@ -3515,6 +3517,7 @@ __export(index_exports, {
3515
3517
  signerInOracleData: () => signerInOracleData,
3516
3518
  simulateConsensusOracleSettlement: () => simulateConsensusOracleSettlement,
3517
3519
  simulateDryRunSettlement: () => simulateDryRunSettlement,
3520
+ simulateOraclePublication: () => simulateOraclePublication,
3518
3521
  simulateSquadsProposalExecution: () => simulateSquadsProposalExecution,
3519
3522
  sumPositionsByMint: () => sumPositionsByMint,
3520
3523
  systemClock: () => systemClock,
@@ -19596,7 +19599,7 @@ function simulateConsensusOracleSettlement(args) {
19596
19599
  signerEntry.externalAmounts[update.holdingIndex] = update.externalAmount;
19597
19600
  }
19598
19601
  }
19599
- const consensus = applyConsensus(
19602
+ const consensus = args.assumeProposedUpdatesApplied ? applyProposedUpdates(holdings, args.updates, args.nowTs) : applyConsensus(
19600
19603
  holdings,
19601
19604
  oracle.entries,
19602
19605
  args.nowTs,
@@ -19734,6 +19737,34 @@ function simulateConsensusOracleSettlement(args) {
19734
19737
  };
19735
19738
  }
19736
19739
  }
19740
+ function applyProposedUpdates(holdings, updates, nowTs) {
19741
+ const seen = /* @__PURE__ */ new Set();
19742
+ return updates.map((update) => {
19743
+ const holding = holdings[update.holdingIndex];
19744
+ if (!holding || holding.cleared || holding.mint !== update.mint || holding.decimals !== update.decimals || holding.priceOracleType === "none" || update.price <= 0n || update.externalAmount < 0n || update.externalAmount > 0xffffffffffffffffn || seen.has(update.holdingIndex)) {
19745
+ throw new Error(
19746
+ `invalid proposed update for holding #${update.holdingIndex}`
19747
+ );
19748
+ }
19749
+ seen.add(update.holdingIndex);
19750
+ const usesConsensusPrice = holding.priceOracleType === "consensusoracle";
19751
+ holding.externalAmount = update.externalAmount;
19752
+ if (usesConsensusPrice) {
19753
+ holding.price = update.price;
19754
+ holding.lastUpdateTs = nowTs;
19755
+ if (!holding.isBase && holding.localAmount === 0n && update.externalAmount === 0n)
19756
+ holding.cleared = true;
19757
+ }
19758
+ return {
19759
+ holdingIndex: update.holdingIndex,
19760
+ mint: update.mint,
19761
+ reportCount: 1,
19762
+ settledPrice: usesConsensusPrice ? holding.price : void 0,
19763
+ settledExternalAmount: holding.externalAmount,
19764
+ wouldUpdateHolding: true
19765
+ };
19766
+ });
19767
+ }
19737
19768
  function applyConsensus(holdings, entries, nowTs, stalenessThresholdSecs) {
19738
19769
  const results = [];
19739
19770
  for (let index = 0; index < holdings.length; index += 1) {
@@ -20743,7 +20774,20 @@ function formatUnits(value, decimals) {
20743
20774
  }
20744
20775
 
20745
20776
  // src/services/consensusOracle/pipeline/dryRunSettlement.ts
20746
- async function simulateDryRunSettlement({
20777
+ async function simulateDryRunSettlement(args) {
20778
+ return simulateConsensusOracleSettlement(await fetchSimulationArgs(args));
20779
+ }
20780
+ async function simulateOraclePublication(args) {
20781
+ const inputs = await fetchSimulationArgs(args);
20782
+ return {
20783
+ consensus: simulateConsensusOracleSettlement(inputs),
20784
+ proposed: simulateConsensusOracleSettlement({
20785
+ ...inputs,
20786
+ assumeProposedUpdatesApplied: true
20787
+ })
20788
+ };
20789
+ }
20790
+ async function fetchSimulationArgs({
20747
20791
  client,
20748
20792
  signer,
20749
20793
  vault,
@@ -20771,7 +20815,7 @@ async function simulateDryRunSettlement({
20771
20815
  if (!info) throw new Error(`share mint ${mintKeys[index]} does not exist`);
20772
20816
  return readSplMintSupply(info.data);
20773
20817
  });
20774
- return simulateConsensusOracleSettlement({
20818
+ return {
20775
20819
  vault: vaultState,
20776
20820
  oracleData: oracleState.data,
20777
20821
  trancheState,
@@ -20781,7 +20825,7 @@ async function simulateDryRunSettlement({
20781
20825
  physicalShareSupply: supplies[0],
20782
20826
  physicalJuniorSupply: tranchingEnabled ? supplies[1] : void 0,
20783
20827
  physicalSeniorSupply: tranchingEnabled ? supplies[2] : void 0
20784
- });
20828
+ };
20785
20829
  }
20786
20830
 
20787
20831
  // src/services/consensusOracle/pipeline/holdingUpdates.ts
@@ -20863,6 +20907,35 @@ async function resolveTrackedAmounts(yieldTracker, cfg, decimals) {
20863
20907
  };
20864
20908
  }
20865
20909
 
20910
+ // src/services/consensusOracle/pipeline/impliedApyGuard.ts
20911
+ var MAX_ORACLE_IMPLIED_APY_BPS = 2000n;
20912
+ var SECONDS_PER_YEAR2 = 31536000n;
20913
+ function assertOracleImpliedApy(vault, simulation, label) {
20914
+ if (simulation.current.regular.totalSupply === 0n) return;
20915
+ const apy = simulation.realizedApy;
20916
+ const prefix = `vault ${vault}: ${label}`;
20917
+ if (!apy || apy.nextValue === void 0 || apy.priorValue <= 0n || apy.priorTs <= 0n) {
20918
+ throw new Error(
20919
+ `${prefix} implied APY cannot be verified; oracle update and NAV crank blocked`
20920
+ );
20921
+ }
20922
+ const gain = apy.nextValue - apy.priorValue;
20923
+ if (gain <= 0n) return;
20924
+ if (apy.elapsedSecs <= 0n) {
20925
+ throw new Error(
20926
+ `${prefix} has positive growth without a positive APY time window; oracle update and NAV crank blocked`
20927
+ );
20928
+ }
20929
+ const numerator = gain * 10000n * SECONDS_PER_YEAR2;
20930
+ const denominator = apy.priorValue * apy.elapsedSecs;
20931
+ if (numerator > MAX_ORACLE_IMPLIED_APY_BPS * denominator) {
20932
+ const minimumBps = (numerator + denominator - 1n) / denominator;
20933
+ throw new Error(
20934
+ `${prefix} implied APY exceeds 20% (requires ${minimumBps}bps); oracle update and NAV crank blocked`
20935
+ );
20936
+ }
20937
+ }
20938
+
20866
20939
  // src/services/consensusOracle/pipeline/livePriceRefresh.ts
20867
20940
  var import_common51 = __toESM(require_dist());
20868
20941
  async function refreshLiveOraclePrices({
@@ -21106,8 +21179,7 @@ async function reconcileManagerWalletBalances({
21106
21179
  updates: accepted ? adjusted : pendingUpdates,
21107
21180
  previousNav,
21108
21181
  candidateNav,
21109
- adjustedNav,
21110
- walletUpdates: adjusted
21182
+ adjustedNav
21111
21183
  };
21112
21184
  }
21113
21185
  function managerReconciliationStateKey(state) {
@@ -21315,7 +21387,7 @@ async function withDiscoveredYieldAccounts(yieldTracker, target, vaultState, exc
21315
21387
  }
21316
21388
 
21317
21389
  // src/services/consensusOracle/pipeline/settlement.ts
21318
- var SECONDS_PER_YEAR2 = 365n * 24n * 3600n;
21390
+ var SECONDS_PER_YEAR3 = 365n * 24n * 3600n;
21319
21391
  async function settleVault2({
21320
21392
  client,
21321
21393
  oracle,
@@ -21329,30 +21401,29 @@ async function settleVault2({
21329
21401
  beforeSubmit
21330
21402
  }) {
21331
21403
  const vault = target.vault;
21332
- log(`vault ${vault}: submitting ${updates.length} consensus asset update(s)`);
21404
+ log(`vault ${vault}: preparing ${updates.length} consensus asset update(s)`);
21333
21405
  for (const update of updates) {
21334
21406
  log(
21335
21407
  ` holding #${update.holdingIndex} ${update.mint}: price=${update.price} external_amount=${update.externalAmount} [pendingNest=${update.pendingNestAmount ?? 0n} managerWallet=${update.managerWalletAmount ?? 0n} mpcWallet=${update.mpcWalletAmount ?? 0n} mpcMarginfi=${update.mpcMarginfiAmount ?? 0n} lp=${update.lpAmount} tracked=${update.trackedValueAmount} principal=${update.trackedPrincipalAmount} yield=${update.yieldAmount}]`
21336
21408
  );
21337
21409
  }
21338
- try {
21339
- const simulation = await simulateDryRunSettlement({
21340
- client,
21341
- signer,
21342
- vault,
21343
- vaultState,
21344
- updates,
21345
- nowSecs
21346
- });
21347
- log(
21348
- `vault ${vault}: expected settlement using this report and current consensus`
21349
- );
21350
- for (const line of formatSettlementSimulation(simulation)) log(line);
21351
- } catch (error) {
21352
- log(
21353
- `vault ${vault}: expected share prices unavailable (${error instanceof Error ? error.message : String(error)})`
21354
- );
21355
- }
21410
+ await assertNoUnconfirmedYieldPayments(yieldTracker, target);
21411
+ const simulations = await simulateOraclePublication({
21412
+ client,
21413
+ signer,
21414
+ vault,
21415
+ vaultState,
21416
+ updates,
21417
+ nowSecs
21418
+ });
21419
+ log(
21420
+ `vault ${vault}: expected settlement using this report and current consensus`
21421
+ );
21422
+ for (const line of formatSettlementSimulation(simulations.consensus))
21423
+ log(line);
21424
+ assertOracleImpliedApy(vault, simulations.proposed, "proposed report");
21425
+ if (simulations.consensus.realizedApy)
21426
+ assertOracleImpliedApy(vault, simulations.consensus, "current consensus");
21356
21427
  await assertNoUnconfirmedYieldPayments(yieldTracker, target);
21357
21428
  await beforeSubmit?.();
21358
21429
  const updateSignature = await oracle.updateAssetConsensusPrice(
@@ -21441,7 +21512,7 @@ async function logProspectiveApy({
21441
21512
  if (physicalNavBefore <= 0n) return;
21442
21513
  const elapsedSecs = nowSecs - settledNavTs;
21443
21514
  if (elapsedSecs <= 0n) return;
21444
- const apyBps = (prospectiveNav - physicalNavBefore) * SECONDS_PER_YEAR2 * 10000n / (physicalNavBefore * elapsedSecs);
21515
+ const apyBps = (prospectiveNav - physicalNavBefore) * SECONDS_PER_YEAR3 * 10000n / (physicalNavBefore * elapsedSecs);
21445
21516
  log(
21446
21517
  `vault ${vault}: raw candidate estimate (before consensus, not the max-APY check): NAV ${prospectiveNav} vs physical baseline ${physicalNavBefore} (elapsed ${elapsedSecs}s) \u2192 implied APY ${apyBps}bps`
21447
21518
  );
@@ -21599,6 +21670,7 @@ async function readMarginfiDepositsForAuthority(connection, authority, mints2) {
21599
21670
  for (const bank of (0, import_marginfi2.parseBankPksFromMarginfiAccount)(account.data))
21600
21671
  bankKeys.set(bank.toBase58(), bank);
21601
21672
  }
21673
+ if (bankKeys.size === 0) return /* @__PURE__ */ new Map();
21602
21674
  const client = await (0, import_marginfi2.createMarginfiReadClient)(connection, [
21603
21675
  ...bankKeys.values()
21604
21676
  ]);
@@ -21820,7 +21892,7 @@ var MarginfiPositionProvider = class {
21820
21892
  };
21821
21893
 
21822
21894
  // src/services/consensusOracle/yield/mockYieldTracker.ts
21823
- var SECONDS_PER_YEAR3 = 365 * 24 * 60 * 60;
21895
+ var SECONDS_PER_YEAR4 = 365 * 24 * 60 * 60;
21824
21896
  var MockYieldTracker = class {
21825
21897
  constructor(opts = {}) {
21826
21898
  this.accounts = /* @__PURE__ */ new Map();
@@ -21880,12 +21952,12 @@ var MockYieldTracker = class {
21880
21952
  let segStart = windowStartMs;
21881
21953
  for (const cf of boundaries) {
21882
21954
  const dtSecs = (cf.ts - segStart) / 1e3;
21883
- totalYield += principal * apr * (dtSecs / SECONDS_PER_YEAR3);
21955
+ totalYield += principal * apr * (dtSecs / SECONDS_PER_YEAR4);
21884
21956
  principal += cf.amount;
21885
21957
  segStart = cf.ts;
21886
21958
  }
21887
21959
  const tailSecs = Math.max(0, (windowEndMs - segStart) / 1e3);
21888
- totalYield += principal * apr * (tailSecs / SECONDS_PER_YEAR3);
21960
+ totalYield += principal * apr * (tailSecs / SECONDS_PER_YEAR4);
21889
21961
  const paidYield = state.yieldPayments.reduce((sum, payment) => {
21890
21962
  return payment.status === "confirmed" && payment.effectiveAt > windowStartMs && payment.effectiveAt <= windowEndMs ? sum + payment.amount : sum;
21891
21963
  }, 0);
@@ -22171,7 +22243,7 @@ var ConsensusOracleService = class {
22171
22243
  if (dryRun) {
22172
22244
  log(`vault ${target.vault}: dry run, ${updates.length} holding(s)`);
22173
22245
  try {
22174
- const settlementSimulation = await simulateDryRunSettlement({
22246
+ const simulations = await simulateOraclePublication({
22175
22247
  client: this.client,
22176
22248
  signer,
22177
22249
  vault: target.vault,
@@ -22179,16 +22251,27 @@ var ConsensusOracleService = class {
22179
22251
  updates,
22180
22252
  nowSecs: this.nowSecs()
22181
22253
  });
22254
+ assertOracleImpliedApy(
22255
+ target.vault,
22256
+ simulations.proposed,
22257
+ "proposed report"
22258
+ );
22259
+ if (simulations.consensus.realizedApy)
22260
+ assertOracleImpliedApy(
22261
+ target.vault,
22262
+ simulations.consensus,
22263
+ "current consensus"
22264
+ );
22182
22265
  return {
22183
22266
  vault: target.vault,
22184
22267
  updates,
22185
22268
  dryRun: true,
22186
- settlementSimulation
22269
+ settlementSimulation: simulations.consensus
22187
22270
  };
22188
22271
  } catch (error) {
22189
22272
  const settlementSimulationError = error instanceof Error ? error.message : String(error);
22190
22273
  log(
22191
- `vault ${target.vault}: settlement simulation unavailable: ${settlementSimulationError}`
22274
+ `vault ${target.vault}: oracle publication preflight failed: ${settlementSimulationError}`
22192
22275
  );
22193
22276
  return {
22194
22277
  vault: target.vault,
@@ -23721,6 +23804,7 @@ var import_common63 = __toESM(require_dist());
23721
23804
  MAX_INCENTIVE_RECIPIENTS,
23722
23805
  MAX_INCENTIVE_REPORT_TTL,
23723
23806
  MAX_MANAGER_WITHDRAW_DESTINATIONS,
23807
+ MAX_ORACLE_IMPLIED_APY_BPS,
23724
23808
  MAX_PRICE_STALENESS_THRESHOLD_SECS,
23725
23809
  MIN_EXTERNAL_POSITION_SAMPLES,
23726
23810
  ManagerRedepositAssetBuilder,
@@ -23796,6 +23880,7 @@ var import_common63 = __toESM(require_dist());
23796
23880
  applyEffectiveApy,
23797
23881
  assertNoLargeBalanceChanges,
23798
23882
  assertNoUnconfirmedYieldPayments,
23883
+ assertOracleImpliedApy,
23799
23884
  buildHoldingUpdate,
23800
23885
  buildMarginfiWithdrawInteraction,
23801
23886
  buildNestDepositRequest,
@@ -23887,6 +23972,7 @@ var import_common63 = __toESM(require_dist());
23887
23972
  signerInOracleData,
23888
23973
  simulateConsensusOracleSettlement,
23889
23974
  simulateDryRunSettlement,
23975
+ simulateOraclePublication,
23890
23976
  simulateSquadsProposalExecution,
23891
23977
  sumPositionsByMint,
23892
23978
  systemClock,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perena/vault-sdk",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "Vault program helpers for Bankineco integrations.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -45,8 +45,6 @@
45
45
  "inspect": "tsx scripts/inspect.ts",
46
46
  "vault-data": "tsx scripts/fetchVaultData.ts",
47
47
  "idle-liquidity": "tsx scripts/runIdleLiquidityService.ts",
48
- "preview-oracle-update": "tsx scripts/previewOracleUpdate.ts",
49
- "correct-oracle-nav": "tsx scripts/correctOracleNav.ts",
50
48
  "simulate-withdraw": "tsx scripts/simulate-withdraw.ts",
51
49
  "simulate-message": "tsx scripts/simulate-message.ts",
52
50
  "run-external-liquidity-service": "tsx scripts/runExternalLiquidityService.ts",