Skip to content

Latest commit

 

History

History
106 lines (85 loc) · 3.87 KB

README.md

File metadata and controls

106 lines (85 loc) · 3.87 KB

Voting system

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.

Contents

Important

Tests

DOS Attack

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:

WORKFLOW

file - votingsystem_workflow.test.js

Ceci est un exemple d’image

METHODS

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

Ceci est un exemple d’image

STATES

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

Ceci est un exemple d’image

How to use this project

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

Clone the project

git clone https://github.com/waymaiker/voting-system.git

Install libraries

cd voting-system
yarn install

hardhat commands

# Start the local Blockchain
yarn hardhat node

In an other terminal tab

# Deploy your smart contract on localhost hardhat
yarn hardhat deploy

If you want to deploy on an other network

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

Need to deploy the contract on Goerli

# Deploy your smart contract on testnet GOERLI
yarn hardhat deploy --network goerli

test commands

yarn hardhat test
yarn hardhat coverage

Resources