hackquest logo

E-Vote Decentralized

E-Vote Decentralized Voting App aims to revolutionize the traditional method of voting which possess insignificant challenges and threats to the integrity, accessibility and efficiency of conducting a

비디오

설명

Overview

The MultiElectionVoting smart contract is designed to manage multiple elections, allowing for the registration of candidates and voters, as well as the recording of votes in a decentralized and secure manner. The contract leverages the ERC2771Context for meta-transactions, ensuring that operations are executed within the context of trusted forwarders.

Features

  • Election Management: Create and manage multiple elections, each with a specific title, start date, and end date.

  • Candidate Registration: Add candidates to specific elections before the election start date.

  • Voter Accreditation: Register voters for specific elections, ensuring only accredited voters can participate.

  • Voting: Accredited voters can vote for registered candidates within the active election period.

  • Election Information: Retrieve details about elections, including the list of candidates and their vote counts.

  • Voting History: allows voters to track their voting activities onchain.

Functions

  • Constructor

    • constructor(address trustedForwarder) ERC2771Context(trustedForwarder): Initializes the contract with the address of a trusted forwarder for meta-transactions.

  • createElection

    • function createElection(string memory title, uint256 startDate, uint256 endDate) public: Creates a new election with the specified title, start date, and end date.

  • addCandidate

    • function addCandidate(uint256 electionId, string memory name) public: Adds a new candidate to an election before it starts.

  • accreditVoter

    • function accreditVoter(uint256 electionId, address voterAddress) public: Accredits a voter for a specific election.

  • vote

    • function vote(uint256 electionId, bytes32 candidateId) public: Allows an accredited voter to cast their vote for a specific candidate during the active election period.

  • getElectionDetails

    • function getElectionDetails(uint256 electionId) public view returns (string memory title, uint256 startDate, uint256 endDate, uint256 candidateCount): Retrieves details about an election, including the title, start date, end date, and number of candidates.

  • getCandidates

    • function getCandidates(uint256 electionId) public view returns (bytes32[] memory, string[] memory, uint256[] memory): Retrieves the list of candidates for an election along with their names and vote counts.

  • hasUserVoted

    • function hasUserVoted(uint256 electionId, address voterAddress) public view returns (bool): Checks if a specific voter has voted in a particular election.

기술 스택

React
Next
Web3
Solidity
Node
Vue
Ethers

자금 모금 상태

N/A

부문
SocialFiDeFiNFT