Skip to content

gnosisguild/zodiac-module-oz-governor

Repository files navigation

Zodiac OZ Governor Module

Build Status Coverage Status Contributor Covenant

The OZ Governor Module belongs to the Zodiac collection of tools, which can be accessed through the Zodiac App available on Gnosis Safe, as well as in this repository.

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

About the OZ Governor Module

The OZ Governor Module is an opinionated implementation of OpenZeppelin's Governor contracts designed to be used in a Zodiac-style setup, allowing a Avatar (like a Gnosis Safe) to controlled by on-chain governance similar to Compound's Governor Alpha and Bravo.

This module makes no changes to the existing Governor interface, in order to maintain compatibility with existing applications that support Governor. However, it does modify the behaviour of some existing functions, along with adding some additional functions, to enable it to be more easily used with an avatar.

Specifically, the following changes are important to note:

  1. _executor() returns the address stored at owner. So all onlyGovernance() checks are now equivalent to onlyOwner() checks.
  2. owner can be set with transferOwnership(). This is important for enabling complex governance setups where the avatar may differ from the account that owns the governor module.
  3. execute encodes the provided array of transactions as a delegate call to the multisend contract and triggers a call to execTransactionFromModule() on the address stored at target. This enables governor to be chained with other modifiers, like the Delay or Roles modifiers.

Warning: Tokens or value MUST NEVER be sent to the address of a deployed instance of this module, as they will be immediately lost. Rather, all value should be stored in the attached avatar (Gnosis Safe).

Commands

yarn install # install dependencies
yarn build # compiles contracts
yarn coverage # runs the tests and displays contract coverage report

Deployment

For each command, the network can be specified by adding the network argument, for instance --network hardhat.

For a full test setup run:

yarn deploy

This will deploy a mastercopy for the module, a mastercopy of the ERC20Votes token, a mastercopy of the ERC721Votes token. Then it will deploy a test avatar, and create a minimal proxy for the ERC20 Votes token and set up a minimal proxy for the module (using the test avatar and ERC20 Votes proxy).

To deploy the mastercopy of the module:

yarn deploy --tags moduleMastercopy

To deploy the mastercopy of the ERC20 Votes token:

yarn deploy --tags erc20VotesMastercopy

To deploy the mastercopy of the ERC721 Votes token:

yarn deploy --tags erc721VotesMastercopy

License

Created under the LGPL-3.0+ license.

Audits

An audit has been performed by the G0 group.

All issues and notes of the audit have been addressed in commit e8281f03779427cd1716e078b712f42473f36e7c.

The audit results are available as a pdf in this repo.

Security and Liability

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

About

A implementation of OpenZeppelin's Governor as a Zodiac module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •