Skip to content
Projets

zodiaceco/zodiac-deployments

Voir sur GitHub

À propos

Une bibliothèque d’outils composables pour les entités on-chain.

Outils de développement

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

Zodiac: The expansion pack for DAOs

Build Status Contributor Covenant

A composable design philosophy for DAOs, Zodiac is a collection of tools built according to an open standard.

Zodiac Icons

The Zodiac collection of tools can be accessed through the Zodiac App available on Safe, as well as through the repositories below. If you have any questions about Zodiac, join the Gnosis Guild Discord.

This repository holds the mastercopy registry and tooling, and links to each tool's own repository below. (For guides and tutorials, see the Zodiac documentation.)

Zodiac enables:

  • Flexible, module-based control of programmable accounts
  • Un-opinionated standards for programmable account interaction
  • Reusable implementations of core and factory logic

The Zodiac open standard consists of Avatars, Modules, Modifiers, and Guards architecture:

1. Avatars are programmable Ethereum accounts, like Safe. Avatars are the address that holds balances, owns systems, executes transactions, is referenced externally, and ultimately represents your DAO. Avatars must expose an interface like IAvatar.sol.

2. Modules are contracts enabled by an Avatar that implement some decision making logic. They should import Module.sol.

3. Modifiers are contracts that sit between Modules and Avatars to modify the Module's behavior. For example, they might enforce a delay on all functions a Module attempts to execute. Modifiers should import Modifier.sol and must expose an interface like IAvatar.sol.

4. Guards are contracts that can be enabled on Modules and implement pre- or post-checks on each transaction that the Module executes. This allows Avatars to do things like limit the scope of addresses and functions that a module can call or ensure a certain state is never changed by a module. Guards should import BaseGuard.sol.

Overview

This repository contains the Zodiac mastercopy registry and tooling: a small TypeScript SDK with the known Zodiac contracts, their canonical addresses and per-version ABIs, plus a maintenance CLI that extracts deployed mastercopies (ABI, source and deployment data) from block explorers into a versioned mastercopies/ folder.

The Zodiac core contracts (Module.sol, Modifier.sol, BaseGuard.sol, ModuleProxyFactory.sol, etc.), along with their tests, live in zodiac-core. If you are building a module, modifier, or guard, use the @gnosis-guild/zodiac-core package.

Installation

npm install @zodiaceco/deployments

The package ships both ESM and CommonJS builds. It was previously published as @gnosis-guild/zodiac, which no longer receives updates.

Usage

The npm package publishes the SDK (MastercopyName, CanonicalAddresses, SupportedNetworks, getZodiacModuleAddress, and getZodiacModuleAbi) and the mastercopies/ artifacts, without their source.json files. The maintenance CLI is not published to npm.

import { getContract, type Abi, type Address, type Client } from "viem";
import {
  getZodiacModuleAbi,
  getZodiacModuleAddress,
  MastercopyName,
} from "@zodiaceco/deployments";

function connectDelayModule(client: Client) {
  return getContract({
    address: getZodiacModuleAddress(MastercopyName.DELAY, "1.1.1") as Address,
    abi: getZodiacModuleAbi(MastercopyName.DELAY, "1.1.1") as Abi,
    client,
  });
}

Both helpers accept an exact version or a semver range (defaulting to "*", where the latest matching version wins), and throw for an unknown or known-faulty mastercopy.

The raw artifacts are importable as JSON, for example to place a mastercopy at its canonical address in a local test node:

import delay from "@zodiaceco/deployments/mastercopies/delay/1.1.1/Delay/deployment.json" with { type: "json" };

await testClient.setCode({
  address: delay.address as Address,
  bytecode: delay.runtimeCode as Hex,
});

setCode skips the constructor; to run it, send initCode and salt to the factory instead. A deployment.json always has address; factory, salt, initCode and runtimeCode are present only when they could be recovered.

To deploy module proxies or mastercopies (encodeDeployProxy, predictProxyAddress, encodeDeploySingleton, predictSingletonAddress) or import the base Solidity contracts (Module.sol, Modifier.sol, BaseGuard.sol), install @gnosis-guild/zodiac-core:

npm install @gnosis-guild/zodiac-core
pragma solidity ^0.8.24;

import "@gnosis-guild/zodiac-core/contracts/core/Module.sol";

contract MyModule is Module {
  /// insert your code here
}

Maintenance CLI

The mastercopies/ artifacts are produced and managed with a CLI that runs the TypeScript source directly with Bun (no build needed). Every command is driven by the known-contract registry — you pass a name and version, not an address, and unknown names/versions error out.

bun install

bun run extract <name> <version> [network]             # explorer -> mastercopies/
bun run deploy <name> <version> [--network a,b]        # deploy missing contracts on each network
bun run deploy:list <name> [version] [--network a,b]   # report per-network deployment status
bun run verify <name> <version> [--network a,b]        # verify deployed contracts on each explorer
bun run verify:list <name> [version] [--network a,b]   # report per-network verification status
bun run abigen                                         # mastercopies/ -> src/sdk/abis (runs before every build)

extract captures one mastercopy into mastercopies/ and replaces the existing folder after validating the new artifact. It uses [network] when given and tries a default set of networks otherwise. The explorer provides the verified source, ABI, and deployment transaction hash. The CLI reads the transaction over RPC to recover the factory, init code, and salt, and reads the runtime bytecode over RPC. The recovered inputs let deploy reproduce the address on networks that have the factory. If deployment recovery fails, the artifact still records the address, ABI, and source. The CLI discovers linked libraries from the compiler input and extracts them recursively. It writes one folder for the main contract and one for each linked library.

