diff --git a/src/contracts/Election.sol b/src/contracts/Election.sol index ec80b53..93ecee9 100644 --- a/src/contracts/Election.sol +++ b/src/contracts/Election.sol @@ -31,4 +31,12 @@ contract VotingForPurpose{ string votername; bool authorized; } + + // Mapping for the voters + mapping(address=>mapping(uint=>bool)) voted; + mapping(uint => Election) public elections; + mapping(uint => Candidate) public candidates; + mapping(address=>Voter) public voters; + + address[] voterslist; } \ No newline at end of file diff --git a/src/utils/election.json b/src/utils/election.json index bb86f2a..0f235e1 100644 --- a/src/utils/election.json +++ b/src/utils/election.json @@ -7,5 +7,102 @@ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "candidates", + "outputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "voteCount", + "type": "uint256" + }, + { + "internalType": "string", + "name": "slogan", + "type": "string" + }, + { + "internalType": "uint256", + "name": "election_id", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "elections", + "outputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "string", + "name": "purpose", + "type": "string" + }, + { + "internalType": "uint256", + "name": "status", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalVotes", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "voters", + "outputs": [ + { + "internalType": "string", + "name": "votername", + "type": "string" + }, + { + "internalType": "bool", + "name": "authorized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" } ]} \ No newline at end of file