Merge pull request #12956 from nobutoba/fix-ballot-contract

Add a require statement to the Ballot contract
This commit is contained in:
chriseth 2022-05-02 15:40:46 +02:00 committed by GitHub
commit 3e3e73e380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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.");