@panoptic-eng/sdk 1.0.75 → 1.0.76
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/{cow-12OtZc7G.js → cow-CniZtok-.js} +1 -1
- package/dist/index.d.ts +355 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +909 -38
- package/dist/index.js.map +1 -1
- package/dist/{irm-BntFNP1P.js → irm-CGuYhr-C.js} +1 -1
- package/dist/panoptic/v2/index.d.ts +32 -1
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +67 -1
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +32 -1
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +67 -1
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{router-lUA1kp8A.js → router-DL_cDCzG.js} +1 -1
- package/dist/{rates-c9XVKm3m.js → tokenFlow-6Ec9Hz48.js} +286 -2
- package/dist/{transactionFees-CqaoQFF-.js → transactionFees-DtoFzBvZ.js} +30 -20
- package/dist/{v2-C0vQkjxc.js → v2-t8LiEkav.js} +71 -5
- package/dist/vault-transaction-fees.d.ts +15 -6
- package/dist/vault-transaction-fees.d.ts.map +1 -1
- package/dist/vault-transaction-fees.js +29 -19
- package/dist/vault-transaction-fees.js.map +1 -1
- package/dist/{writes-CDTpO4OY.js → writes-DKpVWZkE.js} +2 -286
- package/dist/zodiac/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -485,8 +485,8 @@ var VaultTransactionGasCostLimitError = class extends Error {
|
|
|
485
485
|
gasLimit;
|
|
486
486
|
maximumAffordableFeePerGas;
|
|
487
487
|
minimumRequiredFeePerGas;
|
|
488
|
-
constructor({ gasLimit, maximumAffordableFeePerGas, minimumRequiredFeePerGas }) {
|
|
489
|
-
super(`Vault transaction cannot fit the ${
|
|
488
|
+
constructor({ gasLimit, maximumAffordableFeePerGas, minimumRequiredFeePerGas, maximumGasCost = MAX_VAULT_TRANSACTION_GAS_COST }) {
|
|
489
|
+
super(`Vault transaction cannot fit the ${maximumGasCost.toString()} wei gas-cost limit: gasLimit=${gasLimit.toString()}, maximumAffordableFeePerGas=${maximumAffordableFeePerGas.toString()}, minimumRequiredFeePerGas=${minimumRequiredFeePerGas.toString()}`);
|
|
490
490
|
this.name = "VaultTransactionGasCostLimitError";
|
|
491
491
|
this.gasLimit = gasLimit;
|
|
492
492
|
this.maximumAffordableFeePerGas = maximumAffordableFeePerGas;
|
|
@@ -507,6 +507,11 @@ var VaultTransactionReplacementLimitError = class extends Error {
|
|
|
507
507
|
this.maximumAffordableFeePerGas = maximumAffordableFeePerGas;
|
|
508
508
|
}
|
|
509
509
|
};
|
|
510
|
+
function resolveMaximumGasCost(feePolicy) {
|
|
511
|
+
const maximum = feePolicy?.maxTransactionGasCost ?? MAX_VAULT_TRANSACTION_GAS_COST;
|
|
512
|
+
if (maximum <= 0n) throw new Error("Vault transaction gas budget must be positive");
|
|
513
|
+
return maximum;
|
|
514
|
+
}
|
|
510
515
|
function ceilMultiplyFraction(value, numerator, denominator) {
|
|
511
516
|
return (value * numerator + denominator - 1n) / denominator;
|
|
512
517
|
}
|
|
@@ -581,30 +586,32 @@ function resolveRpcPriorityFeeQuote({ baseFeePerGas, rawPriorityFeePerGas, minim
|
|
|
581
586
|
source: "rpc_priority_fee"
|
|
582
587
|
};
|
|
583
588
|
}
|
|
584
|
-
function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote, gasLimit, finalReplacement = false, staleBoundsReplacement = false }) {
|
|
589
|
+
function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote, gasLimit, finalReplacement = false, staleBoundsReplacement = false, feePolicy }) {
|
|
585
590
|
if (gasLimit <= 0n) throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`);
|
|
586
|
-
const bumpedPriorityFee = staleBoundsReplacement ? ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR) : ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR, DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR);
|
|
591
|
+
const bumpedPriorityFee = staleBoundsReplacement || feePolicy?.marketPriorityFees ? ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR) : ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR, DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR);
|
|
587
592
|
const bumpedMaxFee = ceilMultiplyFraction(originalQuote.maxFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR);
|
|
588
593
|
const escalatingPriorityFee = historicalQuote.maxPriorityFeePerGas > bumpedPriorityFee ? historicalQuote.maxPriorityFeePerGas : bumpedPriorityFee;
|
|
589
|
-
const
|
|
590
|
-
const
|
|
594
|
+
const maximumGasCost = resolveMaximumGasCost(feePolicy);
|
|
595
|
+
const priorityFeeLimit = feePolicy?.marketPriorityFees ? maximumGasCost / gasLimit : staleBoundsReplacement ? MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS : finalReplacement ? MAX_VAULT_PRIORITY_FEE_PER_GAS : MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS;
|
|
596
|
+
const desiredMaxPriorityFeePerGas = feePolicy?.marketPriorityFees ? escalatingPriorityFee : finalReplacement ? MAX_VAULT_PRIORITY_FEE_PER_GAS : staleBoundsReplacement ? bumpedPriorityFee : escalatingPriorityFee;
|
|
591
597
|
const requiredReplacementPriorityFee = ceilMultiplyFraction(originalQuote.maxPriorityFeePerGas, REPLACEMENT_FEE_BUMP_NUMERATOR, REPLACEMENT_FEE_BUMP_DENOMINATOR);
|
|
592
598
|
const requiredMaxPriorityFeePerGas = desiredMaxPriorityFeePerGas < priorityFeeLimit ? desiredMaxPriorityFeePerGas : priorityFeeLimit;
|
|
593
599
|
if (requiredMaxPriorityFeePerGas < requiredReplacementPriorityFee) throw new VaultTransactionReplacementLimitError({
|
|
594
|
-
code: "PriorityFeeCapExceeded",
|
|
600
|
+
code: feePolicy?.marketPriorityFees ? "GasCostCapExceeded" : "PriorityFeeCapExceeded",
|
|
595
601
|
gasLimit,
|
|
596
602
|
requiredMaxFeePerGas: originalQuote.maxFeePerGas,
|
|
597
603
|
requiredMaxPriorityFeePerGas: requiredReplacementPriorityFee,
|
|
598
|
-
maximumAffordableFeePerGas:
|
|
604
|
+
maximumAffordableFeePerGas: maximumGasCost / gasLimit
|
|
599
605
|
});
|
|
600
|
-
const bufferedBaseFee = historicalQuote.minimumMaxFeePerGas - (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
|
|
606
|
+
const bufferedBaseFee = feePolicy?.marketPriorityFees ? historicalQuote.maxFeePerGas - historicalQuote.maxPriorityFeePerGas : historicalQuote.minimumMaxFeePerGas - (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
|
|
601
607
|
const currentMarketMaxFee = bufferedBaseFee + requiredMaxPriorityFeePerGas;
|
|
602
608
|
const desiredMaxFeePerGas = currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee;
|
|
603
|
-
const maximumAffordableFeePerGas =
|
|
604
|
-
|
|
609
|
+
const maximumAffordableFeePerGas = maximumGasCost / gasLimit;
|
|
610
|
+
const minimumMarketFeePerGas = (historicalQuote.currentBaseFeePerGas ?? bufferedBaseFee) + requiredMaxPriorityFeePerGas;
|
|
611
|
+
if (bumpedMaxFee > maximumAffordableFeePerGas || requiredMaxPriorityFeePerGas > maximumAffordableFeePerGas || feePolicy?.marketPriorityFees && minimumMarketFeePerGas > maximumAffordableFeePerGas) throw new VaultTransactionReplacementLimitError({
|
|
605
612
|
code: "GasCostCapExceeded",
|
|
606
613
|
gasLimit,
|
|
607
|
-
requiredMaxFeePerGas: bumpedMaxFee,
|
|
614
|
+
requiredMaxFeePerGas: feePolicy?.marketPriorityFees && minimumMarketFeePerGas > bumpedMaxFee ? minimumMarketFeePerGas : bumpedMaxFee,
|
|
608
615
|
requiredMaxPriorityFeePerGas,
|
|
609
616
|
maximumAffordableFeePerGas
|
|
610
617
|
});
|
|
@@ -627,13 +634,15 @@ function resolveFallbackQuote({ maxFeePerGas: estimatedMaxFeePerGas, maxPriority
|
|
|
627
634
|
source: "viem_fallback"
|
|
628
635
|
};
|
|
629
636
|
}
|
|
630
|
-
function applyVaultTransactionGasCostLimit(quote, gasLimit) {
|
|
637
|
+
function applyVaultTransactionGasCostLimit(quote, gasLimit, feePolicy) {
|
|
631
638
|
if (gasLimit <= 0n) throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`);
|
|
632
|
-
const
|
|
639
|
+
const maximumGasCost = resolveMaximumGasCost(feePolicy);
|
|
640
|
+
const maximumAffordableFeePerGas = maximumGasCost / gasLimit;
|
|
633
641
|
if (maximumAffordableFeePerGas < quote.minimumMaxFeePerGas) throw new VaultTransactionGasCostLimitError({
|
|
634
642
|
gasLimit,
|
|
635
643
|
maximumAffordableFeePerGas,
|
|
636
|
-
minimumRequiredFeePerGas: quote.minimumMaxFeePerGas
|
|
644
|
+
minimumRequiredFeePerGas: quote.minimumMaxFeePerGas,
|
|
645
|
+
maximumGasCost
|
|
637
646
|
});
|
|
638
647
|
if (quote.maxFeePerGas <= maximumAffordableFeePerGas) return quote;
|
|
639
648
|
const bufferedBaseFee = quote.minimumMaxFeePerGas - (quote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
|
|
@@ -648,8 +657,9 @@ function bufferVaultTransactionGasEstimate(gasEstimate) {
|
|
|
648
657
|
if (gasEstimate <= 0n) throw new Error(`Vault transaction gas estimate must be positive, received ${gasEstimate.toString()}`);
|
|
649
658
|
return ceilMultiplyFraction(gasEstimate, GAS_ESTIMATE_BUFFER_NUMERATOR, GAS_ESTIMATE_BUFFER_DENOMINATOR);
|
|
650
659
|
}
|
|
651
|
-
function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
|
|
660
|
+
function validateVaultSignedTransactionFeeCaps(feeCaps, quote, feePolicy) {
|
|
652
661
|
const { chainId, gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps;
|
|
662
|
+
const maximumGasCost = resolveMaximumGasCost(feePolicy);
|
|
653
663
|
const minimumPriorityFeePerGas = quote?.minimumPriorityFeePerGas ?? getChainPriorityFeeFloor(chainId) ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
|
|
654
664
|
if (maxFeePerGas === null || maxPriorityFeePerGas === null) return {
|
|
655
665
|
valid: false,
|
|
@@ -666,15 +676,15 @@ function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
|
|
|
666
676
|
code: "PriorityFeeTooLow",
|
|
667
677
|
reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must be at least ${minimumPriorityFeePerGas.toString()} wei.`
|
|
668
678
|
};
|
|
669
|
-
if (maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) return {
|
|
679
|
+
if (!feePolicy?.marketPriorityFees && maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) return {
|
|
670
680
|
valid: false,
|
|
671
681
|
code: "PriorityFeeTooHigh",
|
|
672
682
|
reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must not exceed ${MAX_VAULT_PRIORITY_FEE_PER_GAS.toString()} wei (3 gwei).`
|
|
673
683
|
};
|
|
674
|
-
if (gasLimit !== void 0 && gasLimit !== null && gasLimit * maxFeePerGas >
|
|
684
|
+
if (gasLimit !== void 0 && gasLimit !== null && gasLimit * maxFeePerGas > maximumGasCost) return {
|
|
675
685
|
valid: false,
|
|
676
686
|
code: "GasCostTooHigh",
|
|
677
|
-
reason: `Signed transaction maximum gas cost (${(gasLimit * maxFeePerGas).toString()} wei) must not exceed ${
|
|
687
|
+
reason: `Signed transaction maximum gas cost (${(gasLimit * maxFeePerGas).toString()} wei) must not exceed ${maximumGasCost.toString()} wei.`
|
|
678
688
|
};
|
|
679
689
|
if (quote !== void 0) {
|
|
680
690
|
const feeRequirementDescription = quote.currentBaseFeePerGas === void 0 ? "buffered next-block base fee" : "current base fee";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault-transaction-fees.js","names":["chainDeploymentsData","value: bigint","numerator: bigint","denominator: bigint","values: readonly bigint[]","chainId: number | undefined","priorityFee: bigint","quote: VaultTransactionFeeQuote","gasLimit: bigint","gasEstimate: bigint","feeCaps: VaultSignedTransactionFeeCaps","quote?: VaultTransactionFeeQuote","feeHistoryError: unknown","client: Client<Transport, chain>"],"sources":["../../deployments/src/chainDeployments.data.json","../../deployments/src/chainDeployments.js","../../deployments/src/vaultDisplayNames.js","../src/hypoVault/transactionFees.ts"],"sourcesContent":["{\n \"1\": {\n \"chainId\": 1,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x1F98431c8aD98523631AE4a59f267346ea31F984\",\n \"poolManager\": \"0x000000000004444c5dc75cB358380D2e3dE08A90\",\n \"stateView\": \"0x7ffe42c4a5deea5b0fec41c94c136cf115597227\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xF16714665955DBd0361D997eFc50fe391D96E8D0\",\n \"factory\": \"0xd5049B2647de57141dE7F65E5124707B99A452A3\",\n \"accountant\": \"0x65aA902AE3135658587FFC36ED51B61c927114e1\",\n \"rolesAuthority\": \"0xb952D345c413Ddb7850173422bAe4968e0330598\",\n \"collateralTrackerDecoderAndSanitizer\": \"0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0xd4e2c720a760049cc4151bcf61e3a9348db9cd92\",\n \"usdcPlpVault\": \"0x236d0558f06cd60780b232d4Ec4c92d2cb7e4D18\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0xB6Fc48e658C9B1a7dbdFA51A5E153ab60BB2e04d\",\n \"usdcPlpVaultManager\": \"0x2ce65016366ef7320078e0758D58Cf1038bc7C4e\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\",\n \"usdcPlpVaultManager\": \"0x3c1c79d0cfc316Ba959194c89696a8382d7d283b\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x00000000563b70d704f4c6675a5f6ac989fbae13\",\n \"collateralTracker0\": \"0x1e46b0289B7E0F710E2Db8Ab87800dd782D624f7\",\n \"collateralTracker1\": \"0x12bF31955522BAC337D93e1bC0a39F68D8BDa216\"\n },\n \"additionalPools\": {\n \"ethUsdc5bpsV3\": {\n \"version\": \"v3\",\n \"panopticPool\": \"0x00000000009C7B687e833559e34503f64d7ed7c4\",\n \"collateralTracker0\": \"0x3CCdA7d5E841d6543D90BcEc20b36a724C184DE9\",\n \"collateralTracker1\": \"0x69E9f9e44E5F52237493b980dd7306198C64A4E4\"\n },\n \"ethUsdc5bpsV3Replacement\": {\n \"version\": \"v3\",\n \"panopticPool\": \"0x00000000000E98f6c5aE16835bAdF2f7cC0d49D7\",\n \"collateralTracker0\": \"0x3E24E4Ab1e097F35C910eb9242a8C1530ee9C482\",\n \"collateralTracker1\": \"0xE1e01ac7E6b2671b82Aea4Db812a5c444523a039\",\n \"riskEngine\": \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"deploymentBlock\": \"26173664\"\n }\n },\n \"v2\": {\n \"semiFungiblePositionManagerV4\": \"0x00000000000005C3287f136Ef5AF56c68Ea6849f\",\n \"semiFungiblePositionManagerV3\": \"0x00000000000005E4693aDc8Ec0f12D686f728198\",\n \"builderFactory\": \"0x0000000000000a3D22E158417AA639D7F71b0FF7\",\n \"riskEngine\": \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"panopticPoolImplementation\": \"0x000000000000135429F0DaCaB61639Bf6a63EbbC\",\n \"collateralTrackerImplementation\": \"0x0000000000001d9c38CA405A2e04420865A08A33\",\n \"panopticFactoryV4\": \"0x0000000000000c51d0f8cf4bd9adE7191372a625\",\n \"panopticFactoryV3\": \"0x0000000000000aDC9A108591e718F2aee963a2a7\",\n \"panopticHelper\": \"0x0000000000000000000000000000000000000000\",\n \"panopticMath\": \"0x000000000000334bbd65C195581cf59ECf315932\",\n \"panopticQuery\": \"0x0000000000000e1aE9c66C1c3B0A547D23389C93\",\n \"interactionHelper\": \"0x00000000000041fe14Ce3c2392337CE501aE8328\"\n }\n },\n \"riskEngines\": [\n \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\"\n ],\n \"markets\": {\n \"ethUsdc30bps\": {\n \"currency0\": \"0x0000000000000000000000000000000000000000\",\n \"currency1\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"fee\": 3000,\n \"tickSpacing\": 60,\n \"poolId\": \"0x3C08AE4977F78D\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-mainnet/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-mainnet/v2_prod/gn\"\n },\n \"sfpmSwap\": {\n \"version\": \"v3\",\n \"sfpm\": \"0x00000000000005E4693aDc8Ec0f12D686f728198\",\n \"poolAddress\": \"0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640\",\n \"poolId\": \"2824133844976349\",\n \"fee\": 500,\n \"weth\": \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\"\n },\n \"deprecatedRiskEngines\": [\n \"0x0000000000000e673aECBDB5f5fE5DFAf4a8e9Ac\",\n \"0x0000000000000E65545005B26207D7edFd031260\",\n \"0x000000000000075e29cdaa9cb640a69e148ca7da\",\n \"0x0000000000000fe1e261f66ce2f44def4f5ae0cb\"\n ]\n },\n \"4663\": {\n \"chainId\": 4663,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x1f7d7550b1b028f7571e69a784071f0205fd2efa\",\n \"poolManager\": \"0x8366a39cc670b4001a1121b8f6a443a643e40951\",\n \"stateView\": \"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xF16714665955DBd0361D997eFc50fe391D96E8D0\",\n \"factory\": \"0xd5049B2647de57141dE7F65E5124707B99A452A3\",\n \"accountant\": \"0x9e345d862c41010F87D8E5A279e8D320D2831D36\",\n \"rolesAuthority\": \"0xb952D345c413Ddb7850173422bAe4968e0330598\",\n \"collateralTrackerDecoderAndSanitizer\": \"0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0x0000000000000000000000000000000000000000\",\n \"usdcPlpVault\": \"0x0000000000000000000000000000000000000000\",\n \"usdgPlpVault\": \"0x08B24123252Bd9c4DD473b6573D4cF67196FFC4B\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdcPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdgPlpVaultManager\": \"0x67Edb096585efe88a9A1ee16c5857AB74Fc8EA87\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdcPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdgPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x000000000c21b38c54AcA7c7145Df01ff09d69Bb\",\n \"collateralTracker0\": \"0xDc508622CD7e3850c8240e88c10361Cf493465b6\",\n \"collateralTracker1\": \"0x9212d804953bAf89C24ceFa6545aA293bA08a876\"\n },\n \"additionalPools\": {\n \"spyUsdg30bpsV4\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x00000000989bcb6f24af4a1Ab2A6d6a31c98A58E\",\n \"collateralTracker0\": \"0x49eaAC32A7CD4B8fB2209a12859a95E0b20aB0e5\",\n \"collateralTracker1\": \"0x670C44a0FC35dbC410498e47A6290a1C3196d191\"\n },\n \"spyUsdg5bpsV4\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x000000000c21b38c54AcA7c7145Df01ff09d69Bb\",\n \"collateralTracker0\": \"0xDc508622CD7e3850c8240e88c10361Cf493465b6\",\n \"collateralTracker1\": \"0x9212d804953bAf89C24ceFa6545aA293bA08a876\"\n },\n \"spyUsdg5bpsV4Replacement\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x000000000056475506823b2BedBD89f55232DA40\",\n \"collateralTracker0\": \"0xAd345C2088BF0B6140aa78ABB7fE8336e328686a\",\n \"collateralTracker1\": \"0xC9c3802aF99A6E9B9c3E7F5F8c5093e048Fac1Ca\",\n \"riskEngine\": \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\",\n \"deploymentBlock\": \"86379946\"\n }\n },\n \"v2\": {\n \"semiFungiblePositionManagerV4\": \"0x00000000000005C3287f136Ef5AF56c68Ea6849f\",\n \"semiFungiblePositionManagerV3\": \"0x00000000000005E4693aDc8Ec0f12D686f728198\",\n \"builderFactory\": \"0x0000000000000a3D22E158417AA639D7F71b0FF7\",\n \"riskEngine\": \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\",\n \"panopticPoolImplementation\": \"0x000000000000135429F0DaCaB61639Bf6a63EbbC\",\n \"collateralTrackerImplementation\": \"0x0000000000001d9c38CA405A2e04420865A08A33\",\n \"panopticFactoryV4\": \"0x0000000000000c51d0f8cf4bd9adE7191372a625\",\n \"panopticFactoryV3\": \"0x0000000000000aDC9A108591e718F2aee963a2a7\",\n \"panopticHelper\": \"0x0000000000000000000000000000000000000000\",\n \"panopticMath\": \"0x000000000000334bbd65C195581cf59ECf315932\",\n \"panopticQuery\": \"0x0000000000000e1aE9c66C1c3B0A547D23389C93\",\n \"interactionHelper\": \"0x00000000000041fe14Ce3c2392337CE501aE8328\"\n }\n },\n \"riskEngines\": [\n \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\"\n ],\n \"markets\": {\n \"spyUsdg\": {\n \"currency0\": \"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C\",\n \"currency1\": \"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168\",\n \"fee\": 500,\n \"tickSpacing\": 5,\n \"poolId\": \"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907\"\n },\n \"spyUsdg30bps\": {\n \"currency0\": \"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C\",\n \"currency1\": \"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168\",\n \"fee\": 3000,\n \"tickSpacing\": 60,\n \"poolId\": \"0xfe2a80bb5618fd14984b92ca6d45bf5ba67443ddb1435e28b2e48df2fc1526cd\"\n },\n \"spyUsdg5bps\": {\n \"currency0\": \"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C\",\n \"currency1\": \"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168\",\n \"fee\": 500,\n \"tickSpacing\": 5,\n \"poolId\": \"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-robinhood/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-robinhood/v2_prod/gn\"\n },\n \"deprecatedRiskEngines\": [\n \"0x0000000000000E65545005B26207D7edFd031260\",\n \"0x000000000000075e29cdaa9cb640a69e148ca7da\",\n \"0x0000000000000fe1e261f66ce2f44def4f5ae0cb\",\n \"0x0000000000000f3fb82469581A74776178E76Ca4\"\n ]\n },\n \"8453\": {\n \"chainId\": 8453,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x33128a8fC17869897dcE68Ed026d694621f6FDfD\",\n \"poolManager\": \"0x498581fF718922c3f8e6A244956aF099B2652b2b\",\n \"stateView\": \"0xA3c0c9b65baD0b08107Aa264b0f3dB444b867A71\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xec311aE06486ad44Ba782133b502A34aCE0f479E\",\n \"factory\": \"0x9bE53b169a41030f1710A9B82e9eA6413f14D12E\",\n \"accountant\": \"0x345cA3407942f9d175c9eA8B90e83A36F570f852\",\n \"rolesAuthority\": \"0x278D37CaBFFB4B72D2866E30fEFE08aef773E0B6\",\n \"collateralTrackerDecoderAndSanitizer\": \"0x4A290b3EC46cF320421Bb2aaee96d445de31CF0b\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0x41b7D0515d709A4Fd2CF27f9d141D0c2F8713D04\",\n \"usdcPlpVault\": \"0xb452af299c565D04B05E601efF2840e000C922f1\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0x2a4923456c79E9ebD10F5Bf5305a5C742bBc1D7C\",\n \"usdcPlpVaultManager\": \"0xdd6E2406a044582463CFE9F0C774870eAf4A310B\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\",\n \"usdcPlpVaultManager\": \"0x3c1c79d0cfc316Ba959194c89696a8382d7d283b\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0xB50e8bb68f5855DA742f4579274902a20454174a\",\n \"collateralTracker0\": \"0x0d82b189c96EbB1f44A7207e6A9cfB1e490f2869\",\n \"collateralTracker1\": \"0x9ba1082Ab3cb9edEA988697A14BBe543A3dABEd2\"\n },\n \"v2\": {\n \"semiFungiblePositionManagerV4\": \"0x8dcAa08cF298F8b4830FAf56d47930981AdE33af\",\n \"semiFungiblePositionManagerV3\": \"0xFB1c06B491305d618bb8a7a368C6e50c001C153A\",\n \"builderFactory\": \"0x6d26E916a18d522f7DdA2a26d9E1645564ccDcA5\",\n \"riskEngine\": \"0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481\",\n \"panopticPoolImplementation\": \"0x5BA68a018fF149c38ec52D181Dd24aBabE9a07DB\",\n \"collateralTrackerImplementation\": \"0x34B3a4e4F14f292575ECe3EF67886C4598af459f\",\n \"panopticFactoryV4\": \"0x9ac0317fcd124aff0b5429beb8de17020bc45f9a\",\n \"panopticFactoryV3\": \"0x687f616d68c483a7223e6922f59aef7452e26c1d\",\n \"panopticHelper\": \"0x0000000000000000000000000000000000000000\",\n \"panopticMath\": \"0x6d21699192f5aF112C87e53b32ff846782afF407\",\n \"panopticQuery\": \"0xd2586E1bbdd1169F597F3A370117EdF7372A7350\",\n \"interactionHelper\": \"0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15\"\n }\n },\n \"riskEngines\": [\n \"0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481\"\n ],\n \"markets\": {\n \"ethUsdc5bps\": {\n \"currency0\": \"0x0000000000000000000000000000000000000000\",\n \"currency1\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"fee\": 500,\n \"tickSpacing\": 10,\n \"poolId\": \"0x96d4b53a38337a5733179751781178a2613306063c511b78cd02684739288c0a\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-base/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-base/v2_prod/gn\"\n }\n },\n \"11155111\": {\n \"chainId\": 11155111,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x0227628f3F023bb0B980b67D528571c95c6DaC1c\",\n \"poolManager\": \"0xE03A1074c86CFeDd5C142C4F04F1a1536e203543\",\n \"stateView\": \"0xE1Dd9c3fA50EDB962E442f60DfBc432e24537E4C\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xC5b415Db4087228Af817893769DC3a205160160B\",\n \"factory\": \"0x363a9d605ca45cBfF3b597350DeADb53cdC292c7\",\n \"accountant\": \"0x25BBef1DF262c24aa1AACD1F7eCeEcc1a7AD08ab\",\n \"rolesAuthority\": \"0x673BfafB4e2712215B422347c1571421B83E8A3d\",\n \"collateralTrackerDecoderAndSanitizer\": \"0xb899BE50BAF25BBB3A3ca3403256B3c703E5AB5d\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0xD58C4F9AEe5bBfcf28dC9a8d3D57b323fA6521b1\",\n \"usdcPlpVault\": \"0xdd7a8d6c6975488e801129bC84302d74e2361208\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0x95eC124FAAB70D7aE147c3BE0336E01a828AE2d5\",\n \"usdcPlpVaultManager\": \"0xFB5aa3e0b46F3859D90B14b52ffd287013b5Ec53\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\",\n \"usdcPlpVaultManager\": \"0x3c1c79d0cfc316Ba959194c89696a8382d7d283b\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x872b98C46b2062F663BEb2CC9D4cE046Da2a2918\",\n \"collateralTracker0\": \"0x09a60b78d06a03e5148faedd3bfee6f58b22012f\",\n \"collateralTracker1\": \"0x7365664c8101ff7e9422ae2b203822253c31e69c\"\n },\n \"v2\": {\n \"semiFungiblePositionManagerV3\": \"0x9DaD2C40107Db4B29a5450401BB7A28e6eA00e43\",\n \"semiFungiblePositionManagerV4\": \"0xD2615995A71644E122cC2FD7FeC2392b971220DE\",\n \"builderFactory\": \"0x55f3D2d9D065AA5Fcc11D94c55a6085849e8b6C3\",\n \"riskEngine\": \"0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c\",\n \"panopticPoolImplementation\": \"0x969235B5830f13b58BB699305d9c70A8Cd3BD97C\",\n \"collateralTrackerImplementation\": \"0xafcd5F651Ae0403Ff668bb2dAc38BEa907a35Dba\",\n \"panopticFactoryV3\": \"0xd9FFCa53C0A6155001Ce8cbcAEfe89DB204690F1\",\n \"panopticFactoryV4\": \"0x8FCBb59b05779818D9BAD2686cc44B705603ce03\",\n \"panopticHelper\": \"0xfFEbB3A4ab793cB244209d4dA0Cb3e6B07133bd0\",\n \"panopticMath\": \"0x6d21699192f5aF112C87e53b32ff846782afF407\",\n \"panopticQuery\": \"0x74057945467Fb4eAE9193B46A60ae66a53f06A5b\",\n \"interactionHelper\": \"0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15\"\n }\n },\n \"riskEngines\": [\n \"0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c\"\n ],\n \"markets\": {\n \"ethUsdc5bps\": {\n \"currency0\": \"0x0000000000000000000000000000000000000000\",\n \"currency1\": \"0xFFFeD8254566B7F800f6D8CDb843ec75AE49B07A\",\n \"fee\": 500,\n \"tickSpacing\": 10,\n \"poolId\": \"0xba6673bcb27568a73a93dd23b20c8174fa16193cd90905be859144e8f13097a5\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-sepolia/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-sepolia/v2_prod/gn\"\n }\n }\n}\n","import chainDeploymentsData from './chainDeployments.data.json' with { type: 'json' }\n\nexport const MAINNET_CHAIN_ID = 1\nexport const SEPOLIA_CHAIN_ID = 11155111\nexport const BASE_CHAIN_ID = 8453\nexport const ROBINHOOD_CHAIN_ID = 4663\n\nexport const CHAIN_DEPLOYMENTS = chainDeploymentsData\n\nexport function getChainDeployment(chainId) {\n return CHAIN_DEPLOYMENTS[chainId]\n}\n\nexport function requireChainDeployment(chainId) {\n const deployment = getChainDeployment(chainId)\n if (deployment === undefined) {\n throw new Error(`Unsupported chain deployment for chainId ${chainId}`)\n }\n return deployment\n}\n\nexport function isSupportedChain(chainId) {\n return getChainDeployment(chainId) !== undefined\n}\n\nexport function getEthUsdcMarket(deployment) {\n const market = deployment.markets.ethUsdc5bps ?? deployment.markets.ethUsdc30bps\n if (market === undefined) {\n throw new Error(`Missing ETH/USDC market for chainId ${deployment.chainId}`)\n }\n return market\n}\n\nexport function getSpyUsdgMarket(deployment) {\n const market = deployment.markets.spyUsdg\n if (market === undefined) {\n throw new Error(`Missing SPY/USDG market for chainId ${deployment.chainId}`)\n }\n return market\n}\n\nfunction requireDeploymentValue(value, label) {\n if (value === undefined) {\n throw new Error(`Missing deployment value: ${label}`)\n }\n return value\n}\n\nexport const MAINNET_DEPLOYMENT = CHAIN_DEPLOYMENTS[MAINNET_CHAIN_ID]\nexport const MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES =\n MAINNET_DEPLOYMENT.panoptic.additionalPools?.ethUsdc5bpsV3\nexport const MAINNET_PANOPTIC_V2_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.v2\nexport const SEPOLIA_DEPLOYMENT = CHAIN_DEPLOYMENTS[SEPOLIA_CHAIN_ID]\nexport const SEPOLIA_HYPOVAULT_CORE_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.core\nexport const SEPOLIA_HYPOVAULT_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.vaults\nexport const SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.managers\nexport const SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = SEPOLIA_DEPLOYMENT.hypovault.turnkeySigners\nexport const SEPOLIA_PANOPTIC_POOL_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.pool\nexport const SEPOLIA_PANOPTIC_V2_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.v2\nexport const BASE_DEPLOYMENT = CHAIN_DEPLOYMENTS[BASE_CHAIN_ID]\nexport const BASE_HYPOVAULT_CORE_ADDRESSES = BASE_DEPLOYMENT.hypovault.core\nexport const BASE_HYPOVAULT_ADDRESSES = BASE_DEPLOYMENT.hypovault.vaults\nexport const BASE_HYPOVAULT_MANAGER_ADDRESSES = BASE_DEPLOYMENT.hypovault.managers\nexport const BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = BASE_DEPLOYMENT.hypovault.turnkeySigners\nexport const BASE_PANOPTIC_POOL_ADDRESSES = BASE_DEPLOYMENT.panoptic.pool\nexport const BASE_PANOPTIC_V2_ADDRESSES = BASE_DEPLOYMENT.panoptic.v2\nexport const BASE_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(BASE_DEPLOYMENT)\nexport const SEPOLIA_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(SEPOLIA_DEPLOYMENT)\n\nexport const MAINNET_RISK_ENGINES = MAINNET_DEPLOYMENT.riskEngines\nexport const BASE_RISK_ENGINES = BASE_DEPLOYMENT.riskEngines\nexport const SEPOLIA_RISK_ENGINES = SEPOLIA_DEPLOYMENT.riskEngines\n\nexport const ROBINHOOD_DEPLOYMENT = CHAIN_DEPLOYMENTS[ROBINHOOD_CHAIN_ID]\nexport const ROBINHOOD_HYPOVAULT_CORE_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.core\nexport const ROBINHOOD_HYPOVAULT_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.vaults\nexport const ROBINHOOD_HYPOVAULT_MANAGER_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.managers\nexport const ROBINHOOD_HYPOVAULT_MANAGER_TURNKEY_SIGNERS =\n ROBINHOOD_DEPLOYMENT.hypovault.turnkeySigners\nexport const ROBINHOOD_PANOPTIC_POOL_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.pool\nexport const ROBINHOOD_SPY_USDG_30BPS_PANOPTIC_POOL_ADDRESSES = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.panoptic.additionalPools?.spyUsdg30bpsV4,\n 'Robinhood SPY/USDG 30bps Panoptic pool',\n)\nexport const ROBINHOOD_SPY_USDG_5BPS_PANOPTIC_POOL_ADDRESSES = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.panoptic.additionalPools?.spyUsdg5bpsV4,\n 'Robinhood SPY/USDG 5bps Panoptic pool',\n)\nexport const ROBINHOOD_PANOPTIC_V2_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.v2\nexport const ROBINHOOD_RISK_ENGINES = ROBINHOOD_DEPLOYMENT.riskEngines\nexport const ROBINHOOD_SPY_USDG_MARKET = getSpyUsdgMarket(ROBINHOOD_DEPLOYMENT)\nexport const ROBINHOOD_SPY_USDG_30BPS_MARKET = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.markets.spyUsdg30bps,\n 'Robinhood SPY/USDG 30bps market',\n)\nexport const ROBINHOOD_SPY_USDG_5BPS_MARKET = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.markets.spyUsdg5bps,\n 'Robinhood SPY/USDG 5bps market',\n)\n","import {\n BASE_CHAIN_ID,\n MAINNET_CHAIN_ID,\n requireChainDeployment,\n ROBINHOOD_CHAIN_ID,\n SEPOLIA_CHAIN_ID,\n} from './chainDeployments.js'\n\nconst mainnetDeployment = requireChainDeployment(MAINNET_CHAIN_ID)\nconst mainnetVaults = mainnetDeployment.hypovault.vaults\nconst legacyMainnetVaults = {\n wethPlpVault: '0x779a2aa634A004b3a3f3b322083744869BBC6D66',\n usdcPlpVault: '0x963Fe9c93bc353602656ee4051A75114bA74d6c5',\n}\nconst sepoliaDeployment = requireChainDeployment(SEPOLIA_CHAIN_ID)\nconst sepoliaVaults = sepoliaDeployment.hypovault.vaults\nconst baseDeployment = requireChainDeployment(BASE_CHAIN_ID)\nconst baseVaults = baseDeployment.hypovault.vaults\nconst robinhoodDeployment = requireChainDeployment(ROBINHOOD_CHAIN_ID)\nconst robinhoodUsdgVault = robinhoodDeployment.hypovault.vaults.usdgPlpVault\n\nif (robinhoodUsdgVault === undefined) {\n throw new Error('Missing Robinhood USDG PLP vault address')\n}\n\nexport const VAULT_DISPLAY_NAMES_PER_CHAIN = {\n [MAINNET_CHAIN_ID]: {\n [mainnetVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [mainnetVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n [legacyMainnetVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [legacyMainnetVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n },\n [BASE_CHAIN_ID]: {\n [baseVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [baseVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n },\n [SEPOLIA_CHAIN_ID]: {\n [sepoliaVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [sepoliaVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n },\n [ROBINHOOD_CHAIN_ID]: {\n [robinhoodUsdgVault.toLowerCase()]: '0DTE +67∆ Covered Call Vault',\n },\n}\n\nexport const VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN = {\n [MAINNET_CHAIN_ID]: {\n [mainnetVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [mainnetVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n [legacyMainnetVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [legacyMainnetVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n },\n [BASE_CHAIN_ID]: {\n [baseVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [baseVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n },\n [SEPOLIA_CHAIN_ID]: {\n [sepoliaVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [sepoliaVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n },\n [ROBINHOOD_CHAIN_ID]: {\n [robinhoodUsdgVault.toLowerCase()]: () => '0DTE +67∆ Covered Call Vault',\n },\n}\n\nexport function resolveVaultDisplayName({ chainId, vaultAddress, underlyingSymbol, fallbackName }) {\n const vaultAddressLower = vaultAddress.toLowerCase()\n const resolver = VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN[chainId]?.[vaultAddressLower]\n if (resolver !== undefined) {\n return resolver({\n chainId,\n vaultAddress: vaultAddressLower,\n underlyingSymbol,\n fallbackName,\n })\n }\n\n const staticName = VAULT_DISPLAY_NAMES_PER_CHAIN[chainId]?.[vaultAddressLower]\n if (staticName !== undefined) {\n return staticName\n }\n\n if (fallbackName !== undefined && fallbackName !== null) {\n return fallbackName\n }\n\n return 'Vault'\n}\n","import type { Chain, Client, Transport } from 'viem'\nimport { hexToBigInt } from 'viem'\nimport { estimateFeesPerGas, getBlock, getFeeHistory } from 'viem/actions'\n\nimport { ROBINHOOD_CHAIN_ID } from './chainDeployments'\n\nexport const MIN_VAULT_PRIORITY_FEE_PER_GAS = 100_000_000n // 0.1 gwei\nexport const MAX_VAULT_PRIORITY_FEE_PER_GAS = 3_000_000_000n // 3 gwei\nexport const MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS = 8_000_000_000n // 8 gwei\nexport const MAX_VAULT_TRANSACTION_GAS_COST = 15_000_000_000_000_000n // 0.015 ETH\n\nconst FEE_HISTORY_BLOCK_COUNT = 20\nconst FEE_HISTORY_REWARD_PERCENTILES = [90]\nconst DELTA_HEDGE_FEE_HISTORY_REWARD_PERCENTILES = [25]\nconst BASE_FEE_BUFFER_NUMERATOR = 1_125n\nconst BASE_FEE_BUFFER_DENOMINATOR = 1_000n\nconst REPLACEMENT_FEE_BUMP_NUMERATOR = 1_125n\nconst REPLACEMENT_FEE_BUMP_DENOMINATOR = 1_000n\nconst DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR = 1_300n\nconst DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR = 1_000n\n// Leave the mandatory 12.5% replacement headroom for a final 3 gwei replacement.\nconst MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS =\n (MAX_VAULT_PRIORITY_FEE_PER_GAS * REPLACEMENT_FEE_BUMP_DENOMINATOR) /\n REPLACEMENT_FEE_BUMP_NUMERATOR\nconst GAS_ESTIMATE_BUFFER_NUMERATOR = 3n\nconst GAS_ESTIMATE_BUFFER_DENOMINATOR = 2n\n\nexport type VaultTransactionFeeQuote = {\n currentBaseFeePerGas?: bigint\n maxFeePerGas: bigint\n maxPriorityFeePerGas: bigint\n minimumMaxFeePerGas: bigint\n minimumPriorityFeePerGas?: bigint\n source: 'fee_history' | 'viem_fallback' | 'rpc_priority_fee' | 'fee_history_p25'\n}\n\nexport type VaultDeltaHedgeFeeQuote = VaultTransactionFeeQuote & {\n rawPriorityFeePerGas: bigint\n}\n\nexport type VaultSignedTransactionFeeCaps = {\n chainId?: number\n gasLimit?: bigint | null\n maxFeePerGas: bigint | null\n maxPriorityFeePerGas: bigint | null\n}\n\nexport type VaultSignedTransactionFeeValidationResult =\n | { valid: true }\n | {\n valid: false\n code:\n | 'MissingEip1559Fees'\n | 'InvalidFeeCaps'\n | 'PriorityFeeTooLow'\n | 'PriorityFeeTooHigh'\n | 'MaxFeeTooLow'\n | 'GasCostTooHigh'\n reason: string\n }\n\nexport class VaultTransactionFeeEstimationError extends Error {\n readonly feeHistoryError: unknown\n readonly fallbackError: unknown\n\n constructor({\n feeHistoryError,\n fallbackError,\n }: {\n feeHistoryError: unknown\n fallbackError: unknown\n }) {\n super('Unable to estimate EIP-1559 fees for vault transaction')\n this.name = 'VaultTransactionFeeEstimationError'\n this.feeHistoryError = feeHistoryError\n this.fallbackError = fallbackError\n }\n}\n\nexport class VaultTransactionGasCostLimitError extends Error {\n readonly gasLimit: bigint\n readonly maximumAffordableFeePerGas: bigint\n readonly minimumRequiredFeePerGas: bigint\n\n constructor({\n gasLimit,\n maximumAffordableFeePerGas,\n minimumRequiredFeePerGas,\n }: {\n gasLimit: bigint\n maximumAffordableFeePerGas: bigint\n minimumRequiredFeePerGas: bigint\n }) {\n super(\n `Vault transaction cannot fit the ${MAX_VAULT_TRANSACTION_GAS_COST.toString()} wei gas-cost limit: ` +\n `gasLimit=${gasLimit.toString()}, maximumAffordableFeePerGas=${maximumAffordableFeePerGas.toString()}, ` +\n `minimumRequiredFeePerGas=${minimumRequiredFeePerGas.toString()}`,\n )\n this.name = 'VaultTransactionGasCostLimitError'\n this.gasLimit = gasLimit\n this.maximumAffordableFeePerGas = maximumAffordableFeePerGas\n this.minimumRequiredFeePerGas = minimumRequiredFeePerGas\n }\n}\n\nexport class VaultTransactionReplacementLimitError extends Error {\n readonly code: 'GasCostCapExceeded' | 'PriorityFeeCapExceeded'\n readonly requiredMaxFeePerGas: bigint\n readonly requiredMaxPriorityFeePerGas: bigint\n readonly maximumAffordableFeePerGas: bigint\n\n constructor({\n code,\n gasLimit,\n requiredMaxFeePerGas,\n requiredMaxPriorityFeePerGas,\n maximumAffordableFeePerGas,\n }: {\n code: 'GasCostCapExceeded' | 'PriorityFeeCapExceeded'\n gasLimit: bigint\n requiredMaxFeePerGas: bigint\n requiredMaxPriorityFeePerGas: bigint\n maximumAffordableFeePerGas: bigint\n }) {\n super(\n `Vault transaction replacement blocked by ${code}: gasLimit=${gasLimit.toString()}, ` +\n `requiredMaxFeePerGas=${requiredMaxFeePerGas.toString()}, ` +\n `requiredMaxPriorityFeePerGas=${requiredMaxPriorityFeePerGas.toString()}, ` +\n `maximumAffordableFeePerGas=${maximumAffordableFeePerGas.toString()}`,\n )\n this.name = 'VaultTransactionReplacementLimitError'\n this.code = code\n this.requiredMaxFeePerGas = requiredMaxFeePerGas\n this.requiredMaxPriorityFeePerGas = requiredMaxPriorityFeePerGas\n this.maximumAffordableFeePerGas = maximumAffordableFeePerGas\n }\n}\n\ntype FeeHistorySnapshot = {\n baseFeePerGas: readonly bigint[]\n reward?: readonly (readonly bigint[])[] | undefined\n minimumPriorityFeePerGas?: bigint\n}\n\ntype FallbackFeeEstimate = {\n maxFeePerGas: bigint\n maxPriorityFeePerGas: bigint\n}\n\nfunction ceilMultiplyFraction(value: bigint, numerator: bigint, denominator: bigint): bigint {\n return (value * numerator + denominator - 1n) / denominator\n}\n\nfunction medianBigInt(values: readonly bigint[]): bigint | undefined {\n if (values.length === 0) return undefined\n const sorted = [...values].sort((left, right) => (left < right ? -1 : left > right ? 1 : 0))\n const upperMiddleIndex = Math.floor(sorted.length / 2)\n const upperMiddle = sorted[upperMiddleIndex]\n if (upperMiddle === undefined) return undefined\n if (sorted.length % 2 === 1) return upperMiddle\n const lowerMiddle = sorted[upperMiddleIndex - 1]\n return lowerMiddle === undefined ? undefined : (lowerMiddle + upperMiddle) / 2n\n}\n\nfunction getChainPriorityFeeFloor(chainId: number | undefined): bigint | undefined {\n return chainId === ROBINHOOD_CHAIN_ID ? 0n : undefined\n}\n\nfunction clampPriorityFee(\n priorityFee: bigint,\n minimumPriorityFeePerGas = MIN_VAULT_PRIORITY_FEE_PER_GAS,\n): bigint {\n if (priorityFee < minimumPriorityFeePerGas) return minimumPriorityFeePerGas\n if (priorityFee > MAX_VAULT_PRIORITY_FEE_PER_GAS) return MAX_VAULT_PRIORITY_FEE_PER_GAS\n return priorityFee\n}\n\nfunction resolveFeeHistoryQuote({\n baseFeePerGas,\n reward,\n minimumPriorityFeePerGas,\n}: {\n baseFeePerGas: readonly bigint[]\n reward?: readonly (readonly bigint[])[] | undefined\n minimumPriorityFeePerGas?: bigint\n}): VaultTransactionFeeQuote | null {\n // feeHistory includes one additional base fee for the next block. The\n // second-to-last entry is therefore the latest mined block's base fee.\n const latestBaseFeeIndex = baseFeePerGas.length - 2\n if (latestBaseFeeIndex < 0 || reward === undefined || reward.length === 0) return null\n\n const p90Rewards = reward.flatMap((blockRewards) => {\n const p90 = blockRewards[0]\n return p90 === undefined ? [] : [p90]\n })\n const sampledPriorityFee = medianBigInt(p90Rewards)\n if (sampledPriorityFee === undefined) return null\n\n const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS\n const maxPriorityFeePerGas = clampPriorityFee(sampledPriorityFee, effectivePriorityFeeFloor)\n const bufferedBaseFee = ceilMultiplyFraction(\n baseFeePerGas[latestBaseFeeIndex],\n BASE_FEE_BUFFER_NUMERATOR,\n BASE_FEE_BUFFER_DENOMINATOR,\n )\n\n return {\n currentBaseFeePerGas: baseFeePerGas[latestBaseFeeIndex],\n maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,\n maxPriorityFeePerGas,\n minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n source: 'fee_history',\n }\n}\n\nfunction resolveDeltaHedgeFeeHistoryQuote({\n baseFeePerGas,\n reward,\n minimumPriorityFeePerGas,\n}: FeeHistorySnapshot): VaultDeltaHedgeFeeQuote | null {\n const latestBaseFeeIndex = baseFeePerGas.length - 2\n if (latestBaseFeeIndex < 0 || reward === undefined || reward.length === 0) return null\n\n const p25Rewards = reward.flatMap((blockRewards) => {\n const p25 = blockRewards[0]\n return p25 === undefined ? [] : [p25]\n })\n const rawPriorityFeePerGas = medianBigInt(p25Rewards)\n if (rawPriorityFeePerGas === undefined) return null\n\n const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS\n const maxPriorityFeePerGas = clampPriorityFee(rawPriorityFeePerGas, effectivePriorityFeeFloor)\n const bufferedBaseFee = ceilMultiplyFraction(\n baseFeePerGas[latestBaseFeeIndex],\n BASE_FEE_BUFFER_NUMERATOR,\n BASE_FEE_BUFFER_DENOMINATOR,\n )\n return {\n maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,\n maxPriorityFeePerGas,\n minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n rawPriorityFeePerGas,\n source: 'fee_history_p25',\n }\n}\n\nfunction resolveRpcPriorityFeeQuote({\n baseFeePerGas,\n rawPriorityFeePerGas,\n minimumPriorityFeePerGas,\n}: {\n baseFeePerGas: bigint\n rawPriorityFeePerGas: bigint\n minimumPriorityFeePerGas?: bigint\n}): VaultDeltaHedgeFeeQuote {\n const bufferedBaseFee = ceilMultiplyFraction(\n baseFeePerGas,\n BASE_FEE_BUFFER_NUMERATOR,\n BASE_FEE_BUFFER_DENOMINATOR,\n )\n return {\n maxFeePerGas: bufferedBaseFee + rawPriorityFeePerGas,\n maxPriorityFeePerGas: rawPriorityFeePerGas,\n minimumMaxFeePerGas: bufferedBaseFee + (minimumPriorityFeePerGas ?? rawPriorityFeePerGas),\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n rawPriorityFeePerGas,\n source: 'rpc_priority_fee',\n }\n}\n\nexport function getVaultTransactionReplacementFeeQuote({\n originalQuote,\n historicalQuote,\n gasLimit,\n finalReplacement = false,\n staleBoundsReplacement = false,\n}: {\n originalQuote: Pick<VaultTransactionFeeQuote, 'maxFeePerGas' | 'maxPriorityFeePerGas'>\n historicalQuote: VaultDeltaHedgeFeeQuote\n gasLimit: bigint\n finalReplacement?: boolean\n staleBoundsReplacement?: boolean\n}): VaultDeltaHedgeFeeQuote {\n if (gasLimit <= 0n) {\n throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`)\n }\n\n const bumpedPriorityFee = staleBoundsReplacement\n ? ceilMultiplyFraction(\n originalQuote.maxPriorityFeePerGas,\n REPLACEMENT_FEE_BUMP_NUMERATOR,\n REPLACEMENT_FEE_BUMP_DENOMINATOR,\n )\n : ceilMultiplyFraction(\n originalQuote.maxPriorityFeePerGas,\n DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR,\n DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR,\n )\n const bumpedMaxFee = ceilMultiplyFraction(\n originalQuote.maxFeePerGas,\n REPLACEMENT_FEE_BUMP_NUMERATOR,\n REPLACEMENT_FEE_BUMP_DENOMINATOR,\n )\n const escalatingPriorityFee =\n historicalQuote.maxPriorityFeePerGas > bumpedPriorityFee\n ? historicalQuote.maxPriorityFeePerGas\n : bumpedPriorityFee\n const priorityFeeLimit = staleBoundsReplacement\n ? MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS\n : finalReplacement\n ? MAX_VAULT_PRIORITY_FEE_PER_GAS\n : MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS\n const desiredMaxPriorityFeePerGas = finalReplacement\n ? MAX_VAULT_PRIORITY_FEE_PER_GAS\n : staleBoundsReplacement\n ? bumpedPriorityFee\n : escalatingPriorityFee\n const requiredReplacementPriorityFee = ceilMultiplyFraction(\n originalQuote.maxPriorityFeePerGas,\n REPLACEMENT_FEE_BUMP_NUMERATOR,\n REPLACEMENT_FEE_BUMP_DENOMINATOR,\n )\n const requiredMaxPriorityFeePerGas =\n desiredMaxPriorityFeePerGas < priorityFeeLimit ? desiredMaxPriorityFeePerGas : priorityFeeLimit\n if (requiredMaxPriorityFeePerGas < requiredReplacementPriorityFee) {\n throw new VaultTransactionReplacementLimitError({\n code: 'PriorityFeeCapExceeded',\n gasLimit,\n requiredMaxFeePerGas: originalQuote.maxFeePerGas,\n requiredMaxPriorityFeePerGas: requiredReplacementPriorityFee,\n maximumAffordableFeePerGas: MAX_VAULT_TRANSACTION_GAS_COST / gasLimit,\n })\n }\n const bufferedBaseFee =\n historicalQuote.minimumMaxFeePerGas -\n (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS)\n const currentMarketMaxFee = bufferedBaseFee + requiredMaxPriorityFeePerGas\n const desiredMaxFeePerGas =\n currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee\n const maximumAffordableFeePerGas = MAX_VAULT_TRANSACTION_GAS_COST / gasLimit\n\n if (\n bumpedMaxFee > maximumAffordableFeePerGas ||\n requiredMaxPriorityFeePerGas > maximumAffordableFeePerGas\n ) {\n throw new VaultTransactionReplacementLimitError({\n code: 'GasCostCapExceeded',\n gasLimit,\n requiredMaxFeePerGas: bumpedMaxFee,\n requiredMaxPriorityFeePerGas,\n maximumAffordableFeePerGas,\n })\n }\n const maxFeePerGas =\n desiredMaxFeePerGas < maximumAffordableFeePerGas\n ? desiredMaxFeePerGas\n : maximumAffordableFeePerGas\n\n return {\n ...historicalQuote,\n maxFeePerGas,\n maxPriorityFeePerGas: requiredMaxPriorityFeePerGas,\n }\n}\n\nfunction resolveFallbackQuote({\n maxFeePerGas: estimatedMaxFeePerGas,\n maxPriorityFeePerGas: estimatedPriorityFeePerGas,\n minimumPriorityFeePerGas,\n}: {\n maxFeePerGas: bigint\n maxPriorityFeePerGas: bigint\n minimumPriorityFeePerGas?: bigint\n}): VaultTransactionFeeQuote {\n const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS\n const maxPriorityFeePerGas = clampPriorityFee(\n estimatedPriorityFeePerGas,\n effectivePriorityFeeFloor,\n )\n const estimatedBaseFeeAllowance =\n estimatedMaxFeePerGas > estimatedPriorityFeePerGas\n ? estimatedMaxFeePerGas - estimatedPriorityFeePerGas\n : 0n\n\n return {\n maxFeePerGas: estimatedBaseFeeAllowance + maxPriorityFeePerGas,\n maxPriorityFeePerGas,\n minimumMaxFeePerGas: estimatedBaseFeeAllowance + effectivePriorityFeeFloor,\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n source: 'viem_fallback',\n }\n}\n\nexport function applyVaultTransactionGasCostLimit(\n quote: VaultTransactionFeeQuote,\n gasLimit: bigint,\n): VaultTransactionFeeQuote {\n if (gasLimit <= 0n) {\n throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`)\n }\n\n const maximumAffordableFeePerGas = MAX_VAULT_TRANSACTION_GAS_COST / gasLimit\n if (maximumAffordableFeePerGas < quote.minimumMaxFeePerGas) {\n throw new VaultTransactionGasCostLimitError({\n gasLimit,\n maximumAffordableFeePerGas,\n minimumRequiredFeePerGas: quote.minimumMaxFeePerGas,\n })\n }\n\n if (quote.maxFeePerGas <= maximumAffordableFeePerGas) return quote\n\n const bufferedBaseFee =\n quote.minimumMaxFeePerGas - (quote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS)\n const affordablePriorityFee = maximumAffordableFeePerGas - bufferedBaseFee\n return {\n ...quote,\n maxFeePerGas: maximumAffordableFeePerGas,\n maxPriorityFeePerGas:\n quote.maxPriorityFeePerGas < affordablePriorityFee\n ? quote.maxPriorityFeePerGas\n : affordablePriorityFee,\n }\n}\n\nexport function bufferVaultTransactionGasEstimate(gasEstimate: bigint): bigint {\n if (gasEstimate <= 0n) {\n throw new Error(\n `Vault transaction gas estimate must be positive, received ${gasEstimate.toString()}`,\n )\n }\n return ceilMultiplyFraction(\n gasEstimate,\n GAS_ESTIMATE_BUFFER_NUMERATOR,\n GAS_ESTIMATE_BUFFER_DENOMINATOR,\n )\n}\n\nexport function validateVaultSignedTransactionFeeCaps(\n feeCaps: VaultSignedTransactionFeeCaps,\n quote?: VaultTransactionFeeQuote,\n): VaultSignedTransactionFeeValidationResult {\n const { chainId, gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps\n const minimumPriorityFeePerGas =\n quote?.minimumPriorityFeePerGas ??\n getChainPriorityFeeFloor(chainId) ??\n MIN_VAULT_PRIORITY_FEE_PER_GAS\n if (maxFeePerGas === null || maxPriorityFeePerGas === null) {\n return {\n valid: false,\n code: 'MissingEip1559Fees',\n reason: 'Signed transaction must include EIP-1559 max fee and priority fee caps.',\n }\n }\n if (maxPriorityFeePerGas > maxFeePerGas) {\n return {\n valid: false,\n code: 'InvalidFeeCaps',\n reason:\n `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) ` +\n `cannot exceed maxFeePerGas (${maxFeePerGas.toString()} wei).`,\n }\n }\n if (maxPriorityFeePerGas < minimumPriorityFeePerGas) {\n return {\n valid: false,\n code: 'PriorityFeeTooLow',\n reason:\n `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) ` +\n `must be at least ${minimumPriorityFeePerGas.toString()} wei.`,\n }\n }\n if (maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) {\n return {\n valid: false,\n code: 'PriorityFeeTooHigh',\n reason:\n `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) ` +\n `must not exceed ${MAX_VAULT_PRIORITY_FEE_PER_GAS.toString()} wei (3 gwei).`,\n }\n }\n if (\n gasLimit !== undefined &&\n gasLimit !== null &&\n gasLimit * maxFeePerGas > MAX_VAULT_TRANSACTION_GAS_COST\n ) {\n return {\n valid: false,\n code: 'GasCostTooHigh',\n reason:\n `Signed transaction maximum gas cost (${(gasLimit * maxFeePerGas).toString()} wei) ` +\n `must not exceed ${MAX_VAULT_TRANSACTION_GAS_COST.toString()} wei (0.015 ETH).`,\n }\n }\n if (quote !== undefined) {\n const feeRequirementDescription =\n quote.currentBaseFeePerGas === undefined ? 'buffered next-block base fee' : 'current base fee'\n const minimumBroadcastMaxFeePerGas =\n quote.currentBaseFeePerGas === undefined\n ? quote.minimumMaxFeePerGas\n : quote.currentBaseFeePerGas + minimumPriorityFeePerGas\n if (maxFeePerGas < minimumBroadcastMaxFeePerGas) {\n return {\n valid: false,\n code: 'MaxFeeTooLow',\n reason:\n `Signed transaction maxFeePerGas (${maxFeePerGas.toString()} wei) must be at least ` +\n `${minimumBroadcastMaxFeePerGas.toString()} wei for the ${feeRequirementDescription} ` +\n 'and configured minimum priority fee.',\n }\n }\n }\n return { valid: true }\n}\n\nasync function resolveVaultTransactionFeeQuote({\n readFeeHistory,\n readFallbackEstimate,\n minimumPriorityFeePerGas,\n}: {\n readFeeHistory: () => Promise<FeeHistorySnapshot>\n readFallbackEstimate: () => Promise<FallbackFeeEstimate>\n minimumPriorityFeePerGas?: bigint\n}): Promise<VaultTransactionFeeQuote> {\n let feeHistoryError: unknown\n try {\n const quote = resolveFeeHistoryQuote({\n ...(await readFeeHistory()),\n minimumPriorityFeePerGas,\n })\n if (quote !== null) return quote\n feeHistoryError = new Error('eth_feeHistory returned incomplete base fee or reward data')\n } catch (error) {\n feeHistoryError = error\n }\n\n try {\n return resolveFallbackQuote({\n ...(await readFallbackEstimate()),\n minimumPriorityFeePerGas,\n })\n } catch (fallbackError) {\n throw new VaultTransactionFeeEstimationError({ feeHistoryError, fallbackError })\n }\n}\n\n/**\n * Resolve explicit EIP-1559 fees for operator-controlled vault transactions.\n *\n * The normal path follows the median p90 priority fee from the last 20 blocks,\n * with a 3 gwei ceiling and a 0.1 gwei floor except on chains that do not use\n * tips for ordering. If fee history is unavailable, Viem's estimate is used\n * while preserving those bounds and its original base-fee allowance.\n */\nexport async function getVaultTransactionFeeQuote<chain extends Chain | undefined>(\n client: Client<Transport, chain>,\n): Promise<VaultTransactionFeeQuote> {\n return resolveVaultTransactionFeeQuote({\n minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),\n readFeeHistory: () =>\n getFeeHistory(client, {\n blockCount: FEE_HISTORY_BLOCK_COUNT,\n blockTag: 'latest',\n rewardPercentiles: FEE_HISTORY_REWARD_PERCENTILES,\n }),\n readFallbackEstimate: () => estimateFeesPerGas(client),\n })\n}\n\nexport async function getVaultDeltaHedgeHistoricalFeeQuote<chain extends Chain | undefined>(\n client: Client<Transport, chain>,\n): Promise<VaultDeltaHedgeFeeQuote> {\n const feeHistory = await getFeeHistory(client, {\n blockCount: FEE_HISTORY_BLOCK_COUNT,\n blockTag: 'latest',\n rewardPercentiles: DELTA_HEDGE_FEE_HISTORY_REWARD_PERCENTILES,\n })\n const quote = resolveDeltaHedgeFeeHistoryQuote({\n ...feeHistory,\n minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),\n })\n if (quote === null) {\n throw new Error('eth_feeHistory returned incomplete p25 base fee or reward data')\n }\n return quote\n}\n\nasync function resolveVaultDeltaHedgeInitialFeeQuote({\n readRpcQuote,\n readHistoricalQuote,\n minimumPriorityFeePerGas,\n}: {\n readRpcQuote: () => Promise<{ baseFeePerGas: bigint; rawPriorityFeePerGas: bigint }>\n readHistoricalQuote: () => Promise<VaultDeltaHedgeFeeQuote>\n minimumPriorityFeePerGas?: bigint\n}): Promise<VaultDeltaHedgeFeeQuote> {\n try {\n return resolveRpcPriorityFeeQuote({\n ...(await readRpcQuote()),\n minimumPriorityFeePerGas,\n })\n } catch {\n return readHistoricalQuote()\n }\n}\n\n/**\n * Resolve the first fee quote for a delta hedge from the connected RPC's\n * eth_maxPriorityFeePerGas recommendation. A failed RPC recommendation falls\n * back immediately to the rolling historical p25 quote.\n */\nexport async function getVaultDeltaHedgeInitialFeeQuote<chain extends Chain | undefined>(\n client: Client<Transport, chain>,\n): Promise<VaultDeltaHedgeFeeQuote> {\n return resolveVaultDeltaHedgeInitialFeeQuote({\n minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),\n readRpcQuote: async () => {\n const [rawPriorityFee, latestBlock] = await Promise.all([\n client.request({ method: 'eth_maxPriorityFeePerGas' }),\n getBlock(client, { blockTag: 'latest' }),\n ])\n if (latestBlock.baseFeePerGas === null) {\n throw new Error('Latest block does not include an EIP-1559 base fee')\n }\n return {\n baseFeePerGas: latestBlock.baseFeePerGas,\n rawPriorityFeePerGas: hexToBigInt(rawPriorityFee),\n }\n },\n readHistoricalQuote: () => getVaultDeltaHedgeHistoricalFeeQuote(client),\n })\n}\n\nexport const __transactionFeeTestUtils = {\n clampPriorityFee,\n getChainPriorityFeeFloor,\n resolveDeltaHedgeFeeHistoryQuote,\n resolveFallbackQuote,\n resolveFeeHistoryQuote,\n resolveRpcPriorityFeeQuote,\n resolveVaultDeltaHedgeInitialFeeQuote,\n resolveVaultTransactionFeeQuote,\n}\n"],"mappings":";;;;SACO;CACH,WAAW;CACX,kBAAkB;EAChB,oBAAoB;EACpB,eAAe;EACf,aAAa;CACd;CACD,aAAa;EACX,QAAQ;GACN,2BAA2B;GAC3B,WAAW;GACX,cAAc;GACd,kBAAkB;GAClB,wCAAwC;EACzC;EACD,UAAU;GACR,gBAAgB;GAChB,gBAAgB;EACjB;EACD,YAAY;GACV,uBAAuB;GACvB,uBAAuB;EACxB;EACD,kBAAkB;GAChB,uBAAuB;GACvB,uBAAuB;EACxB;CACF;CACD,YAAY;EACV,QAAQ;GACN,WAAW;GACX,gBAAgB;GAChB,sBAAsB;GACtB,sBAAsB;EACvB;EACD,mBAAmB;GACjB,iBAAiB;IACf,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;GACvB;GACD,4BAA4B;IAC1B,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;IACtB,cAAc;IACd,mBAAmB;GACpB;EACF;EACD,MAAM;GACJ,iCAAiC;GACjC,iCAAiC;GACjC,kBAAkB;GAClB,cAAc;GACd,8BAA8B;GAC9B,mCAAmC;GACnC,qBAAqB;GACrB,qBAAqB;GACrB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB,qBAAqB;EACtB;CACF;CACD,eAAe,CACb,8CACA,4CACD;CACD,WAAW,EACT,gBAAgB;EACd,aAAa;EACb,aAAa;EACb,OAAO;EACP,eAAe;EACf,UAAU;CACX,EACF;CACD,aAAa;EACX,aAAa;EACb,YAAY;CACb;CACD,YAAY;EACV,WAAW;EACX,QAAQ;EACR,eAAe;EACf,UAAU;EACV,OAAO;EACP,QAAQ;CACT;CACD,yBAAyB;EACvB;EACA;EACA;EACA;CACD;AACF;YACO;CACN,WAAW;CACX,kBAAkB;EAChB,oBAAoB;EACpB,eAAe;EACf,aAAa;CACd;CACD,aAAa;EACX,QAAQ;GACN,2BAA2B;GAC3B,WAAW;GACX,cAAc;GACd,kBAAkB;GAClB,wCAAwC;EACzC;EACD,UAAU;GACR,gBAAgB;GAChB,gBAAgB;GAChB,gBAAgB;EACjB;EACD,YAAY;GACV,uBAAuB;GACvB,uBAAuB;GACvB,uBAAuB;EACxB;EACD,kBAAkB;GAChB,uBAAuB;GACvB,uBAAuB;GACvB,uBAAuB;EACxB;CACF;CACD,YAAY;EACV,QAAQ;GACN,WAAW;GACX,gBAAgB;GAChB,sBAAsB;GACtB,sBAAsB;EACvB;EACD,mBAAmB;GACjB,kBAAkB;IAChB,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;GACvB;GACD,iBAAiB;IACf,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;GACvB;GACD,4BAA4B;IAC1B,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;IACtB,cAAc;IACd,mBAAmB;GACpB;EACF;EACD,MAAM;GACJ,iCAAiC;GACjC,iCAAiC;GACjC,kBAAkB;GAClB,cAAc;GACd,8BAA8B;GAC9B,mCAAmC;GACnC,qBAAqB;GACrB,qBAAqB;GACrB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB,qBAAqB;EACtB;CACF;CACD,eAAe,CACb,8CACA,4CACD;CACD,WAAW;EACT,WAAW;GACT,aAAa;GACb,aAAa;GACb,OAAO;GACP,eAAe;GACf,UAAU;EACX;EACD,gBAAgB;GACd,aAAa;GACb,aAAa;GACb,OAAO;GACP,eAAe;GACf,UAAU;EACX;EACD,eAAe;GACb,aAAa;GACb,aAAa;GACb,OAAO;GACP,eAAe;GACf,UAAU;EACX;CACF;CACD,aAAa;EACX,aAAa;EACb,YAAY;CACb;CACD,yBAAyB;EACvB;EACA;EACA;EACA;CACD;AACF;YACO;CACN,WAAW;CACX,kBAAkB;EAChB,oBAAoB;EACpB,eAAe;EACf,aAAa;CACd;CACD,aAAa;EACX,QAAQ;GACN,2BAA2B;GAC3B,WAAW;GACX,cAAc;GACd,kBAAkB;GAClB,wCAAwC;EACzC;EACD,UAAU;GACR,gBAAgB;GAChB,gBAAgB;EACjB;EACD,YAAY;GACV,uBAAuB;GACvB,uBAAuB;EACxB;EACD,kBAAkB;GAChB,uBAAuB;GACvB,uBAAuB;EACxB;CACF;CACD,YAAY;EACV,QAAQ;GACN,WAAW;GACX,gBAAgB;GAChB,sBAAsB;GACtB,sBAAsB;EACvB;EACD,MAAM;GACJ,iCAAiC;GACjC,iCAAiC;GACjC,kBAAkB;GAClB,cAAc;GACd,8BAA8B;GAC9B,mCAAmC;GACnC,qBAAqB;GACrB,qBAAqB;GACrB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB,qBAAqB;EACtB;CACF;CACD,eAAe,CACb,4CACD;CACD,WAAW,EACT,eAAe;EACb,aAAa;EACb,aAAa;EACb,OAAO;EACP,eAAe;EACf,UAAU;CACX,EACF;CACD,aAAa;EACX,aAAa;EACb,YAAY;CACb;AACF;gBACW;CACV,WAAW;CACX,kBAAkB;EAChB,oBAAoB;EACpB,eAAe;EACf,aAAa;CACd;CACD,aAAa;EACX,QAAQ;GACN,2BAA2B;GAC3B,WAAW;GACX,cAAc;GACd,kBAAkB;GAClB,wCAAwC;EACzC;EACD,UAAU;GACR,gBAAgB;GAChB,gBAAgB;EACjB;EACD,YAAY;GACV,uBAAuB;GACvB,uBAAuB;EACxB;EACD,kBAAkB;GAChB,uBAAuB;GACvB,uBAAuB;EACxB;CACF;CACD,YAAY;EACV,QAAQ;GACN,WAAW;GACX,gBAAgB;GAChB,sBAAsB;GACtB,sBAAsB;EACvB;EACD,MAA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Q,IAAI,CACtD,OAAO,QAAQ,EAAE,QAAQ,2BAA4B,EAAC,EACtD,SAAS,QAAQ,EAAE,UAAU,SAAU,EAAC,AACzC,EAAC;AACF,OAAI,YAAY,kBAAkB,KAChC,OAAM,IAAI,MAAM;AAElB,UAAO;IACL,eAAe,YAAY;IAC3B,sBAAsB,YAAY,eAAe;GAClD;EACF;EACD,qBAAqB,MAAM,qCAAqC,OAAO;CACxE,EAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"vault-transaction-fees.js","names":["chainDeploymentsData","feePolicy?: VaultTransactionFeePolicy","value: bigint","numerator: bigint","denominator: bigint","values: readonly bigint[]","chainId: number | undefined","priorityFee: bigint","quote: VaultTransactionFeeQuote","gasLimit: bigint","gasEstimate: bigint","feeCaps: VaultSignedTransactionFeeCaps","quote?: VaultTransactionFeeQuote","feeHistoryError: unknown","client: Client<Transport, chain>"],"sources":["../../deployments/src/chainDeployments.data.json","../../deployments/src/chainDeployments.js","../../deployments/src/vaultDisplayNames.js","../src/hypoVault/transactionFees.ts"],"sourcesContent":["{\n \"1\": {\n \"chainId\": 1,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x1F98431c8aD98523631AE4a59f267346ea31F984\",\n \"poolManager\": \"0x000000000004444c5dc75cB358380D2e3dE08A90\",\n \"stateView\": \"0x7ffe42c4a5deea5b0fec41c94c136cf115597227\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xF16714665955DBd0361D997eFc50fe391D96E8D0\",\n \"factory\": \"0xd5049B2647de57141dE7F65E5124707B99A452A3\",\n \"accountant\": \"0x65aA902AE3135658587FFC36ED51B61c927114e1\",\n \"rolesAuthority\": \"0xb952D345c413Ddb7850173422bAe4968e0330598\",\n \"collateralTrackerDecoderAndSanitizer\": \"0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0xd4e2c720a760049cc4151bcf61e3a9348db9cd92\",\n \"usdcPlpVault\": \"0x236d0558f06cd60780b232d4Ec4c92d2cb7e4D18\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0xB6Fc48e658C9B1a7dbdFA51A5E153ab60BB2e04d\",\n \"usdcPlpVaultManager\": \"0x2ce65016366ef7320078e0758D58Cf1038bc7C4e\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\",\n \"usdcPlpVaultManager\": \"0x3c1c79d0cfc316Ba959194c89696a8382d7d283b\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x00000000563b70d704f4c6675a5f6ac989fbae13\",\n \"collateralTracker0\": \"0x1e46b0289B7E0F710E2Db8Ab87800dd782D624f7\",\n \"collateralTracker1\": \"0x12bF31955522BAC337D93e1bC0a39F68D8BDa216\"\n },\n \"additionalPools\": {\n \"ethUsdc5bpsV3\": {\n \"version\": \"v3\",\n \"panopticPool\": \"0x00000000009C7B687e833559e34503f64d7ed7c4\",\n \"collateralTracker0\": \"0x3CCdA7d5E841d6543D90BcEc20b36a724C184DE9\",\n \"collateralTracker1\": \"0x69E9f9e44E5F52237493b980dd7306198C64A4E4\"\n },\n \"ethUsdc5bpsV3Replacement\": {\n \"version\": \"v3\",\n \"panopticPool\": \"0x00000000000E98f6c5aE16835bAdF2f7cC0d49D7\",\n \"collateralTracker0\": \"0x3E24E4Ab1e097F35C910eb9242a8C1530ee9C482\",\n \"collateralTracker1\": \"0xE1e01ac7E6b2671b82Aea4Db812a5c444523a039\",\n \"riskEngine\": \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"deploymentBlock\": \"26173664\"\n }\n },\n \"v2\": {\n \"semiFungiblePositionManagerV4\": \"0x00000000000005C3287f136Ef5AF56c68Ea6849f\",\n \"semiFungiblePositionManagerV3\": \"0x00000000000005E4693aDc8Ec0f12D686f728198\",\n \"builderFactory\": \"0x0000000000000a3D22E158417AA639D7F71b0FF7\",\n \"riskEngine\": \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"panopticPoolImplementation\": \"0x000000000000135429F0DaCaB61639Bf6a63EbbC\",\n \"collateralTrackerImplementation\": \"0x0000000000001d9c38CA405A2e04420865A08A33\",\n \"panopticFactoryV4\": \"0x0000000000000c51d0f8cf4bd9adE7191372a625\",\n \"panopticFactoryV3\": \"0x0000000000000aDC9A108591e718F2aee963a2a7\",\n \"panopticHelper\": \"0x0000000000000000000000000000000000000000\",\n \"panopticMath\": \"0x000000000000334bbd65C195581cf59ECf315932\",\n \"panopticQuery\": \"0x0000000000000e1aE9c66C1c3B0A547D23389C93\",\n \"interactionHelper\": \"0x00000000000041fe14Ce3c2392337CE501aE8328\"\n }\n },\n \"riskEngines\": [\n \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\"\n ],\n \"markets\": {\n \"ethUsdc30bps\": {\n \"currency0\": \"0x0000000000000000000000000000000000000000\",\n \"currency1\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"fee\": 3000,\n \"tickSpacing\": 60,\n \"poolId\": \"0x3C08AE4977F78D\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-mainnet/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-mainnet/v2_prod/gn\"\n },\n \"sfpmSwap\": {\n \"version\": \"v3\",\n \"sfpm\": \"0x00000000000005E4693aDc8Ec0f12D686f728198\",\n \"poolAddress\": \"0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640\",\n \"poolId\": \"2824133844976349\",\n \"fee\": 500,\n \"weth\": \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\"\n },\n \"deprecatedRiskEngines\": [\n \"0x0000000000000e673aECBDB5f5fE5DFAf4a8e9Ac\",\n \"0x0000000000000E65545005B26207D7edFd031260\",\n \"0x000000000000075e29cdaa9cb640a69e148ca7da\",\n \"0x0000000000000fe1e261f66ce2f44def4f5ae0cb\"\n ]\n },\n \"4663\": {\n \"chainId\": 4663,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x1f7d7550b1b028f7571e69a784071f0205fd2efa\",\n \"poolManager\": \"0x8366a39cc670b4001a1121b8f6a443a643e40951\",\n \"stateView\": \"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xF16714665955DBd0361D997eFc50fe391D96E8D0\",\n \"factory\": \"0xd5049B2647de57141dE7F65E5124707B99A452A3\",\n \"accountant\": \"0x9e345d862c41010F87D8E5A279e8D320D2831D36\",\n \"rolesAuthority\": \"0xb952D345c413Ddb7850173422bAe4968e0330598\",\n \"collateralTrackerDecoderAndSanitizer\": \"0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0x0000000000000000000000000000000000000000\",\n \"usdcPlpVault\": \"0x0000000000000000000000000000000000000000\",\n \"usdgPlpVault\": \"0x08B24123252Bd9c4DD473b6573D4cF67196FFC4B\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdcPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdgPlpVaultManager\": \"0x67Edb096585efe88a9A1ee16c5857AB74Fc8EA87\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdcPlpVaultManager\": \"0x0000000000000000000000000000000000000000\",\n \"usdgPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x000000000c21b38c54AcA7c7145Df01ff09d69Bb\",\n \"collateralTracker0\": \"0xDc508622CD7e3850c8240e88c10361Cf493465b6\",\n \"collateralTracker1\": \"0x9212d804953bAf89C24ceFa6545aA293bA08a876\"\n },\n \"additionalPools\": {\n \"spyUsdg30bpsV4\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x00000000989bcb6f24af4a1Ab2A6d6a31c98A58E\",\n \"collateralTracker0\": \"0x49eaAC32A7CD4B8fB2209a12859a95E0b20aB0e5\",\n \"collateralTracker1\": \"0x670C44a0FC35dbC410498e47A6290a1C3196d191\"\n },\n \"spyUsdg5bpsV4\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x000000000c21b38c54AcA7c7145Df01ff09d69Bb\",\n \"collateralTracker0\": \"0xDc508622CD7e3850c8240e88c10361Cf493465b6\",\n \"collateralTracker1\": \"0x9212d804953bAf89C24ceFa6545aA293bA08a876\"\n },\n \"spyUsdg5bpsV4Replacement\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x000000000056475506823b2BedBD89f55232DA40\",\n \"collateralTracker0\": \"0xAd345C2088BF0B6140aa78ABB7fE8336e328686a\",\n \"collateralTracker1\": \"0xC9c3802aF99A6E9B9c3E7F5F8c5093e048Fac1Ca\",\n \"riskEngine\": \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\",\n \"deploymentBlock\": \"86379946\"\n }\n },\n \"v2\": {\n \"semiFungiblePositionManagerV4\": \"0x00000000000005C3287f136Ef5AF56c68Ea6849f\",\n \"semiFungiblePositionManagerV3\": \"0x00000000000005E4693aDc8Ec0f12D686f728198\",\n \"builderFactory\": \"0x0000000000000a3D22E158417AA639D7F71b0FF7\",\n \"riskEngine\": \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\",\n \"panopticPoolImplementation\": \"0x000000000000135429F0DaCaB61639Bf6a63EbbC\",\n \"collateralTrackerImplementation\": \"0x0000000000001d9c38CA405A2e04420865A08A33\",\n \"panopticFactoryV4\": \"0x0000000000000c51d0f8cf4bd9adE7191372a625\",\n \"panopticFactoryV3\": \"0x0000000000000aDC9A108591e718F2aee963a2a7\",\n \"panopticHelper\": \"0x0000000000000000000000000000000000000000\",\n \"panopticMath\": \"0x000000000000334bbd65C195581cf59ECf315932\",\n \"panopticQuery\": \"0x0000000000000e1aE9c66C1c3B0A547D23389C93\",\n \"interactionHelper\": \"0x00000000000041fe14Ce3c2392337CE501aE8328\"\n }\n },\n \"riskEngines\": [\n \"0x000000000000ffE5eFdB5AE76b9200263C58b4c0\",\n \"0x000000000000FfADa7c641E2aD6B13b51b50Cc94\"\n ],\n \"markets\": {\n \"spyUsdg\": {\n \"currency0\": \"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C\",\n \"currency1\": \"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168\",\n \"fee\": 500,\n \"tickSpacing\": 5,\n \"poolId\": \"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907\"\n },\n \"spyUsdg30bps\": {\n \"currency0\": \"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C\",\n \"currency1\": \"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168\",\n \"fee\": 3000,\n \"tickSpacing\": 60,\n \"poolId\": \"0xfe2a80bb5618fd14984b92ca6d45bf5ba67443ddb1435e28b2e48df2fc1526cd\"\n },\n \"spyUsdg5bps\": {\n \"currency0\": \"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C\",\n \"currency1\": \"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168\",\n \"fee\": 500,\n \"tickSpacing\": 5,\n \"poolId\": \"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-robinhood/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-robinhood/v2_prod/gn\"\n },\n \"deprecatedRiskEngines\": [\n \"0x0000000000000E65545005B26207D7edFd031260\",\n \"0x000000000000075e29cdaa9cb640a69e148ca7da\",\n \"0x0000000000000fe1e261f66ce2f44def4f5ae0cb\",\n \"0x0000000000000f3fb82469581A74776178E76Ca4\"\n ]\n },\n \"8453\": {\n \"chainId\": 8453,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x33128a8fC17869897dcE68Ed026d694621f6FDfD\",\n \"poolManager\": \"0x498581fF718922c3f8e6A244956aF099B2652b2b\",\n \"stateView\": \"0xA3c0c9b65baD0b08107Aa264b0f3dB444b867A71\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xec311aE06486ad44Ba782133b502A34aCE0f479E\",\n \"factory\": \"0x9bE53b169a41030f1710A9B82e9eA6413f14D12E\",\n \"accountant\": \"0x345cA3407942f9d175c9eA8B90e83A36F570f852\",\n \"rolesAuthority\": \"0x278D37CaBFFB4B72D2866E30fEFE08aef773E0B6\",\n \"collateralTrackerDecoderAndSanitizer\": \"0x4A290b3EC46cF320421Bb2aaee96d445de31CF0b\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0x41b7D0515d709A4Fd2CF27f9d141D0c2F8713D04\",\n \"usdcPlpVault\": \"0xb452af299c565D04B05E601efF2840e000C922f1\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0x2a4923456c79E9ebD10F5Bf5305a5C742bBc1D7C\",\n \"usdcPlpVaultManager\": \"0xdd6E2406a044582463CFE9F0C774870eAf4A310B\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\",\n \"usdcPlpVaultManager\": \"0x3c1c79d0cfc316Ba959194c89696a8382d7d283b\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0xB50e8bb68f5855DA742f4579274902a20454174a\",\n \"collateralTracker0\": \"0x0d82b189c96EbB1f44A7207e6A9cfB1e490f2869\",\n \"collateralTracker1\": \"0x9ba1082Ab3cb9edEA988697A14BBe543A3dABEd2\"\n },\n \"v2\": {\n \"semiFungiblePositionManagerV4\": \"0x8dcAa08cF298F8b4830FAf56d47930981AdE33af\",\n \"semiFungiblePositionManagerV3\": \"0xFB1c06B491305d618bb8a7a368C6e50c001C153A\",\n \"builderFactory\": \"0x6d26E916a18d522f7DdA2a26d9E1645564ccDcA5\",\n \"riskEngine\": \"0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481\",\n \"panopticPoolImplementation\": \"0x5BA68a018fF149c38ec52D181Dd24aBabE9a07DB\",\n \"collateralTrackerImplementation\": \"0x34B3a4e4F14f292575ECe3EF67886C4598af459f\",\n \"panopticFactoryV4\": \"0x9ac0317fcd124aff0b5429beb8de17020bc45f9a\",\n \"panopticFactoryV3\": \"0x687f616d68c483a7223e6922f59aef7452e26c1d\",\n \"panopticHelper\": \"0x0000000000000000000000000000000000000000\",\n \"panopticMath\": \"0x6d21699192f5aF112C87e53b32ff846782afF407\",\n \"panopticQuery\": \"0xd2586E1bbdd1169F597F3A370117EdF7372A7350\",\n \"interactionHelper\": \"0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15\"\n }\n },\n \"riskEngines\": [\n \"0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481\"\n ],\n \"markets\": {\n \"ethUsdc5bps\": {\n \"currency0\": \"0x0000000000000000000000000000000000000000\",\n \"currency1\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"fee\": 500,\n \"tickSpacing\": 10,\n \"poolId\": \"0x96d4b53a38337a5733179751781178a2613306063c511b78cd02684739288c0a\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-base/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-base/v2_prod/gn\"\n }\n },\n \"11155111\": {\n \"chainId\": 11155111,\n \"infrastructure\": {\n \"uniswapV3Factory\": \"0x0227628f3F023bb0B980b67D528571c95c6DaC1c\",\n \"poolManager\": \"0xE03A1074c86CFeDd5C142C4F04F1a1536e203543\",\n \"stateView\": \"0xE1Dd9c3fA50EDB962E442f60DfBc432e24537E4C\"\n },\n \"hypovault\": {\n \"core\": {\n \"hypoVaultImplementation\": \"0xC5b415Db4087228Af817893769DC3a205160160B\",\n \"factory\": \"0x363a9d605ca45cBfF3b597350DeADb53cdC292c7\",\n \"accountant\": \"0x25BBef1DF262c24aa1AACD1F7eCeEcc1a7AD08ab\",\n \"rolesAuthority\": \"0x673BfafB4e2712215B422347c1571421B83E8A3d\",\n \"collateralTrackerDecoderAndSanitizer\": \"0xb899BE50BAF25BBB3A3ca3403256B3c703E5AB5d\"\n },\n \"vaults\": {\n \"wethPlpVault\": \"0xD58C4F9AEe5bBfcf28dC9a8d3D57b323fA6521b1\",\n \"usdcPlpVault\": \"0xdd7a8d6c6975488e801129bC84302d74e2361208\"\n },\n \"managers\": {\n \"wethPlpVaultManager\": \"0x95eC124FAAB70D7aE147c3BE0336E01a828AE2d5\",\n \"usdcPlpVaultManager\": \"0xFB5aa3e0b46F3859D90B14b52ffd287013b5Ec53\"\n },\n \"turnkeySigners\": {\n \"wethPlpVaultManager\": \"0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F\",\n \"usdcPlpVaultManager\": \"0x3c1c79d0cfc316Ba959194c89696a8382d7d283b\"\n }\n },\n \"panoptic\": {\n \"pool\": {\n \"version\": \"v4\",\n \"panopticPool\": \"0x872b98C46b2062F663BEb2CC9D4cE046Da2a2918\",\n \"collateralTracker0\": \"0x09a60b78d06a03e5148faedd3bfee6f58b22012f\",\n \"collateralTracker1\": \"0x7365664c8101ff7e9422ae2b203822253c31e69c\"\n },\n \"v2\": {\n \"semiFungiblePositionManagerV3\": \"0x9DaD2C40107Db4B29a5450401BB7A28e6eA00e43\",\n \"semiFungiblePositionManagerV4\": \"0xD2615995A71644E122cC2FD7FeC2392b971220DE\",\n \"builderFactory\": \"0x55f3D2d9D065AA5Fcc11D94c55a6085849e8b6C3\",\n \"riskEngine\": \"0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c\",\n \"panopticPoolImplementation\": \"0x969235B5830f13b58BB699305d9c70A8Cd3BD97C\",\n \"collateralTrackerImplementation\": \"0xafcd5F651Ae0403Ff668bb2dAc38BEa907a35Dba\",\n \"panopticFactoryV3\": \"0xd9FFCa53C0A6155001Ce8cbcAEfe89DB204690F1\",\n \"panopticFactoryV4\": \"0x8FCBb59b05779818D9BAD2686cc44B705603ce03\",\n \"panopticHelper\": \"0xfFEbB3A4ab793cB244209d4dA0Cb3e6B07133bd0\",\n \"panopticMath\": \"0x6d21699192f5aF112C87e53b32ff846782afF407\",\n \"panopticQuery\": \"0x74057945467Fb4eAE9193B46A60ae66a53f06A5b\",\n \"interactionHelper\": \"0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15\"\n }\n },\n \"riskEngines\": [\n \"0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c\"\n ],\n \"markets\": {\n \"ethUsdc5bps\": {\n \"currency0\": \"0x0000000000000000000000000000000000000000\",\n \"currency1\": \"0xFFFeD8254566B7F800f6D8CDb843ec75AE49B07A\",\n \"fee\": 500,\n \"tickSpacing\": 10,\n \"poolId\": \"0xba6673bcb27568a73a93dd23b20c8174fa16193cd90905be859144e8f13097a5\"\n }\n },\n \"subgraphs\": {\n \"hypovault\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-sepolia/prod/gn\",\n \"panoptic\": \"https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-sepolia/v2_prod/gn\"\n }\n }\n}\n","import chainDeploymentsData from './chainDeployments.data.json' with { type: 'json' }\n\nexport const MAINNET_CHAIN_ID = 1\nexport const SEPOLIA_CHAIN_ID = 11155111\nexport const BASE_CHAIN_ID = 8453\nexport const ROBINHOOD_CHAIN_ID = 4663\n\nexport const CHAIN_DEPLOYMENTS = chainDeploymentsData\n\nexport function getChainDeployment(chainId) {\n return CHAIN_DEPLOYMENTS[chainId]\n}\n\nexport function requireChainDeployment(chainId) {\n const deployment = getChainDeployment(chainId)\n if (deployment === undefined) {\n throw new Error(`Unsupported chain deployment for chainId ${chainId}`)\n }\n return deployment\n}\n\nexport function isSupportedChain(chainId) {\n return getChainDeployment(chainId) !== undefined\n}\n\nexport function getEthUsdcMarket(deployment) {\n const market = deployment.markets.ethUsdc5bps ?? deployment.markets.ethUsdc30bps\n if (market === undefined) {\n throw new Error(`Missing ETH/USDC market for chainId ${deployment.chainId}`)\n }\n return market\n}\n\nexport function getSpyUsdgMarket(deployment) {\n const market = deployment.markets.spyUsdg\n if (market === undefined) {\n throw new Error(`Missing SPY/USDG market for chainId ${deployment.chainId}`)\n }\n return market\n}\n\nfunction requireDeploymentValue(value, label) {\n if (value === undefined) {\n throw new Error(`Missing deployment value: ${label}`)\n }\n return value\n}\n\nexport const MAINNET_DEPLOYMENT = CHAIN_DEPLOYMENTS[MAINNET_CHAIN_ID]\nexport const MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES =\n MAINNET_DEPLOYMENT.panoptic.additionalPools?.ethUsdc5bpsV3\nexport const MAINNET_PANOPTIC_V2_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.v2\nexport const SEPOLIA_DEPLOYMENT = CHAIN_DEPLOYMENTS[SEPOLIA_CHAIN_ID]\nexport const SEPOLIA_HYPOVAULT_CORE_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.core\nexport const SEPOLIA_HYPOVAULT_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.vaults\nexport const SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.managers\nexport const SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = SEPOLIA_DEPLOYMENT.hypovault.turnkeySigners\nexport const SEPOLIA_PANOPTIC_POOL_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.pool\nexport const SEPOLIA_PANOPTIC_V2_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.v2\nexport const BASE_DEPLOYMENT = CHAIN_DEPLOYMENTS[BASE_CHAIN_ID]\nexport const BASE_HYPOVAULT_CORE_ADDRESSES = BASE_DEPLOYMENT.hypovault.core\nexport const BASE_HYPOVAULT_ADDRESSES = BASE_DEPLOYMENT.hypovault.vaults\nexport const BASE_HYPOVAULT_MANAGER_ADDRESSES = BASE_DEPLOYMENT.hypovault.managers\nexport const BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = BASE_DEPLOYMENT.hypovault.turnkeySigners\nexport const BASE_PANOPTIC_POOL_ADDRESSES = BASE_DEPLOYMENT.panoptic.pool\nexport const BASE_PANOPTIC_V2_ADDRESSES = BASE_DEPLOYMENT.panoptic.v2\nexport const BASE_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(BASE_DEPLOYMENT)\nexport const SEPOLIA_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(SEPOLIA_DEPLOYMENT)\n\nexport const MAINNET_RISK_ENGINES = MAINNET_DEPLOYMENT.riskEngines\nexport const BASE_RISK_ENGINES = BASE_DEPLOYMENT.riskEngines\nexport const SEPOLIA_RISK_ENGINES = SEPOLIA_DEPLOYMENT.riskEngines\n\nexport const ROBINHOOD_DEPLOYMENT = CHAIN_DEPLOYMENTS[ROBINHOOD_CHAIN_ID]\nexport const ROBINHOOD_HYPOVAULT_CORE_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.core\nexport const ROBINHOOD_HYPOVAULT_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.vaults\nexport const ROBINHOOD_HYPOVAULT_MANAGER_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.managers\nexport const ROBINHOOD_HYPOVAULT_MANAGER_TURNKEY_SIGNERS =\n ROBINHOOD_DEPLOYMENT.hypovault.turnkeySigners\nexport const ROBINHOOD_PANOPTIC_POOL_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.pool\nexport const ROBINHOOD_SPY_USDG_30BPS_PANOPTIC_POOL_ADDRESSES = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.panoptic.additionalPools?.spyUsdg30bpsV4,\n 'Robinhood SPY/USDG 30bps Panoptic pool',\n)\nexport const ROBINHOOD_SPY_USDG_5BPS_PANOPTIC_POOL_ADDRESSES = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.panoptic.additionalPools?.spyUsdg5bpsV4,\n 'Robinhood SPY/USDG 5bps Panoptic pool',\n)\nexport const ROBINHOOD_PANOPTIC_V2_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.v2\nexport const ROBINHOOD_RISK_ENGINES = ROBINHOOD_DEPLOYMENT.riskEngines\nexport const ROBINHOOD_SPY_USDG_MARKET = getSpyUsdgMarket(ROBINHOOD_DEPLOYMENT)\nexport const ROBINHOOD_SPY_USDG_30BPS_MARKET = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.markets.spyUsdg30bps,\n 'Robinhood SPY/USDG 30bps market',\n)\nexport const ROBINHOOD_SPY_USDG_5BPS_MARKET = requireDeploymentValue(\n ROBINHOOD_DEPLOYMENT.markets.spyUsdg5bps,\n 'Robinhood SPY/USDG 5bps market',\n)\n","import {\n BASE_CHAIN_ID,\n MAINNET_CHAIN_ID,\n requireChainDeployment,\n ROBINHOOD_CHAIN_ID,\n SEPOLIA_CHAIN_ID,\n} from './chainDeployments.js'\n\nconst mainnetDeployment = requireChainDeployment(MAINNET_CHAIN_ID)\nconst mainnetVaults = mainnetDeployment.hypovault.vaults\nconst legacyMainnetVaults = {\n wethPlpVault: '0x779a2aa634A004b3a3f3b322083744869BBC6D66',\n usdcPlpVault: '0x963Fe9c93bc353602656ee4051A75114bA74d6c5',\n}\nconst sepoliaDeployment = requireChainDeployment(SEPOLIA_CHAIN_ID)\nconst sepoliaVaults = sepoliaDeployment.hypovault.vaults\nconst baseDeployment = requireChainDeployment(BASE_CHAIN_ID)\nconst baseVaults = baseDeployment.hypovault.vaults\nconst robinhoodDeployment = requireChainDeployment(ROBINHOOD_CHAIN_ID)\nconst robinhoodUsdgVault = robinhoodDeployment.hypovault.vaults.usdgPlpVault\n\nif (robinhoodUsdgVault === undefined) {\n throw new Error('Missing Robinhood USDG PLP vault address')\n}\n\nexport const VAULT_DISPLAY_NAMES_PER_CHAIN = {\n [MAINNET_CHAIN_ID]: {\n [mainnetVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [mainnetVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n [legacyMainnetVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [legacyMainnetVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n },\n [BASE_CHAIN_ID]: {\n [baseVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [baseVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n },\n [SEPOLIA_CHAIN_ID]: {\n [sepoliaVaults.wethPlpVault.toLowerCase()]: 'ETH Yield Vault',\n [sepoliaVaults.usdcPlpVault.toLowerCase()]: 'volUSDC Vault',\n },\n [ROBINHOOD_CHAIN_ID]: {\n [robinhoodUsdgVault.toLowerCase()]: '0DTE +67∆ Covered Call Vault',\n },\n}\n\nexport const VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN = {\n [MAINNET_CHAIN_ID]: {\n [mainnetVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [mainnetVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n [legacyMainnetVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [legacyMainnetVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n },\n [BASE_CHAIN_ID]: {\n [baseVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [baseVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n },\n [SEPOLIA_CHAIN_ID]: {\n [sepoliaVaults.wethPlpVault.toLowerCase()]: () => 'ETH Yield Vault',\n [sepoliaVaults.usdcPlpVault.toLowerCase()]: () => 'volUSDC Vault',\n },\n [ROBINHOOD_CHAIN_ID]: {\n [robinhoodUsdgVault.toLowerCase()]: () => '0DTE +67∆ Covered Call Vault',\n },\n}\n\nexport function resolveVaultDisplayName({ chainId, vaultAddress, underlyingSymbol, fallbackName }) {\n const vaultAddressLower = vaultAddress.toLowerCase()\n const resolver = VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN[chainId]?.[vaultAddressLower]\n if (resolver !== undefined) {\n return resolver({\n chainId,\n vaultAddress: vaultAddressLower,\n underlyingSymbol,\n fallbackName,\n })\n }\n\n const staticName = VAULT_DISPLAY_NAMES_PER_CHAIN[chainId]?.[vaultAddressLower]\n if (staticName !== undefined) {\n return staticName\n }\n\n if (fallbackName !== undefined && fallbackName !== null) {\n return fallbackName\n }\n\n return 'Vault'\n}\n","import type { Chain, Client, Transport } from 'viem'\nimport { hexToBigInt } from 'viem'\nimport { estimateFeesPerGas, getBlock, getFeeHistory } from 'viem/actions'\n\nimport { ROBINHOOD_CHAIN_ID } from './chainDeployments'\n\nexport const MIN_VAULT_PRIORITY_FEE_PER_GAS = 100_000_000n // 0.1 gwei\nexport const MAX_VAULT_PRIORITY_FEE_PER_GAS = 3_000_000_000n // 3 gwei\nexport const MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS = 8_000_000_000n // 8 gwei\nexport const MAX_VAULT_TRANSACTION_GAS_COST = 15_000_000_000_000_000n // 0.015 ETH\n\nconst FEE_HISTORY_BLOCK_COUNT = 20\nconst FEE_HISTORY_REWARD_PERCENTILES = [90]\nconst DELTA_HEDGE_FEE_HISTORY_REWARD_PERCENTILES = [25]\nconst BASE_FEE_BUFFER_NUMERATOR = 1_125n\nconst BASE_FEE_BUFFER_DENOMINATOR = 1_000n\nexport const REPLACEMENT_FEE_BUMP_NUMERATOR = 1_125n\nexport const REPLACEMENT_FEE_BUMP_DENOMINATOR = 1_000n\nconst DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR = 1_300n\nconst DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR = 1_000n\n// Leave the mandatory 12.5% replacement headroom for a final 3 gwei replacement.\nconst MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS =\n (MAX_VAULT_PRIORITY_FEE_PER_GAS * REPLACEMENT_FEE_BUMP_DENOMINATOR) /\n REPLACEMENT_FEE_BUMP_NUMERATOR\nconst GAS_ESTIMATE_BUFFER_NUMERATOR = 3n\nconst GAS_ESTIMATE_BUFFER_DENOMINATOR = 2n\n\nexport type VaultTransactionFeePolicy = Readonly<{\n maxTransactionGasCost: bigint\n marketPriorityFees: boolean\n}>\n\nexport type VaultTransactionFeeQuote = {\n currentBaseFeePerGas?: bigint\n maxFeePerGas: bigint\n maxPriorityFeePerGas: bigint\n minimumMaxFeePerGas: bigint\n minimumPriorityFeePerGas?: bigint\n source:\n | 'fee_history'\n | 'viem_fallback'\n | 'rpc_priority_fee'\n | 'fee_history_p25'\n | 'adaptive_hedge'\n}\n\nexport type VaultDeltaHedgeFeeQuote = VaultTransactionFeeQuote & {\n rawPriorityFeePerGas: bigint\n competitivePriorityFeePerGas?: bigint\n}\n\nexport type VaultSignedTransactionFeeCaps = {\n chainId?: number\n gasLimit?: bigint | null\n maxFeePerGas: bigint | null\n maxPriorityFeePerGas: bigint | null\n}\n\nexport type VaultSignedTransactionFeeValidationResult =\n | { valid: true }\n | {\n valid: false\n code:\n | 'MissingEip1559Fees'\n | 'InvalidFeeCaps'\n | 'PriorityFeeTooLow'\n | 'PriorityFeeTooHigh'\n | 'MaxFeeTooLow'\n | 'GasCostTooHigh'\n reason: string\n }\n\nexport class VaultTransactionFeeEstimationError extends Error {\n readonly feeHistoryError: unknown\n readonly fallbackError: unknown\n\n constructor({\n feeHistoryError,\n fallbackError,\n }: {\n feeHistoryError: unknown\n fallbackError: unknown\n }) {\n super('Unable to estimate EIP-1559 fees for vault transaction')\n this.name = 'VaultTransactionFeeEstimationError'\n this.feeHistoryError = feeHistoryError\n this.fallbackError = fallbackError\n }\n}\n\nexport class VaultTransactionGasCostLimitError extends Error {\n readonly gasLimit: bigint\n readonly maximumAffordableFeePerGas: bigint\n readonly minimumRequiredFeePerGas: bigint\n\n constructor({\n gasLimit,\n maximumAffordableFeePerGas,\n minimumRequiredFeePerGas,\n maximumGasCost = MAX_VAULT_TRANSACTION_GAS_COST,\n }: {\n gasLimit: bigint\n maximumAffordableFeePerGas: bigint\n minimumRequiredFeePerGas: bigint\n maximumGasCost?: bigint\n }) {\n super(\n `Vault transaction cannot fit the ${maximumGasCost.toString()} wei gas-cost limit: ` +\n `gasLimit=${gasLimit.toString()}, maximumAffordableFeePerGas=${maximumAffordableFeePerGas.toString()}, ` +\n `minimumRequiredFeePerGas=${minimumRequiredFeePerGas.toString()}`,\n )\n this.name = 'VaultTransactionGasCostLimitError'\n this.gasLimit = gasLimit\n this.maximumAffordableFeePerGas = maximumAffordableFeePerGas\n this.minimumRequiredFeePerGas = minimumRequiredFeePerGas\n }\n}\n\nexport class VaultTransactionReplacementLimitError extends Error {\n readonly code: 'GasCostCapExceeded' | 'PriorityFeeCapExceeded'\n readonly requiredMaxFeePerGas: bigint\n readonly requiredMaxPriorityFeePerGas: bigint\n readonly maximumAffordableFeePerGas: bigint\n\n constructor({\n code,\n gasLimit,\n requiredMaxFeePerGas,\n requiredMaxPriorityFeePerGas,\n maximumAffordableFeePerGas,\n }: {\n code: 'GasCostCapExceeded' | 'PriorityFeeCapExceeded'\n gasLimit: bigint\n requiredMaxFeePerGas: bigint\n requiredMaxPriorityFeePerGas: bigint\n maximumAffordableFeePerGas: bigint\n }) {\n super(\n `Vault transaction replacement blocked by ${code}: gasLimit=${gasLimit.toString()}, ` +\n `requiredMaxFeePerGas=${requiredMaxFeePerGas.toString()}, ` +\n `requiredMaxPriorityFeePerGas=${requiredMaxPriorityFeePerGas.toString()}, ` +\n `maximumAffordableFeePerGas=${maximumAffordableFeePerGas.toString()}`,\n )\n this.name = 'VaultTransactionReplacementLimitError'\n this.code = code\n this.requiredMaxFeePerGas = requiredMaxFeePerGas\n this.requiredMaxPriorityFeePerGas = requiredMaxPriorityFeePerGas\n this.maximumAffordableFeePerGas = maximumAffordableFeePerGas\n }\n}\n\ntype FeeHistorySnapshot = {\n baseFeePerGas: readonly bigint[]\n reward?: readonly (readonly bigint[])[] | undefined\n minimumPriorityFeePerGas?: bigint\n}\n\ntype FallbackFeeEstimate = {\n maxFeePerGas: bigint\n maxPriorityFeePerGas: bigint\n}\n\nfunction resolveMaximumGasCost(feePolicy?: VaultTransactionFeePolicy): bigint {\n const maximum = feePolicy?.maxTransactionGasCost ?? MAX_VAULT_TRANSACTION_GAS_COST\n if (maximum <= 0n) throw new Error('Vault transaction gas budget must be positive')\n return maximum\n}\n\nfunction ceilMultiplyFraction(value: bigint, numerator: bigint, denominator: bigint): bigint {\n return (value * numerator + denominator - 1n) / denominator\n}\n\nfunction medianBigInt(values: readonly bigint[]): bigint | undefined {\n if (values.length === 0) return undefined\n const sorted = [...values].sort((left, right) => (left < right ? -1 : left > right ? 1 : 0))\n const upperMiddleIndex = Math.floor(sorted.length / 2)\n const upperMiddle = sorted[upperMiddleIndex]\n if (upperMiddle === undefined) return undefined\n if (sorted.length % 2 === 1) return upperMiddle\n const lowerMiddle = sorted[upperMiddleIndex - 1]\n return lowerMiddle === undefined ? undefined : (lowerMiddle + upperMiddle) / 2n\n}\n\nfunction getChainPriorityFeeFloor(chainId: number | undefined): bigint | undefined {\n return chainId === ROBINHOOD_CHAIN_ID ? 0n : undefined\n}\n\nfunction clampPriorityFee(\n priorityFee: bigint,\n minimumPriorityFeePerGas = MIN_VAULT_PRIORITY_FEE_PER_GAS,\n): bigint {\n if (priorityFee < minimumPriorityFeePerGas) return minimumPriorityFeePerGas\n if (priorityFee > MAX_VAULT_PRIORITY_FEE_PER_GAS) return MAX_VAULT_PRIORITY_FEE_PER_GAS\n return priorityFee\n}\n\nfunction resolveFeeHistoryQuote({\n baseFeePerGas,\n reward,\n minimumPriorityFeePerGas,\n}: {\n baseFeePerGas: readonly bigint[]\n reward?: readonly (readonly bigint[])[] | undefined\n minimumPriorityFeePerGas?: bigint\n}): VaultTransactionFeeQuote | null {\n // feeHistory includes one additional base fee for the next block. The\n // second-to-last entry is therefore the latest mined block's base fee.\n const latestBaseFeeIndex = baseFeePerGas.length - 2\n if (latestBaseFeeIndex < 0 || reward === undefined || reward.length === 0) return null\n\n const p90Rewards = reward.flatMap((blockRewards) => {\n const p90 = blockRewards[0]\n return p90 === undefined ? [] : [p90]\n })\n const sampledPriorityFee = medianBigInt(p90Rewards)\n if (sampledPriorityFee === undefined) return null\n\n const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS\n const maxPriorityFeePerGas = clampPriorityFee(sampledPriorityFee, effectivePriorityFeeFloor)\n const bufferedBaseFee = ceilMultiplyFraction(\n baseFeePerGas[latestBaseFeeIndex],\n BASE_FEE_BUFFER_NUMERATOR,\n BASE_FEE_BUFFER_DENOMINATOR,\n )\n\n return {\n currentBaseFeePerGas: baseFeePerGas[latestBaseFeeIndex],\n maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,\n maxPriorityFeePerGas,\n minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n source: 'fee_history',\n }\n}\n\nfunction resolveDeltaHedgeFeeHistoryQuote({\n baseFeePerGas,\n reward,\n minimumPriorityFeePerGas,\n}: FeeHistorySnapshot): VaultDeltaHedgeFeeQuote | null {\n const latestBaseFeeIndex = baseFeePerGas.length - 2\n if (latestBaseFeeIndex < 0 || reward === undefined || reward.length === 0) return null\n\n const p25Rewards = reward.flatMap((blockRewards) => {\n const p25 = blockRewards[0]\n return p25 === undefined ? [] : [p25]\n })\n const rawPriorityFeePerGas = medianBigInt(p25Rewards)\n if (rawPriorityFeePerGas === undefined) return null\n\n const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS\n const maxPriorityFeePerGas = clampPriorityFee(rawPriorityFeePerGas, effectivePriorityFeeFloor)\n const bufferedBaseFee = ceilMultiplyFraction(\n baseFeePerGas[latestBaseFeeIndex],\n BASE_FEE_BUFFER_NUMERATOR,\n BASE_FEE_BUFFER_DENOMINATOR,\n )\n return {\n maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,\n maxPriorityFeePerGas,\n minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n rawPriorityFeePerGas,\n source: 'fee_history_p25',\n }\n}\n\nfunction resolveRpcPriorityFeeQuote({\n baseFeePerGas,\n rawPriorityFeePerGas,\n minimumPriorityFeePerGas,\n}: {\n baseFeePerGas: bigint\n rawPriorityFeePerGas: bigint\n minimumPriorityFeePerGas?: bigint\n}): VaultDeltaHedgeFeeQuote {\n const bufferedBaseFee = ceilMultiplyFraction(\n baseFeePerGas,\n BASE_FEE_BUFFER_NUMERATOR,\n BASE_FEE_BUFFER_DENOMINATOR,\n )\n return {\n maxFeePerGas: bufferedBaseFee + rawPriorityFeePerGas,\n maxPriorityFeePerGas: rawPriorityFeePerGas,\n minimumMaxFeePerGas: bufferedBaseFee + (minimumPriorityFeePerGas ?? rawPriorityFeePerGas),\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n rawPriorityFeePerGas,\n source: 'rpc_priority_fee',\n }\n}\n\nexport function getVaultTransactionReplacementFeeQuote({\n originalQuote,\n historicalQuote,\n gasLimit,\n finalReplacement = false,\n staleBoundsReplacement = false,\n feePolicy,\n}: {\n originalQuote: Pick<VaultTransactionFeeQuote, 'maxFeePerGas' | 'maxPriorityFeePerGas'>\n historicalQuote: VaultDeltaHedgeFeeQuote\n gasLimit: bigint\n finalReplacement?: boolean\n staleBoundsReplacement?: boolean\n feePolicy?: VaultTransactionFeePolicy\n}): VaultDeltaHedgeFeeQuote {\n if (gasLimit <= 0n) {\n throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`)\n }\n\n const bumpedPriorityFee =\n staleBoundsReplacement || feePolicy?.marketPriorityFees\n ? ceilMultiplyFraction(\n originalQuote.maxPriorityFeePerGas,\n REPLACEMENT_FEE_BUMP_NUMERATOR,\n REPLACEMENT_FEE_BUMP_DENOMINATOR,\n )\n : ceilMultiplyFraction(\n originalQuote.maxPriorityFeePerGas,\n DELTA_HEDGE_PRIORITY_FEE_BUMP_NUMERATOR,\n DELTA_HEDGE_PRIORITY_FEE_BUMP_DENOMINATOR,\n )\n const bumpedMaxFee = ceilMultiplyFraction(\n originalQuote.maxFeePerGas,\n REPLACEMENT_FEE_BUMP_NUMERATOR,\n REPLACEMENT_FEE_BUMP_DENOMINATOR,\n )\n const escalatingPriorityFee =\n historicalQuote.maxPriorityFeePerGas > bumpedPriorityFee\n ? historicalQuote.maxPriorityFeePerGas\n : bumpedPriorityFee\n const maximumGasCost = resolveMaximumGasCost(feePolicy)\n const priorityFeeLimit = feePolicy?.marketPriorityFees\n ? maximumGasCost / gasLimit\n : staleBoundsReplacement\n ? MAX_STALE_DELTA_HEDGE_PRIORITY_FEE_PER_GAS\n : finalReplacement\n ? MAX_VAULT_PRIORITY_FEE_PER_GAS\n : MAX_DELTA_HEDGE_PRIORITY_FEE_PER_GAS\n const desiredMaxPriorityFeePerGas = feePolicy?.marketPriorityFees\n ? escalatingPriorityFee\n : finalReplacement\n ? MAX_VAULT_PRIORITY_FEE_PER_GAS\n : staleBoundsReplacement\n ? bumpedPriorityFee\n : escalatingPriorityFee\n const requiredReplacementPriorityFee = ceilMultiplyFraction(\n originalQuote.maxPriorityFeePerGas,\n REPLACEMENT_FEE_BUMP_NUMERATOR,\n REPLACEMENT_FEE_BUMP_DENOMINATOR,\n )\n const requiredMaxPriorityFeePerGas =\n desiredMaxPriorityFeePerGas < priorityFeeLimit ? desiredMaxPriorityFeePerGas : priorityFeeLimit\n if (requiredMaxPriorityFeePerGas < requiredReplacementPriorityFee) {\n throw new VaultTransactionReplacementLimitError({\n code: feePolicy?.marketPriorityFees ? 'GasCostCapExceeded' : 'PriorityFeeCapExceeded',\n gasLimit,\n requiredMaxFeePerGas: originalQuote.maxFeePerGas,\n requiredMaxPriorityFeePerGas: requiredReplacementPriorityFee,\n maximumAffordableFeePerGas: maximumGasCost / gasLimit,\n })\n }\n const bufferedBaseFee = feePolicy?.marketPriorityFees\n ? historicalQuote.maxFeePerGas - historicalQuote.maxPriorityFeePerGas\n : historicalQuote.minimumMaxFeePerGas -\n (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS)\n const currentMarketMaxFee = bufferedBaseFee + requiredMaxPriorityFeePerGas\n const desiredMaxFeePerGas =\n currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee\n const maximumAffordableFeePerGas = maximumGasCost / gasLimit\n const minimumMarketFeePerGas =\n (historicalQuote.currentBaseFeePerGas ?? bufferedBaseFee) + requiredMaxPriorityFeePerGas\n\n if (\n bumpedMaxFee > maximumAffordableFeePerGas ||\n requiredMaxPriorityFeePerGas > maximumAffordableFeePerGas ||\n (feePolicy?.marketPriorityFees && minimumMarketFeePerGas > maximumAffordableFeePerGas)\n ) {\n throw new VaultTransactionReplacementLimitError({\n code: 'GasCostCapExceeded',\n gasLimit,\n requiredMaxFeePerGas:\n feePolicy?.marketPriorityFees && minimumMarketFeePerGas > bumpedMaxFee\n ? minimumMarketFeePerGas\n : bumpedMaxFee,\n requiredMaxPriorityFeePerGas,\n maximumAffordableFeePerGas,\n })\n }\n const maxFeePerGas =\n desiredMaxFeePerGas < maximumAffordableFeePerGas\n ? desiredMaxFeePerGas\n : maximumAffordableFeePerGas\n\n return {\n ...historicalQuote,\n maxFeePerGas,\n maxPriorityFeePerGas: requiredMaxPriorityFeePerGas,\n }\n}\n\nfunction resolveFallbackQuote({\n maxFeePerGas: estimatedMaxFeePerGas,\n maxPriorityFeePerGas: estimatedPriorityFeePerGas,\n minimumPriorityFeePerGas,\n}: {\n maxFeePerGas: bigint\n maxPriorityFeePerGas: bigint\n minimumPriorityFeePerGas?: bigint\n}): VaultTransactionFeeQuote {\n const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS\n const maxPriorityFeePerGas = clampPriorityFee(\n estimatedPriorityFeePerGas,\n effectivePriorityFeeFloor,\n )\n const estimatedBaseFeeAllowance =\n estimatedMaxFeePerGas > estimatedPriorityFeePerGas\n ? estimatedMaxFeePerGas - estimatedPriorityFeePerGas\n : 0n\n\n return {\n maxFeePerGas: estimatedBaseFeeAllowance + maxPriorityFeePerGas,\n maxPriorityFeePerGas,\n minimumMaxFeePerGas: estimatedBaseFeeAllowance + effectivePriorityFeeFloor,\n ...(minimumPriorityFeePerGas === undefined ? {} : { minimumPriorityFeePerGas }),\n source: 'viem_fallback',\n }\n}\n\nexport function applyVaultTransactionGasCostLimit(\n quote: VaultTransactionFeeQuote,\n gasLimit: bigint,\n feePolicy?: VaultTransactionFeePolicy,\n): VaultTransactionFeeQuote {\n if (gasLimit <= 0n) {\n throw new Error(`Vault transaction gas limit must be positive, received ${gasLimit.toString()}`)\n }\n\n const maximumGasCost = resolveMaximumGasCost(feePolicy)\n const maximumAffordableFeePerGas = maximumGasCost / gasLimit\n if (maximumAffordableFeePerGas < quote.minimumMaxFeePerGas) {\n throw new VaultTransactionGasCostLimitError({\n gasLimit,\n maximumAffordableFeePerGas,\n minimumRequiredFeePerGas: quote.minimumMaxFeePerGas,\n maximumGasCost,\n })\n }\n\n if (quote.maxFeePerGas <= maximumAffordableFeePerGas) return quote\n\n const bufferedBaseFee =\n quote.minimumMaxFeePerGas - (quote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS)\n const affordablePriorityFee = maximumAffordableFeePerGas - bufferedBaseFee\n return {\n ...quote,\n maxFeePerGas: maximumAffordableFeePerGas,\n maxPriorityFeePerGas:\n quote.maxPriorityFeePerGas < affordablePriorityFee\n ? quote.maxPriorityFeePerGas\n : affordablePriorityFee,\n }\n}\n\nexport function bufferVaultTransactionGasEstimate(gasEstimate: bigint): bigint {\n if (gasEstimate <= 0n) {\n throw new Error(\n `Vault transaction gas estimate must be positive, received ${gasEstimate.toString()}`,\n )\n }\n return ceilMultiplyFraction(\n gasEstimate,\n GAS_ESTIMATE_BUFFER_NUMERATOR,\n GAS_ESTIMATE_BUFFER_DENOMINATOR,\n )\n}\n\nexport function validateVaultSignedTransactionFeeCaps(\n feeCaps: VaultSignedTransactionFeeCaps,\n quote?: VaultTransactionFeeQuote,\n feePolicy?: VaultTransactionFeePolicy,\n): VaultSignedTransactionFeeValidationResult {\n const { chainId, gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps\n const maximumGasCost = resolveMaximumGasCost(feePolicy)\n const minimumPriorityFeePerGas =\n quote?.minimumPriorityFeePerGas ??\n getChainPriorityFeeFloor(chainId) ??\n MIN_VAULT_PRIORITY_FEE_PER_GAS\n if (maxFeePerGas === null || maxPriorityFeePerGas === null) {\n return {\n valid: false,\n code: 'MissingEip1559Fees',\n reason: 'Signed transaction must include EIP-1559 max fee and priority fee caps.',\n }\n }\n if (maxPriorityFeePerGas > maxFeePerGas) {\n return {\n valid: false,\n code: 'InvalidFeeCaps',\n reason:\n `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) ` +\n `cannot exceed maxFeePerGas (${maxFeePerGas.toString()} wei).`,\n }\n }\n if (maxPriorityFeePerGas < minimumPriorityFeePerGas) {\n return {\n valid: false,\n code: 'PriorityFeeTooLow',\n reason:\n `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) ` +\n `must be at least ${minimumPriorityFeePerGas.toString()} wei.`,\n }\n }\n if (!feePolicy?.marketPriorityFees && maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) {\n return {\n valid: false,\n code: 'PriorityFeeTooHigh',\n reason:\n `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) ` +\n `must not exceed ${MAX_VAULT_PRIORITY_FEE_PER_GAS.toString()} wei (3 gwei).`,\n }\n }\n if (gasLimit !== undefined && gasLimit !== null && gasLimit * maxFeePerGas > maximumGasCost) {\n return {\n valid: false,\n code: 'GasCostTooHigh',\n reason:\n `Signed transaction maximum gas cost (${(gasLimit * maxFeePerGas).toString()} wei) ` +\n `must not exceed ${maximumGasCost.toString()} wei.`,\n }\n }\n if (quote !== undefined) {\n const feeRequirementDescription =\n quote.currentBaseFeePerGas === undefined ? 'buffered next-block base fee' : 'current base fee'\n const minimumBroadcastMaxFeePerGas =\n quote.currentBaseFeePerGas === undefined\n ? quote.minimumMaxFeePerGas\n : quote.currentBaseFeePerGas + minimumPriorityFeePerGas\n if (maxFeePerGas < minimumBroadcastMaxFeePerGas) {\n return {\n valid: false,\n code: 'MaxFeeTooLow',\n reason:\n `Signed transaction maxFeePerGas (${maxFeePerGas.toString()} wei) must be at least ` +\n `${minimumBroadcastMaxFeePerGas.toString()} wei for the ${feeRequirementDescription} ` +\n 'and configured minimum priority fee.',\n }\n }\n }\n return { valid: true }\n}\n\nasync function resolveVaultTransactionFeeQuote({\n readFeeHistory,\n readFallbackEstimate,\n minimumPriorityFeePerGas,\n}: {\n readFeeHistory: () => Promise<FeeHistorySnapshot>\n readFallbackEstimate: () => Promise<FallbackFeeEstimate>\n minimumPriorityFeePerGas?: bigint\n}): Promise<VaultTransactionFeeQuote> {\n let feeHistoryError: unknown\n try {\n const quote = resolveFeeHistoryQuote({\n ...(await readFeeHistory()),\n minimumPriorityFeePerGas,\n })\n if (quote !== null) return quote\n feeHistoryError = new Error('eth_feeHistory returned incomplete base fee or reward data')\n } catch (error) {\n feeHistoryError = error\n }\n\n try {\n return resolveFallbackQuote({\n ...(await readFallbackEstimate()),\n minimumPriorityFeePerGas,\n })\n } catch (fallbackError) {\n throw new VaultTransactionFeeEstimationError({ feeHistoryError, fallbackError })\n }\n}\n\n/**\n * Resolve explicit EIP-1559 fees for operator-controlled vault transactions.\n *\n * The normal path follows the median p90 priority fee from the last 20 blocks,\n * with a 3 gwei ceiling and a 0.1 gwei floor except on chains that do not use\n * tips for ordering. If fee history is unavailable, Viem's estimate is used\n * while preserving those bounds and its original base-fee allowance.\n */\nexport async function getVaultTransactionFeeQuote<chain extends Chain | undefined>(\n client: Client<Transport, chain>,\n): Promise<VaultTransactionFeeQuote> {\n return resolveVaultTransactionFeeQuote({\n minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),\n readFeeHistory: () =>\n getFeeHistory(client, {\n blockCount: FEE_HISTORY_BLOCK_COUNT,\n blockTag: 'latest',\n rewardPercentiles: FEE_HISTORY_REWARD_PERCENTILES,\n }),\n readFallbackEstimate: () => estimateFeesPerGas(client),\n })\n}\n\nexport async function getVaultDeltaHedgeHistoricalFeeQuote<chain extends Chain | undefined>(\n client: Client<Transport, chain>,\n): Promise<VaultDeltaHedgeFeeQuote> {\n const feeHistory = await getFeeHistory(client, {\n blockCount: FEE_HISTORY_BLOCK_COUNT,\n blockTag: 'latest',\n rewardPercentiles: DELTA_HEDGE_FEE_HISTORY_REWARD_PERCENTILES,\n })\n const quote = resolveDeltaHedgeFeeHistoryQuote({\n ...feeHistory,\n minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),\n })\n if (quote === null) {\n throw new Error('eth_feeHistory returned incomplete p25 base fee or reward data')\n }\n return quote\n}\n\nasync function resolveVaultDeltaHedgeInitialFeeQuote({\n readRpcQuote,\n readHistoricalQuote,\n minimumPriorityFeePerGas,\n}: {\n readRpcQuote: () => Promise<{ baseFeePerGas: bigint; rawPriorityFeePerGas: bigint }>\n readHistoricalQuote: () => Promise<VaultDeltaHedgeFeeQuote>\n minimumPriorityFeePerGas?: bigint\n}): Promise<VaultDeltaHedgeFeeQuote> {\n try {\n return resolveRpcPriorityFeeQuote({\n ...(await readRpcQuote()),\n minimumPriorityFeePerGas,\n })\n } catch {\n return readHistoricalQuote()\n }\n}\n\n/**\n * Resolve the first fee quote for a delta hedge from the connected RPC's\n * eth_maxPriorityFeePerGas recommendation. A failed RPC recommendation falls\n * back immediately to the rolling historical p25 quote.\n */\nexport async function getVaultDeltaHedgeInitialFeeQuote<chain extends Chain | undefined>(\n client: Client<Transport, chain>,\n): Promise<VaultDeltaHedgeFeeQuote> {\n return resolveVaultDeltaHedgeInitialFeeQuote({\n minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),\n readRpcQuote: async () => {\n const [rawPriorityFee, latestBlock] = await Promise.all([\n client.request({ method: 'eth_maxPriorityFeePerGas' }),\n getBlock(client, { blockTag: 'latest' }),\n ])\n if (latestBlock.baseFeePerGas === null) {\n throw new Error('Latest block does not include an EIP-1559 base fee')\n }\n return {\n baseFeePerGas: latestBlock.baseFeePerGas,\n rawPriorityFeePerGas: hexToBigInt(rawPriorityFee),\n }\n },\n readHistoricalQuote: () => getVaultDeltaHedgeHistoricalFeeQuote(client),\n })\n}\n\nexport const __transactionFeeTestUtils = {\n clampPriorityFee,\n getChainPriorityFeeFloor,\n resolveDeltaHedgeFeeHistoryQuote,\n resolveFallbackQuote,\n resolveFeeHistoryQuote,\n resolveRpcPriorityFeeQuote,\n resolveVaultDeltaHedgeInitialFeeQuote,\n resolveVaultTransactionFeeQuote,\n}\n"],"mappings":";;;;SACO;CACH,WAAW;CACX,kBAAkB;EAChB,oBAAoB;EACpB,eAAe;EACf,aAAa;CACd;CACD,aAAa;EACX,QAAQ;GACN,2BAA2B;GAC3B,WAAW;GACX,cAAc;GACd,kBAAkB;GAClB,wCAAwC;EACzC;EACD,UAAU;GACR,gBAAgB;GAChB,gBAAgB;EACjB;EACD,YAAY;GACV,uBAAuB;GACvB,uBAAuB;EACxB;EACD,kBAAkB;GAChB,uBAAuB;GACvB,uBAAuB;EACxB;CACF;CACD,YAAY;EACV,QAAQ;GACN,WAAW;GACX,gBAAgB;GAChB,sBAAsB;GACtB,sBAAsB;EACvB;EACD,mBAAmB;GACjB,iBAAiB;IACf,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;GACvB;GACD,4BAA4B;IAC1B,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;IACtB,cAAc;IACd,mBAAmB;GACpB;EACF;EACD,MAAM;GACJ,iCAAiC;GACjC,iCAAiC;GACjC,kBAAkB;GAClB,cAAc;GACd,8BAA8B;GAC9B,mCAAmC;GACnC,qBAAqB;GACrB,qBAAqB;GACrB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB,qBAAqB;EACtB;CACF;CACD,eAAe,CACb,8CACA,4CACD;CACD,WAAW,EACT,gBAAgB;EACd,aAAa;EACb,aAAa;EACb,OAAO;EACP,eAAe;EACf,UAAU;CACX,EACF;CACD,aAAa;EACX,aAAa;EACb,YAAY;CACb;CACD,YAAY;EACV,WAAW;EACX,QAAQ;EACR,eAAe;EACf,UAAU;EACV,OAAO;EACP,QAAQ;CACT;CACD,yBAAyB;EACvB;EACA;EACA;EACA;CACD;AACF;YACO;CACN,WAAW;CACX,kBAAkB;EAChB,oBAAoB;EACpB,eAAe;EACf,aAAa;CACd;CACD,aAAa;EACX,QAAQ;GACN,2BAA2B;GAC3B,WAAW;GACX,cAAc;GACd,kBAAkB;GAClB,wCAAwC;EACzC;EACD,UAAU;GACR,gBAAgB;GAChB,gBAAgB;GAChB,gBAAgB;EACjB;EACD,YAAY;GACV,uBAAuB;GACvB,uBAAuB;GACvB,uBAAuB;EACxB;EACD,kBAAkB;GAChB,uBAAuB;GACvB,uBAAuB;GACvB,uBAAuB;EACxB;CACF;CACD,YAAY;EACV,QAAQ;GACN,WAAW;GACX,gBAAgB;GAChB,sBAAsB;GACtB,sBAAsB;EACvB;EACD,mBAAmB;GACjB,kBAAkB;IAChB,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;GACvB;GACD,iBAAiB;IACf,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;GACvB;GACD,4BAA4B;IAC1B,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,sBAAsB;IACtB,cAAc;IACd,mBAAmB;GACpB;EACF;EACD,MAAM;GACJ,iCAAiC;GACjC,iCAAiC;GACjC,kBAAkB;GAClB,cAAc;GACd,8BAA8B;GAC9B,mCAAmC;GACnC,qBAAqB;GACrB,qBAAqB;GACrB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB,qBAAqB;EACtB;CACF;CACD,eAAe,CACb,8CACA,4CACD;CACD,WAAW;EACT,WAAW;GACT,aAAa;GACb,aAAa;GACb,OAAO;GACP,eAAe;GACf,UAAU;EACX;EACD,gBAAgB;GACd,aAAa;GACb,aAAa;GACb,OAAO;GACP,eAAe;GACf,UAAU;EACX;EACD,eAAe;GACb,aAAa;GACb,aAAa;GACb,OAAO;GACP,eAAe;GACf,UAAU;EACX;CACF;CACD,aAAa;EACX,aAAa;EACb,YAAY;CACb;CACD,yBAAyB;EACvB;EACA;EACA;EACA;CACD;AACF;YACO;CACN,WAAW;CACX,kBAAkB;EAChB,oBAAoB;EACpB,eAAe;EACf,aAAa;CACd;CACD,aAAa;EACX,QAAQ;GACN,2BAA2B;GAC3B,WAAW;GACX,cAAc;GACd,kBAAkB;GAClB,wCAAwC;EACzC;EACD,UAAU;GACR,gBAAgB;GAChB,gBAAgB;EACjB;EACD,YAAY;GACV,uBAAuB;GACvB,uBAAuB;EACxB;EACD,kBAAkB;GAChB,uBAAuB;GACvB,uBAAuB;EACxB;CACF;CACD,YAAY;EACV,QAAQ;GACN,WAAW;GACX,gBAAgB;GAChB,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