Skip to content

Instantly share code, notes, and snippets.

@elenadimitrova
Last active September 29, 2016 06:12
Show Gist options
  • Save elenadimitrova/26eae4eed096b8ff1a92d33acc413e3a to your computer and use it in GitHub Desktop.
Save elenadimitrova/26eae4eed096b8ff1a92d33acc413e3a to your computer and use it in GitHub Desktop.
/// @notice Checks if an address is 'locked' due to any present unresolved votes
function isAddressLocked(address _storageContract, address userAddress)
constant returns (bool) {
var zeroPollCloseTimeNext = EternalStorage(_storageContract)
.getUIntValue(sha3("Voting", userAddress, uint256(0), "nextTimestamp"));
// The list is empty, no unrevealed votes for this address
if (zeroPollCloseTimeNext == 0){
return false;
}
// The poll is still open for voting and tokens transfer
if (now < zeroPollCloseTimeNext){
return false;
}
else {
// The poll is closed for voting and is in the reveal period, during which all voters' tokens are locked until reveal
// Note: even after the poll is resolved, tokens remain locked until reveal
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment