@panoptic-eng/sdk 1.0.63 → 1.0.65

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/StateView-q4yMpBY6.js +323 -0
  3. package/dist/cow/index.d.ts +1 -1
  4. package/dist/cow/index.js +1 -1
  5. package/dist/cow/index.js.map +1 -1
  6. package/dist/{cow-BsSaoahK.js → cow-BU9YOHkh.js} +1 -1
  7. package/dist/index.d.ts +34 -34
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +7 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/{irm-BDlcUNgJ.js → irm-DGyKOQXz.js} +4 -326
  12. package/dist/panoptic/v2/index.d.ts +161 -137
  13. package/dist/panoptic/v2/index.d.ts.map +1 -1
  14. package/dist/panoptic/v2/index.js +61 -51
  15. package/dist/panoptic/v2/index.js.map +1 -1
  16. package/dist/panoptic/v2/react-public.d.ts +168 -144
  17. package/dist/panoptic/v2/react-public.d.ts.map +1 -1
  18. package/dist/panoptic/v2/react-public.js +64 -54
  19. package/dist/panoptic/v2/react-public.js.map +1 -1
  20. package/dist/{rates-BwZnK0tG.js → rates-Y0Pbv1_x.js} +4 -4
  21. package/dist/{router-pm9PDlyH.js → router-CheXbrfz.js} +2 -2
  22. package/dist/{router-Dejb6MWu.js → router-DxE-iwYF.js} +304 -6
  23. package/dist/{transactionFees-aXQlx-lq.js → transactionFees-BF033Mob.js} +1 -1
  24. package/dist/uniswap/index.d.ts +194 -4
  25. package/dist/uniswap/index.d.ts.map +1 -1
  26. package/dist/uniswap/index.js +1316 -789
  27. package/dist/uniswap/index.js.map +1 -1
  28. package/dist/{v2-ccGPXWvq.js → v2-QFSAShVj.js} +29 -316
  29. package/dist/{writes--fM_8ggw.js → writes-BA21eyGF.js} +38 -38
  30. package/dist/zodiac/index.d.ts +3 -3
  31. package/dist/zodiac/index.js +3 -3
  32. package/dist/zodiac/index.js.map +1 -1
  33. package/package.json +1 -1
  34. /package/dist/{chainDeployments-BhXMBZ4B.js → chainDeployments-Do4NaZA_.js} +0 -0
  35. /package/dist/{greeks-CNi1-cnp.js → greeks-CGtgLUyh.js} +0 -0
  36. /package/dist/{providers-1WdiaRbY.js → providers-DubVMHWU.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError, PanopticValidationError, PositionSnapshotNotFoundError, ProviderLagError, STANDARD_TICK_WIDTHS, STRIKE_CONVERSION_FACTOR, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, UnsafePremiumSettlementError, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, decodeOracleTiming, decodePosition, decodeTickSpacing$1 as decodeTickSpacing, formatTokenAmount, getBlockMeta, getOpenPositionIds, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositions, getPositionsKey, getSyncCheckpointKey, getTrackedPositionIds, jsonSerializer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, parseTokenAmount, submitWrite } from "./rates-BwZnK0tG.js";
2
- import { MAX_TICK, MIN_TICK, REORG_DEPTH, calculatePositionGreeks, priceToTick, roundToTickSpacing, sqrtPriceX96ToTick, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96 } from "./greeks-CNi1-cnp.js";
1
+ import { BatchValidationError, DEFAULT_VEGOID, InputListFailError, InvalidTickLimitsError, InvalidTokenIdParameterError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LoanSlotExhaustedError, MaxRetriesExceededError, MissingPositionIdsError, NoLoanPositionsError, OracleRateLimitedError, PanopticError, PanopticValidationError, PositionSnapshotNotFoundError, ProviderLagError, STANDARD_TICK_WIDTHS, STRIKE_CONVERSION_FACTOR, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, UnsafePremiumSettlementError, collateralTrackerV2Abi, createTxResult, decodeLeftRightUnsigned, decodeOracleTiming, decodePosition, decodeTickSpacing, formatTokenAmount, getBlockMeta, getOpenPositionIds, getPool, getPoolMetaKey, getPoolMetadata, getPositionMetaKey, getPositions, getPositionsKey, getSyncCheckpointKey, getTrackedPositionIds, jsonSerializer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticPoolV2Abi, parsePanopticError, parseTokenAmount, submitWrite } from "./rates-Y0Pbv1_x.js";
2
+ import { MAX_TICK, MIN_TICK, REORG_DEPTH, calculatePositionGreeks, priceToTick, roundToTickSpacing, sqrtPriceX96ToTick, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96 } from "./greeks-CGtgLUyh.js";
3
3
  import { decodeFunctionResult, encodeFunctionData, erc20Abi, getAbiItem } from "viem";
4
4
 
5
5
  //#region src/panoptic/v2/writes/broadcaster.ts
