ETH Price: $3,326.36 (-3.99%)

Token

Brawler Bearz Battle Pass: S3 (BBBPS3)
 

Overview

Max Total Supply

332 BBBPS3

Holders

163

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 BBBPS3
0xb1a62b285bed3e94bd4a0a410fe579d8545a82e8
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:
BrawlerBearzBattlePassSeason3

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 500 runs

Other Settings:
default evmVersion
File 1 of 18 : BrawlerBearzBattlePassSeason3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
import "erc721a/contracts/extensions/ERC721ABurnable.sol";
import {IBrawlerBearzDynamicItems} from "./interfaces/IBrawlerBearzDynamicItems.sol";
import "./tunnel/FxBaseRootTunnel.sol";

/*******************************************************************************
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|,|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&@@@@@@@@@@@|,*|&@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%,**%@@@@@@@@%|******%&@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&##*****|||**,(%%%%%**|%@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@***,#%%%%**#&@@@@@#**,|@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@*,(@@@@@@@@@@**,(&@@@@#**%@@@@@@||(%@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@%|,****&@((@&***&@@@@@@%||||||||#%&@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@&%#*****||||||**#%&@%%||||||||#@&%#(@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@&**,(&@@@@@%|||||*##&&&&##|||||(%@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@**,%@@@@@@@(|*|#%@@@@@@@@#||#%%@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@#||||#@@@@||*|%@@@@@@@@&|||%%&@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@#,,,,,,*|**||%|||||||###&@@@@@@@#|||#%@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@&#||*|||||%%%@%%%#|||%@@@@@@@@&(|(%&@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@&&%%(||||@@@@@@&|||||(%&((||(#%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@%%(||||||||||#%#(|||||%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@&%#######%%@@**||(#%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%##%%&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
********************************************************************************/

/**
 * @title BrawlerBearzBattlePassSeason3
 * @author @scottybmitch
 * @dev Battle pass public mint and L2 sync on mint, non-transferable, or sellable
 */
contract BrawlerBearzBattlePassSeason3 is
    FxBaseRootTunnel,
    ERC721AQueryable,
    ERC721ABurnable,
    Ownable
{
    using Strings for uint256;

    /// @dev Sync actions
    bytes32 public constant MINTED = keccak256("MINTED");
    bytes32 public constant REWARDS_CLAIM = keccak256("REWARDS_CLAIM");

    /// @notice Vendor contract
    IBrawlerBearzDynamicItems public vendorContract;

    // @dev Base uri for the nft
    string private baseURI =
        "ipfs://bafybeibcjnairw3alc65whtvcy7vosjion5csp5zctn7e4gehbqb77kbye/";

    /// @notice Pro battle pass tier
    uint256 constant PRO_PASS = 1;

    /// @notice Pro pass mint price
    uint256 public proPrice = 0.03 ether;

    // @dev Treasury
    address public treasury =
        payable(0x39bfA2b4319581bc885A2d4b9F0C90C2e1c24B87);

    /*
     * @notice All mints live ~ July 12th, 12PM EST
     * @dev Mints go live date
     */
    uint256 public liveAt = 1689177600;

    /*
     * @notice All mints expired ~ July 29th, 12PM EST
     * @dev Mints expire at
     */
    uint256 public expiresAt = 1690646400;

    /// @dev Thrown on approval
    error CannotApproveAll();

    /// @dev Thrown on transfer
    error Nontransferable();

    modifier mintIsActive() {
        require(
            block.timestamp > liveAt && block.timestamp < expiresAt,
            "Minting is not active."
        );
        _;
    }

    constructor(
        address _checkpointManager,
        address _fxRoot,
        address _vendorContractAddress
    )
        FxBaseRootTunnel(_checkpointManager, _fxRoot)
        ERC721A("Brawler Bearz Battle Pass: S3", "BBBPS3")
    {
        vendorContract = IBrawlerBearzDynamicItems(_vendorContractAddress);
    }

    /**
     * @notice Pro pass mints
     * @param _amount The amount of passes to mint
     **/
    function proPassMint(uint256 _amount) external payable mintIsActive {
        require(msg.value >= _amount * proPrice, "Not enough funds.");
        address to = _msgSender();

        // Mint passes
        _mint(to, _amount);

        // Mint a synthesizer per mint
        uint256[] memory itemIds = new uint256[](_amount);

        for (uint256 i; i < _amount; i++) {
            itemIds[i] = 211; // Synthesizer item id
        }

        vendorContract.dropItems(to, itemIds);

        // Sync w/ child
        _sendMessageToChild(
            abi.encode(
                MINTED,
                abi.encode(to, _nextTokenId(), PRO_PASS, _amount)
            )
        );
    }

    /**
     * @notice Returns the URI for a given token id
     * @param _tokenId A tokenId
     */
    function tokenURI(uint256 _tokenId)
        public
        view
        override
        returns (string memory)
    {
        if (!_exists(_tokenId)) revert OwnerQueryForNonexistentToken();
        return string(abi.encodePacked(baseURI, Strings.toString(PRO_PASS)));
    }

    // @dev Check if mint is live
    function isLive() public view returns (bool) {
        return block.timestamp > liveAt && block.timestamp < expiresAt;
    }

    // @dev Returns the starting token ID.
    function _startTokenId() internal view virtual override returns (uint256) {
        return 1;
    }

    /**
     * @notice Sets pro price
     * @param _proPrice A base uri
     */
    function setProPrice(uint256 _proPrice) external onlyOwner {
        proPrice = _proPrice;
    }

    /**
     * @notice Sets the base URI of the NFT
     * @param _baseURI A base uri
     */
    function setBaseURI(string calldata _baseURI) external onlyOwner {
        baseURI = _baseURI;
    }

    /**
     * @notice Sets timestamps for live and expires timeframe
     * @param _liveAt A unix timestamp for live date
     * @param _expiresAt A unix timestamp for expiration date
     */
    function setMintWindow(uint256 _liveAt, uint256 _expiresAt)
        external
        onlyOwner
    {
        liveAt = _liveAt;
        expiresAt = _expiresAt;
    }

    /**
     * @notice Sets the treasury recipient
     * @param _treasury The treasury address
     */
    function setTreasury(address _treasury) public onlyOwner {
        treasury = payable(_treasury);
    }

    /**
     * Set FxChildTunnel
     * @param _fxChildTunnel - the fxChildTunnel address
     */
    function setFxChildTunnel(address _fxChildTunnel)
        public
        override
        onlyOwner
    {
        fxChildTunnel = _fxChildTunnel;
    }

    /**
     * @notice Sets the bearz vendor item contract
     * @dev only owner call this function
     * @param _vendorContractAddress The new contract address
     */
    function setVendorContractAddress(address _vendorContractAddress)
        external
        onlyOwner
    {
        vendorContract = IBrawlerBearzDynamicItems(_vendorContractAddress);
    }

    /// @notice Withdraws funds from contract
    function withdraw() public onlyOwner {
        (bool success, ) = treasury.call{value: address(this).balance}("");
        require(success, "999");
    }

    /// @dev Prevent approvals of token
    function setApprovalForAll(address, bool) public virtual override {
        revert CannotApproveAll();
    }

    /// @dev Prevent token transfer unless burning
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal override(ERC721A) {
        if (to != address(0) && from != address(0)) {
            revert Nontransferable();
        }
        super._beforeTokenTransfers(from, to, startTokenId, quantity);
    }

    function _processRewardsClaim(bytes memory data) internal {
        (address to, uint256[] memory itemIds) = abi.decode(
            data,
            (address, uint256[])
        );
        vendorContract.dropItems(to, itemIds);
    }

    /// @dev TEST
    function _processMessageFromChildTest(bytes memory message)
        external
        onlyOwner
    {
        (bytes32 syncType, bytes memory syncData) = abi.decode(
            message,
            (bytes32, bytes)
        );
        if (syncType == REWARDS_CLAIM) {
            _processRewardsClaim(syncData);
        } else {
            revert("INVALID_SYNC_TYPE");
        }
    }

    function _processMessageFromChild(bytes memory message) internal override {
        (bytes32 syncType, bytes memory syncData) = abi.decode(
            message,
            (bytes32, bytes)
        );
        if (syncType == REWARDS_CLAIM) {
            _processRewardsClaim(syncData);
        } else {
            revert("INVALID_SYNC_TYPE");
        }
    }
}

File 2 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 4 of 18 : ERC721AQueryable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721AQueryable.sol';
import '../ERC721A.sol';

/**
 * @title ERC721A Queryable
 * @dev ERC721A subclass with convenience query functions.
 */
abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
    /**
     * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
     *
     * If the `tokenId` is out of bounds:
     *   - `addr` = `address(0)`
     *   - `startTimestamp` = `0`
     *   - `burned` = `false`
     *   - `extraData` = `0`
     *
     * If the `tokenId` is burned:
     *   - `addr` = `<Address of owner before token was burned>`
     *   - `startTimestamp` = `<Timestamp when token was burned>`
     *   - `burned = `true`
     *   - `extraData` = `<Extra data when token was burned>`
     *
     * Otherwise:
     *   - `addr` = `<Address of owner>`
     *   - `startTimestamp` = `<Timestamp of start of ownership>`
     *   - `burned = `false`
     *   - `extraData` = `<Extra data at start of ownership>`
     */
    function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) {
        TokenOwnership memory ownership;
        if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) {
            return ownership;
        }
        ownership = _ownershipAt(tokenId);
        if (ownership.burned) {
            return ownership;
        }
        return _ownershipOf(tokenId);
    }

    /**
     * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
     * See {ERC721AQueryable-explicitOwnershipOf}
     */
    function explicitOwnershipsOf(uint256[] memory tokenIds) external view override returns (TokenOwnership[] memory) {
        unchecked {
            uint256 tokenIdsLength = tokenIds.length;
            TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);
            for (uint256 i; i != tokenIdsLength; ++i) {
                ownerships[i] = explicitOwnershipOf(tokenIds[i]);
            }
            return ownerships;
        }
    }

    /**
     * @dev Returns an array of token IDs owned by `owner`,
     * in the range [`start`, `stop`)
     * (i.e. `start <= tokenId < stop`).
     *
     * This function allows for tokens to be queried if the collection
     * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
     *
     * Requirements:
     *
     * - `start` < `stop`
     */
    function tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) external view override returns (uint256[] memory) {
        unchecked {
            if (start >= stop) revert InvalidQueryRange();
            uint256 tokenIdsIdx;
            uint256 stopLimit = _nextTokenId();
            // Set `start = max(start, _startTokenId())`.
            if (start < _startTokenId()) {
                start = _startTokenId();
            }
            // Set `stop = min(stop, stopLimit)`.
            if (stop > stopLimit) {
                stop = stopLimit;
            }
            uint256 tokenIdsMaxLength = balanceOf(owner);
            // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
            // to cater for cases where `balanceOf(owner)` is too big.
            if (start < stop) {
                uint256 rangeLength = stop - start;
                if (rangeLength < tokenIdsMaxLength) {
                    tokenIdsMaxLength = rangeLength;
                }
            } else {
                tokenIdsMaxLength = 0;
            }
            uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);
            if (tokenIdsMaxLength == 0) {
                return tokenIds;
            }
            // We need to call `explicitOwnershipOf(start)`,
            // because the slot at `start` may not be initialized.
            TokenOwnership memory ownership = explicitOwnershipOf(start);
            address currOwnershipAddr;
            // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.
            // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.
            if (!ownership.burned) {
                currOwnershipAddr = ownership.addr;
            }
            for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {
                ownership = _ownershipAt(i);
                if (ownership.burned) {
                    continue;
                }
                if (ownership.addr != address(0)) {
                    currOwnershipAddr = ownership.addr;
                }
                if (currOwnershipAddr == owner) {
                    tokenIds[tokenIdsIdx++] = i;
                }
            }
            // Downsize the array to fit.
            assembly {
                mstore(tokenIds, tokenIdsIdx)
            }
            return tokenIds;
        }
    }

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(totalSupply) in complexity.
     * It is meant to be called off-chain.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K pfp collections should be fine).
     */
    function tokensOfOwner(address owner) external view override returns (uint256[] memory) {
        unchecked {
            uint256 tokenIdsIdx;
            address currOwnershipAddr;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            TokenOwnership memory ownership;
            for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                ownership = _ownershipAt(i);
                if (ownership.burned) {
                    continue;
                }
                if (ownership.addr != address(0)) {
                    currOwnershipAddr = ownership.addr;
                }
                if (currOwnershipAddr == owner) {
                    tokenIds[tokenIdsIdx++] = i;
                }
            }
            return tokenIds;
        }
    }
}

File 5 of 18 : ERC721ABurnable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721ABurnable.sol';
import '../ERC721A.sol';

/**
 * @title ERC721A Burnable Token
 * @dev ERC721A Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721ABurnable is ERC721A, IERC721ABurnable {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual override {
        _burn(tokenId, true);
    }
}

File 6 of 18 : IBrawlerBearzDynamicItems.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";

interface IBrawlerBearzDynamicItems is IERC1155Upgradeable {
    struct CustomMetadata {
        string typeOf;
        string name;
        uint256 xp; // Min XP required to equip
        string rarity; // LEGENDARY, SUPER_RARE, RARE, UNCOMMON, COMMON
        uint256 atk; // Correlated to Strength
        uint256 def; // Correlated to Endurance
        uint256 usageChance; // DEPRECATED
        string usageDuration; // PERSISTENT - equipable items, TEMPORARY - battles, ONE-TIME - buffs
        string description;
        uint256 intel; // Correlated to intellgience
        uint256 luck; // Correlated to luck
    }

    function getMetadata(uint256 tokenId)
        external
        view
        returns (CustomMetadata memory);

    function getMetadataBatch(uint256[] calldata tokenIds)
        external
        view
        returns (CustomMetadata[] memory);

    function getItemType(uint256 tokenId) external view returns (string memory);

    function getItemName(uint256 tokenId) external view returns (string memory);

    function getItemXPReq(uint256 tokenId) external view returns (uint256);

    function setItemMetadata(
        uint256 tokenId,
        string calldata typeOf,
        string calldata name,
        uint256 xp
    ) external;

    function setItemMetadataStruct(
        uint256 tokenId,
        CustomMetadata memory metadata
    ) external;

    function shopDrop(address _toAddress, uint256 _amount) external;

    function dropItems(address _toAddress, uint256[] calldata itemIds) external;

    function burnItemForOwnerAddress(
        uint256 _typeId,
        uint256 _quantity,
        address _materialOwnerAddress
    ) external;

    function mintItemToAddress(
        uint256 _typeId,
        uint256 _quantity,
        address _toAddress
    ) external;

    function mintBatchItemsToAddress(
        uint256[] memory _typeIds,
        uint256[] memory _quantities,
        address _toAddress
    ) external;

    function bulkSafeTransfer(
        uint256 _typeId,
        uint256 _quantityPerRecipient,
        address[] calldata recipients
    ) external;
}

File 7 of 18 : FxBaseRootTunnel.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {RLPReader} from "../lib/RLPReader.sol";
import {MerklePatriciaProof} from "../lib/MerklePatriciaProof.sol";
import {Merkle} from "../lib/Merkle.sol";
import "../lib/ExitPayloadReader.sol";

interface IFxStateSender {
    function sendMessageToChild(address _receiver, bytes calldata _data)
        external;
}

contract ICheckpointManager {
    struct HeaderBlock {
        bytes32 root;
        uint256 start;
        uint256 end;
        uint256 createdAt;
        address proposer;
    }

    /**
     * @notice mapping of checkpoint header numbers to block details
     * @dev These checkpoints are submited by plasma contracts
     */
    mapping(uint256 => HeaderBlock) public headerBlocks;
}

abstract contract FxBaseRootTunnel {
    using RLPReader for RLPReader.RLPItem;
    using Merkle for bytes32;
    using ExitPayloadReader for bytes;
    using ExitPayloadReader for ExitPayloadReader.ExitPayload;
    using ExitPayloadReader for ExitPayloadReader.Log;
    using ExitPayloadReader for ExitPayloadReader.LogTopics;
    using ExitPayloadReader for ExitPayloadReader.Receipt;

    // keccak256(MessageSent(bytes))
    bytes32 public constant SEND_MESSAGE_EVENT_SIG =
        0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036;

    // state sender contract
    IFxStateSender public fxRoot;
    // root chain manager
    ICheckpointManager public checkpointManager;
    // child tunnel contract which receives and sends messages
    address public fxChildTunnel;

    // storage to avoid duplicate exits
    mapping(bytes32 => bool) public processedExits;

    constructor(address _checkpointManager, address _fxRoot) {
        checkpointManager = ICheckpointManager(_checkpointManager);
        fxRoot = IFxStateSender(_fxRoot);
    }

    // set fxChildTunnel if not set already
    function setFxChildTunnel(address _fxChildTunnel) public virtual {
        require(
            fxChildTunnel == address(0x0),
            "FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET"
        );
        fxChildTunnel = _fxChildTunnel;
    }

    /**
     * @notice Send bytes message to Child Tunnel
     * @param message bytes message that will be sent to Child Tunnel
     * some message examples -
     *   abi.encode(tokenId);
     *   abi.encode(tokenId, tokenMetadata);
     *   abi.encode(messageType, messageData);
     */
    function _sendMessageToChild(bytes memory message) internal {
        fxRoot.sendMessageToChild(fxChildTunnel, message);
    }

    function _validateAndExtractMessage(bytes memory inputData)
        internal
        returns (bytes memory)
    {
        ExitPayloadReader.ExitPayload memory payload = inputData
            .toExitPayload();

        bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();
        uint256 blockNumber = payload.getBlockNumber();
        // checking if exit has already been processed
        // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex)
        bytes32 exitHash = keccak256(
            abi.encodePacked(
                blockNumber,
                // first 2 nibbles are dropped while generating nibble array
                // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only)
                // so converting to nibble array and then hashing it
                MerklePatriciaProof._getNibbleArray(branchMaskBytes),
                payload.getReceiptLogIndex()
            )
        );
        require(
            processedExits[exitHash] == false,
            "FxRootTunnel: EXIT_ALREADY_PROCESSED"
        );
        processedExits[exitHash] = true;

        ExitPayloadReader.Receipt memory receipt = payload.getReceipt();
        ExitPayloadReader.Log memory log = receipt.getLog();

        // check child tunnel
        require(
            fxChildTunnel == log.getEmitter(),
            "FxRootTunnel: INVALID_FX_CHILD_TUNNEL"
        );

        bytes32 receiptRoot = payload.getReceiptRoot();
        // verify receipt inclusion
        require(
            MerklePatriciaProof.verify(
                receipt.toBytes(),
                branchMaskBytes,
                payload.getReceiptProof(),
                receiptRoot
            ),
            "FxRootTunnel: INVALID_RECEIPT_PROOF"
        );

        // verify checkpoint inclusion
        _checkBlockMembershipInCheckpoint(
            blockNumber,
            payload.getBlockTime(),
            payload.getTxRoot(),
            receiptRoot,
            payload.getHeaderNumber(),
            payload.getBlockProof()
        );

        ExitPayloadReader.LogTopics memory topics = log.getTopics();

        require(
            bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig
            "FxRootTunnel: INVALID_SIGNATURE"
        );

        // received message data
        bytes memory message = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message
        return message;
    }

    function _checkBlockMembershipInCheckpoint(
        uint256 blockNumber,
        uint256 blockTime,
        bytes32 txRoot,
        bytes32 receiptRoot,
        uint256 headerNumber,
        bytes memory blockProof
    ) private view returns (uint256) {
        (
            bytes32 headerRoot,
            uint256 startBlock,
            ,
            uint256 createdAt,

        ) = checkpointManager.headerBlocks(headerNumber);

        require(
            keccak256(
                abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)
            ).checkMembership(blockNumber - startBlock, headerRoot, blockProof),
            "FxRootTunnel: INVALID_HEADER"
        );
        return createdAt;
    }

    /**
     * @notice receive message from  L2 to L1, validated by proof
     * @dev This function verifies if the transaction actually happened on child chain
     *
     * @param inputData RLP encoded data of the reference tx containing following list of fields
     *  0 - headerNumber - Checkpoint header block number containing the reference tx
     *  1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root
     *  2 - blockNumber - Block number containing the reference tx on child chain
     *  3 - blockTime - Reference tx block time
     *  4 - txRoot - Transactions root of block
     *  5 - receiptRoot - Receipts root of block
     *  6 - receipt - Receipt of the reference transaction
     *  7 - receiptProof - Merkle proof of the reference receipt
     *  8 - branchMask - 32 bits denoting the path of receipt in merkle tree
     *  9 - receiptLogIndex - Log Index to read from the receipt
     */
    function receiveMessage(bytes memory inputData) public virtual {
        bytes memory message = _validateAndExtractMessage(inputData);
        _processMessageFromChild(message);
    }

    /**
     * @notice Process message received from Child Tunnel
     * @dev function needs to be implemented to handle message as per requirement
     * This is called by onStateReceive function.
     * Since it is called via a system call, any event will not be emitted during its execution.
     * @param message bytes message that was sent from Child Tunnel
     */
    function _processMessageFromChild(bytes memory message) internal virtual;
}

File 8 of 18 : 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 9 of 18 : IERC721AQueryable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721A.sol';

/**
 * @dev Interface of an ERC721AQueryable compliant contract.
 */
interface IERC721AQueryable is IERC721A {
    /**
     * Invalid query range (`start` >= `stop`).
     */
    error InvalidQueryRange();

    /**
     * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
     *
     * If the `tokenId` is out of bounds:
     *   - `addr` = `address(0)`
     *   - `startTimestamp` = `0`
     *   - `burned` = `false`
     *
     * If the `tokenId` is burned:
     *   - `addr` = `<Address of owner before token was burned>`
     *   - `startTimestamp` = `<Timestamp when token was burned>`
     *   - `burned = `true`
     *
     * Otherwise:
     *   - `addr` = `<Address of owner>`
     *   - `startTimestamp` = `<Timestamp of start of ownership>`
     *   - `burned = `false`
     */
    function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);

    /**
     * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
     * See {ERC721AQueryable-explicitOwnershipOf}
     */
    function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);

    /**
     * @dev Returns an array of token IDs owned by `owner`,
     * in the range [`start`, `stop`)
     * (i.e. `start <= tokenId < stop`).
     *
     * This function allows for tokens to be queried if the collection
     * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
     *
     * Requirements:
     *
     * - `start` < `stop`
     */
    function tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) external view returns (uint256[] memory);

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(totalSupply) in complexity.
     * It is meant to be called off-chain.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K pfp collections should be fine).
     */
    function tokensOfOwner(address owner) external view returns (uint256[] memory);
}

File 10 of 18 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

/**
 * @dev ERC721 token receiver interface.
 */
interface ERC721A__IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard,
 * including the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at `_startTokenId()`
 * (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // Mask of an entry in packed address data.
    uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

    // The bit position of `numberMinted` in packed address data.
    uint256 private constant BITPOS_NUMBER_MINTED = 64;

    // The bit position of `numberBurned` in packed address data.
    uint256 private constant BITPOS_NUMBER_BURNED = 128;

    // The bit position of `aux` in packed address data.
    uint256 private constant BITPOS_AUX = 192;

    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
    uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

    // The bit position of `startTimestamp` in packed ownership.
    uint256 private constant BITPOS_START_TIMESTAMP = 160;

    // The bit mask of the `burned` bit in packed ownership.
    uint256 private constant BITMASK_BURNED = 1 << 224;

    // The bit position of the `nextInitialized` bit in packed ownership.
    uint256 private constant BITPOS_NEXT_INITIALIZED = 225;

    // The bit mask of the `nextInitialized` bit in packed ownership.
    uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225;

    // The bit position of `extraData` in packed ownership.
    uint256 private constant BITPOS_EXTRA_DATA = 232;

    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
    uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

    // The mask of the lower 160 bits for addresses.
    uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1;

    // The maximum `quantity` that can be minted with `_mintERC2309`.
    // This limit is to prevent overflows on the address data entries.
    // For a limit of 5000, a total of 3.689e15 calls to `_mintERC2309`
    // is required to cause an overflow, which is unrealistic.
    uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

    // The tokenId of the next token to be minted.
    uint256 private _currentIndex;

    // The number of tokens burned.
    uint256 private _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned.
    // See `_packedOwnershipOf` implementation for details.
    //
    // Bits Layout:
    // - [0..159]   `addr`
    // - [160..223] `startTimestamp`
    // - [224]      `burned`
    // - [225]      `nextInitialized`
    // - [232..255] `extraData`
    mapping(uint256 => uint256) private _packedOwnerships;

    // Mapping owner address to address data.
    //
    // Bits Layout:
    // - [0..63]    `balance`
    // - [64..127]  `numberMinted`
    // - [128..191] `numberBurned`
    // - [192..255] `aux`
    mapping(address => uint256) private _packedAddressData;

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

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

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view returns (uint256) {
        return _currentIndex;
    }

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see `_totalMinted`.
     */
    function totalSupply() public view override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view returns (uint256) {
        // Counter underflow is impossible as _currentIndex does not decrement,
        // and it is initialized to `_startTokenId()`
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }

    /**
     * @dev Returns the total number of tokens burned.
     */
    function _totalBurned() internal view returns (uint256) {
        return _burnCounter;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes of the XOR of
        // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165
        // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        return uint64(_packedAddressData[owner] >> BITPOS_AUX);
    }

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal {
        uint256 packed = _packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
        _packedAddressData[owner] = packed;
    }

    /**
     * Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr)
                if (curr < _currentIndex) {
                    uint256 packed = _packedOwnerships[curr];
                    // If not burned.
                    if (packed & BITMASK_BURNED == 0) {
                        // Invariant:
                        // There will always be an ownership that has an address and is not burned
                        // before an ownership that does not have an address and is not burned.
                        // Hence, curr will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed is zero.
                        while (packed == 0) {
                            packed = _packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP);
        ownership.burned = packed & BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> BITPOS_EXTRA_DATA);
    }

    /**
     * Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnerships[index]);
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal {
        if (_packedOwnerships[index] == 0) {
            _packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }

    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }

    /**
     * @dev Packs ownership data into a single uint256.
     */
    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, BITMASK_ADDRESS)
            // `owner | (block.timestamp << BITPOS_START_TIMESTAMP) | flags`.
            result := or(owner, or(shl(BITPOS_START_TIMESTAMP, timestamp()), flags))
        }
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        string memory baseURI = _baseURI();
        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, it can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

    /**
     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
     */
    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
        // For branchless setting of the `nextInitialized` flag.
        assembly {
            // `(quantity == 1) << BITPOS_NEXT_INITIALIZED`.
            result := shl(BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
        }
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public override {
        address owner = ownerOf(tokenId);

        if (_msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }

        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        if (operator == _msgSenderERC721A()) revert ApproveToCaller();

        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

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

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex && // If within bounds,
            _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned.
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, quantity, '');
    }

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     *   {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        _mint(to, quantity);

        unchecked {
            if (to.code.length != 0) {
                uint256 end = _currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (index < end);
                // Reentrancy protection.
                if (_currentIndex != end) revert();
            }
        }
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mint(address to, uint256 quantity) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            uint256 tokenId = startTokenId;
            uint256 end = startTokenId + quantity;
            do {
                emit Transfer(address(0), to, tokenId++);
            } while (tokenId < end);

            _currentIndex = end;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * This function is intended for efficient minting only during contract creation.
     *
     * It emits only one {ConsecutiveTransfer} as defined in
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
     * instead of a sequence of {Transfer} event(s).
     *
     * Calling this function outside of contract creation WILL make your contract
     * non-compliant with the ERC721 standard.
     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
     * {ConsecutiveTransfer} event is only permissible during contract creation.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {ConsecutiveTransfer} event.
     */
    function _mintERC2309(address to, uint256 quantity) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();
        if (quantity > MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);

            _currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals;
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.
        assembly {
            // Compute the slot.
            mstore(0x00, tokenId)
            mstore(0x20, tokenApprovalsPtr.slot)
            approvedAddressSlot := keccak256(0x00, 0x40)
            // Load the slot's value from storage.
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    /**
     * @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`.
     */
    function _isOwnerOrApproved(
        address approvedAddress,
        address from,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
            from := and(from, BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, BITMASK_ADDRESS)
            // `msgSender == from || msgSender == approvedAddress`.
            result := or(eq(msgSender, from), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
            if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();

        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --_packedAddressData[from]; // Updates: `balance -= 1`.
            ++_packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                to,
                BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

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

        address from = address(uint160(prevOwnershipPacked));

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
                if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`.
            _packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1;

            // Updates:
            // - `address` to the last owner.
            // - `startTimestamp` to the timestamp of burning.
            // - `burned` to `true`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                from,
                (BITMASK_BURNED | BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            _burnCounter++;
        }
    }

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

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal {
        uint256 packed = _packedOwnerships[index];
        if (packed == 0) revert OwnershipNotInitializedForExtraData();
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << BITPOS_EXTRA_DATA);
        _packedOwnerships[index] = packed;
    }

    /**
     * @dev Returns the next extra data for the packed ownership data.
     * The returned result is shifted into position.
     */
    function _nextExtraData(
        address from,
        address to,
        uint256 prevOwnershipPacked
    ) private view returns (uint256) {
        uint24 extraData = uint24(prevOwnershipPacked >> BITPOS_EXTRA_DATA);
        return uint256(_extraData(from, to, extraData)) << BITPOS_EXTRA_DATA;
    }

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) internal view virtual returns (uint24) {}

    /**
     * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred.
     * This includes minting.
     * And also called before burning one token.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred.
     * This includes minting.
     * And also called after one token has been burned.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC721A() internal view virtual returns (address) {
        return msg.sender;
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function _toString(uint256 value) internal pure returns (string memory ptr) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit),
            // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
            // We will need 1 32-byte word to store the length,
            // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
            ptr := add(mload(0x40), 128)
            // Update the free memory pointer to allocate.
            mstore(0x40, ptr)

            // Cache the end of the memory to calculate the length later.
            let end := ptr

            // We write the string from the rightmost digit to the leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // Costs a bit more than early returning for the zero case,
            // but cheaper in terms of deployment and overall runtime costs.
            for {
                // Initialize and perform the first pass without check.
                let temp := value
                // Move the pointer 1 byte leftwards to point to an empty character slot.
                ptr := sub(ptr, 1)
                // Write the character to the pointer. 48 is the ASCII index of '0'.
                mstore8(ptr, add(48, mod(temp, 10)))
                temp := div(temp, 10)
            } temp {
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
            } {
                // Body of the for loop.
                ptr := sub(ptr, 1)
                mstore8(ptr, add(48, mod(temp, 10)))
            }

            let length := sub(end, ptr)
            // Move the pointer 32 bytes leftwards to make room for the length.
            ptr := sub(ptr, 32)
            // Store the length.
            mstore(ptr, length)
        }
    }
}

File 11 of 18 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of an ERC721A compliant contract.
 */
interface IERC721A {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

    /**
     * The caller cannot approve to their own address.
     */
    error ApproveToCaller();

    /**
     * Cannot query the balance for the zero address.
     */
    error BalanceQueryForZeroAddress();

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

    /**
     * The token must be owned by `from`.
     */
    error TransferFromIncorrectOwner();

    /**
     * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
     */
    error TransferToNonERC721ReceiverImplementer();

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    /**
     * The `quantity` minted with ERC2309 exceeds the safety limit.
     */
    error MintERC2309QuantityExceedsLimit();

    /**
     * The `extraData` cannot be set on an unintialized ownership slot.
     */
    error OwnershipNotInitializedForExtraData();

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
        // Arbitrary data similar to `startTimestamp` that can be set through `_extraData`.
        uint24 extraData;
    }

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     *
     * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
     */
    function totalSupply() external view returns (uint256);

    // ==============================
    //            IERC165
    // ==============================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // ==============================
    //            IERC721
    // ==============================

    /**
     * @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 be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

    // ==============================
    //        IERC721Metadata
    // ==============================

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

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);

    // ==============================
    //            IERC2309
    // ==============================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId` (inclusive) is transferred from `from` to `to`,
     * as defined in the ERC2309 standard. See `_mintERC2309` for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

File 12 of 18 : IERC721ABurnable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721A.sol';

/**
 * @dev Interface of an ERC721ABurnable compliant contract.
 */
interface IERC721ABurnable is IERC721A {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) external;
}

File 13 of 18 : IERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 14 of 18 : IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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 15 of 18 : RLPReader.sol
/*
 * @author Hamdi Allam [email protected]
 * Please reach out with any questions or concerns
 */
pragma solidity ^0.8.0;

library RLPReader {
    uint8 constant STRING_SHORT_START = 0x80;
    uint8 constant STRING_LONG_START = 0xb8;
    uint8 constant LIST_SHORT_START = 0xc0;
    uint8 constant LIST_LONG_START = 0xf8;
    uint8 constant WORD_SIZE = 32;

    struct RLPItem {
        uint256 len;
        uint256 memPtr;
    }

    struct Iterator {
        RLPItem item; // Item that's being iterated over.
        uint256 nextPtr; // Position of the next item in the list.
    }

    /*
     * @dev Returns the next element in the iteration. Reverts if it has not next element.
     * @param self The iterator.
     * @return The next element in the iteration.
     */
    function next(Iterator memory self) internal pure returns (RLPItem memory) {
        require(hasNext(self));

        uint256 ptr = self.nextPtr;
        uint256 itemLength = _itemLength(ptr);
        self.nextPtr = ptr + itemLength;

        return RLPItem(itemLength, ptr);
    }

    /*
     * @dev Returns true if the iteration has more elements.
     * @param self The iterator.
     * @return true if the iteration has more elements.
     */
    function hasNext(Iterator memory self) internal pure returns (bool) {
        RLPItem memory item = self.item;
        return self.nextPtr < item.memPtr + item.len;
    }

    /*
     * @param item RLP encoded bytes
     */
    function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {
        uint256 memPtr;
        assembly {
            memPtr := add(item, 0x20)
        }

        return RLPItem(item.length, memPtr);
    }

    /*
     * @dev Create an iterator. Reverts if item is not a list.
     * @param self The RLP item.
     * @return An 'Iterator' over the item.
     */
    function iterator(RLPItem memory self) internal pure returns (Iterator memory) {
        require(isList(self));

        uint256 ptr = self.memPtr + _payloadOffset(self.memPtr);
        return Iterator(self, ptr);
    }

    /*
     * @param item RLP encoded bytes
     */
    function rlpLen(RLPItem memory item) internal pure returns (uint256) {
        return item.len;
    }

    /*
     * @param item RLP encoded bytes
     */
    function payloadLen(RLPItem memory item) internal pure returns (uint256) {
        return item.len - _payloadOffset(item.memPtr);
    }

    /*
     * @param item RLP encoded list in bytes
     */
    function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {
        require(isList(item));

        uint256 items = numItems(item);
        RLPItem[] memory result = new RLPItem[](items);

        uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr);
        uint256 dataLen;
        for (uint256 i = 0; i < items; i++) {
            dataLen = _itemLength(memPtr);
            result[i] = RLPItem(dataLen, memPtr);
            memPtr = memPtr + dataLen;
        }

        return result;
    }

    // @return indicator whether encoded payload is a list. negate this function call for isData.
    function isList(RLPItem memory item) internal pure returns (bool) {
        if (item.len == 0) return false;

        uint8 byte0;
        uint256 memPtr = item.memPtr;
        assembly {
            byte0 := byte(0, mload(memPtr))
        }

        if (byte0 < LIST_SHORT_START) return false;
        return true;
    }

    /*
     * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.
     * @return keccak256 hash of RLP encoded bytes.
     */
    function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {
        uint256 ptr = item.memPtr;
        uint256 len = item.len;
        bytes32 result;
        assembly {
            result := keccak256(ptr, len)
        }
        return result;
    }

    function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) {
        uint256 offset = _payloadOffset(item.memPtr);
        uint256 memPtr = item.memPtr + offset;
        uint256 len = item.len - offset; // data length
        return (memPtr, len);
    }

    /*
     * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.
     * @return keccak256 hash of the item payload.
     */
    function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {
        (uint256 memPtr, uint256 len) = payloadLocation(item);
        bytes32 result;
        assembly {
            result := keccak256(memPtr, len)
        }
        return result;
    }

    /** RLPItem conversions into data types **/

    // @returns raw rlp encoding in bytes
    function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {
        bytes memory result = new bytes(item.len);
        if (result.length == 0) return result;

        uint256 ptr;
        assembly {
            ptr := add(0x20, result)
        }

        copy(item.memPtr, ptr, item.len);
        return result;
    }

    // any non-zero byte is considered true
    function toBoolean(RLPItem memory item) internal pure returns (bool) {
        require(item.len == 1);
        uint256 result;
        uint256 memPtr = item.memPtr;
        assembly {
            result := byte(0, mload(memPtr))
        }

        return result == 0 ? false : true;
    }

    function toAddress(RLPItem memory item) internal pure returns (address) {
        // 1 byte for the length prefix
        require(item.len == 21);

        return address(uint160(toUint(item)));
    }

    function toUint(RLPItem memory item) internal pure returns (uint256) {
        require(item.len > 0 && item.len <= 33);

        uint256 offset = _payloadOffset(item.memPtr);
        uint256 len = item.len - offset;

        uint256 result;
        uint256 memPtr = item.memPtr + offset;
        assembly {
            result := mload(memPtr)

            // shfit to the correct location if neccesary
            if lt(len, 32) {
                result := div(result, exp(256, sub(32, len)))
            }
        }

        return result;
    }

    // enforces 32 byte length
    function toUintStrict(RLPItem memory item) internal pure returns (uint256) {
        // one byte prefix
        require(item.len == 33);

        uint256 result;
        uint256 memPtr = item.memPtr + 1;
        assembly {
            result := mload(memPtr)
        }

        return result;
    }

    function toBytes(RLPItem memory item) internal pure returns (bytes memory) {
        require(item.len > 0);

        uint256 offset = _payloadOffset(item.memPtr);
        uint256 len = item.len - offset; // data length
        bytes memory result = new bytes(len);

        uint256 destPtr;
        assembly {
            destPtr := add(0x20, result)
        }

        copy(item.memPtr + offset, destPtr, len);
        return result;
    }

    /*
     * Private Helpers
     */

    // @return number of payload items inside an encoded list.
    function numItems(RLPItem memory item) private pure returns (uint256) {
        if (item.len == 0) return 0;

        uint256 count = 0;
        uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);
        uint256 endPtr = item.memPtr + item.len;
        while (currPtr < endPtr) {
            currPtr = currPtr + _itemLength(currPtr); // skip over an item
            count++;
        }

        return count;
    }

    // @return entire rlp item byte length
    function _itemLength(uint256 memPtr) private pure returns (uint256) {
        uint256 itemLen;
        uint256 byte0;
        assembly {
            byte0 := byte(0, mload(memPtr))
        }

        if (byte0 < STRING_SHORT_START) itemLen = 1;
        else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1;
        else if (byte0 < LIST_SHORT_START) {
            assembly {
                let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is
                memPtr := add(memPtr, 1) // skip over the first byte
                /* 32 byte word size */
                let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len
                itemLen := add(dataLen, add(byteLen, 1))
            }
        } else if (byte0 < LIST_LONG_START) {
            itemLen = byte0 - LIST_SHORT_START + 1;
        } else {
            assembly {
                let byteLen := sub(byte0, 0xf7)
                memPtr := add(memPtr, 1)

                let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length
                itemLen := add(dataLen, add(byteLen, 1))
            }
        }

        return itemLen;
    }

    // @return number of bytes until the data
    function _payloadOffset(uint256 memPtr) private pure returns (uint256) {
        uint256 byte0;
        assembly {
            byte0 := byte(0, mload(memPtr))
        }

        if (byte0 < STRING_SHORT_START) return 0;
        else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1;
        else if (byte0 < LIST_SHORT_START)
            // being explicit
            return byte0 - (STRING_LONG_START - 1) + 1;
        else return byte0 - (LIST_LONG_START - 1) + 1;
    }

    /*
     * @param src Pointer to source
     * @param dest Pointer to destination
     * @param len Amount of memory to copy from the source
     */
    function copy(
        uint256 src,
        uint256 dest,
        uint256 len
    ) private pure {
        if (len == 0) return;

        // copy as many word sizes as possible
        for (; len >= WORD_SIZE; len -= WORD_SIZE) {
            assembly {
                mstore(dest, mload(src))
            }

            src += WORD_SIZE;
            dest += WORD_SIZE;
        }

        if (len == 0) return;

        // left over bytes. Mask is used to remove unwanted bytes from the word
        uint256 mask = 256**(WORD_SIZE - len) - 1;

        assembly {
            let srcpart := and(mload(src), not(mask)) // zero out src
            let destpart := and(mload(dest), mask) // retrieve the bytes
            mstore(dest, or(destpart, srcpart))
        }
    }
}

File 16 of 18 : MerklePatriciaProof.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {RLPReader} from "./RLPReader.sol";

library MerklePatriciaProof {
    /*
     * @dev Verifies a merkle patricia proof.
     * @param value The terminating value in the trie.
     * @param encodedPath The path in the trie leading to value.
     * @param rlpParentNodes The rlp encoded stack of nodes.
     * @param root The root hash of the trie.
     * @return The boolean validity of the proof.
     */
    function verify(
        bytes memory value,
        bytes memory encodedPath,
        bytes memory rlpParentNodes,
        bytes32 root
    ) internal pure returns (bool) {
        RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes);
        RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item);

        bytes memory currentNode;
        RLPReader.RLPItem[] memory currentNodeList;

        bytes32 nodeKey = root;
        uint256 pathPtr = 0;

        bytes memory path = _getNibbleArray(encodedPath);
        if (path.length == 0) {
            return false;
        }

        for (uint256 i = 0; i < parentNodes.length; i++) {
            if (pathPtr > path.length) {
                return false;
            }

            currentNode = RLPReader.toRlpBytes(parentNodes[i]);
            if (nodeKey != keccak256(currentNode)) {
                return false;
            }
            currentNodeList = RLPReader.toList(parentNodes[i]);

            if (currentNodeList.length == 17) {
                if (pathPtr == path.length) {
                    if (keccak256(RLPReader.toBytes(currentNodeList[16])) == keccak256(value)) {
                        return true;
                    } else {
                        return false;
                    }
                }

                uint8 nextPathNibble = uint8(path[pathPtr]);
                if (nextPathNibble > 16) {
                    return false;
                }
                nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[nextPathNibble]));
                pathPtr += 1;
            } else if (currentNodeList.length == 2) {
                uint256 traversed = _nibblesToTraverse(RLPReader.toBytes(currentNodeList[0]), path, pathPtr);
                if (pathPtr + traversed == path.length) {
                    //leaf node
                    if (keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value)) {
                        return true;
                    } else {
                        return false;
                    }
                }

                //extension node
                if (traversed == 0) {
                    return false;
                }

                pathPtr += traversed;
                nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1]));
            } else {
                return false;
            }
        }
    }

    function _nibblesToTraverse(
        bytes memory encodedPartialPath,
        bytes memory path,
        uint256 pathPtr
    ) private pure returns (uint256) {
        uint256 len = 0;
        // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath
        // and slicedPath have elements that are each one hex character (1 nibble)
        bytes memory partialPath = _getNibbleArray(encodedPartialPath);
        bytes memory slicedPath = new bytes(partialPath.length);

        // pathPtr counts nibbles in path
        // partialPath.length is a number of nibbles
        for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) {
            bytes1 pathNibble = path[i];
            slicedPath[i - pathPtr] = pathNibble;
        }

        if (keccak256(partialPath) == keccak256(slicedPath)) {
            len = partialPath.length;
        } else {
            len = 0;
        }
        return len;
    }

    // bytes b must be hp encoded
    function _getNibbleArray(bytes memory b) internal pure returns (bytes memory) {
        bytes memory nibbles = "";
        if (b.length > 0) {
            uint8 offset;
            uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b));
            if (hpNibble == 1 || hpNibble == 3) {
                nibbles = new bytes(b.length * 2 - 1);
                bytes1 oddNibble = _getNthNibbleOfBytes(1, b);
                nibbles[0] = oddNibble;
                offset = 1;
            } else {
                nibbles = new bytes(b.length * 2 - 2);
                offset = 0;
            }

            for (uint256 i = offset; i < nibbles.length; i++) {
                nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b);
            }
        }
        return nibbles;
    }

    function _getNthNibbleOfBytes(uint256 n, bytes memory str) private pure returns (bytes1) {
        return bytes1(n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10);
    }
}

File 17 of 18 : Merkle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Merkle {
    function checkMembership(
        bytes32 leaf,
        uint256 index,
        bytes32 rootHash,
        bytes memory proof
    ) internal pure returns (bool) {
        require(proof.length % 32 == 0, "Invalid proof length");
        uint256 proofHeight = proof.length / 32;
        // Proof of size n means, height of the tree is n+1.
        // In a tree of height n+1, max #leafs possible is 2 ^ n
        require(index < 2**proofHeight, "Leaf index is too big");

        bytes32 proofElement;
        bytes32 computedHash = leaf;
        for (uint256 i = 32; i <= proof.length; i += 32) {
            assembly {
                proofElement := mload(add(proof, i))
            }

            if (index % 2 == 0) {
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }

            index = index / 2;
        }
        return computedHash == rootHash;
    }
}

File 18 of 18 : ExitPayloadReader.sol
pragma solidity ^0.8.0;

import {RLPReader} from "./RLPReader.sol";

library ExitPayloadReader {
    using RLPReader for bytes;
    using RLPReader for RLPReader.RLPItem;

    uint8 constant WORD_SIZE = 32;

    struct ExitPayload {
        RLPReader.RLPItem[] data;
    }

    struct Receipt {
        RLPReader.RLPItem[] data;
        bytes raw;
        uint256 logIndex;
    }

    struct Log {
        RLPReader.RLPItem data;
        RLPReader.RLPItem[] list;
    }

    struct LogTopics {
        RLPReader.RLPItem[] data;
    }

    // copy paste of private copy() from RLPReader to avoid changing of existing contracts
    function copy(
        uint256 src,
        uint256 dest,
        uint256 len
    ) private pure {
        if (len == 0) return;

        // copy as many word sizes as possible
        for (; len >= WORD_SIZE; len -= WORD_SIZE) {
            assembly {
                mstore(dest, mload(src))
            }

            src += WORD_SIZE;
            dest += WORD_SIZE;
        }

        // left over bytes. Mask is used to remove unwanted bytes from the word
        uint256 mask = 256**(WORD_SIZE - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask)) // zero out src
            let destpart := and(mload(dest), mask) // retrieve the bytes
            mstore(dest, or(destpart, srcpart))
        }
    }

    function toExitPayload(bytes memory data) internal pure returns (ExitPayload memory) {
        RLPReader.RLPItem[] memory payloadData = data.toRlpItem().toList();

        return ExitPayload(payloadData);
    }

    function getHeaderNumber(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[0].toUint();
    }

    function getBlockProof(ExitPayload memory payload) internal pure returns (bytes memory) {
        return payload.data[1].toBytes();
    }

    function getBlockNumber(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[2].toUint();
    }

    function getBlockTime(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[3].toUint();
    }

    function getTxRoot(ExitPayload memory payload) internal pure returns (bytes32) {
        return bytes32(payload.data[4].toUint());
    }

    function getReceiptRoot(ExitPayload memory payload) internal pure returns (bytes32) {
        return bytes32(payload.data[5].toUint());
    }

    function getReceipt(ExitPayload memory payload) internal pure returns (Receipt memory receipt) {
        receipt.raw = payload.data[6].toBytes();
        RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();

        if (receiptItem.isList()) {
            // legacy tx
            receipt.data = receiptItem.toList();
        } else {
            // pop first byte before parsting receipt
            bytes memory typedBytes = receipt.raw;
            bytes memory result = new bytes(typedBytes.length - 1);
            uint256 srcPtr;
            uint256 destPtr;
            assembly {
                srcPtr := add(33, typedBytes)
                destPtr := add(0x20, result)
            }

            copy(srcPtr, destPtr, result.length);
            receipt.data = result.toRlpItem().toList();
        }

        receipt.logIndex = getReceiptLogIndex(payload);
        return receipt;
    }

    function getReceiptProof(ExitPayload memory payload) internal pure returns (bytes memory) {
        return payload.data[7].toBytes();
    }

    function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns (bytes memory) {
        return payload.data[8].toBytes();
    }

    function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[8].toUint();
    }

    function getReceiptLogIndex(ExitPayload memory payload) internal pure returns (uint256) {
        return payload.data[9].toUint();
    }

    // Receipt methods
    function toBytes(Receipt memory receipt) internal pure returns (bytes memory) {
        return receipt.raw;
    }

    function getLog(Receipt memory receipt) internal pure returns (Log memory) {
        RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];
        return Log(logData, logData.toList());
    }

    // Log methods
    function getEmitter(Log memory log) internal pure returns (address) {
        return RLPReader.toAddress(log.list[0]);
    }

    function getTopics(Log memory log) internal pure returns (LogTopics memory) {
        return LogTopics(log.list[1].toList());
    }

    function getData(Log memory log) internal pure returns (bytes memory) {
        return log.list[2].toBytes();
    }

    function toRlpBytes(Log memory log) internal pure returns (bytes memory) {
        return log.data.toRlpBytes();
    }

    // LogTopics methods
    function getField(LogTopics memory topics, uint256 index) internal pure returns (RLPReader.RLPItem memory) {
        return topics.data[index];
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 500,
    "details": {
      "yul": false
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_checkpointManager","type":"address"},{"internalType":"address","name":"_fxRoot","type":"address"},{"internalType":"address","name":"_vendorContractAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"CannotApproveAll","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"Nontransferable","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MINTED","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARDS_CLAIM","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEND_MESSAGE_EVENT_SIG","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"message","type":"bytes"}],"name":"_processMessageFromChildTest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpointManager","outputs":[{"internalType":"contract ICheckpointManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expiresAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxChildTunnel","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxRoot","outputs":[{"internalType":"contract IFxStateSender","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liveAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"proPassMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"proPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"processedExits","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"inputData","type":"bytes"}],"name":"receiveMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fxChildTunnel","type":"address"}],"name":"setFxChildTunnel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_liveAt","type":"uint256"},{"internalType":"uint256","name":"_expiresAt","type":"uint256"}],"name":"setMintWindow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proPrice","type":"uint256"}],"name":"setProPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vendorContractAddress","type":"address"}],"name":"setVendorContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vendorContract","outputs":[{"internalType":"contract IBrawlerBearzDynamicItems","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

61010060405260436080818152906200486d60a03980516200002a91600e91602090910190620001d5565b50666a94d74f430000600f55601080546001600160a01b0319167339bfa2b4319581bc885a2d4b9f0c90c2e1c24b871790556364aece006011556364c537806012553480156200007957600080fd5b50604051620048b0380380620048b08339810160408190526200009c91620002b5565b604080518082018252601d81527f427261776c657220426561727a20426174746c6520506173733a2053330000006020808301918252835180850190945260068085526542424250533360d01b91850191909152600180546001600160a01b03808a166001600160a01b03199283161790925560008054928916929091169190911790558251929392620001319290620001d5565b50805162000147906007906020840190620001d5565b50506001600455506200015a3362000183565b600d80546001600160a01b0319166001600160a01b039290921691909117905550620003549050565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620001e39062000323565b90600052602060002090601f01602090048101928262000207576000855562000252565b82601f106200022257805160ff191683800117855562000252565b8280016001018555821562000252579182015b828111156200025257825182559160200191906001019062000235565b506200026092915062000264565b5090565b5b8082111562000260576000815560010162000265565b60006001600160a01b0382165b92915050565b62000299816200027b565b8114620002a557600080fd5b50565b805162000288816200028e565b600080600060608486031215620002cf57620002cf600080fd5b6000620002dd8686620002a8565b9350506020620002f086828701620002a8565b92505060406200030386828701620002a8565b9150509250925092565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806200033857607f821691505b602082108114156200034e576200034e6200030d565b50919050565b61450980620003646000396000f3fe6080604052600436106102c25760003560e01c8063715018a61161017f578063b88d4fde116100e1578063de9b771f1161008a578063f0f4426011610064578063f0f4426014610888578063f2fde38b146108a8578063f953cec7146108c857600080fd5b8063de9b771f146107ff578063e985e9c51461081f578063ea07e68a1461086857600080fd5b8063c23dc68f116100bb578063c23dc68f1461077e578063c3b2ec49146107ab578063c87b56dd146107df57600080fd5b8063b88d4fde1461071c578063b8f7a6651461073c578063c0857ba01461075157600080fd5b806395d89b4111610143578063a22cb4651161011d578063a22cb465146106bc578063a9cdd60d146106dc578063aea4e49e146106fc57600080fd5b806395d89b4114610667578063972c49281461067c57806399a2557a1461069c57600080fd5b8063715018a6146105de5780638462151c146105f35780638622a689146106205780638da5cb5b1461063657806391ccf6911461065457600080fd5b806342842e0e116102285780635bbb2177116101ec5780636255c3ac116101c65780636255c3ac1461057e5780636352211e1461059e57806370a08231146105be57600080fd5b80635bbb217714610501578063607f2d421461052e57806361d027b31461055e57600080fd5b806342842e0e1461047557806342966c681461049557806353b0e17d146104b557806353f8bb9a146104cb57806355f804b3146104e157600080fd5b80630f8677511161028a5780633ccfd60b116102645780633ccfd60b1461040c5780633d58e62e146104215780633e9c7f691461044157600080fd5b80630f867751146103af57806318160ddd146103cf57806323b872dd146103ec57600080fd5b806301ffc9a7146102c757806306fdde03146102fd578063081812fc1461031f578063095ea7b31461034c5780630e387de61461036e575b600080fd5b3480156102d357600080fd5b506102e76102e2366004613319565b6108e8565b6040516102f49190613344565b60405180910390f35b34801561030957600080fd5b5061031261093a565b6040516102f491906133b0565b34801561032b57600080fd5b5061033f61033a3660046133d2565b6109cc565b6040516102f4919061340d565b34801561035857600080fd5b5061036c61036736600461342f565b610a10565b005b34801561037a57600080fd5b506103a27f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03681565b6040516102f49190613472565b3480156103bb57600080fd5b5061036c6103ca366004613480565b610acd565b3480156103db57600080fd5b5060055460045403600019016103a2565b3480156103f857600080fd5b5061036c6104073660046134a2565b610b0b565b34801561041857600080fd5b5061036c610cd0565b34801561042d57600080fd5b5061036c61043c3660046135e5565b610d7e565b34801561044d57600080fd5b506103a27f5a1aa6b3e98d297b5b07a16097bb7f47aa9c559c07c644e033b9aa6ae369025281565b34801561048157600080fd5b5061036c6104903660046134a2565b610e11565b3480156104a157600080fd5b5061036c6104b03660046133d2565b610e2c565b3480156104c157600080fd5b506103a2600f5481565b3480156104d757600080fd5b506103a260115481565b3480156104ed57600080fd5b5061036c6104fc366004613672565b610e37565b34801561050d57600080fd5b5061052161051c36600461375d565b610e6d565b6040516102f4919061385a565b34801561053a57600080fd5b506102e76105493660046133d2565b60036020526000908152604090205460ff1681565b34801561056a57600080fd5b5060105461033f906001600160a01b031681565b34801561058a57600080fd5b5061036c6105993660046133d2565b610f3b565b3480156105aa57600080fd5b5061033f6105b93660046133d2565b610f6a565b3480156105ca57600080fd5b506103a26105d936600461386b565b610f75565b3480156105ea57600080fd5b5061036c610fc4565b3480156105ff57600080fd5b5061061361060e36600461386b565b610ffa565b6040516102f491906138de565b34801561062c57600080fd5b506103a260125481565b34801561064257600080fd5b50600c546001600160a01b031661033f565b61036c6106623660046133d2565b61110a565b34801561067357600080fd5b506103126112cd565b34801561068857600080fd5b5060025461033f906001600160a01b031681565b3480156106a857600080fd5b506106136106b73660046138ef565b6112dc565b3480156106c857600080fd5b5061036c6106d7366004613937565b611468565b3480156106e857600080fd5b5061036c6106f736600461386b565b611481565b34801561070857600080fd5b5061036c61071736600461386b565b6114cd565b34801561072857600080fd5b5061036c61073736600461396a565b611519565b34801561074857600080fd5b506102e7611563565b34801561075d57600080fd5b50600154610771906001600160a01b031681565b6040516102f49190613a08565b34801561078a57600080fd5b5061079e6107993660046133d2565b61157c565b6040516102f49190613a16565b3480156107b757600080fd5b506103a27f306c27fde4d30e93105afde87f5773b4557f5fcbd91b3f18aedef29a5e80fd2881565b3480156107eb57600080fd5b506103126107fa3660046133d2565b611604565b34801561080b57600080fd5b50600054610771906001600160a01b031681565b34801561082b57600080fd5b506102e761083a366004613a24565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b34801561087457600080fd5b50600d54610771906001600160a01b031681565b34801561089457600080fd5b5061036c6108a336600461386b565b61165f565b3480156108b457600080fd5b5061036c6108c336600461386b565b6116ab565b3480156108d457600080fd5b5061036c6108e33660046135e5565b611704565b60006301ffc9a760e01b6001600160e01b03198316148061091957506380ac58cd60e01b6001600160e01b03198316145b806109345750635b5e139f60e01b6001600160e01b03198316145b92915050565b60606006805461094990613a6d565b80601f016020809104026020016040519081016040528092919081815260200182805461097590613a6d565b80156109c25780601f10610997576101008083540402835291602001916109c2565b820191906000526020600020905b8154815290600101906020018083116109a557829003601f168201915b5050505050905090565b60006109d78261171e565b6109f4576040516333d1c03960e21b815260040160405180910390fd5b506000908152600a60205260409020546001600160a01b031690565b6000610a1b82610f6a565b9050336001600160a01b03821614610a71576001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff16610a71576040516367d9dca160e11b815260040160405180910390fd5b6000828152600a602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600c546001600160a01b03163314610b005760405162461bcd60e51b8152600401610af790613ac9565b60405180910390fd5b601191909155601255565b6000610b1682611753565b9050836001600160a01b0316816001600160a01b031614610b495760405162a1148160e81b815260040160405180910390fd5b6000828152600a602052604090208054610b758187335b6001600160a01b039081169116811491141790565b610bbd576001600160a01b0386166000908152600b6020908152604080832033845290915290205460ff16610bbd57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610be457604051633a954ecd60e21b815260040160405180910390fd5b610bf186868660016117bc565b8015610bfc57600082555b6001600160a01b038681166000908152600960205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260086020526040902055600160e11b8316610c875760018401600081815260086020526040902054610c85576004548114610c855760008181526008602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b600c546001600160a01b03163314610cfa5760405162461bcd60e51b8152600401610af790613ac9565b6010546040516000916001600160a01b0316904790610d1890613ad9565b60006040518083038185875af1925050503d8060008114610d55576040519150601f19603f3d011682016040523d82523d6000602084013e610d5a565b606091505b5050905080610d7b5760405162461bcd60e51b8152600401610af790613afb565b50565b600c546001600160a01b03163314610da85760405162461bcd60e51b8152600401610af790613ac9565b60008082806020019051810190610dbf9190613b6e565b915091507f306c27fde4d30e93105afde87f5773b4557f5fcbd91b3f18aedef29a5e80fd28821415610df957610df4816117ff565b505050565b60405162461bcd60e51b8152600401610af790613bf0565b610df483838360405180602001604052806000815250611519565b610d7b816001611883565b600c546001600160a01b03163314610e615760405162461bcd60e51b8152600401610af790613ac9565b610df4600e838361325e565b805160609060008167ffffffffffffffff811115610e8d57610e8d6134f2565b604051908082528060200260200182016040528015610edf57816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610eab5790505b50905060005b828114610f3357610f0e858281518110610f0157610f01613c00565b602002602001015161157c565b828281518110610f2057610f20613c00565b6020908102919091010152600101610ee5565b509392505050565b600c546001600160a01b03163314610f655760405162461bcd60e51b8152600401610af790613ac9565b600f55565b600061093482611753565b60006001600160a01b038216610f9e576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526009602052604090205467ffffffffffffffff1690565b600c546001600160a01b03163314610fee5760405162461bcd60e51b8152600401610af790613ac9565b610ff860006119f2565b565b6060600080600061100a85610f75565b905060008167ffffffffffffffff811115611027576110276134f2565b604051908082528060200260200182016040528015611050578160200160208202803683370190505b50905061107d60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b8386146110fe5761109081611a44565b91508160400151156110a1576110f6565b81516001600160a01b0316156110b657815194505b876001600160a01b0316856001600160a01b031614156110f657808387806001019850815181106110e9576110e9613c00565b6020026020010181815250505b600101611080565b50909695505050505050565b6011544211801561111c575060125442105b6111385760405162461bcd60e51b8152600401610af790613c4a565b600f546111459082613c70565b3410156111645760405162461bcd60e51b8152600401610af790613cc3565b3361116f8183611ac3565b60008267ffffffffffffffff81111561118a5761118a6134f2565b6040519080825280602002602001820160405280156111b3578160200160208202803683370190505b50905060005b838110156111f25760d38282815181106111d5576111d5613c00565b6020908102919091010152806111ea81613cd3565b9150506111b9565b50600d546040516311b211c160e31b81526001600160a01b0390911690638d908e08906112259085908590600401613cee565b600060405180830381600087803b15801561123f57600080fd5b505af1158015611253573d6000803e3d6000fd5b50505050610df47f5a1aa6b3e98d297b5b07a16097bb7f47aa9c559c07c644e033b9aa6ae36902528361128560045490565b60018760405160200161129b9493929190613d0e565b60408051601f19818403018152908290526112b99291602001613d4c565b604051602081830303815290604052611bad565b60606007805461094990613a6d565b60608183106112fe57604051631960ccad60e11b815260040160405180910390fd5b60008061130a60045490565b9050600185101561131a57600194505b80841115611326578093505b600061133187610f75565b905084861015611350578585038181101561134a578091505b50611354565b5060005b60008167ffffffffffffffff81111561136f5761136f6134f2565b604051908082528060200260200182016040528015611398578160200160208202803683370190505b509050816113ab57935061146192505050565b60006113b68861157c565b9050600081604001516113c7575080515b885b8881141580156113d95750848714155b15611455576113e781611a44565b92508260400151156113f85761144d565b82516001600160a01b03161561140d57825191505b8a6001600160a01b0316826001600160a01b0316141561144d578084888060010199508151811061144057611440613c00565b6020026020010181815250505b6001016113c9565b50505092835250909150505b9392505050565b6040516301473cbb60e71b815260040160405180910390fd5b600c546001600160a01b031633146114ab5760405162461bcd60e51b8152600401610af790613ac9565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b031633146114f75760405162461bcd60e51b8152600401610af790613ac9565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b611524848484610b0b565b6001600160a01b0383163b1561155d5761154084848484611c18565b61155d576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b600060115442118015611577575060125442105b905090565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806115d557506004548310155b156115e05792915050565b6115e983611a44565b90508060400151156115fb5792915050565b61146183611d10565b606061160f8261171e565b61162c57604051636f96cda160e11b815260040160405180910390fd5b600e6116386001611d88565b604051602001611649929190613df9565b6040516020818303038152906040529050919050565b600c546001600160a01b031633146116895760405162461bcd60e51b8152600401610af790613ac9565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b031633146116d55760405162461bcd60e51b8152600401610af790613ac9565b6001600160a01b0381166116fb5760405162461bcd60e51b8152600401610af790613e57565b610d7b816119f2565b600061170f82611e86565b905061171a81610da8565b5050565b600081600111158015611732575060045482105b8015610934575050600090815260086020526040902054600160e01b161590565b600081806001116117a3576004548110156117a357600081815260086020526040902054600160e01b81166117a1575b80611461575060001901600081815260086020526040902054611783565b505b604051636f96cda160e11b815260040160405180910390fd5b6001600160a01b038316158015906117dc57506001600160a01b03841615155b156117fa5760405163399f41e760e01b815260040160405180910390fd5b61155d565b600080828060200190518101906118169190613ee7565b600d546040516311b211c160e31b81529294509092506001600160a01b031690638d908e089061184c9085908590600401613cee565b600060405180830381600087803b15801561186657600080fd5b505af115801561187a573d6000803e3d6000fd5b50505050505050565b600061188e83611753565b9050806000806118ac866000908152600a6020526040902080549091565b915091508415611909576118c1818433610b60565b611909576001600160a01b0383166000908152600b6020908152604080832033845290915290205460ff1661190957604051632ce44b5f60e11b815260040160405180910390fd5b6119178360008860016117bc565b801561192257600082555b6001600160a01b038316600081815260096020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260086020526040902055600160e11b84166119a957600186016000818152600860205260409020546119a75760045481146119a75760008181526008602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060058054600101905550505050565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60408051608081018252600080825260208201819052918101829052606081019190915260008281526008602052604090205461093490604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6004546001600160a01b038316611aec57604051622e076360e81b815260040160405180910390fd5b81611b0a5760405163b562e8dd60e01b815260040160405180910390fd5b611b1760008483856117bc565b6001600160a01b038316600081815260096020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260086020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611b615760045550505050565b60005460025460405163b472047760e01b81526001600160a01b039283169263b472047792611be3929116908590600401613f35565b600060405180830381600087803b158015611bfd57600080fd5b505af1158015611c11573d6000803e3d6000fd5b5050505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611c4d903390899088908890600401613f43565b602060405180830381600087803b158015611c6757600080fd5b505af1925050508015611c97575060408051601f3d908101601f19168201909252611c9491810190613f92565b60015b611cf2573d808015611cc5576040519150601f19603f3d011682016040523d82523d6000602084013e611cca565b606091505b508051611cea576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610934611d4083611753565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b606081611dac5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611dd65780611dc081613cd3565b9150611dcf9050600a83613fc9565b9150611db0565b60008167ffffffffffffffff811115611df157611df16134f2565b6040519080825280601f01601f191660200182016040528015611e1b576020820181803683370190505b5090505b8415611d0857611e30600183613fe1565b9150611e3d600a86613ffc565b611e48906030614014565b60f81b818381518110611e5d57611e5d613c00565b60200101906001600160f81b031916908160001a905350611e7f600a86613fc9565b9450611e1f565b60606000611e9383612086565b90506000611ea0826120e5565b90506000611ead8361210e565b9050600081611ebb84612137565b611ec4866122f5565b604051602001611ed69392919061402c565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff1615611f1e5760405162461bcd60e51b8152600401610af7906140a0565b6000818152600360205260408120805460ff19166001179055611f4085612311565b90506000611f4d8261245b565b9050611f58816124eb565b6002546001600160a01b03908116911614611f855760405162461bcd60e51b8152600401610af7906140f2565b6000611f9087612514565b9050611fb0611fa0846020015190565b87611faa8a612530565b8461254c565b611fcc5760405162461bcd60e51b8152600401610af790614142565b611ffa85611fd989612802565b611fe28a61281e565b84611fec8c61283a565b611ff58d612856565b612872565b5060006120068361297a565b90507f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03661203c6120378360006129b6565b6129ee565b146120595760405162461bcd60e51b8152600401610af790614186565b600061206484612a69565b8060200190518101906120779190614196565b9b9a5050505050505050505050565b60408051602081019091526060815260006120d06120cb8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b612a85565b60408051602081019091529081529392505050565b6060610934826000015160088151811061210157612101613c00565b6020026020010151612b9b565b6000610934826000015160028151811061212a5761212a613c00565b60200260200101516129ee565b604080516020810190915260008152815160609190156109345760008061215f600086612c38565b60f81c9050600181148061217657508060ff166003145b1561221e5760018551600261218b9190613c70565b6121959190613fe1565b67ffffffffffffffff8111156121ad576121ad6134f2565b6040519080825280601f01601f1916602001820160405280156121d7576020820181803683370190505b50925060006121e7600187612c38565b905080846000815181106121fd576121fd613c00565b60200101906001600160f81b031916908160001a9053506001925050612282565b60028551600261222e9190613c70565b6122389190613fe1565b67ffffffffffffffff811115612250576122506134f2565b6040519080825280601f01601f19166020018201604052801561227a576020820181803683370190505b509250600091505b60ff82165b83518110156122ec576122b16122a060ff851683613fe1565b6122ab906002614014565b87612c38565b8482815181106122c3576122c3613c00565b60200101906001600160f81b031916908160001a905350806122e481613cd3565b915050612287565b50505092915050565b6000610934826000015160098151811061212a5761212a613c00565b61233560405180606001604052806060815260200160608152602001600081525090565b61234f826000015160068151811061210157612101613c00565b60208281018290526040805180820182526000808252908301528051808201909152825181529181019082015261238581612cb9565b1561239a5761239381612a85565b8252612447565b602082015180516000906123b090600190613fe1565b67ffffffffffffffff8111156123c8576123c86134f2565b6040519080825280601f01601f1916602001820160405280156123f2576020820181803683370190505b50905060008083602101915082602001905061241082828551612cf2565b60408051808201825260008082526020918201528151808301909252845182528085019082015261244090612a85565b8652505050505b612450836122f5565b604083015250919050565b6040805160808101825260009181018281526060808301939093528152602081019190915260006124a9836000015160038151811061249c5761249c613c00565b6020026020010151612a85565b8360400151815181106124be576124be613c00565b6020026020010151905060405180604001604052808281526020016124e283612a85565b90529392505050565b6000610934826020015160008151811061250757612507613c00565b6020026020010151612d6d565b6000610934826000015160058151811061212a5761212a613c00565b6060610934826000015160078151811061210157612101613c00565b6000806125808460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9050600061258d82612a85565b90506060808560008061259f8b612137565b90508051600014156125bb576000975050505050505050611d08565b60005b86518110156127f25781518311156125e157600098505050505050505050611d08565b6126038782815181106125f6576125f6613c00565b6020026020010151612d87565b95508580519060200120841461262457600098505050505050505050611d08565b61263987828151811061249c5761249c613c00565b945084516011141561270e57815183141561269b578c8051906020012061266c8660108151811061210157612101613c00565b80519060200120141561268a57600198505050505050505050611d08565b600098505050505050505050611d08565b60008284815181106126af576126af613c00565b016020015160f81c905060108111156126d45760009950505050505050505050611d08565b6126f9868260ff16815181106126ec576126ec613c00565b6020026020010151612e07565b9450612706600185614014565b9350506127e0565b84516002141561268a57600061273a6127338760008151811061210157612101613c00565b8486612e35565b83519091506127498286614014565b141561279e578d8051906020012061276d8760018151811061210157612101613c00565b80519060200120141561278c5760019950505050505050505050611d08565b60009950505050505050505050611d08565b806127b55760009950505050505050505050611d08565b6127bf8185614014565b93506127d7866001815181106126ec576126ec613c00565b94506127e09050565b806127ea81613cd3565b9150506125be565b5050505050505050949350505050565b6000610934826000015160038151811061212a5761212a613c00565b6000610934826000015160048151811061212a5761212a613c00565b6000610934826000015160008151811061212a5761212a613c00565b6060610934826000015160018151811061210157612101613c00565b6001546040516320a9cea560e11b81526000918291829182916001600160a01b03909116906341539d4a906128ab908990600401613472565b60a06040518083038186803b1580156128c357600080fd5b505afa1580156128d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128fb91906141d1565b5093505092509250612951828b6129129190613fe1565b84878d8d8d8d60405160200161292b9493929190614249565b60405160208183030381529060405280519060200120612f56909392919063ffffffff16565b61296d5760405162461bcd60e51b8152600401610af7906142c5565b9998505050505050505050565b60408051602081019091526060815260405180602001604052806129ae846020015160018151811061249c5761249c613c00565b905292915050565b604080518082019091526000808252602082015282518051839081106129de576129de613c00565b6020026020010151905092915050565b805160009015801590612a0357508151602110155b612a0c57600080fd5b6000612a1b836020015161306a565b90506000818460000151612a2f9190613fe1565b9050600080838660200151612a449190614014565b9050805191506020831015612a6057826020036101000a820491505b50949350505050565b6060610934826020015160028151811061210157612101613c00565b6060612a9082612cb9565b612a9957600080fd5b6000612aa4836130eb565b905060008167ffffffffffffffff811115612ac157612ac16134f2565b604051908082528060200260200182016040528015612b0657816020015b6040805180820190915260008082526020820152815260200190600190039081612adf5790505b5090506000612b18856020015161306a565b8560200151612b279190614014565b90506000805b84811015612b9057612b3e8361316e565b9150604051806040016040528083815260200184815250848281518110612b6757612b67613c00565b6020908102919091010152612b7c8284614014565b925080612b8881613cd3565b915050612b2d565b509195945050505050565b8051606090612ba957600080fd5b6000612bb8836020015161306a565b90506000818460000151612bcc9190613fe1565b905060008167ffffffffffffffff811115612be957612be96134f2565b6040519080825280601f01601f191660200182016040528015612c13576020820181803683370190505b5090506000816020019050612a60848760200151612c319190614014565b8285613212565b6000612c45600284613ffc565b15612c7f57601082612c58600286613fc9565b81518110612c6857612c68613c00565b0160200151612c7a919060f81c6142d5565b612caf565b601082612c8d600286613fc9565b81518110612c9d57612c9d613c00565b0160200151612caf919060f81c6142e6565b60f81b9392505050565b8051600090612cca57506000919050565b6020820151805160001a9060c0821015612ce8575060009392505050565b5060019392505050565b80612cfc57505050565b60208110612d345782518252612d13602084614014565b9250612d20602083614014565b9150612d2d602082613fe1565b9050612cfc565b60006001612d43836020613fe1565b612d4f90610100614405565b612d599190613fe1565b935183518516941916939093179091525050565b8051600090601514612d7e57600080fd5b610934826129ee565b60606000826000015167ffffffffffffffff811115612da857612da86134f2565b6040519080825280601f01601f191660200182016040528015612dd2576020820181803683370190505b509050805160001415612de55792915050565b6000816020019050612e008460200151828660000151613212565b5092915050565b8051600090602114612e1857600080fd5b60008083602001516001612e2c9190614014565b51949350505050565b60008080612e4286612137565b90506000815167ffffffffffffffff811115612e6057612e606134f2565b6040519080825280601f01601f191660200182016040528015612e8a576020820181803683370190505b509050845b8251612e9b9087614014565b811015612f26576000878281518110612eb657612eb6613c00565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690508083612eeb8985613fe1565b81518110612efb57612efb613c00565b60200101906001600160f81b031916908160001a905350508080612f1e90613cd3565b915050612e8f565b50808051906020012082805190602001201415612f465781519250612f4b565b600092505b509095945050505050565b600060208251612f669190613ffc565b15612f835760405162461bcd60e51b8152600401610af790614448565b600060208351612f939190613fc9565b9050612fa0816002614405565b8510612fbe5760405162461bcd60e51b8152600401610af79061448c565b60008660205b8551811161305c57858101519250612fdd600289613ffc565b613011578183604051602001612ff492919061449c565b60405160208183030381529060405280519060200120915061303d565b828260405160200161302492919061449c565b6040516020818303038152906040528051906020012091505b613048600289613fc9565b9750613055602082614014565b9050612fc4565b509094149695505050505050565b8051600090811a60808110156130835750600092915050565b60b881108061309e575060c0811080159061309e575060f881105b156130ac5750600192915050565b60c08110156130d9576130c1600160b86144c2565b6130ce9060ff1682613fe1565b611461906001614014565b6130c1600160f86144c2565b50919050565b80516000906130fc57506000919050565b60008061310c846020015161306a565b846020015161311b9190614014565b90506000846000015185602001516131339190614014565b90505b80821015613165576131478261316e565b6131519083614014565b91508261315d81613cd3565b935050613136565b50909392505050565b80516000908190811a60808110156131895760019150612e00565b60b88110156131af5761319d608082613fe1565b6131a8906001614014565b9150612e00565b60c08110156131dc5760b78103600185019450806020036101000a85510460018201810193505050612e00565b60f88110156131f05761319d60c082613fe1565b60019390930151602084900360f7016101000a900490920160f5190192915050565b8061321c57505050565b602081106132545782518252613233602084614014565b9250613240602083614014565b915061324d602082613fe1565b905061321c565b80612d3457505050565b82805461326a90613a6d565b90600052602060002090601f01602090048101928261328c57600085556132d2565b82601f106132a55782800160ff198235161785556132d2565b828001600101855582156132d2579182015b828111156132d25782358255916020019190600101906132b7565b506132de9291506132e2565b5090565b5b808211156132de57600081556001016132e3565b6001600160e01b031981165b8114610d7b57600080fd5b8035610934816132f7565b60006020828403121561332e5761332e600080fd5b6000611d08848461330e565b8015155b82525050565b60208101610934828461333a565b60005b8381101561336d578181015183820152602001613355565b8381111561155d5750506000910152565b6000613388825190565b80845260208401935061339f818560208601613352565b601f01601f19169290920192915050565b60208082528101611461818461337e565b80613303565b8035610934816133c1565b6000602082840312156133e7576133e7600080fd5b6000611d0884846133c7565b60006001600160a01b038216610934565b61333e816133f3565b602081016109348284613404565b613303816133f3565b80356109348161341b565b6000806040838503121561344557613445600080fd5b60006134518585613424565b9250506020613462858286016133c7565b9150509250929050565b8061333e565b60208101610934828461346c565b6000806040838503121561349657613496600080fd5b600061345185856133c7565b6000806000606084860312156134ba576134ba600080fd5b60006134c68686613424565b93505060206134d786828701613424565b92505060406134e8868287016133c7565b9150509250925092565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff8211171561352e5761352e6134f2565b6040525050565b600061354060405190565b905061354c8282613508565b919050565b600067ffffffffffffffff82111561356b5761356b6134f2565b601f19601f83011660200192915050565b82818337506000910152565b600061359b61359684613551565b613535565b9050828152602081018484840111156135b6576135b6600080fd5b610f3384828561357c565b600082601f8301126135d5576135d5600080fd5b8135611d08848260208601613588565b6000602082840312156135fa576135fa600080fd5b813567ffffffffffffffff81111561361457613614600080fd5b611d08848285016135c1565b60008083601f84011261363557613635600080fd5b50813567ffffffffffffffff81111561365057613650600080fd5b60208301915083600182028301111561366b5761366b600080fd5b9250929050565b6000806020838503121561368857613688600080fd5b823567ffffffffffffffff8111156136a2576136a2600080fd5b6136ae85828601613620565b92509250509250929050565b600067ffffffffffffffff8211156136d4576136d46134f2565b5060209081020190565b60006136ec613596846136ba565b8381529050602080820190840283018581111561370b5761370b600080fd5b835b8181101561372f578061372088826133c7565b8452506020928301920161370d565b5050509392505050565b600082601f83011261374d5761374d600080fd5b8135611d088482602086016136de565b60006020828403121561377257613772600080fd5b813567ffffffffffffffff81111561378c5761378c600080fd5b611d0884828501613739565b67ffffffffffffffff811661333e565b62ffffff811661333e565b805160808301906137c48482613404565b5060208201516137d76020850182613798565b5060408201516137ea604085018261333a565b50606082015161155d60608501826137a8565b600061380983836137b3565b505060800190565b600061381b825190565b80845260209384019383018060005b8381101561384f57815161383e88826137fd565b97506020830192505060010161382a565b509495945050505050565b602080825281016114618184613811565b60006020828403121561388057613880600080fd5b6000611d088484613424565b6000613898838361346c565b505060200190565b60006138aa825190565b80845260209384019383018060005b8381101561384f5781516138cd888261388c565b9750602083019250506001016138b9565b6020808252810161146181846138a0565b60008060006060848603121561390757613907600080fd5b60006139138686613424565b93505060206134d7868287016133c7565b801515613303565b803561093481613924565b6000806040838503121561394d5761394d600080fd5b60006139598585613424565b92505060206134628582860161392c565b6000806000806080858703121561398357613983600080fd5b600061398f8787613424565b94505060206139a087828801613424565b93505060406139b1878288016133c7565b925050606085013567ffffffffffffffff8111156139d1576139d1600080fd5b6139dd878288016135c1565b91505092959194509250565b6000610934826133f3565b6000610934826139e9565b61333e816139f4565b6020810161093482846139ff565b6080810161093482846137b3565b60008060408385031215613a3a57613a3a600080fd5b6000613a468585613424565b925050602061346285828601613424565b634e487b7160e01b600052602260045260246000fd5b600281046001821680613a8157607f821691505b602082108114156130e5576130e5613a57565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260005b5060200190565b6020808252810161093481613a94565b600081610934565b600381526000602082016239393960e81b81529150613ac2565b6020808252810161093481613ae1565b8051610934816133c1565b6000613b2461359684613551565b905082815260208101848484011115613b3f57613b3f600080fd5b610f33848285613352565b600082601f830112613b5e57613b5e600080fd5b8151611d08848260208601613b16565b60008060408385031215613b8457613b84600080fd5b6000613b908585613b0b565b925050602083015167ffffffffffffffff811115613bb057613bb0600080fd5b61346285828601613b4a565b601181526000602082017f494e56414c49445f53594e435f5459504500000000000000000000000000000081529150613ac2565b6020808252810161093481613bbc565b634e487b7160e01b600052603260045260246000fd5b601681526000602082017f4d696e74696e67206973206e6f74206163746976652e0000000000000000000081529150613ac2565b6020808252810161093481613c16565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613c8a57613c8a613c5a565b500290565b601181526000602082017f4e6f7420656e6f7567682066756e64732e00000000000000000000000000000081529150613ac2565b6020808252810161093481613c8f565b6000600019821415613ce757613ce7613c5a565b5060010190565b60408101613cfc8285613404565b8181036020830152611d0881846138a0565b60808101613d1c8287613404565b613d29602083018661346c565b613d36604083018561346c565b613d43606083018461346c565b95945050505050565b60408101613d5a828561346c565b8181036020830152611d08818461337e565b60008154613d7981613a6d565b600182168015613d905760018114613da1576122ec565b60ff198316865281860193506122ec565b60008581526020902060005b83811015613dc957815488820152600190910190602001613dad565b505050939093019392505050565b6000613de1825190565b613def818560208601613352565b9290920192915050565b6000613e058285613d6c565b9150611d088284613dd7565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015291505b5060400190565b6020808252810161093481613e11565b80516109348161341b565b6000613e80613596846136ba565b83815290506020808201908402830185811115613e9f57613e9f600080fd5b835b8181101561372f5780613eb48882613b0b565b84525060209283019201613ea1565b600082601f830112613ed757613ed7600080fd5b8151611d08848260208601613e72565b60008060408385031215613efd57613efd600080fd5b6000613f098585613e67565b925050602083015167ffffffffffffffff811115613f2957613f29600080fd5b61346285828601613ec3565b60408101613d5a8285613404565b60808101613f518287613404565b613f5e6020830186613404565b613f6b604083018561346c565b8181036060830152613f7d818461337e565b9695505050505050565b8051610934816132f7565b600060208284031215613fa757613fa7600080fd5b6000611d088484613f87565b634e487b7160e01b600052601260045260246000fd5b6000825b925082613fdc57613fdc613fb3565b500490565b6000825b925082821015613ff757613ff7613c5a565b500390565b6000825b92508261400f5761400f613fb3565b500690565b6000821982111561402757614027613c5a565b500190565b6000614038828661346c565b6020820191506140488285613dd7565b9150614054828461346c565b506020019392505050565b602481526000602082017f4678526f6f7454756e6e656c3a20455849545f414c52454144595f50524f434581526314d4d15160e21b60208201529150613e50565b602080825281016109348161405f565b602581526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f46585f4348494c445f54815264155393915360da1b60208201529150613e50565b60208082528101610934816140b0565b602381526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f524543454950545f505281526227a7a360e91b60208201529150613e50565b6020808252810161093481614102565b601f81526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f5349474e41545552450081529150613ac2565b6020808252810161093481614152565b6000602082840312156141ab576141ab600080fd5b815167ffffffffffffffff8111156141c5576141c5600080fd5b611d0884828501613b4a565b600080600080600060a086880312156141ec576141ec600080fd5b60006141f88888613b0b565b955050602061420988828901613b0b565b945050604061421a88828901613b0b565b935050606061422b88828901613b0b565b925050608061423c88828901613e67565b9150509295509295909350565b6000614255828761346c565b602082019150614265828661346c565b602082019150614275828561346c565b602082019150614285828461346c565b50602001949350505050565b601c81526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f4845414445520000000081529150613ac2565b6020808252810161093481614291565b600060ff8216915060ff8316614000565b600060ff8216915060ff8316613fcd565b80825b60018511156143365780860481111561431557614315613c5a565b600185161561432357908102905b800261432f8560011c90565b94506142fa565b94509492505050565b60008261434e57506001611461565b8161435b57506000611461565b8160018114614371576002811461437b576143a8565b6001915050611461565b60ff84111561438c5761438c613c5a565b8360020a9150848211156143a2576143a2613c5a565b50611461565b5060208310610133831016604e8410600b84101617156143db575081810a838111156143d6576143d6613c5a565b611461565b6143e884848460016142f7565b925090508184048111156143fe576143fe613c5a565b0292915050565b6000611461600019848461433f565b601481526000602082017f496e76616c69642070726f6f66206c656e67746800000000000000000000000081529150613ac2565b6020808252810161093481614414565b601581526000602082017f4c65616620696e64657820697320746f6f20626967000000000000000000000081529150613ac2565b6020808252810161093481614458565b60006144a8828561346c565b6020820191506144b8828461346c565b5060200192915050565b600060ff8216915060ff8316613fe556fea2646970667358221220f2e70e772b719c5c74e5ba6071d3e0cc80c1f576ba70e6f7dd21bab2e57e4b2564736f6c63430008090033697066733a2f2f6261667962656962636a6e6169727733616c63363577687476637937766f736a696f6e35637370357a63746e37653467656862716237376b6279652f00000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a2000000000000000000000000bd24a76f4135f930f5c49f6c30e0e30a61b97537

Deployed Bytecode

0x6080604052600436106102c25760003560e01c8063715018a61161017f578063b88d4fde116100e1578063de9b771f1161008a578063f0f4426011610064578063f0f4426014610888578063f2fde38b146108a8578063f953cec7146108c857600080fd5b8063de9b771f146107ff578063e985e9c51461081f578063ea07e68a1461086857600080fd5b8063c23dc68f116100bb578063c23dc68f1461077e578063c3b2ec49146107ab578063c87b56dd146107df57600080fd5b8063b88d4fde1461071c578063b8f7a6651461073c578063c0857ba01461075157600080fd5b806395d89b4111610143578063a22cb4651161011d578063a22cb465146106bc578063a9cdd60d146106dc578063aea4e49e146106fc57600080fd5b806395d89b4114610667578063972c49281461067c57806399a2557a1461069c57600080fd5b8063715018a6146105de5780638462151c146105f35780638622a689146106205780638da5cb5b1461063657806391ccf6911461065457600080fd5b806342842e0e116102285780635bbb2177116101ec5780636255c3ac116101c65780636255c3ac1461057e5780636352211e1461059e57806370a08231146105be57600080fd5b80635bbb217714610501578063607f2d421461052e57806361d027b31461055e57600080fd5b806342842e0e1461047557806342966c681461049557806353b0e17d146104b557806353f8bb9a146104cb57806355f804b3146104e157600080fd5b80630f8677511161028a5780633ccfd60b116102645780633ccfd60b1461040c5780633d58e62e146104215780633e9c7f691461044157600080fd5b80630f867751146103af57806318160ddd146103cf57806323b872dd146103ec57600080fd5b806301ffc9a7146102c757806306fdde03146102fd578063081812fc1461031f578063095ea7b31461034c5780630e387de61461036e575b600080fd5b3480156102d357600080fd5b506102e76102e2366004613319565b6108e8565b6040516102f49190613344565b60405180910390f35b34801561030957600080fd5b5061031261093a565b6040516102f491906133b0565b34801561032b57600080fd5b5061033f61033a3660046133d2565b6109cc565b6040516102f4919061340d565b34801561035857600080fd5b5061036c61036736600461342f565b610a10565b005b34801561037a57600080fd5b506103a27f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03681565b6040516102f49190613472565b3480156103bb57600080fd5b5061036c6103ca366004613480565b610acd565b3480156103db57600080fd5b5060055460045403600019016103a2565b3480156103f857600080fd5b5061036c6104073660046134a2565b610b0b565b34801561041857600080fd5b5061036c610cd0565b34801561042d57600080fd5b5061036c61043c3660046135e5565b610d7e565b34801561044d57600080fd5b506103a27f5a1aa6b3e98d297b5b07a16097bb7f47aa9c559c07c644e033b9aa6ae369025281565b34801561048157600080fd5b5061036c6104903660046134a2565b610e11565b3480156104a157600080fd5b5061036c6104b03660046133d2565b610e2c565b3480156104c157600080fd5b506103a2600f5481565b3480156104d757600080fd5b506103a260115481565b3480156104ed57600080fd5b5061036c6104fc366004613672565b610e37565b34801561050d57600080fd5b5061052161051c36600461375d565b610e6d565b6040516102f4919061385a565b34801561053a57600080fd5b506102e76105493660046133d2565b60036020526000908152604090205460ff1681565b34801561056a57600080fd5b5060105461033f906001600160a01b031681565b34801561058a57600080fd5b5061036c6105993660046133d2565b610f3b565b3480156105aa57600080fd5b5061033f6105b93660046133d2565b610f6a565b3480156105ca57600080fd5b506103a26105d936600461386b565b610f75565b3480156105ea57600080fd5b5061036c610fc4565b3480156105ff57600080fd5b5061061361060e36600461386b565b610ffa565b6040516102f491906138de565b34801561062c57600080fd5b506103a260125481565b34801561064257600080fd5b50600c546001600160a01b031661033f565b61036c6106623660046133d2565b61110a565b34801561067357600080fd5b506103126112cd565b34801561068857600080fd5b5060025461033f906001600160a01b031681565b3480156106a857600080fd5b506106136106b73660046138ef565b6112dc565b3480156106c857600080fd5b5061036c6106d7366004613937565b611468565b3480156106e857600080fd5b5061036c6106f736600461386b565b611481565b34801561070857600080fd5b5061036c61071736600461386b565b6114cd565b34801561072857600080fd5b5061036c61073736600461396a565b611519565b34801561074857600080fd5b506102e7611563565b34801561075d57600080fd5b50600154610771906001600160a01b031681565b6040516102f49190613a08565b34801561078a57600080fd5b5061079e6107993660046133d2565b61157c565b6040516102f49190613a16565b3480156107b757600080fd5b506103a27f306c27fde4d30e93105afde87f5773b4557f5fcbd91b3f18aedef29a5e80fd2881565b3480156107eb57600080fd5b506103126107fa3660046133d2565b611604565b34801561080b57600080fd5b50600054610771906001600160a01b031681565b34801561082b57600080fd5b506102e761083a366004613a24565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b34801561087457600080fd5b50600d54610771906001600160a01b031681565b34801561089457600080fd5b5061036c6108a336600461386b565b61165f565b3480156108b457600080fd5b5061036c6108c336600461386b565b6116ab565b3480156108d457600080fd5b5061036c6108e33660046135e5565b611704565b60006301ffc9a760e01b6001600160e01b03198316148061091957506380ac58cd60e01b6001600160e01b03198316145b806109345750635b5e139f60e01b6001600160e01b03198316145b92915050565b60606006805461094990613a6d565b80601f016020809104026020016040519081016040528092919081815260200182805461097590613a6d565b80156109c25780601f10610997576101008083540402835291602001916109c2565b820191906000526020600020905b8154815290600101906020018083116109a557829003601f168201915b5050505050905090565b60006109d78261171e565b6109f4576040516333d1c03960e21b815260040160405180910390fd5b506000908152600a60205260409020546001600160a01b031690565b6000610a1b82610f6a565b9050336001600160a01b03821614610a71576001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff16610a71576040516367d9dca160e11b815260040160405180910390fd5b6000828152600a602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600c546001600160a01b03163314610b005760405162461bcd60e51b8152600401610af790613ac9565b60405180910390fd5b601191909155601255565b6000610b1682611753565b9050836001600160a01b0316816001600160a01b031614610b495760405162a1148160e81b815260040160405180910390fd5b6000828152600a602052604090208054610b758187335b6001600160a01b039081169116811491141790565b610bbd576001600160a01b0386166000908152600b6020908152604080832033845290915290205460ff16610bbd57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610be457604051633a954ecd60e21b815260040160405180910390fd5b610bf186868660016117bc565b8015610bfc57600082555b6001600160a01b038681166000908152600960205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260086020526040902055600160e11b8316610c875760018401600081815260086020526040902054610c85576004548114610c855760008181526008602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b600c546001600160a01b03163314610cfa5760405162461bcd60e51b8152600401610af790613ac9565b6010546040516000916001600160a01b0316904790610d1890613ad9565b60006040518083038185875af1925050503d8060008114610d55576040519150601f19603f3d011682016040523d82523d6000602084013e610d5a565b606091505b5050905080610d7b5760405162461bcd60e51b8152600401610af790613afb565b50565b600c546001600160a01b03163314610da85760405162461bcd60e51b8152600401610af790613ac9565b60008082806020019051810190610dbf9190613b6e565b915091507f306c27fde4d30e93105afde87f5773b4557f5fcbd91b3f18aedef29a5e80fd28821415610df957610df4816117ff565b505050565b60405162461bcd60e51b8152600401610af790613bf0565b610df483838360405180602001604052806000815250611519565b610d7b816001611883565b600c546001600160a01b03163314610e615760405162461bcd60e51b8152600401610af790613ac9565b610df4600e838361325e565b805160609060008167ffffffffffffffff811115610e8d57610e8d6134f2565b604051908082528060200260200182016040528015610edf57816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610eab5790505b50905060005b828114610f3357610f0e858281518110610f0157610f01613c00565b602002602001015161157c565b828281518110610f2057610f20613c00565b6020908102919091010152600101610ee5565b509392505050565b600c546001600160a01b03163314610f655760405162461bcd60e51b8152600401610af790613ac9565b600f55565b600061093482611753565b60006001600160a01b038216610f9e576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526009602052604090205467ffffffffffffffff1690565b600c546001600160a01b03163314610fee5760405162461bcd60e51b8152600401610af790613ac9565b610ff860006119f2565b565b6060600080600061100a85610f75565b905060008167ffffffffffffffff811115611027576110276134f2565b604051908082528060200260200182016040528015611050578160200160208202803683370190505b50905061107d60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b8386146110fe5761109081611a44565b91508160400151156110a1576110f6565b81516001600160a01b0316156110b657815194505b876001600160a01b0316856001600160a01b031614156110f657808387806001019850815181106110e9576110e9613c00565b6020026020010181815250505b600101611080565b50909695505050505050565b6011544211801561111c575060125442105b6111385760405162461bcd60e51b8152600401610af790613c4a565b600f546111459082613c70565b3410156111645760405162461bcd60e51b8152600401610af790613cc3565b3361116f8183611ac3565b60008267ffffffffffffffff81111561118a5761118a6134f2565b6040519080825280602002602001820160405280156111b3578160200160208202803683370190505b50905060005b838110156111f25760d38282815181106111d5576111d5613c00565b6020908102919091010152806111ea81613cd3565b9150506111b9565b50600d546040516311b211c160e31b81526001600160a01b0390911690638d908e08906112259085908590600401613cee565b600060405180830381600087803b15801561123f57600080fd5b505af1158015611253573d6000803e3d6000fd5b50505050610df47f5a1aa6b3e98d297b5b07a16097bb7f47aa9c559c07c644e033b9aa6ae36902528361128560045490565b60018760405160200161129b9493929190613d0e565b60408051601f19818403018152908290526112b99291602001613d4c565b604051602081830303815290604052611bad565b60606007805461094990613a6d565b60608183106112fe57604051631960ccad60e11b815260040160405180910390fd5b60008061130a60045490565b9050600185101561131a57600194505b80841115611326578093505b600061133187610f75565b905084861015611350578585038181101561134a578091505b50611354565b5060005b60008167ffffffffffffffff81111561136f5761136f6134f2565b604051908082528060200260200182016040528015611398578160200160208202803683370190505b509050816113ab57935061146192505050565b60006113b68861157c565b9050600081604001516113c7575080515b885b8881141580156113d95750848714155b15611455576113e781611a44565b92508260400151156113f85761144d565b82516001600160a01b03161561140d57825191505b8a6001600160a01b0316826001600160a01b0316141561144d578084888060010199508151811061144057611440613c00565b6020026020010181815250505b6001016113c9565b50505092835250909150505b9392505050565b6040516301473cbb60e71b815260040160405180910390fd5b600c546001600160a01b031633146114ab5760405162461bcd60e51b8152600401610af790613ac9565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b031633146114f75760405162461bcd60e51b8152600401610af790613ac9565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b611524848484610b0b565b6001600160a01b0383163b1561155d5761154084848484611c18565b61155d576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b600060115442118015611577575060125442105b905090565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806115d557506004548310155b156115e05792915050565b6115e983611a44565b90508060400151156115fb5792915050565b61146183611d10565b606061160f8261171e565b61162c57604051636f96cda160e11b815260040160405180910390fd5b600e6116386001611d88565b604051602001611649929190613df9565b6040516020818303038152906040529050919050565b600c546001600160a01b031633146116895760405162461bcd60e51b8152600401610af790613ac9565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b031633146116d55760405162461bcd60e51b8152600401610af790613ac9565b6001600160a01b0381166116fb5760405162461bcd60e51b8152600401610af790613e57565b610d7b816119f2565b600061170f82611e86565b905061171a81610da8565b5050565b600081600111158015611732575060045482105b8015610934575050600090815260086020526040902054600160e01b161590565b600081806001116117a3576004548110156117a357600081815260086020526040902054600160e01b81166117a1575b80611461575060001901600081815260086020526040902054611783565b505b604051636f96cda160e11b815260040160405180910390fd5b6001600160a01b038316158015906117dc57506001600160a01b03841615155b156117fa5760405163399f41e760e01b815260040160405180910390fd5b61155d565b600080828060200190518101906118169190613ee7565b600d546040516311b211c160e31b81529294509092506001600160a01b031690638d908e089061184c9085908590600401613cee565b600060405180830381600087803b15801561186657600080fd5b505af115801561187a573d6000803e3d6000fd5b50505050505050565b600061188e83611753565b9050806000806118ac866000908152600a6020526040902080549091565b915091508415611909576118c1818433610b60565b611909576001600160a01b0383166000908152600b6020908152604080832033845290915290205460ff1661190957604051632ce44b5f60e11b815260040160405180910390fd5b6119178360008860016117bc565b801561192257600082555b6001600160a01b038316600081815260096020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260086020526040902055600160e11b84166119a957600186016000818152600860205260409020546119a75760045481146119a75760008181526008602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060058054600101905550505050565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60408051608081018252600080825260208201819052918101829052606081019190915260008281526008602052604090205461093490604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6004546001600160a01b038316611aec57604051622e076360e81b815260040160405180910390fd5b81611b0a5760405163b562e8dd60e01b815260040160405180910390fd5b611b1760008483856117bc565b6001600160a01b038316600081815260096020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260086020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611b615760045550505050565b60005460025460405163b472047760e01b81526001600160a01b039283169263b472047792611be3929116908590600401613f35565b600060405180830381600087803b158015611bfd57600080fd5b505af1158015611c11573d6000803e3d6000fd5b5050505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611c4d903390899088908890600401613f43565b602060405180830381600087803b158015611c6757600080fd5b505af1925050508015611c97575060408051601f3d908101601f19168201909252611c9491810190613f92565b60015b611cf2573d808015611cc5576040519150601f19603f3d011682016040523d82523d6000602084013e611cca565b606091505b508051611cea576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610934611d4083611753565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b606081611dac5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611dd65780611dc081613cd3565b9150611dcf9050600a83613fc9565b9150611db0565b60008167ffffffffffffffff811115611df157611df16134f2565b6040519080825280601f01601f191660200182016040528015611e1b576020820181803683370190505b5090505b8415611d0857611e30600183613fe1565b9150611e3d600a86613ffc565b611e48906030614014565b60f81b818381518110611e5d57611e5d613c00565b60200101906001600160f81b031916908160001a905350611e7f600a86613fc9565b9450611e1f565b60606000611e9383612086565b90506000611ea0826120e5565b90506000611ead8361210e565b9050600081611ebb84612137565b611ec4866122f5565b604051602001611ed69392919061402c565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff1615611f1e5760405162461bcd60e51b8152600401610af7906140a0565b6000818152600360205260408120805460ff19166001179055611f4085612311565b90506000611f4d8261245b565b9050611f58816124eb565b6002546001600160a01b03908116911614611f855760405162461bcd60e51b8152600401610af7906140f2565b6000611f9087612514565b9050611fb0611fa0846020015190565b87611faa8a612530565b8461254c565b611fcc5760405162461bcd60e51b8152600401610af790614142565b611ffa85611fd989612802565b611fe28a61281e565b84611fec8c61283a565b611ff58d612856565b612872565b5060006120068361297a565b90507f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03661203c6120378360006129b6565b6129ee565b146120595760405162461bcd60e51b8152600401610af790614186565b600061206484612a69565b8060200190518101906120779190614196565b9b9a5050505050505050505050565b60408051602081019091526060815260006120d06120cb8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b612a85565b60408051602081019091529081529392505050565b6060610934826000015160088151811061210157612101613c00565b6020026020010151612b9b565b6000610934826000015160028151811061212a5761212a613c00565b60200260200101516129ee565b604080516020810190915260008152815160609190156109345760008061215f600086612c38565b60f81c9050600181148061217657508060ff166003145b1561221e5760018551600261218b9190613c70565b6121959190613fe1565b67ffffffffffffffff8111156121ad576121ad6134f2565b6040519080825280601f01601f1916602001820160405280156121d7576020820181803683370190505b50925060006121e7600187612c38565b905080846000815181106121fd576121fd613c00565b60200101906001600160f81b031916908160001a9053506001925050612282565b60028551600261222e9190613c70565b6122389190613fe1565b67ffffffffffffffff811115612250576122506134f2565b6040519080825280601f01601f19166020018201604052801561227a576020820181803683370190505b509250600091505b60ff82165b83518110156122ec576122b16122a060ff851683613fe1565b6122ab906002614014565b87612c38565b8482815181106122c3576122c3613c00565b60200101906001600160f81b031916908160001a905350806122e481613cd3565b915050612287565b50505092915050565b6000610934826000015160098151811061212a5761212a613c00565b61233560405180606001604052806060815260200160608152602001600081525090565b61234f826000015160068151811061210157612101613c00565b60208281018290526040805180820182526000808252908301528051808201909152825181529181019082015261238581612cb9565b1561239a5761239381612a85565b8252612447565b602082015180516000906123b090600190613fe1565b67ffffffffffffffff8111156123c8576123c86134f2565b6040519080825280601f01601f1916602001820160405280156123f2576020820181803683370190505b50905060008083602101915082602001905061241082828551612cf2565b60408051808201825260008082526020918201528151808301909252845182528085019082015261244090612a85565b8652505050505b612450836122f5565b604083015250919050565b6040805160808101825260009181018281526060808301939093528152602081019190915260006124a9836000015160038151811061249c5761249c613c00565b6020026020010151612a85565b8360400151815181106124be576124be613c00565b6020026020010151905060405180604001604052808281526020016124e283612a85565b90529392505050565b6000610934826020015160008151811061250757612507613c00565b6020026020010151612d6d565b6000610934826000015160058151811061212a5761212a613c00565b6060610934826000015160078151811061210157612101613c00565b6000806125808460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9050600061258d82612a85565b90506060808560008061259f8b612137565b90508051600014156125bb576000975050505050505050611d08565b60005b86518110156127f25781518311156125e157600098505050505050505050611d08565b6126038782815181106125f6576125f6613c00565b6020026020010151612d87565b95508580519060200120841461262457600098505050505050505050611d08565b61263987828151811061249c5761249c613c00565b945084516011141561270e57815183141561269b578c8051906020012061266c8660108151811061210157612101613c00565b80519060200120141561268a57600198505050505050505050611d08565b600098505050505050505050611d08565b60008284815181106126af576126af613c00565b016020015160f81c905060108111156126d45760009950505050505050505050611d08565b6126f9868260ff16815181106126ec576126ec613c00565b6020026020010151612e07565b9450612706600185614014565b9350506127e0565b84516002141561268a57600061273a6127338760008151811061210157612101613c00565b8486612e35565b83519091506127498286614014565b141561279e578d8051906020012061276d8760018151811061210157612101613c00565b80519060200120141561278c5760019950505050505050505050611d08565b60009950505050505050505050611d08565b806127b55760009950505050505050505050611d08565b6127bf8185614014565b93506127d7866001815181106126ec576126ec613c00565b94506127e09050565b806127ea81613cd3565b9150506125be565b5050505050505050949350505050565b6000610934826000015160038151811061212a5761212a613c00565b6000610934826000015160048151811061212a5761212a613c00565b6000610934826000015160008151811061212a5761212a613c00565b6060610934826000015160018151811061210157612101613c00565b6001546040516320a9cea560e11b81526000918291829182916001600160a01b03909116906341539d4a906128ab908990600401613472565b60a06040518083038186803b1580156128c357600080fd5b505afa1580156128d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128fb91906141d1565b5093505092509250612951828b6129129190613fe1565b84878d8d8d8d60405160200161292b9493929190614249565b60405160208183030381529060405280519060200120612f56909392919063ffffffff16565b61296d5760405162461bcd60e51b8152600401610af7906142c5565b9998505050505050505050565b60408051602081019091526060815260405180602001604052806129ae846020015160018151811061249c5761249c613c00565b905292915050565b604080518082019091526000808252602082015282518051839081106129de576129de613c00565b6020026020010151905092915050565b805160009015801590612a0357508151602110155b612a0c57600080fd5b6000612a1b836020015161306a565b90506000818460000151612a2f9190613fe1565b9050600080838660200151612a449190614014565b9050805191506020831015612a6057826020036101000a820491505b50949350505050565b6060610934826020015160028151811061210157612101613c00565b6060612a9082612cb9565b612a9957600080fd5b6000612aa4836130eb565b905060008167ffffffffffffffff811115612ac157612ac16134f2565b604051908082528060200260200182016040528015612b0657816020015b6040805180820190915260008082526020820152815260200190600190039081612adf5790505b5090506000612b18856020015161306a565b8560200151612b279190614014565b90506000805b84811015612b9057612b3e8361316e565b9150604051806040016040528083815260200184815250848281518110612b6757612b67613c00565b6020908102919091010152612b7c8284614014565b925080612b8881613cd3565b915050612b2d565b509195945050505050565b8051606090612ba957600080fd5b6000612bb8836020015161306a565b90506000818460000151612bcc9190613fe1565b905060008167ffffffffffffffff811115612be957612be96134f2565b6040519080825280601f01601f191660200182016040528015612c13576020820181803683370190505b5090506000816020019050612a60848760200151612c319190614014565b8285613212565b6000612c45600284613ffc565b15612c7f57601082612c58600286613fc9565b81518110612c6857612c68613c00565b0160200151612c7a919060f81c6142d5565b612caf565b601082612c8d600286613fc9565b81518110612c9d57612c9d613c00565b0160200151612caf919060f81c6142e6565b60f81b9392505050565b8051600090612cca57506000919050565b6020820151805160001a9060c0821015612ce8575060009392505050565b5060019392505050565b80612cfc57505050565b60208110612d345782518252612d13602084614014565b9250612d20602083614014565b9150612d2d602082613fe1565b9050612cfc565b60006001612d43836020613fe1565b612d4f90610100614405565b612d599190613fe1565b935183518516941916939093179091525050565b8051600090601514612d7e57600080fd5b610934826129ee565b60606000826000015167ffffffffffffffff811115612da857612da86134f2565b6040519080825280601f01601f191660200182016040528015612dd2576020820181803683370190505b509050805160001415612de55792915050565b6000816020019050612e008460200151828660000151613212565b5092915050565b8051600090602114612e1857600080fd5b60008083602001516001612e2c9190614014565b51949350505050565b60008080612e4286612137565b90506000815167ffffffffffffffff811115612e6057612e606134f2565b6040519080825280601f01601f191660200182016040528015612e8a576020820181803683370190505b509050845b8251612e9b9087614014565b811015612f26576000878281518110612eb657612eb6613c00565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690508083612eeb8985613fe1565b81518110612efb57612efb613c00565b60200101906001600160f81b031916908160001a905350508080612f1e90613cd3565b915050612e8f565b50808051906020012082805190602001201415612f465781519250612f4b565b600092505b509095945050505050565b600060208251612f669190613ffc565b15612f835760405162461bcd60e51b8152600401610af790614448565b600060208351612f939190613fc9565b9050612fa0816002614405565b8510612fbe5760405162461bcd60e51b8152600401610af79061448c565b60008660205b8551811161305c57858101519250612fdd600289613ffc565b613011578183604051602001612ff492919061449c565b60405160208183030381529060405280519060200120915061303d565b828260405160200161302492919061449c565b6040516020818303038152906040528051906020012091505b613048600289613fc9565b9750613055602082614014565b9050612fc4565b509094149695505050505050565b8051600090811a60808110156130835750600092915050565b60b881108061309e575060c0811080159061309e575060f881105b156130ac5750600192915050565b60c08110156130d9576130c1600160b86144c2565b6130ce9060ff1682613fe1565b611461906001614014565b6130c1600160f86144c2565b50919050565b80516000906130fc57506000919050565b60008061310c846020015161306a565b846020015161311b9190614014565b90506000846000015185602001516131339190614014565b90505b80821015613165576131478261316e565b6131519083614014565b91508261315d81613cd3565b935050613136565b50909392505050565b80516000908190811a60808110156131895760019150612e00565b60b88110156131af5761319d608082613fe1565b6131a8906001614014565b9150612e00565b60c08110156131dc5760b78103600185019450806020036101000a85510460018201810193505050612e00565b60f88110156131f05761319d60c082613fe1565b60019390930151602084900360f7016101000a900490920160f5190192915050565b8061321c57505050565b602081106132545782518252613233602084614014565b9250613240602083614014565b915061324d602082613fe1565b905061321c565b80612d3457505050565b82805461326a90613a6d565b90600052602060002090601f01602090048101928261328c57600085556132d2565b82601f106132a55782800160ff198235161785556132d2565b828001600101855582156132d2579182015b828111156132d25782358255916020019190600101906132b7565b506132de9291506132e2565b5090565b5b808211156132de57600081556001016132e3565b6001600160e01b031981165b8114610d7b57600080fd5b8035610934816132f7565b60006020828403121561332e5761332e600080fd5b6000611d08848461330e565b8015155b82525050565b60208101610934828461333a565b60005b8381101561336d578181015183820152602001613355565b8381111561155d5750506000910152565b6000613388825190565b80845260208401935061339f818560208601613352565b601f01601f19169290920192915050565b60208082528101611461818461337e565b80613303565b8035610934816133c1565b6000602082840312156133e7576133e7600080fd5b6000611d0884846133c7565b60006001600160a01b038216610934565b61333e816133f3565b602081016109348284613404565b613303816133f3565b80356109348161341b565b6000806040838503121561344557613445600080fd5b60006134518585613424565b9250506020613462858286016133c7565b9150509250929050565b8061333e565b60208101610934828461346c565b6000806040838503121561349657613496600080fd5b600061345185856133c7565b6000806000606084860312156134ba576134ba600080fd5b60006134c68686613424565b93505060206134d786828701613424565b92505060406134e8868287016133c7565b9150509250925092565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff8211171561352e5761352e6134f2565b6040525050565b600061354060405190565b905061354c8282613508565b919050565b600067ffffffffffffffff82111561356b5761356b6134f2565b601f19601f83011660200192915050565b82818337506000910152565b600061359b61359684613551565b613535565b9050828152602081018484840111156135b6576135b6600080fd5b610f3384828561357c565b600082601f8301126135d5576135d5600080fd5b8135611d08848260208601613588565b6000602082840312156135fa576135fa600080fd5b813567ffffffffffffffff81111561361457613614600080fd5b611d08848285016135c1565b60008083601f84011261363557613635600080fd5b50813567ffffffffffffffff81111561365057613650600080fd5b60208301915083600182028301111561366b5761366b600080fd5b9250929050565b6000806020838503121561368857613688600080fd5b823567ffffffffffffffff8111156136a2576136a2600080fd5b6136ae85828601613620565b92509250509250929050565b600067ffffffffffffffff8211156136d4576136d46134f2565b5060209081020190565b60006136ec613596846136ba565b8381529050602080820190840283018581111561370b5761370b600080fd5b835b8181101561372f578061372088826133c7565b8452506020928301920161370d565b5050509392505050565b600082601f83011261374d5761374d600080fd5b8135611d088482602086016136de565b60006020828403121561377257613772600080fd5b813567ffffffffffffffff81111561378c5761378c600080fd5b611d0884828501613739565b67ffffffffffffffff811661333e565b62ffffff811661333e565b805160808301906137c48482613404565b5060208201516137d76020850182613798565b5060408201516137ea604085018261333a565b50606082015161155d60608501826137a8565b600061380983836137b3565b505060800190565b600061381b825190565b80845260209384019383018060005b8381101561384f57815161383e88826137fd565b97506020830192505060010161382a565b509495945050505050565b602080825281016114618184613811565b60006020828403121561388057613880600080fd5b6000611d088484613424565b6000613898838361346c565b505060200190565b60006138aa825190565b80845260209384019383018060005b8381101561384f5781516138cd888261388c565b9750602083019250506001016138b9565b6020808252810161146181846138a0565b60008060006060848603121561390757613907600080fd5b60006139138686613424565b93505060206134d7868287016133c7565b801515613303565b803561093481613924565b6000806040838503121561394d5761394d600080fd5b60006139598585613424565b92505060206134628582860161392c565b6000806000806080858703121561398357613983600080fd5b600061398f8787613424565b94505060206139a087828801613424565b93505060406139b1878288016133c7565b925050606085013567ffffffffffffffff8111156139d1576139d1600080fd5b6139dd878288016135c1565b91505092959194509250565b6000610934826133f3565b6000610934826139e9565b61333e816139f4565b6020810161093482846139ff565b6080810161093482846137b3565b60008060408385031215613a3a57613a3a600080fd5b6000613a468585613424565b925050602061346285828601613424565b634e487b7160e01b600052602260045260246000fd5b600281046001821680613a8157607f821691505b602082108114156130e5576130e5613a57565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260005b5060200190565b6020808252810161093481613a94565b600081610934565b600381526000602082016239393960e81b81529150613ac2565b6020808252810161093481613ae1565b8051610934816133c1565b6000613b2461359684613551565b905082815260208101848484011115613b3f57613b3f600080fd5b610f33848285613352565b600082601f830112613b5e57613b5e600080fd5b8151611d08848260208601613b16565b60008060408385031215613b8457613b84600080fd5b6000613b908585613b0b565b925050602083015167ffffffffffffffff811115613bb057613bb0600080fd5b61346285828601613b4a565b601181526000602082017f494e56414c49445f53594e435f5459504500000000000000000000000000000081529150613ac2565b6020808252810161093481613bbc565b634e487b7160e01b600052603260045260246000fd5b601681526000602082017f4d696e74696e67206973206e6f74206163746976652e0000000000000000000081529150613ac2565b6020808252810161093481613c16565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613c8a57613c8a613c5a565b500290565b601181526000602082017f4e6f7420656e6f7567682066756e64732e00000000000000000000000000000081529150613ac2565b6020808252810161093481613c8f565b6000600019821415613ce757613ce7613c5a565b5060010190565b60408101613cfc8285613404565b8181036020830152611d0881846138a0565b60808101613d1c8287613404565b613d29602083018661346c565b613d36604083018561346c565b613d43606083018461346c565b95945050505050565b60408101613d5a828561346c565b8181036020830152611d08818461337e565b60008154613d7981613a6d565b600182168015613d905760018114613da1576122ec565b60ff198316865281860193506122ec565b60008581526020902060005b83811015613dc957815488820152600190910190602001613dad565b505050939093019392505050565b6000613de1825190565b613def818560208601613352565b9290920192915050565b6000613e058285613d6c565b9150611d088284613dd7565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015291505b5060400190565b6020808252810161093481613e11565b80516109348161341b565b6000613e80613596846136ba565b83815290506020808201908402830185811115613e9f57613e9f600080fd5b835b8181101561372f5780613eb48882613b0b565b84525060209283019201613ea1565b600082601f830112613ed757613ed7600080fd5b8151611d08848260208601613e72565b60008060408385031215613efd57613efd600080fd5b6000613f098585613e67565b925050602083015167ffffffffffffffff811115613f2957613f29600080fd5b61346285828601613ec3565b60408101613d5a8285613404565b60808101613f518287613404565b613f5e6020830186613404565b613f6b604083018561346c565b8181036060830152613f7d818461337e565b9695505050505050565b8051610934816132f7565b600060208284031215613fa757613fa7600080fd5b6000611d088484613f87565b634e487b7160e01b600052601260045260246000fd5b6000825b925082613fdc57613fdc613fb3565b500490565b6000825b925082821015613ff757613ff7613c5a565b500390565b6000825b92508261400f5761400f613fb3565b500690565b6000821982111561402757614027613c5a565b500190565b6000614038828661346c565b6020820191506140488285613dd7565b9150614054828461346c565b506020019392505050565b602481526000602082017f4678526f6f7454756e6e656c3a20455849545f414c52454144595f50524f434581526314d4d15160e21b60208201529150613e50565b602080825281016109348161405f565b602581526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f46585f4348494c445f54815264155393915360da1b60208201529150613e50565b60208082528101610934816140b0565b602381526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f524543454950545f505281526227a7a360e91b60208201529150613e50565b6020808252810161093481614102565b601f81526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f5349474e41545552450081529150613ac2565b6020808252810161093481614152565b6000602082840312156141ab576141ab600080fd5b815167ffffffffffffffff8111156141c5576141c5600080fd5b611d0884828501613b4a565b600080600080600060a086880312156141ec576141ec600080fd5b60006141f88888613b0b565b955050602061420988828901613b0b565b945050604061421a88828901613b0b565b935050606061422b88828901613b0b565b925050608061423c88828901613e67565b9150509295509295909350565b6000614255828761346c565b602082019150614265828661346c565b602082019150614275828561346c565b602082019150614285828461346c565b50602001949350505050565b601c81526000602082017f4678526f6f7454756e6e656c3a20494e56414c49445f4845414445520000000081529150613ac2565b6020808252810161093481614291565b600060ff8216915060ff8316614000565b600060ff8216915060ff8316613fcd565b80825b60018511156143365780860481111561431557614315613c5a565b600185161561432357908102905b800261432f8560011c90565b94506142fa565b94509492505050565b60008261434e57506001611461565b8161435b57506000611461565b8160018114614371576002811461437b576143a8565b6001915050611461565b60ff84111561438c5761438c613c5a565b8360020a9150848211156143a2576143a2613c5a565b50611461565b5060208310610133831016604e8410600b84101617156143db575081810a838111156143d6576143d6613c5a565b611461565b6143e884848460016142f7565b925090508184048111156143fe576143fe613c5a565b0292915050565b6000611461600019848461433f565b601481526000602082017f496e76616c69642070726f6f66206c656e67746800000000000000000000000081529150613ac2565b6020808252810161093481614414565b601581526000602082017f4c65616620696e64657820697320746f6f20626967000000000000000000000081529150613ac2565b6020808252810161093481614458565b60006144a8828561346c565b6020820191506144b8828461346c565b5060200192915050565b600060ff8216915060ff8316613fe556fea2646970667358221220f2e70e772b719c5c74e5ba6071d3e0cc80c1f576ba70e6f7dd21bab2e57e4b2564736f6c63430008090033

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

00000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a2000000000000000000000000bd24a76f4135f930f5c49f6c30e0e30a61b97537

-----Decoded View---------------
Arg [0] : _checkpointManager (address): 0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287
Arg [1] : _fxRoot (address): 0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2
Arg [2] : _vendorContractAddress (address): 0xbd24A76F4135F930F5c49f6c30e0E30A61b97537

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000086e4dc95c7fbdbf52e33d563bbdb00823894c287
Arg [1] : 000000000000000000000000fe5e5d361b2ad62c541bab87c45a0b9b018389a2
Arg [2] : 000000000000000000000000bd24a76f4135f930f5c49f6c30e0e30a61b97537


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.