ERC-5005 · Stagnant · ERC · 2022-04-14
ERC-5005: Zodiac Modular Accounts
Proposed standard interfaces (Zodiac) that split a smart account into an avatar that holds assets and pluggable modules, modifiers and guards that decide what it may do, so DAOs can mix and swap tools.
What problem does it solve?
Most DAO frameworks and programmable accounts are monolithic: the contract holding the treasury is tightly coupled to one way of authorising transactions (a particular voting system, a multisig, and so on). Switching tools means migrating everything, which locks projects in.
EIP-5005 (the "Zodiac" design) separates what holds the assets from who can make it act. That lets a DAO run several control mechanisms side by side, swap them later, govern across chains, or decentralise step by step.
How it works
Four roles:
| Role | What it is | Interface |
|---|---|---|
| Avatar | The account itself: holds funds, owns contracts, executes transactions | IAvatar |
| Module | A contract the avatar has enabled that can ask it to execute transactions (e.g. a voting or bridge module) | any |
| Modifier | Sits between a module and the avatar and changes behaviour, e.g. adds a delay or limits scope | IAvatar |
| Guard | Runs checks before and after each transaction a module or modifier executes | IGuard |
Key IAvatar functions:
enableModule(module)/disableModule(prevModule, module): only the avatar itself can call these. Modules are kept as a linked list, henceprevModule.execTransactionFromModule(to, value, data, operation): callable only by an enabled module.operationisCallorDelegateCall.isModuleEnabled,getModulesPaginatedfor discovery.
Guardable contracts store a guard address. Before execution they call checkTransaction(...), and afterwards checkAfterExecution(txHash, success). setGuard checks with ERC-165 that the guard really implements IGuard.
The interfaces were designed to match the most popular programmable accounts in use at the time (Safe's module interface has the same shape), so existing tooling needs few changes.
Sample code
A minimal module that lets one address pay out from the avatar:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
enum Operation { Call, DelegateCall }
interface IAvatar {
function execTransactionFromModule(address to, uint256 value, bytes calldata data, Operation op)
external returns (bool success);
}
contract PayoutModule {
IAvatar public immutable avatar;
address public immutable treasurer;
constructor(IAvatar _avatar, address _treasurer) {
avatar = _avatar;
treasurer = _treasurer;
}
function pay(address to, uint256 amount) external {
require(msg.sender == treasurer, "not treasurer");
bool ok = avatar.execTransactionFromModule(to, amount, "", Operation.Call);
require(ok, "payout failed");
}
}
The avatar must first call enableModule(address(payoutModule)), usually through its own governance.
Things to know
- Status: Stagnant as an ERC, even though the module pattern itself is widely used around Safe accounts.
- Modules have absolute control over the avatar. Only enable a module you would trust with the avatar's entire balance; a
DelegateCallfrom a module can rewrite the avatar's storage. - Several modules acting at once can race each other.
- Nothing stops you from disabling every module that controls an avatar. Do that and the avatar stops working and its funds are stuck.
- Newer modular account standards for ERC-4337 wallets include ERC-7579 and ERC-6900 (both drafts).