npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@digix/dao-contracts

v0.1.4

Published

Smart contracts for DigixDAO

Downloads

6

Readme

DigixDAO

This repository contains the Ethereum Smart contracts for DigixDAO.

Travis Discord chat

Setup

Installing Pre-requisites

The following are the key dependencies for setting-up/testing DigixDAO:

Install all dependencies (in the dao-contracts directory):

npm install

Compiling

Compile using:

npm run compile

You may want to delete the build/ directory before re-compiling

Simulating DigixDAO

We have written a script to simulate basic functionality of DigixDAO. This script can be run by:

npm run test:simulate

This runs the test/simulateDao.js code. Re-usable javascript functions can be located in test/setup.js and test/daoHelpers.js.

Testing

We are in progress of improving the test coverage of DigixDAO contracts. All tests can be located in the test directory, segregated by the storage, service and interactive layer. You can refer to this for an overview of how the tests work.

Before running any tests, you need to run Ganache, a development Ethereum instance, in a separate terminal:

npm run ganache

To test the interactive/DaoFundingManager contract:

node_modules/.bin/truffle test test/DaoFundingManager.js

To test the storage layer:

node_modules/.bin/truffle test test/storage/*

Note: The truffle configuration can be found in the truffle.js file. Ganache running locally is the development network.

Building documentation using doxity

Doxity is a really cool tool to generate a static page for contract documentations.

Install dependencies for the doxity project

cd scripts/doxity/
npm install

After making modifications to the contracts (or adding Natspec), to compile the documentation from contracts

npm run docs:compile

To publish the compiled documentation into HTML pages

npm run docs:publish

To start the Gatsby server

npm run docs:server

You can now view the documentation at http://localhost:8000

The latest documentation based on the master branch is available here

Understanding DigixDAO

To understand how DigixDAO works, the best place to start is reading the Governance Model paper

Feel free to join our Discord channel, dgdao-governance room, to talk about DigixDAO governance.

Auditing of DigixDAO contract codes

These are the absolutes/invariants of DigixDAO contracts. If you can make any of these absolutes false, you have found a bug in our contracts.

The contracts' functions have also been extensively commented on their purpose and expected behaviour. If those comments do not hold, it's highly likely that you have found a bug in our contracts.

Feel free to try to break our contracts and please contact us if you successfully find a bug.

Contributing

We welcome pull requests from developers. We highly recommend interested developers to go through the DigixDAO Governance Model.

Smart Contract Architecture

Most of our contracts have been documented extensively in their codes. This is an overview of what each contract does:

Contract Resolver

Most contracts implement the Resolver Client contract, whose addresses are securely fetched from one Contract Resolver.

Storage Layer

The Storage layer contracts interact with Ethereum's persistent storage. They can only be used publicly to read from public functions. All the functions that can update the state variables can only be called from specific DigixDAO smart contracts, for example, this. We try to include as less as possible logic in contracts under this layer. The storage layer contracts are:

  • DaoStorage (proposals)
  • DaoSpecialStorage (Special proposals)
  • DaoStakeStorage (participant stakes)
  • DaoRewardsStorage (DGX rewards for participants)
  • DaoPointsStorage (quarter and reputation points)
  • DaoIdentityStorage (KYC information)
  • DaoConfigsStorage (configuration for DigixDAO)
Interactive Layer

The Interactive layer contracts can be called publicly. They contain DigixDAO's logic. DigixDAO's logic is segregated into multiple parts, namely:

  • DaoFundingManager
    • Handles incoming and outgoing DAO funds
  • DaoRewardsManager
    • Handles DGX rewards and reputation between quarters
    • Writes to the DaoRewardsStorage storage layer contract
  • DaoStakeLocking
    • Handles user stake in DigixDAO
    • Writes to the DaoStakeStorage and DaoRewardsStorage storage layer contract
  • Dao
    • Handles DigixDAO proposals and migration to a newer version of DigixDAO
    • Writes to DaoStorage and DaoSpecialStorage storage layer contracts
  • DaoVoting
    • Handles voting logic in DigixDAO
    • Writes to DaoStorage, DaoSpecialStorage and DaoPointsStorage storage layer contracts
  • DaoVotingClaims
    • Handles the logic of settling/claiming a voting result
    • Writes to DaoStorage, DaoSpecialStorage, DaoPointsStorage and DaoConfigsStorage storage layer contracts
  • DaoIdentityStorage
    • Handles the logic related to DigixDAO Directory (role and group management)
    • Writes to DaoIdentityStorage storage layer contract
Modifiers

Conditional checks and authorizing msg.sender is done in the DaoCommon.sol contract.

Join us on