A Decentralized Voting Application built for EVM compatible blockchains (ethereum, polygon, avalanche,...), it has the following features :
- Adding new candidates
- Opening the voting for a giver duration
- Closing the election after the predermined voting period
- Allow user to vote only once for a choosen candidate
- Determine the winner based on highest votes count
- Give a complete list of all candidates with their data (id, name, votes count)
-
Installing Brownie: Brownie is a python framework for smart contracts development,testing and deployments. It's quit like HardHat but it uses python for writing test and deployements scripts instead of javascript. Here is a simple way to install brownie.
pip install --user pipx pipx ensurepath # restart your terminal pipx install eth-brownie
Or if you can't get pipx to work, via pip (it's recommended to use pipx)
pip install eth-brownie
Install ganache-cli:
npm install -g ganache-cli
-
Clone the repo:
git clone https://github.com/kaymen99/Election-Dapp.git cd Election-Dapp
To deploy the Election contract on development network, run the command :
brownie run scripts/deploy_election.py
To deploy on real network/testnets, run the command :
brownie run scripts/deploy_election.py --network=<network name>
The tests for the Election smart contract can be found in the tests folder, you can run all the tests by :
brownie test
Or you can test each function individualy:
brownie test -k <function name>