Voting hazi
commit
4560d9d4b3
|
@ -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++;
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue