{ "language": "Solidity", "sources": { "GTR/GTRMCv2-Gold.sol": { "content": "// SPDX-License-Identifier: MIT\r\npragma solidity 0.8.13;\r\n\r\nimport \"erc721a/contracts/extensions/ERC721AQueryable.sol\";\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@openzeppelin/contracts/security/Pausable.sol\";\r\n\r\ninterface IERC20 {\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n function balanceOf(address owner) external view returns (uint256 balance);\r\n function decimals() external view returns (uint8);\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\r\n}\r\n\r\ncontract GTRMCv2 is ERC721AQueryable, Ownable, Pausable {\r\n\r\n uint256 public _maxSupply;\r\n string public _baseUri;\r\n \r\n constructor() ERC721A(\"GTRMC Gold\", \"GTRMC\") {\r\n _maxSupply = 275;\r\n }\r\n\r\n\r\n //\r\n // MIXED FUNCTIONS\r\n //\r\n\r\n //allow self burning or admin burning\r\n function burn(uint256 tokenId) external {\r\n require(tokenId < _totalMinted(), \"INVALID_TOKEN\");\r\n require(ownerOf(tokenId) == msg.sender || owner() == msg.sender, \"NOT_PERMITTED\");\r\n\r\n //burn and do not require built in approvalCheck\r\n _burn(tokenId, false);\r\n }\r\n\r\n //\r\n // INTERNAL FUNCTIONS\r\n //\r\n function _baseURI() internal view virtual override returns (string memory uri) { return _baseUri; }\r\n function _beforeTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual override {\r\n //stop transfers unless not paused, minting or person is owner\r\n require(paused() == false || from == address(0) || msg.sender == owner(), \"NOT_PERMITTED\");\r\n\r\n //call base function\r\n super._beforeTokenTransfers(from, to, startTokenId, quantity);\r\n }\r\n\r\n //\r\n // ADMIN FUNCTIONS\r\n //\r\n\r\n function pause() external onlyOwner { _pause(); }\r\n function unpause() external onlyOwner { _unpause(); }\r\n function setTokenBaseUri(string memory url) external onlyOwner { _baseUri = url; }\r\n\r\n function mintAirdrop(address[] calldata addresses) external onlyOwner {\r\n require(_totalMinted() + addresses.length <= _maxSupply, \"MAX_SUPPLY_REACHED\");\r\n\r\n for (uint256 i = 0; i < addresses.length; i++) {\r\n _mint(addresses[i], 1);\r\n }\r\n }\r\n\r\n function withdrawToken(IERC20 token, uint256 amount, address to) external onlyOwner {\r\n if (address(token) == address(0)) {\r\n (bool success, ) = to.call{value: (amount == 0 ? address(this).balance : amount)}(new bytes(0)); \r\n require(success, \"NATIVE_TRANSFER_FAILED\");\r\n } else {\r\n (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(IERC20.transfer.selector, to, (amount == 0 ? token.balanceOf(address(this)) : amount))); \r\n require(success && (data.length == 0 || abi.decode(data, (bool))), \"ERC20_TRANSFER_FAILED\");\r\n }\r\n }\r\n\r\n receive() external payable {}\r\n}" }, "@openzeppelin/contracts/security/Pausable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" }, "@openzeppelin/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" }, "erc721a/contracts/extensions/ERC721AQueryable.sol": { "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721AQueryable.sol';\nimport '../ERC721A.sol';\n\n/**\n * @title ERC721AQueryable.\n *\n * @dev ERC721A subclass with convenience query functions.\n */\nabstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {\n /**\n * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.\n *\n * If the `tokenId` is out of bounds:\n *\n * - `addr = address(0)`\n * - `startTimestamp = 0`\n * - `burned = false`\n * - `extraData = 0`\n *\n * If the `tokenId` is burned:\n *\n * - `addr =
`\n * - `startTimestamp =