Gitcoin logo

Sandbox dApp for experimenting with Moloch DAO mechanics Governance is hard, especially on-chain. The Moloch aims to simplify ā€œDecentralized Autonomous Organizationsā€. This is a sandbox for playing around with the mechanics and game theory behind a minimum viable DAO.

Sandbox dApp for experimenting with Moloch DAO mechanics

Governance is hard, especially on-chain. The Moloch aims to simplify ā€œDecentralized Autonomous Organizationsā€. This is a sandbox for playing around with the mechanics and game theory behind a minimum viable DAO.

To get started, youā€™ll need Clevis or at least Docker installed on your machine. With Clevis installed directly itā€™s faster, but there are few other commands to run. Iā€™ll default to the Docker version because it works universally. Letā€™s start by cloning down the repo:

cd ~;git clone https://github.com/austintgriffith/moloch

Next, letā€™s fire up our Docker container. This will bring up a private blockchain, the dApp, and the Clevis command prompt:

docker run -ti --rm --name clevis -p 3000:3000 -p 8545:8545 -v ~/moloch/app:/dapp austingriffith/clevis:latest

Note: the ~/moloch/apppart needs to point to where you cloned down the Moloch repo, specifically the app directory.

Note: Make sure you donā€™t have anything running on port 3000 or 8545 already. This container brings up ganache and CRA for you.

Eventually, you will get a clevis prompt and you can test that everything works by running:

šŸ—œļø Clevis:/dapp šŸ—œļøclevis test version

Note: donā€™t paste in ā€œšŸ—œļø Clevis:/dapp šŸ—œļøā€ this is just an indicator that you are putting a command in the Clevis container.

When the Clevis prompt comes up and everything is ready to go, youā€™ll want to compile, deploy, test, and publish your smart contracts with:

šŸ—œļø Clevis:/dapp šŸ—œļøclevis test full

You can edit your code that is injecting into the Clevis container from your native operating system used a command like:

atom ~/moloch

When the container comes up, you will also have a Create React App ready:

http://localhost:3000
Make sure you have MetaMask pointed to the local RPC (http://localhost:8545)

The first screen of the Moloch Sandbox is the deployment screen:

Youā€™ll also notice in the top right that we donā€™t have any ETH in our test accounts. Letā€™s fix that by editing the app/tests/clevis.js file. Look for the metamask() function in particular:

Replace these addresses with your address and you will be supplied with ETH and coins at deploy.

To make this test payout, you can run:

šŸ—œļø Clevis:/dapp šŸ—œļøclevis test metamask

Note: This will also run any time the ā€œclevis test fullā€ command runs.

Now we have ETH and we are ready to deploy.

foundersAddressesis a comma separated list of founding members for you Moloch DAO. They are added to the initial Members list with having to pay any tribute.

foundersVotingSharesis a comma separated list of the voting shares to be given each respective founding memeber.

periodDurationis the time in seconds each period will last. The default for this will be 86400 to represent one day.

votingPeriodLengthis the number of periods a proposal will be open for votes. The default for this will be 7.

gracePeriodLength is the number of periods after a proposal is closed for voting to allow members that voted no to ā€œRageQuitā€ (exchange their voting shares for tokens from the Guild Bank).

proposalDepositis mainly just for Sybil resistance. It is a stake that must be put up for each new proposal. Only one new proposal can be introduced per period so itā€™s important that they canā€™t be spammed.


After you deploy your contract, you can see the specific parameters of your DAO along with current period information and total voting shares:

The UI is really ā€œnastyā€ right now. Sorry. Itā€™ll look really nice soonā€¦

The first thing to test is to submit a proposal from your first account that will deposit some coins. Along with the Moloch contracts, clevis test full has also deployed two ERC20 tokens ā€œSomeCoinā€ and ā€œAnotherCoinā€. You should edit the app/tests/clevis.js to mint you some of these on deploy.

You will need to hit ā€œApproveā€ to make sure you allow the Moloch contract to move your coins.

If you ever see this ā€œout of gasā€ error, itā€™s because you need to update your period. This runs at the start of every major action too, but with short periods it can be very dynamic, so if you see this:

You will want to run:

Note: We will fix this soon so the frontend will fake what period it shows based on time, the updatePeriod will run on a cron, and major functions will be provided with the correct amount of gas to update first.

Once you submit your proposal, it will show up in the list with all the parameters:

Wants 100 voting shares for a tribute of the coins. Voting starts at 22, ends at 25, and is processed after 28.

As you vote for a proposal you will see the votes increase:

When enough periods have passed (keep hitting the updatePeriod button). You will be able to ā€œProcessā€ the proposal:

Once this vote passes, we will see coins deposited in the Guild Bank:

And we will also see the members section where voting shares has updated:

We can see votingShares increased to 200 and coin balances decreased.

As an example, letā€™s say that first user now wantā€™s to Rage Quit. If they ā€œCollect Loot Tokensā€ and then ā€œApproveā€ and ā€œRedeem Loot Tokensā€. They will exit the DAO and collect their share from the Guild Bank:

Conclusion

These are the basic mechanics of the Moloch DAO. You can fire up your own DAO locally with a couple commands and play with the game theory locally. Please contribute to this repo hereor the main Moloch repo here. Feedback is always welcome, Iā€™m šŸ› ļø@austingriffith on Twitter and Telegram. The original Moloch DAO code was created by šŸ‘¹Ameen Soleimani (@ameensol).

If you are interested in contributing to this project, a major UI design is in the works. A React wizard might be needed to help integrate a beautiful design.

Featured Posts

Announcing: Zuzalu QF Grants Program on Grants Stack

Announcing: The Village Infra on Polygon#1 Round on Grants Stack

Gitcoin Grants Round 19: Results and Recap

loading
loading