mastercopies/<name>/<version>/<contract>/abi.json
mastercopies/<name>/<version>/<contract>/source.json       # standard-JSON compiler input
mastercopies/<name>/<version>/<contract>/deployment.json   # address, plus factory, salt, initCode and runtimeCode when recovered

deploy redeploys those contracts to their canonical addresses on each configured network (via the ERC-2470 / Nick CREATE2 singleton factories), skipping any that already exist; verify submits the bundled source to each network's explorer (Etherscan V2, or a chain-specific Etherscan-compatible explorer — e.g. a Blockscout instance — where Etherscan V2 is unavailable) and to Sourcify on every chain Sourcify supports. The explorer decides whether a network passes; a failed Sourcify submission is reported as a warning and retried on the next run, and an unreachable Sourcify doesn't fail a network the explorer reports as verified — except where Sourcify is the only option, as on BOB. Rate-limited requests are retried a few times with a doubling backoff before giving up. The list subcommands report status without making changes, for every known version unless [version] is given. --network limits a command to the given networks (names or chain ids).

Environment

Configure these in a .env file — see .env.sample:

  • ETHERSCAN_API_KEY — Etherscan V2 key, shared by every chain on Etherscan V2. Override per network with ETHERSCAN_API_KEY_<NETWORK> (e.g. for a chain-specific explorer such as Scrollscan). The Blockscout explorers (Ink, Robinhood) ignore it, and Sourcify needs none. Used by extract and verify.
  • ALCHEMY_KEY — optional; used for RPC on the chains Alchemy serves. Public endpoints are used otherwise.
  • MNEMONIC — signer used by deploy (local signing, the default).
  • DEPLOY_VIA_FRAME — set to a truthy value (1/true/yes/on) to sign deploy transactions through a locally running Frame wallet instead of MNEMONIC (e.g. to use a hardware wallet). When enabled, Frame must be running and MNEMONIC is ignored.

Zodiac compliant tools

Avatars

  • Safe: The most trusted platform for managing digital assets on Ethereum. Zodiac embraces Safe as a powerful, extensible and programmable account standard. Safe is the reference implementation of the IAvatar.sol interface specified in zodiac-core. However, all Zodiac tools are framework agnostic, and they can be plugged into any programmable account that implements the IAvatar interface.

Modules

  • Bridge (developed by Gnosis Guild): This module allows an address on one chain to control an avatar on another chain using an Arbitrary Message Bridge (AMB). This enables a DAO on one chain to control assets and interact with systems like a Safe on a different chain.
  • Exit (developed by Gnosis Guild): This module allows users to redeem a designated token for a relative share of an avatar's assets, similar to MolochDAO's infamous rageQuit() function.
  • Governor (developed by Gnosis Guild): An opinionated implementation of OpenZeppelin's Governor contracts designed to be used in a Zodiac-style setup, allowing an Avatar (like a Safe) to be controlled by on-chain governance similar to Compound's Governor Alpha and Bravo.
  • Optimistic Governor (developed by Outcome Finance): This module allows on-chain executions based on Snapshot proposal results. The module utilizes UMA's optimistic oracle to govern a Safe based on a set of rules defined off-chain.
  • Reality (developed by Gnosis Guild): This module allows on-chain execution based on the outcome of events reported by Reality.eth. While built initially to execute Safe transactions according to Snapshot proposals, this module is framework agnostic. It can enable proposal execution from just about anywhere. For example, it can bring Discord polls on-chain.
  • Safe Minion (developed by DAOHaus): This module allows Moloch DAOs to manage the assets in a Safe based on the outcome of v2 Moloch DAO proposals. Safe Minion enables Moloch DAOs to manage collections of NFTs, manage LP positions with AMMs, and initiate any other arbitrary interactions. It enables DAOs that start as a Safe to later delegate governance to a Moloch DAO.
  • Tellor (developed by Tellor): This module allows on-chain executions based on Snapshot proposal results, it uses the Tellor oracle to retrieve the data in a secure and decentralized manner.
  • Usul (developed by SekerDAO): This module allows avatars to operate with trustless tokenized DeGov, similar to Compound or Gitcoin, with a time-boxed proposal core that can register swappable voting contracts. This enables DAOs to choose from various on-chain voting methods that best suit their needs.

Modifiers

  • Delay (developed by Gnosis Guild): This modifier allows avatars to enforce a time delay between when a module initiates a transaction and when it will be executed by an avatar.
  • Roles (developed by Gnosis Guild): This modifier allows for fine-grained, role-based, access control for enabled modules. Scopes for a given role include allowed addresses, and optionally include allowed functions on allowed addresses, allowed parameters on allowed functions, whether or not delegate calls are allowed to an allowed address, and whether or not value (ETH) can be sent to an allowed address.

Guards

  • Meta (developed by Cardstack): This guard allows an avatar to have multiple checking processes by registering multiple guards to this meta guard.
  • Scope (developed by Gnosis Guild): This guard allows an avatar to limit the scope of the addressable functions with which its owners can interact. This enables the avatar to define granular permissions for different control mechanisms.

Support and Contributions

Have you built something cool that belongs in this collection of Zodiac tools and want to add it to the list? Follow our contribution guidelines to open a PR!

If you have any questions about Zodiac, join the Gnosis Guild Discord. Follow @zodiaceco on X for updates.

The Zodiac documentation offers tutorials on how to use the Zodiac App.

Audits

Zodiac has been audited by the G0 group.

All issues and notes of the audit have been addressed in the release candidate v0.1.0 with commit hash 8a77e7b224af8004bd9f2ff4e2919642e93ffd85 and the subsequent release v1.0.0.

The audit results are available as a pdf in this repo or in the g0-group's github repo.

Later audit reports are in the audits folder:

Security and Liability

All contracts and tooling are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

License

Zodiac is created under the LGPL-3.0+ license.

Explorer des projets similaires

Chargement…