You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
940 B
Solidity
39 lines
940 B
Solidity
// 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;
|
|
}
|
|
|
|
} |