@panoptic-eng/sdk 1.0.20 → 1.0.22
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/index.js +3 -3
- package/dist/{cow-Cqw3sako.js → cow-C_SGXoWr.js} +2 -2
- package/dist/{cow-Cqw3sako.js.map → cow-C_SGXoWr.js.map} +1 -1
- package/dist/index.d.ts +696 -5907
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1393 -579
- package/dist/index.js.map +1 -1
- package/dist/irm-C7OUVANR.d.ts +5641 -0
- package/dist/irm-C7OUVANR.d.ts.map +1 -0
- package/dist/{irm-DF4NwYIY.js → irm-DNK3N7qk.js} +301 -3
- package/dist/irm-DNK3N7qk.js.map +1 -0
- package/dist/panoptic/v2/index.d.ts +12 -4
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +25 -10
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/{position-zqvENVuf.js → position-BK4a-Yyu.js} +2 -2
- package/dist/{position-zqvENVuf.js.map → position-BK4a-Yyu.js.map} +1 -1
- package/dist/{router-d09dxd-F.js → router-BZvOeloX.js} +90 -40
- package/dist/router-BZvOeloX.js.map +1 -0
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/uniswap/index.d.ts +118 -1
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +228 -4
- package/dist/uniswap/index.js.map +1 -0
- package/dist/{writes-CRjVFjMt.js → writes-DymnVbiE.js} +2 -2
- package/dist/{writes-CRjVFjMt.js.map → writes-DymnVbiE.js.map} +1 -1
- package/dist/zodiac/index.d.ts +444 -0
- package/dist/zodiac/index.d.ts.map +1 -0
- package/dist/zodiac/index.js +949 -0
- package/dist/zodiac/index.js.map +1 -0
- package/package.json +6 -1
- package/dist/irm-DF4NwYIY.js.map +0 -1
- package/dist/irm-zWjtffWA.d.ts +0 -85
- package/dist/irm-zWjtffWA.d.ts.map +0 -1
- package/dist/router-d09dxd-F.js.map +0 -1
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import { Hex } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/zodiac/rolesAbi.d.ts
|
|
4
|
+
/** Minimal Zodiac Roles v2 modifier ABI used by the scoping/apply flows. */
|
|
5
|
+
/** Minimal Zodiac Roles v2 modifier ABI used by the scoping/apply flows. */
|
|
6
|
+
declare const rolesV2Abi: readonly [{
|
|
7
|
+
readonly type: "function";
|
|
8
|
+
readonly name: "assignRoles";
|
|
9
|
+
readonly stateMutability: "nonpayable";
|
|
10
|
+
readonly inputs: readonly [{
|
|
11
|
+
readonly name: "module";
|
|
12
|
+
readonly type: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "roleKeys";
|
|
15
|
+
readonly type: "bytes32[]";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "memberOf";
|
|
18
|
+
readonly type: "bool[]";
|
|
19
|
+
}];
|
|
20
|
+
readonly outputs: readonly [];
|
|
21
|
+
}, {
|
|
22
|
+
readonly type: "function";
|
|
23
|
+
readonly name: "scopeTarget";
|
|
24
|
+
readonly stateMutability: "nonpayable";
|
|
25
|
+
readonly inputs: readonly [{
|
|
26
|
+
readonly name: "roleKey";
|
|
27
|
+
readonly type: "bytes32";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "targetAddress";
|
|
30
|
+
readonly type: "address";
|
|
31
|
+
}];
|
|
32
|
+
readonly outputs: readonly [];
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "function";
|
|
35
|
+
readonly name: "scopeFunction";
|
|
36
|
+
readonly stateMutability: "nonpayable";
|
|
37
|
+
readonly inputs: readonly [{
|
|
38
|
+
readonly name: "roleKey";
|
|
39
|
+
readonly type: "bytes32";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "targetAddress";
|
|
42
|
+
readonly type: "address";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "selector";
|
|
45
|
+
readonly type: "bytes4";
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "conditions";
|
|
48
|
+
readonly type: "tuple[]";
|
|
49
|
+
readonly components: readonly [{
|
|
50
|
+
readonly name: "parent";
|
|
51
|
+
readonly type: "uint8";
|
|
52
|
+
}, {
|
|
53
|
+
readonly name: "paramType";
|
|
54
|
+
readonly type: "uint8";
|
|
55
|
+
}, {
|
|
56
|
+
readonly name: "operator";
|
|
57
|
+
readonly type: "uint8";
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "compValue";
|
|
60
|
+
readonly type: "bytes";
|
|
61
|
+
}];
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "options";
|
|
64
|
+
readonly type: "uint8";
|
|
65
|
+
}];
|
|
66
|
+
readonly outputs: readonly [];
|
|
67
|
+
}, {
|
|
68
|
+
readonly type: "function";
|
|
69
|
+
readonly name: "allowFunction";
|
|
70
|
+
readonly stateMutability: "nonpayable";
|
|
71
|
+
readonly inputs: readonly [{
|
|
72
|
+
readonly name: "roleKey";
|
|
73
|
+
readonly type: "bytes32";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "targetAddress";
|
|
76
|
+
readonly type: "address";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "selector";
|
|
79
|
+
readonly type: "bytes4";
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "options";
|
|
82
|
+
readonly type: "uint8";
|
|
83
|
+
}];
|
|
84
|
+
readonly outputs: readonly [];
|
|
85
|
+
}, {
|
|
86
|
+
readonly type: "function";
|
|
87
|
+
readonly name: "setTransactionUnwrapper";
|
|
88
|
+
readonly stateMutability: "nonpayable";
|
|
89
|
+
readonly inputs: readonly [{
|
|
90
|
+
readonly name: "to";
|
|
91
|
+
readonly type: "address";
|
|
92
|
+
}, {
|
|
93
|
+
readonly name: "selector";
|
|
94
|
+
readonly type: "bytes4";
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "adapter";
|
|
97
|
+
readonly type: "address";
|
|
98
|
+
}];
|
|
99
|
+
readonly outputs: readonly [];
|
|
100
|
+
}]; //#endregion
|
|
101
|
+
//#region src/zodiac/applySteps.d.ts
|
|
102
|
+
/** One idempotent Roles-modifier configuration call. */
|
|
103
|
+
interface ScopeStep {
|
|
104
|
+
name: string;
|
|
105
|
+
functionName: 'assignRoles' | 'scopeTarget' | 'scopeFunction' | 'allowFunction' | 'setTransactionUnwrapper';
|
|
106
|
+
args: unknown[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Minimal structural client shapes (instead of viem's `PublicClient` /
|
|
110
|
+
* `WalletClient`) so any viem 2.x instance is accepted — pnpm peer-keying can
|
|
111
|
+
* produce multiple viem type-instances across a workspace, and the deeply
|
|
112
|
+
* generic client types are not assignable across instances (TS2719).
|
|
113
|
+
*/
|
|
114
|
+
interface ScopeStepsPublicClient {
|
|
115
|
+
waitForTransactionReceipt(args: {
|
|
116
|
+
hash: `0x${string}`;
|
|
117
|
+
timeout?: number;
|
|
118
|
+
}): Promise<{
|
|
119
|
+
status: string;
|
|
120
|
+
}>;
|
|
121
|
+
}
|
|
122
|
+
interface ScopeStepsWalletClient {
|
|
123
|
+
writeContract(args: {
|
|
124
|
+
address: `0x${string}`;
|
|
125
|
+
abi: typeof rolesV2Abi;
|
|
126
|
+
functionName: ScopeStep['functionName'];
|
|
127
|
+
args: never;
|
|
128
|
+
maxFeePerGas?: bigint;
|
|
129
|
+
maxPriorityFeePerGas?: bigint;
|
|
130
|
+
}): Promise<`0x${string}`>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Apply scope steps to a Roles v2 modifier sequentially, aborting on the
|
|
134
|
+
* first revert so a partially-applied role is never silently left behind.
|
|
135
|
+
* The wallet must be the modifier's owner.
|
|
136
|
+
*/
|
|
137
|
+
declare function applyScopeSteps(params: {
|
|
138
|
+
publicClient: ScopeStepsPublicClient;
|
|
139
|
+
walletClient: ScopeStepsWalletClient;
|
|
140
|
+
rolesModifier: `0x${string}`;
|
|
141
|
+
steps: ScopeStep[];
|
|
142
|
+
log?: (line: string) => void;
|
|
143
|
+
/**
|
|
144
|
+
* EIP-1559 fee overrides applied to every tx. Pass a NON-ZERO
|
|
145
|
+
* `maxPriorityFeePerGas` — some RPC estimators return a zero tip, which leaves
|
|
146
|
+
* txs un-prioritised and slow to include.
|
|
147
|
+
*/
|
|
148
|
+
fees?: {
|
|
149
|
+
maxFeePerGas?: bigint;
|
|
150
|
+
maxPriorityFeePerGas?: bigint;
|
|
151
|
+
};
|
|
152
|
+
/** Receipt-wait timeout (ms). */
|
|
153
|
+
timeoutMs?: number;
|
|
154
|
+
}): Promise<void>; //#endregion
|
|
155
|
+
//#region src/zodiac/conditions.d.ts
|
|
156
|
+
/** Roles v2 flat condition node (BFS-ordered tree). */
|
|
157
|
+
interface ConditionFlat {
|
|
158
|
+
parent: number;
|
|
159
|
+
paramType: number;
|
|
160
|
+
operator: number;
|
|
161
|
+
compValue: Hex;
|
|
162
|
+
}
|
|
163
|
+
/** 32-byte left-padded address as an EqualTo Static compValue. */
|
|
164
|
+
declare function addressEqualCompValue(addr: `0x${string}`): Hex;
|
|
165
|
+
/**
|
|
166
|
+
* Operator.Custom compValue: adapter address in the leading 20 bytes, the
|
|
167
|
+
* trailing 12 bytes are passed to the adapter verbatim as `extra`.
|
|
168
|
+
*/
|
|
169
|
+
declare function customCompValue(adapter: `0x${string}`, extra?: Hex): Hex;
|
|
170
|
+
/**
|
|
171
|
+
* Encode a uint96 mint-size cap as the `bytes12 extra` of a pair-condition
|
|
172
|
+
* compValue (0n = uncapped). The adapters read it as `uint96(extra)`, i.e.
|
|
173
|
+
* big-endian right-aligned in the 12 bytes.
|
|
174
|
+
*/
|
|
175
|
+
declare function sizeCapExtra(cap: bigint): Hex;
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/zodiac/constants.d.ts
|
|
179
|
+
/**
|
|
180
|
+
* Zodiac Roles Modifier v2 enum ordinals.
|
|
181
|
+
*
|
|
182
|
+
* Verified against gnosisguild/zodiac-modifier-roles `contracts/Types.sol`
|
|
183
|
+
* (commit c343958ab7317b31d8c4aec790606d950ea21eed) and the deployed v2.1
|
|
184
|
+
* mastercopy 0x9646fDAD06d3e24444381f44362a3B0eB343D337. Keep in sync with the
|
|
185
|
+
* modifier version the Safe actually runs.
|
|
186
|
+
*/
|
|
187
|
+
declare const ParameterType: {
|
|
188
|
+
readonly None: 0;
|
|
189
|
+
readonly Static: 1;
|
|
190
|
+
readonly Dynamic: 2;
|
|
191
|
+
readonly Tuple: 3;
|
|
192
|
+
readonly Array: 4;
|
|
193
|
+
readonly Calldata: 5;
|
|
194
|
+
readonly AbiEncoded: 6;
|
|
195
|
+
};
|
|
196
|
+
declare const Operator: {
|
|
197
|
+
readonly Pass: 0;
|
|
198
|
+
readonly And: 1;
|
|
199
|
+
readonly Or: 2;
|
|
200
|
+
readonly Nor: 3;
|
|
201
|
+
readonly Matches: 5;
|
|
202
|
+
readonly ArraySome: 6;
|
|
203
|
+
readonly ArrayEvery: 7;
|
|
204
|
+
readonly ArraySubset: 8;
|
|
205
|
+
readonly EqualToAvatar: 15;
|
|
206
|
+
readonly EqualTo: 16;
|
|
207
|
+
readonly GreaterThan: 17;
|
|
208
|
+
readonly LessThan: 18;
|
|
209
|
+
readonly SignedIntGreaterThan: 19;
|
|
210
|
+
readonly SignedIntLessThan: 20;
|
|
211
|
+
readonly Bitmask: 21;
|
|
212
|
+
readonly Custom: 22;
|
|
213
|
+
readonly WithinAllowance: 28;
|
|
214
|
+
readonly EtherWithinAllowance: 29;
|
|
215
|
+
readonly CallWithinAllowance: 30;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Canonical adapter addresses — deterministic CREATE2 (factory
|
|
219
|
+
* 0x4e59b44847b379578588920cA78FbF26c0B4956C, salt
|
|
220
|
+
* keccak256("panoptic.zodiac-modules.v1")), so they depend only on the
|
|
221
|
+
* bytecode: same on every chain, deployer-independent, verifiable with
|
|
222
|
+
* `cast code` against a local `forge build`. The adapters are stateless and
|
|
223
|
+
* immutable (no owner/storage/upgradability). Recompute via
|
|
224
|
+
* `forge script scripts/DeployAdapters.s.sol` after any source change.
|
|
225
|
+
*/
|
|
226
|
+
declare const CANONICAL_ADAPTERS: {
|
|
227
|
+
readonly RollerCondition: "0x7b2402F7Ff7fFe0970D383dE1C6AF8892B87523a";
|
|
228
|
+
readonly SizeAdjusterCondition: "0x72494B2A0C5a69Dd0154386c2F4Af0b38a24C400";
|
|
229
|
+
};
|
|
230
|
+
declare const ExecutionOptions: {
|
|
231
|
+
readonly None: 0;
|
|
232
|
+
readonly Send: 1;
|
|
233
|
+
readonly DelegateCall: 2;
|
|
234
|
+
readonly Both: 3;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/zodiac/roles/deleverager.d.ts
|
|
239
|
+
/**
|
|
240
|
+
* Deleverager role: burn the Safe's existing positions only — never mint.
|
|
241
|
+
*
|
|
242
|
+
* Enforced with plain static conditions, no adapter and no state oracle:
|
|
243
|
+
* every `positionSizes` entry must be 0. A size-0 entry either burns a held
|
|
244
|
+
* position or reverts the whole dispatch — a size-0 mint is impossible
|
|
245
|
+
* (option legs trip `ChunkHasZeroLiquidity` in the SFPM; pure-loan tokenIds
|
|
246
|
+
* die in the end-of-dispatch solvency pass / positions-hash validation).
|
|
247
|
+
*
|
|
248
|
+
* Trade-off vs an oracle-based check: the key cannot settle premium (settle
|
|
249
|
+
* requires `sizes[i] == storedSize`, unknowable pre-execution). Strictly a
|
|
250
|
+
* risk-reduction key: safe for a watchdog keeper or dead-man's-switch.
|
|
251
|
+
*/
|
|
252
|
+
declare const DELEVERAGER_ROLE_KEY: `0x${string}`;
|
|
253
|
+
declare function buildDeleveragerDispatchConditions(): ConditionFlat[];
|
|
254
|
+
declare function buildDeleveragerRoleSteps(params: {
|
|
255
|
+
member: `0x${string}`;
|
|
256
|
+
pool: `0x${string}`;
|
|
257
|
+
roleKey?: Hex;
|
|
258
|
+
}): ScopeStep[];
|
|
259
|
+
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/zodiac/roles/dispatchCustomRole.d.ts
|
|
262
|
+
/** PanopticPool.dispatch — TokenId is a uint256 value type. */
|
|
263
|
+
declare const DISPATCH_SELECTOR: `0x${string}`;
|
|
264
|
+
/** Deterministic per-role keys; override via env/config if a Safe needs several instances. */
|
|
265
|
+
declare function roleKey(name: string): Hex;
|
|
266
|
+
/**
|
|
267
|
+
* ConditionFlat tree for a dispatch-scoped role whose whole authorization
|
|
268
|
+
* logic lives in an on-chain `ICustomCondition` adapter (Operator.Custom).
|
|
269
|
+
*
|
|
270
|
+
* The Custom node is attached to arg0 (`positionIdList`): Roles hands the
|
|
271
|
+
* adapter the FULL calldata regardless of attachment point, and the adapter
|
|
272
|
+
* decodes `positionIdList`/`positionSizes` itself. The remaining nodes are the
|
|
273
|
+
* structural template `Integrity.sol` requires (Calldata and Array nodes must
|
|
274
|
+
* describe their children; see buildLoanOnlyDispatchConditions for the shape).
|
|
275
|
+
*/
|
|
276
|
+
declare function buildDispatchCustomConditions(adapter: `0x${string}`, extra?: Hex): ConditionFlat[];
|
|
277
|
+
/** assignRoles → scopeTarget → scopeFunction steps for an adapter-gated dispatch role. */
|
|
278
|
+
declare function buildDispatchCustomRoleSteps(params: {
|
|
279
|
+
roleName: string;
|
|
280
|
+
roleKey: Hex;
|
|
281
|
+
member: `0x${string}`;
|
|
282
|
+
pool: `0x${string}`;
|
|
283
|
+
adapter: `0x${string}`;
|
|
284
|
+
extra?: Hex;
|
|
285
|
+
}): ScopeStep[];
|
|
286
|
+
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/zodiac/roles/loanHedger.d.ts
|
|
289
|
+
/**
|
|
290
|
+
* Loan-only hedger role scope (migrated from apps/hedger-bot scripts/lib).
|
|
291
|
+
*
|
|
292
|
+
* ⚠️ VALIDATE ON A FORK BEFORE MAINNET. The ConditionFlat encoding below is
|
|
293
|
+
* security-critical. Dry-run `scopeFunction` on an anvil/Tenderly fork and
|
|
294
|
+
* assert that the role CAN mint/burn a pure width=0 loan via dispatch and
|
|
295
|
+
* CANNOT dispatch a tokenId with any width>0 leg.
|
|
296
|
+
*
|
|
297
|
+
* The scope constrains PanopticPool.dispatch(positionIdList, finalPositionIdList,
|
|
298
|
+
* positionSizes, tickAndSpreadLimits, usePremiaAsCollateral, builderCode) so that
|
|
299
|
+
* EVERY element of `positionIdList` (arg 0 — the tokenIds actually minted/burned)
|
|
300
|
+
* is a pure loan: `tokenId & widthFieldsMask == 0`. All other args pass freely;
|
|
301
|
+
* `finalPositionIdList` is intentionally NOT constrained (it legitimately contains
|
|
302
|
+
* the user's option positions that remain open).
|
|
303
|
+
*/
|
|
304
|
+
/**
|
|
305
|
+
* Bitmask compValue layout (Roles v2 `PermissionChecker._bitmask`): a 32-byte
|
|
306
|
+
* word packing `uint16 shift | bytes15 mask | bytes15 expected`, where `shift`
|
|
307
|
+
* is a BYTE offset from the start (left / most-significant end) of the value
|
|
308
|
+
* and the 15-byte mask is applied LEFT-aligned to `bytes32(value[shift:])`.
|
|
309
|
+
*
|
|
310
|
+
* The four 12-bit width fields span tokenId bits 100–255 (leg 3's width sits in
|
|
311
|
+
* the top two bytes), which is wider than one 15-byte window. So the loan
|
|
312
|
+
* constraint is expressed as TWO windows AND-ed together:
|
|
313
|
+
* - shift 0: tokenId bytes 0..14 (bits 136–255) — covers legs 1, 2, 3
|
|
314
|
+
* - shift 17: tokenId bytes 17..31 (bits 0–119) — covers leg 0
|
|
315
|
+
* Bytes 15–16 (bits 120–135) contain no width bits.
|
|
316
|
+
*/
|
|
317
|
+
declare const LOAN_BITMASK_WINDOW_SHIFTS: readonly [0, 17];
|
|
318
|
+
declare function loanBitmaskCompValueAt(shiftBytes: number): Hex;
|
|
319
|
+
/**
|
|
320
|
+
* Build the ConditionFlat[] tree scoping dispatch to loan-only positionIdList.
|
|
321
|
+
*
|
|
322
|
+
* Roles v2 `Integrity.sol` requirements honored here:
|
|
323
|
+
* - BFS order: parent indices must be non-decreasing (NotBFS).
|
|
324
|
+
* - Every Array-typed node needs >=1 child describing the element type
|
|
325
|
+
* (UnsuitableChildCount); ArrayEvery needs exactly 1.
|
|
326
|
+
* - And nodes use ParameterType.None and an empty compValue.
|
|
327
|
+
*/
|
|
328
|
+
declare function buildLoanOnlyDispatchConditions(): ConditionFlat[];
|
|
329
|
+
/** ERC4626 CollateralTracker withdraw(uint256 assets, address receiver, address owner). */
|
|
330
|
+
declare const WITHDRAW_SELECTOR: "0xb460af94";
|
|
331
|
+
/** ERC4626 CollateralTracker deposit(uint256 assets, address receiver). */
|
|
332
|
+
declare const DEPOSIT_SELECTOR: "0x6e553f65";
|
|
333
|
+
/** Uniswap UniversalRouter execute(bytes,bytes[],uint256). */
|
|
334
|
+
declare const EXECUTE_SELECTOR: "0x3593564c";
|
|
335
|
+
/**
|
|
336
|
+
* Scope CT.withdraw so tokens can only be pulled to the Safe: receiver == owner
|
|
337
|
+
* == Safe. Without this, a compromised bot key could withdraw the Safe's
|
|
338
|
+
* collateral to an arbitrary address — this is the critical cross-pool scope.
|
|
339
|
+
*/
|
|
340
|
+
declare function buildWithdrawConditions(safe: `0x${string}`): ConditionFlat[];
|
|
341
|
+
/** Scope CT.deposit so the shares are credited to the Safe: receiver == Safe. */
|
|
342
|
+
declare function buildDepositConditions(safe: `0x${string}`): ConditionFlat[];
|
|
343
|
+
/**
|
|
344
|
+
* Router `execute` is scoped with a calldata template — see
|
|
345
|
+
* apps/hedger-bot/scripts/lib/routerScope.ts (hedging-specific, not migrated).
|
|
346
|
+
*/
|
|
347
|
+
declare const ROUTER_EXECUTE_SELECTOR_ONLY: "0x3593564c";
|
|
348
|
+
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/zodiac/roles/maintenance.d.ts
|
|
351
|
+
/**
|
|
352
|
+
* Maintenance role: full `dispatchFrom` access — settle premium on, force-
|
|
353
|
+
* exercise, and liquidate third-party accounts using the Safe's capital.
|
|
354
|
+
* No adapter needed; the pool itself hash-validates the position lists.
|
|
355
|
+
*
|
|
356
|
+
* The only pin is `account != Safe` (Nor(EqualTo(safe))) so the maintenance
|
|
357
|
+
* key can never force-exercise or liquidate the Safe's own book.
|
|
358
|
+
* `positionIdListFrom` (the caller's solvency list) is intentionally
|
|
359
|
+
* unconstrained — the Safe may legitimately hold option positions.
|
|
360
|
+
*
|
|
361
|
+
* dispatchFrom is payable ⇒ ExecutionOptions.Send.
|
|
362
|
+
*/
|
|
363
|
+
declare const MAINTENANCE_ROLE_KEY: `0x${string}`;
|
|
364
|
+
/** LeftRightUnsigned is a uint256 value type. */
|
|
365
|
+
declare const DISPATCH_FROM_SELECTOR: `0x${string}`;
|
|
366
|
+
declare function buildDispatchFromConditions(safe: `0x${string}`): ConditionFlat[];
|
|
367
|
+
declare function buildMaintenanceRoleSteps(params: {
|
|
368
|
+
member: `0x${string}`;
|
|
369
|
+
pool: `0x${string}`;
|
|
370
|
+
safe: `0x${string}`;
|
|
371
|
+
roleKey?: Hex;
|
|
372
|
+
}): ScopeStep[];
|
|
373
|
+
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/zodiac/roles/roller.d.ts
|
|
376
|
+
/**
|
|
377
|
+
* Roller role: close one position and reopen it identical-except-strike (roll
|
|
378
|
+
* out-of-range positions back into range). Enforced on-chain by the stateless
|
|
379
|
+
* `RollerCondition` adapter (strike-mask equality + one-burn-one-mint shape).
|
|
380
|
+
*
|
|
381
|
+
* The reopened size is bounded by `sizeCap` (0n = uncapped, leaving only
|
|
382
|
+
* dispatch's solvency check as the ceiling) — there is no pre-state oracle,
|
|
383
|
+
* so "same size as before" cannot be enforced.
|
|
384
|
+
*/
|
|
385
|
+
declare const ROLLER_ROLE_KEY: `0x${string}`;
|
|
386
|
+
declare function buildRollerRoleSteps(params: {
|
|
387
|
+
member: `0x${string}`;
|
|
388
|
+
pool: `0x${string}`;
|
|
389
|
+
adapter: `0x${string}`;
|
|
390
|
+
sizeCap?: bigint;
|
|
391
|
+
roleKey?: Hex;
|
|
392
|
+
}): ScopeStep[];
|
|
393
|
+
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/zodiac/roles/sizeAdjuster.d.ts
|
|
396
|
+
/**
|
|
397
|
+
* Size-adjuster role: replace one position with an identical-except-optionRatio
|
|
398
|
+
* one — reduce a short whose long side was purchased, or grow a long as more
|
|
399
|
+
* options are sold. Enforced on-chain by the stateless `SizeAdjusterCondition`
|
|
400
|
+
* adapter (ratio-mask equality + one-burn-one-mint shape).
|
|
401
|
+
*
|
|
402
|
+
* Without a pre-state oracle the relative notional cap is not enforceable;
|
|
403
|
+
* set `sizeCap` (uint96, 0n = uncapped) to bound the mint size absolutely.
|
|
404
|
+
*/
|
|
405
|
+
declare const SIZE_ADJUSTER_ROLE_KEY: `0x${string}`;
|
|
406
|
+
declare function buildSizeAdjusterRoleSteps(params: {
|
|
407
|
+
member: `0x${string}`;
|
|
408
|
+
pool: `0x${string}`;
|
|
409
|
+
adapter: `0x${string}`;
|
|
410
|
+
sizeCap?: bigint;
|
|
411
|
+
roleKey?: Hex;
|
|
412
|
+
}): ScopeStep[];
|
|
413
|
+
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/zodiac/tokenIdMask.d.ts
|
|
416
|
+
/**
|
|
417
|
+
* Bit-field masks over the Panoptic v2 tokenId layout, mirroring
|
|
418
|
+
* `contracts/lib/TokenIdMasks.sol` (kept in lockstep by golden unit tests).
|
|
419
|
+
*
|
|
420
|
+
* Layout (packages/panoptic-v2-core/contracts/types/TokenId.sol):
|
|
421
|
+
* - bits [0, 64) poolId
|
|
422
|
+
* - each leg is 48 bits, starting at 64 + legIndex*48, packing
|
|
423
|
+
* asset(+0,1b) | optionRatio(+1,7b) | isLong(+8) | tokenType(+9)
|
|
424
|
+
* | riskPartner(+10,2b) | strike(+12,24b) | width(+36,12b)
|
|
425
|
+
*/
|
|
426
|
+
/** Mask with 1-bits over a `bits`-wide field at `fieldOffset` in every leg. */
|
|
427
|
+
declare function legFieldMask(fieldOffset: bigint, bits: bigint): bigint;
|
|
428
|
+
/** Mask with 1-bits over every leg's 12-bit width field. */
|
|
429
|
+
declare function loanWidthFieldsMask(): bigint;
|
|
430
|
+
/** Mask with 1-bits over every leg's 24-bit strike field. */
|
|
431
|
+
declare function strikeFieldsMask(): bigint;
|
|
432
|
+
/** Mask with 1-bits over every leg's 7-bit optionRatio field. */
|
|
433
|
+
declare function optionRatioFieldsMask(): bigint;
|
|
434
|
+
/** True iff every leg of the tokenId has width == 0 (a pure loan/credit). */
|
|
435
|
+
declare function isPureLoanTokenId(tokenId: bigint): boolean;
|
|
436
|
+
/** The 32-byte mask + expected value for a Zodiac Roles v2 Bitmask condition. */
|
|
437
|
+
declare function loanBitmaskCondition(): {
|
|
438
|
+
mask: `0x${string}`;
|
|
439
|
+
expected: `0x${string}`;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
//#endregion
|
|
443
|
+
export { CANONICAL_ADAPTERS, ConditionFlat, DELEVERAGER_ROLE_KEY, DEPOSIT_SELECTOR, DISPATCH_FROM_SELECTOR, DISPATCH_SELECTOR, EXECUTE_SELECTOR, ExecutionOptions, LOAN_BITMASK_WINDOW_SHIFTS, MAINTENANCE_ROLE_KEY, Operator, ParameterType, ROLLER_ROLE_KEY, ROUTER_EXECUTE_SELECTOR_ONLY, SIZE_ADJUSTER_ROLE_KEY, ScopeStep, WITHDRAW_SELECTOR, addressEqualCompValue, applyScopeSteps, buildDeleveragerDispatchConditions, buildDeleveragerRoleSteps, buildDepositConditions, buildDispatchCustomConditions, buildDispatchCustomRoleSteps, buildDispatchFromConditions, buildLoanOnlyDispatchConditions, buildMaintenanceRoleSteps, buildRollerRoleSteps, buildSizeAdjusterRoleSteps, buildWithdrawConditions, customCompValue, isPureLoanTokenId, legFieldMask, loanBitmaskCompValueAt, loanBitmaskCondition, loanWidthFieldsMask, optionRatioFieldsMask, roleKey, rolesV2Abi, sizeCapExtra, strikeFieldsMask };
|
|
444
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["rolesV2Abi","rolesV2Abi","ScopeStep","ScopeStepsPublicClient","Promise","ScopeStepsWalletClient","applyScopeSteps","Hex","ConditionFlat","addressEqualCompValue","customCompValue","sizeCapExtra","ParameterType","Operator","CANONICAL_ADAPTERS","ExecutionOptions","Hex","ScopeStep","ConditionFlat","DELEVERAGER_ROLE_KEY","buildDeleveragerDispatchConditions","buildDeleveragerRoleSteps","Hex","ScopeStep","ConditionFlat","DISPATCH_SELECTOR","roleKey","buildDispatchCustomConditions","buildDispatchCustomRoleSteps","Hex","ConditionFlat","LOAN_BITMASK_WINDOW_SHIFTS","loanBitmaskCompValueAt","buildLoanOnlyDispatchConditions","WITHDRAW_SELECTOR","DEPOSIT_SELECTOR","EXECUTE_SELECTOR","buildWithdrawConditions","buildDepositConditions","ROUTER_EXECUTE_SELECTOR_ONLY","Hex","ScopeStep","ConditionFlat","MAINTENANCE_ROLE_KEY","DISPATCH_FROM_SELECTOR","buildDispatchFromConditions","buildMaintenanceRoleSteps","Hex","ScopeStep","ROLLER_ROLE_KEY","buildRollerRoleSteps","Hex","ScopeStep","SIZE_ADJUSTER_ROLE_KEY","buildSizeAdjusterRoleSteps","legFieldMask","loanWidthFieldsMask","strikeFieldsMask","optionRatioFieldsMask","isPureLoanTokenId","loanBitmaskCondition"],"sources":["../../src/zodiac/rolesAbi.d.ts","../../src/zodiac/applySteps.d.ts","../../src/zodiac/conditions.d.ts","../../src/zodiac/constants.d.ts","../../src/zodiac/roles/deleverager.d.ts","../../src/zodiac/roles/dispatchCustomRole.d.ts","../../src/zodiac/roles/loanHedger.d.ts","../../src/zodiac/roles/maintenance.d.ts","../../src/zodiac/roles/roller.d.ts","../../src/zodiac/roles/sizeAdjuster.d.ts","../../src/zodiac/tokenIdMask.d.ts"],"sourcesContent":null,"mappings":";;;;;cACqBC;;;EAAAA,SAAAA,eA8FnB,E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