Skip to content

Commit

Permalink
voter registration
Browse files Browse the repository at this point in the history
  • Loading branch information
dulajsan committed Oct 30, 2018
1 parent 8fd5c3c commit 4d25e8f
Show file tree
Hide file tree
Showing 15 changed files with 8,152 additions and 2 deletions.
70 changes: 70 additions & 0 deletions contracts/Voter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
pragma solidity ^0.4.23;

contract Voter{
//voter details
struct VoterDetails {
bytes32 name;
bytes32 nic;
bytes32 hashOfSecret;
bool submitted_to_review;
bool to_be_deleted;
bool to_be_added;
bool deleted;
bool verified;
}

uint numVoters;

mapping (address => VoterDetails) voters;

function getNumOfVoters() public view returns(uint) {
return numVoters;
}

//this should be updated by the applicant
function addVoter(bytes32 name, bytes32 nic, bytes32 hashOfSecret) public returns(bool,bool,bool,bool,bool) {
//if user doesn't exist
if(voters[msg.sender].name==0x0){
voters[msg.sender] = VoterDetails(name,nic,hashOfSecret,false,false,false,false,false);
numVoters++;
voters[msg.sender].submitted_to_review = true;
return (voters[msg.sender].submitted_to_review,voters[msg.sender].to_be_deleted,voters[msg.sender].to_be_added,voters[msg.sender].deleted,voters[msg.sender].verified);
}
voters[msg.sender].submitted_to_review = true;
return (voters[msg.sender].submitted_to_review,voters[msg.sender].to_be_deleted,voters[msg.sender].to_be_added,voters[msg.sender].deleted,voters[msg.sender].verified);

}

//this should be updated by the grama nildari
function toBeDeleted(address voterAddress) public{
voters[voterAddress].submitted_to_review = false;
voters[voterAddress].to_be_added=false;
voters[voterAddress].to_be_deleted = true;
}

//this should be updated by the grama nildari
function toBeAdded(address voterAddress) public{
voters[voterAddress].submitted_to_review=false;
voters[voterAddress].to_be_deleted=false;
voters[voterAddress].to_be_added=true;
}

//this should be updated by the district office
function deleted(address voterAddress) public{
voters[voterAddress].submitted_to_review=false;
voters[voterAddress].to_be_added=false;
voters[voterAddress].to_be_deleted=false;
voters[voterAddress].verified=false;
voters[voterAddress].deleted=true;
}

//this should be updated by the district office
function verified(address voterAddress) public{
voters[voterAddress].submitted_to_review=false;
voters[voterAddress].to_be_added=false;
voters[voterAddress].to_be_deleted=false;
voters[voterAddress].deleted=true;
voters[voterAddress].verified=true;
}

}
150 changes: 150 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@
},
"dependencies": {
"react": "^15.4.2",
"react-bootstrap": "^0.32.4",
"react-dom": "^15.4.2",
"react-redux": "^5.0.2",
"react-router": "^3.0.2",
"react-router-redux": "^4.0.7",
"redux": "^3.6.0",
"redux-auth-wrapper": "^1.0.0",
"redux-thunk": "^2.2.0"
"redux-thunk": "^2.2.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.83.0"
},
"scripts": {
"start": "node scripts/start.js",
Expand Down
1 change: 1 addition & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import './css/oswald.css'
import './css/open-sans.css'
import './css/pure-min.css'
import './App.css'
import './css/styles.global.css'

class App extends Component {
render() {
Expand Down
Loading

0 comments on commit 4d25e8f

Please sign in to comment.