Skip to content

MandateFactory

MandateFactory is a UX orchestrator. It bundles the two steps of attaching a configurable permission — template.configure(...) then kernel.registerPermission(...) — into a single transaction, and forwards the registration fee with an automatic refund of any excess. License: GPL-2.0-or-later.

The factory has no privilege. Every inner call is independently signature-authenticated:

  • configure carries an EIP-712 signature from the account’s Permission Signer (verified by the template against the kernel).
  • registerPermission carries an EIP-712 signature from the Permission Signer (verified by the kernel).

So the factory’s only value is bundling, fee forwarding, and a canonical entry point for tooling. Anyone can deploy a template implementing IConfigurablePermission and use it with the factory immediately — no allowlist, no registry. Its receive() accepts ETH only from the kernel (the fee refund), preventing balance-inflation games against the refund accounting.

FunctionWhat it does
attachconfigure one template, then registerPermission, one tx; refunds fee excess.
attachBatchconfigure N templates, then registerPermissions atomically.
reconfigurere-configure a template’s params for an account (no kernel touch).
replaceconfigure a new template, then replacePermission (atomic kernel swap).
deployAndAttachclone a standalone template (EIP-1167), initialize it, then registerPermission — one tx.
detach / detachBatchrevokePermission(s) for an account.

deployAndAttach deploys an EIP-1167 minimal-proxy clone of a logic contract via Clones.cloneDeterministic, with the salt namespaced by msg.sender (keccak256(abi.encode(msg.sender, salt))) to prevent cross-caller salt squatting. Predict the address beforehand with predictCloneAddress(impl, salt)from the same EOA that will send deployAndAttach, because of the namespacing. After init, a liveness check (CloneInitializable.initialized()) guards against a clone that failed to initialize.

Attached, BatchAttached, Reconfigured, Replaced, Detached, BatchDetached, and CloneDeployedAndAttached(account, impl, clone, salt).