dao/README.md

2.0 KiB

dao

Moonstream DAO

Deployments

You can find the addresses for all Moonstream DAO contracts on our operations page.

Development environment

Preparing your development environment

Moonstream DAO is built with Solidity, Python, and shell scripts.

We use brownie to build our smart contracts, deploy them, and perform operations on them.

We use moonworm to generate Python interfaces to our smart contracts from their ABIs.

To set up an environment in which you can develop on Moonstream DAO, first create a Python3 environment.

Using the built in venv module:

python3 -m venv .dao

Then make sure that this new environment is active. If you used venv as above:

source .dao/bin/activate

Finally, install the dependencies and developer dependencies for dao:

pip install -e ".[dev]"

Tests

To run unit tests, run: ./test.sh

Before you do this, you must make sure that a Python environment is available in your shell and that you have installed the development dependencies in this environment.

Development workflow

Every time you add, remove, or modify an external or public method from a Solidity smart contract in this repository, make sure to regenerate its Python interface.

You can do this by activating your Python development environment and running the following command from the repository root:

moonworm generate-brownie -p . -o dao -n "<name of Solidity contract you modified>"

For example, if you modify the TerminusFacet contract, you would then run this command:

moonworm generate-brownie -p . -o dao -n TerminusFacet

VSCode setup

If you are using the Solidity extension in VSCode, merge the following snippet into your settings.json:

{
    "solidity.remappings": [
        "@openzeppelin-contracts/=<path to your home directory>/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.3.2"
    ]
}