// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

/**
 * @title EnergyUSDT
 * @dev Fixed supply ERC-20 token - NO MINTING CAPABILITY
 * Total Supply: 10,002,000,000 (100.02 Billion) tokens with 6 decimals (matching USDT)
 *
 * IMPORTANT: This contract has NO mint function and NO way to increase supply.
 * All tokens are minted to the deployer at construction time.
 */
contract EnergyUSDT {
    string public constant name = "Energy USDT";
    string public constant symbol = "eUSDT";
    uint8 public constant decimals = 6;

    // Fixed total supply: 100.02 billion tokens (10,002,000,000 * 10^6)
    uint256 public constant totalSupply = 10_002_000_000 * 10**6;

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

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

    /**
     * @dev Constructor - mints entire fixed supply to deployer
     * No mint function exists - supply is permanently fixed
     */
    constructor() {
        _balances[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }

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

    function transfer(address to, uint256 amount) public returns (bool) {
        require(to != address(0), "Transfer to zero address");
        require(_balances[msg.sender] >= amount, "Insufficient balance");

        unchecked {
            _balances[msg.sender] -= amount;
            _balances[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);
        return true;
    }

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

    function approve(address spender, uint256 amount) public returns (bool) {
        require(spender != address(0), "Approve to zero address");
        _allowances[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) public returns (bool) {
        require(from != address(0), "Transfer from zero address");
        require(to != address(0), "Transfer to zero address");
        require(_balances[from] >= amount, "Insufficient balance");
        require(_allowances[from][msg.sender] >= amount, "Insufficient allowance");

        unchecked {
            _balances[from] -= amount;
            _balances[to] += amount;
            _allowances[from][msg.sender] -= amount;
        }

        emit Transfer(from, to, amount);
        return true;
    }
}
