Templates

Create templates for easy DAO setup.

How does it work?

Creating a DAO with all the desired apps and permissions requires multiple operations that must be properly orchestrated. In the context of Ethereum, performing all these operations would require sending many transactions. This would not only be very costly, as every transaction needs to pay for gas, also the integrity of the deployment depends on all operations occurring in the right order.

For these reasons, the recommended way of creating Aragon DAOs is using what we call templates, on-chain deployment scripts that create a DAO and perform all the required configuration steps in an atomic manner without the possibility of an attacker interacting with the DAO while it is still being set up. Templates allow creating a DAO in just one transaction and when the transaction is processed the DAO is already fully configured and functional.

Templates can also be thought of as DAO templates as every template can create a DAO with specific settings for an organization type.

The two DAO configurations that one can choose from when using the Aragon client correspond to the beta templates (Democracy and Multisig) available in the DAO templates repository.

The above Democracy and Multisig kits have been deprecated and templates should now be used instead. You may still find the kits notation in some places while we make the transition.

Environment setup

Before starting you need to check if you have already installed all these prerequisites:

  • the right version of node.js (recommended v12 LTS version)

  • Metamask web3 provider

  • the aragonCLI (Aragon Command Line Interface)

  • the Aragon Buidler plugin

If you haven't already installed them or if you need more info about this go to the "Environment Setup" paragraph here.

Getting started with templates using the aragonCLI

Now we are ready to build our DAO with the templates.

The aragonCLI (>= v4.1.0) supports using templates to create a DAO to interact with the apps being developed.

To quickly get started developing your own templates:

npx create-aragon-app app

That command will create a new Aragon app project. A sample template for this Counter example app can be found here in Template.sol

Import this in the app under the contracts folder. Then install the @aragon/templates-shared package which contains contract, deployment, and testing utilities to help you build your own template.

Then to run your DAO enter:

cd app
yarn start

When modifying the name of your contract or app name be sure to update those in Template.sol otherwise running the template will fail.

The client should load within few minutes. In case of not, please terminate it and then restart it.

Template structure

All templates follow a similar structure:

  1. Use a DAOFactory to create a DAO.

  2. Assign the template contract the necessary permissions in the DAO needed for installation (usually only APP_MANAGER_ROLE).

  3. Create app proxy instances for all the apps (dao.newAppInstance(...)).

  4. Initialize apps (app.initialize(...)).

  5. Set up permissions for the apps and the DAO.

  6. Clean up the permissions temporarily assigned to the template.

Last updated