Tether USD (USDT)

Description:

ERC20 token contract. 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.0;

contract USDT {
    string public name = "Tether USD";
    string public symbol = "USDT";
    uint8 public constant decimals = 6;

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

    address public owner;

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

    constructor() payable {
        owner = msg.sender;
    }

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

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

    function transfer(address recipient, uint256 amount) public returns (bool) {
        _transfer(msg.sender, recipient, amount);
        return true;
    }

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

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

    function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
        uint256 allowed = _allowances[sender][msg.sender];
        require(allowed >= amount, "ERC20: allowance exceeded");

        _approve(sender, msg.sender, allowed - amount);
        _transfer(sender, recipient, amount);
        return true;
    }

    // --- MISSING FUNCTIONS ADDED BELOW ---
    function _transfer(address sender, address recipient, uint256 amount) internal {
        require(sender != address(0), "ERC20: transfer from zero address");
        require(recipient != address(0), "ERC20: transfer to zero address");
        require(_balances[sender] >= amount, "ERC20: insufficient balance");

        _balances[sender] -= amount;
        _balances[recipient] += amount;
        emit Transfer(sender, recipient, amount);
    }

    function _approve(address owner_, address spender, uint256 amount) internal {
        require(owner_ != address(0), "ERC20: approve from zero address");
        require(spender != address(0), "ERC20: approve to zero address");


        _allowances[owner_][spender] = amount;
        emit Approval(owner_, spender, amount);
    }
    // --- END OF ADDED FUNCTIONS ---
}

Tags:
ERC20, Token|addr:0xa04eafba063168248df8dd3050265b7ee241969f|verified:true|block:23553008|tx:0xc13508f2e086ec76864f9ee4a387589fc5323ae3a5c1cf12e29a9aaf4cb78e21|first_check:1760266530

Submitted on: 2025-10-12 12:55:33

Comments

Log in to comment.

No comments yet.