/** * Actions namespace — pure calldata builders for the Vault contract. * * Each function returns the encoded calldata (or an array of calldatas for * composite "instant*" actions). They can be passed to `vault.multicall(...)` * to batch many operations into a single transaction. * * Roles are organisational (autocomplete + docs); all actions hit the same * underlying contract surface. The vault's `multicall` uses `delegatecall`, * so the caller (`msg.sender`) must hold the relevant role for each action. */ import type { MarketParams } from "./clients/adapters"; /** * An action is either a single calldata or an array of calldatas (for * composite actions like `instantX` which expands to `[submit(set), set]`). * `vault.multicall(...)` flattens arrays automatically. */ export type Action = string | readonly string[]; export type IdType = "this" | "collateralToken" | "this/marketParams"; /** * Build the `idData` blob the vault hashes to derive a cap id. * * Three flavours, matching the buckets returned by * `MorphoMarketV1AdapterV2.ids(marketParams)`: * - `this` — single-id adapters; also the adapter-wide bucket on Morpho V1 * (= `keccak256(abi.encode("this", adapter))`). * - `collateralToken` — per-collateral cap, shared across adapters/markets. * - `this/marketParams` — per-market cap under this adapter. * * For `this/marketParams` the contract encodes the `MarketParams` struct * **inline** (not bytes-wrapped); we mirror that here so the round-trip * `keccak256(idData(...))` matches the adapter's bucket id exactly. See * `idHash` below. */ export declare function idData(type: "this", adapter: string): string; export declare function idData(type: "collateralToken", token: string): string; export declare function idData(type: "this/marketParams", adapter: string, marketParams: MarketParams): string; /** * Compute the bytes32 id the vault stores caps and allocations under for a * given `idData` flavour — i.e. `keccak256(idData(type, ...))`. * * Useful for matching vault ids against expected buckets without rebuilding * the encoding by hand. */ export declare function idHash(type: "this", adapter: string): string; export declare function idHash(type: "collateralToken", token: string): string; export declare function idHash(type: "this/marketParams", adapter: string, marketParams: MarketParams): string; export type MorphoFlavour = "this" | "this/marketParams" | "collateralToken" | "unknown"; /** * Label a Morpho V1 vault id by which `idData` flavour produced it. * * Each match is a positive hash check against `idHash`, the single source * of truth for the contract-side encoding (see * https://docs.morpho.org/get-started/resources/contracts/morpho-market-v1-adapter-v2/). * Anything that doesn't match returns `unknown`, so a future 4th bucket * is flagged instead of silently mislabelled. */ export declare function classifyMorphoFlavour(id: string, adapterAddress: string, adapterId: string | undefined, marketParams: MarketParams | undefined): MorphoFlavour; export type TimelockFunction = "abdicate" | "addAdapter" | "removeAdapter" | "increaseTimelock" | "decreaseTimelock" | "increaseAbsoluteCap" | "increaseRelativeCap" | "setIsAllocator" | "setAdapterRegistry" | "setReceiveSharesGate" | "setSendSharesGate" | "setReceiveAssetsGate" | "setSendAssetsGate" | "setPerformanceFee" | "setPerformanceFeeRecipient" | "setManagementFee" | "setManagementFeeRecipient" | "setForceDeallocatePenalty"; export declare function timelockSelector(fn: TimelockFunction): string; /** * Every timelocked vault function, in declaration order. Derived from * `TIMELOCK_SELECTORS` so it can never drift from the selector table: * iterate this to read all timelock durations off a vault. */ export declare const TIMELOCK_FUNCTIONS: TimelockFunction[]; export declare const Actions: { readonly owner: { readonly setOwner: (newOwner: string) => string; readonly setCurator: (newCurator: string) => string; readonly setIsSentinel: (account: string, is: boolean) => string; readonly setName: (name: string) => string; readonly setSymbol: (symbol: string) => string; }; readonly curator: { readonly submit: (inner: string) => string; readonly revoke: (data: string) => string; readonly addAdapter: (adapter: string) => string; readonly removeAdapter: (adapter: string) => string; readonly increaseAbsoluteCap: (idData: string, cap: bigint) => string; readonly decreaseAbsoluteCap: (idData: string, cap: bigint) => string; readonly increaseRelativeCap: (idData: string, cap: bigint) => string; readonly decreaseRelativeCap: (idData: string, cap: bigint) => string; readonly setIsAllocator: (account: string, is: boolean) => string; readonly setReceiveSharesGate: (gate: string) => string; readonly setSendSharesGate: (gate: string) => string; readonly setReceiveAssetsGate: (gate: string) => string; readonly setSendAssetsGate: (gate: string) => string; readonly setAdapterRegistry: (registry: string) => string; readonly setPerformanceFee: (fee: bigint) => string; readonly setManagementFee: (fee: bigint) => string; readonly setPerformanceFeeRecipient: (r: string) => string; readonly setManagementFeeRecipient: (r: string) => string; readonly setForceDeallocatePenalty: (adapter: string, penalty: bigint) => string; readonly increaseTimelock: (fn: TimelockFunction, duration: bigint) => string; readonly decreaseTimelock: (fn: TimelockFunction, duration: bigint) => string; readonly abdicate: (fn: TimelockFunction) => string; readonly instantAddAdapter: (adapter: string) => readonly [string, string]; readonly instantRemoveAdapter: (adapter: string) => readonly [string, string]; readonly instantIncreaseAbsoluteCap: (idData: string, cap: bigint) => readonly [string, string]; readonly instantIncreaseRelativeCap: (idData: string, cap: bigint) => readonly [string, string]; readonly instantSetIsAllocator: (account: string, is: boolean) => readonly [string, string]; readonly instantSetReceiveSharesGate: (gate: string) => readonly [string, string]; readonly instantSetSendSharesGate: (gate: string) => readonly [string, string]; readonly instantSetReceiveAssetsGate: (gate: string) => readonly [string, string]; readonly instantSetSendAssetsGate: (gate: string) => readonly [string, string]; readonly instantSetAdapterRegistry: (registry: string) => readonly [string, string]; readonly instantSetPerformanceFee: (fee: bigint) => readonly [string, string]; readonly instantSetManagementFee: (fee: bigint) => readonly [string, string]; readonly instantSetPerformanceFeeRecipient: (r: string) => readonly [string, string]; readonly instantSetManagementFeeRecipient: (r: string) => readonly [string, string]; readonly instantSetForceDeallocatePenalty: (adapter: string, penalty: bigint) => readonly [string, string]; readonly instantIncreaseTimelock: (fn: TimelockFunction, duration: bigint) => readonly [string, string]; readonly instantDecreaseTimelock: (fn: TimelockFunction, duration: bigint) => readonly [string, string]; }; readonly allocator: { readonly allocate: (adapter: string, data: string, assets: bigint) => string; readonly deallocate: (adapter: string, data: string, assets: bigint) => string; readonly setLiquidityAdapterAndData: (adapter: string, data: string) => string; readonly setMaxRate: (rate: bigint) => string; }; readonly user: { readonly deposit: (assets: bigint, onBehalf: string) => string; readonly mint: (shares: bigint, onBehalf: string) => string; readonly withdraw: (assets: bigint, receiver: string, onBehalf: string) => string; readonly redeem: (shares: bigint, receiver: string, onBehalf: string) => string; readonly transfer: (to: string, shares: bigint) => string; readonly transferFrom: (from: string, to: string, shares: bigint) => string; readonly approve: (spender: string, shares: bigint) => string; readonly permit: (owner: string, spender: string, shares: bigint, deadline: bigint, v: number, r: string, s: string) => string; readonly forceDeallocate: (adapter: string, data: string, assets: bigint, onBehalf: string) => string; readonly accrueInterest: () => string; }; }; /** * Flatten an array of actions (which may contain string or string[]) into * a flat string[] suitable for the contract's `multicall(bytes[])` arg. */ export declare function flattenActions(actions: readonly Action[]): string[];