voting hw upload

master
mad.nikolett 2022-03-25 15:46:56 +01:00
parent 3e006374b7
commit 7a22b58174
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.11;
contract Voting{
struct Voter {
bool voted;
}
mapping(address => Voter) private Voters;
uint256 public Friends;
uint256 public HowIMetYourMother;
uint256 public TheBigBangTheory;
function voteFriends() public {
Voter storage sender = Voters[msg.sender];
require(!sender.voted, 'Voted');
sender.voted = true;
Friends = Friends + 1;
}
function voteHowIMetYourMother() public {
Voter storage sender = Voters[msg.sender];
require(!sender.voted, 'Voted');
sender.voted = true;
HowIMetYourMother = HowIMetYourMother + 1;
}
function voteTheBigBangTheory() public {
Voter storage sender = Voters[msg.sender];
require(!sender.voted, 'Voted');
sender.voted = true;
TheBigBangTheory = TheBigBangTheory + 1;
}
}