Created
June 14, 2017 18:41
-
-
Save anonymous/4c0545e504ec49822defe782e1402118 to your computer and use it in GitHub Desktop.
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.11+commit.68ef5810.js&optimize=undefined&gist=
This file contains hidden or 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
pragma solidity ^0.4.0; | |
contract TestContract { | |
struct Proposal { | |
uint voteCount; | |
string description; | |
} | |
address public owner; | |
Proposal[] public proposals; | |
function TestContract() { | |
owner = msg.sender; | |
} | |
function createProposal(string description) { | |
Proposal memory p; | |
p.description = description; | |
proposals.push(p); | |
} | |
function vote(uint proposal) { | |
proposals[proposal].voteCount += 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment