ETH Price: $3,009.41 (+4.46%)
Gas: 1 Gwei

Token

Chaos ($SONGS)
 

Overview

Max Total Supply

4,728 $SONGS

Holders

413

Total Transfers

-

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
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:
ChaosSongs

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import {SafeTransferLib} from "@rari-capital/solmate/src/utils/SafeTransferLib.sol";
import "./ChaosPacks.sol";
import "./external/interfaces/ISplitMain.sol";
import "./external/erc721a/extensions/ERC721ABurnable.sol";
import "./BatchShuffle.sol";
import "./Royalties/ERC2981/IERC2981Royalties.sol";

error CallerIsNotTokenOwner();
error PacksDisabledUntilSuperchargedComplete();
error SuperchargedOffsetAlreadySet();
error SuperchargeConfigurationNotReady();
error SuperchargedOffsetNotSet();
error InvalidOffset();
error BurnPackFailed();
error PackContractLocked();

/// @title Chaos Songs
/// @notice Distribute random selection of 4 songs to Chaos Pack holders
contract ChaosSongs is
    ERC721ABurnable,
    Ownable,
    BatchShuffle,
    IERC2981Royalties
{
    using SafeTransferLib for address payable;
    using SafeTransferLib for ERC20;
    using Strings for uint256;

    uint256 constant SONG_COUNT = 4; /* Number of songs minted on pack open*/
    uint32 constant SUPERCHARGED_SUPPLY = 1e3; /* Number of supercharged songs*/
    uint16 constant PACK_SUPPLY = 5e3; /*Supply of packs determines number of offsets*/

    uint256 public royaltyPoints; /*Royalty percentage / 10000*/

    uint256 public superchargedOffset; /*Track offset for first 1000 NFTs separately*/

    ChaosPacks public packContract; /*External contract to use for pack NFTs*/
    bool public packContractLocked; /*Allow pack contract to be locked against further change*/

    /*Liquid splits config*/
    address payable public immutable payoutSplit; /* 0xSplits address for split */
    ISplitMain public splitMain; /* 0xSplits address for updating & distributing split */
    uint32 public distributorFee; /* 0xSplits distributorFee payable to third parties covering gas of distribution */
    mapping(address => uint32) public superchargeBalances; /*Track supercharged balance separately for liquid splits*/

    /*Contract config*/
    string public contractURI; /*contractURI contract metadata json*/
    string public baseURI; /*baseURI_ String to prepend to token IDs*/

    event PackOpened(uint256 _id, address _opener);

    /// @notice Constructor sets contract metadata configurations and split interfaces
    /// @param baseURI_ Base URI for token metadata
    /// @param _contractURI URI for marketplace contract metadata
    /// @param _splitMain Address of splits contract for sending royalties
    /// @param _distributorFee Optional fee to compensate address calling distribute, offset gas
    /// @param _royaltyPoints BP of royalties to send to song contract
    constructor(
        string memory baseURI_,
        string memory _contractURI,
        address _splitMain,
        uint256 _royaltyPoints,
        uint32 _distributorFee
    )
        ERC721A("Chaos", "\u0024SONGS")
        BatchShuffle(PACK_SUPPLY, SONG_COUNT, SUPERCHARGED_SUPPLY)
    {
        baseURI = baseURI_; /*Set token level metadata*/
        contractURI = _contractURI; /*Set marketplace metadata*/

        splitMain = ISplitMain(_splitMain); /*Establish interface to splits contract*/

        // create dummy mutable split with this contract as controller;
        // recipients & distributorFee will be updated on first payout
        address[] memory recipients = new address[](2);
        recipients[0] = address(0);
        recipients[1] = address(1);
        uint32[] memory percentAllocations = new uint32[](2);
        percentAllocations[0] = uint32(500000);
        percentAllocations[1] = uint32(500000);
        payoutSplit = payable(
            splitMain.createSplit(
                recipients,
                percentAllocations,
                0,
                address(this)
            )
        );
        distributorFee = _distributorFee; /*Set optional fee for calling distribute*/

        royaltyPoints = _royaltyPoints; /*Set royalty amount out of 10000*/
    }

    /*****************
    EXTERNAL MINTING FUNCTIONS
    *****************/
    /// @dev Burn packs and receive 4 song NFTs in exchange
    /// @param _packIds Packs owned by sender
    function batchOpenPack(uint256[] calldata _packIds) external {
        for (uint256 index = 0; index < _packIds.length; index++) {
            _openPack(_packIds[index]);
        }
    }

    /// @dev Burn a pack and receive 4 song NFTs in exchange
    /// @param _packId Pack owned by sender
    function openPack(uint256 _packId) external {
        _openPack(_packId);
    }

    /// @dev Burn a pack and receive 4 song NFTs in exchange
    /// @param _packId Pack owned by sender
    function _openPack(uint256 _packId) internal {
        if (packContract.ownerOf(_packId) != msg.sender)
            /*Only pack owner can open pack*/
            revert CallerIsNotTokenOwner();

        if (superchargedOffset == 0)
            /*Pack opening disabled until supercharged tokens are configured*/
            revert PacksDisabledUntilSuperchargedComplete();

        if (!packContract.burnPack(_packId)) revert BurnPackFailed(); /*Opening a pack burns the pack NT*/
        _mintSongs(msg.sender, _currentIndex); /*Mint 4 songs to opener*/

        emit PackOpened(_packId, msg.sender);
    }

    /*****************
    Permissioned Minting
    *****************/

    /// @dev Mint the supercharged tokens to proper destination
    /// @param _to Recipient
    /// @param _amount Number of tokens to send
    function mintSupercharged(address _to, uint256 _amount) external onlyOwner {
        _mintSupercharged(_to, _amount);
    }

    /// @dev Mint the supercharged tokens to proper destination in batches
    /// @param _tos Recipients
    /// @param _amounts Numbers of tokens to send
    function batchMintSupercharged(
        address[] calldata _tos,
        uint256[] calldata _amounts
    ) external onlyOwner {
        if (_tos.length != _amounts.length) revert LengthMismatch();
        for (uint256 index = 0; index < _tos.length; index++) {
            _mintSupercharged(_tos[index], _amounts[index]);
        }
    }

    /*****************
    RNG Config
    *****************/
    /// @notice Set the offset using on chain entropy for the reserve minted tokens
    /// @dev Should be done AFTER distribution, BEFORE pack opening
    ///     In rare case that offset is 0, fail transaction and allow owner to rerun
    function setSuperchargedOffset() external onlyOwner {
        if (superchargedOffset != 0) revert SuperchargedOffsetAlreadySet(); /*Can only be set once*/
        if (totalSupply() != SUPERCHARGED_SUPPLY)
            /*Must be done after supercharge minting is complete before pack opening*/
            revert SuperchargeConfigurationNotReady();

        uint256 _seed = uint256(blockhash(block.number - 1)); /*Use prev block hash for pseudo randomness*/

        superchargedOffset = _seed % SUPERCHARGED_SUPPLY; /*Mod seed by supply to get offset*/
        if (superchargedOffset == 0) revert InvalidOffset(); /*Fail the transaction if we get 0*/
    }

    /*****************
    Internal RNG functions
    *****************/
    /// @dev Get the token ID to use for URI of a token ID
    /// @param _tokenId Token to check
    function getSongTokenId(uint256 _tokenId) public view returns (uint256) {
        if (!_exists(_tokenId)) revert URIQueryForNonexistentToken(); /*Only return for minted tokens*/
        uint256 _shuffledTokenId; /*Initialize shuffled token ID*/

        /*If not supercharged use individual offsets*/
        if (_tokenId >= SUPERCHARGED_SUPPLY) {
            _shuffledTokenId = getShuffledTokenId(_tokenId);
        } else {
            /*If supercharged use the supercharged offset*/
            if (superchargedOffset == 0) revert SuperchargedOffsetNotSet(); /*Require that offset is set for this to return*/
            _shuffledTokenId =
                (superchargedOffset + _tokenId) %
                SUPERCHARGED_SUPPLY; /*Supercharged offset is same for all tokens*/
        }

        return _shuffledTokenId;
    }

    /*****************
    INTERNAL MINTING FUNCTIONS AND HELPERS
    *****************/
    function _mintSongs(address _to, uint256 _offsetIndex) internal {
        _safeMint(_to, SONG_COUNT);

        uint256 _seed = uint256(blockhash(block.number - 1)); /*Use prev block hash for pseudo randomness*/
        _setNextOffset(_offsetIndex, _seed);
    }

    /// @dev Mint the supercharged tokens to proper destination - internal utility
    /// @param _to Recipient
    /// @param _amount Number of tokens to send
    function _mintSupercharged(address _to, uint256 _amount) internal {
        if ((totalSupply() + _amount > SUPERCHARGED_SUPPLY))
            revert MaxSupplyExceeded(); /*Revert if max supply exceeded*/
        _safeMint(_to, _amount); /*Batch mint*/
    }

    /*****************
    DISTRIBUTION FUNCTIONS
    *****************/

    /// @notice distributes ETH to supercharged NFT holders
    /// @param accounts Ordered, unique list of supercharged NFT tokenholders
    /// @param distributorAddress Address to receive distributorFee
    function distributeETH(
        address[] calldata accounts,
        address distributorAddress
    ) external {
        uint256 numRecipients = accounts.length;
        uint32[] memory percentAllocations = new uint32[](numRecipients);
        for (uint256 i = 0; i < numRecipients; ) {
            percentAllocations[i] =
                (superchargeBalances[accounts[i]] * 1e6) /
                SUPERCHARGED_SUPPLY;
            unchecked {
                ++i;
            }
        }

        // atomically deposit funds into split, update recipients to reflect current supercharged NFT holders,
        // and distribute
        payoutSplit.safeTransferETH(address(this).balance);
        splitMain.updateAndDistributeETH(
            payoutSplit,
            accounts,
            percentAllocations,
            distributorFee,
            distributorAddress
        );
    }

    /// @notice distributes ERC20s to supercharged NFT holders
    /// @param accounts Ordered, unique list of supercharged NFT tokenholders
    /// @param token ERC20 token to distribute
    /// @param distributorAddress Address to receive distributorFee
    function distributeERC20(
        address[] calldata accounts,
        ERC20 token,
        address distributorAddress
    ) external {
        uint256 numRecipients = accounts.length;
        uint32[] memory percentAllocations = new uint32[](numRecipients);
        for (uint256 i = 0; i < numRecipients; ) {
            percentAllocations[i] =
                (superchargeBalances[accounts[i]] * 1e6) /
                SUPERCHARGED_SUPPLY;
            unchecked {
                ++i;
            }
        }

        // atomically deposit funds into split, update recipients to reflect current supercharged NFT holders,
        // and distribute
        token.safeTransfer(payoutSplit, token.balanceOf(address(this)));
        splitMain.updateAndDistributeERC20(
            payoutSplit,
            token,
            accounts,
            percentAllocations,
            distributorFee,
            distributorAddress
        );
    }

    /*****************
    CONFIG FUNCTIONS
    *****************/

    /// @notice Set the contract with packs to burn upon opening
    /// @dev reverts if locked
    /// @param _packContract New contract address
    function setPackContract(address _packContract) external onlyOwner {
        if (packContractLocked) revert PackContractLocked();
        packContract = ChaosPacks(_packContract);
    }

    /// @notice Lock pack contract against further changes
    function lockPackAddress() external onlyOwner {
        if (packContractLocked) revert PackContractLocked();
        packContractLocked = true;
    }

    /// @notice Set new base URI
    /// @dev only possible before supercharged offset is set
    /// @param baseURI_ String to prepend to token IDs
    function setBaseURI(string memory baseURI_) external onlyOwner {
        baseURI = baseURI_;
    }

    /// @notice Set new contract URI
    /// @param _contractURI Contract metadata json
    function setContractURI(string memory _contractURI) external onlyOwner {
        contractURI = _contractURI;
    }

    /// @notice Set distributorFee as owner
    /// @param _distributorFee 0xSplits distributorFee payable to third parties covering gas of distribution
    function setDistributorFee(uint32 _distributorFee) external onlyOwner {
        distributorFee = _distributorFee;
    }

    /// @notice Set royalty points
    /// @param _royaltyPoints Royalty percentage / 10000
    function setRoyaltyPoints(uint256 _royaltyPoints) external onlyOwner {
        royaltyPoints = _royaltyPoints;
    }

    /*****************
    Public view interfaces
    *****************/
    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
        uint256 _shuffled = getSongTokenId(tokenId);

        return
            bytes(baseURI).length > 0
                ? string(
                    abi.encodePacked(baseURI, _shuffled.toString(), ".json")
                )
                : "";
    }

    /// @notice Called with the sale price to determine how much royalty
    //          is owed and to whom.
    /// @param _tokenId - the NFT asset queried for royalty information
    /// @param _value - the sale price of the NFT asset specified by _tokenId
    /// @return _receiver - address of who should be sent the royalty payment
    /// @return _royaltyAmount - the royalty payment amount for value sale price
    function royaltyInfo(uint256 _tokenId, uint256 _value)
        external
        view
        override(IERC2981Royalties)
        returns (address _receiver, uint256 _royaltyAmount)
    {
        return (address(this), (_value * royaltyPoints) / 10000);
    }

    /*****************
    Hooks
    *****************/
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal override(ERC721A) {
        super._beforeTokenTransfers(from, to, startTokenId, quantity);
        if (startTokenId < SUPERCHARGED_SUPPLY) {
            require(to != address(0)); /*Disallow burning of supercharged tokens*/
            if (from != address(0)) {
                superchargeBalances[from] -= uint32(quantity);
            }
            superchargeBalances[to] += uint32(quantity);
        }
    }

    receive() external payable {}
}

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 : SafeTransferLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Gnosis (https://github.com/gnosis/gp-v2-contracts/blob/main/src/contracts/libraries/GPv2SafeERC20.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
library SafeTransferLib {
    /*///////////////////////////////////////////////////////////////
                            ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool callStatus;

        assembly {
            // Transfer the ETH and store if it succeeded or not.
            callStatus := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(callStatus, "ETH_TRANSFER_FAILED");
    }

    /*///////////////////////////////////////////////////////////////
                           ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool callStatus;

        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata to memory piece by piece:
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) // Begin with the function selector.
            mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "from" argument.
            mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value.

            // Call the token and store if it succeeded or not.
            // We use 100 because the calldata length is 4 + 32 * 3.
            callStatus := call(gas(), token, 0, freeMemoryPointer, 100, 0, 0)
        }

        require(didLastOptionalReturnCallSucceed(callStatus), "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool callStatus;

        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata to memory piece by piece:
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) // Begin with the function selector.
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value.

            // Call the token and store if it succeeded or not.
            // We use 68 because the calldata length is 4 + 32 * 2.
            callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0)
        }

        require(didLastOptionalReturnCallSucceed(callStatus), "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool callStatus;

        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata to memory piece by piece:
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) // Begin with the function selector.
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value.

            // Call the token and store if it succeeded or not.
            // We use 68 because the calldata length is 4 + 32 * 2.
            callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0)
        }

        require(didLastOptionalReturnCallSucceed(callStatus), "APPROVE_FAILED");
    }

    /*///////////////////////////////////////////////////////////////
                         INTERNAL HELPER LOGIC
    //////////////////////////////////////////////////////////////*/

    function didLastOptionalReturnCallSucceed(bool callStatus) private pure returns (bool success) {
        assembly {
            // Get how many bytes the call returned.
            let returnDataSize := returndatasize()

            // If the call reverted:
            if iszero(callStatus) {
                // Copy the revert message into memory.
                returndatacopy(0, 0, returnDataSize)

                // Revert with the same message.
                revert(0, returnDataSize)
            }

            switch returnDataSize
            case 32 {
                // Copy the return data into memory.
                returndatacopy(0, 0, returnDataSize)

                // Set success to whether it returned true.
                success := iszero(iszero(mload(0)))
            }
            case 0 {
                // There was no return data.
                success := 1
            }
            default {
                // It returned some malformed input.
                success := 0
            }
        }
    }
}

File 5 of 18 : ChaosPacks.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import {SafeTransferLib} from "@rari-capital/solmate/src/utils/SafeTransferLib.sol";
import "./external/erc721a/ERC721A.sol";
import "./Royalties/ERC2981/IERC2981Royalties.sol";

error OnlyOneCallPerBlockForNonEOA();
error SaleDisabled();
error MaxSupplyExceeded();
error MaxReserveExceeded();
error MaxPerTxExceeded();
error InvalidPurchaseValue();
error OnlySongContractCanBurn();
error LengthMismatch();
error SongContractLocked();

/// @title Chaos Packs
/// @notice Sale contract for Songcamp Chaos Packs
contract ChaosPacks is ERC721A, Ownable, IERC2981Royalties {
    using SafeTransferLib for address payable;
    using Strings for uint256;

    uint256 constant MAX_PER_MINT = 100; /*Don't let people buy more than 100 per transaction*/
    uint256 reserved; /*Max amount for reserve*/
    uint256 immutable maxSupply; /*Max token ID - set in constructor*/
    uint256 public constant PRICE = 0.2 ether; /*Public sale price*/

    address public songContract; /*Address that can burn packs to open them*/
    bool public songContractLocked; /*Allow song contract to be locked against further change*/

    uint256 public royaltyPoints; /*Royalty percentage / 10000*/

    string public contractURI; /*contractURI contract metadata json*/

    address payable public ethSink; /*recipient for ETH*/
    string public baseURI; /*baseURI_ String to prepend to token IDs*/

    bool public saleEnabled; /*Sale disabled by default*/

    mapping(address => uint256) lastCallFrom; /*Track last call to prevent contract bots*/

    modifier oncePerBlock() {
        if (msg.sender != tx.origin) {
            /*If caller is a contract only allow one call per block*/
            if (lastCallFrom[tx.origin] == block.number) {
                revert OnlyOneCallPerBlockForNonEOA();
            }
            lastCallFrom[tx.origin] = block.number; /*Store block to check on next mint*/
        }
        _;
    }

    /// @notice Constructor sets contract metadata configurations and sale configurations
    /// @param baseURI_ Base URI for token metadata
    /// @param _contractURI URI for marketplace contract metadata
    /// @param _reserved Max amount that can be minted by admin
    /// @param _maxSupply Max amount that can be minted total
    /// @param _sink Destination for sale ETH
    /// @param _royaltyPoints BP of royalties to send to song contract
    constructor(
        string memory baseURI_,
        string memory _contractURI,
        uint256 _reserved,
        uint256 _maxSupply,
        uint256 _royaltyPoints,
        address payable _sink
    ) ERC721A("Chaos Packs", "\u0024PACKS") {
        ethSink = _sink; /*Set the ETH destination - should be immutable split*/
        contractURI = _contractURI; /*Set contract metadata*/
        baseURI = baseURI_; /*Set token metadata*/

        reserved = _reserved; /*Set max admin mint*/
        maxSupply = _maxSupply; /*Set max total mint*/

        royaltyPoints = _royaltyPoints; /*Set royalty amount out of 10000*/
    }

    /*****************
    EXTERNAL MINTING FUNCTIONS
    *****************/
    /// @notice Mint pack by anyone
    /// @dev Sale state must be enabled
    /// @param _quantity How many tokens to buy - up to 100 at a time
    function purchase(uint256 _quantity) external payable oncePerBlock {
        if (!saleEnabled) revert SaleDisabled(); /*Sale must be enabled*/
        if (msg.value != (PRICE * _quantity)) revert InvalidPurchaseValue(); /*Purchase price must be exact*/
        if ((totalSupply() + _quantity) > maxSupply) revert MaxSupplyExceeded(); /*Check against max supply*/
        if (_quantity > MAX_PER_MINT) revert MaxPerTxExceeded(); /*Check against max per mint*/

        _safeMint(msg.sender, _quantity); /*Mint packs to sender*/
    }

    /// @notice Mint special reserve by owner
    /// @param _tos Addresses to mint tokens to
    /// @param _amounts How many tokens to mint
    function batchMintReserve(
        address[] calldata _tos,
        uint256[] calldata _amounts
    ) external onlyOwner {
        if (_tos.length != _amounts.length) revert LengthMismatch();
        for (uint256 index = 0; index < _tos.length; index++) {
            _mintReserve(_amounts[index], _tos[index]);
        }
    }

    /// @notice Mint special reserve by owner
    /// @param _to Address to mint tokens to
    /// @param _quantity How many tokens to mint
    function mintReserve(uint256 _quantity, address _to) external onlyOwner {
        _mintReserve(_quantity, _to);
    }

    /*****************
    INTERNAL MINTING FUNCTIONS
    *****************/
    /// @notice Mint special reserve by owner
    /// @param _to Address to mint tokens to
    /// @param _quantity How many tokens to mint
    function _mintReserve(uint256 _quantity, address _to) internal {
        if (_quantity > reserved) revert MaxReserveExceeded(); /*Check against max admin mint*/
        if ((totalSupply() + _quantity) > maxSupply)
            /*Check against max supply*/
            revert MaxSupplyExceeded();
        reserved -= _quantity; /*Decrement reserve*/
        _safeMint(_to, _quantity); /*Mint packs to specified destination*/
    }

    /*****************
    PACK OPENING
    *****************/
    /// @notice Burn pack by song contract
    /// @param _packId Which pack to burn
    function burnPack(uint256 _packId) external returns (bool) {
        if (msg.sender != songContract) revert OnlySongContractCanBurn(); /*Packs can only be burned by opening in song contract*/
        _burn(_packId); /*Burn the pack*/
        return true;
    }

    /*****************
    CONFIG FUNCTIONS
    *****************/
    /// @notice Set sale proceeds address
    /// @param _sink new sink
    function setSink(address payable _sink) external onlyOwner {
        ethSink = _sink;
    }

    /// @notice Set states enabled or disabled as owner
    /// @param _enabled specified state on or off
    function setSaleEnabled(bool _enabled) external onlyOwner {
        saleEnabled = _enabled;
    }

    /// @notice Set royalty percentage
    /// @param _royaltyPoints Royalty percentage out of 10000
    function setRoyaltyPoints(uint256 _royaltyPoints) external onlyOwner {
        royaltyPoints = _royaltyPoints;
    }

    /// @notice Set song contract as owner
    /// @param _songContract Song contract address
    function setSongContract(address _songContract) external onlyOwner {
        if (songContractLocked) revert SongContractLocked();
        songContract = _songContract;
    }

    /// @notice Lock song contract against further changes
    function lockSongContract() external onlyOwner {
        if (songContractLocked) revert SongContractLocked();
        songContractLocked = true;
    }

    /// @notice Set new base URI
    /// @param baseURI_ String to prepend to token IDs
    function setBaseURI(string memory baseURI_) external onlyOwner {
        baseURI = baseURI_;
    }

    /// @notice Set new contract URI
    /// @param _contractURI Contract metadata json
    function setContractURI(string memory _contractURI) external onlyOwner {
        contractURI = _contractURI;
    }

    /*****************
    DISTRIBUTION FUNCTIONS
    *****************/
    /// @notice Withdraw sale proceeds to sink
    function withdrawToSink() external onlyOwner {
        ethSink.safeTransferETH(address(this).balance);
    }

    /*****************
    Public view interfaces
    *****************/
    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        return
            bytes(baseURI).length > 0
                ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json"))
                : "";
    }

    /// @notice Called with the sale price to determine how much royalty
    //          is owed and to whom.
    /// @param _tokenId - the NFT asset queried for royalty information
    /// @param _value - the sale price of the NFT asset specified by _tokenId
    /// @return _receiver - address of who should be sent the royalty payment
    /// @return _royaltyAmount - the royalty payment amount for value sale price
    function royaltyInfo(uint256 _tokenId, uint256 _value)
        external
        view
        override(IERC2981Royalties)
        returns (address _receiver, uint256 _royaltyAmount)
    {
        return (songContract, (_value * royaltyPoints) / 10000);
    }
}

