Add a require statement to the Ballot contract

This commit is contained in:
Nobuhiko Otoba
2022-04-30 12:51:59 +02:00
committed by Kamil Śliwak
parent d55b84ff63
commit f6c0edc902
+1
View File
@@ -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.");