Created
September 5, 2017 22:08
-
-
Save skmgoldin/963a97392cabd0ae34aa7ec40dfd3709 to your computer and use it in GitHub Desktop.
This file contains 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
function commitVote(uint pollID, bytes32 secretHash, uint numTokens, uint prevPollID) external { | |
require(commitPeriodActive(pollID)); | |
require(voteTokenBalance[msg.sender] >= numTokens); // prevent user from overspending | |
require(pollID != 0); // prevent user from committing to zero node placerholder | |
uint nextPollID = dllMap[msg.sender].getNext(prevPollID); | |
require(validPosition(prevPollID, nextPollID, msg.sender, numTokens)); | |
dllMap[msg.sender].insert(prevPollID, pollID, nextPollID); | |
bytes32 UUID = attrUUID(msg.sender, pollID); | |
store.attachAttribute(UUID, "numTokens", numTokens); | |
store.attachAttribute(UUID, "commitHash", uint(secretHash)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment