/** * Security-critical contract-address resolution for fund-moving LIT Actions. * * F1 remediation. On enforced chains (sepolia/ethereum, where * `policy.pinContractAddresses` is true) the security-critical addresses come * from the generated pinned map — NOT from the caller — so an attacker who * drives the signer with look-alike contract addresses on a real chain cannot * make a fake `PositionManager` report `borrower = attacker`. On hardhat * (`pinContractAddresses === false`) the caller-supplied addresses are used * exactly as before (audit C-1), because local deployments are freshly * generated every run and carry no real funds. * * The switch is the signed chain policy, never a mutable server env — see * ChainPolicy.pinContractAddresses. */ import { ChainPolicy } from "./chain-policy"; /** * The addresses the btc-transaction-signer must never take from the caller on an * enforced chain. Kept in sync with LIT_ACTIONS_PINNED_KEYS in * sdk/scripts/sync-deployments.js (the generator of the pinned map). */ export declare const SECURITY_CRITICAL_ADDRESS_KEYS: readonly ["PositionManager", "LoanOperationsManagerModule", "BTCSpendAuthorizer", "BitcoinProviderRegistry", "LITActionValidator", "PositionDelegateRegistry", "TermManagerModule", "UCDController", "LiquidationManagerModule"]; export type SecurityCriticalAddressKey = (typeof SECURITY_CRITICAL_ADDRESS_KEYS)[number]; export type ResolvedContractAddresses = Record; /** * Resolve the contract addresses a fund-moving action should use. * * - hardhat (`!policy.pinContractAddresses`): returns a copy of the * caller-supplied map unchanged. * - sepolia/ethereum (`policy.pinContractAddresses`): returns the caller map * with every security-critical key OVERWRITTEN by the pinned value. Fails loud * (throws) if the chain has no pinned set, if a required pinned anchor is * missing, or if the caller SUPPLIED a value that contradicts the pinned one — * surfacing a malicious/misconfigured caller instead of silently ignoring it. * * Non-security-critical caller values (keys the action does not pin) are passed * through unchanged on every chain. */ export declare function resolveSecurityCriticalAddresses(policy: ChainPolicy, callerSupplied: Record | undefined): ResolvedContractAddresses; /** * Agent-path trust anchors (Safe-delegated withdrawal hardening, 2026-08-05). * * Deliberately NOT part of `SECURITY_CRITICAL_ADDRESS_KEYS` above. * `AgentModuleFactory` has no mainnet deployment yet * (`contracts/deployments/deployment.mainnet.json` has no `AgentModuleFactory` * entry — deploying one is decision D-1, deferred to the Master). Folding * these into the mandatory 6-key set would make * `generateLitActionsPinnedAddresses` (sdk/scripts/sync-deployments.js) omit * chainId 1 ENTIRELY from the pinned map — it drops a chain if ANY required * key is missing from that chain's deployment record — which would make * `resolveSecurityCriticalAddresses` throw on EVERY mainnet call, including * the ordinary borrower withdrawal path that has nothing to do with agents. * * `BitcoinWithdrawalAddressRegistry` rides in the same best-effort map because * it is the destination bound the Safe-agent arm ENFORCES — the only bound on a * delegated zero-debt withdrawal — so it must be pinned (never caller-supplied) * and, when absent, make the agent arm refuse rather than brick the borrower * path. See `resolveWithdrawAllowlistRegistry`. * * Kept in sync with `AGENT_PATH_PINNED_KEYS` in sdk/scripts/sync-deployments.js. */ export declare const AGENT_PATH_ADDRESS_KEYS: readonly ["AgentModuleFactory", "AgentDelegationRegistry", "BitcoinWithdrawalAddressRegistry"]; export type AgentPathAddressKey = (typeof AGENT_PATH_ADDRESS_KEYS)[number]; export type ResolvedAgentPathAddresses = Partial>; /** * Resolve the agent-path trust anchors for the current chain, BEST EFFORT. * * Unlike `resolveSecurityCriticalAddresses`, a missing pin here is NOT a * hard error — it is the signal callers evaluating the Safe-agent * authorization arm must treat as "refuse" (see * `AuthorizationModule.checkSafeAgentWithdrawAuthorization`, which refuses * without a chain read when `factory`/`registry` come back undefined). The * ordinary borrower withdrawal path never calls this function and is * completely unaffected by a chain missing an agent-path pin. * * Fail-closed is the DEFAULT here, not opt-in: `lit-ops` standalone mode * pins nothing (`lit-ops.module.ts:2021-2034`) and `AGENT_DELEGATION_REQUIRED` * is set in no deployed environment, so a guarantee that depended on an * opt-in flag would hold on only one caller. Returning "absent" by default * for every unpinned key is what makes the agent arm fail closed everywhere, * regardless of which service calls it. * * On hardhat (`!policy.pinContractAddresses`) the caller-supplied addresses * are trusted, matching `resolveSecurityCriticalAddresses`. */ export declare function resolveAgentPathAddresses(policy: ChainPolicy, callerSupplied: Record | undefined): ResolvedAgentPathAddresses; /** * Decide which `BitcoinWithdrawalAddressRegistry` the withdrawal action's * destination-allowlist gate (Step 2.6) must check against, given HOW the call * was authorized. Named and pure so the fail-closed invariant is provable in * isolation rather than buried inline in a 1400-line action (same reasoning as * `assertAgentWithdrawFloor`). * * DELEGATED (Safe-agent) withdrawal — `authorizedViaAgent`: * The destination allowlist is the ONLY bound on such a withdrawal at zero * debt (a leaked agent key is a single key, not the owner quorum), so it MUST * be enforced against a TRUSTED address the caller can neither substitute * (a sham registry that self-approves) nor omit (to skip the check). Only the * PINNED value is acceptable, and it MUST be present — a missing pin THROWS * (fail closed), never falls through to "skip". `callerSuppliedRegistry` is * ignored entirely on this path. * * BORROWER / EIP-1271 withdrawal — the default: * A full owner quorum already signed the exact destination, so this stays * defense-in-depth: the caller-supplied value is used as before and an absent * one means "skip" (the staged-rollout posture, unchanged). Returning * `undefined` is the signal to skip Step 2.6 on this path. * * @param authorizedViaAgent True iff `checkSafeAgentWithdrawAuthorization` (not * the borrower/EIP-1271 arms) authorized this withdrawal. * @param pinnedAgentRegistry `resolveAgentPathAddresses(...).BitcoinWithdrawalAddressRegistry` * — pinned on enforced chains, caller-supplied only on hardhat, undefined if unpinned. * @param callerSuppliedRegistry The raw jsParams value, used ONLY on the non-agent path. * @returns The registry address to enforce against, or `undefined` to skip * (non-agent path only). THROWS when a delegated withdrawal has no * trusted registry to check against. */ export declare function resolveWithdrawAllowlistRegistry(authorizedViaAgent: boolean, pinnedAgentRegistry: string | undefined, callerSuppliedRegistry: string | undefined): string | undefined; //# sourceMappingURL=pinned-addresses.d.ts.map