Created
February 21, 2019 14:57
-
-
Save ankitbrahmbhatt1997/65139697fffe31972abf30af7b0308d2 to your computer and use it in GitHub Desktop.
vote for a request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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