This is a decenteralized application for blind voting, which means that the voters won't know who voted for which option and how many votes for each option untill the poll ends
├── dapp # Next.js App
│ ├── app
│ │ ├── common
│ │ │ ├── contractOperations.ts
│ │ │ └── contracts.ts
│ │ ├── components
│ │ │ ├── AccountInfo.tsx
│ │ │ ├── Account.tsx
│ │ │ ├── ConfirmModal.tsx
│ │ │ ├── CreatePoll.tsx
│ │ │ ├── Option.tsx
│ │ │ ├── PollBar.tsx
│ │ │ ├── PollsList.tsx
│ │ │ ├── Poll.tsx
│ │ │ └── VotingSystem.tsx
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── config
│ │ └── index.tsx
│ ├── context
│ │ └── index.tsx
│ ├── next.config.ts
│ ├── next-env.d.ts
│ ├── package.json
│ ├── package-lock.json
│ ├── postcss.config.mjs
│ ├── public
│ │ ├── file.svg
│ │ ├── globe.svg
│ │ ├── next.svg
│ │ ├── vercel.svg
│ │ └── window.svg
│ ├── README.md
│ └── tsconfig.json
├── foundry.toml
├── LICENSE
├── Makefile
├── README.md
├── script
├── src # Smart Contract
│ └── VotingSystem.sol
└── test
└── VotingSystem.t.sol
- Inherited OpenZepplin Ownable contract
Files:
- src/contracts/VotingSystem.sol (lines: 18 and 66)
- Access Control Restrictions
Files:
- src/contracts/VotingSystem.sol (lines: 51, 154, and 214)
- Optimizing Gas
Files:
- src/contracts/VotingSystem.sol (lines: 23, 32, and 35)
- Used 0.8.20 as a specific compiler pragma
Files:
- src/contracts/VotingSystem.sol (line: 2 )
- src/test/VotingSystem.t.sol (line; 2)
- Proper use of Require
Files:
- src/contracts/VotingSystem.sol (line: 42, 47, 52, and 62)
- Used modifires for validation
- src/contracts/VotingSystem.sol (lines: 40, 46, 51 and 61)
To run the tests run:
forge test
Before you deploy, you will have to prepare your .env file:
-
Rename
.env.examplein the root of the project to.env -
Add your private key as a value for
PRIVATE_KEY -
Add your web3 address as a value for
WEB3_ADDRESS -
The
RPC_URLis already written as for Scroll Seploia, but you can change it if you would like
Copy the ABI and the contract address to the wagmiContractConfig object in the /dapp/app/common/contracts.ts file
To check the ABI and test the deploying, run:
make test_deploy
To deploy on Scroll Sepolia and get the contract address, run:
make deploy
-
Rename
.env.examplein the/dappdirectory to.env -
Create a new project on Reown Cloud at https://cloud.reown.com and obtain a new project ID
-
Add the project ID as a value for
NEXT_PUBLIC_PROJECT_IDin.envfile
While in the /dapp directory run:
npm run dev
While in the /dapp directory run:
npm run build
https://voting-dapp-ten-sandy.vercel.app/
https://vimeo.com/1089503267?share=copy#t=0
Old contract: 0x1419fE1CB72920084939bFE02a25D9Eaf6f5a4a2
Transaction link: https://sepolia.scrollscan.com/tx/0xfa47b89b534a2451503ee15d8abbbbd99cdfd328510ceea271d990e7adf8c597
Old contract: 0x565d9CC5c46a5Cd2ddE6524517c059336da79E42
Transaction link: https://sepolia.scrollscan.com/tx/0xcaebe2aa13aa113d0d179ade844a7e57d823d0433d4837c9eace98a75dd96594
Latest contract: 0x66e54F78FbD565b1D0fC2f1FcCF832c8F4529B55
Transaction Link: https://sepolia.scrollscan.com/tx/0x123c29a5f05879b14f33dc4e9b2e75102b3b5f89c21115550d3cbc243c5c1a9f