Skip to content
Verified contractPartialMIT

FairToken

Address0xebe9f7bcc1ea94704b593d54ea349bd390aba8c0
Balance

0 ETH

 

Transactions

4

 

Compiler

solc 0.8.37

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.37+commit.f401782d
Language
solidity
Optimization
Yes, 200 runs
EVM version
osaka
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,402,209
Creation transaction
0x4356ec5e89…0ac7ea7038

FairToken.sol

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

/// @title FairToken — fixed supply, ownerless ERC-20 (no mint, no pause, no tax, no admin keys).
/// The deployer receives the entire supply at deploy time. Standard OpenZeppelin-style
/// storage layout (balanceOf/allowance mappings) so it works with slot-probing tooling.
contract FairToken {
    string public name;
    string public symbol;
    uint8 public constant decimals = 18;
    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    constructor(string memory _name, string memory _symbol, uint256 _supply) {
        require(_supply > 0, "supply must be > 0");
        name = _name;
        symbol = _symbol;
        totalSupply = _supply;
        balanceOf[msg.sender] = _supply;
        emit Transfer(address(0), msg.sender, _supply);
    }

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

    function approve(address spender, uint256 value) external returns (bool) {
        require(msg.sender != address(0), "approve from zero");
        require(spender != address(0), "approve to zero");
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) external returns (bool) {
        if (allowance[from][msg.sender] != type(uint256).max) {
            allowance[from][msg.sender] -= value;
        }
        _transfer(from, to, value);
        return true;
    }

    function _transfer(address from, address to, uint256 value) internal {
        require(from != address(0), "transfer from zero");
        require(to != address(0), "transfer to zero");
        require(balanceOf[from] >= value, "insufficient balance");
        balanceOf[from] -= value;
        balanceOf[to] += value;
        emit Transfer(from, to, value);
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "osaka"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.