2022-03-18 14:56:22 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
pragma solidity ^0.8.11;
|
|
|
|
|
2022-03-18 15:00:01 +00:00
|
|
|
/* nem sikerült: megcsinálni, hogy hogyan kell a bool type-ot megváltoztatni, amikor már szavazott az addres;
|
|
|
|
beállítani, hogy melyek address-ek szavazhatnak */
|
2022-03-18 14:56:22 +00:00
|
|
|
|
|
|
|
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++;
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
}
|