{"language":"Solidity","sources":{"src/LazyToken.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\ninterface IFeeVaultHook {\n    function onTransfer(address from, address to, uint256 value) external;\n}\n\n/// @notice Fixed-supply ERC20 template deployed once per meme-coin launch.\n///         Entire supply is minted to the bonding curve at construction.\ncontract LazyToken {\n    string public name;\n    string public symbol;\n    uint8 public constant decimals = 18;\n    uint256 public immutable totalSupply;\n\n    address public immutable creator;\n    /// @notice Reward vault notified on every transfer so holder rewards accrue pro-rata.\n    address public immutable feeVault;\n    string public metadataURI;\n\n    uint256 private _locked = 1;\n\n    mapping(address => uint256) public balanceOf;\n    mapping(address => mapping(address => uint256)) public allowance;\n\n    event Transfer(address indexed from, address indexed to, uint256 value);\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    constructor(\n        string memory _name,\n        string memory _symbol,\n        string memory _metadataURI,\n        address _creator,\n        address _mintTo,\n        uint256 _supply,\n        address _feeVault\n    ) {\n        name = _name;\n        symbol = _symbol;\n        metadataURI = _metadataURI;\n        creator = _creator;\n        feeVault = _feeVault;\n        totalSupply = _supply;\n        balanceOf[_mintTo] = _supply;\n        emit Transfer(address(0), _mintTo, _supply);\n    }\n\n    /// @notice Alias so explorers and indexers can read the off-chain metadata JSON.\n    function tokenURI() external view returns (string memory) {\n        return metadataURI;\n    }\n\n    /// @notice Metadata is permanently frozen at deployment: nobody, including the\n    ///         creator or the platform, can ever change it.\n    function metadataFrozen() external pure returns (bool) {\n        return true;\n    }\n\n    function transfer(address to, uint256 value) external returns (bool) {\n        _transfer(msg.sender, to, value);\n        return true;\n    }\n\n    function approve(address spender, uint256 value) external returns (bool) {\n        allowance[msg.sender][spender] = value;\n        emit Approval(msg.sender, spender, value);\n        return true;\n    }\n\n    function transferFrom(address from, address to, uint256 value) external returns (bool) {\n        uint256 allowed = allowance[from][msg.sender];\n        if (allowed != type(uint256).max) {\n            require(allowed >= value, \"ALLOWANCE\");\n            allowance[from][msg.sender] = allowed - value;\n        }\n        _transfer(from, to, value);\n        return true;\n    }\n\n    function _transfer(address from, address to, uint256 value) internal {\n        require(to != address(0), \"TO_ZERO\");\n        // The reward hook runs before balances change (it snapshots pre-transfer\n        // balances), so a non-reentrancy lock guarantees no callback can re-enter\n        // transfer logic while this contract is in an intermediate state.\n        require(_locked == 1, \"REENTRANCY\");\n        _locked = 2;\n        uint256 bal = balanceOf[from];\n        require(bal >= value, \"BALANCE\");\n        // Reward accounting must never be able to block a transfer: the hook is\n        // called with a bounded gas stipend and any failure is ignored.\n        if (feeVault != address(0)) {\n            try IFeeVaultHook(feeVault).onTransfer{gas: 250_000}(from, to, value) {} catch {}\n        }\n        unchecked {\n            balanceOf[from] = bal - value;\n            balanceOf[to] += value;\n        }\n        _locked = 1;\n        emit Transfer(from, to, value);\n    }\n}\n"}},"settings":{"remappings":["forge-std/=lib/forge-std/src/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode.object","evm.bytecode.sourceMap","evm.bytecode.linkReferences","evm.deployedBytecode.object","evm.deployedBytecode.sourceMap","evm.deployedBytecode.linkReferences","evm.deployedBytecode.immutableReferences","evm.methodIdentifiers","metadata"]}},"evmVersion":"cancun","viaIR":true,"libraries":{}}}
