Skip to content

Instantly share code, notes, and snippets.

@ankitbrahmbhatt1997
Created February 21, 2019 18:19
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/59c0f0bd23f5b0a119fd95576247166f to your computer and use it in GitHub Desktop.
Save ankitbrahmbhatt1997/59c0f0bd23f5b0a119fd95576247166f to your computer and use it in GitHub Desktop.
making a payment to the third party
function makePayment(uint index) public onlyAdmin goalReached{
// Directly referencing the specific spending request inside the requests dynamic array
Request storage thisRequest = requests[index];
// Checking the necessary conditions
require(thisRequest.completed == false);
require(thisRequest.numberOfVoters > totalContributors / 2);//more than 50% voted
// Performing the operations
thisRequest.recipient.transfer(thisRequest.value);
thisRequest.completed = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment