Skip to content

Instantly share code, notes, and snippets.

@developeruche
Last active February 22, 2023 09:53
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 developeruche/8e4e10132b65825f2ed447729ffa7079 to your computer and use it in GitHub Desktop.
Save developeruche/8e4e10132b65825f2ed447729ffa7079 to your computer and use it in GitHub Desktop.
contract Campaign {
struct Request {
string description;
uint256 value;
address recipient;
bool complete;
uint256 approvalCount;
mapping(address => bool) approvals;
}
uint256 numRequests;
mapping (address => Request[]) requests;
function createRequest(string memory description, uint value, address recipient, uint256 _index) public {
Request[] storage r = requests[msg.sender];
r[_index].description = description;
r[_index].value = value;
r[_index].recipient = recipient;
r[_index].complete = false;
r[_index].approvalCount = 0;
r[_index].approvals[msg.sender] = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment