Skip to content

Instantly share code, notes, and snippets.

@ankitbrahmbhatt1997
Created February 21, 2019 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankitbrahmbhatt1997/65139697fffe31972abf30af7b0308d2 to your computer and use it in GitHub Desktop.
Save ankitbrahmbhatt1997/65139697fffe31972abf30af7b0308d2 to your computer and use it in GitHub Desktop.
vote for a request
function voteForRequest(uint index) public goalReached {
// Directly referencing the specific spending request inside the requests dynamic array
Request storage thisRequest = requests[index];
// Checking for the conditions
require(contributions[msg.sender] > 0);
require(thisRequest.voters[msg.sender] == false);
//Counting the vote and then incrementing the number of voters by 1
thisRequest.voters[msg.sender] = true;
thisRequest.numberOfVoters++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment