Skip to content
Verified contractExactMIT

WorldCup

Address0xb37f107e609812ca3b15b8fdd4ecc7f4d122f7d3
Balance

0 ETH

 

Transactions

7

 

Compiler

solc 0.8.31

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.31+commit.fd3a2265
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,159,411
Creation transaction
0x9722e67d92…f49bac84a9

ETH/Worldcup.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract WorldCup {

    // ─── Token Metadata ───────────────────────────────────────────────────────
    string public name     = "WorldCup";
    string public symbol   = "WC";
    uint8  public decimals = 18;

    // ─── State Variables ──────────────────────────────────────────────────────
    uint256 public totalSupply;
    address public owner;

    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;

    // ─── Events ───────────────────────────────────────────────────────────────
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    // ─── Modifiers ────────────────────────────────────────────────────────────
    modifier onlyOwner() {
        require(msg.sender == owner, "WC: caller is not the owner");
        _;
    }

    // ─── Constructor ──────────────────────────────────────────────────────────
    /**
     * @param initialSupply  Total supply (in whole tokens — decimals handled automatically)
     *                       Example: pass 1000000 to mint 1,000,000 tokens
     */
    constructor(uint256 initialSupply) {
        owner = msg.sender;
        uint256 amount = initialSupply * (10 ** decimals);
        totalSupply = amount;
        _balances[msg.sender] = amount;
        emit Transfer(address(0), msg.sender, amount);
    }

    // ─── ERC-20 Core ──────────────────────────────────────────────────────────
    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function transfer(address to, uint256 amount)
        public
        returns (bool)
    {
        _transfer(msg.sender, to, amount);
        return true;
    }

    function allowance(address tokenOwner, address spender) public view returns (uint256) {
        return _allowances[tokenOwner][spender];
    }

    function approve(address spender, uint256 amount)
        public
        returns (bool)
    {
        _allowances[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    function transferFrom(address from, address to, uint256 amount)
        public
        returns (bool)
    {
        uint256 currentAllowance = _allowances[from][msg.sender];
        require(currentAllowance >= amount, "WC: insufficient allowance");
        unchecked { _allowances[from][msg.sender] = currentAllowance - amount; }
        _transfer(from, to, amount);
        return true;
    }

    // ─── Internal Transfer ────────────────────────────────────────────────────
    function _transfer(address from, address to, uint256 amount) internal {
        require(from != address(0), "WC: transfer from zero address");
        require(to   != address(0), "WC: transfer to zero address");
        require(_balances[from] >= amount, "WC: insufficient balance");

        unchecked {
            _balances[from] -= amount;
            _balances[to]   += amount;
        }
        emit Transfer(from, to, amount);
    }

    // ─── Owner Utilities ──────────────────────────────────────────────────────
    /**
     * @notice Burn tokens from your own balance.
     */
    function burn(uint256 amount) external {
        require(_balances[msg.sender] >= amount, "WC: insufficient balance");
        unchecked { _balances[msg.sender] -= amount; }
        totalSupply -= amount;
        emit Transfer(msg.sender, address(0), amount);
    }

    /**
     * @notice Transfer contract ownership to a new address.
     */
    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "WC: zero address");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.