diff --git a/src/contracts/Election.sol b/src/contracts/Election.sol index 7874af2..bdf0a09 100644 --- a/src/contracts/Election.sol +++ b/src/contracts/Election.sol @@ -39,6 +39,7 @@ contract VotingForPurpose{ mapping(address=>Voter) public voters; address[] voterslist; + uint public candidatesCount; uint public electionCount; uint public totalregisteredvoters; @@ -56,4 +57,7 @@ contract VotingForPurpose{ _; } + function isAdmin(address user) public view returns(bool){ + return owner==msg.sender || owner == user; + } } \ No newline at end of file diff --git a/src/utils/election.json b/src/utils/election.json index 15a29c7..a271b80 100644 --- a/src/utils/election.json +++ b/src/utils/election.json @@ -47,6 +47,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "candidatesCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "electionCount", @@ -94,6 +107,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isAdmin", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "totalregisteredvoters",