@panoptic-eng/sdk 1.0.56 → 1.0.58
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/chainDeployments-CmDzAmZ3.js +409 -0
- package/dist/deployments.d.ts +2 -0
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +12 -11
- package/dist/deployments.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +65 -39
- package/dist/index.js.map +1 -1
- package/dist/{irm-Dwl2er4W.js → irm-BGGqQprG.js} +1 -408
- package/dist/panoptic/v2/index.d.ts +1 -1
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +79 -46
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +1 -1
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +79 -46
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/{router-BDp3WQqI.js → router-C5v6J0jv.js} +1 -1
- package/dist/{router-CJCJkqFo.js → router-CF7xBH_o.js} +1 -1
- package/dist/{transactionFees-DE-Whxab.js → transactionFees-CNbjAigT.js} +54 -28
- package/dist/{v2-DvrVwC5h.js → v2-BybBPXaj.js} +70 -38
- package/dist/vault-transaction-fees.d.ts +5 -3
- package/dist/vault-transaction-fees.d.ts.map +1 -1
- package/dist/vault-transaction-fees.js +444 -28
- package/dist/vault-transaction-fees.js.map +1 -1
- package/package.json +1 -1
- /package/dist/{cow-BahYFov0.js → cow-CaVnyjiG.js} +0 -0
- /package/dist/{writes-B4nGIi6h.js → writes-Da5PWxJ9.js} +0 -0
|
@@ -1,6 +1,397 @@
|
|
|
1
1
|
import { hexToBigInt } from "viem";
|
|
2
2
|
import { estimateFeesPerGas, getBlock, getFeeHistory } from "viem/actions";
|
|
3
3
|
|
|
4
|
+
//#region ../deployments/src/chainDeployments.data.json
|
|
5
|
+
var _1 = {
|
|
6
|
+
"chainId": 1,
|
|
7
|
+
"infrastructure": {
|
|
8
|
+
"uniswapV3Factory": "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
9
|
+
"poolManager": "0x000000000004444c5dc75cB358380D2e3dE08A90",
|
|
10
|
+
"stateView": "0x7ffe42c4a5deea5b0fec41c94c136cf115597227"
|
|
11
|
+
},
|
|
12
|
+
"hypovault": {
|
|
13
|
+
"core": {
|
|
14
|
+
"hypoVaultImplementation": "0xF16714665955DBd0361D997eFc50fe391D96E8D0",
|
|
15
|
+
"factory": "0xd5049B2647de57141dE7F65E5124707B99A452A3",
|
|
16
|
+
"accountant": "0x65aA902AE3135658587FFC36ED51B61c927114e1",
|
|
17
|
+
"rolesAuthority": "0xb952D345c413Ddb7850173422bAe4968e0330598",
|
|
18
|
+
"collateralTrackerDecoderAndSanitizer": "0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6"
|
|
19
|
+
},
|
|
20
|
+
"vaults": {
|
|
21
|
+
"wethPlpVault": "0xd4e2c720a760049cc4151bcf61e3a9348db9cd92",
|
|
22
|
+
"usdcPlpVault": "0x236d0558f06cd60780b232d4Ec4c92d2cb7e4D18"
|
|
23
|
+
},
|
|
24
|
+
"managers": {
|
|
25
|
+
"wethPlpVaultManager": "0xB6Fc48e658C9B1a7dbdFA51A5E153ab60BB2e04d",
|
|
26
|
+
"usdcPlpVaultManager": "0x2ce65016366ef7320078e0758D58Cf1038bc7C4e"
|
|
27
|
+
},
|
|
28
|
+
"turnkeySigners": {
|
|
29
|
+
"wethPlpVaultManager": "0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F",
|
|
30
|
+
"usdcPlpVaultManager": "0x3c1c79d0cfc316Ba959194c89696a8382d7d283b"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"panoptic": {
|
|
34
|
+
"pool": {
|
|
35
|
+
"version": "v4",
|
|
36
|
+
"panopticPool": "0x00000000563b70d704f4c6675a5f6ac989fbae13",
|
|
37
|
+
"collateralTracker0": "0x1e46b0289B7E0F710E2Db8Ab87800dd782D624f7",
|
|
38
|
+
"collateralTracker1": "0x12bF31955522BAC337D93e1bC0a39F68D8BDa216"
|
|
39
|
+
},
|
|
40
|
+
"additionalPools": { "ethUsdc5bpsV3": {
|
|
41
|
+
"version": "v3",
|
|
42
|
+
"panopticPool": "0x00000000009C7B687e833559e34503f64d7ed7c4",
|
|
43
|
+
"collateralTracker0": "0x3CCdA7d5E841d6543D90BcEc20b36a724C184DE9",
|
|
44
|
+
"collateralTracker1": "0x69E9f9e44E5F52237493b980dd7306198C64A4E4"
|
|
45
|
+
} },
|
|
46
|
+
"v2": {
|
|
47
|
+
"semiFungiblePositionManagerV4": "0x00000000000005C3287f136Ef5AF56c68Ea6849f",
|
|
48
|
+
"semiFungiblePositionManagerV3": "0x00000000000005E4693aDc8Ec0f12D686f728198",
|
|
49
|
+
"builderFactory": "0x0000000000000a3D22E158417AA639D7F71b0FF7",
|
|
50
|
+
"riskEngine": "0x000000000000075e29cdaa9cb640a69e148ca7da",
|
|
51
|
+
"panopticPoolImplementation": "0x000000000000135429F0DaCaB61639Bf6a63EbbC",
|
|
52
|
+
"collateralTrackerImplementation": "0x0000000000001d9c38CA405A2e04420865A08A33",
|
|
53
|
+
"panopticFactoryV4": "0x0000000000000c51d0f8cf4bd9adE7191372a625",
|
|
54
|
+
"panopticFactoryV3": "0x0000000000000aDC9A108591e718F2aee963a2a7",
|
|
55
|
+
"panopticHelper": "0x0000000000000000000000000000000000000000",
|
|
56
|
+
"panopticMath": "0x000000000000334bbd65C195581cf59ECf315932",
|
|
57
|
+
"panopticQuery": "0x0000000000000e1aE9c66C1c3B0A547D23389C93",
|
|
58
|
+
"interactionHelper": "0x00000000000041fe14Ce3c2392337CE501aE8328"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"riskEngines": ["0x000000000000075e29cdaa9cb640a69e148ca7da", "0x0000000000000fe1e261f66ce2f44def4f5ae0cb"],
|
|
62
|
+
"markets": { "ethUsdc30bps": {
|
|
63
|
+
"currency0": "0x0000000000000000000000000000000000000000",
|
|
64
|
+
"currency1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
65
|
+
"fee": 3e3,
|
|
66
|
+
"tickSpacing": 60,
|
|
67
|
+
"poolId": "0x3C08AE4977F78D"
|
|
68
|
+
} },
|
|
69
|
+
"subgraphs": {
|
|
70
|
+
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-mainnet/prod/gn",
|
|
71
|
+
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-mainnet/v2_prod/gn"
|
|
72
|
+
},
|
|
73
|
+
"sfpmSwap": {
|
|
74
|
+
"version": "v3",
|
|
75
|
+
"sfpm": "0x00000000000005E4693aDc8Ec0f12D686f728198",
|
|
76
|
+
"poolAddress": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640",
|
|
77
|
+
"poolId": "2824133844976349",
|
|
78
|
+
"fee": 500,
|
|
79
|
+
"weth": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
80
|
+
},
|
|
81
|
+
"deprecatedRiskEngines": ["0x0000000000000e673aECBDB5f5fE5DFAf4a8e9Ac", "0x0000000000000E65545005B26207D7edFd031260"]
|
|
82
|
+
};
|
|
83
|
+
var _4663 = {
|
|
84
|
+
"chainId": 4663,
|
|
85
|
+
"infrastructure": {
|
|
86
|
+
"uniswapV3Factory": "0x1f7d7550b1b028f7571e69a784071f0205fd2efa",
|
|
87
|
+
"poolManager": "0x8366a39cc670b4001a1121b8f6a443a643e40951",
|
|
88
|
+
"stateView": "0xf3334192d15450cdd385c8b70e03f9a6bd9e673b"
|
|
89
|
+
},
|
|
90
|
+
"hypovault": {
|
|
91
|
+
"core": {
|
|
92
|
+
"hypoVaultImplementation": "0xF16714665955DBd0361D997eFc50fe391D96E8D0",
|
|
93
|
+
"factory": "0xd5049B2647de57141dE7F65E5124707B99A452A3",
|
|
94
|
+
"accountant": "0x9e345d862c41010F87D8E5A279e8D320D2831D36",
|
|
95
|
+
"rolesAuthority": "0xb952D345c413Ddb7850173422bAe4968e0330598",
|
|
96
|
+
"collateralTrackerDecoderAndSanitizer": "0xC87c45d2dbE5acb56013e2591427ECC84Fa251E6"
|
|
97
|
+
},
|
|
98
|
+
"vaults": {
|
|
99
|
+
"wethPlpVault": "0x0000000000000000000000000000000000000000",
|
|
100
|
+
"usdcPlpVault": "0x0000000000000000000000000000000000000000",
|
|
101
|
+
"usdgPlpVault": "0x08B24123252Bd9c4DD473b6573D4cF67196FFC4B"
|
|
102
|
+
},
|
|
103
|
+
"managers": {
|
|
104
|
+
"wethPlpVaultManager": "0x0000000000000000000000000000000000000000",
|
|
105
|
+
"usdcPlpVaultManager": "0x0000000000000000000000000000000000000000",
|
|
106
|
+
"usdgPlpVaultManager": "0x67Edb096585efe88a9A1ee16c5857AB74Fc8EA87"
|
|
107
|
+
},
|
|
108
|
+
"turnkeySigners": {
|
|
109
|
+
"wethPlpVaultManager": "0x0000000000000000000000000000000000000000",
|
|
110
|
+
"usdcPlpVaultManager": "0x0000000000000000000000000000000000000000",
|
|
111
|
+
"usdgPlpVaultManager": "0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"panoptic": {
|
|
115
|
+
"pool": {
|
|
116
|
+
"version": "v4",
|
|
117
|
+
"panopticPool": "0x00000000989bcb6f24af4a1Ab2A6d6a31c98A58E",
|
|
118
|
+
"collateralTracker0": "0x49eaAC32A7CD4B8fB2209a12859a95E0b20aB0e5",
|
|
119
|
+
"collateralTracker1": "0x670C44a0FC35dbC410498e47A6290a1C3196d191"
|
|
120
|
+
},
|
|
121
|
+
"v2": {
|
|
122
|
+
"semiFungiblePositionManagerV4": "0x00000000000005C3287f136Ef5AF56c68Ea6849f",
|
|
123
|
+
"semiFungiblePositionManagerV3": "0x00000000000005E4693aDc8Ec0f12D686f728198",
|
|
124
|
+
"builderFactory": "0x0000000000000a3D22E158417AA639D7F71b0FF7",
|
|
125
|
+
"riskEngine": "0x000000000000075e29cdaa9cb640a69e148ca7da",
|
|
126
|
+
"panopticPoolImplementation": "0x000000000000135429F0DaCaB61639Bf6a63EbbC",
|
|
127
|
+
"collateralTrackerImplementation": "0x0000000000001d9c38CA405A2e04420865A08A33",
|
|
128
|
+
"panopticFactoryV4": "0x0000000000000c51d0f8cf4bd9adE7191372a625",
|
|
129
|
+
"panopticFactoryV3": "0x0000000000000aDC9A108591e718F2aee963a2a7",
|
|
130
|
+
"panopticHelper": "0x0000000000000000000000000000000000000000",
|
|
131
|
+
"panopticMath": "0x000000000000334bbd65C195581cf59ECf315932",
|
|
132
|
+
"panopticQuery": "0x0000000000000e1aE9c66C1c3B0A547D23389C93",
|
|
133
|
+
"interactionHelper": "0x00000000000041fe14Ce3c2392337CE501aE8328"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"riskEngines": [
|
|
137
|
+
"0x000000000000075e29cdaa9cb640a69e148ca7da",
|
|
138
|
+
"0x0000000000000fe1e261f66ce2f44def4f5ae0cb",
|
|
139
|
+
"0x0000000000000f3fb82469581A74776178E76Ca4"
|
|
140
|
+
],
|
|
141
|
+
"markets": { "spyUsdg": {
|
|
142
|
+
"currency0": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
|
|
143
|
+
"currency1": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
144
|
+
"fee": 3e3,
|
|
145
|
+
"tickSpacing": 60,
|
|
146
|
+
"poolId": "0xfe2a80bb5618fd14984b92ca6d45bf5ba67443ddb1435e28b2e48df2fc1526cd"
|
|
147
|
+
} },
|
|
148
|
+
"subgraphs": {
|
|
149
|
+
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-robinhood/prod/gn",
|
|
150
|
+
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-robinhood/v2_prod/gn"
|
|
151
|
+
},
|
|
152
|
+
"deprecatedRiskEngines": ["0x0000000000000E65545005B26207D7edFd031260"]
|
|
153
|
+
};
|
|
154
|
+
var _8453 = {
|
|
155
|
+
"chainId": 8453,
|
|
156
|
+
"infrastructure": {
|
|
157
|
+
"uniswapV3Factory": "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
|
|
158
|
+
"poolManager": "0x498581fF718922c3f8e6A244956aF099B2652b2b",
|
|
159
|
+
"stateView": "0xA3c0c9b65baD0b08107Aa264b0f3dB444b867A71"
|
|
160
|
+
},
|
|
161
|
+
"hypovault": {
|
|
162
|
+
"core": {
|
|
163
|
+
"hypoVaultImplementation": "0xec311aE06486ad44Ba782133b502A34aCE0f479E",
|
|
164
|
+
"factory": "0x9bE53b169a41030f1710A9B82e9eA6413f14D12E",
|
|
165
|
+
"accountant": "0x345cA3407942f9d175c9eA8B90e83A36F570f852",
|
|
166
|
+
"rolesAuthority": "0x278D37CaBFFB4B72D2866E30fEFE08aef773E0B6",
|
|
167
|
+
"collateralTrackerDecoderAndSanitizer": "0x4A290b3EC46cF320421Bb2aaee96d445de31CF0b"
|
|
168
|
+
},
|
|
169
|
+
"vaults": {
|
|
170
|
+
"wethPlpVault": "0x41b7D0515d709A4Fd2CF27f9d141D0c2F8713D04",
|
|
171
|
+
"usdcPlpVault": "0xb452af299c565D04B05E601efF2840e000C922f1"
|
|
172
|
+
},
|
|
173
|
+
"managers": {
|
|
174
|
+
"wethPlpVaultManager": "0x2a4923456c79E9ebD10F5Bf5305a5C742bBc1D7C",
|
|
175
|
+
"usdcPlpVaultManager": "0xdd6E2406a044582463CFE9F0C774870eAf4A310B"
|
|
176
|
+
},
|
|
177
|
+
"turnkeySigners": {
|
|
178
|
+
"wethPlpVaultManager": "0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F",
|
|
179
|
+
"usdcPlpVaultManager": "0x3c1c79d0cfc316Ba959194c89696a8382d7d283b"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"panoptic": {
|
|
183
|
+
"pool": {
|
|
184
|
+
"version": "v4",
|
|
185
|
+
"panopticPool": "0xB50e8bb68f5855DA742f4579274902a20454174a",
|
|
186
|
+
"collateralTracker0": "0x0d82b189c96EbB1f44A7207e6A9cfB1e490f2869",
|
|
187
|
+
"collateralTracker1": "0x9ba1082Ab3cb9edEA988697A14BBe543A3dABEd2"
|
|
188
|
+
},
|
|
189
|
+
"v2": {
|
|
190
|
+
"semiFungiblePositionManagerV4": "0x8dcAa08cF298F8b4830FAf56d47930981AdE33af",
|
|
191
|
+
"semiFungiblePositionManagerV3": "0xFB1c06B491305d618bb8a7a368C6e50c001C153A",
|
|
192
|
+
"builderFactory": "0x6d26E916a18d522f7DdA2a26d9E1645564ccDcA5",
|
|
193
|
+
"riskEngine": "0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481",
|
|
194
|
+
"panopticPoolImplementation": "0x5BA68a018fF149c38ec52D181Dd24aBabE9a07DB",
|
|
195
|
+
"collateralTrackerImplementation": "0x34B3a4e4F14f292575ECe3EF67886C4598af459f",
|
|
196
|
+
"panopticFactoryV4": "0x9ac0317fcd124aff0b5429beb8de17020bc45f9a",
|
|
197
|
+
"panopticFactoryV3": "0x687f616d68c483a7223e6922f59aef7452e26c1d",
|
|
198
|
+
"panopticHelper": "0x0000000000000000000000000000000000000000",
|
|
199
|
+
"panopticMath": "0x6d21699192f5aF112C87e53b32ff846782afF407",
|
|
200
|
+
"panopticQuery": "0xd2586E1bbdd1169F597F3A370117EdF7372A7350",
|
|
201
|
+
"interactionHelper": "0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"riskEngines": ["0x8bbce8b1eb64118cfe6c1eab0afe13b80ea41481"],
|
|
205
|
+
"markets": { "ethUsdc5bps": {
|
|
206
|
+
"currency0": "0x0000000000000000000000000000000000000000",
|
|
207
|
+
"currency1": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
208
|
+
"fee": 500,
|
|
209
|
+
"tickSpacing": 10,
|
|
210
|
+
"poolId": "0x96d4b53a38337a5733179751781178a2613306063c511b78cd02684739288c0a"
|
|
211
|
+
} },
|
|
212
|
+
"subgraphs": {
|
|
213
|
+
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-base/prod/gn",
|
|
214
|
+
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-base/v2_prod/gn"
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var _11155111 = {
|
|
218
|
+
"chainId": 11155111,
|
|
219
|
+
"infrastructure": {
|
|
220
|
+
"uniswapV3Factory": "0x0227628f3F023bb0B980b67D528571c95c6DaC1c",
|
|
221
|
+
"poolManager": "0xE03A1074c86CFeDd5C142C4F04F1a1536e203543",
|
|
222
|
+
"stateView": "0xE1Dd9c3fA50EDB962E442f60DfBc432e24537E4C"
|
|
223
|
+
},
|
|
224
|
+
"hypovault": {
|
|
225
|
+
"core": {
|
|
226
|
+
"hypoVaultImplementation": "0xC5b415Db4087228Af817893769DC3a205160160B",
|
|
227
|
+
"factory": "0x363a9d605ca45cBfF3b597350DeADb53cdC292c7",
|
|
228
|
+
"accountant": "0x25BBef1DF262c24aa1AACD1F7eCeEcc1a7AD08ab",
|
|
229
|
+
"rolesAuthority": "0x673BfafB4e2712215B422347c1571421B83E8A3d",
|
|
230
|
+
"collateralTrackerDecoderAndSanitizer": "0xb899BE50BAF25BBB3A3ca3403256B3c703E5AB5d"
|
|
231
|
+
},
|
|
232
|
+
"vaults": {
|
|
233
|
+
"wethPlpVault": "0xD58C4F9AEe5bBfcf28dC9a8d3D57b323fA6521b1",
|
|
234
|
+
"usdcPlpVault": "0xdd7a8d6c6975488e801129bC84302d74e2361208"
|
|
235
|
+
},
|
|
236
|
+
"managers": {
|
|
237
|
+
"wethPlpVaultManager": "0x95eC124FAAB70D7aE147c3BE0336E01a828AE2d5",
|
|
238
|
+
"usdcPlpVaultManager": "0xFB5aa3e0b46F3859D90B14b52ffd287013b5Ec53"
|
|
239
|
+
},
|
|
240
|
+
"turnkeySigners": {
|
|
241
|
+
"wethPlpVaultManager": "0x8FfA6DAB99f8afc64F61BeF83F0966eD6362f24F",
|
|
242
|
+
"usdcPlpVaultManager": "0x3c1c79d0cfc316Ba959194c89696a8382d7d283b"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"panoptic": {
|
|
246
|
+
"pool": {
|
|
247
|
+
"version": "v4",
|
|
248
|
+
"panopticPool": "0x872b98C46b2062F663BEb2CC9D4cE046Da2a2918",
|
|
249
|
+
"collateralTracker0": "0x09a60b78d06a03e5148faedd3bfee6f58b22012f",
|
|
250
|
+
"collateralTracker1": "0x7365664c8101ff7e9422ae2b203822253c31e69c"
|
|
251
|
+
},
|
|
252
|
+
"v2": {
|
|
253
|
+
"semiFungiblePositionManagerV3": "0x9DaD2C40107Db4B29a5450401BB7A28e6eA00e43",
|
|
254
|
+
"semiFungiblePositionManagerV4": "0xD2615995A71644E122cC2FD7FeC2392b971220DE",
|
|
255
|
+
"builderFactory": "0x55f3D2d9D065AA5Fcc11D94c55a6085849e8b6C3",
|
|
256
|
+
"riskEngine": "0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c",
|
|
257
|
+
"panopticPoolImplementation": "0x969235B5830f13b58BB699305d9c70A8Cd3BD97C",
|
|
258
|
+
"collateralTrackerImplementation": "0xafcd5F651Ae0403Ff668bb2dAc38BEa907a35Dba",
|
|
259
|
+
"panopticFactoryV3": "0xd9FFCa53C0A6155001Ce8cbcAEfe89DB204690F1",
|
|
260
|
+
"panopticFactoryV4": "0x8FCBb59b05779818D9BAD2686cc44B705603ce03",
|
|
261
|
+
"panopticHelper": "0xfFEbB3A4ab793cB244209d4dA0Cb3e6B07133bd0",
|
|
262
|
+
"panopticMath": "0x6d21699192f5aF112C87e53b32ff846782afF407",
|
|
263
|
+
"panopticQuery": "0x74057945467Fb4eAE9193B46A60ae66a53f06A5b",
|
|
264
|
+
"interactionHelper": "0x643d8DD5372FD6c71f8fAbCce4Eb8857704F3E15"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"riskEngines": ["0x1376aF5ca426B6B9fad6a712c21f6Cf58a94b93c"],
|
|
268
|
+
"markets": { "ethUsdc5bps": {
|
|
269
|
+
"currency0": "0x0000000000000000000000000000000000000000",
|
|
270
|
+
"currency1": "0xFFFeD8254566B7F800f6D8CDb843ec75AE49B07A",
|
|
271
|
+
"fee": 500,
|
|
272
|
+
"tickSpacing": 10,
|
|
273
|
+
"poolId": "0xba6673bcb27568a73a93dd23b20c8174fa16193cd90905be859144e8f13097a5"
|
|
274
|
+
} },
|
|
275
|
+
"subgraphs": {
|
|
276
|
+
"hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-sepolia/prod/gn",
|
|
277
|
+
"panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-sepolia/v2_prod/gn"
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var chainDeployments_data_default = {
|
|
281
|
+
"1": _1,
|
|
282
|
+
"4663": _4663,
|
|
283
|
+
"8453": _8453,
|
|
284
|
+
"11155111": _11155111
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region ../deployments/src/chainDeployments.js
|
|
289
|
+
const MAINNET_CHAIN_ID = 1;
|
|
290
|
+
const SEPOLIA_CHAIN_ID = 11155111;
|
|
291
|
+
const BASE_CHAIN_ID = 8453;
|
|
292
|
+
const ROBINHOOD_CHAIN_ID = 4663;
|
|
293
|
+
const CHAIN_DEPLOYMENTS = chainDeployments_data_default;
|
|
294
|
+
function getChainDeployment(chainId) {
|
|
295
|
+
return CHAIN_DEPLOYMENTS[chainId];
|
|
296
|
+
}
|
|
297
|
+
function requireChainDeployment(chainId) {
|
|
298
|
+
const deployment = getChainDeployment(chainId);
|
|
299
|
+
if (deployment === void 0) throw new Error(`Unsupported chain deployment for chainId ${chainId}`);
|
|
300
|
+
return deployment;
|
|
301
|
+
}
|
|
302
|
+
function getEthUsdcMarket(deployment) {
|
|
303
|
+
const market = deployment.markets.ethUsdc5bps ?? deployment.markets.ethUsdc30bps;
|
|
304
|
+
if (market === void 0) throw new Error(`Missing ETH/USDC market for chainId ${deployment.chainId}`);
|
|
305
|
+
return market;
|
|
306
|
+
}
|
|
307
|
+
function getSpyUsdgMarket(deployment) {
|
|
308
|
+
const market = deployment.markets.spyUsdg;
|
|
309
|
+
if (market === void 0) throw new Error(`Missing SPY/USDG market for chainId ${deployment.chainId}`);
|
|
310
|
+
return market;
|
|
311
|
+
}
|
|
312
|
+
const MAINNET_DEPLOYMENT = CHAIN_DEPLOYMENTS[MAINNET_CHAIN_ID];
|
|
313
|
+
const MAINNET_ETH_USDC_5BPS_V3_PANOPTIC_POOL_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.additionalPools?.ethUsdc5bpsV3;
|
|
314
|
+
const MAINNET_PANOPTIC_V2_ADDRESSES = MAINNET_DEPLOYMENT.panoptic.v2;
|
|
315
|
+
const SEPOLIA_DEPLOYMENT = CHAIN_DEPLOYMENTS[SEPOLIA_CHAIN_ID];
|
|
316
|
+
const SEPOLIA_HYPOVAULT_CORE_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.core;
|
|
317
|
+
const SEPOLIA_HYPOVAULT_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.vaults;
|
|
318
|
+
const SEPOLIA_HYPOVAULT_MANAGER_ADDRESSES = SEPOLIA_DEPLOYMENT.hypovault.managers;
|
|
319
|
+
const SEPOLIA_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = SEPOLIA_DEPLOYMENT.hypovault.turnkeySigners;
|
|
320
|
+
const SEPOLIA_PANOPTIC_POOL_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.pool;
|
|
321
|
+
const SEPOLIA_PANOPTIC_V2_ADDRESSES = SEPOLIA_DEPLOYMENT.panoptic.v2;
|
|
322
|
+
const BASE_DEPLOYMENT = CHAIN_DEPLOYMENTS[BASE_CHAIN_ID];
|
|
323
|
+
const BASE_HYPOVAULT_CORE_ADDRESSES = BASE_DEPLOYMENT.hypovault.core;
|
|
324
|
+
const BASE_HYPOVAULT_ADDRESSES = BASE_DEPLOYMENT.hypovault.vaults;
|
|
325
|
+
const BASE_HYPOVAULT_MANAGER_ADDRESSES = BASE_DEPLOYMENT.hypovault.managers;
|
|
326
|
+
const BASE_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = BASE_DEPLOYMENT.hypovault.turnkeySigners;
|
|
327
|
+
const BASE_PANOPTIC_POOL_ADDRESSES = BASE_DEPLOYMENT.panoptic.pool;
|
|
328
|
+
const BASE_PANOPTIC_V2_ADDRESSES = BASE_DEPLOYMENT.panoptic.v2;
|
|
329
|
+
const BASE_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(BASE_DEPLOYMENT);
|
|
330
|
+
const SEPOLIA_ETH_USDC_5BPS_MARKET = getEthUsdcMarket(SEPOLIA_DEPLOYMENT);
|
|
331
|
+
const MAINNET_RISK_ENGINES = MAINNET_DEPLOYMENT.riskEngines;
|
|
332
|
+
const BASE_RISK_ENGINES = BASE_DEPLOYMENT.riskEngines;
|
|
333
|
+
const SEPOLIA_RISK_ENGINES = SEPOLIA_DEPLOYMENT.riskEngines;
|
|
334
|
+
const ROBINHOOD_DEPLOYMENT = CHAIN_DEPLOYMENTS[ROBINHOOD_CHAIN_ID];
|
|
335
|
+
const ROBINHOOD_HYPOVAULT_CORE_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.core;
|
|
336
|
+
const ROBINHOOD_HYPOVAULT_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.vaults;
|
|
337
|
+
const ROBINHOOD_HYPOVAULT_MANAGER_ADDRESSES = ROBINHOOD_DEPLOYMENT.hypovault.managers;
|
|
338
|
+
const ROBINHOOD_HYPOVAULT_MANAGER_TURNKEY_SIGNERS = ROBINHOOD_DEPLOYMENT.hypovault.turnkeySigners;
|
|
339
|
+
const ROBINHOOD_PANOPTIC_POOL_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.pool;
|
|
340
|
+
const ROBINHOOD_PANOPTIC_V2_ADDRESSES = ROBINHOOD_DEPLOYMENT.panoptic.v2;
|
|
341
|
+
const ROBINHOOD_RISK_ENGINES = ROBINHOOD_DEPLOYMENT.riskEngines;
|
|
342
|
+
const ROBINHOOD_SPY_USDG_MARKET = getSpyUsdgMarket(ROBINHOOD_DEPLOYMENT);
|
|
343
|
+
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region ../deployments/src/vaultDisplayNames.js
|
|
346
|
+
const mainnetDeployment = requireChainDeployment(MAINNET_CHAIN_ID);
|
|
347
|
+
const mainnetVaults = mainnetDeployment.hypovault.vaults;
|
|
348
|
+
const legacyMainnetVaults = {
|
|
349
|
+
wethPlpVault: "0x779a2aa634A004b3a3f3b322083744869BBC6D66",
|
|
350
|
+
usdcPlpVault: "0x963Fe9c93bc353602656ee4051A75114bA74d6c5"
|
|
351
|
+
};
|
|
352
|
+
const sepoliaDeployment = requireChainDeployment(SEPOLIA_CHAIN_ID);
|
|
353
|
+
const sepoliaVaults = sepoliaDeployment.hypovault.vaults;
|
|
354
|
+
const baseDeployment = requireChainDeployment(BASE_CHAIN_ID);
|
|
355
|
+
const baseVaults = baseDeployment.hypovault.vaults;
|
|
356
|
+
const robinhoodDeployment = requireChainDeployment(ROBINHOOD_CHAIN_ID);
|
|
357
|
+
const robinhoodUsdgVault = robinhoodDeployment.hypovault.vaults.usdgPlpVault;
|
|
358
|
+
if (robinhoodUsdgVault === void 0) throw new Error("Missing Robinhood USDG PLP vault address");
|
|
359
|
+
const VAULT_DISPLAY_NAMES_PER_CHAIN = {
|
|
360
|
+
[MAINNET_CHAIN_ID]: {
|
|
361
|
+
[mainnetVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
362
|
+
[mainnetVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault",
|
|
363
|
+
[legacyMainnetVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
364
|
+
[legacyMainnetVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault"
|
|
365
|
+
},
|
|
366
|
+
[BASE_CHAIN_ID]: {
|
|
367
|
+
[baseVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
368
|
+
[baseVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault"
|
|
369
|
+
},
|
|
370
|
+
[SEPOLIA_CHAIN_ID]: {
|
|
371
|
+
[sepoliaVaults.wethPlpVault.toLowerCase()]: "PLP Vault",
|
|
372
|
+
[sepoliaVaults.usdcPlpVault.toLowerCase()]: "Unicorn Vault"
|
|
373
|
+
},
|
|
374
|
+
[ROBINHOOD_CHAIN_ID]: { [robinhoodUsdgVault.toLowerCase()]: "0DTE +67∆ Vault" }
|
|
375
|
+
};
|
|
376
|
+
const VAULT_DISPLAY_NAME_RESOLVERS_PER_CHAIN = {
|
|
377
|
+
[MAINNET_CHAIN_ID]: {
|
|
378
|
+
[mainnetVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
379
|
+
[mainnetVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault",
|
|
380
|
+
[legacyMainnetVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
381
|
+
[legacyMainnetVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault"
|
|
382
|
+
},
|
|
383
|
+
[BASE_CHAIN_ID]: {
|
|
384
|
+
[baseVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
385
|
+
[baseVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault"
|
|
386
|
+
},
|
|
387
|
+
[SEPOLIA_CHAIN_ID]: {
|
|
388
|
+
[sepoliaVaults.wethPlpVault.toLowerCase()]: () => "PLP Vault",
|
|
389
|
+
[sepoliaVaults.usdcPlpVault.toLowerCase()]: () => "Unicorn Vault"
|
|
390
|
+
},
|
|
391
|
+
[ROBINHOOD_CHAIN_ID]: { [robinhoodUsdgVault.toLowerCase()]: () => "0DTE +67∆ Vault" }
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
//#endregion
|
|
4
395
|
//#region src/hypoVault/transactionFees.ts
|
|
5
396
|
const MIN_VAULT_PRIORITY_FEE_PER_GAS = 100000000n;
|
|
6
397
|
const MAX_VAULT_PRIORITY_FEE_PER_GAS = 3000000000n;
|
|
@@ -67,12 +458,15 @@ function medianBigInt(values) {
|
|
|
67
458
|
const lowerMiddle = sorted[upperMiddleIndex - 1];
|
|
68
459
|
return lowerMiddle === void 0 ? void 0 : (lowerMiddle + upperMiddle) / 2n;
|
|
69
460
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
461
|
+
function getChainPriorityFeeFloor(chainId) {
|
|
462
|
+
return chainId === ROBINHOOD_CHAIN_ID ? 0n : void 0;
|
|
463
|
+
}
|
|
464
|
+
function clampPriorityFee(priorityFee, minimumPriorityFeePerGas = MIN_VAULT_PRIORITY_FEE_PER_GAS) {
|
|
465
|
+
if (priorityFee < minimumPriorityFeePerGas) return minimumPriorityFeePerGas;
|
|
72
466
|
if (priorityFee > MAX_VAULT_PRIORITY_FEE_PER_GAS) return MAX_VAULT_PRIORITY_FEE_PER_GAS;
|
|
73
467
|
return priorityFee;
|
|
74
468
|
}
|
|
75
|
-
function resolveFeeHistoryQuote({ baseFeePerGas, reward }) {
|
|
469
|
+
function resolveFeeHistoryQuote({ baseFeePerGas, reward, minimumPriorityFeePerGas }) {
|
|
76
470
|
const latestBaseFeeIndex = baseFeePerGas.length - 2;
|
|
77
471
|
if (latestBaseFeeIndex < 0 || reward === void 0 || reward.length === 0) return null;
|
|
78
472
|
const p90Rewards = reward.flatMap((blockRewards) => {
|
|
@@ -81,16 +475,18 @@ function resolveFeeHistoryQuote({ baseFeePerGas, reward }) {
|
|
|
81
475
|
});
|
|
82
476
|
const sampledPriorityFee = medianBigInt(p90Rewards);
|
|
83
477
|
if (sampledPriorityFee === void 0) return null;
|
|
84
|
-
const
|
|
478
|
+
const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
|
|
479
|
+
const maxPriorityFeePerGas = clampPriorityFee(sampledPriorityFee, effectivePriorityFeeFloor);
|
|
85
480
|
const bufferedBaseFee = ceilMultiplyFraction(baseFeePerGas[latestBaseFeeIndex], BASE_FEE_BUFFER_NUMERATOR, BASE_FEE_BUFFER_DENOMINATOR);
|
|
86
481
|
return {
|
|
87
482
|
maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,
|
|
88
483
|
maxPriorityFeePerGas,
|
|
89
|
-
minimumMaxFeePerGas: bufferedBaseFee +
|
|
484
|
+
minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,
|
|
485
|
+
...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
|
|
90
486
|
source: "fee_history"
|
|
91
487
|
};
|
|
92
488
|
}
|
|
93
|
-
function resolveDeltaHedgeFeeHistoryQuote({ baseFeePerGas, reward }) {
|
|
489
|
+
function resolveDeltaHedgeFeeHistoryQuote({ baseFeePerGas, reward, minimumPriorityFeePerGas }) {
|
|
94
490
|
const latestBaseFeeIndex = baseFeePerGas.length - 2;
|
|
95
491
|
if (latestBaseFeeIndex < 0 || reward === void 0 || reward.length === 0) return null;
|
|
96
492
|
const p25Rewards = reward.flatMap((blockRewards) => {
|
|
@@ -99,22 +495,25 @@ function resolveDeltaHedgeFeeHistoryQuote({ baseFeePerGas, reward }) {
|
|
|
99
495
|
});
|
|
100
496
|
const rawPriorityFeePerGas = medianBigInt(p25Rewards);
|
|
101
497
|
if (rawPriorityFeePerGas === void 0) return null;
|
|
102
|
-
const
|
|
498
|
+
const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
|
|
499
|
+
const maxPriorityFeePerGas = clampPriorityFee(rawPriorityFeePerGas, effectivePriorityFeeFloor);
|
|
103
500
|
const bufferedBaseFee = ceilMultiplyFraction(baseFeePerGas[latestBaseFeeIndex], BASE_FEE_BUFFER_NUMERATOR, BASE_FEE_BUFFER_DENOMINATOR);
|
|
104
501
|
return {
|
|
105
502
|
maxFeePerGas: bufferedBaseFee + maxPriorityFeePerGas,
|
|
106
503
|
maxPriorityFeePerGas,
|
|
107
|
-
minimumMaxFeePerGas: bufferedBaseFee +
|
|
504
|
+
minimumMaxFeePerGas: bufferedBaseFee + effectivePriorityFeeFloor,
|
|
505
|
+
...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
|
|
108
506
|
rawPriorityFeePerGas,
|
|
109
507
|
source: "fee_history_p25"
|
|
110
508
|
};
|
|
111
509
|
}
|
|
112
|
-
function resolveRpcPriorityFeeQuote({ baseFeePerGas, rawPriorityFeePerGas }) {
|
|
510
|
+
function resolveRpcPriorityFeeQuote({ baseFeePerGas, rawPriorityFeePerGas, minimumPriorityFeePerGas }) {
|
|
113
511
|
const bufferedBaseFee = ceilMultiplyFraction(baseFeePerGas, BASE_FEE_BUFFER_NUMERATOR, BASE_FEE_BUFFER_DENOMINATOR);
|
|
114
512
|
return {
|
|
115
513
|
maxFeePerGas: bufferedBaseFee + rawPriorityFeePerGas,
|
|
116
514
|
maxPriorityFeePerGas: rawPriorityFeePerGas,
|
|
117
|
-
minimumMaxFeePerGas: bufferedBaseFee + rawPriorityFeePerGas,
|
|
515
|
+
minimumMaxFeePerGas: bufferedBaseFee + (minimumPriorityFeePerGas ?? rawPriorityFeePerGas),
|
|
516
|
+
...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
|
|
118
517
|
rawPriorityFeePerGas,
|
|
119
518
|
source: "rpc_priority_fee"
|
|
120
519
|
};
|
|
@@ -135,7 +534,7 @@ function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote
|
|
|
135
534
|
requiredMaxPriorityFeePerGas: requiredReplacementPriorityFee,
|
|
136
535
|
maximumAffordableFeePerGas: MAX_VAULT_TRANSACTION_GAS_COST / gasLimit
|
|
137
536
|
});
|
|
138
|
-
const bufferedBaseFee = historicalQuote.minimumMaxFeePerGas - MIN_VAULT_PRIORITY_FEE_PER_GAS;
|
|
537
|
+
const bufferedBaseFee = historicalQuote.minimumMaxFeePerGas - (historicalQuote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
|
|
139
538
|
const currentMarketMaxFee = bufferedBaseFee + requiredMaxPriorityFeePerGas;
|
|
140
539
|
const desiredMaxFeePerGas = currentMarketMaxFee > bumpedMaxFee ? currentMarketMaxFee : bumpedMaxFee;
|
|
141
540
|
const maximumAffordableFeePerGas = MAX_VAULT_TRANSACTION_GAS_COST / gasLimit;
|
|
@@ -153,13 +552,15 @@ function getVaultTransactionReplacementFeeQuote({ originalQuote, historicalQuote
|
|
|
153
552
|
maxPriorityFeePerGas: requiredMaxPriorityFeePerGas
|
|
154
553
|
};
|
|
155
554
|
}
|
|
156
|
-
function resolveFallbackQuote({ maxFeePerGas: estimatedMaxFeePerGas, maxPriorityFeePerGas: estimatedPriorityFeePerGas }) {
|
|
157
|
-
const
|
|
555
|
+
function resolveFallbackQuote({ maxFeePerGas: estimatedMaxFeePerGas, maxPriorityFeePerGas: estimatedPriorityFeePerGas, minimumPriorityFeePerGas }) {
|
|
556
|
+
const effectivePriorityFeeFloor = minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
|
|
557
|
+
const maxPriorityFeePerGas = clampPriorityFee(estimatedPriorityFeePerGas, effectivePriorityFeeFloor);
|
|
158
558
|
const estimatedBaseFeeAllowance = estimatedMaxFeePerGas > estimatedPriorityFeePerGas ? estimatedMaxFeePerGas - estimatedPriorityFeePerGas : 0n;
|
|
159
559
|
return {
|
|
160
560
|
maxFeePerGas: estimatedBaseFeeAllowance + maxPriorityFeePerGas,
|
|
161
561
|
maxPriorityFeePerGas,
|
|
162
|
-
minimumMaxFeePerGas: estimatedBaseFeeAllowance +
|
|
562
|
+
minimumMaxFeePerGas: estimatedBaseFeeAllowance + effectivePriorityFeeFloor,
|
|
563
|
+
...minimumPriorityFeePerGas === void 0 ? {} : { minimumPriorityFeePerGas },
|
|
163
564
|
source: "viem_fallback"
|
|
164
565
|
};
|
|
165
566
|
}
|
|
@@ -172,7 +573,7 @@ function applyVaultTransactionGasCostLimit(quote, gasLimit) {
|
|
|
172
573
|
minimumRequiredFeePerGas: quote.minimumMaxFeePerGas
|
|
173
574
|
});
|
|
174
575
|
if (quote.maxFeePerGas <= maximumAffordableFeePerGas) return quote;
|
|
175
|
-
const bufferedBaseFee = quote.minimumMaxFeePerGas - MIN_VAULT_PRIORITY_FEE_PER_GAS;
|
|
576
|
+
const bufferedBaseFee = quote.minimumMaxFeePerGas - (quote.minimumPriorityFeePerGas ?? MIN_VAULT_PRIORITY_FEE_PER_GAS);
|
|
176
577
|
const affordablePriorityFee = maximumAffordableFeePerGas - bufferedBaseFee;
|
|
177
578
|
return {
|
|
178
579
|
...quote,
|
|
@@ -185,7 +586,8 @@ function bufferVaultTransactionGasEstimate(gasEstimate) {
|
|
|
185
586
|
return ceilMultiplyFraction(gasEstimate, GAS_ESTIMATE_BUFFER_NUMERATOR, GAS_ESTIMATE_BUFFER_DENOMINATOR);
|
|
186
587
|
}
|
|
187
588
|
function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
|
|
188
|
-
const { gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps;
|
|
589
|
+
const { chainId, gasLimit, maxFeePerGas, maxPriorityFeePerGas } = feeCaps;
|
|
590
|
+
const minimumPriorityFeePerGas = quote?.minimumPriorityFeePerGas ?? getChainPriorityFeeFloor(chainId) ?? MIN_VAULT_PRIORITY_FEE_PER_GAS;
|
|
189
591
|
if (maxFeePerGas === null || maxPriorityFeePerGas === null) return {
|
|
190
592
|
valid: false,
|
|
191
593
|
code: "MissingEip1559Fees",
|
|
@@ -196,10 +598,10 @@ function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
|
|
|
196
598
|
code: "InvalidFeeCaps",
|
|
197
599
|
reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) cannot exceed maxFeePerGas (${maxFeePerGas.toString()} wei).`
|
|
198
600
|
};
|
|
199
|
-
if (maxPriorityFeePerGas <
|
|
601
|
+
if (maxPriorityFeePerGas < minimumPriorityFeePerGas) return {
|
|
200
602
|
valid: false,
|
|
201
603
|
code: "PriorityFeeTooLow",
|
|
202
|
-
reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must be at least ${
|
|
604
|
+
reason: `Signed transaction maxPriorityFeePerGas (${maxPriorityFeePerGas.toString()} wei) must be at least ${minimumPriorityFeePerGas.toString()} wei.`
|
|
203
605
|
};
|
|
204
606
|
if (maxPriorityFeePerGas > MAX_VAULT_PRIORITY_FEE_PER_GAS) return {
|
|
205
607
|
valid: false,
|
|
@@ -214,21 +616,27 @@ function validateVaultSignedTransactionFeeCaps(feeCaps, quote) {
|
|
|
214
616
|
if (quote !== void 0 && maxFeePerGas < quote.minimumMaxFeePerGas) return {
|
|
215
617
|
valid: false,
|
|
216
618
|
code: "MaxFeeTooLow",
|
|
217
|
-
reason: `Signed transaction maxFeePerGas (${maxFeePerGas.toString()} wei) must be at least ${quote.minimumMaxFeePerGas.toString()} wei for the buffered next-block base fee and
|
|
619
|
+
reason: `Signed transaction maxFeePerGas (${maxFeePerGas.toString()} wei) must be at least ${quote.minimumMaxFeePerGas.toString()} wei for the buffered next-block base fee and configured minimum priority fee.`
|
|
218
620
|
};
|
|
219
621
|
return { valid: true };
|
|
220
622
|
}
|
|
221
|
-
async function resolveVaultTransactionFeeQuote({ readFeeHistory, readFallbackEstimate }) {
|
|
623
|
+
async function resolveVaultTransactionFeeQuote({ readFeeHistory, readFallbackEstimate, minimumPriorityFeePerGas }) {
|
|
222
624
|
let feeHistoryError;
|
|
223
625
|
try {
|
|
224
|
-
const quote = resolveFeeHistoryQuote(
|
|
626
|
+
const quote = resolveFeeHistoryQuote({
|
|
627
|
+
...await readFeeHistory(),
|
|
628
|
+
minimumPriorityFeePerGas
|
|
629
|
+
});
|
|
225
630
|
if (quote !== null) return quote;
|
|
226
631
|
feeHistoryError = new Error("eth_feeHistory returned incomplete base fee or reward data");
|
|
227
632
|
} catch (error) {
|
|
228
633
|
feeHistoryError = error;
|
|
229
634
|
}
|
|
230
635
|
try {
|
|
231
|
-
return resolveFallbackQuote(
|
|
636
|
+
return resolveFallbackQuote({
|
|
637
|
+
...await readFallbackEstimate(),
|
|
638
|
+
minimumPriorityFeePerGas
|
|
639
|
+
});
|
|
232
640
|
} catch (fallbackError) {
|
|
233
641
|
throw new VaultTransactionFeeEstimationError({
|
|
234
642
|
feeHistoryError,
|
|
@@ -240,12 +648,13 @@ async function resolveVaultTransactionFeeQuote({ readFeeHistory, readFallbackEst
|
|
|
240
648
|
* Resolve explicit EIP-1559 fees for operator-controlled vault transactions.
|
|
241
649
|
*
|
|
242
650
|
* The normal path follows the median p90 priority fee from the last 20 blocks,
|
|
243
|
-
* with a 0.1 gwei floor
|
|
244
|
-
*
|
|
245
|
-
* base-fee allowance.
|
|
651
|
+
* with a 3 gwei ceiling and a 0.1 gwei floor except on chains that do not use
|
|
652
|
+
* tips for ordering. If fee history is unavailable, Viem's estimate is used
|
|
653
|
+
* while preserving those bounds and its original base-fee allowance.
|
|
246
654
|
*/
|
|
247
655
|
async function getVaultTransactionFeeQuote(client) {
|
|
248
656
|
return resolveVaultTransactionFeeQuote({
|
|
657
|
+
minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),
|
|
249
658
|
readFeeHistory: () => getFeeHistory(client, {
|
|
250
659
|
blockCount: FEE_HISTORY_BLOCK_COUNT,
|
|
251
660
|
blockTag: "latest",
|
|
@@ -260,13 +669,19 @@ async function getVaultDeltaHedgeHistoricalFeeQuote(client) {
|
|
|
260
669
|
blockTag: "latest",
|
|
261
670
|
rewardPercentiles: DELTA_HEDGE_FEE_HISTORY_REWARD_PERCENTILES
|
|
262
671
|
});
|
|
263
|
-
const quote = resolveDeltaHedgeFeeHistoryQuote(
|
|
672
|
+
const quote = resolveDeltaHedgeFeeHistoryQuote({
|
|
673
|
+
...feeHistory,
|
|
674
|
+
minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id)
|
|
675
|
+
});
|
|
264
676
|
if (quote === null) throw new Error("eth_feeHistory returned incomplete p25 base fee or reward data");
|
|
265
677
|
return quote;
|
|
266
678
|
}
|
|
267
|
-
async function resolveVaultDeltaHedgeInitialFeeQuote({ readRpcQuote, readHistoricalQuote }) {
|
|
679
|
+
async function resolveVaultDeltaHedgeInitialFeeQuote({ readRpcQuote, readHistoricalQuote, minimumPriorityFeePerGas }) {
|
|
268
680
|
try {
|
|
269
|
-
return resolveRpcPriorityFeeQuote(
|
|
681
|
+
return resolveRpcPriorityFeeQuote({
|
|
682
|
+
...await readRpcQuote(),
|
|
683
|
+
minimumPriorityFeePerGas
|
|
684
|
+
});
|
|
270
685
|
} catch {
|
|
271
686
|
return readHistoricalQuote();
|
|
272
687
|
}
|
|
@@ -278,6 +693,7 @@ async function resolveVaultDeltaHedgeInitialFeeQuote({ readRpcQuote, readHistori
|
|
|
278
693
|
*/
|
|
279
694
|
async function getVaultDeltaHedgeInitialFeeQuote(client) {
|
|
280
695
|
return resolveVaultDeltaHedgeInitialFeeQuote({
|
|
696
|
+
minimumPriorityFeePerGas: getChainPriorityFeeFloor(client.chain?.id),
|
|
281
697
|
readRpcQuote: async () => {
|
|
282
698
|
const [rawPriorityFee, latestBlock] = await Promise.all([client.request({ method: "eth_maxPriorityFeePerGas" }), getBlock(client, { blockTag: "latest" })]);
|
|
283
699
|
if (latestBlock.baseFeePerGas === null) throw new Error("Latest block does not include an EIP-1559 base fee");
|