Created
December 9, 2017 14:55
-
-
Save laurentsenta/d199e325dc121596d6a0d4b1a669e7eb to your computer and use it in GitHub Desktop.
Data Storage Test Excerpts
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 Test { | |
mapping(uint =\> uint) tests; | |
function Test() { | |
} | |
function one_set() { | |
tests[0] = 0; | |
} | |
function two_increment() { | |
tests[0] = tests[0] + 1; | |
} | |
} |
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
/// Give a single vote to proposal $(proposal). | |
function vote(uint8 proposal) { | |
Voter storage sender = voters[msg.sender]; | |
if (sender.voted || proposal >= proposals.length) return; | |
sender.voted = true; | |
sender.vote = proposal; | |
proposals[proposal].voteCount += sender.weight; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment