A small organization has decided, to use a new vote system.
All voters are known to the organization and are whitelisted using their Ethereum address.
They can submit new proposals during a proposal registration session and can vote on proposals only during the voting session.
When the administrator has tallied the votes, the vote is closed.
Few rules:
✔️ Voting is not secret for users added to the Whitelist.
✔️ Each voter can see the votes of others.
✔️ The winner is determined by simple majority.
✔️ The proposal that gets the most votes wins.
We added tests to make sure that a DoS attack was not possible
Added code into VotingSytem.sol
The Javascript test here
Currently having 50 tests.
Divided into 3 files:
file - votingsystem_workflow.test.js
file - votingsystem_methods.test.js
What are required to them to work well, what kind of event they should emit while working well and what could make them not working
file - votingsystem_state.test.js
What are required to them to work well, what kind of event they should emit while working well and what could make them not working
This project will require that you have already installed
- Yarn
- Node
- Git
If you are familiar with git and the terminal, here are few steps to follow
git clone https://github.com/waymaiker/voting-system.git
cd voting-system
yarn install
# Start the local Blockchain
yarn hardhat node
# Deploy your smart contract on localhost hardhat
yarn hardhat deploy
1- Add the network name and Id into this helper-hardhat-config.js
2- Make sur your .env file is all set with you RPC nodes Api Key, Private Key and the Etherscan Api Key
3- Configure your hardhat.config.js
4- Then execute the next command
# Deploy your smart contract on testnet GOERLI
yarn hardhat deploy --network goerli
yarn hardhat test
yarn hardhat coverage