Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Voter Registry Smart Contract

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.

🚀 Overview

The VoterRegistry allows an owner to manage a focused voting session. It features:

  • State Management: Controlled transitions between CLOSE, OPEN, and ENDED states.
  • Access Control: Restricted administrative functions (starting/ending votes, authorizing voters) using the onlyOwner modifier.
  • Input Validation: Strict checks on candidate numbers and voting eligibility.
  • Event Logging: Transparent on-chain logs for all critical actions.

🛠 Architecture

HelperConfig & Deployment

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.

Development Stack

  • Foundry: Used for compilation, testing, and deployment scripts.
  • Solidity: ^0.8.19
  • WSL/Ubuntu: Primary development environment.

🧪 Testing & Coverage

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.

📦 Deployment Information

  • Network: Sepolia Testnet
  • Contract Address: 0x2f6b48601C81D8FF8eD95B1cF60c058Daa596915
  • Verified on Etherscan: Yes

📖 Usage

  1. Deploy: Use the DeployVoterRegistry.s.sol script.
  2. Authorize: The owner calls authorizeVoter(address).
  3. Start: The owner calls startVoting().
  4. Vote: Authorized users call castVote(uint256).
  5. End: The owner calls endVoting().

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages