ETH Price: $3,390.98 (+1.54%)

Token

YARN (PCC Yarn)
 

Overview

Max Total Supply

5,544,467.978055527394218996 PCC Yarn

Holders

424

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Filtered by Token Holder
digga.eth
Balance
1,898 PCC Yarn

Value
$0.00
0x461ae8c33224aceb7f1259095dd2a334ad20f322
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:
PccToken

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 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");
        _;
    }
}

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 : 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 16 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 17 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);
	}

}

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":[{"internalType":"contract PccLand","name":"_land","type":"address"},{"internalType":"contract PccTierTwoItem","name":"_ticket","type":"address"},{"internalType":"contract PccTierTwo","name":"_tierTwo","type":"address"},{"internalType":"contract IERC721","name":"_nft1","type":"address"},{"internalType":"contract IERC721","name":"_nft2","type":"address"},{"internalType":"contract IERC721","name":"_nft3","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"_name","type":"string"},{"indexed":false,"internalType":"uint256","name":"_dailyYield","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_maxYield","type":"uint256"}],"name":"AddedClaimBucket","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","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":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ClaimedAirdrop","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXCLUSIVES_CONTRACT","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"EXCLUSIVES_DAILY_YIELD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXCLUSIVES_START_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"name":"FirstClaimTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"LastClaimedTimes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"name":"NftContracts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECOND_RATE_FOR_ONE_PER_DAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TierTwo","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TierTwoItem","outputs":[{"internalType":"contract PccTierTwoItem","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"TokenClaimBuckets","outputs":[{"internalType":"uint256","name":"AvailableCurrently","type":"uint256"},{"internalType":"uint256","name":"DailyYield","type":"uint256"},{"internalType":"uint256","name":"MaxYield","type":"uint256"},{"internalType":"uint256","name":"CurrentYield","type":"uint256"},{"internalType":"uint256","name":"LastClaimTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"YIELD_MAP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"availableFromBucket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"bucketMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"claimCommunitityAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721[]","name":"_contracts","type":"address[]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IERC721[]","name":"_contracts","type":"address[]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"currentTokenToClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getExclusivesDailyYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getExclusivesYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getNftYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"landContract","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"packedNumbers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"payForTierTwoItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"test","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"updateLandMintingTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"updateTierTwoMintingTime","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610fe06040527e484500000402400012004800880004020000100000004002000102000000006101209081527b40200200040009000000200040000040008008001000000240009010610140527f120100001840004801000000004020000004200160220040004800024000a000610160527f02002002002000000002000010000000010002c0008000000240048208008000610180527d2012000000084406000092010800102000080400400000004090002000406101a0527e010000000410010800400020400000004000810000400000c00400000080016101c0527f20080000002002400000080000012000194002084080830482800000080000006101e0527c04000000010000002100000010000010000000400000000c0000010040610200527b08202040000040000011400000002200040000000008040040010000610220527c0400040008049000048400002200240049081048080000040200800000610240527e18048000040208001400280000000048000400000408000010008208203200610260527f0200041000001000200043000080051009200002000000001040000001000040610280527c020020100100004000904040024020a0012080400402000800402000086102a0527f12002010010010002002010082004000020002080400004000002000400400016102c0527f10000080400512010400080090000000002400000090000506090100090000026102e0527f0400001000000040040041403200010440200200040008248000248000000000610300527e1800040104040a20800800924024004000120960004004000b001001040400610320527e080430080400400080082002012000000000400c0200211000000000000000610340527e40200249008000008400000048001000000200600200000000240001201211610360527f0201440001000000008009201042290080000000000208280000049000041000610380527f20410100082010082094400010412006090000002090010000000022010012086103a0527e112002090080000010800400000082402402082402000400000400402400406103c0527a4010014000480000410010014080810002800100000100490000086103e0527f100000a0000004400002800000000000002000c1040000040209000241000240610400527d2480000000c8008000200000000248000008240010008000240000008000610420527f1640000008001041000088008009010240050010000048008001001241200010610440527f104100000000004a000008208000200210009210001001000201000080048001610460527f0400001049000440248008000080000000200001040001002200280008001402610480527b090802010012010400402010002000002800000010400000000500406104a0527e082010080002010000000010020000080004480012400000012082400000406104c0527f10010480090400010400400080030010202000012000012000402000000000026104e0527d208000240010001041000249008018000008000000008680201048008008610500527e40000000008000088401000088040041209040002041080200209010210401610520527f208000120120800a201209040000008001408240000008041000008040000040610540527f2210000001243008200200240001040041008200240040200000609002000000610560527f01080c120120900820040024204a00004100000020000000904900a202200000610580527f020100800000100001900140008000120104100004820800024400a0100040006105a0527b4808028004000220000a0080000080800000402000090416182000006105c0527b400010000000000000400880000080420420c80010502012402002006105e0527e400000c0000200008442000040048009200041218001001008000040002008610600527f0201088200048008000608000000208200210240088000200049048201000281610620527e404000000000400402080000000080080c1000041000080008000041000000610640527f1001000048000000000000000000000041208200040041000000000000040002610660527e430010010006000020000080400810502000000400c8001000000200001000610680527e010400002800000000100000010000000022480000000000012000000000486106a0527f20000000080402012010000000810000020000402010000010080480030002006106c0527e400020900080480022880010000110c00002012400406000180000002082086106e0527d050208002040048010001040011001010001600001008040000200208000610700527f0200001080040208082000088001040240001000001201241040000209040000610720527f200840820b200000000000048000000001001040001040600203060008008000610740527c8042000201200243200000000001000000000000400000048050010000610760527f040004820000000004000004000000001a00a000240008001001410088280001610780527d0802080410000400000014010000020410000000000002002010000080016107a0527f02002014410002010492482080010080010080000004400000000000000020406107c0527e482000004480010000104000000422020000090400000002180000020414496107e0527f1400000000408000281000000400008200000001408001241001001000000000610800527e50040000000400000001048010000002008040010000001000408018000088610820527b080012c9000000000041001008000200000200010008011001080200610840527e40210002000001000081000200000401000080000049002200000008040400610860527e01000000000000202000001240049280000040200240289280000003200240610880527b802400000006c00c00812000110500000010090492022000000080006108a0527f10000000420020400002012002410024000802002002000002000000082094086108c0527e012080000010102000000402402002080010014400000090000082512180006108e0527e02040003000000200011409010280040040000000000240201048000042040610900527e020412410000000400014080000080010480000000022080002c0000008208610920527f0208200400000090240000000040080200000000000240000208201000040000610940527f0200080003008003041001040040200040202040448000008000200249212001610960527f2001240000201040000008200411000000012000000008009240050800000001610980527f10020000110000026002012002000000010002000000402002410800000400096109a0527e0a0010402002000090584010110012404000080480482080400800002480086109c0527d20200004020000000140028040a0000000480900420400000004010010406109e0527e08000601000001000001000040008000000281008202009040202040008008610a00527f1000041000000000000000208008208000000200208008208080011400400040610a20527e09210040200008001000000440000000040040000040240000001000088048610a40527e0820a040040208280000200200008211000001048000000200000409840200610a60527f02c904100000a240209040008001002040200008400240209200600080448200610a80527f14000010004410c1040000409051248400000080000000040000200000058041610aa0527e09000049000010000002000201041000408000011000088040008000300248610ac0527c8008000208040001000003001000080048400000000240201000001000610ae0527f024100120a20004001100000000120a200042000440009008009000200002041610b00527e4200004104101900000100040800000104000144a008010200000001000001610b20527f200004004804a000040000000048000002000001000003008000001240000080610b40527b080000080410480000010400000410092000c0200000000008208600610b60527d040000408000000208200202041000240080008208000001002000008001610b80527d040090000209200010000000008000081000240041040000000002201000610ba0527f024000120000000100000100020100a00000000000020a640209000000200009610bc0527a2400000402082000020000c8200200000201240000000000208040610be0527f0200008000001000000010018402008040040000208040040001090000000000610c00527f0201000240010002000000290010458040000008049241000002000088201200610c20527e0100020000000100824000004000800a0002004082010000000000080c0048610c40527f200004000000b000201002048000040081041000240018040000000000000000610c60527e480406020080000084012090480400020000000004004000c0000288240000610c80527f100000944200000000a080400200001008210000000000040208200040008000610ca0527f0241000241280000040010240000000200000450003000049000001010009040610cc0527f100a0004020420100000000002000010080120490c8000200000241008200248610ce0527f020000000140200001008200840000105044040220900100800100020000a081610d00527f2000000000001008008000000001001000040240008040040040211089082201610d20527d018000048200040040001000048082009080201000000040000040000000610d40527e0100008004108000000800020100000000040200a2000000432c0000040210610d60527f0201000281009048009209040008001000001000000040000281080008040001610d80527c8001240040200000040440088000008049000040080040040008001009610da0527e01200000000000000409000000000200200088000040200008000280000000610dc0527f024000800804000020a048200000000208000040000080083209008400440200610de0527e43011240008480008000000410042041400241000048000400018080008040610e00527f1010211040048040001040201050000201000040000000000000000001040000610e20527e08001001200001040000048200048000002000008209000200488010000001610e40527d24004108000900000000004820000800000100800a288048200000400200610e60527f1241051040010280408000040040000200008000201080000001009400000000610e80527f2001000000010080249008600200200040001209200080000040010200208242610ea0527e40000240000040009201003080000001010008040600002008000200000241610ec0527e08208040040040000002049040003008080000002288241009440090008049610ee0527e44010000000000202209000010000200200211008208600008001001000010610f00527d409240200000000011201008000450040000400000008000040008000040610f20527e40200008200208000040019000041048200208201008040200000040048041610f40527f1000000009001000400048200001000009011001000000040001040010000000610f60527f024000041108004000120000000220000240000000100960000000000a040080610f80527f0201000010208000001000000008000000000000003001001400208208040040610fa0527203000000001049001000200000249000000000610fc052620010a190600790607662001612565b506040518060a00160405280650a86cc92e3da6005620010c29190620016a9565b8152602001620010da650a86cc92e3da600a620016a9565b8152602001620010f2650a86cc92e3da6019620016a9565b81526020016200110a650a86cc92e3da6032620016a9565b815260200162001122650a86cc92e3da6064620016a9565b90526200113490600e90600562001662565b503480156200114257600080fd5b5060405162003cba38038062003cba8339810160408190526200116591620016ee565b604051806040016040528060048152602001632ca0a92760e11b815250604051806040016040528060088152602001672821a1902cb0b93760c11b81525060128260009081620011b6919062001827565b506001620011c5838262001827565b5060ff81166080524660a052620011db62001352565b60c05250620011ee9150339050620013ee565b600980546001600160a01b038088166001600160a01b031992831617909255739e8a92f833c0ae4842574ce9cc0ef4c7300ddb1260e05287821661010052600a805487841692169190911790554260138190558482166000908152601860205260408082208390558584168252808220839055928416815291909120556200127884600562001440565b610100516200128990600562001440565b604080518082019091526008815267656d706c6f79656560c01b6020820152620012d6906a067dbba2cc371efc4000006902be902146fa268000006a412f40285de5b80724000062001530565b6040805180820190915260048152637465616d60e01b60208201526200131f906a0d6166b79446e31e000000690afa40851be89a0000006af8277896582678ac00000062001530565b6200132c83600a62001440565b6200133982600162001440565b6200134681600162001440565b505050505050620019a2565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620013869190620018f3565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03821660009081526016602052604090205415620014a15760405162461bcd60e51b8152602060048201526012602482015271191d5c1b1a58d85d194818dbdb9d1c9858dd60721b60448201526064015b60405180910390fd5b600b81108015620014b25750600081115b620014f55760405162461bcd60e51b81526020600482015260126024820152717969656c64206f7574206f662072616e676560701b604482015260640162001498565b60148054600101905562001510650a86cc92e3da82620016a9565b6001600160a01b0390921660009081526016602052604090209190915550565b60006040518060a0016040528085815260200184815260200183815260200160008152602001426001600160501b0316815250905080600c8660405162001578919062001971565b9081526020016040518091039020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015590505084604051620015cb919062001971565b6040805191829003822085835260208301859052917fc76b091b4d5a8459cb4ad1bcc70971f466906ed3801657bade6beda8aa8c4d49910160405180910390a25050505050565b82805482825590600052602060002090810192821562001650579160200282015b828111156200165057825182559160200191906001019062001633565b506200165e92915062001692565b5090565b82600581019282156200165057916020028201828111156200165057825182559160200191906001019062001633565b5b808211156200165e576000815560010162001693565b8082028115828204841417620016cf57634e487b7160e01b600052601160045260246000fd5b92915050565b6001600160a01b0381168114620016eb57600080fd5b50565b60008060008060008060c087890312156200170857600080fd5b86516200171581620016d5565b60208801519096506200172881620016d5565b60408801519095506200173b81620016d5565b60608801519094506200174e81620016d5565b60808801519093506200176181620016d5565b60a08801519092506200177481620016d5565b809150509295509295509295565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620017ad57607f821691505b602082108103620017ce57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200182257600081815260208120601f850160051c81016020861015620017fd5750805b601f850160051c820191505b818110156200181e5782815560010162001809565b5050505b505050565b81516001600160401b0381111562001843576200184362001782565b6200185b8162001854845462001798565b84620017d4565b602080601f8311600181146200189357600084156200187a5750858301515b600019600386901b1c1916600185901b1785556200181e565b600085815260208120601f198616915b82811015620018c457888601518255948401946001909101908401620018a3565b5085821015620018e35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354620019038162001798565b600182811680156200191e5760018114620019345762001965565b60ff198416875282151583028701945062001965565b8760005260208060002060005b858110156200195c5781548a82015290840190820162001941565b50505082870194505b50929695505050505050565b6000825160005b8181101562001994576020818601810151858301520162001978565b506000920191825250919050565b60805160a05160c05160e051610100516122b062001a0a6000396000818161027e0152818161106c01526110bc0152600081816104d401528181610c8301528181610cce015261191701526000610c5701526000610c22015260006103ae01526122b06000f3fe608060405234801561001057600080fd5b50600436106102745760003560e01c8063816ed52611610151578063c0e59d2f116100c3578063d505accf11610087578063d505accf1461063d578063dd62ed3e14610650578063ec4f67f91461067b578063f0bc1dd71461068e578063f2fde38b146106b1578063fb883874146106c457600080fd5b8063c0e59d2f146105c3578063cb1374a2146105ee578063cbfb8b2f14610601578063cc49da1314610614578063d2191df11461061d57600080fd5b806395d89b411161011557806395d89b41146105095780639a733448146105115780639dc29fac14610524578063a2cba22514610537578063a9059cbb146105a7578063b7c34384146105ba57600080fd5b8063816ed5261461048b578063836ff3661461049e5780638da5cb5b146104be5780638f388d05146104cf57806390f3c83c146104f657600080fd5b80632ce120fe116101ea578063475573b6116101ae578063475573b61461041057806362590c7b1461041d57806370a0823114610430578063715018a6146104505780637cb64759146104585780637ecebe001461046b57600080fd5b80632ce120fe14610396578063313ce567146103a95780633644e515146103e25780633d6b9df4146103ea57806344fa46fe146103fd57600080fd5b8063132d3f6a1161023c578063132d3f6a1461032b57806318160ddd1461033457806321a4dac41461033d57806323b872dd1461035057806329e99f07146103635780632a3de6461461038357600080fd5b806303d073401461027957806306fdde03146102bd578063095ea7b3146102d25780630b70f42f146102f55780630bfd60b814610316575b600080fd5b6102a07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6102c56106d7565b6040516102b49190611b8a565b6102e56102e0366004611bed565b610765565b60405190151581526020016102b4565b610308610303366004611c19565b6107d2565b6040519081526020016102b4565b610329610324366004611c7e565b61081c565b005b610308600b5481565b61030860025481565b61030861034b366004611cca565b61095d565b6102e561035e366004611d4d565b610a14565b610308610371366004611c19565b60156020526000908152604090205481565b600a546102a0906001600160a01b031681565b6103086103a4366004611dd0565b610af6565b6103d07f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016102b4565b610308610c1e565b6103086103f8366004611c19565b610c79565b61032961040b366004611bed565b610d44565b610308650a86cc92e3da81565b61032961042b366004611e12565b610e4c565b61030861043e366004611e4a565b60036020526000908152604090205481565b610329611049565b610329610466366004611c19565b61105d565b610308610479366004611e4a565b60056020526000908152604090205481565b610329610499366004611c19565b61106a565b6103086104ac366004611e4a565b60166020526000908152604090205481565b6006546001600160a01b03166102a0565b6102a07f000000000000000000000000000000000000000000000000000000000000000081565b610329610504366004611c19565b6110f9565b6102c561114c565b61030861051f366004611bed565b611159565b610329610532366004611bed565b611226565b61057f610545366004611e7d565b8051602081830181018051600c82529282019190930120915280546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102b4565b6102e56105b5366004611bed565b611285565b61030860135481565b6103086105d1366004611bed565b601760209081526000928352604080842090915290825290205481565b6103296105fc366004611f2e565b6112eb565b6009546102a0906001600160a01b031681565b61030860085481565b61030861062b366004611e4a565b60186020526000908152604090205481565b61032961064b366004611f9a565b611478565b61030861065e366004612011565b600460209081526000928352604080842090915290825290205481565b610308610689366004611c19565b6116bc565b6102e561069c366004611e4a565b600d6020526000908152604090205460ff1681565b6103296106bf366004611e4a565b6116dd565b6103086106d2366004611c19565b611756565b600080546106e49061204a565b80601f01602080910402602001604051908101604052809291908181526020018280546107109061204a565b801561075d5780601f106107325761010080835404028352916020019161075d565b820191906000526020600020905b81548152906001019060200180831161074057829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107c09086815260200190565b60405180910390a35060015b92915050565b60006107cc60076107e46055856120b0565b815481106107f4576107f46120c4565b906000526020600020015460558461080c91906120da565b6003810282901c60071692915050565b6040516bffffffffffffffffffffffff193360601b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905061089d84848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600b54915084905061176d565b6108c25760405162461bcd60e51b81526004016108b9906120ee565b60405180910390fd5b336000908152600d602052604090205460ff16156109225760405162461bcd60e51b815260206004820152601760248201527f616c726561647920636c61696d65642061697264726f7000000000000000000060448201526064016108b9565b336000818152600d60205260409020805460ff191660011790556109579061095284670de0b6b3a7640000612116565b611783565b50505050565b6000838281146109a75760405162461bcd60e51b8152602060048201526015602482015274696e76616c6964206172726179206c656e6774687360581b60448201526064016108b9565b6000805b82811015610a08576109fc8888838181106109c8576109c86120c4565b90506020020160208101906109dd9190611e4a565b8787848181106109ef576109ef6120c4565b905060200201358b6117dd565b909101906001016109ab565b50979650505050505050565b6001600160a01b03831660009081526004602090815260408083203384529091528120546000198114610a7057610a4b838261212d565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b03851660009081526003602052604081208054859290610a9890849061212d565b90915550506001600160a01b038085166000818152600360205260409081902080548701905551909187169060008051602061225b83398151915290610ae19087815260200190565b60405180910390a360019150505b9392505050565b600080600c8484604051610b0b929190612140565b90815260200160405180910390206040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505090506000816080015111610ba45760405162461bcd60e51b8152602060048201526015602482015274189d58dad95d08191bd95cc81b9bdd08195e1a5cdd605a1b60448201526064016108b9565b80516020820151610bb99062015180906120b0565b6080830151610bc8904261212d565b610bd29190612116565b610bdc9082612150565b90508160400151818360600151610bf39190612150565b1115610c165781606001518260400151610c0d919061212d565b925050506107cc565b949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610c5457610c4f611969565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152601760209081526040808320848452909152812054819015610d0d576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152601760209081526040808320868452909152902054610d11565b6013545b9050600e610d1e846107d2565b60058110610d2e57610d2e6120c4565b0154610d3a824261212d565b610aef9190612116565b6009546001600160a01b0316338114610d6f5760405162461bcd60e51b81526004016108b9906120ee565b6001600160a01b038316600090815260036020526040902054821115610dce5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016108b9565b6001600160a01b03831660009081526003602052604081208054849290610df690849061212d565b90915550506001600160a01b038082166000818152600360205260409081902080548601905551909185169060008051602061225b83398151915290610e3f9086815260200190565b60405180910390a3505050565b610e54611a03565b6000600c8484604051610e68929190612140565b90815260200160405180910390206040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505090506000816080015111610f015760405162461bcd60e51b8152602060048201526015602482015274189d58dad95d08191bd95cc81b9bdd08195e1a5cdd605a1b60448201526064016108b9565b80516080820151600090610f15904261212d565b9050620151808360200151610f2a91906120b0565b610f349082612116565b610f3e9083612150565b91508383606001818151610f529190612150565b9052506040830151606084015111801590610f6d5750838210155b610fc85760405162461bcd60e51b815260206004820152602660248201527f63616e6e6f74206d696e742074686973206d616e792066726f6d207468697320604482015265189d58dad95d60d21b60648201526084016108b9565b610fd23385611783565b610fdc848361212d565b835269ffffffffffffffffffff421660808401526040518390600c906110059089908990612140565b908152604080516020928190038301902083518155918301516001830155820151600282015560608201516003820155608090910151600490910155505050505050565b611051611a03565b61105b6000611a5d565b565b611065611a03565b600b55565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146110b25760405162461bcd60e51b81526004016108b9906120ee565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016600090815260176020908152604080832093835292905220429055565b600a546001600160a01b031633146111235760405162461bcd60e51b81526004016108b9906120ee565b600a546001600160a01b0316600090815260176020908152604080832093835292905220429055565b600180546106e49061204a565b6001600160a01b03821660009081526017602090815260408083208484529091528120548190156111ad576001600160a01b03841660009081526017602090815260408083208684529091529020546111f6565b6001600160a01b038416600090815260186020526040902054156111e9576001600160a01b0384166000908152601860205260409020546111f6565b6111f66206977f4261212d565b6001600160a01b03851660009081526016602052604090205490915061121c824261212d565b610c169190612116565b6009546001600160a01b031633146112775760405162461bcd60e51b81526020600482015260146024820152731bdb9b1e481d1a58dad95d0818dbdb9d1c9858dd60621b60448201526064016108b9565b6112818282611aaf565b5050565b336000908152600360205260408120805483919083906112a690849061212d565b90915550506001600160a01b0383166000818152600360205260409081902080548501905551339060008051602061225b833981519152906107c09086815260200190565b828181146113335760405162461bcd60e51b8152602060048201526015602482015274696e76616c6964206172726179206c656e6774687360581b60448201526064016108b9565b6000805b8281101561141657611388878783818110611354576113546120c4565b90506020020160208101906113699190611e4a565b86868481811061137b5761137b6120c4565b90506020020135336117dd565b6113929083612150565b915042601760008989858181106113ab576113ab6120c4565b90506020020160208101906113c09190611e4a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008787858181106113f4576113f46120c4565b6020908102929092013583525081019190915260400160002055600101611337565b506114213382611783565b6b06765c793fa10079d0000000600254106114705760405162461bcd60e51b815260206004820152600f60248201526e072656163686564206d61782063617608c1b60448201526064016108b9565b505050505050565b428410156114c85760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016108b9565b600060016114d4610c1e565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa1580156115e0573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906116165750876001600160a01b0316816001600160a01b0316145b6116535760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016108b9565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600781815481106116cc57600080fd5b600091825260209091200154905081565b6116e5611a03565b6001600160a01b03811661174a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108b9565b61175381611a5d565b50565b600e816005811061176657600080fd5b0154905081565b60008261177a8584611b11565b14949350505050565b80600260008282546117959190612150565b90915550506001600160a01b03821660008181526003602090815260408083208054860190555184815260008051602061225b83398151915291015b60405180910390a35050565b6040516331a9108f60e11b81526004810183905260009081906001600160a01b03861690636352211e90602401602060405180830381865afa158015611827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184b9190612163565b9050826001600160a01b0316816001600160a01b031614806118da575060405163e985e9c560e01b81526001600160a01b038281166004830152848116602483015286169063e985e9c590604401602060405180830381865afa1580156118b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118da9190612180565b6119155760405162461bcd60e51b815260206004820152600c60248201526b6e6f7420656c696769626c6560a01b60448201526064016108b9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b03160361195f5761195784610c79565b915050610aef565b6119578585611159565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600060405161199b91906121a2565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6006546001600160a01b0316331461105b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108b9565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03821660009081526003602052604081208054839290611ad790849061212d565b90915550506002805482900390556040518181526000906001600160a01b0384169060008051602061225b833981519152906020016117d1565b600081815b8451811015611b5657611b4282868381518110611b3557611b356120c4565b6020026020010151611b5e565b915080611b4e81612241565b915050611b16565b509392505050565b6000818310611b7a576000828152602084905260409020610aef565b5060009182526020526040902090565b600060208083528351808285015260005b81811015611bb757858101830151858201604001528201611b9b565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461175357600080fd5b60008060408385031215611c0057600080fd5b8235611c0b81611bd8565b946020939093013593505050565b600060208284031215611c2b57600080fd5b5035919050565b60008083601f840112611c4457600080fd5b50813567ffffffffffffffff811115611c5c57600080fd5b6020830191508360208260051b8501011115611c7757600080fd5b9250929050565b600080600060408486031215611c9357600080fd5b833567ffffffffffffffff811115611caa57600080fd5b611cb686828701611c32565b909790965060209590950135949350505050565b600080600080600060608688031215611ce257600080fd5b8535611ced81611bd8565b9450602086013567ffffffffffffffff80821115611d0a57600080fd5b611d1689838a01611c32565b90965094506040880135915080821115611d2f57600080fd5b50611d3c88828901611c32565b969995985093965092949392505050565b600080600060608486031215611d6257600080fd5b8335611d6d81611bd8565b92506020840135611d7d81611bd8565b929592945050506040919091013590565b60008083601f840112611da057600080fd5b50813567ffffffffffffffff811115611db857600080fd5b602083019150836020828501011115611c7757600080fd5b60008060208385031215611de357600080fd5b823567ffffffffffffffff811115611dfa57600080fd5b611e0685828601611d8e565b90969095509350505050565b600080600060408486031215611e2757600080fd5b833567ffffffffffffffff811115611e3e57600080fd5b611cb686828701611d8e565b600060208284031215611e5c57600080fd5b8135610aef81611bd8565b634e487b7160e01b600052604160045260246000fd5b600060208284031215611e8f57600080fd5b813567ffffffffffffffff80821115611ea757600080fd5b818401915084601f830112611ebb57600080fd5b813581811115611ecd57611ecd611e67565b604051601f8201601f19908116603f01168101908382118183101715611ef557611ef5611e67565b81604052828152876020848701011115611f0e57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008060008060408587031215611f4457600080fd5b843567ffffffffffffffff80821115611f5c57600080fd5b611f6888838901611c32565b90965094506020870135915080821115611f8157600080fd5b50611f8e87828801611c32565b95989497509550505050565b600080600080600080600060e0888a031215611fb557600080fd5b8735611fc081611bd8565b96506020880135611fd081611bd8565b95506040880135945060608801359350608088013560ff81168114611ff457600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561202457600080fd5b823561202f81611bd8565b9150602083013561203f81611bd8565b809150509250929050565b600181811c9082168061205e57607f821691505b60208210810361207e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000826120bf576120bf612084565b500490565b634e487b7160e01b600052603260045260246000fd5b6000826120e9576120e9612084565b500690565b6020808252600e908201526d1b9bdd08185d5d1a1bdc9a5cd95960921b604082015260600190565b80820281158282048414176107cc576107cc61209a565b818103818111156107cc576107cc61209a565b8183823760009101908152919050565b808201808211156107cc576107cc61209a565b60006020828403121561217557600080fd5b8151610aef81611bd8565b60006020828403121561219257600080fd5b81518015158114610aef57600080fd5b600080835481600182811c9150808316806121be57607f831692505b602080841082036121dd57634e487b7160e01b86526022600452602486fd5b8180156121f1576001811461220657612233565b60ff1986168952841515850289019650612233565b60008a81526020902060005b8681101561222b5781548b820152908501908301612212565b505084890196505b509498975050505050505050565b6000600182016122535761225361209a565b506001019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220e228194cecb00362d6bb87ef8bd1c5a117589acf3560a5b88ed2c427e258aa9264736f6c63430008110033000000000000000000000000881af5994ecb00b140886d4b8a615bd19543e0420000000000000000000000003f0b4d09fa1097f1f95683988872e6f24b90d21b000000000000000000000000affbbe7a37d01bb1cdce64be947383e8e31658750000000000000000000000009759226b2f8ddeff81583e244ef3bd13aaa7e4a10000000000000000000000000c6218d95735d3e12ae7c4703106e4b8e0b610100000000000000000000000009e5bf3026a4f77971057cad44c0b6e02efa9a7cd

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102745760003560e01c8063816ed52611610151578063c0e59d2f116100c3578063d505accf11610087578063d505accf1461063d578063dd62ed3e14610650578063ec4f67f91461067b578063f0bc1dd71461068e578063f2fde38b146106b1578063fb883874146106c457600080fd5b8063c0e59d2f146105c3578063cb1374a2146105ee578063cbfb8b2f14610601578063cc49da1314610614578063d2191df11461061d57600080fd5b806395d89b411161011557806395d89b41146105095780639a733448146105115780639dc29fac14610524578063a2cba22514610537578063a9059cbb146105a7578063b7c34384146105ba57600080fd5b8063816ed5261461048b578063836ff3661461049e5780638da5cb5b146104be5780638f388d05146104cf57806390f3c83c146104f657600080fd5b80632ce120fe116101ea578063475573b6116101ae578063475573b61461041057806362590c7b1461041d57806370a0823114610430578063715018a6146104505780637cb64759146104585780637ecebe001461046b57600080fd5b80632ce120fe14610396578063313ce567146103a95780633644e515146103e25780633d6b9df4146103ea57806344fa46fe146103fd57600080fd5b8063132d3f6a1161023c578063132d3f6a1461032b57806318160ddd1461033457806321a4dac41461033d57806323b872dd1461035057806329e99f07146103635780632a3de6461461038357600080fd5b806303d073401461027957806306fdde03146102bd578063095ea7b3146102d25780630b70f42f146102f55780630bfd60b814610316575b600080fd5b6102a07f000000000000000000000000881af5994ecb00b140886d4b8a615bd19543e04281565b6040516001600160a01b0390911681526020015b60405180910390f35b6102c56106d7565b6040516102b49190611b8a565b6102e56102e0366004611bed565b610765565b60405190151581526020016102b4565b610308610303366004611c19565b6107d2565b6040519081526020016102b4565b610329610324366004611c7e565b61081c565b005b610308600b5481565b61030860025481565b61030861034b366004611cca565b61095d565b6102e561035e366004611d4d565b610a14565b610308610371366004611c19565b60156020526000908152604090205481565b600a546102a0906001600160a01b031681565b6103086103a4366004611dd0565b610af6565b6103d07f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff90911681526020016102b4565b610308610c1e565b6103086103f8366004611c19565b610c79565b61032961040b366004611bed565b610d44565b610308650a86cc92e3da81565b61032961042b366004611e12565b610e4c565b61030861043e366004611e4a565b60036020526000908152604090205481565b610329611049565b610329610466366004611c19565b61105d565b610308610479366004611e4a565b60056020526000908152604090205481565b610329610499366004611c19565b61106a565b6103086104ac366004611e4a565b60166020526000908152604090205481565b6006546001600160a01b03166102a0565b6102a07f0000000000000000000000009e8a92f833c0ae4842574ce9cc0ef4c7300ddb1281565b610329610504366004611c19565b6110f9565b6102c561114c565b61030861051f366004611bed565b611159565b610329610532366004611bed565b611226565b61057f610545366004611e7d565b8051602081830181018051600c82529282019190930120915280546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102b4565b6102e56105b5366004611bed565b611285565b61030860135481565b6103086105d1366004611bed565b601760209081526000928352604080842090915290825290205481565b6103296105fc366004611f2e565b6112eb565b6009546102a0906001600160a01b031681565b61030860085481565b61030861062b366004611e4a565b60186020526000908152604090205481565b61032961064b366004611f9a565b611478565b61030861065e366004612011565b600460209081526000928352604080842090915290825290205481565b610308610689366004611c19565b6116bc565b6102e561069c366004611e4a565b600d6020526000908152604090205460ff1681565b6103296106bf366004611e4a565b6116dd565b6103086106d2366004611c19565b611756565b600080546106e49061204a565b80601f01602080910402602001604051908101604052809291908181526020018280546107109061204a565b801561075d5780601f106107325761010080835404028352916020019161075d565b820191906000526020600020905b81548152906001019060200180831161074057829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107c09086815260200190565b60405180910390a35060015b92915050565b60006107cc60076107e46055856120b0565b815481106107f4576107f46120c4565b906000526020600020015460558461080c91906120da565b6003810282901c60071692915050565b6040516bffffffffffffffffffffffff193360601b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905061089d84848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600b54915084905061176d565b6108c25760405162461bcd60e51b81526004016108b9906120ee565b60405180910390fd5b336000908152600d602052604090205460ff16156109225760405162461bcd60e51b815260206004820152601760248201527f616c726561647920636c61696d65642061697264726f7000000000000000000060448201526064016108b9565b336000818152600d60205260409020805460ff191660011790556109579061095284670de0b6b3a7640000612116565b611783565b50505050565b6000838281146109a75760405162461bcd60e51b8152602060048201526015602482015274696e76616c6964206172726179206c656e6774687360581b60448201526064016108b9565b6000805b82811015610a08576109fc8888838181106109c8576109c86120c4565b90506020020160208101906109dd9190611e4a565b8787848181106109ef576109ef6120c4565b905060200201358b6117dd565b909101906001016109ab565b50979650505050505050565b6001600160a01b03831660009081526004602090815260408083203384529091528120546000198114610a7057610a4b838261212d565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b03851660009081526003602052604081208054859290610a9890849061212d565b90915550506001600160a01b038085166000818152600360205260409081902080548701905551909187169060008051602061225b83398151915290610ae19087815260200190565b60405180910390a360019150505b9392505050565b600080600c8484604051610b0b929190612140565b90815260200160405180910390206040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505090506000816080015111610ba45760405162461bcd60e51b8152602060048201526015602482015274189d58dad95d08191bd95cc81b9bdd08195e1a5cdd605a1b60448201526064016108b9565b80516020820151610bb99062015180906120b0565b6080830151610bc8904261212d565b610bd29190612116565b610bdc9082612150565b90508160400151818360600151610bf39190612150565b1115610c165781606001518260400151610c0d919061212d565b925050506107cc565b949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000014614610c5457610c4f611969565b905090565b507f92c7a06eb7b3c65801ff10c0ab949479e33b1c530786c569861818c98822113c90565b6001600160a01b037f0000000000000000000000009e8a92f833c0ae4842574ce9cc0ef4c7300ddb12166000908152601760209081526040808320848452909152812054819015610d0d576001600160a01b037f0000000000000000000000009e8a92f833c0ae4842574ce9cc0ef4c7300ddb12166000908152601760209081526040808320868452909152902054610d11565b6013545b9050600e610d1e846107d2565b60058110610d2e57610d2e6120c4565b0154610d3a824261212d565b610aef9190612116565b6009546001600160a01b0316338114610d6f5760405162461bcd60e51b81526004016108b9906120ee565b6001600160a01b038316600090815260036020526040902054821115610dce5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016108b9565b6001600160a01b03831660009081526003602052604081208054849290610df690849061212d565b90915550506001600160a01b038082166000818152600360205260409081902080548601905551909185169060008051602061225b83398151915290610e3f9086815260200190565b60405180910390a3505050565b610e54611a03565b6000600c8484604051610e68929190612140565b90815260200160405180910390206040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505090506000816080015111610f015760405162461bcd60e51b8152602060048201526015602482015274189d58dad95d08191bd95cc81b9bdd08195e1a5cdd605a1b60448201526064016108b9565b80516080820151600090610f15904261212d565b9050620151808360200151610f2a91906120b0565b610f349082612116565b610f3e9083612150565b91508383606001818151610f529190612150565b9052506040830151606084015111801590610f6d5750838210155b610fc85760405162461bcd60e51b815260206004820152602660248201527f63616e6e6f74206d696e742074686973206d616e792066726f6d207468697320604482015265189d58dad95d60d21b60648201526084016108b9565b610fd23385611783565b610fdc848361212d565b835269ffffffffffffffffffff421660808401526040518390600c906110059089908990612140565b908152604080516020928190038301902083518155918301516001830155820151600282015560608201516003820155608090910151600490910155505050505050565b611051611a03565b61105b6000611a5d565b565b611065611a03565b600b55565b7f000000000000000000000000881af5994ecb00b140886d4b8a615bd19543e0426001600160a01b031633146110b25760405162461bcd60e51b81526004016108b9906120ee565b6001600160a01b037f000000000000000000000000881af5994ecb00b140886d4b8a615bd19543e04216600090815260176020908152604080832093835292905220429055565b600a546001600160a01b031633146111235760405162461bcd60e51b81526004016108b9906120ee565b600a546001600160a01b0316600090815260176020908152604080832093835292905220429055565b600180546106e49061204a565b6001600160a01b03821660009081526017602090815260408083208484529091528120548190156111ad576001600160a01b03841660009081526017602090815260408083208684529091529020546111f6565b6001600160a01b038416600090815260186020526040902054156111e9576001600160a01b0384166000908152601860205260409020546111f6565b6111f66206977f4261212d565b6001600160a01b03851660009081526016602052604090205490915061121c824261212d565b610c169190612116565b6009546001600160a01b031633146112775760405162461bcd60e51b81526020600482015260146024820152731bdb9b1e481d1a58dad95d0818dbdb9d1c9858dd60621b60448201526064016108b9565b6112818282611aaf565b5050565b336000908152600360205260408120805483919083906112a690849061212d565b90915550506001600160a01b0383166000818152600360205260409081902080548501905551339060008051602061225b833981519152906107c09086815260200190565b828181146113335760405162461bcd60e51b8152602060048201526015602482015274696e76616c6964206172726179206c656e6774687360581b60448201526064016108b9565b6000805b8281101561141657611388878783818110611354576113546120c4565b90506020020160208101906113699190611e4a565b86868481811061137b5761137b6120c4565b90506020020135336117dd565b6113929083612150565b915042601760008989858181106113ab576113ab6120c4565b90506020020160208101906113c09190611e4a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008787858181106113f4576113f46120c4565b6020908102929092013583525081019190915260400160002055600101611337565b506114213382611783565b6b06765c793fa10079d0000000600254106114705760405162461bcd60e51b815260206004820152600f60248201526e072656163686564206d61782063617608c1b60448201526064016108b9565b505050505050565b428410156114c85760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016108b9565b600060016114d4610c1e565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa1580156115e0573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906116165750876001600160a01b0316816001600160a01b0316145b6116535760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016108b9565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600781815481106116cc57600080fd5b600091825260209091200154905081565b6116e5611a03565b6001600160a01b03811661174a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108b9565b61175381611a5d565b50565b600e816005811061176657600080fd5b0154905081565b60008261177a8584611b11565b14949350505050565b80600260008282546117959190612150565b90915550506001600160a01b03821660008181526003602090815260408083208054860190555184815260008051602061225b83398151915291015b60405180910390a35050565b6040516331a9108f60e11b81526004810183905260009081906001600160a01b03861690636352211e90602401602060405180830381865afa158015611827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184b9190612163565b9050826001600160a01b0316816001600160a01b031614806118da575060405163e985e9c560e01b81526001600160a01b038281166004830152848116602483015286169063e985e9c590604401602060405180830381865afa1580156118b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118da9190612180565b6119155760405162461bcd60e51b815260206004820152600c60248201526b6e6f7420656c696769626c6560a01b60448201526064016108b9565b7f0000000000000000000000009e8a92f833c0ae4842574ce9cc0ef4c7300ddb126001600160a01b0316856001600160a01b03160361195f5761195784610c79565b915050610aef565b6119578585611159565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600060405161199b91906121a2565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6006546001600160a01b0316331461105b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108b9565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03821660009081526003602052604081208054839290611ad790849061212d565b90915550506002805482900390556040518181526000906001600160a01b0384169060008051602061225b833981519152906020016117d1565b600081815b8451811015611b5657611b4282868381518110611b3557611b356120c4565b6020026020010151611b5e565b915080611b4e81612241565b915050611b16565b509392505050565b6000818310611b7a576000828152602084905260409020610aef565b5060009182526020526040902090565b600060208083528351808285015260005b81811015611bb757858101830151858201604001528201611b9b565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461175357600080fd5b60008060408385031215611c0057600080fd5b8235611c0b81611bd8565b946020939093013593505050565b600060208284031215611c2b57600080fd5b5035919050565b60008083601f840112611c4457600080fd5b50813567ffffffffffffffff811115611c5c57600080fd5b6020830191508360208260051b8501011115611c7757600080fd5b9250929050565b600080600060408486031215611c9357600080fd5b833567ffffffffffffffff811115611caa57600080fd5b611cb686828701611c32565b909790965060209590950135949350505050565b600080600080600060608688031215611ce257600080fd5b8535611ced81611bd8565b9450602086013567ffffffffffffffff80821115611d0a57600080fd5b611d1689838a01611c32565b90965094506040880135915080821115611d2f57600080fd5b50611d3c88828901611c32565b969995985093965092949392505050565b600080600060608486031215611d6257600080fd5b8335611d6d81611bd8565b92506020840135611d7d81611bd8565b929592945050506040919091013590565b60008083601f840112611da057600080fd5b50813567ffffffffffffffff811115611db857600080fd5b602083019150836020828501011115611c7757600080fd5b60008060208385031215611de357600080fd5b823567ffffffffffffffff811115611dfa57600080fd5b611e0685828601611d8e565b90969095509350505050565b600080600060408486031215611e2757600080fd5b833567ffffffffffffffff811115611e3e57600080fd5b611cb686828701611d8e565b600060208284031215611e5c57600080fd5b8135610aef81611bd8565b634e487b7160e01b600052604160045260246000fd5b600060208284031215611e8f57600080fd5b813567ffffffffffffffff80821115611ea757600080fd5b818401915084601f830112611ebb57600080fd5b813581811115611ecd57611ecd611e67565b604051601f8201601f19908116603f01168101908382118183101715611ef557611ef5611e67565b81604052828152876020848701011115611f0e57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008060008060408587031215611f4457600080fd5b843567ffffffffffffffff80821115611f5c57600080fd5b611f6888838901611c32565b90965094506020870135915080821115611f8157600080fd5b50611f8e87828801611c32565b95989497509550505050565b600080600080600080600060e0888a031215611fb557600080fd5b8735611fc081611bd8565b96506020880135611fd081611bd8565b95506040880135945060608801359350608088013560ff81168114611ff457600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561202457600080fd5b823561202f81611bd8565b9150602083013561203f81611bd8565b809150509250929050565b600181811c9082168061205e57607f821691505b60208210810361207e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000826120bf576120bf612084565b500490565b634e487b7160e01b600052603260045260246000fd5b6000826120e9576120e9612084565b500690565b6020808252600e908201526d1b9bdd08185d5d1a1bdc9a5cd95960921b604082015260600190565b80820281158282048414176107cc576107cc61209a565b818103818111156107cc576107cc61209a565b8183823760009101908152919050565b808201808211156107cc576107cc61209a565b60006020828403121561217557600080fd5b8151610aef81611bd8565b60006020828403121561219257600080fd5b81518015158114610aef57600080fd5b600080835481600182811c9150808316806121be57607f831692505b602080841082036121dd57634e487b7160e01b86526022600452602486fd5b8180156121f1576001811461220657612233565b60ff1986168952841515850289019650612233565b60008a81526020902060005b8681101561222b5781548b820152908501908301612212565b505084890196505b509498975050505050505050565b6000600182016122535761225361209a565b506001019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220e228194cecb00362d6bb87ef8bd1c5a117589acf3560a5b88ed2c427e258aa9264736f6c63430008110033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000881af5994ecb00b140886d4b8a615bd19543e0420000000000000000000000003f0b4d09fa1097f1f95683988872e6f24b90d21b000000000000000000000000affbbe7a37d01bb1cdce64be947383e8e31658750000000000000000000000009759226b2f8ddeff81583e244ef3bd13aaa7e4a10000000000000000000000000c6218d95735d3e12ae7c4703106e4b8e0b610100000000000000000000000009e5bf3026a4f77971057cad44c0b6e02efa9a7cd

-----Decoded View---------------
Arg [0] : _land (address): 0x881aF5994ECB00b140886D4B8A615bD19543E042
Arg [1] : _ticket (address): 0x3f0b4D09Fa1097F1f95683988872e6F24b90D21B
Arg [2] : _tierTwo (address): 0xaffBBE7A37D01bb1cdcE64bE947383e8E3165875
Arg [3] : _nft1 (address): 0x9759226B2F8ddEFF81583e244Ef3bd13AAA7e4A1
Arg [4] : _nft2 (address): 0x0c6218D95735d3E12AE7C4703106E4b8e0b61010
Arg [5] : _nft3 (address): 0x9e5bF3026A4F77971057cad44C0B6e02EFA9a7cD

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000881af5994ecb00b140886d4b8a615bd19543e042
Arg [1] : 0000000000000000000000003f0b4d09fa1097f1f95683988872e6f24b90d21b
Arg [2] : 000000000000000000000000affbbe7a37d01bb1cdce64be947383e8e3165875
Arg [3] : 0000000000000000000000009759226b2f8ddeff81583e244ef3bd13aaa7e4a1
Arg [4] : 0000000000000000000000000c6218d95735d3e12ae7c4703106e4b8e0b61010
Arg [5] : 0000000000000000000000009e5bf3026a4f77971057cad44c0b6e02efa9a7cd


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.