A robust, state-managed voting system built with Solidity and the Foundry development framework. This project demonstrates industry-standard patterns for smart contract architecture, including multi-chain deployment configurations and high-test coverage.
The VoterRegistry allows an owner to manage a focused voting session. It features:
- State Management: Controlled transitions between
CLOSE,OPEN, andENDEDstates. - Access Control: Restricted administrative functions (starting/ending votes, authorizing voters) using the
onlyOwnermodifier. - Input Validation: Strict checks on candidate numbers and voting eligibility.
- Event Logging: Transparent on-chain logs for all critical actions.
The project utilizes a HelperConfig pattern to remain Chain-Agnostic.
- Anvil: Configured for local development with a 500 candidate limit.
- Sepolia: Deployed and verified on the Ethereum Sepolia Testnet with a 700 candidate limit.
- Mainnet: Pre-configured for future production deployment with a 300 candidate limit.
- Foundry: Used for compilation, testing, and deployment scripts.
- Solidity: ^0.8.19
- WSL/Ubuntu: Primary development environment.
This project maintains high security standards with 100% logic coverage on the core contract and deployment scripts.
- Unit Tests: Rigorous testing of state transitions, authorization logic, and edge cases.
- Integration Tests: Deployment scripts are integrated into the test suite via
deployer.run()to ensure deployment-time configurations are valid.
- Network: Sepolia Testnet
- Contract Address:
0x2f6b48601C81D8FF8eD95B1cF60c058Daa596915 - Verified on Etherscan: Yes
- Deploy: Use the
DeployVoterRegistry.s.solscript. - Authorize: The owner calls
authorizeVoter(address). - Start: The owner calls
startVoting(). - Vote: Authorized users call
castVote(uint256). - End: The owner calls
endVoting().