Ethereum ETH (ETH)

Description:

ERC20 token contract with Factory capabilities. Standard implementation for fungible tokens on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

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

/// @title  Ethereum ETH (ETH) - simple ERC20, single-file (no imports)
/// @notice Fixed supply minted to deployer. Decimals = 18.
contract SANTY_EthereumETH {
    string public name = "Ethereum ETH";
    string public symbol = "ETH";
    uint8  public decimals = 18;
    uint256 private _totalSupply;

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

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

    constructor() {
        // 100,000,000 tokens with 18 decimals
        uint256 initial = 100_000_000 * 10 ** uint256(decimals);
        _mint(msg.sender, initial);
    }

    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function transfer(address to, uint256 amount) public returns (bool) {
        require(to != address(0), "transfer to zero");
        uint256 senderBal = _balances[msg.sender];
        require(senderBal >= amount, "insufficient balance");
        _balances[msg.sender] = senderBal - amount;
        _balances[to] += amount;
        emit Transfer(msg.sender, to, amount);
        return true;
    }

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

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

    function transferFrom(address from, address to, uint256 amount) public returns (bool) {
        require(to != address(0), "transfer to zero");
        uint256 fromBal = _balances[from];
        require(fromBal >= amount, "insufficient balance");
        uint256 currentAllowance = _allowances[from][msg.sender];
        require(currentAllowance >= amount, "allowance exceeded");

        _balances[from] = fromBal - amount;
        _balances[to] += amount;
        _allowances[from][msg.sender] = currentAllowance - amount;

        emit Transfer(from, to, amount);
        return true;
    }

    // internal mint function
    function _mint(address account, uint256 amount) internal {
        require(account != address(0), "mint to zero");
        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);
    }
}

Tags:
ERC20, Token, Factory|addr:0x49c6410999d212f501c8c268ef7adcdf056674f8|verified:true|block:23626140|tx:0x6990ee4cf6cd40f9fc03a799163280d4e1d1f13e4acb08efd1a27d8d13a9e54f|first_check:1761052765

Submitted on: 2025-10-21 15:19:27

Comments

Log in to comment.

No comments yet.