Skip to content

Instantly share code, notes, and snippets.

@laurentsenta
Created December 9, 2017 14:55
Show Gist options
  • Save laurentsenta/d199e325dc121596d6a0d4b1a669e7eb to your computer and use it in GitHub Desktop.
Save laurentsenta/d199e325dc121596d6a0d4b1a669e7eb to your computer and use it in GitHub Desktop.
Data Storage Test Excerpts
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;
}
}
/// 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