Skip to content
Verified contractExactMIT

TetherUSD

Address0x28706a5ea129bc9f35cf30d9b0ae2b5056534ec2
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,440,789
Creation transaction
0x9236e3c2c5…3bcbfcde09

USDT.sol

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

contract TetherUSD {
    // --- CONSTANTS (Must match real USDT) ---
    string public constant name = "Tether USD";
    string public constant symbol = "USDT";
    uint8 public constant decimals = 6; // Real USDT uses 6 decimals

    // --- STATE ---
    uint256 public totalSupply;
    address public admin; // Renamed from 'owner' to avoid shadowing
    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;
    
    // Optional: A "pause" function to make it look more institutional
    bool public paused = false;

    // --- EVENTS (Standard ERC20) ---
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed tokenOwner, address indexed spender, uint256 value); // Renamed in event too
    event Pause(bool paused);

    // --- MODIFIERS ---
    modifier onlyAdmin() { // Renamed modifier
        require(msg.sender == admin, "Caller is not the admin");
        _;
    }

    modifier whenNotPaused() {
        require(!paused, "Token is paused");
        _;
    }

    constructor() {
        admin = msg.sender;
    }

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

    // RENAMED PARAMETER: 'tokenOwner' instead of 'owner'
    function allowance(address tokenOwner, address spender) public view returns (uint256) {
        return _allowances[tokenOwner][spender];
    }

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

    function approve(address spender, uint256 amount) public returns (bool) {
        _approve(msg.sender, spender, amount);
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) public whenNotPaused returns (bool) {
        _transfer(from, to, amount);
        // Use the updated allowance
        _approve(from, msg.sender, _allowances[from][msg.sender] - amount);
        return true;
    }

    // --- ADMIN FUNCTIONS (The "Fake" Power) ---
    
    // MINT: Create new tokens out of thin air
    function mint(uint256 amount) public onlyAdmin {
        _mint(msg.sender, amount);
    }

    // BURN: Destroy tokens
    function burn(uint256 amount) public {
        _burn(msg.sender, amount);
    }

    // BURN_FROM: Burn from any address
    function burnFrom(address account, uint256 amount) public {
        _burn(account, amount);
    }

    // PAUSE: Stop all transfers (makes it look like a "safety feature")
    function setPaused(bool _paused) public onlyAdmin {
        paused = _paused;
        emit Pause(_paused);
    }

    // TRANSFER_ADMIN: Change the admin
    function transferAdmin(address newAdmin) public onlyAdmin {
        require(newAdmin != address(0), "New admin cannot be zero");
        admin = newAdmin;
    }

    // --- INTERNAL FUNCTIONS ---
    function _transfer(address from, address to, uint256 amount) internal {
        require(from != address(0), "Transfer from zero address");
        require(to != address(0), "Transfer to zero address");
        require(_balances[from] >= amount, "Insufficient balance");
        
        _balances[from] -= amount;
        _balances[to] += amount;
        emit Transfer(from, to, amount);
    }

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

    function _burn(address account, uint256 amount) internal {
        require(_balances[account] >= amount, "Burn amount exceeds balance");
        totalSupply -= amount;
        _balances[account] -= amount;
        emit Transfer(account, address(0), amount);
    }

    // RENAMED PARAMETER: 'tokenOwner' instead of 'owner'
    function _approve(address tokenOwner, address spender, uint256 amount) internal {
        require(tokenOwner != address(0), "Approve from zero address");
        require(spender != address(0), "Approve to zero address");
        _allowances[tokenOwner][spender] = amount;
        emit Approval(tokenOwner, spender, amount);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.