File 6 of 18 : ISplitMain.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;

import {ERC20} from '@rari-capital/solmate/src/tokens/ERC20.sol';

/**
 * @title ISplitMain
 * @author 0xSplits <[email protected]>
 */
interface ISplitMain {
  /**
   * FUNCTIONS
   */

  function walletImplementation() external returns (address);

  function createSplit(
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee,
    address controller
  ) external returns (address);

  function predictImmutableSplitAddress(
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee
  ) external view returns (address);

  function updateSplit(
    address split,
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee
  ) external;

  function transferControl(address split, address newController) external;

  function cancelControlTransfer(address split) external;

  function acceptControl(address split) external;

  function makeSplitImmutable(address split) external;

  function distributeETH(
    address split,
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee,
    address distributorAddress
  ) external;

  function updateAndDistributeETH(
    address split,
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee,
    address distributorAddress
  ) external;

  function distributeERC20(
    address split,
    ERC20 token,
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee,
    address distributorAddress
  ) external;

  function updateAndDistributeERC20(
    address split,
    ERC20 token,
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee,
    address distributorAddress
  ) external;

  function withdraw(
    address account,
    uint256 withdrawETH,
    ERC20[] calldata tokens
  ) external;

  /**
   * EVENTS
   */

  /** @notice emitted after each successful split creation
   *  @param split Address of the created split
   */
  event CreateSplit(address indexed split);

  /** @notice emitted after each successful split update
   *  @param split Address of the updated split
   */
  event UpdateSplit(address indexed split);

  /** @notice emitted after each initiated split control transfer
   *  @param split Address of the split control transfer was initiated for
   *  @param newPotentialController Address of the split's new potential controller
   */
  event InitiateControlTransfer(
    address indexed split,
    address indexed newPotentialController
  );

  /** @notice emitted after each canceled split control transfer
   *  @param split Address of the split control transfer was canceled for
   */
  event CancelControlTransfer(address indexed split);

  /** @notice emitted after each successful split control transfer
   *  @param split Address of the split control was transferred for
   *  @param previousController Address of the split's previous controller
   *  @param newController Address of the split's new controller
   */
  event ControlTransfer(
    address indexed split,
    address indexed previousController,
    address indexed newController
  );

  /** @notice emitted after each successful ETH balance split
   *  @param split Address of the split that distributed its balance
   *  @param amount Amount of ETH distributed
   *  @param distributorAddress Address to credit distributor fee to
   */
  event DistributeETH(
    address indexed split,
    uint256 amount,
    address indexed distributorAddress
  );

  /** @notice emitted after each successful ERC20 balance split
   *  @param split Address of the split that distributed its balance
   *  @param token Address of ERC20 distributed
   *  @param amount Amount of ERC20 distributed
   *  @param distributorAddress Address to credit distributor fee to
   */
  event DistributeERC20(
    address indexed split,
    ERC20 indexed token,
    uint256 amount,
    address indexed distributorAddress
  );

  /** @notice emitted after each successful withdrawal
   *  @param account Address that funds were withdrawn to
   *  @param ethAmount Amount of ETH withdrawn
   *  @param tokens Addresses of ERC20s withdrawn
   *  @param tokenAmounts Amounts of corresponding ERC20s withdrawn
   */
  event Withdrawal(
    address indexed account,
    uint256 ethAmount,
    ERC20[] tokens,
    uint256[] tokenAmounts
  );
}

File 7 of 18 : ERC721ABurnable.sol
// SPDX-License-Identifier: MIT
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import "../ERC721A.sol";

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

File 8 of 18 : BatchShuffle.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

/// @title BatchShuffle
/// @notice Assign random offsets based on seed input. Remove selected offset from set so it cannot be used multiple times
abstract contract BatchShuffle {
    uint256 internal immutable _batchSize; /*Number of consecutive tokens using the same offset*/
    uint256 internal immutable _startShuffledId; /*Offset to add to all token IDs*/

    mapping(uint256 => uint16) public availableIds; /*Mapping to use to track used offsets*/
    uint16 public availableCount; /*Track the available count to know the id of the current max offset*/
    mapping(uint256 => uint256) public offsets; /*Store offsets once found*/

    /// @notice Constructor sets the shuffle parameters
    /// @param _availableCount Max number of offsets
    /// @param batchSize_ Number of consecutive tokens using the same offset
    /// @param startShuffledId_ Offset to add to all token IDs
    constructor(
        uint16 _availableCount,
        uint256 batchSize_,
        uint256 startShuffledId_
    ) {
        availableCount = _availableCount; /*Set max offsets*/
        _batchSize = batchSize_; /*Set consecutive tokens using same offset*/
        _startShuffledId = startShuffledId_; /*Set offset for all token IDs*/
    }

    /// @notice Set offset at index using seed
    /// @param _index Offset to set
    /// @param _seed Number fr RNG
    function _setNextOffset(uint256 _index, uint256 _seed) internal {
        require(availableCount > 0, "Sold out"); /*Revert once we use up all indices*/
        // Get index of ID to mint from available ids
        uint256 swapIndex = _seed % availableCount;
        // Load in new id
        uint256 newId = availableIds[swapIndex];
        // If unset, assume equals index
        if (newId == 0) {
            newId = swapIndex;
        }
        uint16 lastIndex = availableCount - 1;
        uint16 lastId = availableIds[lastIndex];
        if (lastId == 0) {
            lastId = lastIndex;
        }
        // Set last value as swapped index
        availableIds[swapIndex] = lastId;

        availableCount--;

        offsets[_index] = newId;
    }

    /// @dev Get the token ID to use for URI of a token ID
    /// @param _tokenId Token to check
    function getShuffledTokenId(uint256 _tokenId)
        public
        view
        returns (uint256)
    {
        uint256 _batchIndex = _tokenId % _batchSize; /*Get the offset within the batch*/
        uint256 _batchStart = _tokenId - _batchIndex; /*Offsets are stored for batches of 4 consecutive songs*/
        uint256 _offset = offsets[_batchStart];
        uint256 _shuffledTokenId = (_offset * _batchSize) +
            _startShuffledId +
            _batchIndex; /*Add to token ID to get shuffled ID*/

        return _shuffledTokenId;
    }
}

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

/// @title IERC2981Royalties
/// @dev Interface for the ERC2981 - Token Royalty standard
interface IERC2981Royalties {
    /// @notice Called with the sale price to determine how much royalty
    //          is owed and to whom.
    /// @param _tokenId - the NFT asset queried for royalty information
    /// @param _value - the sale price of the NFT asset specified by _tokenId
    /// @return _receiver - address of who should be sent the royalty payment
    /// @return _royaltyAmount - the royalty payment amount for value sale price
    function royaltyInfo(uint256 _tokenId, uint256 _value)
        external
        view
        returns (address _receiver, uint256 _royaltyAmount);
}

File 10 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 11 of 18 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

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

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

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

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

    string public name;

    string public symbol;

    uint8 public immutable decimals;

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

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

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

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

    bytes32 public constant PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

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

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

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

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

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

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

        return true;
    }

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

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

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

        return true;
    }

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

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

        balanceOf[from] -= amount;

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

        emit Transfer(from, to, amount);

        return true;
    }

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

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

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

            address recoveredAddress = ecrecover(digest, v, r, s);

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

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();

/**
 * @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 Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Compiler will pack this into a single 256bit word.
    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;
    }

    // Compiler will pack this into a single 256bit word.
    struct AddressData {
        // Realistically, 2**64-1 is more than enough.
        uint64 balance;
        // Keeps track of mint count with minimal overhead for tokenomics.
        uint64 numberMinted;
        // Keeps track of burn count with minimal overhead for tokenomics.
        uint64 numberBurned;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux;
    }

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

    // The number of tokens burned.
    uint256 internal _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 _ownershipOf implementation for details.
    mapping(uint256 => TokenOwnership) internal _ownerships;

    // Mapping owner address to address data
    mapping(address => AddressData) private _addressData;

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

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

    /**
     * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
     */
    function totalSupply() public view returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than _currentIndex - _startTokenId() times
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

    /**
     * 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 See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

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

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return uint256(_addressData[owner].numberMinted);
    }

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

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

    /**
     * Sets the auxillary 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 {
        _addressData[owner].aux = aux;
    }

    /**
     * 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)
    {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr && curr < _currentIndex) {
                TokenOwnership memory ownership = _ownerships[curr];
                if (!ownership.burned) {
                    if (ownership.addr != address(0)) {
                        return ownership;
                    }
                    // 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.
                    while (true) {
                        curr--;
                        ownership = _ownerships[curr];
                        if (ownership.addr != address(0)) {
                            return ownership;
                        }
                    }
                }
            }
        }
        revert OwnerQueryForNonexistentToken();
    }

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

    /**
     * @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, tokenId.toString()))
                : "";
    }

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

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

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

        _approve(to, tokenId, owner);
    }

    /**
     * @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 == _msgSender()) revert ApproveToCaller();

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

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

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

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        _transfer(from, to, tokenId);
        if (
            to.isContract() &&
            !_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 &&
            !_ownerships[tokenId].burned;
    }

    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.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        _mint(to, quantity, _data, true);
    }

    /**
     * @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.
     */
    function _mint(
        address to,
        uint256 quantity,
        bytes memory _data,
        bool safe
    ) 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 or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            _addressData[to].balance += uint64(quantity);
            _addressData[to].numberMinted += uint64(quantity);

            _ownerships[startTokenId].addr = to;
            _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);

            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;

            if (safe && to.isContract()) {
                do {
                    emit Transfer(address(0), to, updatedIndex);
                    if (
                        !_checkContractOnERC721Received(
                            address(0),
                            to,
                            updatedIndex++,
                            _data
                        )
                    ) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (updatedIndex != end);
                // Reentrancy protection
                if (_currentIndex != startTokenId) revert();
            } else {
                do {
                    emit Transfer(address(0), to, updatedIndex++);
                } while (updatedIndex != end);
            }
            _currentIndex = updatedIndex;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @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 _transfer(
        address from,
        address to,
        uint256 tokenId
    ) private {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();

        bool isApprovedOrOwner = (_msgSender() == from ||
            isApprovedForAll(from, _msgSender()) ||
            getApproved(tokenId) == _msgSender());

        if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        // 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 {
            _addressData[from].balance -= 1;
            _addressData[to].balance += 1;

            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = to;
            currSlot.startTimestamp = uint64(block.timestamp);

            // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

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

    /**
     * @dev This is 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 {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        address from = prevOwnership.addr;

        if (approvalCheck) {
            bool isApprovedOrOwner = (_msgSender() == from ||
                isApprovedForAll(from, _msgSender()) ||
                getApproved(tokenId) == _msgSender());

            if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        }

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

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

        // 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 {
            AddressData storage addressData = _addressData[from];
            addressData.balance -= 1;
            addressData.numberBurned += 1;

            // Keep track of who burned the token, and the timestamp of burning.
            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = from;
            currSlot.startTimestamp = uint64(block.timestamp);
            currSlot.burned = true;

            // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

        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 Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        address owner
    ) internal {
        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @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
            IERC721Receiver(to).onERC721Received(
                _msgSender(),
                from,
                tokenId,
                _data
            )
        returns (bytes4 retval) {
            return retval == IERC721Receiver(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 14 of 18 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 15 of 18 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 16 of 18 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 17 of 18 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"address","name":"_splitMain","type":"address"},{"internalType":"uint256","name":"_royaltyPoints","type":"uint256"},{"internalType":"uint32","name":"_distributorFee","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BurnPackFailed","type":"error"},{"inputs":[],"name":"CallerIsNotTokenOwner","type":"error"},{"inputs":[],"name":"InvalidOffset","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"PackContractLocked","type":"error"},{"inputs":[],"name":"PacksDisabledUntilSuperchargedComplete","type":"error"},{"inputs":[],"name":"SuperchargeConfigurationNotReady","type":"error"},{"inputs":[],"name":"SuperchargedOffsetAlreadySet","type":"error"},{"inputs":[],"name":"SuperchargedOffsetNotSet","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":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"_opener","type":"address"}],"name":"PackOpened","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":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"availableIds","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tos","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"batchMintSupercharged","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_packIds","type":"uint256[]"}],"name":"batchOpenPack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"address","name":"distributorAddress","type":"address"}],"name":"distributeERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"address","name":"distributorAddress","type":"address"}],"name":"distributeETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributorFee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"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":"uint256","name":"_tokenId","type":"uint256"}],"name":"getShuffledTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getSongTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"lockPackAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mintSupercharged","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"offsets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_packId","type":"uint256"}],"name":"openPack","outputs":[],"stateMutability":"nonpayable","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":[],"name":"packContract","outputs":[{"internalType":"contract ChaosPacks","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"packContractLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payoutSplit","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyPoints","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":"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":"operator","type":"address"},{"internalType":"bool","name":"approved","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":"string","name":"_contractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_distributorFee","type":"uint32"}],"name":"setDistributorFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_packContract","type":"address"}],"name":"setPackContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_royaltyPoints","type":"uint256"}],"name":"setRoyaltyPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setSuperchargedOffset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"splitMain","outputs":[{"internalType":"contract ISplitMain","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"superchargeBalances","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"superchargedOffset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"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"},{"stateMutability":"payable","type":"receive"}]

60e06040523480156200001157600080fd5b506040516200380b3803806200380b833981016040819052620000349162000514565b60408051808201825260058152644368616f7360d81b60208083019182528351808501909452600684526524534f4e475360d01b908401528151611388936004936103e893909262000089916002916200037a565b5080516200009f9060039060208401906200037a565b50506000805550620000b13362000328565b600a805461ffff191661ffff949094169390931790925560805260a0528451620000e39060129060208801906200037a565b508351620000f99060119060208701906200037a565b50600f80546001600160a01b0319166001600160a01b0385161790556040805160028082526060820183526000926020830190803683370190505090506000816000815181106200015a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250506001816001815181106200019e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039290921660209283029190910182015260408051600280825260608201835260009391929091830190803683370190505090506207a12081600081518110620001ff57634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff16815250506207a120816001815181106200023f57634e487b7160e01b600052603260045260246000fd5b63ffffffff90921660209283029190910190910152600f54604051633b00fbc160e11b81526001600160a01b0390911690637601f782906200028d90859085906000903090600401620005b5565b602060405180830381600087803b158015620002a857600080fd5b505af1158015620002bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002e39190620004f0565b60601b6001600160601b03191660c0525050600f805463ffffffff60a01b1916600160a01b63ffffffff9390931692909202919091179055600c5550620006b9915050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620003889062000666565b90600052602060002090601f016020900481019282620003ac5760008555620003f7565b82601f10620003c757805160ff1916838001178555620003f7565b82800160010185558215620003f7579182015b82811115620003f7578251825591602001919060010190620003da565b506200040592915062000409565b5090565b5b808211156200040557600081556001016200040a565b80516001600160a01b03811681146200043857600080fd5b919050565b600082601f8301126200044e578081fd5b81516001600160401b03808211156200046b576200046b620006a3565b604051601f8301601f19908116603f01168101908282118183101715620004965762000496620006a3565b81604052838152602092508683858801011115620004b2578485fd5b8491505b83821015620004d55785820183015181830184015290820190620004b6565b83821115620004e657848385830101525b9695505050505050565b60006020828403121562000502578081fd5b6200050d8262000420565b9392505050565b600080600080600060a086880312156200052c578081fd5b85516001600160401b038082111562000543578283fd5b6200055189838a016200043d565b9650602088015191508082111562000567578283fd5b5062000576888289016200043d565b945050620005876040870162000420565b925060608601519150608086015163ffffffff81168114620005a7578182fd5b809150509295509295909350565b6080808252855190820181905260009060209060a0840190828901845b82811015620005f95781516001600160a01b031684529284019290840190600101620005d2565b50505083810382850152865180825287830191830190845b818110156200063557835163ffffffff168352928401929184019160010162000611565b505063ffffffff8716604086015292506200064e915050565b6001600160a01b038316606083015295945050505050565b600181811c908216806200067b57607f821691505b602082108114156200069d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160a05160c05160601c6130fc6200070f6000396000818161071f015281816110f6015281816111b2015281816115140152611561015260006116de015260008181611696015261170201526130fc6000f3fe60806040526004361061028c5760003560e01c806371817da71161015a578063b88d4fde116100c1578063d528d1181161007a578063d528d11814610816578063dbf32be514610847578063e3f5d2ba1461086b578063e8a3d4851461088b578063e985e9c5146108a0578063f2fde38b146108e957600080fd5b8063b88d4fde14610761578063c0882ecb14610781578063c87b56dd146107a1578063cb1cc2ac146107c1578063ce6de12c146107e1578063cfedd61b146107f657600080fd5b806395d89b411161011357806395d89b411461068a578063962635131461069f5780639e05c118146106bf578063a04c1e3c146106ed578063a12df0e71461070d578063a22cb4651461074157600080fd5b806371817da7146105c85780637ebb2e41146105e957806381914619146105ff57806387d521d81461062c5780638da5cb5b1461064c578063938e3d7b1461066a57600080fd5b80632a55205a116101fe57806355f804b3116101b757806355f804b3146104f65780635cf94d94146105165780636352211e1461055e5780636c0360eb1461057e57806370a0823114610593578063715018a6146105b357600080fd5b80632a55205a146104225780633a20a3541461046157806341315ee01461048157806342842e0e1461049657806342966c68146104b657806350a88c7e146104d657600080fd5b80630fa1dc55116102505780630fa1dc551461036957806318160ddd1461038957806321f634d2146103ac57806323b872dd146103cc57806327988c19146103ec57806327cc374e1461040257600080fd5b806301ffc9a71461029857806306fdde03146102cd578063081812fc146102ef578063095ea7b3146103275780630e769b2b1461034957600080fd5b3661029357005b600080fd5b3480156102a457600080fd5b506102b86102b3366004612abb565b610909565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e261095b565b6040516102c49190612e16565b3480156102fb57600080fd5b5061030f61030a366004612b38565b6109ed565b6040516001600160a01b0390911681526020016102c4565b34801561033357600080fd5b50610347610342366004612914565b610a31565b005b34801561035557600080fd5b50600f5461030f906001600160a01b031681565b34801561037557600080fd5b50610347610384366004612a60565b610abf565b34801561039557600080fd5b50600154600054035b6040519081526020016102c4565b3480156103b857600080fd5b506103476103c7366004612914565b610b0b565b3480156103d857600080fd5b506103476103e736600461282b565b610b4c565b3480156103f857600080fd5b5061039e600d5481565b34801561040e57600080fd5b5061034761041d366004612993565b610b57565b34801561042e57600080fd5b5061044261043d366004612b68565b610c2c565b604080516001600160a01b0390931683526020830191909152016102c4565b34801561046d57600080fd5b5061034761047c3660046127bb565b610c57565b34801561048d57600080fd5b50610347610cce565b3480156104a257600080fd5b506103476104b136600461282b565b610d38565b3480156104c257600080fd5b506103476104d1366004612b38565b610d53565b3480156104e257600080fd5b506103476104f1366004612b38565b610d61565b34801561050257600080fd5b50610347610511366004612af3565b610d6a565b34801561052257600080fd5b506105496105313660046127bb565b60106020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016102c4565b34801561056a57600080fd5b5061030f610579366004612b38565b610da7565b34801561058a57600080fd5b506102e2610db9565b34801561059f57600080fd5b5061039e6105ae3660046127bb565b610e47565b3480156105bf57600080fd5b50610347610e95565b3480156105d457600080fd5b50600e546102b890600160a01b900460ff1681565b3480156105f557600080fd5b5061039e600c5481565b34801561060b57600080fd5b5061039e61061a366004612b38565b600b6020526000908152604090205481565b34801561063857600080fd5b5061039e610647366004612b38565b610ecb565b34801561065857600080fd5b506008546001600160a01b031661030f565b34801561067657600080fd5b50610347610685366004612af3565b610f51565b34801561069657600080fd5b506102e2610f8e565b3480156106ab57600080fd5b506103476106ba366004612b38565b610f9d565b3480156106cb57600080fd5b50600a546106da9061ffff1681565b60405161ffff90911681526020016102c4565b3480156106f957600080fd5b506103476107083660046129fb565b610fcc565b34801561071957600080fd5b5061030f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561074d57600080fd5b5061034761075c3660046128e7565b61122d565b34801561076d57600080fd5b5061034761077c36600461286b565b6112c3565b34801561078d57600080fd5b5061034761079c366004612b89565b611314565b3480156107ad57600080fd5b506102e26107bc366004612b38565b611364565b3480156107cd57600080fd5b506103476107dc36600461293f565b6113f6565b3480156107ed57600080fd5b506103476115d8565b34801561080257600080fd5b5061039e610811366004612b38565b61168e565b34801561082257600080fd5b506106da610831366004612b38565b60096020526000908152604090205461ffff1681565b34801561085357600080fd5b50600f5461054990600160a01b900463ffffffff1681565b34801561087757600080fd5b50600e5461030f906001600160a01b031681565b34801561089757600080fd5b506102e2611745565b3480156108ac57600080fd5b506102b86108bb3660046127f3565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156108f557600080fd5b506103476109043660046127bb565b611752565b60006001600160e01b031982166380ac58cd60e01b148061093a57506001600160e01b03198216635b5e139f60e01b145b8061095557506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606002805461096a90612fc1565b80601f016020809104026020016040519081016040528092919081815260200182805461099690612fc1565b80156109e35780601f106109b8576101008083540402835291602001916109e3565b820191906000526020600020905b8154815290600101906020018083116109c657829003601f168201915b5050505050905090565b60006109f8826117ea565b610a15576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a3c82610da7565b9050806001600160a01b0316836001600160a01b03161415610a715760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610a915750610a8f81336108bb565b155b15610aaf576040516367d9dca160e11b815260040160405180910390fd5b610aba838383611815565b505050565b60005b81811015610aba57610af9838383818110610aed57634e487b7160e01b600052603260045260246000fd5b90506020020135611871565b80610b0381612ffc565b915050610ac2565b6008546001600160a01b03163314610b3e5760405162461bcd60e51b8152600401610b3590612e29565b60405180910390fd5b610b488282611a16565b5050565b610aba838383611a5a565b6008546001600160a01b03163314610b815760405162461bcd60e51b8152600401610b3590612e29565b828114610ba4576040516001621398b960e31b0319815260040160405180910390fd5b60005b83811015610c2557610c13858583818110610bd257634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610be791906127bb565b848484818110610c0757634e487b7160e01b600052603260045260246000fd5b90506020020135611a16565b80610c1d81612ffc565b915050610ba7565b5050505050565b60008030612710600c5485610c419190612ed5565b610c4b9190612e9e565b915091505b9250929050565b6008546001600160a01b03163314610c815760405162461bcd60e51b8152600401610b3590612e29565b600e54600160a01b900460ff1615610cac5760405163845acc1360e01b815260040160405180910390fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b03163314610cf85760405162461bcd60e51b8152600401610b3590612e29565b600e54600160a01b900460ff1615610d235760405163845acc1360e01b815260040160405180910390fd5b600e805460ff60a01b1916600160a01b179055565b610aba838383604051806020016040528060008152506112c3565b610d5e816001611c40565b50565b610d5e81611871565b6008546001600160a01b03163314610d945760405162461bcd60e51b8152600401610b3590612e29565b8051610b4890601290602084019061266b565b6000610db282611e01565b5192915050565b60128054610dc690612fc1565b80601f0160208091040260200160405190810160405280929190818152602001828054610df290612fc1565b8015610e3f5780601f10610e1457610100808354040283529160200191610e3f565b820191906000526020600020905b815481529060010190602001808311610e2257829003601f168201915b505050505081565b60006001600160a01b038216610e70576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b03163314610ebf5760405162461bcd60e51b8152600401610b3590612e29565b610ec96000611f1b565b565b6000610ed6826117ea565b610ef357604051630a14c4b560e41b815260040160405180910390fd5b60006103e88310610f0e57610f078361168e565b9050610955565b600d54610f2e5760405163b13a157960e01b815260040160405180910390fd5b600d546103e890610f40908590612e5e565b610f4a9190613017565b9392505050565b6008546001600160a01b03163314610f7b5760405162461bcd60e51b8152600401610b3590612e29565b8051610b4890601190602084019061266b565b60606003805461096a90612fc1565b6008546001600160a01b03163314610fc75760405162461bcd60e51b8152600401610b3590612e29565b600c55565b826000816001600160401b03811115610ff557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561101e578160200160208202803683370190505b50905060005b828110156110dc576103e86010600089898581811061105357634e487b7160e01b600052603260045260246000fd5b905060200201602081019061106891906127bb565b6001600160a01b031681526020810191909152604001600020546110959063ffffffff16620f4240612ef4565b61109f9190612eb2565b8282815181106110bf57634e487b7160e01b600052603260045260246000fd5b63ffffffff90921660209283029190910190910152600101611024565b506040516370a0823160e01b815230600482015261118b907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b038716906370a082319060240160206040518083038186803b15801561114257600080fd5b505afa158015611156573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117a9190612b50565b6001600160a01b0387169190611f6d565b600f546040516377b1e4e960e01b81526001600160a01b038216916377b1e4e9916111f3917f00000000000000000000000000000000000000000000000000000000000000009189918c918c918991600160a01b90910463ffffffff16908c90600401612d83565b600060405180830381600087803b15801561120d57600080fd5b505af1158015611221573d6000803e3d6000fd5b50505050505050505050565b6001600160a01b0382163314156112575760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6112ce848484611a5a565b6001600160a01b0383163b151580156112f057506112ee84848484611fe6565b155b1561130e576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6008546001600160a01b0316331461133e5760405162461bcd60e51b8152600401610b3590612e29565b600f805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b606061136f826117ea565b61138c57604051630a14c4b560e41b815260040160405180910390fd5b600061139783610ecb565b90506000601280546113a890612fc1565b9050116113c45760405180602001604052806000815250610f4a565b60126113cf826120de565b6040516020016113e0929190612c72565b6040516020818303038152906040529392505050565b816000816001600160401b0381111561141f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611448578160200160208202803683370190505b50905060005b82811015611506576103e86010600088888581811061147d57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061149291906127bb565b6001600160a01b031681526020810191909152604001600020546114bf9063ffffffff16620f4240612ef4565b6114c99190612eb2565b8282815181106114e957634e487b7160e01b600052603260045260246000fd5b63ffffffff9092166020928302919091019091015260010161144e565b5061153a6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016476121f7565b600f546040516352f1c84f60e11b81526001600160a01b0382169163a5e3909e9161159f917f0000000000000000000000000000000000000000000000000000000000000000918a918a918891600160a01b900463ffffffff16908b90600401612d2c565b600060405180830381600087803b1580156115b957600080fd5b505af11580156115cd573d6000803e3d6000fd5b505050505050505050565b6008546001600160a01b031633146116025760405162461bcd60e51b8152600401610b3590612e29565b600d541561162357604051631263c80160e11b815260040160405180910390fd5b6103e86116336001546000540390565b1461165157604051634a9811a160e01b815260040160405180910390fd5b600061165e600143612f43565b40905061166d6103e882613017565b600d819055610d5e5760405162ed0ab960e11b815260040160405180910390fd5b6000806116bb7f000000000000000000000000000000000000000000000000000000000000000084613017565b905060006116c98285612f43565b6000818152600b6020526040812054919250837f00000000000000000000000000000000000000000000000000000000000000006117277f000000000000000000000000000000000000000000000000000000000000000085612ed5565b6117319190612e5e565b61173b9190612e5e565b9695505050505050565b60118054610dc690612fc1565b6008546001600160a01b0316331461177c5760405162461bcd60e51b8152600401610b3590612e29565b6001600160a01b0381166117e15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b35565b610d5e81611f1b565b6000805482108015610955575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600e546040516331a9108f60e11b81526004810183905233916001600160a01b031690636352211e9060240160206040518083038186803b1580156118b557600080fd5b505afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed91906127d7565b6001600160a01b03161461191457604051634143fbf960e01b815260040160405180910390fd5b600d54611934576040516342f3535960e01b815260040160405180910390fd5b600e54604051631f551a8760e31b8152600481018390526001600160a01b039091169063faa8d43890602401602060405180830381600087803b15801561197a57600080fd5b505af115801561198e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b29190612a9f565b6119cf57604051631629142f60e01b815260040160405180910390fd5b6119db33600054612248565b604080518281523360208201527f86ed3e19f8d5b64492a8aa542a0268f79413b19b2f76dcff5b71469d603444e6910160405180910390a150565b6103e881611a276001546000540390565b611a319190612e5e565b1115611a5057604051638a164f6360e01b815260040160405180910390fd5b610b48828261226d565b6000611a6582611e01565b9050836001600160a01b031681600001516001600160a01b031614611a9c5760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480611aba5750611aba85336108bb565b80611ad5575033611aca846109ed565b6001600160a01b0316145b905080611af557604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038416611b1c57604051633a954ecd60e21b815260040160405180910390fd5b611b298585856001612287565b611b3560008487611815565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116611c09576000548214611c0957805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03166000805160206130a783398151915260405160405180910390a4610c25565b6000611c4b83611e01565b80519091508215611cb1576000336001600160a01b0383161480611c745750611c7482336108bb565b80611c8f575033611c84866109ed565b6001600160a01b0316145b905080611caf57604051632ce44b5f60e11b815260040160405180910390fd5b505b611cbf816000866001612287565b611ccb60008583611815565b6001600160a01b0380821660008181526005602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b86526004909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b178555918901808452922080549194909116611dc9576000548214611dc957805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b038416906000805160206130a7833981519152908390a4505060018054810190555050565b604080516060810182526000808252602082018190529181019190915281600054811015611f0257600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290611f005780516001600160a01b031615611e97579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611efb579392505050565b611e97565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060405163a9059cbb60e01b81526001600160a01b03841660048201528260248201526000806044836000895af1915050611fa881612352565b61130e5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610b35565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061201b903390899088908890600401612de3565b602060405180830381600087803b15801561203557600080fd5b505af1925050508015612065575060408051601f3d908101601f1916820190925261206291810190612ad7565b60015b6120c0573d808015612093576040519150601f19603f3d011682016040523d82523d6000602084013e612098565b606091505b5080516120b8576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060816121025750506040805180820190915260018152600360fc1b602082015290565b8160005b811561212c578061211681612ffc565b91506121259050600a83612e9e565b9150612106565b6000816001600160401b0381111561215457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561217e576020820181803683370190505b5090505b84156120d657612193600183612f43565b91506121a0600a86613017565b6121ab906030612e5e565b60f81b8183815181106121ce57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506121f0600a86612e9e565b9450612182565b600080600080600085875af1905080610aba5760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610b35565b61225382600461226d565b6000612260600143612f43565b409050610aba8282612399565b610b488282604051806020016040528060008152506124aa565b6103e882101561130e576001600160a01b0383166122a457600080fd5b6001600160a01b03841615612300576001600160a01b038416600090815260106020526040812080548392906122e190849063ffffffff16612f5a565b92506101000a81548163ffffffff021916908363ffffffff1602179055505b6001600160a01b0383166000908152601060205260408120805483929061232e90849063ffffffff16612e76565b92506101000a81548163ffffffff021916908363ffffffff16021790555050505050565b60003d8261236457806000803e806000fd5b806020811461237c57801561238d5760009250612392565b816000803e60005115159250612392565b600192505b5050919050565b600a5461ffff166123d75760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b6044820152606401610b35565b600a546000906123eb9061ffff1683613017565b60008181526009602052604090205490915061ffff16806124095750805b600a5460009061241f9060019061ffff16612f20565b61ffff80821660009081526009602052604090205491925016806124405750805b6000848152600960205260408120805461ffff191661ffff84811691909117909155600a80549091169161247383612fa3565b825461ffff9182166101009390930a92830291909202199091161790555050506000938452600b6020526040909320929092555050565b610aba83838360016000546001600160a01b0385166124db57604051622e076360e81b815260040160405180910390fd5b836124f95760405163b562e8dd60e01b815260040160405180910390fd5b6125066000868387612287565b6001600160a01b038516600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452600490925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156125b757506001600160a01b0387163b15155b1561262e575b60405182906001600160a01b038916906000906000805160206130a7833981519152908290a46125f66000888480600101955088611fe6565b612613576040516368d2bf6b60e11b815260040160405180910390fd5b808214156125bd57826000541461262957600080fd5b612662565b5b6040516001830192906001600160a01b038916906000906000805160206130a7833981519152908290a48082141561262f575b50600055610c25565b82805461267790612fc1565b90600052602060002090601f01602090048101928261269957600085556126df565b82601f106126b257805160ff19168380011785556126df565b828001600101855582156126df579182015b828111156126df5782518255916020019190600101906126c4565b506126eb9291506126ef565b5090565b5b808211156126eb57600081556001016126f0565b60006001600160401b038084111561271e5761271e613057565b604051601f8501601f19908116603f0116810190828211818310171561274657612746613057565b8160405280935085815286868601111561275f57600080fd5b858560208301376000602087830101525050509392505050565b60008083601f84011261278a578182fd5b5081356001600160401b038111156127a0578182fd5b6020830191508360208260051b8501011115610c5057600080fd5b6000602082840312156127cc578081fd5b8135610f4a8161306d565b6000602082840312156127e8578081fd5b8151610f4a8161306d565b60008060408385031215612805578081fd5b82356128108161306d565b915060208301356128208161306d565b809150509250929050565b60008060006060848603121561283f578081fd5b833561284a8161306d565b9250602084013561285a8161306d565b929592945050506040919091013590565b60008060008060808587031215612880578081fd5b843561288b8161306d565b9350602085013561289b8161306d565b92506040850135915060608501356001600160401b038111156128bc578182fd5b8501601f810187136128cc578182fd5b6128db87823560208401612704565b91505092959194509250565b600080604083850312156128f9578182fd5b82356129048161306d565b9150602083013561282081613082565b60008060408385031215612926578182fd5b82356129318161306d565b946020939093013593505050565b600080600060408486031215612953578283fd5b83356001600160401b03811115612968578384fd5b61297486828701612779565b90945092505060208401356129888161306d565b809150509250925092565b600080600080604085870312156129a8578384fd5b84356001600160401b03808211156129be578586fd5b6129ca88838901612779565b909650945060208701359150808211156129e2578384fd5b506129ef87828801612779565b95989497509550505050565b60008060008060608587031215612a10578182fd5b84356001600160401b03811115612a25578283fd5b612a3187828801612779565b9095509350506020850135612a458161306d565b91506040850135612a558161306d565b939692955090935050565b60008060208385031215612a72578182fd5b82356001600160401b03811115612a87578283fd5b612a9385828601612779565b90969095509350505050565b600060208284031215612ab0578081fd5b8151610f4a81613082565b600060208284031215612acc578081fd5b8135610f4a81613090565b600060208284031215612ae8578081fd5b8151610f4a81613090565b600060208284031215612b04578081fd5b81356001600160401b03811115612b19578182fd5b8201601f81018413612b29578182fd5b6120d684823560208401612704565b600060208284031215612b49578081fd5b5035919050565b600060208284031215612b61578081fd5b5051919050565b60008060408385031215612b7a578182fd5b50508035926020909101359150565b600060208284031215612b9a578081fd5b813563ffffffff81168114610f4a578182fd5b81835260006020808501945082825b85811015612bea578135612bcf8161306d565b6001600160a01b031687529582019590820190600101612bbc565b509495945050505050565b6000815180845260208085019450808401835b83811015612bea57815163ffffffff1687529582019590820190600101612c08565b60008151808452612c42816020860160208601612f77565b601f01601f19169290920160200192915050565b60008151612c68818560208601612f77565b9290920192915050565b600080845482600182811c915080831680612c8e57607f831692505b6020808410821415612cae57634e487b7160e01b87526022600452602487fd5b818015612cc25760018114612cd357612cff565b60ff19861689528489019650612cff565b60008b815260209020885b86811015612cf75781548b820152908501908301612cde565b505084890196505b505050505050612d23612d128286612c56565b64173539b7b760d91b815260050190565b95945050505050565b600060018060a01b03808916835260a06020840152612d4f60a08401888a612bad565b8381036040850152612d618188612bf5565b63ffffffff969096166060850152509290921660809091015250949350505050565b600060018060a01b03808a168352808916602084015260c06040840152612dae60c08401888a612bad565b8381036060850152612dc08188612bf5565b63ffffffff969096166080850152509290921660a0909101525095945050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061173b90830184612c2a565b602081526000610f4a6020830184612c2a565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115612e7157612e7161302b565b500190565b600063ffffffff808316818516808303821115612e9557612e9561302b565b01949350505050565b600082612ead57612ead613041565b500490565b600063ffffffff80841680612ec957612ec9613041565b92169190910492915050565b6000816000190483118215151615612eef57612eef61302b565b500290565b600063ffffffff80831681851681830481118215151615612f1757612f1761302b565b02949350505050565b600061ffff83811690831681811015612f3b57612f3b61302b565b039392505050565b600082821015612f5557612f5561302b565b500390565b600063ffffffff83811690831681811015612f3b57612f3b61302b565b60005b83811015612f92578181015183820152602001612f7a565b8381111561130e5750506000910152565b600061ffff821680612fb757612fb761302b565b6000190192915050565b600181811c90821680612fd557607f821691505b60208210811415612ff657634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156130105761301061302b565b5060010190565b60008261302657613026613041565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610d5e57600080fd5b8015158114610d5e57600080fd5b6001600160e01b031981168114610d5e57600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220cf70d80bba472af47dbbe073a536ce2e3d3e1b2d51a9c3cb9cfc4e488b6f9b2664736f6c6343000804003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001200000000000000000000000002ed6c4b5da6378c7897ac67ba9e43102feb694ee00000000000000000000000000000000000000000000000000000000000002ee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656964697777676d667637346a337a736534756732366a7a61786579796d63756f6c7035636a756d7565356d766e6f767967683536792f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d563242454b6e75643477616f51676b6e7a425776466d774371454b63357675324566683157624770664e534c0000000000000000000000

Deployed Bytecode

0x60806040526004361061028c5760003560e01c806371817da71161015a578063b88d4fde116100c1578063d528d1181161007a578063d528d11814610816578063dbf32be514610847578063e3f5d2ba1461086b578063e8a3d4851461088b578063e985e9c5146108a0578063f2fde38b146108e957600080fd5b8063b88d4fde14610761578063c0882ecb14610781578063c87b56dd146107a1578063cb1cc2ac146107c1578063ce6de12c146107e1578063cfedd61b146107f657600080fd5b806395d89b411161011357806395d89b411461068a578063962635131461069f5780639e05c118146106bf578063a04c1e3c146106ed578063a12df0e71461070d578063a22cb4651461074157600080fd5b806371817da7146105c85780637ebb2e41146105e957806381914619146105ff57806387d521d81461062c5780638da5cb5b1461064c578063938e3d7b1461066a57600080fd5b80632a55205a116101fe57806355f804b3116101b757806355f804b3146104f65780635cf94d94146105165780636352211e1461055e5780636c0360eb1461057e57806370a0823114610593578063715018a6146105b357600080fd5b80632a55205a146104225780633a20a3541461046157806341315ee01461048157806342842e0e1461049657806342966c68146104b657806350a88c7e146104d657600080fd5b80630fa1dc55116102505780630fa1dc551461036957806318160ddd1461038957806321f634d2146103ac57806323b872dd146103cc57806327988c19146103ec57806327cc374e1461040257600080fd5b806301ffc9a71461029857806306fdde03146102cd578063081812fc146102ef578063095ea7b3146103275780630e769b2b1461034957600080fd5b3661029357005b600080fd5b3480156102a457600080fd5b506102b86102b3366004612abb565b610909565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e261095b565b6040516102c49190612e16565b3480156102fb57600080fd5b5061030f61030a366004612b38565b6109ed565b6040516001600160a01b0390911681526020016102c4565b34801561033357600080fd5b50610347610342366004612914565b610a31565b005b34801561035557600080fd5b50600f5461030f906001600160a01b031681565b34801561037557600080fd5b50610347610384366004612a60565b610abf565b34801561039557600080fd5b50600154600054035b6040519081526020016102c4565b3480156103b857600080fd5b506103476103c7366004612914565b610b0b565b3480156103d857600080fd5b506103476103e736600461282b565b610b4c565b3480156103f857600080fd5b5061039e600d5481565b34801561040e57600080fd5b5061034761041d366004612993565b610b57565b34801561042e57600080fd5b5061044261043d366004612b68565b610c2c565b604080516001600160a01b0390931683526020830191909152016102c4565b34801561046d57600080fd5b5061034761047c3660046127bb565b610c57565b34801561048d57600080fd5b50610347610cce565b3480156104a257600080fd5b506103476104b136600461282b565b610d38565b3480156104c257600080fd5b506103476104d1366004612b38565b610d53565b3480156104e257600080fd5b506103476104f1366004612b38565b610d61565b34801561050257600080fd5b50610347610511366004612af3565b610d6a565b34801561052257600080fd5b506105496105313660046127bb565b60106020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016102c4565b34801561056a57600080fd5b5061030f610579366004612b38565b610da7565b34801561058a57600080fd5b506102e2610db9565b34801561059f57600080fd5b5061039e6105ae3660046127bb565b610e47565b3480156105bf57600080fd5b50610347610e95565b3480156105d457600080fd5b50600e546102b890600160a01b900460ff1681565b3480156105f557600080fd5b5061039e600c5481565b34801561060b57600080fd5b5061039e61061a366004612b38565b600b6020526000908152604090205481565b34801561063857600080fd5b5061039e610647366004612b38565b610ecb565b34801561065857600080fd5b506008546001600160a01b031661030f565b34801561067657600080fd5b50610347610685366004612af3565b610f51565b34801561069657600080fd5b506102e2610f8e565b3480156106ab57600080fd5b506103476106ba366004612b38565b610f9d565b3480156106cb57600080fd5b50600a546106da9061ffff1681565b60405161ffff90911681526020016102c4565b3480156106f957600080fd5b506103476107083660046129fb565b610fcc565b34801561071957600080fd5b5061030f7f0000000000000000000000002bcc9b134f90fb45bd73de3b3af20cde96cc241b81565b34801561074d57600080fd5b5061034761075c3660046128e7565b61122d565b34801561076d57600080fd5b5061034761077c36600461286b565b6112c3565b34801561078d57600080fd5b5061034761079c366004612b89565b611314565b3480156107ad57600080fd5b506102e26107bc366004612b38565b611364565b3480156107cd57600080fd5b506103476107dc36600461293f565b6113f6565b3480156107ed57600080fd5b506103476115d8565b34801561080257600080fd5b5061039e610811366004612b38565b61168e565b34801561082257600080fd5b506106da610831366004612b38565b60096020526000908152604090205461ffff1681565b34801561085357600080fd5b50600f5461054990600160a01b900463ffffffff1681565b34801561087757600080fd5b50600e5461030f906001600160a01b031681565b34801561089757600080fd5b506102e2611745565b3480156108ac57600080fd5b506102b86108bb3660046127f3565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156108f557600080fd5b506103476109043660046127bb565b611752565b60006001600160e01b031982166380ac58cd60e01b148061093a57506001600160e01b03198216635b5e139f60e01b145b8061095557506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606002805461096a90612fc1565b80601f016020809104026020016040519081016040528092919081815260200182805461099690612fc1565b80156109e35780601f106109b8576101008083540402835291602001916109e3565b820191906000526020600020905b8154815290600101906020018083116109c657829003601f168201915b5050505050905090565b60006109f8826117ea565b610a15576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a3c82610da7565b9050806001600160a01b0316836001600160a01b03161415610a715760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610a915750610a8f81336108bb565b155b15610aaf576040516367d9dca160e11b815260040160405180910390fd5b610aba838383611815565b505050565b60005b81811015610aba57610af9838383818110610aed57634e487b7160e01b600052603260045260246000fd5b90506020020135611871565b80610b0381612ffc565b915050610ac2565b6008546001600160a01b03163314610b3e5760405162461bcd60e51b8152600401610b3590612e29565b60405180910390fd5b610b488282611a16565b5050565b610aba838383611a5a565b6008546001600160a01b03163314610b815760405162461bcd60e51b8152600401610b3590612e29565b828114610ba4576040516001621398b960e31b0319815260040160405180910390fd5b60005b83811015610c2557610c13858583818110610bd257634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610be791906127bb565b848484818110610c0757634e487b7160e01b600052603260045260246000fd5b90506020020135611a16565b80610c1d81612ffc565b915050610ba7565b5050505050565b60008030612710600c5485610c419190612ed5565b610c4b9190612e9e565b915091505b9250929050565b6008546001600160a01b03163314610c815760405162461bcd60e51b8152600401610b3590612e29565b600e54600160a01b900460ff1615610cac5760405163845acc1360e01b815260040160405180910390fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b03163314610cf85760405162461bcd60e51b8152600401610b3590612e29565b600e54600160a01b900460ff1615610d235760405163845acc1360e01b815260040160405180910390fd5b600e805460ff60a01b1916600160a01b179055565b610aba838383604051806020016040528060008152506112c3565b610d5e816001611c40565b50565b610d5e81611871565b6008546001600160a01b03163314610d945760405162461bcd60e51b8152600401610b3590612e29565b8051610b4890601290602084019061266b565b6000610db282611e01565b5192915050565b60128054610dc690612fc1565b80601f0160208091040260200160405190810160405280929190818152602001828054610df290612fc1565b8015610e3f5780601f10610e1457610100808354040283529160200191610e3f565b820191906000526020600020905b815481529060010190602001808311610e2257829003601f168201915b505050505081565b60006001600160a01b038216610e70576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b03163314610ebf5760405162461bcd60e51b8152600401610b3590612e29565b610ec96000611f1b565b565b6000610ed6826117ea565b610ef357604051630a14c4b560e41b815260040160405180910390fd5b60006103e88310610f0e57610f078361168e565b9050610955565b600d54610f2e5760405163b13a157960e01b815260040160405180910390fd5b600d546103e890610f40908590612e5e565b610f4a9190613017565b9392505050565b6008546001600160a01b03163314610f7b5760405162461bcd60e51b8152600401610b3590612e29565b8051610b4890601190602084019061266b565b60606003805461096a90612fc1565b6008546001600160a01b03163314610fc75760405162461bcd60e51b8152600401610b3590612e29565b600c55565b826000816001600160401b03811115610ff557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561101e578160200160208202803683370190505b50905060005b828110156110dc576103e86010600089898581811061105357634e487b7160e01b600052603260045260246000fd5b905060200201602081019061106891906127bb565b6001600160a01b031681526020810191909152604001600020546110959063ffffffff16620f4240612ef4565b61109f9190612eb2565b8282815181106110bf57634e487b7160e01b600052603260045260246000fd5b63ffffffff90921660209283029190910190910152600101611024565b506040516370a0823160e01b815230600482015261118b907f0000000000000000000000002bcc9b134f90fb45bd73de3b3af20cde96cc241b906001600160a01b038716906370a082319060240160206040518083038186803b15801561114257600080fd5b505afa158015611156573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117a9190612b50565b6001600160a01b0387169190611f6d565b600f546040516377b1e4e960e01b81526001600160a01b038216916377b1e4e9916111f3917f0000000000000000000000002bcc9b134f90fb45bd73de3b3af20cde96cc241b9189918c918c918991600160a01b90910463ffffffff16908c90600401612d83565b600060405180830381600087803b15801561120d57600080fd5b505af1158015611221573d6000803e3d6000fd5b50505050505050505050565b6001600160a01b0382163314156112575760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6112ce848484611a5a565b6001600160a01b0383163b151580156112f057506112ee84848484611fe6565b155b1561130e576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6008546001600160a01b0316331461133e5760405162461bcd60e51b8152600401610b3590612e29565b600f805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b606061136f826117ea565b61138c57604051630a14c4b560e41b815260040160405180910390fd5b600061139783610ecb565b90506000601280546113a890612fc1565b9050116113c45760405180602001604052806000815250610f4a565b60126113cf826120de565b6040516020016113e0929190612c72565b6040516020818303038152906040529392505050565b816000816001600160401b0381111561141f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611448578160200160208202803683370190505b50905060005b82811015611506576103e86010600088888581811061147d57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061149291906127bb565b6001600160a01b031681526020810191909152604001600020546114bf9063ffffffff16620f4240612ef4565b6114c99190612eb2565b8282815181106114e957634e487b7160e01b600052603260045260246000fd5b63ffffffff9092166020928302919091019091015260010161144e565b5061153a6001600160a01b037f0000000000000000000000002bcc9b134f90fb45bd73de3b3af20cde96cc241b16476121f7565b600f546040516352f1c84f60e11b81526001600160a01b0382169163a5e3909e9161159f917f0000000000000000000000002bcc9b134f90fb45bd73de3b3af20cde96cc241b918a918a918891600160a01b900463ffffffff16908b90600401612d2c565b600060405180830381600087803b1580156115b957600080fd5b505af11580156115cd573d6000803e3d6000fd5b505050505050505050565b6008546001600160a01b031633146116025760405162461bcd60e51b8152600401610b3590612e29565b600d541561162357604051631263c80160e11b815260040160405180910390fd5b6103e86116336001546000540390565b1461165157604051634a9811a160e01b815260040160405180910390fd5b600061165e600143612f43565b40905061166d6103e882613017565b600d819055610d5e5760405162ed0ab960e11b815260040160405180910390fd5b6000806116bb7f000000000000000000000000000000000000000000000000000000000000000484613017565b905060006116c98285612f43565b6000818152600b6020526040812054919250837f00000000000000000000000000000000000000000000000000000000000003e86117277f000000000000000000000000000000000000000000000000000000000000000485612ed5565b6117319190612e5e565b61173b9190612e5e565b9695505050505050565b60118054610dc690612fc1565b6008546001600160a01b0316331461177c5760405162461bcd60e51b8152600401610b3590612e29565b6001600160a01b0381166117e15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b35565b610d5e81611f1b565b6000805482108015610955575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600e546040516331a9108f60e11b81526004810183905233916001600160a01b031690636352211e9060240160206040518083038186803b1580156118b557600080fd5b505afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed91906127d7565b6001600160a01b03161461191457604051634143fbf960e01b815260040160405180910390fd5b600d54611934576040516342f3535960e01b815260040160405180910390fd5b600e54604051631f551a8760e31b8152600481018390526001600160a01b039091169063faa8d43890602401602060405180830381600087803b15801561197a57600080fd5b505af115801561198e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b29190612a9f565b6119cf57604051631629142f60e01b815260040160405180910390fd5b6119db33600054612248565b604080518281523360208201527f86ed3e19f8d5b64492a8aa542a0268f79413b19b2f76dcff5b71469d603444e6910160405180910390a150565b6103e881611a276001546000540390565b611a319190612e5e565b1115611a5057604051638a164f6360e01b815260040160405180910390fd5b610b48828261226d565b6000611a6582611e01565b9050836001600160a01b031681600001516001600160a01b031614611a9c5760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480611aba5750611aba85336108bb565b80611ad5575033611aca846109ed565b6001600160a01b0316145b905080611af557604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038416611b1c57604051633a954ecd60e21b815260040160405180910390fd5b611b298585856001612287565b611b3560008487611815565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116611c09576000548214611c0957805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03166000805160206130a783398151915260405160405180910390a4610c25565b6000611c4b83611e01565b80519091508215611cb1576000336001600160a01b0383161480611c745750611c7482336108bb565b80611c8f575033611c84866109ed565b6001600160a01b0316145b905080611caf57604051632ce44b5f60e11b815260040160405180910390fd5b505b611cbf816000866001612287565b611ccb60008583611815565b6001600160a01b0380821660008181526005602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b86526004909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b178555918901808452922080549194909116611dc9576000548214611dc957805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b038416906000805160206130a7833981519152908390a4505060018054810190555050565b604080516060810182526000808252602082018190529181019190915281600054811015611f0257600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290611f005780516001600160a01b031615611e97579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611efb579392505050565b611e97565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060405163a9059cbb60e01b81526001600160a01b03841660048201528260248201526000806044836000895af1915050611fa881612352565b61130e5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610b35565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061201b903390899088908890600401612de3565b602060405180830381600087803b15801561203557600080fd5b505af1925050508015612065575060408051601f3d908101601f1916820190925261206291810190612ad7565b60015b6120c0573d808015612093576040519150601f19603f3d011682016040523d82523d6000602084013e612098565b606091505b5080516120b8576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060816121025750506040805180820190915260018152600360fc1b602082015290565b8160005b811561212c578061211681612ffc565b91506121259050600a83612e9e565b9150612106565b6000816001600160401b0381111561215457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561217e576020820181803683370190505b5090505b84156120d657612193600183612f43565b91506121a0600a86613017565b6121ab906030612e5e565b60f81b8183815181106121ce57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506121f0600a86612e9e565b9450612182565b600080600080600085875af1905080610aba5760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610b35565b61225382600461226d565b6000612260600143612f43565b409050610aba8282612399565b610b488282604051806020016040528060008152506124aa565b6103e882101561130e576001600160a01b0383166122a457600080fd5b6001600160a01b03841615612300576001600160a01b038416600090815260106020526040812080548392906122e190849063ffffffff16612f5a565b92506101000a81548163ffffffff021916908363ffffffff1602179055505b6001600160a01b0383166000908152601060205260408120805483929061232e90849063ffffffff16612e76565b92506101000a81548163ffffffff021916908363ffffffff16021790555050505050565b60003d8261236457806000803e806000fd5b806020811461237c57801561238d5760009250612392565b816000803e60005115159250612392565b600192505b5050919050565b600a5461ffff166123d75760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b6044820152606401610b35565b600a546000906123eb9061ffff1683613017565b60008181526009602052604090205490915061ffff16806124095750805b600a5460009061241f9060019061ffff16612f20565b61ffff80821660009081526009602052604090205491925016806124405750805b6000848152600960205260408120805461ffff191661ffff84811691909117909155600a80549091169161247383612fa3565b825461ffff9182166101009390930a92830291909202199091161790555050506000938452600b6020526040909320929092555050565b610aba83838360016000546001600160a01b0385166124db57604051622e076360e81b815260040160405180910390fd5b836124f95760405163b562e8dd60e01b815260040160405180910390fd5b6125066000868387612287565b6001600160a01b038516600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452600490925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156125b757506001600160a01b0387163b15155b1561262e575b60405182906001600160a01b038916906000906000805160206130a7833981519152908290a46125f66000888480600101955088611fe6565b612613576040516368d2bf6b60e11b815260040160405180910390fd5b808214156125bd57826000541461262957600080fd5b612662565b5b6040516001830192906001600160a01b038916906000906000805160206130a7833981519152908290a48082141561262f575b50600055610c25565b82805461267790612fc1565b90600052602060002090601f01602090048101928261269957600085556126df565b82601f106126b257805160ff19168380011785556126df565b828001600101855582156126df579182015b828111156126df5782518255916020019190600101906126c4565b506126eb9291506126ef565b5090565b5b808211156126eb57600081556001016126f0565b60006001600160401b038084111561271e5761271e613057565b604051601f8501601f19908116603f0116810190828211818310171561274657612746613057565b8160405280935085815286868601111561275f57600080fd5b858560208301376000602087830101525050509392505050565b60008083601f84011261278a578182fd5b5081356001600160401b038111156127a0578182fd5b6020830191508360208260051b8501011115610c5057600080fd5b6000602082840312156127cc578081fd5b8135610f4a8161306d565b6000602082840312156127e8578081fd5b8151610f4a8161306d565b60008060408385031215612805578081fd5b82356128108161306d565b915060208301356128208161306d565b809150509250929050565b60008060006060848603121561283f578081fd5b833561284a8161306d565b9250602084013561285a8161306d565b929592945050506040919091013590565b60008060008060808587031215612880578081fd5b843561288b8161306d565b9350602085013561289b8161306d565b92506040850135915060608501356001600160401b038111156128bc578182fd5b8501601f810187136128cc578182fd5b6128db87823560208401612704565b91505092959194509250565b600080604083850312156128f9578182fd5b82356129048161306d565b9150602083013561282081613082565b60008060408385031215612926578182fd5b82356129318161306d565b946020939093013593505050565b600080600060408486031215612953578283fd5b83356001600160401b03811115612968578384fd5b61297486828701612779565b90945092505060208401356129888161306d565b809150509250925092565b600080600080604085870312156129a8578384fd5b84356001600160401b03808211156129be578586fd5b6129ca88838901612779565b909650945060208701359150808211156129e2578384fd5b506129ef87828801612779565b95989497509550505050565b60008060008060608587031215612a10578182fd5b84356001600160401b03811115612a25578283fd5b612a3187828801612779565b9095509350506020850135612a458161306d565b91506040850135612a558161306d565b939692955090935050565b60008060208385031215612a72578182fd5b82356001600160401b03811115612a87578283fd5b612a9385828601612779565b90969095509350505050565b600060208284031215612ab0578081fd5b8151610f4a81613082565b600060208284031215612acc578081fd5b8135610f4a81613090565b600060208284031215612ae8578081fd5b8151610f4a81613090565b600060208284031215612b04578081fd5b81356001600160401b03811115612b19578182fd5b8201601f81018413612b29578182fd5b6120d684823560208401612704565b600060208284031215612b49578081fd5b5035919050565b600060208284031215612b61578081fd5b5051919050565b60008060408385031215612b7a578182fd5b50508035926020909101359150565b600060208284031215612b9a578081fd5b813563ffffffff81168114610f4a578182fd5b81835260006020808501945082825b85811015612bea578135612bcf8161306d565b6001600160a01b031687529582019590820190600101612bbc565b509495945050505050565b6000815180845260208085019450808401835b83811015612bea57815163ffffffff1687529582019590820190600101612c08565b60008151808452612c42816020860160208601612f77565b601f01601f19169290920160200192915050565b60008151612c68818560208601612f77565b9290920192915050565b600080845482600182811c915080831680612c8e57607f831692505b6020808410821415612cae57634e487b7160e01b87526022600452602487fd5b818015612cc25760018114612cd357612cff565b60ff19861689528489019650612cff565b60008b815260209020885b86811015612cf75781548b820152908501908301612cde565b505084890196505b505050505050612d23612d128286612c56565b64173539b7b760d91b815260050190565b95945050505050565b600060018060a01b03808916835260a06020840152612d4f60a08401888a612bad565b8381036040850152612d618188612bf5565b63ffffffff969096166060850152509290921660809091015250949350505050565b600060018060a01b03808a168352808916602084015260c06040840152612dae60c08401888a612bad565b8381036060850152612dc08188612bf5565b63ffffffff969096166080850152509290921660a0909101525095945050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061173b90830184612c2a565b602081526000610f4a6020830184612c2a565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115612e7157612e7161302b565b500190565b600063ffffffff808316818516808303821115612e9557612e9561302b565b01949350505050565b600082612ead57612ead613041565b500490565b600063ffffffff80841680612ec957612ec9613041565b92169190910492915050565b6000816000190483118215151615612eef57612eef61302b565b500290565b600063ffffffff80831681851681830481118215151615612f1757612f1761302b565b02949350505050565b600061ffff83811690831681811015612f3b57612f3b61302b565b039392505050565b600082821015612f5557612f5561302b565b500390565b600063ffffffff83811690831681811015612f3b57612f3b61302b565b60005b83811015612f92578181015183820152602001612f7a565b8381111561130e5750506000910152565b600061ffff821680612fb757612fb761302b565b6000190192915050565b600181811c90821680612fd557607f821691505b60208210811415612ff657634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156130105761301061302b565b5060010190565b60008261302657613026613041565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610d5e57600080fd5b8015158114610d5e57600080fd5b6001600160e01b031981168114610d5e57600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220cf70d80bba472af47dbbe073a536ce2e3d3e1b2d51a9c3cb9cfc4e488b6f9b2664736f6c63430008040033

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

00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001200000000000000000000000002ed6c4b5da6378c7897ac67ba9e43102feb694ee00000000000000000000000000000000000000000000000000000000000002ee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656964697777676d667637346a337a736534756732366a7a61786579796d63756f6c7035636a756d7565356d766e6f767967683536792f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d563242454b6e75643477616f51676b6e7a425776466d774371454b63357675324566683157624770664e534c0000000000000000000000

-----Decoded View---------------
Arg [0] : baseURI_ (string): ipfs://bafybeidiwwgmfv74j3zse4ug26jzaxeyymcuolp5cjumue5mvnovygh56y/
Arg [1] : _contractURI (string): ipfs://QmV2BEKnud4waoQgknzBWvFmwCqEKc5vu2Efh1WbGpfNSL
Arg [2] : _splitMain (address): 0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE
Arg [3] : _royaltyPoints (uint256): 750
Arg [4] : _distributorFee (uint32): 0

-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [2] : 0000000000000000000000002ed6c4b5da6378c7897ac67ba9e43102feb694ee
Arg [3] : 00000000000000000000000000000000000000000000000000000000000002ee
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [6] : 697066733a2f2f6261667962656964697777676d667637346a337a7365347567
Arg [7] : 32366a7a61786579796d63756f6c7035636a756d7565356d766e6f7679676835
Arg [8] : 36792f0000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [10] : 697066733a2f2f516d563242454b6e75643477616f51676b6e7a425776466d77
Arg [11] : 4371454b63357675324566683157624770664e534c0000000000000000000000


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.