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