Перейти к содержимому
Проверенный контрактТочноеMIT

EducationalUSDT

Адрес0x30a329c8a3ff3446a12bed15a836de8befd55dc8
Баланс

0 ETH

 

Транзакций

2

 

Компилятор

solc 0.8.20

 

Тот же код

Только этот контракт

 

Подробности

Компилятор
solc 0.8.20+commit.a1b79de6
Язык
solidity
Оптимизация
Нет
Лицензия
MIT
Совпадение
Точноекод создания: да, код в сети: да
Проверен на Sourcify
Создан в блоке
26 400 947
Транзакция создания
0x3a73433a18…37e92afee3

EducationalUSDT.sol


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

contract EducationalUSDT {
    string public constant name = "Educational USDT";
    string public constant symbol = "USDT";
    uint8 public constant decimals = 6;

    uint256 public totalSupply;
    uint256 public immutable expiresAt;
    address public immutable owner;

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

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

    event Approval(
        address indexed tokenOwner,
        address indexed spender,
        uint256 value
    );

    constructor() {
        owner = msg.sender;
        expiresAt = block.timestamp + 90 days;

        // Mint 1,000,000 educational tokens
        uint256 initialSupply = 1_000_000 * 10 ** 6;

        totalSupply = initialSupply;
        balanceOf[msg.sender] = initialSupply;

        emit Transfer(
            address(0),
            msg.sender,
            initialSupply
        );
    }

    modifier active() {
        require(
            block.timestamp < expiresAt,
            "Token expired"
        );
        _;
    }

    function transfer(
        address to,
        uint256 amount
    ) external active returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    function approve(
        address spender,
        uint256 amount
    ) external active returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(
            msg.sender,
            spender,
            amount
        );

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external active returns (bool) {
        uint256 allowed = allowance[from][msg.sender];

        require(
            allowed >= amount,
            "Insufficient allowance"
        );

        allowance[from][msg.sender] =
            allowed - amount;

        _transfer(from, to, amount);
        return true;
    }

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

        balanceOf[from] -= amount;
        balanceOf[to] += amount;

        emit Transfer(from, to, amount);
    }

    function isExpired() external view returns (bool) {
        return block.timestamp >= expiresAt;
    }
}
Настройки компилятораПоказать
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.