Voting hazi

master
itsfine 2022-03-18 15:56:22 +01:00
commit 4560d9d4b3
1 changed files with 32 additions and 0 deletions

32
Voting hazi.sol 100644
View File

@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.11;
// nem sikerült: sdf
contract VoteforBest {
uint public NFT;
uint public ERC20;
uint public DAO;
bool public voted;
address public owner;
struct Voter{
bool voted;
address addr;
}
mapping(address=> Voter ) public voters;
function Vote (string memory _choice) public {
if (keccak256(abi.encodePacked(_choice)) == keccak256(abi.encodePacked("NFT"))) {
NFT++;}
else if (keccak256(abi.encodePacked(_choice)) == keccak256(abi.encodePacked("DAO"))) {
DAO++;}
else {
require(keccak256(abi.encodePacked(_choice)) == keccak256(abi.encodePacked("ERC20")), 'Please use valid vote option');
ERC20++;
}}
}