- Members can propose and vote on tasks.
- Once a task gets 100% of votes then it becomes an approved task.
- If a task does not get 100% votes after everyone has voted, then it becomes an unapproved task.
These instructions will get you a a copy of the project running on your localhost with a development blockchain.
-
Clone this repo
git clone https://github.com/dliuproduction/daory.git
-
Install npm packages
npm install npm update
-
Install Truffle globally.
npm install -g truffle
-
Run your local blockchain. eg. ganache-cli
ganache-cli
-
Compile and migrate the smart contracts. Note inside the development console we don't preface commands with
truffle
.truffle compile truffle migrate
-
Run the webpack server for front-end hot reloading (outside the development console). Smart contract changes must be manually recompiled and migrated.
// Serves the front-end on http://localhost:3000 npm start
-
Import your ethereum account generated on the local test blockchain into MetaMask.
-
Connect MetaMask to custom localhost RPC if web3 is not detected correctly. This information can be found in the truffle develop console (eg. http://127.0.0.1:8545/).
-
Click 'Sign Up' to sign up your address with a name. This is mandatory to login
-
Click 'Login'
-
Click 'Propose' to propose tasks
-
Click 'Task Board' to view tasks and vote
Contract tests are written in javascript. To run tests:
javascript truffle test
-
Tests the authentication process for normal use (signup, login, update names), and edge cases (disallow empty names, disallow non-member login)
-
Test the functionalities of the DAO. Specifically:
Normal use:
- Task proposal
- Task voting
- Task removal
Edge cases:
- Disallow non-member to propose task
- Disallow non-member to vote on a task
- Disallow any member to vote on the same task more than once.
- Disallow any new members to vote on a task that has finished voting before their joining.
- Disallow members to remove tasks not proposed by themselves.
- Disallow any member to vote on a non-existing task
-
The Authentication contract which the DAO contract inherits from, is implemented as destructible.
-
- Restricting access
- Tasks are declared public, therefore anyone can view the task list and the voting details.
- However, all functions that change the state of the contracts (eg. propose, vote, remove), require a membership to be associated with the ethereum account.
- Only proposers of the tasks can remove their own tasks
- Only the contract creater/owner can destroy the contract
- This pattern is used to implement the mechanics of voting in the organization, as a consensus of votes needs to be achieved amoung a certain number of members for a task to be approved.
- No payment pattern is used, as the contract does not have any functions that require transfers of value.
- Restricting access
Openzeppelin libraries of destructible and SafeMath are used in the contracts. However, since there is no transfer of value within the contract, there is no incentive to gain for an attacker.
-
The attacker could overflow the task count, making the organization's task count reset and unusable. However, this requires a very large number of transactions.
-
The attacker could send ether to the contract. However, as there is no functionality associated with the balance of the contract, the Ether would be stuck in the contract.
This project is licensed under the MIT License - see the LICENSE.md file for details