Skip to content
Verified contractPartialMIT

USDTToken

Address0x0ef0a0e564c817538b5673e72b73dd1bb92bb283
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.20

 

Same code

1 more contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
24,552,365
Creation transaction
0x23e9c9fc8f…4a2d0851ce
Main copy (most transactions)
0x440dbd9f…0248452b

contracts/USDT.sol

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

/**
 * @title USDTToken
 * @dev A basic ERC-20 token inspired by USDT (Tether)
 * @author Generated with Claude
 */
contract USDTToken {

    // ─── Token Metadata ───────────────────────────────────────────────────────
    string public name     = "Tether USD";
    string public symbol   = "USDT";
    uint8  public decimals = 6;          // USDT uses 6 decimals

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

    mapping(address => uint256)                     public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    // ─── Events ───────────────────────────────────────────────────────────────
    event Transfer(address indexed from,    address indexed to,      uint256 value);
    event Approval(address indexed ownerAddr, address indexed spender, uint256 value);

    // ─── Modifiers ────────────────────────────────────────────────────────────
    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    // ─── Constructor ──────────────────────────────────────────────────────────
    /**
     * @param initialSupply Total tokens to mint at deployment (in whole units).
     *                      e.g. 1_000_000 mints 1 million USDT
     */
    constructor(uint256 initialSupply) {
        owner       = msg.sender;
        totalSupply = initialSupply * 10 ** decimals;
        balanceOf[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }

    // ─── Core ERC-20 Functions ────────────────────────────────────────────────

    /**
     * @dev Transfer tokens to a recipient.
     */
    function transfer(address to, uint256 amount) external returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    /**
     * @dev Approve a spender to use your tokens.
     */
    function approve(address spender, uint256 amount) external returns (bool) {
        allowance[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    /**
     * @dev Transfer tokens on behalf of another address (using allowance).
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool) {
        uint256 allowed = allowance[from][msg.sender];
        require(allowed >= amount, "Allowance exceeded");
        allowance[from][msg.sender] = allowed - amount;
        _transfer(from, to, amount);
        return true;
    }

    // ─── Internal ─────────────────────────────────────────────────────────────

    function _transfer(address from, address to, uint256 amount) internal {
        require(to != address(0),              "Transfer to zero address");
        require(balanceOf[from] >= amount,     "Insufficient balance");

        balanceOf[from] -= amount;
        balanceOf[to]   += amount;
        emit Transfer(from, to, amount);
    }

    // ─── Owner Utilities ──────────────────────────────────────────────────────

    /**
     * @dev Transfer contract ownership.
     */
    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "Zero address");
        owner = newOwner;
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.