Skip to main content

Decentralized Autonomous Organizations

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.

dao

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


Create a DAO

The simplest way to create and interact with a DAO is to go through the AstraDAO UI.

You can also create a DAO by interacting with the sputnik-dao contract.

const args = {
config: {
name: "Primitives",
purpose: "Building primitives on NEAR",
metadata: ""
},
policy: ["bob.near"]
};
Near.call(
"sputnik-dao.near",
"create",
{
name: "primitives",
args: Buffer.from(JSON.stringify(args)).toString("base64"),
},
300000000000000,
6000000000000000000000000
);
note

The full list of roles and permissions you can find here.


Voting policy

Currently, DAOs support 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".

Details

Voting Threshold 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).


List of DAOs

Query the list of DAOs existing in Sputnik Dao.

const result = Near.view("sputnik-dao.near", "get_dao_list");
Example response

[
'ref-finance.sputnik-dao.near'
'gaming-dao.sputnik-dao.near',
...
]


Query Existing Proposals

These snippets will enable you to query the proposals existing in a particular DAO.

const result = Near.view(
"nearweek-news-contribution.sputnik-dao.near",
"get_proposals",
{ from_index: 9262, limit: 2 }
);
Example response

[
{
id: 9262,
proposer: 'pasternag.near',
description: 'NEAR, a top non-EVM blockchain, has gone live on Router’s Testnet Mandara. With Router Nitro, our flagship dApp, users in the NEAR ecosystem can now transfer test tokens to and from NEAR onto other supported chains. $$$$https://twitter.com/routerprotocol/status/1727732303491961232',
kind: {
Transfer: {
token_id: '',
receiver_id: 'pasternag.near',
amount: '500000000000000000000000',
msg: null
}
},
status: 'Approved',
vote_counts: { council: [ 1, 0, 0 ] },
votes: { 'brzk-93444.near': 'Approve' },
submission_time: '1700828277659425683'
},
{
id: 9263,
proposer: 'fittedn.near',
description: 'How to deploy BOS component$$$$https://twitter.com/BitkubAcademy/status/1728003163318563025?t=PiN6pwS380T1N4JuQXSONA&s=19',
kind: {
Transfer: {
token_id: '',
receiver_id: 'fittedn.near',
amount: '500000000000000000000000',
msg: null
}
},
status: 'InProgress',
vote_counts: { 'Whitelisted Members': [ 1, 0, 0 ] },
votes: { 'trendheo.near': 'Approve' },
submission_time: '1700832601849419123'
}
]


Create proposal

Create a proposal so other users can vote in favor or against it.

Near.call(
"primitives.sputnik-dao.near",
"add_proposal",
{
proposal: {
description: "My first proposal",
kind: {
Transfer: {
token_id: "",
receiver_id: "bob.near",
amount: "10000000000000000000000000",
},
},
},
},
300000000000000,
100000000000000000000000
);
info

By default, only council members can create proposals.


Vote for proposal

These snippet will enable your users to cast a vote for proposal of a particular DAO.

Near.call(
"primitives.sputnik-dao.near",
"act_proposal",
{ id: 0, action: "VoteApprove" },
300000000000000
);
note

Available vote options: VoteApprove, VoteReject, VoteRemove.


Additional Resources

  1. AstroDAO UI - the web app built on top of the Sputnik DAO Contract. Allows users to create and manage DAOs.
  2. List of DAOs as a NEAR component
Was this page helpful?