@@ -1386,7 +1386,7 @@ async function forceExerciseAndWait(params) {
1386
1386
  * Reorder a position ID list so `tokenId` is the last element.
1387
1387
  *
1388
1388
  * The position list fingerprint is an XOR hash, so ordering is free to change.
1389
- * The contract settles premium on the last element of `positionIdListTo`.
1389
+ * The contract settles streamia on the last element of `positionIdListTo`.
1390
1390
  *
1391
1391
  * @throws PanopticError if `tokenId` is not in the list
1392
1392
  */
@@ -1395,15 +1395,15 @@ function orderListForSettle(positionIdList, tokenId) {
1395
1395
  return [...positionIdList.filter((id) => id !== tokenId), tokenId];
1396
1396
  }
1397
1397
  /**
1398
- * Settle another account's accumulated long premium.
1398
+ * Settle another account's accumulated long streamia.
1399
1399
  *
1400
1400
  * Calls `dispatchFrom` with the target's position list passed as both
1401
1401
  * `positionIdListTo` and `positionIdListToFinal` (equal lengths select the
1402
- * settle-premium mode and cannot force-exercise or liquidate). Requires the
1403
- * target account to be solvent; the settled premium is credited to the
1402
+ * settle-streamia mode and cannot force-exercise or liquidate). Requires the
1403
+ * target account to be solvent; the settled streamia is credited to the
1404
1404
  * sellers of the corresponding chunks.
1405
1405
  *
1406
- * @param params - Settle premium parameters
1406
+ * @param params - Settle streamia parameters
1407
1407
  * @returns TxResult
1408
1408
  *
1409
1409
  * @example
@@ -1441,7 +1441,7 @@ async function settlePremiumFrom(params) {
1441
1441
  });
1442
1442
  }
1443
1443
  /**
1444
- * Settle another account's premium and wait for confirmation.
1444
+ * Settle another account's streamia and wait for confirmation.
1445
1445
  *
1446
1446
  * When `storage` and `chainId` are provided, automatically syncs the
1447
1447
  * caller's positions after the transaction confirms.
@@ -1531,7 +1531,7 @@ function buildSettleSequenceCalls(params) {
1531
1531
  return calls;
1532
1532
  }
1533
1533
  /**
1534
- * Execute a settle sequence: settle each target buyer's owed long premium,
1534
+ * Execute a settle sequence: settle each target buyer's owed long streamia,
1535
1535
  * then optionally close the caller's own position, in one multicall.
1536
1536
  *
1537
1537
  * @param params - Settle sequence parameters
@@ -1711,7 +1711,7 @@ function formatRatioPercent(numerator, denominator, precision) {
1711
1711
  * // Now use without passing decimals each time
1712
1712
  * const priceStr = fmt.tickToPriceScaled(position.currentTick, 4n)
1713
1713
  * const amount0Str = fmt.formatAmount0(collateral.assets, 4n)
1714
- * const amount1Str = fmt.formatAmount1(premia.token1, 2n)
1714
+ * const amount1Str = fmt.formatAmount1(streamia.token1, 2n)
1715
1715
  *
1716
1716
  * // Parse user input
1717
1717
  * const rawAmount0 = fmt.parseAmount0("1.5")
@@ -3218,18 +3218,18 @@ async function getCurrentPositionSizes(params) {
3218
3218
  //#endregion
3219
3219
  //#region src/panoptic/v2/reads/premia.ts
3220
3220
  /**
3221
- * Get premia totals for an account.
3221
+ * Get streamia totals for an account.
3222
3222
  *
3223
- * Returns the total short and long premium across all positions.
3224
- * Short premium is owed TO the account (earned from selling options).
3225
- * Long premium is owed BY the account (paid for buying options).
3223
+ * Returns the total short and long streamia across all positions.
3224
+ * Short streamia is owed TO the account (earned from selling options).
3225
+ * Long streamia is owed BY the account (paid for buying options).
3226
3226
  *
3227
3227
  * @param params - The parameters
3228
- * @returns Premia totals with block metadata
3228
+ * @returns Streamia totals with block metadata
3229
3229
  *
3230
3230
  * @example
3231
3231
  * ```typescript
3232
- * const premia = await getAccountPremia({
3232
+ * const streamia = await getAccountPremia({
3233
3233
  * client,
3234
3234
  * poolAddress,
3235
3235
  * account,
@@ -3237,8 +3237,8 @@ async function getCurrentPositionSizes(params) {
3237
3237
  * includePendingPremium: true,
3238
3238
  * })
3239
3239
  *
3240
- * console.log('Short premium earned:', premia.shortPremium0, premia.shortPremium1)
3241
- * console.log('Long premium owed:', premia.longPremium0, premia.longPremium1)
3240
+ * console.log('Short streamia earned:', streamia.shortPremium0, streamia.shortPremium1)
3241
+ * console.log('Long streamia owed:', streamia.longPremium0, streamia.longPremium1)
3242
3242
  * ```
3243
3243
  */
3244
3244
  async function getAccountPremia(params) {
@@ -3284,13 +3284,13 @@ async function getAccountPremia(params) {
3284
3284
  };
3285
3285
  }
3286
3286
  /**
3287
- * Get positions with per-position premia data.
3287
+ * Get positions with per-position streamia data.
3288
3288
  *
3289
3289
  * Uses multicall to batch individual getFullPositionsData calls
3290
- * for each position, giving us per-position premia in a single RPC request.
3290
+ * for each position, giving us per-position streamia in a single RPC request.
3291
3291
  *
3292
3292
  * @param params - The parameters
3293
- * @returns Positions with premia and totals with block metadata
3293
+ * @returns Positions with streamia and totals with block metadata
3294
3294
  *
3295
3295
  * @example
3296
3296
  * ```typescript
@@ -3303,9 +3303,9 @@ async function getAccountPremia(params) {
3303
3303
  *
3304
3304
  * for (const position of result.positions) {
3305
3305
  * console.log('Position:', position.tokenId)
3306
- * console.log('Premia:', position.premiaOwed0, position.premiaOwed1)
3306
+ * console.log('Streamia:', position.premiaOwed0, position.premiaOwed1)
3307
3307
  * }
3308
- * console.log('Total short premium:', result.shortPremium0, result.shortPremium1)
3308
+ * console.log('Total short streamia:', result.shortPremium0, result.shortPremium1)
3309
3309
  * ```
3310
3310
  */
3311
3311
  async function getPositionsWithPremia(params) {
@@ -3422,17 +3422,17 @@ async function getPositionsWithPremia(params) {
3422
3422
  };
3423
3423
  }
3424
3424
  /**
3425
- * Get the unsettled short premium an account would forfeit by closing now.
3425
+ * Get the unsettled short streamia an account would forfeit by closing now.
3426
3426
  *
3427
3427
  * Calls `getFullPositionsData` twice in one multicall — once with
3428
3428
  * `includePendingPremium = true` (everything owed to the short legs) and once
3429
3429
  * with `false` (only what is available to collect). The difference is the
3430
- * premium still owed by buyers that has not been settled; closing before it
3430
+ * streamia still owed by buyers that has not been settled; closing before it
3431
3431
  * settles forfeits it. Settling buyers first (see `settlePremiumFrom`) moves
3432
- * that premium into the available bucket.
3432
+ * that streamia into the available bucket.
3433
3433
  *
3434
3434
  * @param params - The parameters
3435
- * @returns Owed, available, and forfeitable premium with block metadata
3435
+ * @returns Owed, available, and forfeitable streamia with block metadata
3436
3436
  */
3437
3437
  async function getForfeitablePremium(params) {
3438
3438
  const { client, poolAddress, account, tokenIds, blockNumber } = params;
@@ -3706,11 +3706,11 @@ async function getPoolTokensForSimulation(params) {
3706
3706
 
3707
3707
  //#endregion
3708
3708
  //#region src/panoptic/v2/simulations/simulateSettlePremiumFrom.ts
3709
- /** Soft-failure revert markers for settle premium (target-state issues, not caller errors). */
3709
+ /** Soft-failure revert markers for settle streamia (target-state issues, not caller errors). */
3710
3710
  const SOFT_FAILURES = [
3711
3711
  {
3712
3712
  marker: "AccountInsolvent",
3713
- reason: "Target account is insolvent; premium cannot be settled"
3713
+ reason: "Target account is insolvent; streamia cannot be settled"
3714
3714
  },
3715
3715
  {
3716
3716
  marker: "PositionNotOwned",
@@ -3726,14 +3726,14 @@ const SOFT_FAILURES = [
3726
3726
  }
3727
3727
  ];
3728
3728
  /**
3729
- * Simulate settling another account's accumulated long premium via `dispatchFrom`
3729
+ * Simulate settling another account's accumulated long streamia via `dispatchFrom`
3730
3730
  * (equal-length `positionIdListTo`/`positionIdListToFinal` selects the settle mode).
3731
3731
  *
3732
- * The measured token flow is the CALLER's collateral delta — i.e. the premium
3732
+ * The measured token flow is the CALLER's collateral delta — i.e. the streamia
3733
3733
  * the caller receives from the settlement (for chunks they sold).
3734
3734
  *
3735
3735
  * @param params - Simulation parameters
3736
- * @returns Simulation result with settled premium data or error
3736
+ * @returns Simulation result with settled streamia data or error
3737
3737
  */
3738
3738
  async function simulateSettlePremiumFrom(params) {
3739
3739
  const { client, poolAddress, account, user, positionIdListFrom, positionIdList, tokenId, blockNumber } = params;
@@ -3891,14 +3891,14 @@ async function simulateSettlePremiumFrom(params) {
3891
3891
  //#endregion
3892
3892
  //#region src/panoptic/v2/simulations/simulateSettlePremiumBatch.ts
3893
3893
  /**
3894
- * Simulate settling each target buyer's owed long premium, all at one block.
3894
+ * Simulate settling each target buyer's owed long streamia, all at one block.
3895
3895
  *
3896
3896
  * Individual failures (insolvent buyer, stale list, …) are soft: the target
3897
3897
  * lands in the unsettleable partition instead of failing the batch. Only
3898
3898
  * unexpected errors reject.
3899
3899
  *
3900
3900
  * @param params - Simulation parameters
3901
- * @returns Partitioned targets with per-target premium and totals
3901
+ * @returns Partitioned targets with per-target streamia and totals
3902
3902
  */
3903
3903
  async function simulateSettlePremiumBatch(params) {
3904
3904
  const { client, poolAddress, account, positionIdListFrom, targets, blockNumber } = params;
@@ -4189,9 +4189,9 @@ async function simulateSettle(params) {
4189
4189
  //#endregion
4190
4190
  //#region src/panoptic/v2/writes/settle.ts
4191
4191
  /**
4192
- * Settle accumulated premia on existing positions.
4192
+ * Settle accumulated streamia on existing positions.
4193
4193
  *
4194
- * This function triggers premium collection without changing position size.
4194
+ * This function triggers streamia collection without changing position size.
4195
4195
  * It calls dispatch with unchanged position lists.
4196
4196
  *
4197
4197
  * @param params - Settlement parameters
@@ -4274,7 +4274,7 @@ async function settleAccumulatedPremia(params) {
4274
4274
  });
4275
4275
  }
4276
4276
  /**
4277
- * Settle premia and wait for confirmation.
4277
+ * Settle streamia and wait for confirmation.
4278
4278
  */
4279
4279
  async function settleAccumulatedPremiaAndWait(params) {
4280
4280
  const result = await settleAccumulatedPremia(params);
@@ -5937,4 +5937,4 @@ async function smartRepayAndWait(params) {
5937
5937
  }
5938
5938
 
5939
5939
  //#endregion
5940
- export { addLegToTokenId, approve, approveAndWait, approvePool, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateResyncBlock, cancelTransaction, checkApproval, clearCheckpoint, closePosition, closePositionAndWait, countLegs, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllLegs, decodeLeg, decodePoolId, decodeTickSpacing$1 as decodeTickSpacing, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveUniqueTokenId, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodeV4PoolId, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPoolIdHex, formatRatioPercent, formatTimestamp, formatTimestampLocale, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWei, generateOverlappingTokenIds, getAccountPremia, getAssetIndex, getForfeitablePremium, getPoolDeploymentBlock, getPoolDisplayId, getPoolTokensForSimulation, getPositionsWithPremia, getSimpleLoanTokenIndex, getTokenListId, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isInputListFailError, isLoan, isLoanLeg, isShortOnly, isSpread, liquidate, liquidateAndWait, loadCheckpoint, mint, mintAndWait, openPosition, openPositionAndWait, orderListForSettle, parseBps, parseTokenListId, planDeriveStrategy, pokeOracle, pokeOracleAndWait, previewBorrow, previewRepay, previewUnwrap, previewWrap, publicBroadcaster, reconstructFromEvents, redeem, redeemAndWait, repay, repayAndWait, resolveTokenIndex, rollPosition, rollPositionAndWait, saveCheckpoint, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateDispatch, simulateOpenPosition, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateWithTokenFlow, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, validateBatch, validatePoolId, verifyBlockContinuity, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
5940
+ export { addLegToTokenId, approve, approveAndWait, approvePool, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateResyncBlock, cancelTransaction, checkApproval, clearCheckpoint, closePosition, closePositionAndWait, countLegs, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllLegs, decodeLeg, decodePoolId, decodeTickSpacing$1, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveUniqueTokenId, detectReorg, dispatch, dispatchAndWait, encodeLeg, encodePoolId, encodeV4PoolId, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPoolIdHex, formatRatioPercent, formatTimestamp, formatTimestampLocale, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWei, generateOverlappingTokenIds, getAccountPremia, getAssetIndex, getForfeitablePremium, getPoolDeploymentBlock, getPoolDisplayId, getPoolTokensForSimulation, getPositionsWithPremia, getSimpleLoanTokenIndex, getTokenListId, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isInputListFailError, isLoan, isLoanLeg, isShortOnly, isSpread, liquidate, liquidateAndWait, loadCheckpoint, mint, mintAndWait, openPosition, openPositionAndWait, orderListForSettle, parseBps, parseTokenListId, planDeriveStrategy, pokeOracle, pokeOracleAndWait, previewBorrow, previewRepay, previewUnwrap, previewWrap, publicBroadcaster, reconstructFromEvents, redeem, redeemAndWait, repay, repayAndWait, resolveTokenIndex, rollPosition, rollPositionAndWait, saveCheckpoint, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateDispatch, simulateOpenPosition, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateWithTokenFlow, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, validateBatch, validatePoolId, verifyBlockContinuity, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
@@ -247,7 +247,7 @@ declare const ExecutionOptions: {
247
247
  * (option legs trip `ChunkHasZeroLiquidity` in the SFPM; pure-loan tokenIds
248
248
  * die in the end-of-dispatch solvency pass / positions-hash validation).
249
249
  *
250
- * Trade-off vs an oracle-based check: the key cannot settle premium (settle
250
+ * Trade-off vs an oracle-based check: the key cannot settle streamia (settle
251
251
  * requires `sizes[i] == storedSize`, unknowable pre-execution). Strictly a
252
252
  * risk-reduction key: safe for a watchdog keeper or dead-man's-switch.
253
253
  */
@@ -297,7 +297,7 @@ declare function buildDispatchCustomRoleSteps(params: {
297
297
  * hand-encoded tree in zodiac-modules/test/LiquidatorRolesFork.t.sol, which is
298
298
  * the golden spec for this builder):
299
299
  * - THIS TREE pins the static fields: pool ∈ allowlist, account ∉ {safe,
300
- * helper}, swap targets ∈ {router, 0}, premia flags = 0, and — via
300
+ * helper}, swap targets ∈ {router, 0}, streamia flags = 0, and — via
301
301
  * ExecutionOptions.None — zero outer msg.value (attached value is excluded
302
302
  * from the helper's minDelta floors, so it must never flow through the
303
303
  * role; native shortfalls are funded via nativeFundingAmount instead).
@@ -389,7 +389,7 @@ declare function buildDepositConditions(safe: `0x${string}`): ConditionFlat[];
389
389
  //#endregion
390
390
  //#region src/zodiac/roles/maintenance.d.ts
391
391
  /**
392
- * Maintenance role: full `dispatchFrom` access — settle premium on, force-
392
+ * Maintenance role: full `dispatchFrom` access — settle streamia on, force-
393
393
  * exercise, and liquidate third-party accounts using the Safe's capital.
394
394
  * No adapter needed; the pool itself hash-validates the position lists.
395
395
  *
@@ -398,7 +398,7 @@ function buildDispatchCustomRoleSteps(params) {
398
398
  * (option legs trip `ChunkHasZeroLiquidity` in the SFPM; pure-loan tokenIds
399
399
  * die in the end-of-dispatch solvency pass / positions-hash validation).
400
400
  *
401
- * Trade-off vs an oracle-based check: the key cannot settle premium (settle
401
+ * Trade-off vs an oracle-based check: the key cannot settle streamia (settle
402
402
  * requires `sizes[i] == storedSize`, unknowable pre-execution). Strictly a
403
403
  * risk-reduction key: safe for a watchdog keeper or dead-man's-switch.
404
404
  */
@@ -534,7 +534,7 @@ function buildDeleveragerRoleSteps(params) {
534
534
  * hand-encoded tree in zodiac-modules/test/LiquidatorRolesFork.t.sol, which is
535
535
  * the golden spec for this builder):
536
536
  * - THIS TREE pins the static fields: pool ∈ allowlist, account ∉ {safe,
537
- * helper}, swap targets ∈ {router, 0}, premia flags = 0, and — via
537
+ * helper}, swap targets ∈ {router, 0}, streamia flags = 0, and — via
538
538
  * ExecutionOptions.None — zero outer msg.value (attached value is excluded
539
539
  * from the helper's minDelta floors, so it must never flow through the
540
540
  * role; native shortfalls are funded via nativeFundingAmount instead).
@@ -937,7 +937,7 @@ function buildDepositConditions(safe) {
937
937
  //#endregion
938
938
  //#region src/zodiac/roles/maintenance.ts
939
939
  /**
940
- * Maintenance role: full `dispatchFrom` access — settle premium on, force-
940
+ * Maintenance role: full `dispatchFrom` access — settle streamia on, force-
941
941
  * exercise, and liquidate third-party accounts using the Safe's capital.
942
942
  * No adapter needed; the pool itself hash-validates the position lists.
943
943
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["params: {\n publicClient: ScopeStepsPublicClient\n walletClient: ScopeStepsWalletClient\n rolesModifier: `0x${string}`\n steps: ScopeStep[]\n log?: (line: string) => void\n /**\n * EIP-1559 fee overrides applied to every tx. Pass a NON-ZERO\n * `maxPriorityFeePerGas` — some RPC estimators return a zero tip, which leaves\n * txs un-prioritised and slow to include.\n */\n fees?: { maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint }\n /** Receipt-wait timeout (ms). */\n timeoutMs?: number\n}","v: string","addr: `0x${string}`","adapter: `0x${string}`","extra: Hex","cap: bigint","name: string","adapter: `0x${string}`","extra: Hex","params: {\n roleName: string\n roleKey: Hex\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}`\n extra?: Hex\n}","params: {\n member: `0x${string}`\n pool: `0x${string}`\n roleKey?: Hex\n}","params: LiquidatorConditionsParams","parent: number","paramType: ConditionFlat['paramType']","conditions: ConditionFlat[]","params: LiquidatorConditionsParams & { roleKey: Hex; member: Address }","fieldOffset: bigint","bits: bigint","tokenId: bigint","v: bigint","shiftBytes: number","safe: `0x${string}`","safe: `0x${string}`","params: {\n member: `0x${string}`\n pool: `0x${string}`\n safe: `0x${string}`\n roleKey?: Hex\n}","params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed RollerCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}","safe: `0x${string}`","poolId: bigint","adapter: `0x${string}`","poolIdPin: bigint","params: {\n roleKey: Hex\n safe: `0x${string}`\n sfpm: `0x${string}`\n /** CollateralTracker for token0. */\n collateralTracker0: `0x${string}`\n /** CollateralTracker for token1. */\n collateralTracker1: `0x${string}`\n /** Deployed SfpmSwapCondition (stateless, canonical per chain). */\n adapter: `0x${string}`\n /** The registered `uint64` SFPM poolId of the allowed swap pool. */\n poolIdPin: bigint\n /** Safe MultiSendCallOnly address (the batch entrypoint). */\n multiSendCallOnly: `0x${string}`\n /** Canonical MultiSend unwrapper adapter for this chain. */\n multiSendUnwrapper: `0x${string}`\n /**\n * Which collateral asset is native ETH (its CT `deposit` is payable and needs\n * value; the batch wraps/unwraps around the swap). `'none'` for two-ERC20 pools.\n */\n nativeCollateral?: 'token0' | 'token1' | 'none'\n /** WETH9 address — required when `nativeCollateral` is not `'none'`. */\n weth9?: `0x${string}`\n}","side: 'token0' | 'token1'","ct: `0x${string}`","label: string","roleKey","steps: ScopeStep[]","params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed SizeAdjusterCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}"],"sources":["../../src/zodiac/rolesAbi.ts","../../src/zodiac/applySteps.ts","../../src/zodiac/conditions.ts","../../src/zodiac/constants.ts","../../src/zodiac/roles/dispatchCustomRole.ts","../../src/zodiac/roles/deleverager.ts","../../src/zodiac/roles/liquidator.ts","../../src/zodiac/tokenIdMask.ts","../../src/zodiac/roles/loanHedger.ts","../../src/zodiac/roles/maintenance.ts","../../src/zodiac/roles/roller.ts","../../src/zodiac/roles/sfpmSwap.ts","../../src/zodiac/roles/sizeAdjuster.ts"],"sourcesContent":["/** Minimal Zodiac Roles v2 modifier ABI used by the scoping/apply flows. */\nexport const rolesV2Abi = [\n {\n type: 'function',\n name: 'assignRoles',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'module', type: 'address' },\n { name: 'roleKeys', type: 'bytes32[]' },\n { name: 'memberOf', type: 'bool[]' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'scopeTarget',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'roleKey', type: 'bytes32' },\n { name: 'targetAddress', type: 'address' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'scopeFunction',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'roleKey', type: 'bytes32' },\n { name: 'targetAddress', type: 'address' },\n { name: 'selector', type: 'bytes4' },\n {\n name: 'conditions',\n type: 'tuple[]',\n components: [\n { name: 'parent', type: 'uint8' },\n { name: 'paramType', type: 'uint8' },\n { name: 'operator', type: 'uint8' },\n { name: 'compValue', type: 'bytes' },\n ],\n },\n { name: 'options', type: 'uint8' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'allowFunction',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'roleKey', type: 'bytes32' },\n { name: 'targetAddress', type: 'address' },\n { name: 'selector', type: 'bytes4' },\n { name: 'options', type: 'uint8' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'setTransactionUnwrapper',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'to', type: 'address' },\n { name: 'selector', type: 'bytes4' },\n { name: 'adapter', type: 'address' },\n ],\n outputs: [],\n },\n] as const\n","import type { ContractFunctionArgs, ContractFunctionName } from 'viem'\n\nimport { rolesV2Abi } from './rolesAbi'\n\ntype ScopeFunctionName = ContractFunctionName<typeof rolesV2Abi, 'nonpayable'>\n\n/** One idempotent Roles-modifier configuration call, paired with its ABI arguments. */\nexport type ScopeStep = {\n [Name in ScopeFunctionName]: {\n name: string\n functionName: Name\n args: ContractFunctionArgs<typeof rolesV2Abi, 'nonpayable', Name>\n }\n}[ScopeFunctionName]\n\n/**\n * Minimal structural client shapes (instead of viem's `PublicClient` /\n * `WalletClient`) so any viem 2.x instance is accepted — pnpm peer-keying can\n * produce multiple viem type-instances across a workspace, and the deeply\n * generic client types are not assignable across instances (TS2719).\n */\nexport interface ScopeStepsPublicClient {\n waitForTransactionReceipt(args: {\n hash: `0x${string}`\n timeout?: number\n }): Promise<{ status: string }>\n}\n\nexport interface ScopeStepsWalletClient {\n writeContract(args: {\n address: `0x${string}`\n abi: typeof rolesV2Abi\n functionName: ScopeStep['functionName']\n args: never\n maxFeePerGas?: bigint\n maxPriorityFeePerGas?: bigint\n }): Promise<`0x${string}`>\n}\n\n/**\n * Apply scope steps to a Roles v2 modifier sequentially, aborting on the\n * first revert so a partially-applied role is never silently left behind.\n * The wallet must be the modifier's owner.\n */\nexport async function applyScopeSteps(params: {\n publicClient: ScopeStepsPublicClient\n walletClient: ScopeStepsWalletClient\n rolesModifier: `0x${string}`\n steps: ScopeStep[]\n log?: (line: string) => void\n /**\n * EIP-1559 fee overrides applied to every tx. Pass a NON-ZERO\n * `maxPriorityFeePerGas` — some RPC estimators return a zero tip, which leaves\n * txs un-prioritised and slow to include.\n */\n fees?: { maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint }\n /** Receipt-wait timeout (ms). */\n timeoutMs?: number\n}): Promise<void> {\n // eslint-disable-next-line no-console\n const { publicClient, walletClient, rolesModifier, steps, log = console.log } = params\n for (const step of steps) {\n log(`→ ${step.name}`)\n const hash = await walletClient.writeContract({\n address: rolesModifier,\n abi: rolesV2Abi,\n functionName: step.functionName,\n args: step.args as never,\n ...(params.fees ?? {}),\n })\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n ...(params.timeoutMs ? { timeout: params.timeoutMs } : {}),\n })\n log(` ${receipt.status} ${hash}`)\n if (receipt.status !== 'success') {\n throw new Error(`step \"${step.name}\" reverted (tx ${hash}); aborting before later steps`)\n }\n }\n}\n","import type { Hex } from 'viem'\n\n/** Roles v2 flat condition node (BFS-ordered tree). */\nexport interface ConditionFlat {\n parent: number\n paramType: number\n operator: number\n compValue: Hex\n}\n\n/** True for a 0x-prefixed, 20-byte (40 hex char) address. */\nfunction isHexAddress(v: string): boolean {\n return /^0x[0-9a-fA-F]{40}$/.test(v)\n}\n\n/** 32-byte left-padded address as an EqualTo Static compValue. */\nexport function addressEqualCompValue(addr: `0x${string}`): Hex {\n if (!isHexAddress(addr)) {\n throw new Error(`addressEqualCompValue: expected a 20-byte hex address, got \"${addr}\"`)\n }\n return `0x${addr.slice(2).toLowerCase().padStart(64, '0')}` as Hex\n}\n\n/**\n * Operator.Custom compValue: adapter address in the leading 20 bytes, the\n * trailing 12 bytes are passed to the adapter verbatim as `extra`.\n */\nexport function customCompValue(adapter: `0x${string}`, extra: Hex = '0x'): Hex {\n if (!isHexAddress(adapter)) {\n throw new Error(`customCompValue: adapter must be a 20-byte hex address, got \"${adapter}\"`)\n }\n if (!/^0x([0-9a-fA-F]{2})*$/.test(extra)) {\n throw new Error(`customCompValue: extra must be 0x-prefixed, even-length hex, got \"${extra}\"`)\n }\n if (extra.length - 2 > 24) throw new Error('customCompValue: extra must be at most 12 bytes')\n const extraHex = extra.slice(2).padEnd(24, '0')\n return `0x${adapter.slice(2).toLowerCase()}${extraHex}` as Hex\n}\n\n/**\n * Encode a uint96 mint-size cap as the `bytes12 extra` of a pair-condition\n * compValue (0n = uncapped). The adapters read it as `uint96(extra)`, i.e.\n * big-endian right-aligned in the 12 bytes.\n */\nexport function sizeCapExtra(cap: bigint): Hex {\n if (cap < 0n || cap >= 1n << 96n) throw new Error('size cap must fit in uint96')\n return `0x${cap.toString(16).padStart(24, '0')}` as Hex\n}\n","/**\n * Zodiac Roles Modifier v2 enum ordinals.\n *\n * Verified against gnosisguild/zodiac-modifier-roles `contracts/Types.sol`\n * (commit c343958ab7317b31d8c4aec790606d950ea21eed) and the deployed v2.1\n * mastercopy 0x9646fDAD06d3e24444381f44362a3B0eB343D337. Keep in sync with the\n * modifier version the Safe actually runs.\n */\n\nexport const ParameterType = {\n None: 0,\n Static: 1,\n Dynamic: 2,\n Tuple: 3,\n Array: 4,\n Calldata: 5,\n AbiEncoded: 6,\n} as const\n\nexport const Operator = {\n Pass: 0,\n And: 1,\n Or: 2,\n Nor: 3,\n Matches: 5,\n ArraySome: 6,\n ArrayEvery: 7,\n ArraySubset: 8,\n EqualToAvatar: 15,\n EqualTo: 16,\n GreaterThan: 17,\n LessThan: 18,\n SignedIntGreaterThan: 19,\n SignedIntLessThan: 20,\n Bitmask: 21,\n Custom: 22,\n WithinAllowance: 28,\n EtherWithinAllowance: 29,\n CallWithinAllowance: 30,\n} as const\n\n/**\n * Canonical adapter addresses — deterministic CREATE2 (factory\n * 0x4e59b44847b379578588920cA78FbF26c0B4956C, salt\n * keccak256(\"panoptic.zodiac-modules.v1\")), so they depend only on the\n * bytecode: same on every chain, deployer-independent, verifiable with\n * `cast code` against a local `forge build`. The adapters are stateless and\n * immutable (no owner/storage/upgradability). Recompute via\n * `forge script scripts/DeployAdapters.s.sol` after any source change.\n */\nexport const CANONICAL_ADAPTERS = {\n RollerCondition: '0x7b2402F7Ff7fFe0970D383dE1C6AF8892B87523a',\n SizeAdjusterCondition: '0x72494B2A0C5a69Dd0154386c2F4Af0b38a24C400',\n SfpmSwapCondition: '0x9321DdE7242dFcFac61D1b2d357e88FC4302eAF7',\n} as const\n\nexport const ExecutionOptions = {\n None: 0,\n Send: 1,\n DelegateCall: 2,\n Both: 3,\n} as const\n","import { type Hex, keccak256, toBytes, toFunctionSelector } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, customCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\n\n/** PanopticPool.dispatch — TokenId is a uint256 value type. */\nexport const DISPATCH_SELECTOR = toFunctionSelector(\n 'dispatch(uint256[],uint256[],uint128[],int24[3][],bool,uint256)',\n)\n\n/** Deterministic per-role keys; override via env/config if a Safe needs several instances. */\nexport function roleKey(name: string): Hex {\n return keccak256(toBytes(`panoptic.role.${name}.v1`))\n}\n\n/**\n * ConditionFlat tree for a dispatch-scoped role whose whole authorization\n * logic lives in an on-chain `ICustomCondition` adapter (Operator.Custom).\n *\n * The Custom node is attached to arg0 (`positionIdList`): Roles hands the\n * adapter the FULL calldata regardless of attachment point, and the adapter\n * decodes `positionIdList`/`positionSizes` itself. The remaining nodes are the\n * structural template `Integrity.sol` requires (Calldata and Array nodes must\n * describe their children; see buildLoanOnlyDispatchConditions for the shape).\n */\nexport function buildDispatchCustomConditions(\n adapter: `0x${string}`,\n extra: Hex = '0x',\n): ConditionFlat[] {\n const compValue = customCompValue(adapter, extra)\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdList — carries the Custom adapter check\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Custom, compValue },\n // 2: arg1 finalPositionIdList\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 3: arg2 positionSizes\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 4: arg3 tickAndSpreadLimits (int24[3][])\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg5 builderCode\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7-9: array element types\n { parent: 1, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 2, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 3, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 10: tickAndSpreadLimits element (int24[3] — statically encoded, 3 words)\n { parent: 4, paramType: ParameterType.Tuple, operator: Operator.Pass, compValue: '0x' },\n // 11-13: int24[3] members\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n/** assignRoles → scopeTarget → scopeFunction steps for an adapter-gated dispatch role. */\nexport function buildDispatchCustomRoleSteps(params: {\n roleName: string\n roleKey: Hex\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}`\n extra?: Hex\n}): ScopeStep[] {\n const { roleName, member, pool, adapter, extra } = params\n return [\n {\n name: `assignRoles(${roleName} member)`,\n functionName: 'assignRoles',\n args: [member, [params.roleKey], [true]],\n },\n { name: 'scopeTarget(pool)', functionName: 'scopeTarget', args: [params.roleKey, pool] },\n {\n name: `scopeFunction(dispatch, ${roleName} custom adapter)`,\n functionName: 'scopeFunction',\n args: [\n params.roleKey,\n pool,\n DISPATCH_SELECTOR,\n buildDispatchCustomConditions(adapter, extra),\n ExecutionOptions.None,\n ],\n },\n ]\n}\n","import type { Hex } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport type { ConditionFlat } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\nimport { DISPATCH_SELECTOR, roleKey } from './dispatchCustomRole'\n\n/**\n * Deleverager role: burn the Safe's existing positions only — never mint.\n *\n * Enforced with plain static conditions, no adapter and no state oracle:\n * every `positionSizes` entry must be 0. A size-0 entry either burns a held\n * position or reverts the whole dispatch — a size-0 mint is impossible\n * (option legs trip `ChunkHasZeroLiquidity` in the SFPM; pure-loan tokenIds\n * die in the end-of-dispatch solvency pass / positions-hash validation).\n *\n * Trade-off vs an oracle-based check: the key cannot settle premium (settle\n * requires `sizes[i] == storedSize`, unknowable pre-execution). Strictly a\n * risk-reduction key: safe for a watchdog keeper or dead-man's-switch.\n */\nexport const DELEVERAGER_ROLE_KEY = roleKey('deleverager')\n\nconst ZERO_WORD = `0x${'0'.repeat(64)}` as Hex\n\nexport function buildDeleveragerDispatchConditions(): ConditionFlat[] {\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdList — unconstrained (any held tokenId may be burnt)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 2: arg1 finalPositionIdList\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 3: arg2 positionSizes — EVERY entry must be 0 (burn-or-revert)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.ArrayEvery, compValue: '0x' },\n // 4: arg3 tickAndSpreadLimits (int24[3][])\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg5 builderCode\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7-9: array element types\n { parent: 1, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 2, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n {\n parent: 3,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: ZERO_WORD,\n },\n // 10: tickAndSpreadLimits element (int24[3] — statically encoded, 3 words)\n { parent: 4, paramType: ParameterType.Tuple, operator: Operator.Pass, compValue: '0x' },\n // 11-13: int24[3] members\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\nexport function buildDeleveragerRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n roleKey?: Hex\n}): ScopeStep[] {\n const key = params.roleKey ?? DELEVERAGER_ROLE_KEY\n return [\n {\n name: 'assignRoles(deleverager member)',\n functionName: 'assignRoles',\n args: [params.member, [key], [true]],\n },\n { name: 'scopeTarget(pool)', functionName: 'scopeTarget', args: [key, params.pool] },\n {\n name: 'scopeFunction(dispatch, burn-only: all sizes == 0)',\n functionName: 'scopeFunction',\n args: [\n key,\n params.pool,\n DISPATCH_SELECTOR,\n buildDeleveragerDispatchConditions(),\n ExecutionOptions.None,\n ],\n },\n ]\n}\n","import { type Address, type Hex, toFunctionSelector, zeroAddress } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, addressEqualCompValue, customCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\n\n/**\n * Liquidator role: scopes ONLY `PanopticLiquidator.liquidate(LiquidateParams)`\n * on the helper. `initializePool`, `execute`, `multicall`, `sweep`, and\n * `quoteLiquidation` are never scoped.\n *\n * Split of enforcement (must match the LiquidatorCondition contract and the\n * hand-encoded tree in zodiac-modules/test/LiquidatorRolesFork.t.sol, which is\n * the golden spec for this builder):\n * - THIS TREE pins the static fields: pool ∈ allowlist, account ∉ {safe,\n * helper}, swap targets ∈ {router, 0}, premia flags = 0, and — via\n * ExecutionOptions.None — zero outer msg.value (attached value is excluded\n * from the helper's minDelta floors, so it must never flow through the\n * role; native shortfalls are funded via nativeFundingAmount instead).\n * - THE ADAPTER (Custom node on positionIdListTo; Roles hands it full\n * calldata) enforces the cross-field invariants: flash/swap tokens ∈ pool\n * underlyings, swap groups zeroed together or exact nonzero amounts,\n * nativeFundingAmount only on native pools, floors ≥ 0 with one positive.\n */\nexport const LIQUIDATE_SELECTOR = toFunctionSelector(\n 'liquidate((address,address,uint256[],uint256,address,uint256,uint256,address,bytes,address,uint256,address,bytes,address,uint256,int256,int256))',\n)\n\nexport interface LiquidatorConditionsParams {\n /** Deployed LiquidatorCondition adapter. */\n adapter: Address\n /** The Safe (avatar) — excluded as a liquidation target. */\n safe: Address\n /** The PanopticLiquidator helper — also excluded as a target. */\n helper: Address\n /** Pinned swap router (Uniswap Universal Router). */\n router: Address\n /** PanopticPool allowlist (at least one). */\n pools: readonly Address[]\n /** Trailing 12 bytes of the Custom compValue (unused by the adapter). */\n extra?: Hex\n}\n\n/** BFS ConditionFlat tree over liquidate's single LiquidateParams tuple. */\nexport function buildLiquidatorConditions(params: LiquidatorConditionsParams): ConditionFlat[] {\n const { adapter, safe, helper, router, pools, extra = '0x' } = params\n if (pools.length === 0) throw new Error('liquidator role needs at least one pool')\n\n const pass = (parent: number, paramType: ConditionFlat['paramType']): ConditionFlat => ({\n parent,\n paramType,\n operator: Operator.Pass,\n compValue: '0x',\n })\n\n const conditions: ConditionFlat[] = [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: the LiquidateParams tuple\n { parent: 0, paramType: ParameterType.Tuple, operator: Operator.Matches, compValue: '0x' },\n // 2: pool — Or(EqualTo(pool_i)) allowlist\n { parent: 1, paramType: ParameterType.None, operator: Operator.Or, compValue: '0x' },\n // 3: account — Nor(EqualTo(safe), EqualTo(helper))\n { parent: 1, paramType: ParameterType.None, operator: Operator.Nor, compValue: '0x' },\n // 4: positionIdListTo — carries the Custom adapter (full-calldata hook)\n {\n parent: 1,\n paramType: ParameterType.Array,\n operator: Operator.Custom,\n compValue: customCompValue(adapter, extra),\n },\n // 5: usePremiaAsCollateral — pinned to zero\n {\n parent: 1,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: '0x0000000000000000000000000000000000000000000000000000000000000000',\n },\n pass(1, ParameterType.Static), // 6: flashToken\n pass(1, ParameterType.Static), // 7: flashAmount\n pass(1, ParameterType.Static), // 8: nativeFundingAmount\n // 9: preSwapTarget — Or(EqualTo(router), EqualTo(0))\n { parent: 1, paramType: ParameterType.None, operator: Operator.Or, compValue: '0x' },\n pass(1, ParameterType.Dynamic), // 10: preSwapCallData\n pass(1, ParameterType.Static), // 11: preSwapTokenIn\n pass(1, ParameterType.Static), // 12: preSwapAmountIn\n // 13: swapTarget — Or(EqualTo(router), EqualTo(0))\n { parent: 1, paramType: ParameterType.None, operator: Operator.Or, compValue: '0x' },\n pass(1, ParameterType.Dynamic), // 14: swapCallData\n pass(1, ParameterType.Static), // 15: swapTokenIn\n pass(1, ParameterType.Static), // 16: swapAmountIn\n pass(1, ParameterType.Static), // 17: minDelta0\n pass(1, ParameterType.Static), // 18: minDelta1\n ]\n\n // Children (parents nondecreasing): pool allowlist under 2.\n for (const pool of pools) {\n conditions.push({\n parent: 2,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(pool),\n })\n }\n // account exclusions under 3.\n for (const excluded of [safe, helper]) {\n conditions.push({\n parent: 3,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(excluded),\n })\n }\n // positionIdListTo element template under 4.\n conditions.push(pass(4, ParameterType.Static))\n // swap target pins under 9 and 13.\n for (const parent of [9, 13]) {\n conditions.push({\n parent,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(router),\n })\n conditions.push({\n parent,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(zeroAddress),\n })\n }\n\n return conditions\n}\n\n/** assignRoles → scopeTarget → scopeFunction for the liquidator role. */\nexport function buildLiquidatorRoleSteps(\n params: LiquidatorConditionsParams & { roleKey: Hex; member: Address },\n): ScopeStep[] {\n return [\n {\n name: 'assignRoles(liquidator member)',\n functionName: 'assignRoles',\n args: [params.member, [params.roleKey], [true]],\n },\n {\n name: 'scopeTarget(helper)',\n functionName: 'scopeTarget',\n args: [params.roleKey, params.helper],\n },\n {\n name: 'scopeFunction(liquidate, liquidator conditions)',\n functionName: 'scopeFunction',\n args: [\n params.roleKey,\n params.helper,\n LIQUIDATE_SELECTOR,\n buildLiquidatorConditions(params),\n // No Send: zero outer msg.value is load-bearing (see module docblock).\n ExecutionOptions.None,\n ],\n },\n ]\n}\n","/**\n * Bit-field masks over the Panoptic v2 tokenId layout, mirroring\n * `contracts/lib/TokenIdMasks.sol` (kept in lockstep by golden unit tests).\n *\n * Layout (packages/panoptic-v2-core/contracts/types/TokenId.sol):\n * - bits [0, 64) poolId\n * - each leg is 48 bits, starting at 64 + legIndex*48, packing\n * asset(+0,1b) | optionRatio(+1,7b) | isLong(+8) | tokenType(+9)\n * | riskPartner(+10,2b) | strike(+12,24b) | width(+36,12b)\n */\n\nconst POOL_ID_SIZE = 64n\nconst LEG_SIZE = 48n\nconst MAX_LEGS = 4n\n\n/** Mask with 1-bits over a `bits`-wide field at `fieldOffset` in every leg. */\nexport function legFieldMask(fieldOffset: bigint, bits: bigint): bigint {\n const field = (1n << bits) - 1n\n let mask = 0n\n for (let leg = 0n; leg < MAX_LEGS; leg++) {\n mask |= field << (POOL_ID_SIZE + leg * LEG_SIZE + fieldOffset)\n }\n return mask\n}\n\n/** Mask with 1-bits over every leg's 12-bit width field. */\nexport function loanWidthFieldsMask(): bigint {\n return legFieldMask(36n, 12n)\n}\n\n/** Mask with 1-bits over every leg's 24-bit strike field. */\nexport function strikeFieldsMask(): bigint {\n return legFieldMask(12n, 24n)\n}\n\n/** Mask with 1-bits over every leg's 7-bit optionRatio field. */\nexport function optionRatioFieldsMask(): bigint {\n return legFieldMask(1n, 7n)\n}\n\n/** True iff every leg of the tokenId has width == 0 (a pure loan/credit). */\nexport function isPureLoanTokenId(tokenId: bigint): boolean {\n return (tokenId & loanWidthFieldsMask()) === 0n\n}\n\n/** The 32-byte mask + expected value for a Zodiac Roles v2 Bitmask condition. */\nexport function loanBitmaskCondition(): { mask: `0x${string}`; expected: `0x${string}` } {\n const mask = loanWidthFieldsMask()\n const toBytes32 = (v: bigint) => `0x${v.toString(16).padStart(64, '0')}` as `0x${string}`\n return { mask: toBytes32(mask), expected: toBytes32(0n) }\n}\n","import type { Hex } from 'viem'\n\nimport { type ConditionFlat, addressEqualCompValue } from '../conditions'\nimport { Operator, ParameterType } from '../constants'\nimport { loanBitmaskCondition } from '../tokenIdMask'\n\n/**\n * Loan-only hedger role scope (migrated from apps/hedger-bot scripts/lib).\n *\n * ⚠️ VALIDATE ON A FORK BEFORE MAINNET. The ConditionFlat encoding below is\n * security-critical. Dry-run `scopeFunction` on an anvil/Tenderly fork and\n * assert that the role CAN mint/burn a pure width=0 loan via dispatch and\n * CANNOT dispatch a tokenId with any width>0 leg.\n *\n * The scope constrains PanopticPool.dispatch(positionIdList, finalPositionIdList,\n * positionSizes, tickAndSpreadLimits, usePremiaAsCollateral, builderCode) so that\n * EVERY element of `positionIdList` (arg 0 — the tokenIds actually minted/burned)\n * is a pure loan: `tokenId & widthFieldsMask == 0`. All other args pass freely;\n * `finalPositionIdList` is intentionally NOT constrained (it legitimately contains\n * the user's option positions that remain open).\n */\n\n/**\n * Bitmask compValue layout (Roles v2 `PermissionChecker._bitmask`): a 32-byte\n * word packing `uint16 shift | bytes15 mask | bytes15 expected`, where `shift`\n * is a BYTE offset from the start (left / most-significant end) of the value\n * and the 15-byte mask is applied LEFT-aligned to `bytes32(value[shift:])`.\n *\n * The four 12-bit width fields span tokenId bits 100–255 (leg 3's width sits in\n * the top two bytes), which is wider than one 15-byte window. So the loan\n * constraint is expressed as TWO windows AND-ed together:\n * - shift 0: tokenId bytes 0..14 (bits 136–255) — covers legs 1, 2, 3\n * - shift 17: tokenId bytes 17..31 (bits 0–119) — covers leg 0\n * Bytes 15–16 (bits 120–135) contain no width bits.\n */\nexport const LOAN_BITMASK_WINDOW_SHIFTS = [0, 17] as const\n\nexport function loanBitmaskCompValueAt(shiftBytes: number): Hex {\n const { mask } = loanBitmaskCondition()\n const maskBytes = mask.slice(2) // 64 hex chars, byte 0 first\n const window = maskBytes.slice(shiftBytes * 2, shiftBytes * 2 + 30).padEnd(30, '0')\n const shift = shiftBytes.toString(16).padStart(4, '0')\n return `0x${shift}${window}${'0'.repeat(30)}` as Hex // expected = all zeros\n}\n\n/**\n * Build the ConditionFlat[] tree scoping dispatch to loan-only positionIdList.\n *\n * Roles v2 `Integrity.sol` requirements honored here:\n * - BFS order: parent indices must be non-decreasing (NotBFS).\n * - Every Array-typed node needs >=1 child describing the element type\n * (UnsuitableChildCount); ArrayEvery needs exactly 1.\n * - And nodes use ParameterType.None and an empty compValue.\n */\nexport function buildLoanOnlyDispatchConditions(): ConditionFlat[] {\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdList — every element must satisfy subtree [7]\n { parent: 0, paramType: ParameterType.Array, operator: Operator.ArrayEvery, compValue: '0x' },\n // 2: arg1 finalPositionIdList — unconstrained (holds user option positions)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 3: arg2 positionSizes\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 4: arg3 tickAndSpreadLimits (int24[3][])\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg5 builderCode\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7: positionIdList element (uint256 tokenId) — both width windows must be zero\n { parent: 1, paramType: ParameterType.None, operator: Operator.And, compValue: '0x' },\n // 8: finalPositionIdList element\n { parent: 2, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 9: positionSizes element\n { parent: 3, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 10: tickAndSpreadLimits element (int24[3] — statically encoded, 3 words)\n { parent: 4, paramType: ParameterType.Tuple, operator: Operator.Pass, compValue: '0x' },\n // 11-12: the two AND-ed bitmask windows over the tokenId\n {\n parent: 7,\n paramType: ParameterType.Static,\n operator: Operator.Bitmask,\n compValue: loanBitmaskCompValueAt(LOAN_BITMASK_WINDOW_SHIFTS[0]),\n },\n {\n parent: 7,\n paramType: ParameterType.Static,\n operator: Operator.Bitmask,\n compValue: loanBitmaskCompValueAt(LOAN_BITMASK_WINDOW_SHIFTS[1]),\n },\n // 13-15: int24[3] members\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n// ---------------------------------------------------------------------------\n// Cross-pool scope: MultiSend unwrap + per-inner-call scopes.\n//\n// The bot batches [CT.withdraw, router.execute, CT.deposit] via Safe MultiSend,\n// routed through Roles with a MultiSend unwrapper registered so each inner call\n// is re-checked against these scopes. Selectors below are the inner targets.\n// ---------------------------------------------------------------------------\n\n/** ERC4626 CollateralTracker withdraw(uint256 assets, address receiver, address owner). */\nexport const WITHDRAW_SELECTOR = '0xb460af94' as const\n/** ERC4626 CollateralTracker deposit(uint256 assets, address receiver). */\nexport const DEPOSIT_SELECTOR = '0x6e553f65' as const\n/** Uniswap UniversalRouter execute(bytes,bytes[],uint256). */\nexport const EXECUTE_SELECTOR = '0x3593564c' as const\n\n/**\n * Scope CT.withdraw so tokens can only be pulled to the Safe: receiver == owner\n * == Safe. Without this, a compromised bot key could withdraw the Safe's\n * collateral to an arbitrary address — this is the critical cross-pool scope.\n */\nexport function buildWithdrawConditions(safe: `0x${string}`): ConditionFlat[] {\n const safeEq = addressEqualCompValue(safe)\n return [\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' }, // assets\n { parent: 0, paramType: ParameterType.Static, operator: Operator.EqualTo, compValue: safeEq }, // receiver\n { parent: 0, paramType: ParameterType.Static, operator: Operator.EqualTo, compValue: safeEq }, // owner\n ]\n}\n\n/** Scope CT.deposit so the shares are credited to the Safe: receiver == Safe. */\nexport function buildDepositConditions(safe: `0x${string}`): ConditionFlat[] {\n return [\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' }, // assets\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(safe),\n }, // receiver\n ]\n}\n","import { type Hex, toFunctionSelector } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, addressEqualCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\nimport { roleKey } from './dispatchCustomRole'\n\n/**\n * Maintenance role: full `dispatchFrom` access — settle premium on, force-\n * exercise, and liquidate third-party accounts using the Safe's capital.\n * No adapter needed; the pool itself hash-validates the position lists.\n *\n * The only pin is `account != Safe` (Nor(EqualTo(safe))) so the maintenance\n * key can never force-exercise or liquidate the Safe's own book.\n * `positionIdListFrom` (the caller's solvency list) is intentionally\n * unconstrained — the Safe may legitimately hold option positions.\n *\n * dispatchFrom is payable ⇒ ExecutionOptions.Send.\n */\nexport const MAINTENANCE_ROLE_KEY = roleKey('maintenance')\n\n/** LeftRightUnsigned is a uint256 value type. */\nexport const DISPATCH_FROM_SELECTOR = toFunctionSelector(\n 'dispatchFrom(uint256[],address,uint256[],uint256[],uint256)',\n)\n\nexport function buildDispatchFromConditions(safe: `0x${string}`): ConditionFlat[] {\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdListFrom (caller solvency list)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 2: arg1 account — anything but the Safe itself\n { parent: 0, paramType: ParameterType.None, operator: Operator.Nor, compValue: '0x' },\n // 3: arg2 positionIdListTo\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 4: arg3 positionIdListToFinal\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral (LeftRightUnsigned)\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg0 element\n { parent: 1, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7: Nor child — account == Safe (negated by the parent)\n {\n parent: 2,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(safe),\n },\n // 8: arg2 element\n { parent: 3, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 9: arg3 element\n { parent: 4, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\nexport function buildMaintenanceRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n safe: `0x${string}`\n roleKey?: Hex\n}): ScopeStep[] {\n const key = params.roleKey ?? MAINTENANCE_ROLE_KEY\n return [\n {\n name: 'assignRoles(maintenance member)',\n functionName: 'assignRoles',\n args: [params.member, [key], [true]],\n },\n { name: 'scopeTarget(pool)', functionName: 'scopeTarget', args: [key, params.pool] },\n {\n name: 'scopeFunction(dispatchFrom, account != safe, Send)',\n functionName: 'scopeFunction',\n args: [\n key,\n params.pool,\n DISPATCH_FROM_SELECTOR,\n buildDispatchFromConditions(params.safe),\n ExecutionOptions.Send,\n ],\n },\n ]\n}\n","import type { Hex } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { sizeCapExtra } from '../conditions'\nimport { buildDispatchCustomRoleSteps, roleKey } from './dispatchCustomRole'\n\n/**\n * Roller role: close one position and reopen it identical-except-strike (roll\n * out-of-range positions back into range). Enforced on-chain by the stateless\n * `RollerCondition` adapter (strike-mask equality + one-burn-one-mint shape).\n *\n * The reopened size is bounded by `sizeCap` (0n = uncapped, leaving only\n * dispatch's solvency check as the ceiling) — there is no pre-state oracle,\n * so \"same size as before\" cannot be enforced.\n */\nexport const ROLLER_ROLE_KEY = roleKey('roller')\n\nexport function buildRollerRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed RollerCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}): ScopeStep[] {\n return buildDispatchCustomRoleSteps({\n roleName: 'roller',\n roleKey: params.roleKey ?? ROLLER_ROLE_KEY,\n member: params.member,\n pool: params.pool,\n adapter: params.adapter,\n extra: sizeCapExtra(params.sizeCap ?? 0n),\n })\n}\n","import { type Hex, toFunctionSelector, zeroHash } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, addressEqualCompValue, customCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\nimport { buildDepositConditions, DEPOSIT_SELECTOR } from './loanHedger'\n\n/** SFPM `multicall(bytes[])`. */\nexport const MULTICALL_SELECTOR = toFunctionSelector('multicall(bytes[])')\n/** Safe `MultiSend.multiSend(bytes)` — the batch entrypoint the Roles unwrapper is registered for. */\nexport const MULTISEND_SELECTOR = toFunctionSelector('multiSend(bytes)')\n/** WETH9 `deposit()` (wrap native ETH → WETH; payable). */\nexport const WETH_DEPOSIT_SELECTOR = toFunctionSelector('deposit()')\n/** WETH9 `withdraw(uint256)` (unwrap WETH → native ETH). */\nexport const WETH_WITHDRAW_SELECTOR = toFunctionSelector('withdraw(uint256)')\n/** Panoptic CT solvency-aware withdrawal used while the Safe has open positions. */\nexport const WITHDRAW_WITH_POSITIONS_SELECTOR = toFunctionSelector(\n 'withdraw(uint256,address,address,uint256[],bool)',\n)\n\n/**\n * Scope the solvency-aware CT withdrawal to the Safe and to the conservative\n * `usePremiaAsCollateral=false` mode. The position list remains dynamic because\n * it must exactly match the Safe's live Panoptic portfolio.\n */\nexport function buildWithdrawWithPositionsConditions(safe: `0x${string}`): ConditionFlat[] {\n const safeEq = addressEqualCompValue(safe)\n return [\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: safeEq,\n },\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: safeEq,\n },\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: zeroHash,\n },\n { parent: 4, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n/**\n * Encode a `uint64` SFPM poolId as the `bytes12 extra` of the SfpmSwapCondition\n * compValue. The adapter reads it as `uint64(uint96(extra))`, i.e. big-endian\n * right-aligned in the 12 bytes (same convention as `sizeCapExtra`).\n */\nexport function sfpmPoolIdPinExtra(poolId: bigint): Hex {\n if (poolId <= 0n || poolId >= 1n << 64n) {\n throw new Error(`sfpmPoolIdPinExtra: poolId must be a nonzero uint64, got ${poolId}`)\n }\n return `0x${poolId.toString(16).padStart(24, '0')}` as Hex\n}\n\n/**\n * ConditionFlat tree scoping `SFPM.multicall(bytes[])` to the SfpmSwapCondition\n * adapter. The whole check lives in the adapter (Operator.Custom on arg0); the\n * other nodes are the structural template Integrity.sol requires — a Calldata\n * root and the `bytes[]` array with its element type.\n */\nexport function buildSfpmSwapConditions(\n adapter: `0x${string}`,\n poolIdPin: bigint,\n): ConditionFlat[] {\n const compValue = customCompValue(adapter, sfpmPoolIdPinExtra(poolIdPin))\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 bytes[] — carries the Custom adapter check\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Custom, compValue },\n // 2: array element type (bytes → Dynamic)\n { parent: 1, paramType: ParameterType.Dynamic, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n/**\n * Steps that extend an existing bot role with the off-venue SFPM swap surface.\n *\n * The bot batches `[CT(tokenIn).withdraw(with position list),\n * SFPM.multicall(mint+burn), CT(tokenOut).deposit]`\n * via Safe MultiSend, routed through Roles with a MultiSend unwrapper registered\n * so each inner call is re-checked against the scopes below.\n *\n * Reuses the existing bot `roleKey` (no `assignRoles`) — `execTransactionWithRole`\n * authorizes one role per tx and the batch mixes CT + SFPM calls, so all inner\n * calls must live under one key. The loan-only dispatch scope on that role is\n * orthogonal and unchanged.\n *\n * `setTransactionUnwrapper` is **modifier-global**, not per-role: registering it\n * affects every role on the modifier.\n */\nexport function buildSfpmSwapVenueSteps(params: {\n roleKey: Hex\n safe: `0x${string}`\n sfpm: `0x${string}`\n /** CollateralTracker for token0. */\n collateralTracker0: `0x${string}`\n /** CollateralTracker for token1. */\n collateralTracker1: `0x${string}`\n /** Deployed SfpmSwapCondition (stateless, canonical per chain). */\n adapter: `0x${string}`\n /** The registered `uint64` SFPM poolId of the allowed swap pool. */\n poolIdPin: bigint\n /** Safe MultiSendCallOnly address (the batch entrypoint). */\n multiSendCallOnly: `0x${string}`\n /** Canonical MultiSend unwrapper adapter for this chain. */\n multiSendUnwrapper: `0x${string}`\n /**\n * Which collateral asset is native ETH (its CT `deposit` is payable and needs\n * value; the batch wraps/unwraps around the swap). `'none'` for two-ERC20 pools.\n */\n nativeCollateral?: 'token0' | 'token1' | 'none'\n /** WETH9 address — required when `nativeCollateral` is not `'none'`. */\n weth9?: `0x${string}`\n}): ScopeStep[] {\n const {\n roleKey,\n safe,\n sfpm,\n collateralTracker0,\n collateralTracker1,\n adapter,\n poolIdPin,\n multiSendCallOnly,\n multiSendUnwrapper,\n } = params\n const nativeCollateral = params.nativeCollateral ?? 'none'\n\n // The native-ETH CT's deposit is payable (deposit by sending value), so it\n // needs ExecutionOptions.Send; ERC20 CT deposits take no value.\n const depositOptions = (side: 'token0' | 'token1') =>\n nativeCollateral === side ? ExecutionOptions.Send : ExecutionOptions.None\n\n const scopeCollateralTracker = (\n ct: `0x${string}`,\n side: 'token0' | 'token1',\n label: string,\n ): ScopeStep[] => [\n { name: `scopeTarget(${label})`, functionName: 'scopeTarget', args: [roleKey, ct] },\n {\n name: `scopeFunction(${label}.withdraw(with positions) → Safe)`,\n functionName: 'scopeFunction',\n args: [\n roleKey,\n ct,\n WITHDRAW_WITH_POSITIONS_SELECTOR,\n buildWithdrawWithPositionsConditions(safe),\n ExecutionOptions.None,\n ],\n },\n {\n name: `scopeFunction(${label}.deposit → Safe)`,\n functionName: 'scopeFunction',\n args: [roleKey, ct, DEPOSIT_SELECTOR, buildDepositConditions(safe), depositOptions(side)],\n },\n ]\n\n const steps: ScopeStep[] = [\n {\n name: 'setTransactionUnwrapper(MultiSend)',\n functionName: 'setTransactionUnwrapper',\n args: [multiSendCallOnly, MULTISEND_SELECTOR, multiSendUnwrapper],\n },\n { name: 'scopeTarget(SFPM)', functionName: 'scopeTarget', args: [roleKey, sfpm] },\n {\n name: 'scopeFunction(SFPM.multicall, SfpmSwapCondition)',\n functionName: 'scopeFunction',\n args: [\n roleKey,\n sfpm,\n MULTICALL_SELECTOR,\n buildSfpmSwapConditions(adapter, poolIdPin),\n ExecutionOptions.None,\n ],\n },\n ...scopeCollateralTracker(collateralTracker0, 'token0', 'CT0'),\n ...scopeCollateralTracker(collateralTracker1, 'token1', 'CT1'),\n ]\n\n // Bridge native ETH ↔ WETH around the v3 swap when a collateral asset is native.\n if (nativeCollateral !== 'none') {\n if (params.weth9 === undefined) {\n throw new Error('buildSfpmSwapVenueSteps: weth9 is required when nativeCollateral is set')\n }\n steps.push(\n { name: 'scopeTarget(WETH9)', functionName: 'scopeTarget', args: [roleKey, params.weth9] },\n {\n name: 'allowFunction(WETH9.deposit, Send)',\n functionName: 'allowFunction',\n args: [roleKey, params.weth9, WETH_DEPOSIT_SELECTOR, ExecutionOptions.Send],\n },\n {\n name: 'allowFunction(WETH9.withdraw)',\n functionName: 'allowFunction',\n args: [roleKey, params.weth9, WETH_WITHDRAW_SELECTOR, ExecutionOptions.None],\n },\n )\n }\n\n return steps\n}\n","import type { Hex } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { sizeCapExtra } from '../conditions'\nimport { buildDispatchCustomRoleSteps, roleKey } from './dispatchCustomRole'\n\n/**\n * Size-adjuster role: replace one position with an identical-except-optionRatio\n * one — reduce a short whose long side was purchased, or grow a long as more\n * options are sold. Enforced on-chain by the stateless `SizeAdjusterCondition`\n * adapter (ratio-mask equality + one-burn-one-mint shape).\n *\n * Without a pre-state oracle the relative notional cap is not enforceable;\n * set `sizeCap` (uint96, 0n = uncapped) to bound the mint size absolutely.\n */\nexport const SIZE_ADJUSTER_ROLE_KEY = roleKey('size-adjuster')\n\nexport function buildSizeAdjusterRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed SizeAdjusterCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}): ScopeStep[] {\n return buildDispatchCustomRoleSteps({\n roleName: 'size-adjuster',\n roleKey: params.roleKey ?? SIZE_ADJUSTER_ROLE_KEY,\n member: params.member,\n pool: params.pool,\n adapter: params.adapter,\n extra: sizeCapExtra(params.sizeCap ?? 0n),\n })\n}\n"],"mappings":";;;;AACA,MAAa,aAAa;CACxB;EACE,MAAM;EACN,MAAM;EACN,iBAAiB;EACjB,QAAQ;GACN;IAAE,MAAM;IAAU,MAAM;GAAW;GACnC;IAAE,MAAM;IAAY,MAAM;GAAa;GACvC;IAAE,MAAM;IAAY,MAAM;GAAU;EACrC;EACD,SAAS,CAAE;CACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,iBAAiB;EACjB,QAAQ,CACN;GAAE,MAAM;GAAW,MAAM;EAAW,GACpC;GAAE,MAAM;GAAiB,MAAM;EAAW,CAC3C;EACD,SAAS,CAAE;CACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,iBAAiB;EACjB,QAAQ;GACN;IAAE,MAAM;IAAW,MAAM;GAAW;GACpC;IAAE,MAAM;IAAiB,MAAM;GAAW;GAC1C;IAAE,MAAM;IAAY,MAAM;GAAU;GACpC;IACE,MAAM;IACN,MAAM;IACN,YAAY;KACV;MAAE,MAAM;MAAU,MAAM;KAAS;KACjC;MAAE,MAAM;MAAa,MAAM;KAAS;KACpC;MAAE,MAAM;MAAY,MAAM;KAAS;KACnC;MAAE,MAAM;MAAa,MAAM;KAAS;IACrC;GACF;GACD;IAAE,MAAM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,OAAM,IAAI,MAAM;AAElB,QAAM,KACJ;GAAE,MAAM;GAAsB,cAAc;GAAe,MAAM,CAACA,WAAS,OAAO,KAAM;EAAE,GAC1F;GACE,MAAM;GACN,cAAc;GACd,MAAM;IAACA;IAAS,OAAO;IAAO;IAAuB,iBAAiB;GAAK;EAC5E,GACD;GACE,MAAM;GACN,cAAc;GACd,MAAM;IAACA;IAAS,OAAO;IAAO;IAAwB,iBAAiB;GAAK;EAC7E,EACF;CACF;AAED,QAAO;AACR;;;;;;;;;;;;;ACpMD,MAAa,yBAAyB,QAAQ,gBAAgB;AAE9D,SAAgB,2BAA2BE,QAM3B;AACd,QAAO,6BAA6B;EAClC,UAAU;EACV,SAAS,OAAO,WAAW;EAC3B,QAAQ,OAAO;EACf,MAAM,OAAO;EACb,SAAS,OAAO;EAChB,OAAO,aAAa,OAAO,WAAW,GAAG;CAC1C,EAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":["params: {\n publicClient: ScopeStepsPublicClient\n walletClient: ScopeStepsWalletClient\n rolesModifier: `0x${string}`\n steps: ScopeStep[]\n log?: (line: string) => void\n /**\n * EIP-1559 fee overrides applied to every tx. Pass a NON-ZERO\n * `maxPriorityFeePerGas` — some RPC estimators return a zero tip, which leaves\n * txs un-prioritised and slow to include.\n */\n fees?: { maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint }\n /** Receipt-wait timeout (ms). */\n timeoutMs?: number\n}","v: string","addr: `0x${string}`","adapter: `0x${string}`","extra: Hex","cap: bigint","name: string","adapter: `0x${string}`","extra: Hex","params: {\n roleName: string\n roleKey: Hex\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}`\n extra?: Hex\n}","params: {\n member: `0x${string}`\n pool: `0x${string}`\n roleKey?: Hex\n}","params: LiquidatorConditionsParams","parent: number","paramType: ConditionFlat['paramType']","conditions: ConditionFlat[]","params: LiquidatorConditionsParams & { roleKey: Hex; member: Address }","fieldOffset: bigint","bits: bigint","tokenId: bigint","v: bigint","shiftBytes: number","safe: `0x${string}`","safe: `0x${string}`","params: {\n member: `0x${string}`\n pool: `0x${string}`\n safe: `0x${string}`\n roleKey?: Hex\n}","params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed RollerCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}","safe: `0x${string}`","poolId: bigint","adapter: `0x${string}`","poolIdPin: bigint","params: {\n roleKey: Hex\n safe: `0x${string}`\n sfpm: `0x${string}`\n /** CollateralTracker for token0. */\n collateralTracker0: `0x${string}`\n /** CollateralTracker for token1. */\n collateralTracker1: `0x${string}`\n /** Deployed SfpmSwapCondition (stateless, canonical per chain). */\n adapter: `0x${string}`\n /** The registered `uint64` SFPM poolId of the allowed swap pool. */\n poolIdPin: bigint\n /** Safe MultiSendCallOnly address (the batch entrypoint). */\n multiSendCallOnly: `0x${string}`\n /** Canonical MultiSend unwrapper adapter for this chain. */\n multiSendUnwrapper: `0x${string}`\n /**\n * Which collateral asset is native ETH (its CT `deposit` is payable and needs\n * value; the batch wraps/unwraps around the swap). `'none'` for two-ERC20 pools.\n */\n nativeCollateral?: 'token0' | 'token1' | 'none'\n /** WETH9 address — required when `nativeCollateral` is not `'none'`. */\n weth9?: `0x${string}`\n}","side: 'token0' | 'token1'","ct: `0x${string}`","label: string","roleKey","steps: ScopeStep[]","params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed SizeAdjusterCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}"],"sources":["../../src/zodiac/rolesAbi.ts","../../src/zodiac/applySteps.ts","../../src/zodiac/conditions.ts","../../src/zodiac/constants.ts","../../src/zodiac/roles/dispatchCustomRole.ts","../../src/zodiac/roles/deleverager.ts","../../src/zodiac/roles/liquidator.ts","../../src/zodiac/tokenIdMask.ts","../../src/zodiac/roles/loanHedger.ts","../../src/zodiac/roles/maintenance.ts","../../src/zodiac/roles/roller.ts","../../src/zodiac/roles/sfpmSwap.ts","../../src/zodiac/roles/sizeAdjuster.ts"],"sourcesContent":["/** Minimal Zodiac Roles v2 modifier ABI used by the scoping/apply flows. */\nexport const rolesV2Abi = [\n {\n type: 'function',\n name: 'assignRoles',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'module', type: 'address' },\n { name: 'roleKeys', type: 'bytes32[]' },\n { name: 'memberOf', type: 'bool[]' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'scopeTarget',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'roleKey', type: 'bytes32' },\n { name: 'targetAddress', type: 'address' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'scopeFunction',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'roleKey', type: 'bytes32' },\n { name: 'targetAddress', type: 'address' },\n { name: 'selector', type: 'bytes4' },\n {\n name: 'conditions',\n type: 'tuple[]',\n components: [\n { name: 'parent', type: 'uint8' },\n { name: 'paramType', type: 'uint8' },\n { name: 'operator', type: 'uint8' },\n { name: 'compValue', type: 'bytes' },\n ],\n },\n { name: 'options', type: 'uint8' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'allowFunction',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'roleKey', type: 'bytes32' },\n { name: 'targetAddress', type: 'address' },\n { name: 'selector', type: 'bytes4' },\n { name: 'options', type: 'uint8' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'setTransactionUnwrapper',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'to', type: 'address' },\n { name: 'selector', type: 'bytes4' },\n { name: 'adapter', type: 'address' },\n ],\n outputs: [],\n },\n] as const\n","import type { ContractFunctionArgs, ContractFunctionName } from 'viem'\n\nimport { rolesV2Abi } from './rolesAbi'\n\ntype ScopeFunctionName = ContractFunctionName<typeof rolesV2Abi, 'nonpayable'>\n\n/** One idempotent Roles-modifier configuration call, paired with its ABI arguments. */\nexport type ScopeStep = {\n [Name in ScopeFunctionName]: {\n name: string\n functionName: Name\n args: ContractFunctionArgs<typeof rolesV2Abi, 'nonpayable', Name>\n }\n}[ScopeFunctionName]\n\n/**\n * Minimal structural client shapes (instead of viem's `PublicClient` /\n * `WalletClient`) so any viem 2.x instance is accepted — pnpm peer-keying can\n * produce multiple viem type-instances across a workspace, and the deeply\n * generic client types are not assignable across instances (TS2719).\n */\nexport interface ScopeStepsPublicClient {\n waitForTransactionReceipt(args: {\n hash: `0x${string}`\n timeout?: number\n }): Promise<{ status: string }>\n}\n\nexport interface ScopeStepsWalletClient {\n writeContract(args: {\n address: `0x${string}`\n abi: typeof rolesV2Abi\n functionName: ScopeStep['functionName']\n args: never\n maxFeePerGas?: bigint\n maxPriorityFeePerGas?: bigint\n }): Promise<`0x${string}`>\n}\n\n/**\n * Apply scope steps to a Roles v2 modifier sequentially, aborting on the\n * first revert so a partially-applied role is never silently left behind.\n * The wallet must be the modifier's owner.\n */\nexport async function applyScopeSteps(params: {\n publicClient: ScopeStepsPublicClient\n walletClient: ScopeStepsWalletClient\n rolesModifier: `0x${string}`\n steps: ScopeStep[]\n log?: (line: string) => void\n /**\n * EIP-1559 fee overrides applied to every tx. Pass a NON-ZERO\n * `maxPriorityFeePerGas` — some RPC estimators return a zero tip, which leaves\n * txs un-prioritised and slow to include.\n */\n fees?: { maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint }\n /** Receipt-wait timeout (ms). */\n timeoutMs?: number\n}): Promise<void> {\n // eslint-disable-next-line no-console\n const { publicClient, walletClient, rolesModifier, steps, log = console.log } = params\n for (const step of steps) {\n log(`→ ${step.name}`)\n const hash = await walletClient.writeContract({\n address: rolesModifier,\n abi: rolesV2Abi,\n functionName: step.functionName,\n args: step.args as never,\n ...(params.fees ?? {}),\n })\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n ...(params.timeoutMs ? { timeout: params.timeoutMs } : {}),\n })\n log(` ${receipt.status} ${hash}`)\n if (receipt.status !== 'success') {\n throw new Error(`step \"${step.name}\" reverted (tx ${hash}); aborting before later steps`)\n }\n }\n}\n","import type { Hex } from 'viem'\n\n/** Roles v2 flat condition node (BFS-ordered tree). */\nexport interface ConditionFlat {\n parent: number\n paramType: number\n operator: number\n compValue: Hex\n}\n\n/** True for a 0x-prefixed, 20-byte (40 hex char) address. */\nfunction isHexAddress(v: string): boolean {\n return /^0x[0-9a-fA-F]{40}$/.test(v)\n}\n\n/** 32-byte left-padded address as an EqualTo Static compValue. */\nexport function addressEqualCompValue(addr: `0x${string}`): Hex {\n if (!isHexAddress(addr)) {\n throw new Error(`addressEqualCompValue: expected a 20-byte hex address, got \"${addr}\"`)\n }\n return `0x${addr.slice(2).toLowerCase().padStart(64, '0')}` as Hex\n}\n\n/**\n * Operator.Custom compValue: adapter address in the leading 20 bytes, the\n * trailing 12 bytes are passed to the adapter verbatim as `extra`.\n */\nexport function customCompValue(adapter: `0x${string}`, extra: Hex = '0x'): Hex {\n if (!isHexAddress(adapter)) {\n throw new Error(`customCompValue: adapter must be a 20-byte hex address, got \"${adapter}\"`)\n }\n if (!/^0x([0-9a-fA-F]{2})*$/.test(extra)) {\n throw new Error(`customCompValue: extra must be 0x-prefixed, even-length hex, got \"${extra}\"`)\n }\n if (extra.length - 2 > 24) throw new Error('customCompValue: extra must be at most 12 bytes')\n const extraHex = extra.slice(2).padEnd(24, '0')\n return `0x${adapter.slice(2).toLowerCase()}${extraHex}` as Hex\n}\n\n/**\n * Encode a uint96 mint-size cap as the `bytes12 extra` of a pair-condition\n * compValue (0n = uncapped). The adapters read it as `uint96(extra)`, i.e.\n * big-endian right-aligned in the 12 bytes.\n */\nexport function sizeCapExtra(cap: bigint): Hex {\n if (cap < 0n || cap >= 1n << 96n) throw new Error('size cap must fit in uint96')\n return `0x${cap.toString(16).padStart(24, '0')}` as Hex\n}\n","/**\n * Zodiac Roles Modifier v2 enum ordinals.\n *\n * Verified against gnosisguild/zodiac-modifier-roles `contracts/Types.sol`\n * (commit c343958ab7317b31d8c4aec790606d950ea21eed) and the deployed v2.1\n * mastercopy 0x9646fDAD06d3e24444381f44362a3B0eB343D337. Keep in sync with the\n * modifier version the Safe actually runs.\n */\n\nexport const ParameterType = {\n None: 0,\n Static: 1,\n Dynamic: 2,\n Tuple: 3,\n Array: 4,\n Calldata: 5,\n AbiEncoded: 6,\n} as const\n\nexport const Operator = {\n Pass: 0,\n And: 1,\n Or: 2,\n Nor: 3,\n Matches: 5,\n ArraySome: 6,\n ArrayEvery: 7,\n ArraySubset: 8,\n EqualToAvatar: 15,\n EqualTo: 16,\n GreaterThan: 17,\n LessThan: 18,\n SignedIntGreaterThan: 19,\n SignedIntLessThan: 20,\n Bitmask: 21,\n Custom: 22,\n WithinAllowance: 28,\n EtherWithinAllowance: 29,\n CallWithinAllowance: 30,\n} as const\n\n/**\n * Canonical adapter addresses — deterministic CREATE2 (factory\n * 0x4e59b44847b379578588920cA78FbF26c0B4956C, salt\n * keccak256(\"panoptic.zodiac-modules.v1\")), so they depend only on the\n * bytecode: same on every chain, deployer-independent, verifiable with\n * `cast code` against a local `forge build`. The adapters are stateless and\n * immutable (no owner/storage/upgradability). Recompute via\n * `forge script scripts/DeployAdapters.s.sol` after any source change.\n */\nexport const CANONICAL_ADAPTERS = {\n RollerCondition: '0x7b2402F7Ff7fFe0970D383dE1C6AF8892B87523a',\n SizeAdjusterCondition: '0x72494B2A0C5a69Dd0154386c2F4Af0b38a24C400',\n SfpmSwapCondition: '0x9321DdE7242dFcFac61D1b2d357e88FC4302eAF7',\n} as const\n\nexport const ExecutionOptions = {\n None: 0,\n Send: 1,\n DelegateCall: 2,\n Both: 3,\n} as const\n","import { type Hex, keccak256, toBytes, toFunctionSelector } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, customCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\n\n/** PanopticPool.dispatch — TokenId is a uint256 value type. */\nexport const DISPATCH_SELECTOR = toFunctionSelector(\n 'dispatch(uint256[],uint256[],uint128[],int24[3][],bool,uint256)',\n)\n\n/** Deterministic per-role keys; override via env/config if a Safe needs several instances. */\nexport function roleKey(name: string): Hex {\n return keccak256(toBytes(`panoptic.role.${name}.v1`))\n}\n\n/**\n * ConditionFlat tree for a dispatch-scoped role whose whole authorization\n * logic lives in an on-chain `ICustomCondition` adapter (Operator.Custom).\n *\n * The Custom node is attached to arg0 (`positionIdList`): Roles hands the\n * adapter the FULL calldata regardless of attachment point, and the adapter\n * decodes `positionIdList`/`positionSizes` itself. The remaining nodes are the\n * structural template `Integrity.sol` requires (Calldata and Array nodes must\n * describe their children; see buildLoanOnlyDispatchConditions for the shape).\n */\nexport function buildDispatchCustomConditions(\n adapter: `0x${string}`,\n extra: Hex = '0x',\n): ConditionFlat[] {\n const compValue = customCompValue(adapter, extra)\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdList — carries the Custom adapter check\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Custom, compValue },\n // 2: arg1 finalPositionIdList\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 3: arg2 positionSizes\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 4: arg3 tickAndSpreadLimits (int24[3][])\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg5 builderCode\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7-9: array element types\n { parent: 1, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 2, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 3, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 10: tickAndSpreadLimits element (int24[3] — statically encoded, 3 words)\n { parent: 4, paramType: ParameterType.Tuple, operator: Operator.Pass, compValue: '0x' },\n // 11-13: int24[3] members\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n/** assignRoles → scopeTarget → scopeFunction steps for an adapter-gated dispatch role. */\nexport function buildDispatchCustomRoleSteps(params: {\n roleName: string\n roleKey: Hex\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}`\n extra?: Hex\n}): ScopeStep[] {\n const { roleName, member, pool, adapter, extra } = params\n return [\n {\n name: `assignRoles(${roleName} member)`,\n functionName: 'assignRoles',\n args: [member, [params.roleKey], [true]],\n },\n { name: 'scopeTarget(pool)', functionName: 'scopeTarget', args: [params.roleKey, pool] },\n {\n name: `scopeFunction(dispatch, ${roleName} custom adapter)`,\n functionName: 'scopeFunction',\n args: [\n params.roleKey,\n pool,\n DISPATCH_SELECTOR,\n buildDispatchCustomConditions(adapter, extra),\n ExecutionOptions.None,\n ],\n },\n ]\n}\n","import type { Hex } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport type { ConditionFlat } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\nimport { DISPATCH_SELECTOR, roleKey } from './dispatchCustomRole'\n\n/**\n * Deleverager role: burn the Safe's existing positions only — never mint.\n *\n * Enforced with plain static conditions, no adapter and no state oracle:\n * every `positionSizes` entry must be 0. A size-0 entry either burns a held\n * position or reverts the whole dispatch — a size-0 mint is impossible\n * (option legs trip `ChunkHasZeroLiquidity` in the SFPM; pure-loan tokenIds\n * die in the end-of-dispatch solvency pass / positions-hash validation).\n *\n * Trade-off vs an oracle-based check: the key cannot settle streamia (settle\n * requires `sizes[i] == storedSize`, unknowable pre-execution). Strictly a\n * risk-reduction key: safe for a watchdog keeper or dead-man's-switch.\n */\nexport const DELEVERAGER_ROLE_KEY = roleKey('deleverager')\n\nconst ZERO_WORD = `0x${'0'.repeat(64)}` as Hex\n\nexport function buildDeleveragerDispatchConditions(): ConditionFlat[] {\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdList — unconstrained (any held tokenId may be burnt)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 2: arg1 finalPositionIdList\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 3: arg2 positionSizes — EVERY entry must be 0 (burn-or-revert)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.ArrayEvery, compValue: '0x' },\n // 4: arg3 tickAndSpreadLimits (int24[3][])\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg5 builderCode\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7-9: array element types\n { parent: 1, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 2, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n {\n parent: 3,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: ZERO_WORD,\n },\n // 10: tickAndSpreadLimits element (int24[3] — statically encoded, 3 words)\n { parent: 4, paramType: ParameterType.Tuple, operator: Operator.Pass, compValue: '0x' },\n // 11-13: int24[3] members\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\nexport function buildDeleveragerRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n roleKey?: Hex\n}): ScopeStep[] {\n const key = params.roleKey ?? DELEVERAGER_ROLE_KEY\n return [\n {\n name: 'assignRoles(deleverager member)',\n functionName: 'assignRoles',\n args: [params.member, [key], [true]],\n },\n { name: 'scopeTarget(pool)', functionName: 'scopeTarget', args: [key, params.pool] },\n {\n name: 'scopeFunction(dispatch, burn-only: all sizes == 0)',\n functionName: 'scopeFunction',\n args: [\n key,\n params.pool,\n DISPATCH_SELECTOR,\n buildDeleveragerDispatchConditions(),\n ExecutionOptions.None,\n ],\n },\n ]\n}\n","import { type Address, type Hex, toFunctionSelector, zeroAddress } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, addressEqualCompValue, customCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\n\n/**\n * Liquidator role: scopes ONLY `PanopticLiquidator.liquidate(LiquidateParams)`\n * on the helper. `initializePool`, `execute`, `multicall`, `sweep`, and\n * `quoteLiquidation` are never scoped.\n *\n * Split of enforcement (must match the LiquidatorCondition contract and the\n * hand-encoded tree in zodiac-modules/test/LiquidatorRolesFork.t.sol, which is\n * the golden spec for this builder):\n * - THIS TREE pins the static fields: pool ∈ allowlist, account ∉ {safe,\n * helper}, swap targets ∈ {router, 0}, streamia flags = 0, and — via\n * ExecutionOptions.None — zero outer msg.value (attached value is excluded\n * from the helper's minDelta floors, so it must never flow through the\n * role; native shortfalls are funded via nativeFundingAmount instead).\n * - THE ADAPTER (Custom node on positionIdListTo; Roles hands it full\n * calldata) enforces the cross-field invariants: flash/swap tokens ∈ pool\n * underlyings, swap groups zeroed together or exact nonzero amounts,\n * nativeFundingAmount only on native pools, floors ≥ 0 with one positive.\n */\nexport const LIQUIDATE_SELECTOR = toFunctionSelector(\n 'liquidate((address,address,uint256[],uint256,address,uint256,uint256,address,bytes,address,uint256,address,bytes,address,uint256,int256,int256))',\n)\n\nexport interface LiquidatorConditionsParams {\n /** Deployed LiquidatorCondition adapter. */\n adapter: Address\n /** The Safe (avatar) — excluded as a liquidation target. */\n safe: Address\n /** The PanopticLiquidator helper — also excluded as a target. */\n helper: Address\n /** Pinned swap router (Uniswap Universal Router). */\n router: Address\n /** PanopticPool allowlist (at least one). */\n pools: readonly Address[]\n /** Trailing 12 bytes of the Custom compValue (unused by the adapter). */\n extra?: Hex\n}\n\n/** BFS ConditionFlat tree over liquidate's single LiquidateParams tuple. */\nexport function buildLiquidatorConditions(params: LiquidatorConditionsParams): ConditionFlat[] {\n const { adapter, safe, helper, router, pools, extra = '0x' } = params\n if (pools.length === 0) throw new Error('liquidator role needs at least one pool')\n\n const pass = (parent: number, paramType: ConditionFlat['paramType']): ConditionFlat => ({\n parent,\n paramType,\n operator: Operator.Pass,\n compValue: '0x',\n })\n\n const conditions: ConditionFlat[] = [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: the LiquidateParams tuple\n { parent: 0, paramType: ParameterType.Tuple, operator: Operator.Matches, compValue: '0x' },\n // 2: pool — Or(EqualTo(pool_i)) allowlist\n { parent: 1, paramType: ParameterType.None, operator: Operator.Or, compValue: '0x' },\n // 3: account — Nor(EqualTo(safe), EqualTo(helper))\n { parent: 1, paramType: ParameterType.None, operator: Operator.Nor, compValue: '0x' },\n // 4: positionIdListTo — carries the Custom adapter (full-calldata hook)\n {\n parent: 1,\n paramType: ParameterType.Array,\n operator: Operator.Custom,\n compValue: customCompValue(adapter, extra),\n },\n // 5: usePremiaAsCollateral — pinned to zero\n {\n parent: 1,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: '0x0000000000000000000000000000000000000000000000000000000000000000',\n },\n pass(1, ParameterType.Static), // 6: flashToken\n pass(1, ParameterType.Static), // 7: flashAmount\n pass(1, ParameterType.Static), // 8: nativeFundingAmount\n // 9: preSwapTarget — Or(EqualTo(router), EqualTo(0))\n { parent: 1, paramType: ParameterType.None, operator: Operator.Or, compValue: '0x' },\n pass(1, ParameterType.Dynamic), // 10: preSwapCallData\n pass(1, ParameterType.Static), // 11: preSwapTokenIn\n pass(1, ParameterType.Static), // 12: preSwapAmountIn\n // 13: swapTarget — Or(EqualTo(router), EqualTo(0))\n { parent: 1, paramType: ParameterType.None, operator: Operator.Or, compValue: '0x' },\n pass(1, ParameterType.Dynamic), // 14: swapCallData\n pass(1, ParameterType.Static), // 15: swapTokenIn\n pass(1, ParameterType.Static), // 16: swapAmountIn\n pass(1, ParameterType.Static), // 17: minDelta0\n pass(1, ParameterType.Static), // 18: minDelta1\n ]\n\n // Children (parents nondecreasing): pool allowlist under 2.\n for (const pool of pools) {\n conditions.push({\n parent: 2,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(pool),\n })\n }\n // account exclusions under 3.\n for (const excluded of [safe, helper]) {\n conditions.push({\n parent: 3,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(excluded),\n })\n }\n // positionIdListTo element template under 4.\n conditions.push(pass(4, ParameterType.Static))\n // swap target pins under 9 and 13.\n for (const parent of [9, 13]) {\n conditions.push({\n parent,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(router),\n })\n conditions.push({\n parent,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(zeroAddress),\n })\n }\n\n return conditions\n}\n\n/** assignRoles → scopeTarget → scopeFunction for the liquidator role. */\nexport function buildLiquidatorRoleSteps(\n params: LiquidatorConditionsParams & { roleKey: Hex; member: Address },\n): ScopeStep[] {\n return [\n {\n name: 'assignRoles(liquidator member)',\n functionName: 'assignRoles',\n args: [params.member, [params.roleKey], [true]],\n },\n {\n name: 'scopeTarget(helper)',\n functionName: 'scopeTarget',\n args: [params.roleKey, params.helper],\n },\n {\n name: 'scopeFunction(liquidate, liquidator conditions)',\n functionName: 'scopeFunction',\n args: [\n params.roleKey,\n params.helper,\n LIQUIDATE_SELECTOR,\n buildLiquidatorConditions(params),\n // No Send: zero outer msg.value is load-bearing (see module docblock).\n ExecutionOptions.None,\n ],\n },\n ]\n}\n","/**\n * Bit-field masks over the Panoptic v2 tokenId layout, mirroring\n * `contracts/lib/TokenIdMasks.sol` (kept in lockstep by golden unit tests).\n *\n * Layout (packages/panoptic-v2-core/contracts/types/TokenId.sol):\n * - bits [0, 64) poolId\n * - each leg is 48 bits, starting at 64 + legIndex*48, packing\n * asset(+0,1b) | optionRatio(+1,7b) | isLong(+8) | tokenType(+9)\n * | riskPartner(+10,2b) | strike(+12,24b) | width(+36,12b)\n */\n\nconst POOL_ID_SIZE = 64n\nconst LEG_SIZE = 48n\nconst MAX_LEGS = 4n\n\n/** Mask with 1-bits over a `bits`-wide field at `fieldOffset` in every leg. */\nexport function legFieldMask(fieldOffset: bigint, bits: bigint): bigint {\n const field = (1n << bits) - 1n\n let mask = 0n\n for (let leg = 0n; leg < MAX_LEGS; leg++) {\n mask |= field << (POOL_ID_SIZE + leg * LEG_SIZE + fieldOffset)\n }\n return mask\n}\n\n/** Mask with 1-bits over every leg's 12-bit width field. */\nexport function loanWidthFieldsMask(): bigint {\n return legFieldMask(36n, 12n)\n}\n\n/** Mask with 1-bits over every leg's 24-bit strike field. */\nexport function strikeFieldsMask(): bigint {\n return legFieldMask(12n, 24n)\n}\n\n/** Mask with 1-bits over every leg's 7-bit optionRatio field. */\nexport function optionRatioFieldsMask(): bigint {\n return legFieldMask(1n, 7n)\n}\n\n/** True iff every leg of the tokenId has width == 0 (a pure loan/credit). */\nexport function isPureLoanTokenId(tokenId: bigint): boolean {\n return (tokenId & loanWidthFieldsMask()) === 0n\n}\n\n/** The 32-byte mask + expected value for a Zodiac Roles v2 Bitmask condition. */\nexport function loanBitmaskCondition(): { mask: `0x${string}`; expected: `0x${string}` } {\n const mask = loanWidthFieldsMask()\n const toBytes32 = (v: bigint) => `0x${v.toString(16).padStart(64, '0')}` as `0x${string}`\n return { mask: toBytes32(mask), expected: toBytes32(0n) }\n}\n","import type { Hex } from 'viem'\n\nimport { type ConditionFlat, addressEqualCompValue } from '../conditions'\nimport { Operator, ParameterType } from '../constants'\nimport { loanBitmaskCondition } from '../tokenIdMask'\n\n/**\n * Loan-only hedger role scope (migrated from apps/hedger-bot scripts/lib).\n *\n * ⚠️ VALIDATE ON A FORK BEFORE MAINNET. The ConditionFlat encoding below is\n * security-critical. Dry-run `scopeFunction` on an anvil/Tenderly fork and\n * assert that the role CAN mint/burn a pure width=0 loan via dispatch and\n * CANNOT dispatch a tokenId with any width>0 leg.\n *\n * The scope constrains PanopticPool.dispatch(positionIdList, finalPositionIdList,\n * positionSizes, tickAndSpreadLimits, usePremiaAsCollateral, builderCode) so that\n * EVERY element of `positionIdList` (arg 0 — the tokenIds actually minted/burned)\n * is a pure loan: `tokenId & widthFieldsMask == 0`. All other args pass freely;\n * `finalPositionIdList` is intentionally NOT constrained (it legitimately contains\n * the user's option positions that remain open).\n */\n\n/**\n * Bitmask compValue layout (Roles v2 `PermissionChecker._bitmask`): a 32-byte\n * word packing `uint16 shift | bytes15 mask | bytes15 expected`, where `shift`\n * is a BYTE offset from the start (left / most-significant end) of the value\n * and the 15-byte mask is applied LEFT-aligned to `bytes32(value[shift:])`.\n *\n * The four 12-bit width fields span tokenId bits 100–255 (leg 3's width sits in\n * the top two bytes), which is wider than one 15-byte window. So the loan\n * constraint is expressed as TWO windows AND-ed together:\n * - shift 0: tokenId bytes 0..14 (bits 136–255) — covers legs 1, 2, 3\n * - shift 17: tokenId bytes 17..31 (bits 0–119) — covers leg 0\n * Bytes 15–16 (bits 120–135) contain no width bits.\n */\nexport const LOAN_BITMASK_WINDOW_SHIFTS = [0, 17] as const\n\nexport function loanBitmaskCompValueAt(shiftBytes: number): Hex {\n const { mask } = loanBitmaskCondition()\n const maskBytes = mask.slice(2) // 64 hex chars, byte 0 first\n const window = maskBytes.slice(shiftBytes * 2, shiftBytes * 2 + 30).padEnd(30, '0')\n const shift = shiftBytes.toString(16).padStart(4, '0')\n return `0x${shift}${window}${'0'.repeat(30)}` as Hex // expected = all zeros\n}\n\n/**\n * Build the ConditionFlat[] tree scoping dispatch to loan-only positionIdList.\n *\n * Roles v2 `Integrity.sol` requirements honored here:\n * - BFS order: parent indices must be non-decreasing (NotBFS).\n * - Every Array-typed node needs >=1 child describing the element type\n * (UnsuitableChildCount); ArrayEvery needs exactly 1.\n * - And nodes use ParameterType.None and an empty compValue.\n */\nexport function buildLoanOnlyDispatchConditions(): ConditionFlat[] {\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdList — every element must satisfy subtree [7]\n { parent: 0, paramType: ParameterType.Array, operator: Operator.ArrayEvery, compValue: '0x' },\n // 2: arg1 finalPositionIdList — unconstrained (holds user option positions)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 3: arg2 positionSizes\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 4: arg3 tickAndSpreadLimits (int24[3][])\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg5 builderCode\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7: positionIdList element (uint256 tokenId) — both width windows must be zero\n { parent: 1, paramType: ParameterType.None, operator: Operator.And, compValue: '0x' },\n // 8: finalPositionIdList element\n { parent: 2, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 9: positionSizes element\n { parent: 3, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 10: tickAndSpreadLimits element (int24[3] — statically encoded, 3 words)\n { parent: 4, paramType: ParameterType.Tuple, operator: Operator.Pass, compValue: '0x' },\n // 11-12: the two AND-ed bitmask windows over the tokenId\n {\n parent: 7,\n paramType: ParameterType.Static,\n operator: Operator.Bitmask,\n compValue: loanBitmaskCompValueAt(LOAN_BITMASK_WINDOW_SHIFTS[0]),\n },\n {\n parent: 7,\n paramType: ParameterType.Static,\n operator: Operator.Bitmask,\n compValue: loanBitmaskCompValueAt(LOAN_BITMASK_WINDOW_SHIFTS[1]),\n },\n // 13-15: int24[3] members\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n { parent: 10, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n// ---------------------------------------------------------------------------\n// Cross-pool scope: MultiSend unwrap + per-inner-call scopes.\n//\n// The bot batches [CT.withdraw, router.execute, CT.deposit] via Safe MultiSend,\n// routed through Roles with a MultiSend unwrapper registered so each inner call\n// is re-checked against these scopes. Selectors below are the inner targets.\n// ---------------------------------------------------------------------------\n\n/** ERC4626 CollateralTracker withdraw(uint256 assets, address receiver, address owner). */\nexport const WITHDRAW_SELECTOR = '0xb460af94' as const\n/** ERC4626 CollateralTracker deposit(uint256 assets, address receiver). */\nexport const DEPOSIT_SELECTOR = '0x6e553f65' as const\n/** Uniswap UniversalRouter execute(bytes,bytes[],uint256). */\nexport const EXECUTE_SELECTOR = '0x3593564c' as const\n\n/**\n * Scope CT.withdraw so tokens can only be pulled to the Safe: receiver == owner\n * == Safe. Without this, a compromised bot key could withdraw the Safe's\n * collateral to an arbitrary address — this is the critical cross-pool scope.\n */\nexport function buildWithdrawConditions(safe: `0x${string}`): ConditionFlat[] {\n const safeEq = addressEqualCompValue(safe)\n return [\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' }, // assets\n { parent: 0, paramType: ParameterType.Static, operator: Operator.EqualTo, compValue: safeEq }, // receiver\n { parent: 0, paramType: ParameterType.Static, operator: Operator.EqualTo, compValue: safeEq }, // owner\n ]\n}\n\n/** Scope CT.deposit so the shares are credited to the Safe: receiver == Safe. */\nexport function buildDepositConditions(safe: `0x${string}`): ConditionFlat[] {\n return [\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' }, // assets\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(safe),\n }, // receiver\n ]\n}\n","import { type Hex, toFunctionSelector } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, addressEqualCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\nimport { roleKey } from './dispatchCustomRole'\n\n/**\n * Maintenance role: full `dispatchFrom` access — settle streamia on, force-\n * exercise, and liquidate third-party accounts using the Safe's capital.\n * No adapter needed; the pool itself hash-validates the position lists.\n *\n * The only pin is `account != Safe` (Nor(EqualTo(safe))) so the maintenance\n * key can never force-exercise or liquidate the Safe's own book.\n * `positionIdListFrom` (the caller's solvency list) is intentionally\n * unconstrained — the Safe may legitimately hold option positions.\n *\n * dispatchFrom is payable ⇒ ExecutionOptions.Send.\n */\nexport const MAINTENANCE_ROLE_KEY = roleKey('maintenance')\n\n/** LeftRightUnsigned is a uint256 value type. */\nexport const DISPATCH_FROM_SELECTOR = toFunctionSelector(\n 'dispatchFrom(uint256[],address,uint256[],uint256[],uint256)',\n)\n\nexport function buildDispatchFromConditions(safe: `0x${string}`): ConditionFlat[] {\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 positionIdListFrom (caller solvency list)\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 2: arg1 account — anything but the Safe itself\n { parent: 0, paramType: ParameterType.None, operator: Operator.Nor, compValue: '0x' },\n // 3: arg2 positionIdListTo\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 4: arg3 positionIdListToFinal\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n // 5: arg4 usePremiaAsCollateral (LeftRightUnsigned)\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 6: arg0 element\n { parent: 1, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 7: Nor child — account == Safe (negated by the parent)\n {\n parent: 2,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: addressEqualCompValue(safe),\n },\n // 8: arg2 element\n { parent: 3, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n // 9: arg3 element\n { parent: 4, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\nexport function buildMaintenanceRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n safe: `0x${string}`\n roleKey?: Hex\n}): ScopeStep[] {\n const key = params.roleKey ?? MAINTENANCE_ROLE_KEY\n return [\n {\n name: 'assignRoles(maintenance member)',\n functionName: 'assignRoles',\n args: [params.member, [key], [true]],\n },\n { name: 'scopeTarget(pool)', functionName: 'scopeTarget', args: [key, params.pool] },\n {\n name: 'scopeFunction(dispatchFrom, account != safe, Send)',\n functionName: 'scopeFunction',\n args: [\n key,\n params.pool,\n DISPATCH_FROM_SELECTOR,\n buildDispatchFromConditions(params.safe),\n ExecutionOptions.Send,\n ],\n },\n ]\n}\n","import type { Hex } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { sizeCapExtra } from '../conditions'\nimport { buildDispatchCustomRoleSteps, roleKey } from './dispatchCustomRole'\n\n/**\n * Roller role: close one position and reopen it identical-except-strike (roll\n * out-of-range positions back into range). Enforced on-chain by the stateless\n * `RollerCondition` adapter (strike-mask equality + one-burn-one-mint shape).\n *\n * The reopened size is bounded by `sizeCap` (0n = uncapped, leaving only\n * dispatch's solvency check as the ceiling) — there is no pre-state oracle,\n * so \"same size as before\" cannot be enforced.\n */\nexport const ROLLER_ROLE_KEY = roleKey('roller')\n\nexport function buildRollerRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed RollerCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}): ScopeStep[] {\n return buildDispatchCustomRoleSteps({\n roleName: 'roller',\n roleKey: params.roleKey ?? ROLLER_ROLE_KEY,\n member: params.member,\n pool: params.pool,\n adapter: params.adapter,\n extra: sizeCapExtra(params.sizeCap ?? 0n),\n })\n}\n","import { type Hex, toFunctionSelector, zeroHash } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { type ConditionFlat, addressEqualCompValue, customCompValue } from '../conditions'\nimport { ExecutionOptions, Operator, ParameterType } from '../constants'\nimport { buildDepositConditions, DEPOSIT_SELECTOR } from './loanHedger'\n\n/** SFPM `multicall(bytes[])`. */\nexport const MULTICALL_SELECTOR = toFunctionSelector('multicall(bytes[])')\n/** Safe `MultiSend.multiSend(bytes)` — the batch entrypoint the Roles unwrapper is registered for. */\nexport const MULTISEND_SELECTOR = toFunctionSelector('multiSend(bytes)')\n/** WETH9 `deposit()` (wrap native ETH → WETH; payable). */\nexport const WETH_DEPOSIT_SELECTOR = toFunctionSelector('deposit()')\n/** WETH9 `withdraw(uint256)` (unwrap WETH → native ETH). */\nexport const WETH_WITHDRAW_SELECTOR = toFunctionSelector('withdraw(uint256)')\n/** Panoptic CT solvency-aware withdrawal used while the Safe has open positions. */\nexport const WITHDRAW_WITH_POSITIONS_SELECTOR = toFunctionSelector(\n 'withdraw(uint256,address,address,uint256[],bool)',\n)\n\n/**\n * Scope the solvency-aware CT withdrawal to the Safe and to the conservative\n * `usePremiaAsCollateral=false` mode. The position list remains dynamic because\n * it must exactly match the Safe's live Panoptic portfolio.\n */\nexport function buildWithdrawWithPositionsConditions(safe: `0x${string}`): ConditionFlat[] {\n const safeEq = addressEqualCompValue(safe)\n return [\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n { parent: 0, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: safeEq,\n },\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: safeEq,\n },\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Pass, compValue: '0x' },\n {\n parent: 0,\n paramType: ParameterType.Static,\n operator: Operator.EqualTo,\n compValue: zeroHash,\n },\n { parent: 4, paramType: ParameterType.Static, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n/**\n * Encode a `uint64` SFPM poolId as the `bytes12 extra` of the SfpmSwapCondition\n * compValue. The adapter reads it as `uint64(uint96(extra))`, i.e. big-endian\n * right-aligned in the 12 bytes (same convention as `sizeCapExtra`).\n */\nexport function sfpmPoolIdPinExtra(poolId: bigint): Hex {\n if (poolId <= 0n || poolId >= 1n << 64n) {\n throw new Error(`sfpmPoolIdPinExtra: poolId must be a nonzero uint64, got ${poolId}`)\n }\n return `0x${poolId.toString(16).padStart(24, '0')}` as Hex\n}\n\n/**\n * ConditionFlat tree scoping `SFPM.multicall(bytes[])` to the SfpmSwapCondition\n * adapter. The whole check lives in the adapter (Operator.Custom on arg0); the\n * other nodes are the structural template Integrity.sol requires — a Calldata\n * root and the `bytes[]` array with its element type.\n */\nexport function buildSfpmSwapConditions(\n adapter: `0x${string}`,\n poolIdPin: bigint,\n): ConditionFlat[] {\n const compValue = customCompValue(adapter, sfpmPoolIdPinExtra(poolIdPin))\n return [\n // 0: root over calldata\n { parent: 0, paramType: ParameterType.Calldata, operator: Operator.Matches, compValue: '0x' },\n // 1: arg0 bytes[] — carries the Custom adapter check\n { parent: 0, paramType: ParameterType.Array, operator: Operator.Custom, compValue },\n // 2: array element type (bytes → Dynamic)\n { parent: 1, paramType: ParameterType.Dynamic, operator: Operator.Pass, compValue: '0x' },\n ]\n}\n\n/**\n * Steps that extend an existing bot role with the off-venue SFPM swap surface.\n *\n * The bot batches `[CT(tokenIn).withdraw(with position list),\n * SFPM.multicall(mint+burn), CT(tokenOut).deposit]`\n * via Safe MultiSend, routed through Roles with a MultiSend unwrapper registered\n * so each inner call is re-checked against the scopes below.\n *\n * Reuses the existing bot `roleKey` (no `assignRoles`) — `execTransactionWithRole`\n * authorizes one role per tx and the batch mixes CT + SFPM calls, so all inner\n * calls must live under one key. The loan-only dispatch scope on that role is\n * orthogonal and unchanged.\n *\n * `setTransactionUnwrapper` is **modifier-global**, not per-role: registering it\n * affects every role on the modifier.\n */\nexport function buildSfpmSwapVenueSteps(params: {\n roleKey: Hex\n safe: `0x${string}`\n sfpm: `0x${string}`\n /** CollateralTracker for token0. */\n collateralTracker0: `0x${string}`\n /** CollateralTracker for token1. */\n collateralTracker1: `0x${string}`\n /** Deployed SfpmSwapCondition (stateless, canonical per chain). */\n adapter: `0x${string}`\n /** The registered `uint64` SFPM poolId of the allowed swap pool. */\n poolIdPin: bigint\n /** Safe MultiSendCallOnly address (the batch entrypoint). */\n multiSendCallOnly: `0x${string}`\n /** Canonical MultiSend unwrapper adapter for this chain. */\n multiSendUnwrapper: `0x${string}`\n /**\n * Which collateral asset is native ETH (its CT `deposit` is payable and needs\n * value; the batch wraps/unwraps around the swap). `'none'` for two-ERC20 pools.\n */\n nativeCollateral?: 'token0' | 'token1' | 'none'\n /** WETH9 address — required when `nativeCollateral` is not `'none'`. */\n weth9?: `0x${string}`\n}): ScopeStep[] {\n const {\n roleKey,\n safe,\n sfpm,\n collateralTracker0,\n collateralTracker1,\n adapter,\n poolIdPin,\n multiSendCallOnly,\n multiSendUnwrapper,\n } = params\n const nativeCollateral = params.nativeCollateral ?? 'none'\n\n // The native-ETH CT's deposit is payable (deposit by sending value), so it\n // needs ExecutionOptions.Send; ERC20 CT deposits take no value.\n const depositOptions = (side: 'token0' | 'token1') =>\n nativeCollateral === side ? ExecutionOptions.Send : ExecutionOptions.None\n\n const scopeCollateralTracker = (\n ct: `0x${string}`,\n side: 'token0' | 'token1',\n label: string,\n ): ScopeStep[] => [\n { name: `scopeTarget(${label})`, functionName: 'scopeTarget', args: [roleKey, ct] },\n {\n name: `scopeFunction(${label}.withdraw(with positions) → Safe)`,\n functionName: 'scopeFunction',\n args: [\n roleKey,\n ct,\n WITHDRAW_WITH_POSITIONS_SELECTOR,\n buildWithdrawWithPositionsConditions(safe),\n ExecutionOptions.None,\n ],\n },\n {\n name: `scopeFunction(${label}.deposit → Safe)`,\n functionName: 'scopeFunction',\n args: [roleKey, ct, DEPOSIT_SELECTOR, buildDepositConditions(safe), depositOptions(side)],\n },\n ]\n\n const steps: ScopeStep[] = [\n {\n name: 'setTransactionUnwrapper(MultiSend)',\n functionName: 'setTransactionUnwrapper',\n args: [multiSendCallOnly, MULTISEND_SELECTOR, multiSendUnwrapper],\n },\n { name: 'scopeTarget(SFPM)', functionName: 'scopeTarget', args: [roleKey, sfpm] },\n {\n name: 'scopeFunction(SFPM.multicall, SfpmSwapCondition)',\n functionName: 'scopeFunction',\n args: [\n roleKey,\n sfpm,\n MULTICALL_SELECTOR,\n buildSfpmSwapConditions(adapter, poolIdPin),\n ExecutionOptions.None,\n ],\n },\n ...scopeCollateralTracker(collateralTracker0, 'token0', 'CT0'),\n ...scopeCollateralTracker(collateralTracker1, 'token1', 'CT1'),\n ]\n\n // Bridge native ETH ↔ WETH around the v3 swap when a collateral asset is native.\n if (nativeCollateral !== 'none') {\n if (params.weth9 === undefined) {\n throw new Error('buildSfpmSwapVenueSteps: weth9 is required when nativeCollateral is set')\n }\n steps.push(\n { name: 'scopeTarget(WETH9)', functionName: 'scopeTarget', args: [roleKey, params.weth9] },\n {\n name: 'allowFunction(WETH9.deposit, Send)',\n functionName: 'allowFunction',\n args: [roleKey, params.weth9, WETH_DEPOSIT_SELECTOR, ExecutionOptions.Send],\n },\n {\n name: 'allowFunction(WETH9.withdraw)',\n functionName: 'allowFunction',\n args: [roleKey, params.weth9, WETH_WITHDRAW_SELECTOR, ExecutionOptions.None],\n },\n )\n }\n\n return steps\n}\n","import type { Hex } from 'viem'\n\nimport type { ScopeStep } from '../applySteps'\nimport { sizeCapExtra } from '../conditions'\nimport { buildDispatchCustomRoleSteps, roleKey } from './dispatchCustomRole'\n\n/**\n * Size-adjuster role: replace one position with an identical-except-optionRatio\n * one — reduce a short whose long side was purchased, or grow a long as more\n * options are sold. Enforced on-chain by the stateless `SizeAdjusterCondition`\n * adapter (ratio-mask equality + one-burn-one-mint shape).\n *\n * Without a pre-state oracle the relative notional cap is not enforceable;\n * set `sizeCap` (uint96, 0n = uncapped) to bound the mint size absolutely.\n */\nexport const SIZE_ADJUSTER_ROLE_KEY = roleKey('size-adjuster')\n\nexport function buildSizeAdjusterRoleSteps(params: {\n member: `0x${string}`\n pool: `0x${string}`\n adapter: `0x${string}` // deployed SizeAdjusterCondition (stateless, shared per chain)\n sizeCap?: bigint\n roleKey?: Hex\n}): ScopeStep[] {\n return buildDispatchCustomRoleSteps({\n roleName: 'size-adjuster',\n roleKey: params.roleKey ?? SIZE_ADJUSTER_ROLE_KEY,\n member: params.member,\n pool: params.pool,\n adapter: params.adapter,\n extra: sizeCapExtra(params.sizeCap ?? 0n),\n })\n}\n"],"mappings":";;;;AACA,MAAa,aAAa;CACxB;EACE,MAAM;EACN,MAAM;EACN,iBAAiB;EACjB,QAAQ;GACN;IAAE,MAAM;IAAU,MAAM;GAAW;GACnC;IAAE,MAAM;IAAY,MAAM;GAAa;GACvC;IAAE,MAAM;IAAY,MAAM;GAAU;EACrC;EACD,SAAS,CAAE;CACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,iBAAiB;EACjB,QAAQ,CACN;GAAE,MAAM;GAAW,MAAM;EAAW,GACpC;GAAE,MAAM;GAAiB,MAAM;EAAW,CAC3C;EACD,SAAS,CAAE;CACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,iBAAiB;EACjB,QAAQ;GACN;IAAE,MAAM;IAAW,MAAM;GAAW;GACpC;IAAE,MAAM;IAAiB,MAAM;GAAW;GAC1C;IAAE,MAAM;IAAY,MAAM;GAAU;GACpC;IACE,MAAM;IACN,MAAM;IACN,YAAY;KACV;MAAE,MAAM;MAAU,MAAM;KAAS;KACjC;MAAE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B,oBAAoB,UAAU,MAAM;EAC9D,GAAG,uBAAuB,oBAAoB,UAAU,MAAM;CAC/D;AAGD,KAAI,qBAAqB,QAAQ;AAC/B,MAAI,OAAO,iBACT,OAAM,IAAI,MAAM;AAElB,QAAM,KACJ;GAAE,MAAM;GAAsB,cAAc;GAAe,MAAM,CAACA,WAAS,OAAO,KAAM;EAAE,GAC1F;GACE,MAAM;GACN,cAAc;GACd,MAAM;IAACA;IAAS,OAAO;IAAO;IAAuB,iBAAiB;GAAK;EAC5E,GACD;GACE,MAAM;GACN,cAAc;GACd,MAAM;IAACA;IAAS,OAAO;IAAO;IAAwB,iBAAiB;GAAK;EAC7E,EACF;CACF;AAED,QAAO;AACR;;;;;;;;;;;;;ACpMD,MAAa,yBAAyB,QAAQ,gBAAgB;AAE9D,SAAgB,2BAA2BE,QAM3B;AACd,QAAO,6BAA6B;EAClC,UAAU;EACV,SAAS,OAAO,WAAW;EAC3B,QAAQ,OAAO;EACf,MAAM,OAAO;EACb,SAAS,OAAO;EAChB,OAAO,aAAa,OAAO,WAAW,GAAG;CAC1C,EAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-eng/sdk",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/panoptic-labs/panoptic-sdk.git"