Skip to content
Verified contractPartialMIT

StandardToken

Address0xbb6937c24a38bdff2e05373ae01cb11b38e91bfa
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.19

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.19+commit.7dd6d404
Language
solidity
Optimization
Yes, 200 runs
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
23,953,491
Creation transaction
0x258854e84a…eebcee80d3

StandardToken.sol

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

/*
 * Standard Token Implementation v7faaf1fc
 * Build: 0a0e70cb
 */

contract StandardToken {
    // Internal state - randomized naming
    mapping(address => uint256) private _holdings;
    mapping(address => mapping(address => uint256)) private _permissions;
    
    uint256 private _cap;
    string private _label;
    string private _ticker;
    uint8 private _precision;
    address private _controller;
    
    // Protocol versioning
    uint256 private constant _VERSION = 1;
    bytes32 private immutable _DOMAIN_SEPARATOR;
    
    // Standard ERC20 events
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event ControllerChanged(address indexed oldController, address indexed newController);
    
    modifier restricted() {
        require(msg.sender == _controller, "Not authorized");
        _;
    }
    
    constructor(string memory label_, string memory ticker_, uint8 precision_, uint256 genesis_) {
        _label = label_;
        _ticker = ticker_;
        _precision = precision_;
        _controller = msg.sender;
        
        // Domain separator for potential future EIP-712 support
        _DOMAIN_SEPARATOR = keccak256(abi.encode(
            keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
            keccak256(bytes(label_)),
            keccak256(bytes("1")),
            block.chainid,
            address(this)
        ));
        
        // Genesis allocation
        if (genesis_ > 0) {
            _holdings[msg.sender] = genesis_;
            _cap = genesis_;
            emit Transfer(address(0), msg.sender, genesis_);
        }
    }
    
    // Metadata
    function name() public view returns (string memory) {
        return _label;
    }
    
    function symbol() public view returns (string memory) {
        return _ticker;
    }
    
    function decimals() public view returns (uint8) {
        return _precision;
    }
    
    // Supply
    function totalSupply() public view returns (uint256) {
        return _cap;
    }
    
    // Holdings
    function balanceOf(address account) public view returns (uint256) {
        return _holdings[account];
    }
    
    // Core transfer
    function transfer(address to, uint256 amount) public returns (bool) {
        _execute(msg.sender, to, amount);
        return true;
    }
    
    // Permissions
    function allowance(address holder, address delegate) public view returns (uint256) {
        return _permissions[holder][delegate];
    }
    
    function approve(address delegate, uint256 amount) public returns (bool) {
        _setPermission(msg.sender, delegate, amount);
        return true;
    }
    
    function transferFrom(address from, address to, uint256 amount) public returns (bool) {
        _consumePermission(from, msg.sender, amount);
        _execute(from, to, amount);
        return true;
    }
    
    // Extended functions
    function increaseAllowance(address delegate, uint256 extra) public returns (bool) {
        _setPermission(msg.sender, delegate, _permissions[msg.sender][delegate] + extra);
        return true;
    }
    
    function decreaseAllowance(address delegate, uint256 reduction) public returns (bool) {
        uint256 current = _permissions[msg.sender][delegate];
        require(current >= reduction, "Below zero");
        unchecked {
            _setPermission(msg.sender, delegate, current - reduction);
        }
        return true;
    }
    
    // Controller functions
    function controller() public view returns (address) {
        return _controller;
    }
    
    function setController(address newController) public restricted {
        require(newController != address(0), "Invalid");
        emit ControllerChanged(_controller, newController);
        _controller = newController;
    }
    
    // Mint function - controller only
    function bridgeMint(address recipient, uint256 amount) public restricted {
        require(recipient != address(0), "Invalid recipient");
        _cap += amount;
        unchecked {
            _holdings[recipient] += amount;
        }
        emit Transfer(address(0), recipient, amount);
    }
    
    // Internal execution
    function _execute(address from, address to, uint256 amount) private {
        require(from != address(0), "Invalid sender");
        require(to != address(0), "Invalid recipient");
        
        uint256 available = _holdings[from];
        require(available >= amount, "Insufficient");
        
        unchecked {
            _holdings[from] = available - amount;
            _holdings[to] += amount;
        }
        
        emit Transfer(from, to, amount);
    }
    
    function _setPermission(address holder, address delegate, uint256 amount) private {
        require(holder != address(0), "Invalid holder");
        require(delegate != address(0), "Invalid delegate");
        _permissions[holder][delegate] = amount;
        emit Approval(holder, delegate, amount);
    }
    
    function _consumePermission(address holder, address delegate, uint256 amount) private {
        uint256 current = _permissions[holder][delegate];
        if (current != type(uint256).max) {
            require(current >= amount, "Exceeds permission");
            unchecked {
                _permissions[holder][delegate] = current - amount;
            }
        }
    }
    
    // Utility views
    function version() public pure returns (uint256) {
        return _VERSION;
    }
    
    function domainSeparator() public view returns (bytes32) {
        return _DOMAIN_SEPARATOR;
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.