forked from Medha08/solidity-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVoterList.sol
43 lines (36 loc) · 1.3 KB
/
VoterList.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
pragma solidity ^0.5.0;
import "browser/User.sol";
contract VoterList is User {
address[] public regVoters;
mapping(address => address) citizenToCitizenCont;
function getAllVoters() public view onlyECIAccess(msg.sender) returns (address[] memory){
address [] memory voters;
for(uint i =0;i< regVoters.length;i++){
voters[i] = regVoters[i];
}
return voters;
}
function registerVoter()public{
regVoters.push(msg.sender);
}
function getContractAdd() public view onlyECIAccess(msg.sender) returns (address[] memory){
address [] memory votersContr;
for(uint i =0;i< regVoters.length;i++){
votersContr[i] = citizenToCitizenCont[regVoters[i]] ;
}
return votersContr;
}
function getuserdetails() public view onlyECIAccess(msg.sender) returns ( string memory , string memory , uint8 , bytes32 , address){
User contractUser = User(citizenToCitizenCont[msg.sender]);
return contractUser.getDetails();
}
function isRegistered() public view onlyECIAccess(msg.sender) returns(bool){
for(uint i =0;i< regVoters.length;i++){
if(regVoters[i] == msg.sender){
return true;
}else{
return false;
}
}
}
}