Coder Social home page Coder Social logo

da0-da0 / dao-contracts Goto Github PK

View Code? Open in Web Editor NEW
203.0 15.0 134.0 6.44 MB

CosmWasm smart contracts for Interchain DAOs.

Home Page: https://docs.daodao.zone

License: BSD 3-Clause "New" or "Revised" License

Rust 99.12% Shell 0.78% JavaScript 0.01% Just 0.09%
cosmwasm dao rust multisig governance interchain

dao-contracts's Introduction

DAO Contracts

GitHub tag (with filter) GitHub contributors

GitHub commit activity (branch) codecov

Discord X (formerly Twitter) URL

DAO DAO DAO

This is a collection of smart contracts for building composable, modular, and upgradable DAOs.

For a detailed look at how these contracts work, see our wiki.

Overview

Every DAO is made up of three modules:

  1. A voting power module, which manages the voting power of DAO members.
  2. Any number of proposal modules, which manage proposals in the DAO.
  3. A core module, which holds the DAO treasury.

image

For example, voting power might be based on staked governance tokens, staked NFTs, or membership and proposal modules might implement yes/no, multiple-choice, or ranked-choice voting.

Each module type has a standard interface. As a result, any voting module can be used with any proposal module, and any proposal module with any voting module.

The best way to get started is to create a DAO! We maintain an open source frontend you can find at daodao.zone.

Audits

If you believe you have found a problem, please let us know.

DAO DAO has been audited by Oak Security on multiple occasions. You can find all the audit reports here.

v2.3.0 is the most recent DAO DAO release; only new feautres related to tokenfactory and improved NFT DAOs have been audited. Our most recently full audited release is v2.0.0. Vesting and payroll were added and audited in v2.1.0.

Audited contracts include:

Audited packages include:

Why?

Our institutions grew rapidly after 1970, but as time passed their priorities shifted from growth, to protectionism. We're fighting this. We believe The Internet is where the organizations of tomorrow will be built.

DAO DAO is a global community working on Internet governance, and a real DAO. We've never raised money, and all our work is open-source. We hope you'll join us.

Links and Resources

Developers

Information about our development workflow and how to contribute can be found in CONTRIBUTING.md.

Testing

Unit tests

Run cargo test, or just test from the project root to run the unit tests.

Integration tests

Run just bootstrap-dev to spin up a local environment and just integration-test-dev to run tests against it.

See ci/integration-tests/README.md for more information.

Disclaimer

DAO DAO TOOLING IS PROVIDED β€œAS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. No developer or entity involved in creating the DAO DAO UI or smart contracts will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of DAO DAO tooling, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.

dao-contracts's People

Contributors

0xekez avatar 0xjame5 avatar 0xjayak avatar albttx avatar art3mix avatar bekauz avatar ben2x4 avatar blue-note avatar bmorphism avatar borgbob avatar buckram123 avatar callum-a avatar clhrae avatar de-husk avatar ebaker avatar elsehow avatar gavindoughtie avatar ismellike avatar jakehartnell avatar lacercat avatar lumtis avatar maurolacy avatar mehrbod2002 avatar noahsaso avatar omahs avatar onewhiskeypls avatar orkunkl avatar poroburu avatar the-frey avatar vernonjohnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dao-contracts's Issues

Dockerize

Need to make it easier for frontend folks to develop UI.

We should have a docker container:

  • Running wasmd chain with right RPC and REST ports exposed
  • Automatically deploys contracts onto chain
  • Has a set of accounts created with balances

Native token voting

Would be nice to optionally use a native token for voting instead of a cw20.

`query_proposal` should use total supply at time of proposal creation not at time of query

Currently this query will return a response based on the current token supply

let total_supply = get_total_supply(deps)?;
let threshold = prop.threshold.to_response(total_supply);

