/M0-TTG

TTG, "Two Token Governance," is a governance mechanism that uses token voting to maintain lists and manage communal property

Primary LanguageSolidityGNU General Public License v3.0GPL-3.0

TTG (Two Token Governance)

A TTG, "Two Token Governance" is a governance mechanism that uses token voting to maintain lists and manage communal property. As its name implies, it primarily optimizes for token holder participation. A TTG is primarily used for permissioning actors and should not be used for funding/financing decisions.

Development

Installation

You may have to install the following tools to use this repository:

  • foundry to compile and test contracts
  • lcov to generate the code coverage report
  • yarn to manage npm dependencies
  • slither to static analyze contracts

Install dependencies:

yarn
forge install

Compile

Run the following command to compile the contracts:

forge compile

Coverage

Forge is used for coverage, run it with:

yarn coverage

You can then consult the report by opening coverage/index.html:

open coverage/index.html

Test

To run all tests:

forge test

Run test that matches a test contract:

forge test --mc <test-contract-name>

Test a specific test case:

forge test --mt <test-case-name>

To run slither:

yarn slither

Code quality

Prettier is used to format Solidity code. Use it by running:

yarn prettier

Solhint is used to lint Solidity files. Run it with:

yarn solhint

Or to autofix some issues:

yarn solhint-fix

Documentation

Forge is used to generate the documentation. Run it with:

yarn doc

The command will generate the documentation in the docs folder and spinup a local server on port 4000 to view the documentation.

TTG Smart Contract Architecture

ttg