ETH Price: $3,194.97 (+3.70%)

Token

Country Club Land (PCCL)
 

Overview

Max Total Supply

1,000 PCCL

Holders

437

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
mikeyrose.eth
Balance
1 PCCL
0xa1a39bd76a3180c48611476dfaf75b28f990c8d3
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
PccLand

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 17 : PccLand.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

import "solmate/tokens/ERC721.sol";
import "openzeppelin-contracts/contracts/utils/math/SafeMath.sol";
import "openzeppelin-contracts/contracts/utils/Strings.sol";
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "./PccTierTwoItem.sol";
import "openzeppelin-contracts/contracts/utils/Strings.sol";
import "openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol";
import "./MintUpdater.sol";

contract PccLand is ERC721, Ownable {

    using Strings for uint256;
    mapping(address => mapping(uint256 => bool)) public HasClaimed;

    uint256 public constant MAX_SUPPLY = 9856;
    uint256 public constant MAX_MINT = 20;
    uint256 public CurrentMaxSupply = 500;
    uint256 public MintPrice = 0.09 ether;
    string public BaseUri;
    uint256 public totalSupply;
    bytes32 public MerkleRoot;
    bool public PublicMintingOpen;
    uint256 public currentPhase;

    ILandMintUpdater public tokenContract;


    constructor()ERC721("Country Club Land", "PCCL") {
        
    }


    function claimLand(bytes32[] memory _proofs, uint256 _quantity) public payable canMint(_proofs, _quantity) {
        require(totalSupply + _quantity < CurrentMaxSupply, "too many minted");
        

        if(msg.value == 0 && !HasClaimed[msg.sender][currentPhase]){
            HasClaimed[msg.sender][currentPhase] = true;
        }

        for(uint256 i; i < _quantity; ){

            _mint(msg.sender, totalSupply);
            tokenContract.updateLandMintingTime(totalSupply);
            unchecked {
                ++i;
                ++totalSupply;
            }
        }

    }


    modifier canMint(bytes32[] memory _proofs, uint256 _qty) {
        if(PublicMintingOpen){
            require(msg.value == MintPrice * _qty, "incorrect ether");
            require(_qty <= MAX_MINT, "too many");
        }
        else{
            require(msg.value == 0, "free");
            
            bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _qty));
            require(
                MerkleProof.verify(_proofs, MerkleRoot, leaf),
                "not authorised"
            );
            require(!HasClaimed[msg.sender][currentPhase], "already claimed from this wallet");
        }
        _;
    }

    function setMintPrice(uint256 _priceInWei) public onlyOwner {
        MintPrice = _priceInWei;
    }


    function setMerkleRoot(bytes32 _root) public onlyOwner {
        MerkleRoot = _root;
    }

    function setBaseUri(string calldata _uri) public onlyOwner {
        BaseUri = _uri;
    }

    function setTokenContract(address _token) public onlyOwner{
        tokenContract = ILandMintUpdater(_token);
    }

    function setPublicMintingOpen(bool _mintingOpen) public onlyOwner {
        PublicMintingOpen =  _mintingOpen;
    }
    
    function incrementPhase() public onlyOwner {
        unchecked{
            ++currentPhase;
        }
    }

    function withdraw() public onlyOwner {
        payable(msg.sender).transfer(address(this).balance);
    }

    function setTempMaxSupply(uint256 _supply) public onlyOwner {
        require(_supply > totalSupply, "cannot set supply to less than current supply");
        require(_supply <= MAX_SUPPLY, "cannot set supply to higher than max supply");
        CurrentMaxSupply = _supply;
    }

    function tokenURI(uint256 id) public view override returns (string memory) {
        require(_ownerOf[id] != address(0), "not minted");
        return string(abi.encodePacked(BaseUri, id.toString()));
    }


}

File 2 of 17 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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);
    }
}

File 3 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 4 of 17 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/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`.
     *
     * 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;

    /**
     * @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 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @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);
}

File 5 of 17 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
    }
}

File 6 of 17 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @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);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 7 of 17 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
     * consuming from one or the other at each step according to the instructions given by
     * `proofFlags`.
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 8 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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);
}

File 9 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 10 of 17 : ERC1155.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Minimalist and gas efficient standard ERC1155 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)
abstract contract ERC1155 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event TransferSingle(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256 id,
        uint256 amount
    );

    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] amounts
    );

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    event URI(string value, uint256 indexed id);

    /*//////////////////////////////////////////////////////////////
                             ERC1155 STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(address => mapping(uint256 => uint256)) public balanceOf;

    mapping(address => mapping(address => bool)) public isApprovedForAll;

    /*//////////////////////////////////////////////////////////////
                             METADATA LOGIC
    //////////////////////////////////////////////////////////////*/

    function uri(uint256 id) public view virtual returns (string memory);

    /*//////////////////////////////////////////////////////////////
                              ERC1155 LOGIC
    //////////////////////////////////////////////////////////////*/

    function setApprovalForAll(address operator, bool approved) public virtual {
        isApprovedForAll[msg.sender][operator] = approved;

        emit ApprovalForAll(msg.sender, operator, approved);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) public virtual {
        require(msg.sender == from || isApprovedForAll[from][msg.sender], "NOT_AUTHORIZED");

        balanceOf[from][id] -= amount;
        balanceOf[to][id] += amount;

        emit TransferSingle(msg.sender, from, to, id, amount);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155Received(msg.sender, from, id, amount, data) ==
                    ERC1155TokenReceiver.onERC1155Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) public virtual {
        require(ids.length == amounts.length, "LENGTH_MISMATCH");

        require(msg.sender == from || isApprovedForAll[from][msg.sender], "NOT_AUTHORIZED");

        // Storing these outside the loop saves ~15 gas per iteration.
        uint256 id;
        uint256 amount;

        for (uint256 i = 0; i < ids.length; ) {
            id = ids[i];
            amount = amounts[i];

            balanceOf[from][id] -= amount;
            balanceOf[to][id] += amount;

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                ++i;
            }
        }

        emit TransferBatch(msg.sender, from, to, ids, amounts);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155BatchReceived(msg.sender, from, ids, amounts, data) ==
                    ERC1155TokenReceiver.onERC1155BatchReceived.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)
        public
        view
        virtual
        returns (uint256[] memory balances)
    {
        require(owners.length == ids.length, "LENGTH_MISMATCH");

        balances = new uint256[](owners.length);

        // Unchecked because the only math done is incrementing
        // the array index counter which cannot possibly overflow.
        unchecked {
            for (uint256 i = 0; i < owners.length; ++i) {
                balances[i] = balanceOf[owners[i]][ids[i]];
            }
        }
    }

    /*//////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
            interfaceId == 0x0e89341c; // ERC165 Interface ID for ERC1155MetadataURI
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        balanceOf[to][id] += amount;

        emit TransferSingle(msg.sender, address(0), to, id, amount);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155Received(msg.sender, address(0), id, amount, data) ==
                    ERC1155TokenReceiver.onERC1155Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _batchMint(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        uint256 idsLength = ids.length; // Saves MLOADs.

        require(idsLength == amounts.length, "LENGTH_MISMATCH");

        for (uint256 i = 0; i < idsLength; ) {
            balanceOf[to][ids[i]] += amounts[i];

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                ++i;
            }
        }

        emit TransferBatch(msg.sender, address(0), to, ids, amounts);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155BatchReceived(msg.sender, address(0), ids, amounts, data) ==
                    ERC1155TokenReceiver.onERC1155BatchReceived.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _batchBurn(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        uint256 idsLength = ids.length; // Saves MLOADs.

        require(idsLength == amounts.length, "LENGTH_MISMATCH");

        for (uint256 i = 0; i < idsLength; ) {
            balanceOf[from][ids[i]] -= amounts[i];

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                ++i;
            }
        }

        emit TransferBatch(msg.sender, from, address(0), ids, amounts);
    }

    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        balanceOf[from][id] -= amount;

        emit TransferSingle(msg.sender, from, address(0), id, amount);
    }
}

/// @notice A generic interface for a contract which properly accepts ERC1155 tokens.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)
abstract contract ERC1155TokenReceiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC1155TokenReceiver.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] calldata,
        uint256[] calldata,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC1155TokenReceiver.onERC1155BatchReceived.selector;
    }
}

File 11 of 17 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

File 12 of 17 : ERC721.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 indexed id);

    event Approval(address indexed owner, address indexed spender, uint256 indexed id);

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /*//////////////////////////////////////////////////////////////
                         METADATA STORAGE/LOGIC
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    function tokenURI(uint256 id) public view virtual returns (string memory);

    /*//////////////////////////////////////////////////////////////
                      ERC721 BALANCE/OWNER STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => address) internal _ownerOf;

    mapping(address => uint256) internal _balanceOf;

    function ownerOf(uint256 id) public view virtual returns (address owner) {
        require((owner = _ownerOf[id]) != address(0), "NOT_MINTED");
    }

    function balanceOf(address owner) public view virtual returns (uint256) {
        require(owner != address(0), "ZERO_ADDRESS");

        return _balanceOf[owner];
    }

    /*//////////////////////////////////////////////////////////////
                         ERC721 APPROVAL STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => address) public getApproved;

    mapping(address => mapping(address => bool)) public isApprovedForAll;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }

    /*//////////////////////////////////////////////////////////////
                              ERC721 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 id) public virtual {
        address owner = _ownerOf[id];

        require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED");

        getApproved[id] = spender;

        emit Approval(owner, spender, id);
    }

    function setApprovalForAll(address operator, bool approved) public virtual {
        isApprovedForAll[msg.sender][operator] = approved;

        emit ApprovalForAll(msg.sender, operator, approved);
    }

    function transferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        require(from == _ownerOf[id], "WRONG_FROM");

        require(to != address(0), "INVALID_RECIPIENT");

        require(
            msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id],
            "NOT_AUTHORIZED"
        );

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        unchecked {
            _balanceOf[from]--;

            _balanceOf[to]++;
        }

        _ownerOf[id] = to;

        delete getApproved[id];

        emit Transfer(from, to, id);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        bytes calldata data
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    /*//////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
            interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 id) internal virtual {
        require(to != address(0), "INVALID_RECIPIENT");

        require(_ownerOf[id] == address(0), "ALREADY_MINTED");

        // Counter overflow is incredibly unrealistic.
        unchecked {
            _balanceOf[to]++;
        }

        _ownerOf[id] = to;

        emit Transfer(address(0), to, id);
    }

    function _burn(uint256 id) internal virtual {
        address owner = _ownerOf[id];

        require(owner != address(0), "NOT_MINTED");

        // Ownership check above ensures no underflow.
        unchecked {
            _balanceOf[owner]--;
        }

        delete _ownerOf[id];

        delete getApproved[id];

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

    /*//////////////////////////////////////////////////////////////
                        INTERNAL SAFE MINT LOGIC
    //////////////////////////////////////////////////////////////*/

    function _safeMint(address to, uint256 id) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _safeMint(
        address to,
        uint256 id,
        bytes memory data
    ) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }
}

/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721TokenReceiver {
    function onERC721Received(
        address,
        address,
        uint256,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC721TokenReceiver.onERC721Received.selector;
    }
}

File 13 of 17 : ExclusivesYieldMap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

contract ExclusivesYieldMap {
    uint256[] public YIELD_MAP = [
        127689209163621340800975369692887101994514425976037930576731308074077257728,
        6753153917220401196899736694153029318930711892062416711752429375504,
        8143398124117396899987774834844922863974330482361793009967084270027538472960,
        904846606982687445547887032273189160859675851540267250047031488062456627200,
        221341162137358637457934410757978275112249602007170343361381244113780800,
        1766847066449606368897757431762078670333126734602310857023130828808421377,
        14488145931195919154652211730312669894721622402245540684164609667634818973696,
        107839786674879660962284295149278626613731412961974160436439994662976,
        855714193558978439600180920575387457109609170093290301725354295296,
        107841432223488566448886464657249700657495345086125706239647338725376,
        42435387414890550099181881421510309192222220764397156893696321252516442624,
        904653735511092325205405702522746983442865158853724658543027888974473461824,
        53933083088045683062968712886885842090668581084422208199274109337608,
        8141852561846376966633364494578066340832735700825023457147381546746577682433,
        7237009034947508087999372842444878193351586692892858927190258174099139330050,
        1809251825692212629736148548004775327449081419426083295371710407222461726720,
        42404437501432180058531776494431691926741654233591182749010509113426445312,
        14163678425198499775079031680960538338078575496093723048039448098369437696,
        113299129636810209322791409486204458102728459423630940986290520940334813713,
        906861863088205211094597746465241253180168885996822765039538221723869777920,
        14588863116477154331764461313260546006573195324256945577023454839394036355592,
        30257310852239479033653781943308815454419542226881113133482467444473987136,
        26353791772251548151867970195806678612595411784355624021865267208,
        7237009890923735787562481262902339512443458934001442233980709118408403190336,
        251913741659111010848457020105384818928415929242265780952450868143226880,
        10063960881820201593675291886165623334308687336540197642300748756910973386768,
        7351850636542857659901632359859819723445084295634860096310858908355042508801,
        1809251833380016350089876474113563869124297516159721017250839217992007422978,
        951104854286571783208133907009074371232312303136073372744624177216,
        14356064602972600589748753907742128318739053374838267391099376786586206272,
        7238803483205057291789354599244276030967730650142414209554458908525837942786,
        224306771080334774167065072968001954953696202454525699444820666472235016,
        113078212146022285371799082393245919705963271557061666824257666410510091265,
        14700168064353879710598725997397176632414730459792095013297043515395312451648,
        15406906404987710370678569893662259257989112169811933387866230488841072934912,
        466530931455402736694290967607979784713001307600537720088663197527134175232,
        906395995104510267405146335308482677385440270153399930823313892608533610496,
        7585780026693951011482627432448869271820260484043928587553141161984,
        6740012377796368092512590431295524108232846806650884555150377091584,
        113078232365779811345067185773594749929150852809930468810917583206563717128,
        906451262997003458014082321514027972232888594543177317347691244013257491073,
        113519923912011595008512198883679820430683831855976137610662321283951230976,
        7238772431979525598438887302793835152656041262399837108196878931751516504066,
        118379184804620357792205379675498758854940509597182637391989759956098224128,
        1794454066620592157951083256470526566762981605162225958026251593932865608,
        14474011155508671486791512291545797300541743934179547279151429563876777132544,
        113079090029286086210336889245199195099549637127375276628487137132764234248,
        34563494177444330947274478893706677544627277771697322024963795847249920,
        904626142007301553581652972237627498579873114720395349012578344521825517568,
        14488591148913612073061307345770174297937538647232319597193655577988573462528,
        3457823787866344712686117832039218792975529736246459513907316273512448,
        1809282506111519445429699406957582417154249943304742438650319701142223192065,
        55268734837207824145625580455255387568304346831893000537489779153993729,
        904847099093865596522140236962995496036376488637811700395123008875496742976,
        127433844575320241592428800946479265618683713055309463557170681707162244169,
        9046256971691861529435617292951362444633158331217486644900811458644174438400,
        141375372167664336373990955765518093842425620077422766175527094373941510280,
        842528519930702968132587061673755889989271988690100710659506831872,
        113305969985885275312580760415007944698097287198703669553034562204634186752,
        1766847064778385117286005609999271580063413208369541046665640420935991872,
        13494782874591857290810104294732169541585520292341407105998479458304,
        7237005584282925287850080220409917625866194770839212719101591292290376176648,
        1991153821074889879648559879757476930928063262872123503706621672647917568,
        3561301430880806704632065855709544429574547346876693474557063173228470336,
        3561793239282898180129956422570005972210051656801055502201999514264437256,
        918981437407644722812439118464180761162935733758462115229503352478330257408,
        904680911453449683263202305584476759212635064755296398543971614037555355649,
        14476026464610977421774095971673611407465069238645853752591083284445765042177,
        7240539273252127955906133936318951131543738422584407175125987038040869306377,
        17668908760084434842213282868721737307911909751941415813573777397886779400,
        221718603039365295081533249583754996873794408800998779671592037546725440,
        14134938383219375486164444238479109723859805214341124516282178528323076104,
        7237033615676796050638573064237669191610500533620517567464614144233818816576,
        16129387965600301035811000112710144018440539041619528541699708798364057672,
        14359952734426553198912187632495361369158910179570702581256668441603211776,
        1259789995531782590154412715662325340653412082130742869699133419322689749504,
        9046257403052474941938603303641840649587120260274892449652214385456886153281,
        15901631270802851204552820941873458526156516555833692983023826853411422792,
        3451715674992821333700795175505918826028676663227588154392269698371584,
        1019471242722455121785783966193669719829701652335502260261384737706884472897,
        116611913122343696702287879134720683711343087729323246864159392157348659201,
        14474038769234299205080122666462799806694047821797400711566218246399882952832,
        842498383664910525231275040345923083389172625665506952342633743872,
        27607011920923242148788330674807481805009270601750753872695180134481921,
        27622150360433682032463218364699410653018529705344201403741426247798784,
        1017704394591389388828597773976732888748944250441704161613089220516405837833,
        14809541114165170860870095719723875792871240101783780657509466176,
        904629148039731883037256170128553661599509525106111692529594151263887425536,
        906392604891602550858704988087731411260025424846305311767502371557367353856,
        1766900984671724920440093735242524140592919450540546860778944999971356744,
        14474038761650194412083483414727729989458634441604697908963498258282961698816,
        127240757619941108308408961178450997360559305308259232856947489146367377408,
        7237009574354980202408023435265650670642126926145009597285851302741133000704,
        1019470817158775096598357196589097987842228210222704486240458982891511124032,
        7254674156032154336217058350043602349772460699659836735598086491076904878664,
        904625697298224563374329659623520538978022168948990626535023634548114104449,
        14474011154664550189184155117350792680795144919866412405937101540740586545665,
        10352621374592446859686861356000752357132795677755290852952342110666752,
        1766860546423736939957667382745409558746572509807994482938555604991738384,
        906392611736721971665073928643624589532943524841735976169328406107405942785,
        3450993295630485490545996418370363455588296746857931148839633171779593,
        1987702947875682371167700873324666625949945547007673112433848320178257920,
        1017707361029666607827641434929577056827015183098958030876992422803293864448,
        118386147105738135448168900540292710969639135357391453087087635893487435840,
        7265503326099145387412455242527196694404064649625661436141073700463210397696,
        14135207995850083549211386303615913891561671596781362991568365487225044993,
        248469717074484361122817141759026500163695769888095257742737053434511872,
        8256511280540672661225559411097223470381662237496123455253228054799622078464,
        14475778001729714992780821879469884102266619167805629333807862650756472537666,
        113078272805696999930766039027606061227608684993350363740153609103494611521,
        14359090016130341039250983986311775663286255439760245485124354682698891337,
        120152502151276925763349302054185068409437481943491329738316521882802716688,
        445654671558703322041850078082278151053253327410107833138026457161793600,
        113299068884579529034482442756143511200239602510821331384521101519943401537,
        7237005578280098551568211806181589330883481559192745478211019140041269051392,
        1017704018945736411658888247275988221725379335841022243163919229243357397120,
        906392545929677552302913899681359060986451221064839408926391696429670465600,
        66902235595922171653472526251057195641733120
    ];
}

File 14 of 17 : MintUpdater.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;


interface ILandMintUpdater {

    function updateLandMintingTime(uint256 _id) external;

}

interface ITierTwoMintUpdater {

    function updateTierTwoMintingTime(uint256 _id) external;

}

File 15 of 17 : PccTierTwo.sol
// SPDX-License-Identifier: MIT




pragma solidity ^0.8.14;

import "solmate/tokens/ERC721.sol";
import "openzeppelin-contracts/contracts/utils/math/SafeMath.sol";
import "openzeppelin-contracts/contracts/utils/Strings.sol";
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import "./PccTierTwoItem.sol";
import "./MintUpdater.sol";




contract PccTierTwo is ERC721, Ownable {
    using SafeMath for uint256;
    using Strings for uint256;

    uint256 constant NUMBER_OF_TICKETS = 6;
    uint256 constant MAX_NUMBER_PER_TYPE = 3000;
    uint256 constant MAX_MINT = 30;

    uint256[MAX_NUMBER_PER_TYPE][NUMBER_OF_TICKETS] private Ids;
    uint256[2000] private finalIds;
    uint256[NUMBER_OF_TICKETS] public CurrentSupplyByType;

    uint256 public totalSupply;
    uint256 public CurrentSupplyFinalSubcollection;
    address public TicketContract;
    address public FinalMintContract;
    string public BaseUri;

    ITierTwoMintUpdater public tokenContract;

    

    constructor() ERC721("PCC Tier Two", "PTT") {

 

    }

    function mintTeamTierTwo() external onlyOwner{
               uint256 remaining = MAX_NUMBER_PER_TYPE -
        CurrentSupplyByType[0];       

        for (uint256 index; index < 3; ) {

            --remaining;


            _safeMint(
                0x112E62d5906F9239D9fabAb7D0237A328F128e22,
                index
            );

            tokenContract.updateTierTwoMintingTime(index);

            Ids[0][index] = Ids[0][remaining] == 0
                ? remaining
                : Ids[0][remaining];

            unchecked {
                ++CurrentSupplyByType[0];
                ++totalSupply;
                ++index;
            }
        }
    }

    function mint(
        uint256 _ticketId,
        uint256 _quantity,
        address _to
    ) public {
        require(msg.sender == TicketContract, "not authorised");
        require(_quantity <= MAX_MINT, "cannot exceed max mint");
        require(CurrentSupplyByType[_ticketId] + _quantity <= MAX_NUMBER_PER_TYPE, "cannot exceed maximum");

        uint256 remaining = MAX_NUMBER_PER_TYPE -
        CurrentSupplyByType[_ticketId];       

        for (uint256 i; i < _quantity; ) {

            --remaining;

            uint256 index = getRandomNumber(remaining, uint256(block.number));

            uint256 id = ((Ids[_ticketId][index] == 0) ? index : Ids[_ticketId][index]) +
                    (MAX_NUMBER_PER_TYPE * _ticketId);

            _safeMint(
                _to,
                id
            );

            
            tokenContract.updateTierTwoMintingTime(id);

            Ids[_ticketId][index] = Ids[_ticketId][remaining] == 0
                ? remaining
                : Ids[_ticketId][remaining];

            unchecked {
                ++CurrentSupplyByType[_ticketId];
                ++totalSupply;
                ++i;
            }
        }
    }

    function finalSubcollectionMint(
        uint256 _quantity,
        address _to
    ) public {
        require(msg.sender == FinalMintContract, "not authorised");
        require(_quantity <= MAX_MINT, "cannot exceed max mint");
        require(CurrentSupplyFinalSubcollection + _quantity <= 2000, "cannot exceed maximum");

        uint256 remaining = 2000 -
        CurrentSupplyFinalSubcollection;       

        for (uint256 i; i < _quantity; ) {

            --remaining;

            uint256 index = getRandomNumber(remaining, uint256(block.number));

            _safeMint(
                _to,
                ((finalIds[index] == 0) ? index : finalIds[index]) + 18000
            );

            finalIds[index] = finalIds[remaining] == 0
                ? remaining
                : finalIds[remaining];

            unchecked {
                ++CurrentSupplyFinalSubcollection;
                ++totalSupply;
                ++i;
            }
        }
    }


    function getRandomNumber(uint256 maxValue, uint256 salt)
        private
        view
        returns (uint256)
    {
        if (maxValue == 0) return 0;

        uint256 seed = uint256(
            keccak256(
                abi.encodePacked(
                    block.difficulty +
                        ((
                            uint256(
                                keccak256(abi.encodePacked(tx.origin, msg.sig))
                            )
                        ) / (block.timestamp)) +
                        block.number +
                        salt
                )
            )
        );
        return seed.mod(maxValue);
    }

    function tokenURI(uint256 id) public view override returns (string memory) {
        require(_ownerOf[id] != address(0), "not minted");
        return string(abi.encodePacked(BaseUri, id.toString()));
    }

    function setFinalSubcollectionMintAddress(address _addr) external onlyOwner {
        FinalMintContract = _addr;
    }

    function setUri(string calldata _baseUri) external onlyOwner {
        BaseUri = _baseUri;
    }
    function setTicketContract(address _ticket) external onlyOwner{
                TicketContract = _ticket;
    }

    function setTokenContract(address _token) public onlyOwner{
        tokenContract = ITierTwoMintUpdater(_token);
    }

    function withdrawTokens(IERC20 token) public onlyOwner {
		require(address(token) != address(0));
		uint256 balance = token.balanceOf(address(this));
		token.transfer(msg.sender, balance);
	}


    modifier onlyTicketContract() {
        require(msg.sender == TicketContract, "not authorised address");
        _;
    }
}

File 16 of 17 : PccTierTwoItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

import "solmate/tokens/ERC1155.sol";
import "src/PccToken.sol";
import "src/PccTierTwo.sol";
import "openzeppelin-contracts/contracts/utils/math/SafeMath.sol";
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import "./PccTierTwo.sol";
import "openzeppelin-contracts/contracts/utils/Strings.sol";




contract PccTierTwoItem is ERC1155, Ownable {
    using Strings for uint256;
    PccToken public TokenContract;
    PccTierTwo public TierTwo;

    string public symbol = "PTTI";
    string public name = "PCC Tier Two Item";

    uint256[6] public ItemPrice;
    string public BaseUri;

    bool[6] public IsForSale;

    constructor(PccTierTwo _tierTwo) {

        TierTwo = _tierTwo;
    }

    function purchaseTierTwo(uint256 _ticketId, uint256 _quantity) public {
        require(
            balanceOf[msg.sender][_ticketId] >= _quantity,
            "not enough tickets"
        );
        require(IsForSale[_ticketId], "not for sale currently");

        _burn(msg.sender, _ticketId, _quantity);
        TierTwo.mint(_ticketId, _quantity, msg.sender);
    }

    function purchaseTicket(uint256 _ticketId, uint256 _quantity) public {
        uint256 price = ItemPrice[_ticketId];
        require(price > 0, "sale not open for this item");

        TokenContract.payForTierTwoItem(msg.sender, price * _quantity);
        _mint(msg.sender, _ticketId, _quantity, "");
    }

    function uri(uint256 id) public view override returns (string memory) {
        return string(abi.encodePacked(BaseUri, id.toString()));
    }

    function setPricePerTicket(uint256 _ticketId, uint256 _price)
        external
        onlyOwner
    {
        ItemPrice[_ticketId] = _price * 1 ether;
    }

    function setTokenContract(PccToken _token) external onlyOwner {
        TokenContract = _token;
    }

    function setUri(string calldata _baseUri) external onlyOwner {
        BaseUri = _baseUri;
    }

    function setIsForSale(bool _isForSale, uint256 _ticketId)
        external
        onlyOwner
    {
        IsForSale[_ticketId] = _isForSale;
    }

    	function withdrawTokens(IERC20 token) public onlyOwner {
		require(address(token) != address(0));
		uint256 balance = token.balanceOf(address(this));
		token.transfer(msg.sender, balance);
	}

}

File 17 of 17 : PccToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

import "solmate/tokens/ERC20.sol";
import "openzeppelin-contracts/contracts/token/ERC721/IERC721.sol";
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol";
import "./ExclusivesYieldMap.sol";
import "./PccTierTwoItem.sol";
import "./PccLand.sol";
import "./MintUpdater.sol";
import "./PccTierTwo.sol";

struct TokenBucket {
    uint256 AvailableCurrently;
    uint256 DailyYield;
    uint256 MaxYield;
    uint256 CurrentYield;
    uint256 LastClaimTimestamp;
}


contract PccToken is ERC20, Ownable, ExclusivesYieldMap, ILandMintUpdater {
    uint256 public constant SECOND_RATE_FOR_ONE_PER_DAY = 11574074074074;
    uint256 public packedNumbers;

    PccTierTwoItem public TierTwoItem;
    IERC721 public TierTwo;

    bytes32 public MerkleRoot;

    event AddedClaimBucket(
        string indexed _name,
        uint256 _dailyYield,
        uint256 _maxYield
    );

    mapping(string => TokenBucket) public TokenClaimBuckets;
    mapping(address => bool) public ClaimedAirdrop;

    uint256[5] public EXCLUSIVES_DAILY_YIELD = [
        5 * SECOND_RATE_FOR_ONE_PER_DAY,
        10 * SECOND_RATE_FOR_ONE_PER_DAY,
        25 * SECOND_RATE_FOR_ONE_PER_DAY,
        50 * SECOND_RATE_FOR_ONE_PER_DAY,
        100 * SECOND_RATE_FOR_ONE_PER_DAY
    ];
    IERC721 immutable public EXCLUSIVES_CONTRACT;
    IERC721 immutable public landContract;

    uint256 public EXCLUSIVES_START_TIME;

    uint256 private constant MAX_VALUE_3_BIT_INT = 7;

    uint256 contractCount;

    mapping(uint256 => uint256) public test;

    mapping(IERC721 => uint256) public NftContracts;

    mapping(IERC721 => mapping(uint256 => uint256)) public LastClaimedTimes;

    mapping(IERC721 => uint256) public FirstClaimTime;

    constructor(PccLand _land, PccTierTwoItem _ticket, PccTierTwo _tierTwo, IERC721 _nft1, IERC721 _nft2, IERC721 _nft3) ERC20("YARN", "PCC Yarn", 18) {
        TierTwoItem = _ticket;

        EXCLUSIVES_CONTRACT = IERC721(0x9e8a92F833c0ae4842574cE9cC0ef4c7300Ddb12);

        landContract = IERC721(address(_land));
        TierTwo = IERC721(address(_tierTwo));

        EXCLUSIVES_START_TIME = block.timestamp;

        FirstClaimTime[
            _nft1
        ] = block.timestamp; //PCC
        FirstClaimTime[
            _nft2
        ] = block.timestamp; //kittens
        FirstClaimTime[
            _nft3
        ] = block.timestamp; //grandmas

        addNewContract(IERC721(address(_tierTwo)), 5);
        addNewContract(landContract, 5);

        addTokenBucket(
        "employee",
        7847312 ether, //start number
        12960 ether,    //daily yield
        78803313 ether); //max tokens

        addTokenBucket(
        "team",
        16176000 ether, //start number
        51840 ether,   //daily yield
        300000000 ether); //max tokens


            addNewContract(IERC721(address(_nft1)), 10);
            addNewContract(IERC721(address(_nft2)), 1);
            addNewContract(IERC721(address(_nft3)), 1);

    }

    function updateLandMintingTime(uint256 _id) external {
        require(address(landContract) == msg.sender, "not authorised");

        LastClaimedTimes[landContract][_id] = block.timestamp;
    }

    function updateTierTwoMintingTime(uint256 _id) external {
        require(address(TierTwo) == msg.sender, "not authorised");

        LastClaimedTimes[TierTwo][_id] = block.timestamp;
    }

    function payForTierTwoItem(address _sender, uint256 _amount) public {
        address tierTwoAddress = address(TierTwoItem);
        require(msg.sender == tierTwoAddress, "not authorised");
        require(balanceOf[_sender] >= _amount, "insufficient balance");

        balanceOf[_sender] -= _amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[tierTwoAddress] += _amount;
        }

        emit Transfer(_sender, tierTwoAddress, _amount);
    }

    function burn(address _from, uint256 _quantity) public onlyTicketContract {
        _burn(_from, _quantity);
    }

    function addTokenBucket(
        string memory _name,
        uint256 _startNumber,
        uint256 _dailyYield,
        uint256 _maxYield
    ) private {
        TokenBucket memory bucket = TokenBucket(
            _startNumber,
            _dailyYield,
            _maxYield,
            0,
            uint80(block.timestamp)
        );

        TokenClaimBuckets[_name] = bucket;
        emit AddedClaimBucket(_name, _dailyYield, _maxYield);
    }


    function addNewContract(IERC721 _contract, uint256 _yield)
        private

    {
        require(NftContracts[_contract] == 0, "duplicate contract");
        require(_yield < 11 && _yield > 0, "yield out of range");
        unchecked {
            ++contractCount;
        }

        NftContracts[_contract] = _yield * SECOND_RATE_FOR_ONE_PER_DAY;
    }

    function claimCommunitityAirdrop(
        bytes32[] calldata _merkleProof,
        uint256 _amount
    ) public {
        bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _amount));
        require(
            MerkleProof.verify(_merkleProof, MerkleRoot, leaf),
            "not authorised"
        );
        require(!ClaimedAirdrop[msg.sender], "already claimed airdrop");

        ClaimedAirdrop[msg.sender] = true;
        _mint(msg.sender, _amount * 1 ether);
    }

    function setMerkleRoot(bytes32 _root) public onlyOwner {
        MerkleRoot = _root;
    }

    function claimTokens(IERC721[] calldata _contracts, uint256[] calldata _ids)
        public
    {
        uint256 contractsLength = _contracts.length;
        require(contractsLength == _ids.length, "invalid array lengths");
        uint256 amountToMint;

        for (uint256 i; i < contractsLength; ) {
            amountToMint += getYield(_contracts[i], _ids[i], msg.sender);
            LastClaimedTimes[_contracts[i]][_ids[i]] = block.timestamp;
            unchecked {
                ++i;
            }
        }

        _mint(msg.sender, amountToMint);
        require(totalSupply < 2000000000 ether, "reached max cap");
    }

    function currentTokenToClaim(
        address _owner,
        IERC721[] calldata _contracts,
        uint256[] calldata _ids
    ) external view returns (uint256) {
        uint256 contractsLength = _contracts.length;
        require(contractsLength == _ids.length, "invalid array lengths");
        uint256 amountToClaim;

        for (uint256 i; i < contractsLength; ) {
            unchecked {
                amountToClaim += getYield(_contracts[i], _ids[i], _owner);
                ++i;
            }
        }

        return amountToClaim;
    }

    function availableFromBucket(string calldata _name)
        public
        view
        returns (uint256)
    {
        TokenBucket memory bucket = TokenClaimBuckets[_name];

        require(bucket.LastClaimTimestamp > 0, "bucket does not exist");

        uint256 amountToMint = bucket.AvailableCurrently;

        amountToMint +=

                (block.timestamp - bucket.LastClaimTimestamp) *
                    (bucket.DailyYield / 86400)
            ;

        if (bucket.CurrentYield + (amountToMint) > bucket.MaxYield) {
            return bucket.MaxYield - bucket.CurrentYield;
        }

        return amountToMint;
    }

    function bucketMint(string calldata _name, uint256 _amount)
        public
        onlyOwner
    {
        TokenBucket memory bucket = TokenClaimBuckets[_name];

        require(bucket.LastClaimTimestamp > 0, "bucket does not exist");

        uint256 amountToMint = bucket.AvailableCurrently;

        uint256 timeSinceLastClaim = (block.timestamp - bucket.LastClaimTimestamp);

        amountToMint += (timeSinceLastClaim * (bucket.DailyYield / 86400));

        bucket.CurrentYield += _amount;
        require(
            bucket.CurrentYield <= bucket.MaxYield && amountToMint >= _amount,
            "cannot mint this many from this bucket"
        );

        _mint(msg.sender, _amount);


        bucket.AvailableCurrently = amountToMint - _amount;
        bucket.LastClaimTimestamp = uint80(block.timestamp);

        TokenClaimBuckets[_name] = bucket;
    }

    function getYield(
        IERC721 _contract,
        uint256 _id,
        address _operator
    ) private view returns (uint256) {
        address owner = _contract.ownerOf(_id);
        require(
            owner == _operator || _contract.isApprovedForAll(owner, _operator),
            "not eligible"
        );
        if (_contract == EXCLUSIVES_CONTRACT) {
            return getExclusivesYield(_id);
        } else {
            return getNftYield(_contract, _id);
        }
    }

    function getExclusivesYield(uint256 _id) public view returns (uint256) {
        uint256 lastClaim = (
            LastClaimedTimes[EXCLUSIVES_CONTRACT][_id] == 0
                ? EXCLUSIVES_START_TIME
                : LastClaimedTimes[EXCLUSIVES_CONTRACT][_id]
        );
        return
            (block.timestamp - lastClaim) *
            EXCLUSIVES_DAILY_YIELD[getExclusivesDailyYield(_id)];
    }

    function getNftYield(IERC721 _nft, uint256 _id)
        public
        view
        returns (uint256)
    {
        uint256 lastClaim = (
            LastClaimedTimes[_nft][_id] == 0
                ? FirstClaimTime[_nft] == 0
                    ? block.timestamp - (5 days - 1)
                    : FirstClaimTime[_nft]
                : LastClaimedTimes[_nft][_id]
        );
        return (block.timestamp - lastClaim) * NftContracts[_nft];
    }

    function getExclusivesDailyYield(uint256 _id)
        public
        view
        returns (uint256)
    {
        return unpackNumber(YIELD_MAP[_id / 85], _id % 85);
    }

    function unpackNumber(uint256 _packedNumbers, uint256 _position)
        private
        pure
        returns (uint256)
    {
        unchecked {
            uint256 number = (_packedNumbers >> (_position * 3)) &
                MAX_VALUE_3_BIT_INT;
            return number;
        }
    }

    modifier onlyTicketContract() {
        require(address(TierTwoItem) == msg.sender, "only ticket contract");
        _;
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"BaseUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CurrentMaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"HasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PublicMintingOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_proofs","type":"bytes32[]"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"claimLand","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"currentPhase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incrementPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_priceInWei","type":"uint256"}],"name":"setMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_mintingOpen","type":"bool"}],"name":"setPublicMintingOpen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"name":"setTempMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"setTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenContract","outputs":[{"internalType":"contract ILandMintUpdater","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526101f460085567013fbe85edc900006009553480156200002357600080fd5b506040518060400160405280601181526020017010dbdd5b9d1c9e4810db1d588813185b99607a1b815250604051806040016040528060048152602001631410d0d360e21b81525081600090816200007c9190620001a9565b5060016200008b8282620001a9565b505050620000a8620000a2620000ae60201b60201c565b620000b2565b62000275565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200012f57607f821691505b6020821081036200015057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001a457600081815260208120601f850160051c810160208610156200017f5750805b601f850160051c820191505b81811015620001a0578281556001016200018b565b5050505b505050565b81516001600160401b03811115620001c557620001c562000104565b620001dd81620001d684546200011a565b8462000156565b602080601f831160018114620002155760008415620001fc5750858301515b600019600386901b1c1916600185901b178555620001a0565b600085815260208120601f198616915b82811015620002465788860151825594840194600190910190840162000225565b5085821015620002655787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611d0e80620002856000396000f3fe60806040526004361061020f5760003560e01c80638da5cb5b11610118578063d26c3c48116100a0578063f2fde38b1161006f578063f2fde38b14610601578063f4a0a52814610621578063f4be1a9214610641578063fab583f214610661578063fdbf9ef21461067657600080fd5b8063d26c3c4814610581578063e21e011914610597578063e985e9c5146105b1578063f0292a03146105ec57600080fd5b8063a22cb465116100e7578063a22cb465146104e1578063b88d4fde14610501578063bbcd5bbe14610521578063c6465fb914610541578063c87b56dd1461056157600080fd5b80638da5cb5b1461047957806395d89b41146104975780639812eeda146104ac578063a0bcfc7f146104c157600080fd5b806332cb6b0c1161019b5780636352211e1161016a5780636352211e146103c957806370a08231146103e9578063715018a6146104095780637cb647591461041e5780638629b2001461043e57600080fd5b806332cb6b0c1461035e5780633ccfd60b1461037457806342842e0e1461038957806355a373d6146103a957600080fd5b8063081812fc116101e2578063081812fc146102a4578063095ea7b3146102f2578063132d3f6a1461031257806318160ddd1461032857806323b872dd1461033e57600080fd5b806301ffc9a714610214578063055ad42e1461024957806305c7dcc31461026d57806306fdde0314610282575b600080fd5b34801561022057600080fd5b5061023461022f366004611657565b61068c565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b5061025f600e5481565b604051908152602001610240565b61028061027b36600461168a565b6106de565b005b34801561028e57600080fd5b506102976109f4565b6040516102409190611772565b3480156102b057600080fd5b506102da6102bf3660046117a5565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610240565b3480156102fe57600080fd5b5061028061030d3660046117d5565b610a82565b34801561031e57600080fd5b5061025f600c5481565b34801561033457600080fd5b5061025f600b5481565b34801561034a57600080fd5b506102806103593660046117ff565b610b64565b34801561036a57600080fd5b5061025f61268081565b34801561038057600080fd5b50610280610d2b565b34801561039557600080fd5b506102806103a43660046117ff565b610d62565b3480156103b557600080fd5b50600f546102da906001600160a01b031681565b3480156103d557600080fd5b506102da6103e43660046117a5565b610e5a565b3480156103f557600080fd5b5061025f61040436600461183b565b610eb1565b34801561041557600080fd5b50610280610f14565b34801561042a57600080fd5b506102806104393660046117a5565b610f28565b34801561044a57600080fd5b506102346104593660046117d5565b600760209081526000928352604080842090915290825290205460ff1681565b34801561048557600080fd5b506006546001600160a01b03166102da565b3480156104a357600080fd5b50610297610f35565b3480156104b857600080fd5b50610280610f42565b3480156104cd57600080fd5b506102806104dc36600461189f565b610f55565b3480156104ed57600080fd5b506102806104fc3660046118f1565b610f6a565b34801561050d57600080fd5b5061028061051c366004611924565b610fd6565b34801561052d57600080fd5b5061028061053c36600461183b565b6110b7565b34801561054d57600080fd5b5061028061055c3660046117a5565b6110e1565b34801561056d57600080fd5b5061029761057c3660046117a5565b6111bb565b34801561058d57600080fd5b5061025f60085481565b3480156105a357600080fd5b50600d546102349060ff1681565b3480156105bd57600080fd5b506102346105cc366004611993565b600560209081526000928352604080842090915290825290205460ff1681565b3480156105f857600080fd5b5061025f601481565b34801561060d57600080fd5b5061028061061c36600461183b565b611241565b34801561062d57600080fd5b5061028061063c3660046117a5565b6112b7565b34801561064d57600080fd5b5061028061065c3660046119bd565b6112c4565b34801561066d57600080fd5b506102976112df565b34801561068257600080fd5b5061025f60095481565b60006301ffc9a760e01b6001600160e01b0319831614806106bd57506380ac58cd60e01b6001600160e01b03198316145b806106d85750635b5e139f60e01b6001600160e01b03198316145b92915050565b600d548290829060ff161561078157806009546106fb91906119ee565b34146107405760405162461bcd60e51b815260206004820152600f60248201526e34b731b7b93932b1ba1032ba3432b960891b60448201526064015b60405180910390fd5b601481111561077c5760405162461bcd60e51b8152602060048201526008602482015267746f6f206d616e7960c01b6044820152606401610737565b6108b1565b34156107b85760405162461bcd60e51b8152600401610737906020808252600490820152636672656560e01b604082015260600190565b6040516bffffffffffffffffffffffff193360601b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905061080583600c54836112ec565b6108425760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5cd95960921b6044820152606401610737565b336000908152600760209081526040808320600e54845290915290205460ff16156108af5760405162461bcd60e51b815260206004820181905260248201527f616c726561647920636c61696d65642066726f6d20746869732077616c6c65746044820152606401610737565b505b60085483600b546108c29190611a05565b106109015760405162461bcd60e51b815260206004820152600f60248201526e1d1bdbc81b585b9e481b5a5b9d1959608a1b6044820152606401610737565b3415801561092c5750336000908152600760209081526040808320600e54845290915290205460ff16155b1561095957336000908152600760209081526040808320600e5484529091529020805460ff191660011790555b60005b838110156109ed5761097033600b54611302565b600f54600b546040516340b76a9360e11b81526001600160a01b039092169163816ed526916109a59160040190815260200190565b600060405180830381600087803b1580156109bf57600080fd5b505af11580156109d3573d6000803e3d6000fd5b5050600b80546001908101909155909201915061095c9050565b5050505050565b60008054610a0190611a18565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2d90611a18565b8015610a7a5780601f10610a4f57610100808354040283529160200191610a7a565b820191906000526020600020905b815481529060010190602001808311610a5d57829003601f168201915b505050505081565b6000818152600260205260409020546001600160a01b031633811480610acb57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b610b085760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b6044820152606401610737565b60008281526004602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000818152600260205260409020546001600160a01b03848116911614610bba5760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b6044820152606401610737565b6001600160a01b038216610c045760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610737565b336001600160a01b0384161480610c3e57506001600160a01b038316600090815260056020908152604080832033845290915290205460ff165b80610c5f57506000818152600460205260409020546001600160a01b031633145b610c9c5760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b6044820152606401610737565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526002825284832080546001600160a01b03199081168317909155600490925284832080549092169091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610d3361140d565b60405133904780156108fc02916000818181858888f19350505050158015610d5f573d6000803e3d6000fd5b50565b610d6d838383610b64565b6001600160a01b0382163b1580610e165750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190611a52565b6001600160e01b031916145b610e555760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610737565b505050565b6000818152600260205260409020546001600160a01b031680610eac5760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b6044820152606401610737565b919050565b60006001600160a01b038216610ef85760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b6044820152606401610737565b506001600160a01b031660009081526003602052604090205490565b610f1c61140d565b610f266000611467565b565b610f3061140d565b600c55565b60018054610a0190611a18565b610f4a61140d565b600e80546001019055565b610f5d61140d565b600a610e55828483611abd565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610fe1858585610b64565b6001600160a01b0384163b15806110785750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a02906110299033908a90899089908990600401611b7d565b6020604051808303816000875af1158015611048573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106c9190611a52565b6001600160e01b031916145b6109ed5760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610737565b6110bf61140d565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6110e961140d565b600b5481116111505760405162461bcd60e51b815260206004820152602d60248201527f63616e6e6f742073657420737570706c7920746f206c657373207468616e206360448201526c757272656e7420737570706c7960981b6064820152608401610737565b6126808111156111b65760405162461bcd60e51b815260206004820152602b60248201527f63616e6e6f742073657420737570706c7920746f20686967686572207468616e60448201526a206d617820737570706c7960a81b6064820152608401610737565b600855565b6000818152600260205260409020546060906001600160a01b031661120f5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd081b5a5b9d195960b21b6044820152606401610737565b600a61121a836114b9565b60405160200161122b929190611bd1565b6040516020818303038152906040529050919050565b61124961140d565b6001600160a01b0381166112ae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610737565b610d5f81611467565b6112bf61140d565b600955565b6112cc61140d565b600d805460ff1916911515919091179055565b600a8054610a0190611a18565b6000826112f985846115c2565b14949350505050565b6001600160a01b03821661134c5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610737565b6000818152600260205260409020546001600160a01b0316156113a25760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b6044820152606401610737565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6006546001600160a01b03163314610f265760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610737565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060816000036114e05750506040805180820190915260018152600360fc1b602082015290565b8160005b811561150a57806114f481611c58565b91506115039050600a83611c87565b91506114e4565b60008167ffffffffffffffff81111561152557611525611674565b6040519080825280601f01601f19166020018201604052801561154f576020820181803683370190505b5090505b84156115ba57611564600183611c9b565b9150611571600a86611cae565b61157c906030611a05565b60f81b81838151811061159157611591611cc2565b60200101906001600160f81b031916908160001a9053506115b3600a86611c87565b9450611553565b949350505050565b600081815b8451811015611607576115f3828683815181106115e6576115e6611cc2565b602002602001015161160f565b9150806115ff81611c58565b9150506115c7565b509392505050565b600081831061162b57600082815260208490526040902061163a565b60008381526020839052604090205b9392505050565b6001600160e01b031981168114610d5f57600080fd5b60006020828403121561166957600080fd5b813561163a81611641565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561169d57600080fd5b823567ffffffffffffffff808211156116b557600080fd5b818501915085601f8301126116c957600080fd5b81356020828211156116dd576116dd611674565b8160051b604051601f19603f8301168101818110868211171561170257611702611674565b60405292835281830193508481018201928984111561172057600080fd5b948201945b8386101561173e57853585529482019493820193611725565b9997909101359750505050505050565b60005b83811015611769578181015183820152602001611751565b50506000910152565b602081526000825180602084015261179181604085016020870161174e565b601f01601f19169190910160400192915050565b6000602082840312156117b757600080fd5b5035919050565b80356001600160a01b0381168114610eac57600080fd5b600080604083850312156117e857600080fd5b6117f1836117be565b946020939093013593505050565b60008060006060848603121561181457600080fd5b61181d846117be565b925061182b602085016117be565b9150604084013590509250925092565b60006020828403121561184d57600080fd5b61163a826117be565b60008083601f84011261186857600080fd5b50813567ffffffffffffffff81111561188057600080fd5b60208301915083602082850101111561189857600080fd5b9250929050565b600080602083850312156118b257600080fd5b823567ffffffffffffffff8111156118c957600080fd5b6118d585828601611856565b90969095509350505050565b80358015158114610eac57600080fd5b6000806040838503121561190457600080fd5b61190d836117be565b915061191b602084016118e1565b90509250929050565b60008060008060006080868803121561193c57600080fd5b611945866117be565b9450611953602087016117be565b935060408601359250606086013567ffffffffffffffff81111561197657600080fd5b61198288828901611856565b969995985093965092949392505050565b600080604083850312156119a657600080fd5b6119af836117be565b915061191b602084016117be565b6000602082840312156119cf57600080fd5b61163a826118e1565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106d8576106d86119d8565b808201808211156106d8576106d86119d8565b600181811c90821680611a2c57607f821691505b602082108103611a4c57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a6457600080fd5b815161163a81611641565b601f821115610e5557600081815260208120601f850160051c81016020861015611a965750805b601f850160051c820191505b81811015611ab557828155600101611aa2565b505050505050565b67ffffffffffffffff831115611ad557611ad5611674565b611ae983611ae38354611a18565b83611a6f565b6000601f841160018114611b1d5760008515611b055750838201355b600019600387901b1c1916600186901b1783556109ed565b600083815260209020601f19861690835b82811015611b4e5786850135825560209485019460019092019101611b2e565b5086821015611b6b5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b6000808454611bdf81611a18565b60018281168015611bf75760018114611c0c57611c3b565b60ff1984168752821515830287019450611c3b565b8860005260208060002060005b85811015611c325781548a820152908401908201611c19565b50505082870194505b505050508351611c4f81836020880161174e565b01949350505050565b600060018201611c6a57611c6a6119d8565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c9657611c96611c71565b500490565b818103818111156106d8576106d86119d8565b600082611cbd57611cbd611c71565b500690565b634e487b7160e01b600052603260045260246000fdfea26469706673582212202be7b282a4313d4211c8b0b8b00915efd4a705443897132327a6399ea18d659e64736f6c63430008110033

Deployed Bytecode

0x60806040526004361061020f5760003560e01c80638da5cb5b11610118578063d26c3c48116100a0578063f2fde38b1161006f578063f2fde38b14610601578063f4a0a52814610621578063f4be1a9214610641578063fab583f214610661578063fdbf9ef21461067657600080fd5b8063d26c3c4814610581578063e21e011914610597578063e985e9c5146105b1578063f0292a03146105ec57600080fd5b8063a22cb465116100e7578063a22cb465146104e1578063b88d4fde14610501578063bbcd5bbe14610521578063c6465fb914610541578063c87b56dd1461056157600080fd5b80638da5cb5b1461047957806395d89b41146104975780639812eeda146104ac578063a0bcfc7f146104c157600080fd5b806332cb6b0c1161019b5780636352211e1161016a5780636352211e146103c957806370a08231146103e9578063715018a6146104095780637cb647591461041e5780638629b2001461043e57600080fd5b806332cb6b0c1461035e5780633ccfd60b1461037457806342842e0e1461038957806355a373d6146103a957600080fd5b8063081812fc116101e2578063081812fc146102a4578063095ea7b3146102f2578063132d3f6a1461031257806318160ddd1461032857806323b872dd1461033e57600080fd5b806301ffc9a714610214578063055ad42e1461024957806305c7dcc31461026d57806306fdde0314610282575b600080fd5b34801561022057600080fd5b5061023461022f366004611657565b61068c565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b5061025f600e5481565b604051908152602001610240565b61028061027b36600461168a565b6106de565b005b34801561028e57600080fd5b506102976109f4565b6040516102409190611772565b3480156102b057600080fd5b506102da6102bf3660046117a5565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610240565b3480156102fe57600080fd5b5061028061030d3660046117d5565b610a82565b34801561031e57600080fd5b5061025f600c5481565b34801561033457600080fd5b5061025f600b5481565b34801561034a57600080fd5b506102806103593660046117ff565b610b64565b34801561036a57600080fd5b5061025f61268081565b34801561038057600080fd5b50610280610d2b565b34801561039557600080fd5b506102806103a43660046117ff565b610d62565b3480156103b557600080fd5b50600f546102da906001600160a01b031681565b3480156103d557600080fd5b506102da6103e43660046117a5565b610e5a565b3480156103f557600080fd5b5061025f61040436600461183b565b610eb1565b34801561041557600080fd5b50610280610f14565b34801561042a57600080fd5b506102806104393660046117a5565b610f28565b34801561044a57600080fd5b506102346104593660046117d5565b600760209081526000928352604080842090915290825290205460ff1681565b34801561048557600080fd5b506006546001600160a01b03166102da565b3480156104a357600080fd5b50610297610f35565b3480156104b857600080fd5b50610280610f42565b3480156104cd57600080fd5b506102806104dc36600461189f565b610f55565b3480156104ed57600080fd5b506102806104fc3660046118f1565b610f6a565b34801561050d57600080fd5b5061028061051c366004611924565b610fd6565b34801561052d57600080fd5b5061028061053c36600461183b565b6110b7565b34801561054d57600080fd5b5061028061055c3660046117a5565b6110e1565b34801561056d57600080fd5b5061029761057c3660046117a5565b6111bb565b34801561058d57600080fd5b5061025f60085481565b3480156105a357600080fd5b50600d546102349060ff1681565b3480156105bd57600080fd5b506102346105cc366004611993565b600560209081526000928352604080842090915290825290205460ff1681565b3480156105f857600080fd5b5061025f601481565b34801561060d57600080fd5b5061028061061c36600461183b565b611241565b34801561062d57600080fd5b5061028061063c3660046117a5565b6112b7565b34801561064d57600080fd5b5061028061065c3660046119bd565b6112c4565b34801561066d57600080fd5b506102976112df565b34801561068257600080fd5b5061025f60095481565b60006301ffc9a760e01b6001600160e01b0319831614806106bd57506380ac58cd60e01b6001600160e01b03198316145b806106d85750635b5e139f60e01b6001600160e01b03198316145b92915050565b600d548290829060ff161561078157806009546106fb91906119ee565b34146107405760405162461bcd60e51b815260206004820152600f60248201526e34b731b7b93932b1ba1032ba3432b960891b60448201526064015b60405180910390fd5b601481111561077c5760405162461bcd60e51b8152602060048201526008602482015267746f6f206d616e7960c01b6044820152606401610737565b6108b1565b34156107b85760405162461bcd60e51b8152600401610737906020808252600490820152636672656560e01b604082015260600190565b6040516bffffffffffffffffffffffff193360601b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905061080583600c54836112ec565b6108425760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5cd95960921b6044820152606401610737565b336000908152600760209081526040808320600e54845290915290205460ff16156108af5760405162461bcd60e51b815260206004820181905260248201527f616c726561647920636c61696d65642066726f6d20746869732077616c6c65746044820152606401610737565b505b60085483600b546108c29190611a05565b106109015760405162461bcd60e51b815260206004820152600f60248201526e1d1bdbc81b585b9e481b5a5b9d1959608a1b6044820152606401610737565b3415801561092c5750336000908152600760209081526040808320600e54845290915290205460ff16155b1561095957336000908152600760209081526040808320600e5484529091529020805460ff191660011790555b60005b838110156109ed5761097033600b54611302565b600f54600b546040516340b76a9360e11b81526001600160a01b039092169163816ed526916109a59160040190815260200190565b600060405180830381600087803b1580156109bf57600080fd5b505af11580156109d3573d6000803e3d6000fd5b5050600b80546001908101909155909201915061095c9050565b5050505050565b60008054610a0190611a18565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2d90611a18565b8015610a7a5780601f10610a4f57610100808354040283529160200191610a7a565b820191906000526020600020905b815481529060010190602001808311610a5d57829003601f168201915b505050505081565b6000818152600260205260409020546001600160a01b031633811480610acb57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b610b085760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b6044820152606401610737565b60008281526004602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000818152600260205260409020546001600160a01b03848116911614610bba5760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b6044820152606401610737565b6001600160a01b038216610c045760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610737565b336001600160a01b0384161480610c3e57506001600160a01b038316600090815260056020908152604080832033845290915290205460ff165b80610c5f57506000818152600460205260409020546001600160a01b031633145b610c9c5760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b6044820152606401610737565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526002825284832080546001600160a01b03199081168317909155600490925284832080549092169091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610d3361140d565b60405133904780156108fc02916000818181858888f19350505050158015610d5f573d6000803e3d6000fd5b50565b610d6d838383610b64565b6001600160a01b0382163b1580610e165750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190611a52565b6001600160e01b031916145b610e555760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610737565b505050565b6000818152600260205260409020546001600160a01b031680610eac5760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b6044820152606401610737565b919050565b60006001600160a01b038216610ef85760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b6044820152606401610737565b506001600160a01b031660009081526003602052604090205490565b610f1c61140d565b610f266000611467565b565b610f3061140d565b600c55565b60018054610a0190611a18565b610f4a61140d565b600e80546001019055565b610f5d61140d565b600a610e55828483611abd565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610fe1858585610b64565b6001600160a01b0384163b15806110785750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a02906110299033908a90899089908990600401611b7d565b6020604051808303816000875af1158015611048573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106c9190611a52565b6001600160e01b031916145b6109ed5760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610737565b6110bf61140d565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6110e961140d565b600b5481116111505760405162461bcd60e51b815260206004820152602d60248201527f63616e6e6f742073657420737570706c7920746f206c657373207468616e206360448201526c757272656e7420737570706c7960981b6064820152608401610737565b6126808111156111b65760405162461bcd60e51b815260206004820152602b60248201527f63616e6e6f742073657420737570706c7920746f20686967686572207468616e60448201526a206d617820737570706c7960a81b6064820152608401610737565b600855565b6000818152600260205260409020546060906001600160a01b031661120f5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd081b5a5b9d195960b21b6044820152606401610737565b600a61121a836114b9565b60405160200161122b929190611bd1565b6040516020818303038152906040529050919050565b61124961140d565b6001600160a01b0381166112ae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610737565b610d5f81611467565b6112bf61140d565b600955565b6112cc61140d565b600d805460ff1916911515919091179055565b600a8054610a0190611a18565b6000826112f985846115c2565b14949350505050565b6001600160a01b03821661134c5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610737565b6000818152600260205260409020546001600160a01b0316156113a25760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b6044820152606401610737565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6006546001600160a01b03163314610f265760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610737565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060816000036114e05750506040805180820190915260018152600360fc1b602082015290565b8160005b811561150a57806114f481611c58565b91506115039050600a83611c87565b91506114e4565b60008167ffffffffffffffff81111561152557611525611674565b6040519080825280601f01601f19166020018201604052801561154f576020820181803683370190505b5090505b84156115ba57611564600183611c9b565b9150611571600a86611cae565b61157c906030611a05565b60f81b81838151811061159157611591611cc2565b60200101906001600160f81b031916908160001a9053506115b3600a86611c87565b9450611553565b949350505050565b600081815b8451811015611607576115f3828683815181106115e6576115e6611cc2565b602002602001015161160f565b9150806115ff81611c58565b9150506115c7565b509392505050565b600081831061162b57600082815260208490526040902061163a565b60008381526020839052604090205b9392505050565b6001600160e01b031981168114610d5f57600080fd5b60006020828403121561166957600080fd5b813561163a81611641565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561169d57600080fd5b823567ffffffffffffffff808211156116b557600080fd5b818501915085601f8301126116c957600080fd5b81356020828211156116dd576116dd611674565b8160051b604051601f19603f8301168101818110868211171561170257611702611674565b60405292835281830193508481018201928984111561172057600080fd5b948201945b8386101561173e57853585529482019493820193611725565b9997909101359750505050505050565b60005b83811015611769578181015183820152602001611751565b50506000910152565b602081526000825180602084015261179181604085016020870161174e565b601f01601f19169190910160400192915050565b6000602082840312156117b757600080fd5b5035919050565b80356001600160a01b0381168114610eac57600080fd5b600080604083850312156117e857600080fd5b6117f1836117be565b946020939093013593505050565b60008060006060848603121561181457600080fd5b61181d846117be565b925061182b602085016117be565b9150604084013590509250925092565b60006020828403121561184d57600080fd5b61163a826117be565b60008083601f84011261186857600080fd5b50813567ffffffffffffffff81111561188057600080fd5b60208301915083602082850101111561189857600080fd5b9250929050565b600080602083850312156118b257600080fd5b823567ffffffffffffffff8111156118c957600080fd5b6118d585828601611856565b90969095509350505050565b80358015158114610eac57600080fd5b6000806040838503121561190457600080fd5b61190d836117be565b915061191b602084016118e1565b90509250929050565b60008060008060006080868803121561193c57600080fd5b611945866117be565b9450611953602087016117be565b935060408601359250606086013567ffffffffffffffff81111561197657600080fd5b61198288828901611856565b969995985093965092949392505050565b600080604083850312156119a657600080fd5b6119af836117be565b915061191b602084016117be565b6000602082840312156119cf57600080fd5b61163a826118e1565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106d8576106d86119d8565b808201808211156106d8576106d86119d8565b600181811c90821680611a2c57607f821691505b602082108103611a4c57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a6457600080fd5b815161163a81611641565b601f821115610e5557600081815260208120601f850160051c81016020861015611a965750805b601f850160051c820191505b81811015611ab557828155600101611aa2565b505050505050565b67ffffffffffffffff831115611ad557611ad5611674565b611ae983611ae38354611a18565b83611a6f565b6000601f841160018114611b1d5760008515611b055750838201355b600019600387901b1c1916600186901b1783556109ed565b600083815260209020601f19861690835b82811015611b4e5786850135825560209485019460019092019101611b2e565b5086821015611b6b5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b6000808454611bdf81611a18565b60018281168015611bf75760018114611c0c57611c3b565b60ff1984168752821515830287019450611c3b565b8860005260208060002060005b85811015611c325781548a820152908401908201611c19565b50505082870194505b505050508351611c4f81836020880161174e565b01949350505050565b600060018201611c6a57611c6a6119d8565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c9657611c96611c71565b500490565b818103818111156106d8576106d86119d8565b600082611cbd57611cbd611c71565b500690565b634e487b7160e01b600052603260045260246000fdfea26469706673582212202be7b282a4313d4211c8b0b8b00915efd4a705443897132327a6399ea18d659e64736f6c63430008110033

Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.