ERC-5005 Zodiac modular account standard (Zodiac Modular Accounts)

Stagnant · Accounts & wallets · created 2022-04-14

A standard that separates a contract account (avatar) from its authentication and execution logic (modules, guards) via standard interfaces, allowing programmable accounts such as DAOs to freely swap and combine control tools.

Why it is needed

Most current DAO tools and programmable accounts are built with a monolithic structure, where authentication logic and execution logic are mixed together in a single contract or a tightly coupled set of contracts. This makes switching how an account is controlled, or moving to different tooling, costly, resulting in lock-in to a specific platform. It also makes it difficult to use multiple control mechanisms simultaneously, build cross-chain governance, or design flexibly so that governance can be progressively decentralized as a community matures.

What to implement

In depth

Four core concepts

This standard is composed of four concepts: Avatar, Module, Modifier, and Guard. The avatar is the externally referenced programmable account that holds balances, owns the system, and executes transactions; it MUST implement IAvatar. A module is a contract containing execution logic that has been enabled by the avatar. A modifier is a contract that sits between a module and the avatar and modifies the module's behavior, for example imposing a delay or restricting the scope of every function the module tries to execute, and it MUST implement IAvatar. A guard is optionally set on a module or modifier and performs pre- and post-checks for each transaction execution, and it MUST implement IGuard.

The IAvatar interface

IAvatar manages modules via enableModule (callable only by the avatar, emits an EnabledModule event on success) and disableModule (takes the previous module's address, prevModule, in the linked list and the module to remove, emits DisabledModule). execTransactionFromModule and execTransactionFromModuleReturnData can only be called by enabled modules, execute a transaction using to, value, data, and operation (0 = call, 1 = delegatecall), and emit ExecutionFromModuleSuccess on success or ExecutionFromModuleFailure on failure. isModuleEnabled returns whether a module is enabled, and getModulesPaginated retrieves the list of modules in pages.

IGuard and Guardable

For a module, modifier, or avatar to support guard functionality, it must inherit Guardable, and MUST call checkTransaction before triggering execution and checkAfterExecution after execution completes. checkTransaction receives all parameters of a Safe transaction (to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures, msgSender), but module transactions only use the first four (to, value, data, operation) and the rest are fixed at 0. setGuard checks whether the address being set as the guard supports the IGuard interfaceId via ERC165, and reverts with a NotIERC165Compliant error if not.

Operation and transaction types

Enum.Operation has two values, Call and DelegateCall; as the operation argument to execTransactionFromModule(ReturnData), 0 means call and 1 means delegatecall. Allowing delegatecall means a module can execute arbitrary code within the avatar's storage context, so since this interface design exposes that value directly, trust in the module is critical.

Design goal: compatibility with existing tooling

The interface defined by this standard is designed to be as compatible as possible with most programmable accounts currently in wide use. The source states this is meant to allow the standard to be adopted without major changes to existing tooling.

Backward compatibility

The source explicitly states that this standard introduces no backward compatibility issues.

Proposal status

This proposal is in Stagnant status, meaning it is no longer actively discussed or progressed. It should be kept in mind that the content of the standard may change or may never be adopted.

Things to watch out for

Original ERC · ← ERCs