voting hw upload
parent
3e006374b7
commit
7a22b58174
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue