Skip to content

Instantly share code, notes, and snippets.

@ankitbrahmbhatt1997
Last active February 21, 2019 18: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/a1001d712fb60fc01e7932bc9300b965 to your computer and use it in GitHub Desktop.
Save ankitbrahmbhatt1997/a1001d712fb60fc01e7932bc9300b965 to your computer and use it in GitHub Desktop.
spending request
function createSpendingRequest(string _description, address _recipient, uint _value) public onlyAdmin goalReached{
// INSTANTIATING A Request STRUCT IN THE MEMORY
Request memory newRequest = Request(
{
description:_description,
value:_value,
recipient:_recipient,
numberOfVoters:0,
completed:false
}
);
// AN EXAMPLE OF A SPENDING REQUEST WOULD BE SOMETHING LIKE
// {
// description:"For Buying microchips for the product(A description would generally describe more than this :) )",
// value: 2000000000000000000 (2 ether converted to wei),
// recipient:0x12gfsk34j43.....,
// numberOfVoters:0,
// completed:false
// }
// STORING THE SPENDING REQUEST STRUCT VARIABLE INTO THE requests DYNAMIC ARRAY
requests.push(newRequest);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment