{ "language": "Solidity", "sources": { "contracts/i.sol": { "content": "// SPDX-License-Identifier: No License\n// Copyright 404.zero x Han, 2022\n\npragma solidity ^0.8.15;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol\";\nimport \"@openzeppelin/contracts/token/common/ERC2981.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\n\ncontract i is ERC721, ERC721Enumerable, ERC2981, Ownable, ReentrancyGuard {\n using Strings for uint256;\n\n string public constant MANIFEST = (\n ' i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n 'i i i i i i i i i i i i i i i i i i i i i i i i i i i' '\\n'\n );\n\n struct Params {\n uint8 brightness;\n uint8 frequency;\n uint8 amplitude;\n }\n\n struct Coords {\n int32 latitude;\n int32 longitude;\n int32 altitude;\n }\n\n uint256 public constant MAX_SUPPLY = 660;\n uint256 public constant PRESALE_MINT_PRICE = 1 ether;\n uint256 public constant PUBLIC_SALE_MINT_PRICE = 2 ether;\n\n string public baseURI;\n string public baseJS;\n\n mapping(uint256 => Params) public params;\n mapping(uint256 => Coords) public coords;\n\n bool public presaleOpen;\n bool public publicSaleOpen;\n\n mapping(address => uint256) public presaleList;\n\n modifier onlyTokenOwner(uint256 tokenId) {\n require(ownerOf(tokenId) == msg.sender, \"You are not the owner of this token\");\n _;\n }\n\n modifier validParamValue(uint8 value) {\n require(value >= 0 && value <= 100, \"Value should be greater than 0 and less than 100\");\n _;\n }\n\n event TweakParam(uint256 indexed tokenId, string paramName, uint8 newValue);\n\n constructor(string memory name, string memory symbol) ERC721(name, symbol) {\n }\n\n function mintPresale() public payable nonReentrant {\n uint256 tokenId = totalSupply();\n\n require(presaleOpen, \"Sale is not active\");\n require(tokenId < MAX_SUPPLY, \"Purchase would exceed max supply\");\n require(presaleList[msg.sender] > 0, \"Exceeded max available to purchase\");\n require(msg.value >= PRESALE_MINT_PRICE, \"Ether value is too small\");\n\n _safeMint(msg.sender, tokenId);\n _synthesizeParams(block.number, tokenId);\n\n presaleList[msg.sender]--;\n }\n\n function mintPublicSale() public payable nonReentrant {\n uint256 tokenId = totalSupply();\n\n require(publicSaleOpen, \"Sale is not active\");\n require(tokenId < MAX_SUPPLY, \"Purchase would exceed max supply\");\n require(msg.value >= PUBLIC_SALE_MINT_PRICE, \"Ether value is too small\");\n require(msg.sender == tx.origin, \"Purchase is forbidden\");\n\n _safeMint(msg.sender, tokenId);\n _synthesizeParams(block.number, tokenId);\n }\n\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n return string(abi.encodePacked(baseURI, tokenId.toString()));\n }\n\n function tokenHTML(uint256 tokenId) public view virtual returns (string memory) {\n _requireMinted(tokenId);\n\n bytes memory liveJS = abi.encodePacked(\n 'live({'\n 'brightness:', uint256(params[tokenId].brightness).toString(), ','\n 'frequency:', uint256(params[tokenId].frequency).toString(), ','\n 'amplitude:', uint256(params[tokenId].amplitude).toString(), ','\n '});'\n );\n\n return string(abi.encodePacked(\n ''\n ''\n '
'\n '