Decentralized Autonomous Organizations

To Share and +4 nLEARNs

import Tabs from ‘@theme/Tabs’;
import TabItem from ‘@theme/TabItem’;

Decentralized Autonomous Organizations (DAOs) are self-organized groups that form around common purposes. Membership, decision making,
and funding are coordinated by publicly voting on proposals through a smart contract.

In contrast with FT and NFT, DAO contract’s are not standardized. Because of this, in this page we will use as
reference the sputnik dao implementation. The main concepts covered here should
easily generalizable to other DAO implementations.


Creating a DAO

To create a DAO you first need to deploy the DAO contract factory, and initialize it.

Once deployed and initialized, you can ask the factory to create a new DAO for you. On creation, you will define parameters such as the DAO’s name, its purpose, and its council. Defining the right council is important since its members are the only accounts allowed to vote on proposals.


“`bash
# 1. Deploy the contract in a testnet account
near dev-deploy –wasmFile= –accountId

# 2. Initialize factory contract
near call new –accountId –gas 100000000000000

# 3. Define a council and create DAO
export COUNCIL='[““, ““]’
export ARGS=`echo ‘{“config”: {“name”: ““, “purpose”: ““, “metadata”:”“}, “policy”: ‘$COUNCIL’}’ | base64`

near call create “{“name”: ““, “args”: “$ARGS”}” –accountId –amount 10 –gas 150000000000000
“`


Voting policy

Currently, the DAO supports two different types of voting policies: TokenWeight, and RoleWeight.

When the vote policy is TokenWeight, the council votes using tokens. The weigh of a vote is the proportion of tokens used for voting over the token’s total supply.

When the vote policy is RoleWeight(role), the vote weigh is computed as "one over the total number of people with the role".

Both voting policies further include a "threshold" for passing a proposal, which can be a ratio or a fixed number. The ratio indicates that you need a proportion of people/tokens to approve the proposal (e.g. half the people need to vote, and to vote positively). A fixed number indicated that you need a specific number of votes/tokens to pass the proposal (e.g. 3 people/tokens are enough to approve the proposal).


Adding a Proposal

By default, anyone can add a proposal to the DAO, but a minimum of 1Ⓝ needs to be attached as a bond. This however can be changed by setting roles in the DAO. The type of proposals that can be added is predefined, and include actions such as:

  1. Adding a member to the council.
  2. Calling a method in a smart contract.
  3. Transferring NEAR or a FT to some account.

Each action has its own kind of arguments. The complete list of actions can be found here.


“`bash
near call add_proposal
‘{“proposal”: {“description”: ““, “kind”: {““: {““: ““, ““: ““}}}}’
–accountId proposer.testnet
–amount 1

“`



Acting on a Proposal

Once a proposal is added, council members can act on them calling the act_proposal method. The available actions are one of the following: AddProposal, RemoveProposal, VoteApprove, VoteReject, VoteRemove, Finalize, or MoveToHub.


“`bash
near call act_proposal ‘{“id”: , “action”: ““}’ –accountId
“`


Each time somebody acts on the proposal, the DAO checks if the proposal has enough votes to be approved. If the proposal is approve, then the DAO executes the proposal (for example, adding a new member to the council).

Generate comment with AI 2 nL
Scroll to Top
Report a bug👀