Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xdc1631801301226Ab016C2D09b1b6D495c84365D
Balance 0 ETH
Nonce 1
Code Size 8265 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

8265 bytes
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063715018a6116100f9578063c87b56dd11610097578063f2fde38b11610071578063f2fde38b14610383578063f46eccc414610396578063f74bee28146103a9578063ff74927b146103bc576101c4565b8063c87b56dd1461034a578063cf456ae71461035d578063e985e9c514610370576101c4565b806395d89b41116100d357806395d89b4114610314578063a22cb4651461031c578063a2309ff81461032f578063b88d4fde14610337576101c4565b8063715018a6146102f1578063862440e2146102f95780638da5cb5b1461030c576101c4565b806342966c68116101665780636352211e116101405780636352211e146102b0578063664aa26b146102c35780636c0360eb146102d657806370a08231146102de576101c4565b806342966c68146102775780634ebbc92a1461028a5780636010a5e71461029d576101c4565b8063095ea7b3116101a2578063095ea7b31461022757806318160ddd1461023c57806323b872dd1461025157806342842e0e14610264576101c4565b806301ffc9a7146101c957806306fdde03146101f2578063081812fc14610207575b600080fd5b6101dc6101d73660046118a3565b6103cf565b6040516101e99190611a79565b60405180910390f35b6101fa610417565b6040516101e99190611a84565b61021a61021536600461196f565b6104a9565b6040516101e99190611a0d565b61023a61023536600461187a565b6104f5565b005b61024461058d565b6040516101e99190611eec565b61023a61025f36600461178c565b610593565b61023a61027236600461178c565b6105cb565b61023a61028536600461196f565b6105e6565b6101dc61029836600461196f565b610679565b6102446102ab3660046117c7565b61068e565b61021a6102be36600461196f565b610703565b61023a6102d13660046118db565b61071e565b6101fa610774565b6102446102ec366004611740565b610802565b61023a610846565b61023a610307366004611987565b610891565b61021a610906565b6101fa610915565b61023a61032a366004611840565b610924565b610244610936565b61023a6103453660046117c7565b61093c565b6101fa61035836600461196f565b61097b565b61023a61036b366004611840565b610add565b6101dc61037e36600461175a565b610b7e565b61023a610391366004611740565b610bac565b6101dc6103a4366004611740565b610c1a565b6101fa6103b736600461196f565b610c2f565b6101fa6103ca36600461190e565b610c48565b60006001600160e01b031982166380ac58cd60e01b148061040057506001600160e01b03198216635b5e139f60e01b145b8061040f575061040f82610de1565b90505b919050565b60606001805461042690611f51565b80601f016020809104026020016040519081016040528092919081815260200182805461045290611f51565b801561049f5780601f106104745761010080835404028352916020019161049f565b820191906000526020600020905b81548152906001019060200180831161048257829003601f168201915b5050505050905090565b60006104b482610dfa565b6104d95760405162461bcd60e51b81526004016104d090611d4a565b60405180910390fd5b506000908152600860205260409020546001600160a01b031690565b600061050082610703565b9050806001600160a01b0316836001600160a01b031614156105345760405162461bcd60e51b81526004016104d090611e14565b806001600160a01b0316610546610e17565b6001600160a01b0316148061056257506105628161037e610e17565b61057e5760405162461bcd60e51b81526004016104d090611c6e565b6105888383610e1b565b505050565b60045490565b6105a461059e610e17565b82610e89565b6105c05760405162461bcd60e51b81526004016104d090611e78565b610588838383610f06565b6105888383836040518060200160405280600081525061093c565b6000818152600560205260409020546001600160a01b03161580159061061b575060008181526006602052604090205460ff16155b6106375760405162461bcd60e51b81526004016104d090611e55565b6000818152600560205260409020546001600160a01b0316331461066d5760405162461bcd60e51b81526004016104d090611ec9565b61067681611033565b50565b6000908152600d602052604090205460ff1690565b336000908152600c602052604081205460ff166106bd5760405162461bcd60e51b81526004016104d090611ec9565b60008381526006602052604090205460ff16156106ec5760405162461bcd60e51b81526004016104d090611e55565b6106f885858585611109565b90505b949350505050565b6000908152600560205260409020546001600160a01b031690565b610726610e17565b6001600160a01b0316610737610906565b6001600160a01b03161461075d5760405162461bcd60e51b81526004016104d090611d96565b805161077090600a9060208401906115fa565b5050565b600a805461078190611f51565b80601f01602080910402602001604051908101604052809291908181526020018280546107ad90611f51565b80156107fa5780601f106107cf576101008083540402835291602001916107fa565b820191906000526020600020905b8154815290600101906020018083116107dd57829003601f168201915b505050505081565b60006001600160a01b03821661082a5760405162461bcd60e51b81526004016104d090611ccb565b506001600160a01b031660009081526007602052604090205490565b61084e610e17565b6001600160a01b031661085f610906565b6001600160a01b0316146108855760405162461bcd60e51b81526004016104d090611d96565b61088f600061124a565b565b336000908152600c602052604090205460ff166108c05760405162461bcd60e51b81526004016104d090611ec9565b6000828152600b602052604090208054600191906108dd90611f51565b9050106108fc5760405162461bcd60e51b81526004016104d090611a97565b610770828261129a565b6000546001600160a01b031690565b60606002805461042690611f51565b61077061092f610e17565b83836112eb565b60035490565b61094d610947610e17565b83610e89565b6109695760405162461bcd60e51b81526004016104d090611e78565b6109758484848461138e565b50505050565b6000818152600b602052604081208054606092919061099990611f51565b90501115610a3f576000828152600b6020526040902080546109ba90611f51565b80601f01602080910402602001604051908101604052809291908181526020018280546109e690611f51565b8015610a335780601f10610a0857610100808354040283529160200191610a33565b820191906000526020600020905b815481529060010190602001808311610a1657829003601f168201915b50505050509050610412565b610ad6600a8054610a4f90611f51565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7b90611f51565b8015610ac85780601f10610a9d57610100808354040283529160200191610ac8565b820191906000526020600020905b815481529060010190602001808311610aab57829003601f168201915b50505050506103ca846113c1565b9050610412565b610ae5610e17565b6001600160a01b0316610af6610906565b6001600160a01b031614610b1c5760405162461bcd60e51b81526004016104d090611d96565b6001600160a01b0382166000908152600c602052604090819020805460ff1916831515179055517fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb6090610b729084908490611a5e565b60405180910390a15050565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205460ff1690565b610bb4610e17565b6001600160a01b0316610bc5610906565b6001600160a01b031614610beb5760405162461bcd60e51b81526004016104d090611d96565b6001600160a01b038116610c115760405162461bcd60e51b81526004016104d090611b2a565b6106768161124a565b600c6020526000908152604090205460ff1681565b600b602052600090815260409020805461078190611f51565b8051825160609184918491600091610c609190611f0e565b67ffffffffffffffff811115610c8657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610cb0576020820181803683370190505b509050806000805b8551811015610d4457858181518110610ce157634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168383610cfb81611f8c565b945081518110610d1b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535080610d3c81611f8c565b915050610cb8565b5060005b8451811015610dd457848181518110610d7157634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168383610d8b81611f8c565b945081518110610dab57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535080610dcc81611f8c565b915050610d48565b5091979650505050505050565b6001600160e01b031981166301ffc9a760e01b14919050565b6000908152600560205260409020546001600160a01b0316151590565b3390565b600081815260086020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610e5082610703565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610e9482610dfa565b610eb05760405162461bcd60e51b81526004016104d090611c22565b6000610ebb83610703565b9050806001600160a01b0316846001600160a01b03161480610ef65750836001600160a01b0316610eeb846104a9565b6001600160a01b0316145b806106fb57506106fb8185610b7e565b826001600160a01b0316610f1982610703565b6001600160a01b031614610f3f5760405162461bcd60e51b81526004016104d090611dcb565b6001600160a01b038216610f655760405162461bcd60e51b81526004016104d090611ba7565b610f70838383610588565b610f7b600082610e1b565b6001600160a01b0383166000908152600760205260408120805460019290610fa4908490611f3a565b90915550506001600160a01b0382166000908152600760205260408120805460019290610fd2908490611f0e565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600061103e82610703565b905061104c81600084610588565b611057600083610e1b565b6001600160a01b0381166000908152600760205260408120805460019290611080908490611f3a565b9250508190555060016003600082825461109a9190611f3a565b90915550506000828152600660209081526040808320805460ff19166001179055600590915280822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006001600160a01b0384166111315760405162461bcd60e51b81526004016104d090611d15565b61113a83610dfa565b156111575760405162461bcd60e51b81526004016104d090611b70565b60008251116111785760405162461bcd60e51b81526004016104d090611ab4565b611183858585610588565b6001600160a01b03841660009081526007602052604081208054600192906111ac908490611f0e565b9091555050600083815260056020908152604080832080546001600160a01b0319166001600160a01b038916179055600d9091528120805460ff1916600117905560038054916111fb83611f8c565b919050555082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450909392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000828152600b6020908152604090912082516112b9928401906115fa565b507fee1bb82f380189104b74a7647d26f2f35679780e816626ffcaec7cafb7288e468282604051610b72929190611ef5565b816001600160a01b0316836001600160a01b0316141561131d5760405162461bcd60e51b81526004016104d090611beb565b6001600160a01b0383811660008181526009602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190611381908590611a79565b60405180910390a3505050565b611399848484610f06565b6113a5848484846114dc565b6109755760405162461bcd60e51b81526004016104d090611ad8565b6060816113e657506040805180820190915260018152600360fc1b6020820152610412565b8160005b811561141057806113fa81611f8c565b91506114099050600a83611f26565b91506113ea565b60008167ffffffffffffffff81111561143957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611463576020820181803683370190505b5090505b84156106fb57611478600183611f3a565b9150611485600a86611fa7565b611490906030611f0e565b60f81b8183815181106114b357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506114d5600a86611f26565b9450611467565b60006114f0846001600160a01b03166115f4565b156115ec57836001600160a01b031663150b7a0261150c610e17565b8786866040518563ffffffff1660e01b815260040161152e9493929190611a21565b602060405180830381600087803b15801561154857600080fd5b505af1925050508015611578575060408051601f3d908101601f19168201909252611575918101906118bf565b60015b6115d2573d8080156115a6576040519150601f19603f3d011682016040523d82523d6000602084013e6115ab565b606091505b5080516115ca5760405162461bcd60e51b81526004016104d090611ad8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506106fb565b5060016106fb565b3b151590565b82805461160690611f51565b90600052602060002090601f016020900481019282611628576000855561166e565b82601f1061164157805160ff191683800117855561166e565b8280016001018555821561166e579182015b8281111561166e578251825591602001919060010190611653565b5061167a92915061167e565b5090565b5b8082111561167a576000815560010161167f565b600067ffffffffffffffff808411156116ae576116ae611fe7565b604051601f8501601f1916810160200182811182821017156116d2576116d2611fe7565b6040528481529150818385018610156116ea57600080fd5b8484602083013760006020868301015250509392505050565b80356001600160a01b038116811461041257600080fd5b600082601f83011261172a578081fd5b61173983833560208501611693565b9392505050565b600060208284031215611751578081fd5b61173982611703565b6000806040838503121561176c578081fd5b61177583611703565b915061178360208401611703565b90509250929050565b6000806000606084860312156117a0578081fd5b6117a984611703565b92506117b760208501611703565b9150604084013590509250925092565b600080600080608085870312156117dc578081fd5b6117e585611703565b93506117f360208601611703565b925060408501359150606085013567ffffffffffffffff811115611815578182fd5b8501601f81018713611825578182fd5b61183487823560208401611693565b91505092959194509250565b60008060408385031215611852578182fd5b61185b83611703565b91506020830135801515811461186f578182fd5b809150509250929050565b6000806040838503121561188c578182fd5b61189583611703565b946020939093013593505050565b6000602082840312156118b4578081fd5b813561173981611ffd565b6000602082840312156118d0578081fd5b815161173981611ffd565b6000602082840312156118ec578081fd5b813567ffffffffffffffff811115611902578182fd5b6106fb8482850161171a565b60008060408385031215611920578182fd5b823567ffffffffffffffff80821115611937578384fd5b6119438683870161171a565b93506020850135915080821115611958578283fd5b506119658582860161171a565b9150509250929050565b600060208284031215611980578081fd5b5035919050565b60008060408385031215611999578182fd5b82359150602083013567ffffffffffffffff8111156119b6578182fd5b6119658582860161171a565b60008151808452815b818110156119e7576020818501810151868301820152016119cb565b818111156119f85782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611a54908301846119c2565b9695505050505050565b6001600160a01b039290921682521515602082015260400190565b901515815260200190565b60006020825261173960208301846119c2565b60208082526003908201526234303360e81b604082015260600190565b6020808252600a908201526906c656e676874203c20360b41b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b6020808252600990820152684552524f522034303160b81b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252600990820152684552524f522034303360b81b604082015260600190565b90815260200190565b6000838252604060208301526106fb60408301846119c2565b60008219821115611f2157611f21611fbb565b500190565b600082611f3557611f35611fd1565b500490565b600082821015611f4c57611f4c611fbb565b500390565b600281046001821680611f6557607f821691505b60208210811415611f8657634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611fa057611fa0611fbb565b5060010190565b600082611fb657611fb6611fd1565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461067657600080fdfea264697066735822122097a341b06d4d7dbc0ffaaea7f29ee700ac7efc7f8e7422499076e5caac437d3c64736f6c63430008000033