A proposal being passed though depends on the amount of tokens available when the proposal was created:

} => {
self.votes.yes
>= votes_needed(self.total_weight - self.votes.abstain, percentage_needed)
}
Threshold::ThresholdQuorum { threshold, quorum } => {
// we always require the quorum
if self.votes.total() < votes_needed(self.total_weight, quorum) {
return false;
}
if self.expires.is_expired(block) {
// If expired, we compare Yes votes against the total number of votes (minus abstain).
let opinions = self.votes.total() - self.votes.abstain;
self.votes.yes >= votes_needed(opinions, threshold)
} else {
// If not expired, we must assume all non-votes will be cast as No.
// We compare threshold against the total weight (minus abstain).
let possible_opinions = self.total_weight - self.votes.abstain;
self.votes.yes >= votes_needed(possible_opinions, threshold)
}

Tokens being burned or minted between when a proposal is created will result in the threshold returned by the query being different than the threshold that is required for the proposal to pass.

Use sub-account for proposal deposit balances

The current implementation of proposal deposits has a hidden foot-gun that the dao could create a proposal to spend all of its cw20 balance and accidentally spend the proposal deposit balances. Storing the proposal deposit balances in a sub account using https://github.com/CosmWasm/cw-plus/tree/main/contracts/cw1-whitelist would make this distinction more clear and make it unlikely the dao would accidentally spend proposal deposits. Of course, the DAO could always spend the deposits on purpose but such is the will of the people πŸ€·β€β™‚οΈ .

deploy_local.sh should use ujunox as denom

Now that we use junod it doesn't seem to make a terrible amount of sense that ustake is distributed to the default account as you can't pay for juno transactions with that (or at least this is what keplr suggests to me).

Add vote tally response type to @dao-dao/types

New response type was added in #99. Looks like this:

{
  "status": "open",
  "threshold": {
    "absolute_percentage": {
      "percentage": "0.5",
      "total_weight": "1000000000"
    }
  },
  "quorum": "0",
  "total_votes": "0",
  "total_weight": "1000000000",
  "votes": {
    "yes": "0",
    "no": "0",
    "abstain": "0",
    "veto": "0"
  }
}

Reduce entanglement with cw-dao-dapp

Currently, running a development environment (by our instructions) requires running the frontend repo in order to get a wasm address for one of your private keys. This links the two repos together a bit too tightly.

Ideally, developers should get a wasm address for their private key without the frontend repo.

Optional Whale Cap on vote size

Token based voting is great, but the downside is that whales can completely dominate some communities.

Would be great to potentially integrate an optional "whale cap" parameter. In other words the max vote size.

Ideally, whale sized votes would sill count towards quorum.

Test proposal logic edge cases

We should have some tests on contract edge cases. A few that have come up (more ideas welcome):

  • A number of people make proposals, and someone makes a proposal that spends their deposits.
  • User Alice makes a deposit, a proposal passes that changes the deposit amounts, Alice gets her original deposit back.

These are tests that should fail until we address the issue described in #12

Update votes when determing if a proposal has passed to reflect current CW20 balances

This is a fairly large issue in the current implementation. After a user votes for a proposal, they can then transfer the cw20 to a different wallet and vote again. Effectively this gives anyone unlimited votes.

One fix is to update vote power when checking if a proposal has passed. We could go further and just record the voter address and only get the token balance when evaluating if the proposal has passed.

Another fix is to require voters to deposit their token when voting to be returned after the proposal resolves.

IMO, I think the first solution gives more flexibility to the token holders.

Staking

After some thought, it's better to stake the Gov tokens in order to participate in governance.

Address book

This could be a separate contract, but we need a way to know who is who in the DAO.

Get Cw20Balances for Multisig

Similar to cw3-dao, it would be nice to maintain a list of cw20 tokens for querying for cw3-flex-multisig.

cw3-dao supports the following query messages:

    /// Returns All DAO Cw20 Balances
    Cw20Balances {
        start_after: Option<String>,
        limit: Option<u32>,
    },
    /// Return list of cw20 Tokens associated with the DAO Treasury
    Cw20TokenList {},

It also supports a method to update the token list, which is only callable by the cw3-dao contract itself.

    /// Updates token list
    UpdateCw20TokenList {
        to_add: Vec<Addr>,
        to_remove: Vec<Addr>,
    },

Shareholder Distribution Contract

Think of it like a built in payment splitter, tokens come in and are distributed according to token ownership in the DAO.

Using this, DAO members could submit proposals to distribute a portion of the DAO treasury amongst DAO token holders. Alternatively, other projects could airdrop DAO token holder.

Tally query

As a DAO member, I would like to know how close a vote is to passing.

Currently, from the queries included in the cw3 spec, it's a pain to figure this out (especially if there are a large number of voters).

So let's introduce a Tally { proposal_id: u64 } query, which will return info about the current vote tally. Imagine it would look something like this:

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
pub struct VoteTallyResponse {
    // Current proposal status
    pub status: Status,
    // Required passing criteria
    pub threshold: ThresholdResponse,
    // Percentage of turnout
    pub quorum: Decimal,
    // Total number of votes
    pub total_votes: Uint128,
    // absolute number of votes
    pub total_weight: Uint128,
    // Tally's of the different votes
    pub votes: Votes,
}

We should be able to extend the existing proposal implementation in both cw3-dao and cw3-flex-multisig for this.

Transfer juno to the dao treasury in deploy_local.sh

We currently don't do this which means that when the DAO attempts to execute a proposal it will fail with insufficient funds unless you manually send some as the DAO does not have any coins to pay for the transaction.

Multisig factory contract

As a user, I would like to see a list of the multisigs I'm a part of.

To achieve this, I think we need a factory contract that keeps track of multisigs created.

Delegate Votes

Would be nice to be able to delegate votes like in Compound Governance. This is an advanced feature and we should wait til #17 is resolved first.

Update Multisig Config

  • Add name + description to config
  • Add UpdateConfig method (similar to cw3-dao). This should only be callable by the flex multisig contract itself (i.e. a proposal would need to be passed to update the config)
  • Add GetConfig query and be sure to also return the group contract address

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.