From f6c0edc902f2dabdf67c81435061038bfe3dce98 Mon Sep 17 00:00:00 2001 From: Nobuhiko Otoba <44864310+nobutoba@users.noreply.github.com> Date: Mon, 25 Apr 2022 11:10:23 +0900 Subject: [PATCH] Add a require statement to the Ballot contract --- docs/examples/voting.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/examples/voting.rst b/docs/examples/voting.rst index 0e8901c3d..a51c01b74 100644 --- a/docs/examples/voting.rst +++ b/docs/examples/voting.rst @@ -109,6 +109,7 @@ of votes. function delegate(address to) external { // assigns reference Voter storage sender = voters[msg.sender]; + require(sender.weight != 0, "You have no right to vote"); require(!sender.voted, "You already voted."); require(to != msg.sender, "Self-delegation is disallowed.");