aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorBerk Erol <berk.erol@boun.edu.tr>2018-10-26 14:53:57 +0800
committerGitHub <noreply@github.com>2018-10-26 14:53:57 +0800
commit19064e81bc07c75a5b7626fc97315e92ec09db7b (patch)
tree59dea57f88723cbe14f3d5d2b8737ebb2da3b53f /docs
parent41375b5d79a77d392922f36f149d5bef269303e6 (diff)
downloaddexon-solidity-19064e81bc07c75a5b7626fc97315e92ec09db7b.tar.gz
dexon-solidity-19064e81bc07c75a5b7626fc97315e92ec09db7b.tar.zst
dexon-solidity-19064e81bc07c75a5b7626fc97315e92ec09db7b.zip
Add check for whether voter has right to vote
Diffstat (limited to 'docs')
-rw-r--r--docs/solidity-by-example.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 8f58f339..f71f1e23 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -152,6 +152,7 @@ of votes.
/// to proposal `proposals[proposal].name`.
function vote(uint proposal) public {
Voter storage sender = voters[msg.sender];
+ require(sender.weight != 0, "Has no right to vote");
require(!sender.voted, "Already voted.");
sender.voted = true;
sender.vote = proposal;