Web3 Coin
  • Welcome to Web3 Coin
  • Overview
    • 💡Our Vision
    • ✨Team
  • WhitePaper
    • Terminology
    • Abstract
    • Introduction
    • Vision
    • Overview
      • Current Problems of Existing Blockchain Networks
      • Web3Coin Solution
    • Web3Chain
      • An Overview for Web3Chain
      • Web3Anthill
      • EVM to MVM
      • Web3Chain Consensus Mechanism: PoW
      • Transaction Check Per Second (TCPS)
    • Proof of Web3 Consensus Mechanism
      • Web3Miner (WPoS & Web3Anthill)
        • Fees and Rewards
      • MacroMiner (MPoH & Web3Anthill)
        • Archive Node
        • Full Node
        • Light Node
      • MicroMiner (MPoSW & Web3Anthill)
    • Scalability
      • Blockchain Network Structure
      • Energy Consumption
    • Smart Contract
      • Smart Contract Compatibility
      • Smart Contract Fees
    • Transaction
      • Transaction Fees
    • Attack Vectors & Security
      • Transaction Denial
      • Eclipse Attack
      • Double Spending
    • Native Token
      • Web3 Coin (W3B)
      • Token Burning
        • Transaction Fee Burning
        • Constant Burning
      • Pool Distribution
    • Experimental Results
    • Information
    • Audit
    • Solution and Conclusion
      • Focused on 'Human'
    • References
    • Disclaimer
  • Fundamentals
    • 🌎Tokenomics
      • Chart
    • 🗺️ROADMAP
  • FAQ
    • ❓What is Web3Coin?
    • ⭐Good to Know
    • 💾Web3Anthill
  • Products
    • Web3Chain
    • Web3 Airdrop
    • Web3 Coin (W3B)
    • Web3Dex
    • Web3Exchange
    • Web3Explorer
    • Web3Launchpad
    • Web3NFT
Powered by GitBook
On this page
  1. WhitePaper
  2. Proof of Web3 Consensus Mechanism

MicroMiner (MPoSW & Web3Anthill)

PreviousLight NodeNextScalability

Last updated 1 year ago

t are one of the most essential parts of the human-centered blockchain structure. It creates a direct link between the Web3 Coin ecosystem applications and the user, beyond performing the transaction verification task systematically.

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Strings.sol";
contract Vote{
    using Strings for uint256;
    address private immutable owner;
    string_baseUri;
    uint256 totalVote;
    struct Votes {
        uint256 startTime;
        uint256 endTime;
        uint256 selection;
        string question;
        mapping (uint256 => uint256) selections;
        mapping (address => uint256) voter;
    }
    
    mapping (uint256 => votes)_votes;
    
    constructor(string memory base_Uri_) {
        owner = msg.sender;
        _baseUri = base_Uri_;
    }
    
    modifier onlyOwner() {
        require(msg.sender == owner,"You are not owner.");
        _;
    }
    
    function questionURL(uint256 vote_) internal view returns(string memory) {
        return string(abi.encodePacked(_basedUri,_votes[vote_].selection.toString()));
    }
    
    function setBaseURI(string memory base_Uri_) external only Owner {
        _baseUri = base_Uri_;
    }
    
    function getQuestion() public view returns(string memory) {
        return_votes[totalVote].question;
    }
    
    function vote(uint256 selection)public {
        require(block.timestamp > _votes[totalVote].startTime&&
            block.timestamp <_votes[totalVote].endTime);
        require(selection <=_votes[]totalVote.selection && selection > 0);
        require(_votes[totalVote].voter[msg.sender] ==0);
        _votes[totalVote].voter[msg.sender] = selection;
    }
    
    function setVote(
        uint256 startTime,
        uint256 endTime,
        uint256 selection,
        string memory question)
        public
        onlyOwner {
        totalVote ++;
        _votes[totalVote].startTime = startTime;
        _votes[totalVote].endTime = endTime;
        _votes[totalVote].selection = selection;
        _votes[totalVote].question = question;
    }
}