Verified Source Code Partial Match

Compiler: v0.8.0+commit.c7dfd78e EVM: istanbul Optimization: Yes (200 runs)
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
ERC721.sol 508 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "./Address.sol";
import "./Context.sol";
import "./Strings.sol";
import "./ERC165.sol";
import "./Ownable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, Ownable {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // current Number of Token
    uint256 internal _numberOfToken;

    // max Mint Number
    uint256 internal _totalNumber;


    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // g: burning
    mapping(uint => bool) private _burnTokens;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    string public baseURI;
    mapping(uint => string) public lockUri;
    mapping(address => bool) public minters;
    mapping(uint256 => bool) tokenExist;
    event Minter(address _m,bool _o);
    event SetURI(uint _id,string _ipfs);
    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_, uint256 totalNumber_) {
        _name = name_;
        _symbol = symbol_;
        _totalNumber = totalNumber_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }
    function setBase(string memory _uri) public onlyOwner{
        baseURI = _uri;
    }
    function exist(uint _id) external view returns (bool) {
        return tokenExist[_id];
    }
    function setMinter(address _minter,bool _open) public onlyOwner{
        minters[_minter] = _open;
        emit Minter(_minter,_open);
    }
    // function setTotalNumber(uint256 totalNumber_) public onlyOwner{ 
    //     _totalNumber = totalNumber_;
    // }
    function setURI(uint _id,string memory _ipfs) public  {
        // // require(ownerOf(_id) == msg.sender && bytes(lockUri[_id]).length < 1,"403");
        require(minters[msg.sender],'ERROR 403');
        require(bytes(lockUri[_id]).length < 1,"403");
        _setURI(_id,_ipfs);
    }
    function strConcat(string memory _a, string memory _b) public pure returns (string memory){
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        string memory ret = new string(_ba.length + _bb.length);
        bytes memory bret = bytes(ret);
        uint k = 0;
        uint i;
        for (i = 0; i < _ba.length; i++)bret[k++] = _ba[i];
        for (i = 0; i < _bb.length; i++) bret[k++] = _bb[i];
        return string(ret);
    }
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        
        if(bytes(lockUri[tokenId]).length > 0){
            return lockUri[tokenId];
        }else{
            return strConcat(baseURI,Strings.toString(tokenId));
        }
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }
    
    /**
     * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
     */
    function totalSupply() public view  returns (uint256) {
        return _totalNumber;
    }

    /**
     * Returns the total amount of tokens minted in the contract.
     */
    function totalMinted() public view returns (uint256)  {
        return _numberOfToken;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    function _setURI(uint _id,string memory _ipfs) internal  {
        lockUri[_id] = _ipfs;
        emit SetURI(_id,_ipfs);
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */

    // function mint(
    //     address from,
    //     address to,
    //     uint _tokenID,
    //     bytes memory data,
    //     string memory _ipfs
    // ) public override virtual returns (uint) {
    //     require(minters[msg.sender],'ERROR 403');
    //     return _mint(from,to,_tokenID , data, _ipfs);
    // }
    // function _mint(address from,address to, uint256 tokenId,bytes memory data, string memory _ipfs) internal virtual  returns (uint){
    //     require(to != address(0), "ERC721: mint to the zero address");
    //     require(!_exists(tokenId), "ERC721: token already minted");
    //     require(data.length > 0, "lenght < 0");
    //     _beforeTokenTransfer(from, to, tokenId);

    //     _balances[to] += 1;
    //     _owners[tokenId] = to;
    //     tokenExist[tokenId] = true;
    //     bytes memory ipfsBytes = bytes(_ipfs);
    //     if(ipfsBytes.length != 0) {
    //         _setURI(tokenId, _ipfs);
    //     }
    //     emit Transfer(from, to, tokenId);
    //     return tokenId;
    // }

    // Original Minting
    function mint(
        address from,
        address to,
        uint _tokenID,
        bytes memory data
    ) public virtual returns (uint) {
        require(minters[msg.sender],'ERROR 403');
        require(!_burnTokens[_tokenID],'ERROR 401');
        return _mint(from,to,_tokenID,data);
    }
    function _mint(address from,address to, uint256 tokenId,bytes memory data) internal virtual  returns (uint){
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");
        require(data.length > 0, "lenght < 0");
        _beforeTokenTransfer(from, to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;
        tokenExist[tokenId] = true;
        _numberOfToken++;
        emit Transfer(from, to, tokenId);
        return tokenId;
    }
    
    function burn(uint256 tokenId) public virtual {
        require(_owners[tokenId] != address(0) && !_burnTokens[tokenId],'ERROR 401');
        require(msg.sender == _owners[tokenId],'ERROR 403');
        _burn(tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        _numberOfToken -= 1;
        _burnTokens[tokenId] = true;

        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721.sol 311 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;


}


// pragma solidity ^0.8.0;

// import "./IERC165.sol";

// /**
//  * @dev Required interface of an ERC721 compliant contract.
//  */
// interface IERC721 is IERC165 {
//     /**
//      * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
//      */
//     event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

//     /**
//      * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
//      */
//     event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

//     /**
//      * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
//      */
//     event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

//     /**
//      * @dev Returns the number of tokens in ``owner``'s account.
//      */
//     function balanceOf(address owner) external view returns (uint256 balance);

//     /**
//      * @dev Returns the owner of the `tokenId` token.
//      *
//      * Requirements:
//      *
//      * - `tokenId` must exist.
//      */
//     function ownerOf(uint256 tokenId) external view returns (address owner);

//     /**
//      * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
//      * are aware of the ERC721 protocol to prevent tokens from being forever locked.
//      *
//      * Requirements:
//      *
//      * - `from` cannot be the zero address.
//      * - `to` cannot be the zero address.
//      * - `tokenId` token must exist and be owned by `from`.
//      * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
//      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
//      *
//      * Emits a {Transfer} event.
//      */
//     function safeTransferFrom(
//         address from,
//         address to,
//         uint256 tokenId
//     ) external;

//     /**
//      * @dev Transfers `tokenId` token from `from` to `to`.
//      *
//      * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
//      *
//      * Requirements:
//      *
//      * - `from` cannot be the zero address.
//      * - `to` cannot be the zero address.
//      * - `tokenId` token must be owned by `from`.
//      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
//      *
//      * Emits a {Transfer} event.
//      */
//     function transferFrom(
//         address from,
//         address to,
//         uint256 tokenId
//     ) external;

//     /**
//      * @dev Gives permission to `to` to transfer `tokenId` token to another account.
//      * The approval is cleared when the token is transferred.
//      *
//      * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
//      *
//      * Requirements:
//      *
//      * - The caller must own the token or be an approved operator.
//      * - `tokenId` must exist.
//      *
//      * Emits an {Approval} event.
//      */
//     function approve(address to, uint256 tokenId) external;

//     /**
//      * @dev Returns the account approved for `tokenId` token.
//      *
//      * Requirements:
//      *
//      * - `tokenId` must exist.
//      */
//     function getApproved(uint256 tokenId) external view returns (address operator);

//     /**
//      * @dev Approve or remove `operator` as an operator for the caller.
//      * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
//      *
//      * Requirements:
//      *
//      * - The `operator` cannot be the caller.
//      *
//      * Emits an {ApprovalForAll} event.
//      */
//     function setApprovalForAll(address operator, bool _approved) external;

//     /**
//      * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
//      *
//      * See {setApprovalForAll}
//      */
//     function isApprovedForAll(address owner, address operator) external view returns (bool);

//     /**
//      * @dev Safely transfers `tokenId` token from `from` to `to`.
//      *
//      * Requirements:
//      *
//      * - `from` cannot be the zero address.
//      * - `to` cannot be the zero address.
//      * - `tokenId` token must exist and be owned by `from`.
//      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
//      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
//      *
//      * Emits a {Transfer} event.
//      */
//     function safeTransferFrom(
//         address from,
//         address to,
//         uint256 tokenId,
//         bytes calldata data
//     ) external;

//     // function mint(
//     //     address from,
//     //     address to,
//     //     uint _tokenID,
//     //     bytes memory data
//     // ) external returns (uint);

//     // function mintMulti(
//     //     address from,
//     //     address to,
//     //     uint[] memory _tokenIDs,
//     //     uint tokenIndex,
//     //     bytes memory data,
//     //     string[] memory _ipfs
//     // ) external;

//     function mintMulti(
//         address to,
//         uint tokenIndex,
//         bytes memory data
//     ) external;

//     // function setURI(uint _id,string memory _ipfs)  external;
// }
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "./Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

Read Contract

balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
exist 0x4ebbc92a → bool
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
lockUri 0xf74bee28 → string
minters 0xf46eccc4 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
strConcat 0xff74927b → string
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalMinted 0xa2309ff8 → uint256
totalSupply 0x18160ddd → uint256

Write Contract 12 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
mint 0x6010a5e7
address from
address to
uint256 _tokenID
bytes data
returns: uint256
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBase 0x664aa26b
string _uri
setMinter 0xcf456ae7
address _minter
bool _open
setURI 0x862440e2
uint256 _id
string _ipfs
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address