Contract 0x231d3559aa848Bf10366fB9868590F01d34bF240 2

 
 
Txn Hash
Method
Block
From
To
Value
0x4780125cbe060b0243f0efadf30ed597276047bf55db56523244f9695ead1520Set Approval For...160631522022-11-27 18:36:113 mins agoENS Name calmyourtits.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00068296 10.71372944
0x02a22ad47527fdd29d41b37f13ddb043345d633ec9a077dd01082815eeb06510Safe Transfer Fr...160631452022-11-27 18:34:474 mins ago0x56fa11bcfd7fc0feee343f3542796f1fc81d7e76 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00079902 11.01614766
0xd8cfd411e3d2e2eae4c0006c5e00a461cdb7e3d2addd186ff5a1b588a0e3330aSet Approval For...160631252022-11-27 18:30:478 mins ago0x436246746ce0c4fc26db83eb897fb532e4b82069 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00066587 10.4593626
0xf193d83430ea5c8b3e9cf7978785a123344d41d4f69e2786c4823088f3865235Set Approval For...160631062022-11-27 18:26:4712 mins ago0xdbd85d3373ce7c3954bddee710ed1a682b064b07 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00040296 9.65153706
0x7a110e4368c29d65d3e29d3001b9e8f7f84235d78de4540ba4d2162ae7718788Set Approval For...160630732022-11-27 18:20:1119 mins agoENS Name rcdcn.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00068068 10.67791968
0x05c7495c09dd31c27ea1e6d21673f85a6fe3a20728969006ee9b13154ea36609Set Approval For...160630152022-11-27 18:08:3531 mins agoENS Name ngmibean.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00068943 10.82949312
0x1e39db690862960ffee1cf6d87f79dfe47ccde9d744d699e79650d76b22d0624Set Approval For...160629802022-11-27 18:01:3538 mins ago0xf92a6fd688871f718fcc0bc87e7ffc9bc670e68f IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00066143 10.38956931
0x56c8176d4a0117075c3c3f04fca0f7325adb76bc7adb8f5a7d0cdeffa60cc1beSet Approval For...160629732022-11-27 18:00:1139 mins ago0x5765bdefb7ead33f4eb7935c5d5eb130f4299568 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00066324 10.41804639
0x70389ace23f19d4a54b999bcecd5ae9a659b20901597687dcc8a2b862062eeb6Safe Transfer Fr...160629242022-11-27 17:50:1149 mins ago0xaa10e30b4e1e8d6aed95cb38268389212932b8b2 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00072985 10.06975801
0xf783b7253f33b5f2cb2659257115b2a81e6afd6079b20adcc9a0fa287066f67eSet Approval For...160629232022-11-27 17:49:5949 mins ago0x122118af844eafeaea3e2c43c8346dae87e6c9c0 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00065694 10.31917531
0x825eb8137229fe6b874b27b8c035981896aecaddc991f268fc06ed7e5e2cce59Set Approval For...160628962022-11-27 17:44:3555 mins ago0xde4d4c88e973207c7205f9410a57b1dfa6226ab7 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00072364 11.36685638
0x5b53ad8b6430e080fc96d4e677bc3a0d4bdbdd6600d2e6418041282c0799144aSet Approval For...160627772022-11-27 17:20:351 hr 19 mins ago0xb5f368aad67de0ffa610388183ddbc647c1feeaf IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.0010523 16.5292828
0xfea59cfd4c2558b6d8159f54b7b0d604e5e59d4580d8f3a0dd6f491831bf018dSet Approval For...160627592022-11-27 17:16:471 hr 22 mins ago0xcab6aff590865e99a29fc785ea57421bd44c6323 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00109783 17.24439714
0xf3ccc9310754687293409c0036d40815ece9907aef91a5eec8de287950956ad3Set Approval For...160627292022-11-27 17:10:471 hr 28 mins agoENS Name oper8r.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00068376 10.74046022
0xae4b0cb62e450276ffb331530cfec598ae86793f53b78f7af307963e803160a4Safe Transfer Fr...160627142022-11-27 17:07:471 hr 31 mins ago0x2ea1bde40d9e5dcd95c79292c6d10d93c025394a IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00086267 11.90219089
0xdeb74d1625f8300303d4d7a37863c2b6f025b1a1792f9affbe0ae92250d49342Set Approval For...160626712022-11-27 16:59:111 hr 40 mins agoENS Name foreverkids.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00068298 10.72819894
0x57d9bb09dbd70b80185bd20a68cf4e1886e0e589b969933f56026881b4741fbeTransfer From160626582022-11-27 16:56:351 hr 43 mins ago0x1f6b9819b100b1ae9b8757359e851fb80f48d224 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00077171 11.07375282
0x85dee89e5d55763694487d4147d1cea0ca3c8466ae43d4f9670be73d8e821239Safe Transfer Fr...160625702022-11-27 16:38:472 hrs ago0x6bcd18be79739346eaa7762b4a235ec8a6426679 IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00080275 11.06576969
0xa7e7eebfa1e758bd29dadd796487e33463f1164b690f2883b312f621eaee4e76Set Approval For...160625592022-11-27 16:36:232 hrs 3 mins agoENS Name paperhandman.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00080142 12.58856284
0x8208ac40b578683865083259f6be18cde28645177688af99edd978f0fb73cf31Safe Transfer Fr...160623402022-11-27 15:52:352 hrs 47 mins ago0xb6f8e26bbf9c5494dd153d5d206ca21c523d338d IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00088237 11.1001266
0x36ea417aa19bb5e2be294b3be325a4008d38e6a39d0ecb159471deec81e5d60bSet Approval For...160623262022-11-27 15:49:472 hrs 49 mins agoENS Name 0xscottyb.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00065542 10.28170192
0xeb0c35674601a86ab7e8e7686ee4b5705c0065ed0f20c5e82bbba278caf46856Set Approval For...160622672022-11-27 15:37:593 hrs 1 min agoENS Name blacktitanz.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00076369 11.99596068
0x1c52189f543a5d39492cca6dbf2390157af23dd3d3607512b98a5471bbd30139Set Approval For...160622062022-11-27 15:25:473 hrs 13 mins agoENS Name pogboom.eth IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00075002 11.78115146
0xc2b9663e1b862af54f9170cbe432ad188161248625cbe334a1be9dc2259c5243Set Approval For...160621532022-11-27 15:15:113 hrs 24 mins ago0xccbeffe27d1b2ea84c530bf267d0b38224394c4b IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00072057 11.31862211
0xe9343caca82b1a518000c9e8a4c978af86ec84a01054977879c131c460725c7bSafe Transfer Fr...160621482022-11-27 15:14:113 hrs 25 mins ago0x9bc5f114622cc2cd0509e245c9f32633ce48149e IN  0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether0.00057395 10.36400652
[ Download CSV Export 
Latest 3 internal transactions
Parent Txn Hash Block From To Value
0xd94eb99ac4de9478f7f4c5770d685f3fd58866543130b28a264ae588abc2cc09160350242022-11-23 20:18:113 days 22 hrs ago 0x231d3559aa848bf10366fb9868590f01d34bf240 0xff59b4b3d52728f78020414c720164a17c08f4993,899.15 Ether
0x272f1d0a618f4519b8ae95bcd6296c7f7aa5e944273a7adcba327d46f5516cd2160290612022-11-23 0:17:114 days 18 hrs ago 0xf510dcba81e42e9fe294a3a68b7428dfc59c698b 0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether
0x684e731a607bf6af28e884eedd2d251a2ceec1505a2a66b7656bd7aed3cf6b3c160286742022-11-22 22:58:594 days 19 hrs ago 0x454fdf4f61b4e9b734cfd2e8cfdf779cb6266c8c 0x231d3559aa848bf10366fb9868590f01d34bf2400 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Valhalla

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 11 : ERC721V.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

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

/**
 * @title ERC721V is a slight improvement upon ERC721A for a few select purposes.
 * 
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension. It is optimized for lower gas during batch mints through the ERC721A implementation 
 * by Chiru Labs (https://github.com/chiru-labs/ERC721A)
 *
 * ERC2309 was removed because it will not be used. 
 * Token burning was also removed, but left the reserved bit there.
 * 
 * Ownership's extraData field was modified to be writable without ownership initialized. This allows for multiple
 * mints with different extraData values. A token's extraData will be used as a transfer lockup period and will
 * therefore NOT need to be persisted during a token transfer.
 * 
 * Both token operator approval methods will call a beforeApproval hook that can be overwritten.
 * 
 * Assumptions:
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 * 
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721V is IERC721A {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

    // =============================================================
    //                           CONSTANTS
    // =============================================================

    // Mask of an entry in packed address data.
    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

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

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

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

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

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

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

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

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

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

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

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

    // The `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    // =============================================================
    //                            STORAGE
    // =============================================================

    // The next token ID to be minted.
    uint256 private _currentIndex;

    // Burning disabled.
    // uint256 private _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

    // =============================================================
    //                          CONSTRUCTOR
    // =============================================================

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

    // =============================================================
    //                   TOKEN COUNTING OPERATIONS
    // =============================================================

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

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

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

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

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

    // =============================================================
    //                    ADDRESS DATA OPERATIONS
    // =============================================================

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

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

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

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

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

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

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

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

    /**
     * @dev Returns the token collection name.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

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

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

    // =============================================================
    //                     OWNERSHIPS OPERATIONS
    // =============================================================

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

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

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

    /**
     * @dev Verifies if the address has been set a given ownership value.
     */
    function _ownershipNotInitialized(uint256 ownership) internal pure returns (bool) {
        return ownership & _BITMASK_EXTRA_DATA_COMPLEMENT == 0;
    }

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

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

        unchecked {
            if (_startTokenId() <= curr)
                if (curr < _currentIndex) {
                    uint256 packed = _packedOwnerships[curr];
                    // Burning disabled so we can remove the burned check.
                    // if (packed & _BITMASK_BURNED == 0) {
                    
                    // Invariant:
                    // There will always be an initialized ownership slot
                    // (i.e. `ownership.addr != address(0))
                    // before an unintialized ownership slot
                    // (i.e. `ownership.addr == address(0))
                    // Hence, `curr` will not underflow.
                    //
                    // We can directly compare the packed value.
                    // If the address is zero, packed will be zero.
                    while (_ownershipNotInitialized(packed)) {
                        packed = _packedOwnerships[--curr];
                    }
                    return packed;
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
        // Burning disabled
        // ownership.burned = packed & _BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
    }

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

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

    // =============================================================
    //                      APPROVAL OPERATIONS
    // =============================================================

    /**
     * @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) public payable virtual override {
        _beforeApproval(to);
        address owner = ownerOf(tokenId);

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

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

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
        return _tokenApprovals[tokenId].value;
    }

    /**
     * @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) public virtual override {
        _beforeApproval(operator);
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

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

    /**
     * @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. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex; // If within bounds,
            // Burning disabled so we can remove the burned check.
            // _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; 
    }

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

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedSlotAndAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
        assembly {
            approvedAddressSlot := tokenApproval.slot
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    // =============================================================
    //                      TRANSFER OPERATIONS
    // =============================================================

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * 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
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

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

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

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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

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

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            // - `extraData` to `0` because we use it for token lockup timestamp.
            _packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _BITMASK_NEXT_INITIALIZED
            );

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

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

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @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 memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Hook that is called before any approval for a token or wallet
     *      
     * `approvedAddr` - the address a wallet is trying to grant approval to.
     */
    function _beforeApproval(address approvedAddr) internal virtual {}

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

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

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

    // =============================================================
    //                        MINT OPERATIONS
    // =============================================================

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

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

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

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

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

            // Use assembly to loop and emit the `Transfer` event for gas savings.
            // The duplicated `log4` removes an extra check and reduces stack juggling.
            // The assembly, together with the surrounding Solidity code, have been
            // delicately arranged to nudge the compiler into producing optimized opcodes.
            assembly {
                // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                toMasked := and(to, _BITMASK_ADDRESS)
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    startTokenId // `tokenId`.
                )

                // The `iszero(eq(,))` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
                // The compiler will optimize the `iszero` away for performance.
                for {
                    let tokenId := add(startTokenId, 1)
                } iszero(eq(tokenId, end)) {
                    tokenId := add(tokenId, 1)
                } {
                    // Emit the `Transfer` event. Similar to above.
                    log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                }
            }
            if (toMasked == 0) revert MintToZeroAddress();

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

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

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

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

    // =============================================================
    //                        BURN OPERATIONS
    // =============================================================

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

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

    //     address from = address(uint160(prevOwnershipPacked));

    //     (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

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

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

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

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

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

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

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

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

    // =============================================================
    //                     EXTRA DATA OPERATIONS
    // =============================================================

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

    /**
     * @dev gets the extra data for the ownership data `index`. This can differ from the
     * _packedOwnershipOf(index).extraData because if the address is not initialized it will return
     * the extraData of a different index.
     */
    function _getExtraDataAt(uint256 index) internal virtual returns (uint256) {
      return _packedOwnerships[index] >> _BITPOS_EXTRA_DATA;
    }

    // =============================================================
    //                       OTHER OPERATIONS
    // =============================================================

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

    /**
     * @dev Converts a uint256 to its ASCII string decimal representation.
     */
    function _toString(uint256 value) internal pure virtual returns (string memory str) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

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

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // prettier-ignore
            for { let temp := value } 1 {} {
                str := sub(str, 1)
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                // prettier-ignore
                if iszero(temp) { break }
            }

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

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

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

    // =============================================================
    //                            STRUCTS
    // =============================================================

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

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

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

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

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

    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`,
     * 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,
        bytes calldata data
    ) external payable;

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Transfers `tokenId` 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 payable;

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

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

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

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

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

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

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

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

File 3 of 11 : 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 4 of 11 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "./Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 5 of 11 : 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 6 of 11 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "./IERC2981.sol";
import "./ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

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

pragma solidity ^0.8.0;

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

File 8 of 11 : IERC2981.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard
 */
interface IERC2981 is IERC165 {
    /**
     * ERC165 bytes to add to interface array - set in parent contract
     * implementing this standard
     *
     * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
     * bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
     * _registerInterface(_INTERFACE_ID_ERC2981);
     */

    /**
     * @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 _salePrice - 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 _salePrice
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

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

pragma solidity ^0.8.0;

import "./Context.sol";

error CallerNotOwner();
error OwnerNotZero();

/**
 * @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 internal _owner;

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) revert CallerNotOwner();
    }

    /**
     * @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 {
        if (newOwner == address(0)) revert OwnerNotZero();
        _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 10 of 11 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

File 11 of 11 : Valhalla.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./token/ERC721V.sol";
import "./utils/ERC2981.sol";
import "./utils/IERC165.sol";
import "./utils/Ownable.sol";
import "./utils/ECDSA.sol";

/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//                                                                         //
//    ██╗░░░██╗░█████╗░██╗░░░░░██╗░░██╗░█████╗░██╗░░░░░██╗░░░░░░█████╗░    //
//    ██║░░░██║██╔══██╗██║░░░░░██║░░██║██╔══██╗██║░░░░░██║░░░░░██╔══██╗    //
//    ╚██╗░██╔╝███████║██║░░░░░███████║███████║██║░░░░░██║░░░░░███████║    //
//    ░╚████╔╝░██╔══██║██║░░░░░██╔══██║██╔══██║██║░░░░░██║░░░░░██╔══██║    //
//    ░░╚██╔╝░░██║░░██║███████╗██║░░██║██║░░██║███████╗███████╗██║░░██║    //
//    ░░░╚═╝░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝╚══════╝╚═╝░░╚═╝    //
//                                                                         //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////

/**
 * Subset of a Presale with only the methods that the main minting contract will call.
 */
interface Presale {
    function selectedBids(address presaleAddr) external view returns (uint256);
}

/**
 * Subset of the IOperatorFilterRegistry with only the methods that the main minting contract will call.
 * The owner of the collection is able to manage the registry subscription on the contract's behalf
 */
interface IOperatorFilterRegistry {
    function isOperatorAllowed(
        address registrant,
        address operator
    ) external returns (bool);
}

contract Valhalla is ERC721V, Ownable, ERC2981 {
    using ECDSA for bytes32;

    // =============================================================
    //                            Structs
    // =============================================================

    // Compiler will pack this into one 256-bit word
    struct AuctionParams {
        // auctionNumber; also tracks which bidIndexes are currently live
        uint16 index;
        // Following 2 values will be multiplied by 1 GWEI or 0.000000001 ETH
        // Bid values with GWEI lower than this denomination do NOT add to a bid.
        uint56 startPrice;
        uint56 minStackedBidIncrement;
        // new bids must beat the lowest bid by this percentage. This is a whole
        // percentage number, a value of 10 means new bids must beat old ones by 10%
        uint8 minBidIncrementPercentage;
        // Optional parameter for if a bid was submitted within seconds of ending,
        // endTimestamp will extend to block.timestamp+timeBuffer if that value is greater.
        uint16 timeBuffer;
        // When the auction can start getting bidded on
        uint48 startTimestamp;
        // When the auction can no longer get bidded on
        uint48 endTimestamp;
        // How many tokens are up for auction. If 0, there is NO auction live.
        uint8 numTokens;
    }

    struct Bid {
        address bidder;
        uint192 amount;
        uint64 bidTime;
    }

    struct BidIndex {
        uint8 index;
        bool isSet;
    }

    // =============================================================
    //                            Constants
    // =============================================================

    // Set on contract initialization
    address public immutable PRESALE_ADDRESS;

    // Proof of hash will be given after reveal.
    string public MINT_PROVENANCE_HASH = "037226b21636376001dbfd22f52d1dd72845efa9613baf51a6a011ac731b2327";
    // Owner will be minting this amount to the treasury which happens before
    // any presale or regular sale. Once totalSupply() is over this amount,
    // no more can get minted by {mintDev}
    uint256 public constant TREASURY_SUPPLY = 300;
    // Maximum tokens that can be minted from {mintTier} and {mintPublic}
    uint256 public constant MINT_CAP = 9000;

    // Public mint is unlikely to be enabled as it will get botted, but if
    // is needed this will make it a tiny bit harder to bot the entire remaining.
    uint256 public constant MAX_PUBLIC_MINT_TXN_SIZE = 5;

    // Proof of hash will be given after all tokens are auctioned.
    string public AUCTION_PROVENANCE_HASH = "eb8c88969a4b776d757de962a194f5b4ffaaadb991ecfbb24d806c7bc6397d30";
    // Multiplier for minBidPrice and minBidIncrement to verify bids are large enough
    // Is used so that we can save storage space and fit the auctionParams into one uint256
    uint256 public constant AUCTION_PRICE_MULTIPLIER = 1 gwei;
    uint256 public constant AUCTION_SUPPLY = 1000;
    // At most 5 tokens can be bid on at once
    uint256 public constant MAX_NUM_BIDS = 5;

    // Cheaper gaswise to set this as 10000 instead of MINT_CAP + AUCTION_SUPPLY
    uint256 public constant TOTAL_SUPPLY = 10000;

    // =============================================================
    //                            STORAGE
    // =============================================================

    // Address that houses the implemention to check if operators are allowed or not
    address public operatorFilterRegistryAddress;
    // Address this contract verifies with the registryAddress for allowed operators.
    address public filterRegistrant;

    // Address that will link to the tokenDNA which the metadata relies on.
    address public dnaContractAddress;

    /**
     * Lockup timestamps are saved in uint24 to fit into the _extraData for the _packedOwnerships
     * mapping of ERC721A tokens. In order to still represent a large range of times, we will
     * be saving the hour the token gets unlocked.
     *
     * In {_beforeTokenTransfers}, _extraData * 3600 will be compared with the current block.timestamp.
     */
    uint24 public firstUnlockTime;
    uint24 public secondUnlockTime;
    uint24 public thirdUnlockTime;

    // Determines whether a presale address has already gotten its presale tokens
    mapping(address => bool) public presaleMinted;
    // If a presale address wants their tokens to land in a different wallet
    mapping(address => address) public presaleDelegation;

    string public tokenUriBase;

    // Address used for {mintTier} which will be a majority of the transactions
    address public signer;
    // Used to quickly invalidate batches of signatures if needed.
    uint256 public signatureVersion;
    // Mapping that shows if a tier is active or not
    mapping(string => bool) public isTierActive;
    mapping(bytes32 => bool) public signatureUsed;

    // Price of a single public mint, {mintPublic} is NOT enabled while this value is 0.
    uint256 public publicMintPrice;

    // Address that is permitted to start and stop auctions
    address public auctioneer;
    // The current highest bids made in the auction
    Bid[MAX_NUM_BIDS] public activeBids;
    // The mapping between an address and its active bid. The isSet flag differentiates the default
    // uint value 0 from an actual 0 value.
    mapping(uint256 => mapping(address => BidIndex)) public bidIndexes;

    // All parameters needed to run an auction
    AuctionParams public auctionParams;
    // ETH reserved due to a live auction, cannot be withdrawn by the owner until the
    // owner calls {endAuction} which also mints out the tokens.
    uint256 public reserveAuctionETH;

    // =============================================================
    //                            Events
    // =============================================================

    event TokenLocked(uint256 indexed tokenId, uint256 unlockTimeHr);
    event TokenUnlocked(uint256 indexed tokenId);

    event AuctionStarted(uint256 indexed index);
    event NewBid(
        uint256 indexed auctionIndex,
        address indexed bidder,
        uint256 value
    );
    event BidIncreased(
        uint256 indexed auctionIndex,
        address indexed bidder,
        uint256 oldValue,
        uint256 increment
    );
    event AuctionExtended(uint256 indexed index);

    // =============================================================
    //                          Constructor
    // =============================================================

    constructor(address initialPresale) ERC721V("Valhalla", "VAL") {
        PRESALE_ADDRESS = initialPresale;
    }

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

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

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ERC721V, ERC2981) returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            ERC721V.supportsInterface(interfaceId) ||
            ERC2981.supportsInterface(interfaceId);
    }

    // =============================================================
    //                           IERC2981
    // =============================================================

    /**
     * @notice Allows the owner to set default royalties following EIP-2981 royalty standard.
     */
    function setDefaultRoyalty(
        address receiver,
        uint96 feeNumerator
    ) external onlyOwner {
        _setDefaultRoyalty(receiver, feeNumerator);
    }

    // =============================================================
    //                        Token Metadata
    // =============================================================

    function tokenURI(
        uint256 tokenId
    ) public view override returns (string memory) {
        return string(abi.encodePacked(tokenUriBase, _toString(tokenId)));
    }

    /**
     * @notice Allows the owner to set the base token URI.
     */
    function setTokenURI(string memory newUriBase) external onlyOwner {
        tokenUriBase = newUriBase;
    }

    /**
     * @notice Allows the owner to set the dna contract address.
     */
    function setDnaContract(address dnaAddress) external onlyOwner {
        dnaContractAddress = dnaAddress;
    }

    // =============================================================
    //                 Operator Filter Registry
    // =============================================================
    /**
     * @dev Stops operators from being added as an approved address to transfer.
     * @param operator the address a wallet is trying to grant approval to.
     */
    function _beforeApproval(address operator) internal virtual override {
        if (operatorFilterRegistryAddress.code.length > 0) {
            if (
                !IOperatorFilterRegistry(operatorFilterRegistryAddress)
                    .isOperatorAllowed(filterRegistrant, operator)
            ) {
                revert OperatorNotAllowed();
            }
        }
        super._beforeApproval(operator);
    }

    /**
     * @dev Stops operators that are not approved from doing transfers.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 tokenId,
        uint256 quantity
    ) internal virtual override {
        if (operatorFilterRegistryAddress.code.length > 0) {
            if (
                !IOperatorFilterRegistry(operatorFilterRegistryAddress)
                    .isOperatorAllowed(filterRegistrant, msg.sender)
            ) {
                revert OperatorNotAllowed();
            }
        }
        // expiration time represented in hours. multiply by 60 * 60, or 3600.
        if (_getExtraDataAt(tokenId) * 3600 > block.timestamp)
            revert TokenTransferLocked();
        super._beforeTokenTransfers(from, to, tokenId, quantity);
    }

    /**
     * @notice Allows the owner to set a new registrant contract.
     */
    function setOperatorFilterRegistryAddress(
        address registryAddress
    ) external onlyOwner {
        operatorFilterRegistryAddress = registryAddress;
    }

    /**
     * @notice Allows the owner to set a new registrant address.
     */
    function setFilterRegistrant(address newRegistrant) external onlyOwner {
        filterRegistrant = newRegistrant;
    }

    // =============================================================
    //                          Presale
    // =============================================================

    /**
     * @notice Allows the owner to mint from treasury supply.
     */
    function mintDev(
        address[] memory mintAddresses,
        uint256[] memory mintQuantities
    ) external onlyOwner {
        for (uint256 i = 0; i < mintAddresses.length; ++i) {
            _mint(mintAddresses[i], mintQuantities[i]);
            if (totalSupply() > TREASURY_SUPPLY) revert OverDevSupplyLimit();
        }
    }

    /**
     * @notice Allows the owner to set the presale unlock times.
     */
    function setUnlockTimes(
        uint24 first,
        uint24 second,
        uint24 third
    ) external onlyOwner {
        firstUnlockTime = first;
        secondUnlockTime = second;
        thirdUnlockTime = third;
    }

    /**
     * @notice Allows selected presale addresses to assign wallet address to receive presale mints.
     * @dev This does not do anything for addresses that were not selected on the presale contract.
     */
    function setPresaleMintAddress(address addr) external {
        presaleDelegation[msg.sender] = addr;
    }

    /**
     * @notice Allows owner to mint presale tokens. The ordering is randomzied on-chain so
     * that the owner does not have control over which users get which tokens when uploading
     * an array of presaleUsers
     * @dev Presale contract already guarantees a cap on the # of presale tokens, so
     * we will not check supply against the MINT_CAP in order to save gas.
     */
    function mintPresale(address[] memory presaleUsers) external onlyOwner {
        uint256 nextId = _nextTokenId();

        uint256 supplyLeft = presaleUsers.length;
        while (supplyLeft > 0) {
            // generate a random index less than the supply left
            uint256 randomIndex = uint256(
                keccak256(abi.encodePacked(block.timestamp, supplyLeft))
            ) % supplyLeft;
            address presaleUser = presaleUsers[randomIndex];

            if (presaleMinted[presaleUser])
                revert PresaleAddressAlreadyMinted();
            presaleMinted[presaleUser] = true;

            uint256 tokensOwed = Presale(PRESALE_ADDRESS).selectedBids(
                presaleUser
            );
            _mintPresaleAddress(presaleUser, nextId, tokensOwed);

            unchecked {
                --supplyLeft;
                // Replace the chosen address with the last address not chosen
                presaleUsers[randomIndex] = presaleUsers[supplyLeft];
                nextId += tokensOwed;
            }
        }
    }

    /**
     * @dev mints a certain amount of tokens to the presale address or its delegation
     * if it has delegated another wallet. These tokens will be locked up and released
     * 1/3rd of the amounts at a time.
     */
    function _mintPresaleAddress(
        address presale,
        uint256 nextId,
        uint256 amount
    ) internal {
        if (presaleDelegation[presale] != address(0)) {
            _mint(presaleDelegation[presale], amount);
        } else {
            _mint(presale, amount);
        }

        unchecked {
            // Cheaper gas wise to do every 3 tokens and deal with the remainder afterwards
            // than to do if statements within the loop.
            for (uint256 j = 0; j < amount / 3; ) {
                uint256 start = nextId + j * 3;

                _setExtraDataAt(start, thirdUnlockTime);
                _setExtraDataAt(start + 1, secondUnlockTime);
                _setExtraDataAt(start + 2, firstUnlockTime);
                emit TokenLocked(start, thirdUnlockTime);
                emit TokenLocked(start + 1, secondUnlockTime);
                emit TokenLocked(start + 2, firstUnlockTime);

                ++j;
            }

            // temporarily adjust nextId to do minimal subtractions
            // when setting `extraData` field
            nextId += amount - 1;
            if (amount % 3 == 2) {
                _setExtraDataAt(nextId - 1, thirdUnlockTime);
                emit TokenLocked(nextId - 1, thirdUnlockTime);

                _setExtraDataAt(nextId, secondUnlockTime);
                emit TokenLocked(nextId, secondUnlockTime);
            } else if (amount % 3 == 1) {
                _setExtraDataAt(nextId, thirdUnlockTime);
                emit TokenLocked(nextId, thirdUnlockTime);
            }
        }
    }

    // =============================================================
    //                   External Mint Methods
    // =============================================================

    /**
     * @notice Allows the owner to change the active version of their signatures, this also
     * allows a simple invalidation of all signatures they have created on old versions.
     */
    function setSigner(address signer_) external onlyOwner {
        signer = signer_;
    }

    /**
     * @notice Allows the owner to change the active version of their signatures, this also
     * allows a simple invalidation of all signatures they have created on old versions.
     */
    function setSignatureVersion(uint256 version) external onlyOwner {
        signatureVersion = version;
    }

    /**
     * @notice Allows owner to sets if a certain tier is active or not.
     */
    function setIsTierActive(
        string memory tier,
        bool active
    ) external onlyOwner {
        isTierActive[tier] = active;
    }

    /**
     * @notice Tiered mint for allegiants, immortals, and presale bidders.
     * @dev After a tier is activated by the owner, users with the proper signature for that
     * tier are able to mint based on what the owner has approved for their wallet.
     */
    function mintTier(
        string memory tier,
        uint256 price,
        uint256 version,
        uint256 allowedAmount,
        uint256 buyAmount,
        bytes memory sig
    ) external payable {
        if (totalSupply() + buyAmount > MINT_CAP) revert OverMintLimit();
        if (!isTierActive[tier]) revert TierNotActive();
        if (version != signatureVersion) revert InvalidSignatureVersion();

        if (buyAmount > allowedAmount) revert InvalidSignatureBuyAmount();
        if (msg.value != price * buyAmount) revert IncorrectMsgValue();

        bytes32 hash = ECDSA.toEthSignedMessageHash(
            keccak256(
                abi.encode(
                    tier,
                    address(this),
                    price,
                    version,
                    allowedAmount,
                    msg.sender
                )
            )
        );
        if (signatureUsed[hash]) revert SignatureAlreadyUsed();
        signatureUsed[hash] = true;
        if (hash.recover(sig) != signer) revert InvalidSignature();

        _mint(msg.sender, buyAmount);
    }

    /**
     * @notice Allows the owner to set the public mint price.
     * @dev If this is 0, it is assumed that the public mint is not active.
     */
    function setPublicMintPrice(uint256 price) external onlyOwner {
        publicMintPrice = price;
    }

    /**
     * @notice Public mint method. Will not work while {publicMintPrice} is 0.
     * Unlikely to be enabled because it can be easily botted.
     */
    function mintPublic(uint256 amount) external payable {
        if (tx.origin != msg.sender) revert NotEOA();
        if (totalSupply() + amount > MINT_CAP) revert OverMintLimit();
        if (publicMintPrice == 0) revert PublicMintNotLive();
        if (amount > MAX_PUBLIC_MINT_TXN_SIZE) revert OverMintLimit();

        if (msg.value != amount * publicMintPrice) revert IncorrectMsgValue();
        _mint(msg.sender, amount);
    }

    // =============================================================
    //                       Auction Methods
    // =============================================================

    /**
     * @notice Allows the owner to set the auction parameters
     */
    function setOverallAuctionParams(
        uint40 startPrice_,
        uint40 minStackedBidIncrement_,
        uint8 minBidIncrementPercentage_,
        uint16 timeBuffer_
    ) external onlyOwner {
        auctionParams.startPrice = startPrice_;
        auctionParams.minStackedBidIncrement = minStackedBidIncrement_;
        auctionParams.minBidIncrementPercentage = minBidIncrementPercentage_;
        auctionParams.timeBuffer = timeBuffer_;
    }

    /**
     * @notice Allows the owner to set the auctioneer address.
     */
    function setAuctioneer(address auctioneer_) external onlyOwner {
        auctioneer = auctioneer_;
    }

    /**
     * @notice Allows the autioneer to start the auction of `numTokens` from `startTime` to `endTime`.
     * @dev Auctions can only start after all minting has terminated. We cannot auction more than
     * MAX_NUM_BIDS at a time. Only one auction can be live at a time.
     */
    function startAuction(
        uint8 numTokens,
        uint48 startTime,
        uint48 endTime
    ) external {
        if (auctioneer != msg.sender) revert CallerNotAuctioneer();
        if (totalSupply() < MINT_CAP) revert MintingNotFinished();
        if (totalSupply() + numTokens > TOTAL_SUPPLY) revert OverTokenLimit();
        if (numTokens > MAX_NUM_BIDS) revert OverMaxBids();
        if (auctionParams.numTokens != 0) revert AuctionStillLive();
        if (auctionParams.startPrice == 0) revert AuctionParamsNotInitialized();

        auctionParams.numTokens = numTokens;
        auctionParams.startTimestamp = startTime;
        auctionParams.endTimestamp = endTime;

        emit AuctionStarted(auctionParams.index);
    }

    /**
     * @notice Allows the auctioneer to end the auction.
     * @dev Auctions can end at any time by the owner's discretion and when it ends all
     * current bids are accepted. The owner is also now able to withdraw the funds
     * that were reserved for the auction, and active bids data id reset.
     */
    function endAuction() external {
        if (auctioneer != msg.sender) revert CallerNotAuctioneer();
        if (auctionParams.numTokens == 0) revert AuctionNotLive();

        uint256 lowestPrice = activeBids[getBidIndexToUpdate()].amount;
        for (uint256 i = 0; i < auctionParams.numTokens; ) {
            if (activeBids[i].bidder == address(0)) {
                break;
            }

            _mint(activeBids[i].bidder, 1);

            // getBidIndex to update gaurantees no activeBids[i] is less than lowestPrice.
            unchecked {
                _transferETH(
                    activeBids[i].bidder,
                    activeBids[i].amount - lowestPrice
                );
                ++i;
            }
        }

        unchecked {
            ++auctionParams.index;
        }
        auctionParams.numTokens = 0;
        delete activeBids;
        reserveAuctionETH = 0;
    }

    /**
     * @notice Gets the index of the entry in activeBids to update
     * @dev The index to return will be decided by the following rules:
     * If there are less than auctionTokens bids, the index of the first empty slot is returned.
     * If there are auctionTokens or more bids, the index of the lowest value bid is returned. If
     * there is a tie, the most recent bid with the low amount will be returned. If there is a tie
     * among bidTimes, the highest index is chosen.
     */
    function getBidIndexToUpdate() public view returns (uint8) {
        uint256 minAmount = activeBids[0].amount;
        // If the first value is 0 then we can assume that no bids have been submitted
        if (minAmount == 0) {
            return 0;
        }

        uint8 minIndex = 0;
        uint64 minBidTime = activeBids[0].bidTime;

        for (uint8 i = 1; i < auctionParams.numTokens; ) {
            uint256 bidAmount = activeBids[i].amount;
            uint64 bidTime = activeBids[i].bidTime;

            // A zero bidAmount means the slot is empty because we enforce non-zero bid amounts
            if (bidAmount == 0) {
                return i;
            } else if (
                bidAmount < minAmount ||
                (bidAmount == minAmount && bidTime >= minBidTime)
            ) {
                minAmount = bidAmount;
                minIndex = i;
                minBidTime = bidTime;
            }

            unchecked {
                ++i;
            }
        }

        return minIndex;
    }

    /**
     * @notice Handle users' bids
     * @dev Bids must be made while the auction is live. Bids must meet a minimum reserve price.
     *
     * The first {auctionParams.numTokens} bids made will be accepted as valid. Subsequent bids must be a percentage
     * higher than the lowest of the active bids. When a low bid is replaced, the ETH will
     * be refunded back to the original bidder.
     *
     * If a valid bid comes in within the last `timeBuffer` seconds, the auction will be extended
     * for another `timeBuffer` seconds. This will continue until no new active bids come in.
     *
     * If a wallet makes a bid while it still has an active bid, the second bid will
     * stack on top of the first bid. If the second bid doesn't meet the `minStackedBidIncrement`
     * threshold, an error will be thrown. A wallet will only have one active bid at at time.
     */
    function bid() external payable {
        if (msg.sender != tx.origin) revert NotEOA();
        if (auctionParams.numTokens == 0) {
            revert AuctionNotInitialized();
        }
        if (
            block.timestamp < auctionParams.startTimestamp ||
            block.timestamp > auctionParams.endTimestamp
        ) {
            revert AuctionNotLive();
        }

        BidIndex memory existingIndex = bidIndexes[auctionParams.index][
            msg.sender
        ];
        if (existingIndex.isSet) {
            // Case when the user already has an active bid
            if (
                msg.value <
                auctionParams.minStackedBidIncrement * AUCTION_PRICE_MULTIPLIER
            ) {
                revert BidIncrementTooLow();
            }

            uint192 oldValue = activeBids[existingIndex.index].amount;
            unchecked {
                reserveAuctionETH += msg.value;
                activeBids[existingIndex.index].amount =
                    oldValue +
                    uint192(msg.value);
            }
            activeBids[existingIndex.index].bidTime = uint64(block.timestamp);

            emit BidIncreased(
                auctionParams.index,
                msg.sender,
                oldValue,
                msg.value
            );
        } else {
            if (
                msg.value < auctionParams.startPrice * AUCTION_PRICE_MULTIPLIER
            ) {
                revert ReservePriceNotMet();
            }

            uint8 lowestBidIndex = getBidIndexToUpdate();
            uint256 lowestBidAmount = activeBids[lowestBidIndex].amount;
            address lowestBidder = activeBids[lowestBidIndex].bidder;

            unchecked {
                if (
                    msg.value <
                    lowestBidAmount +
                        (lowestBidAmount *
                            auctionParams.minBidIncrementPercentage) /
                        100
                ) {
                    revert IncrementalPriceNotMet();
                }
                reserveAuctionETH += msg.value - lowestBidAmount;
            }

            // Refund lowest bidder and remove bidIndexes entry
            if (lowestBidder != address(0)) {
                delete bidIndexes[auctionParams.index][lowestBidder];
                _transferETH(lowestBidder, lowestBidAmount);
            }

            activeBids[lowestBidIndex] = Bid({
                bidder: msg.sender,
                amount: uint192(msg.value),
                bidTime: uint64(block.timestamp)
            });

            bidIndexes[auctionParams.index][msg.sender] = BidIndex({
                index: lowestBidIndex,
                isSet: true
            });

            emit NewBid(auctionParams.index, msg.sender, msg.value);
        }

        // Extend the auction if the bid was received within `timeBuffer` of the auction end time
        if (
            auctionParams.endTimestamp - block.timestamp <
            auctionParams.timeBuffer
        ) {
            unchecked {
                auctionParams.endTimestamp = uint48(
                    block.timestamp + auctionParams.timeBuffer
                );
            }
            emit AuctionExtended(auctionParams.index);
        }
    }

    // =============================================================
    //                        Miscellaneous
    // =============================================================

    /**
     * @notice Allows owner to emit TokenUnlocked events
     * @dev This method does NOT need to be called for locked tokens to be unlocked.
     * It is here to emit unlock events for marketplaces to know when tokens are
     * eligible for trade. The burden to call this method on the right tokens at the
     * correct timestamp is on the owner of the contract.
     */
    function emitTokensUnlocked(uint256[] memory tokens) external onlyOwner {
        for (uint256 i = 0; i < tokens.length; ) {
            emit TokenUnlocked(tokens[i]);

            unchecked {
                ++i;
            }
        }
    }

    /**
     * @notice Allows owner to withdraw a specified amount of ETH to a specified address.
     */
    function withdraw(
        address withdrawAddress,
        uint256 amount
    ) external onlyOwner {
        unchecked {
            if (amount > address(this).balance - reserveAuctionETH) {
                amount = address(this).balance - reserveAuctionETH;
            }
        }

        if (!_transferETH(withdrawAddress, amount)) revert WithdrawFailed();
    }

    /**
     * @notice Internal function to transfer ETH to a specified address.
     */
    function _transferETH(address to, uint256 value) internal returns (bool) {
        (bool success, ) = to.call{ value: value, gas: 30000 }(new bytes(0));
        return success;
    }

    error AuctionNotInitialized();
    error AuctionNotLive();
    error AuctionParamsNotInitialized();
    error AuctionStillLive();
    error BidIncrementTooLow();
    error CallerNotAuctioneer();
    error IncorrectMsgValue();
    error IncrementalPriceNotMet();
    error InvalidSignatureBuyAmount();
    error InvalidSignature();
    error InvalidSignatureVersion();
    error MintingNotFinished();
    error NotEOA();
    error OverDevSupplyLimit();
    error OverMintLimit();
    error OverTokenLimit();
    error OverMaxBids();
    error OperatorNotAllowed();
    error PublicMintNotLive();
    error PresaleAddressAlreadyMinted();
    error ReservePriceNotMet();
    error SignatureAlreadyUsed();
    error TierNotActive();
    error TokenTransferLocked();
    error WithdrawFailed();
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"initialPresale","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"AuctionNotInitialized","type":"error"},{"inputs":[],"name":"AuctionNotLive","type":"error"},{"inputs":[],"name":"AuctionParamsNotInitialized","type":"error"},{"inputs":[],"name":"AuctionStillLive","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BidIncrementTooLow","type":"error"},{"inputs":[],"name":"CallerNotAuctioneer","type":"error"},{"inputs":[],"name":"CallerNotOwner","type":"error"},{"inputs":[],"name":"IncorrectMsgValue","type":"error"},{"inputs":[],"name":"IncrementalPriceNotMet","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSignatureBuyAmount","type":"error"},{"inputs":[],"name":"InvalidSignatureVersion","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"MintingNotFinished","type":"error"},{"inputs":[],"name":"NotEOA","type":"error"},{"inputs":[],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OverDevSupplyLimit","type":"error"},{"inputs":[],"name":"OverMaxBids","type":"error"},{"inputs":[],"name":"OverMintLimit","type":"error"},{"inputs":[],"name":"OverTokenLimit","type":"error"},{"inputs":[],"name":"OwnerNotZero","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PresaleAddressAlreadyMinted","type":"error"},{"inputs":[],"name":"PublicMintNotLive","type":"error"},{"inputs":[],"name":"ReservePriceNotMet","type":"error"},{"inputs":[],"name":"SignatureAlreadyUsed","type":"error"},{"inputs":[],"name":"TierNotActive","type":"error"},{"inputs":[],"name":"TokenTransferLocked","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"},{"inputs":[],"name":"WithdrawFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"}],"name":"AuctionExtended","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"}],"name":"AuctionStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"bidder","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"increment","type":"uint256"}],"name":"BidIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"auctionIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"bidder","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockTimeHr","type":"uint256"}],"name":"TokenLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenUnlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"AUCTION_PRICE_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AUCTION_PROVENANCE_HASH","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AUCTION_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_NUM_BIDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PUBLIC_MINT_TXN_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_CAP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PROVENANCE_HASH","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRESALE_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOTAL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREASURY_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"activeBids","outputs":[{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint192","name":"amount","type":"uint192"},{"internalType":"uint64","name":"bidTime","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"auctionParams","outputs":[{"internalType":"uint16","name":"index","type":"uint16"},{"internalType":"uint56","name":"startPrice","type":"uint56"},{"internalType":"uint56","name":"minStackedBidIncrement","type":"uint56"},{"internalType":"uint8","name":"minBidIncrementPercentage","type":"uint8"},{"internalType":"uint16","name":"timeBuffer","type":"uint16"},{"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"internalType":"uint48","name":"endTimestamp","type":"uint48"},{"internalType":"uint8","name":"numTokens","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctioneer","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"bid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"bidIndexes","outputs":[{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"bool","name":"isSet","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dnaContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"name":"emitTokensUnlocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"filterRegistrant","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"firstUnlockTime","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBidIndexToUpdate","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":[{"internalType":"string","name":"","type":"string"}],"name":"isTierActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"mintAddresses","type":"address[]"},{"internalType":"uint256[]","name":"mintQuantities","type":"uint256[]"}],"name":"mintDev","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"presaleUsers","type":"address[]"}],"name":"mintPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"tier","type":"string"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"version","type":"uint256"},{"internalType":"uint256","name":"allowedAmount","type":"uint256"},{"internalType":"uint256","name":"buyAmount","type":"uint256"},{"internalType":"bytes","name":"sig","type":"bytes"}],"name":"mintTier","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterRegistryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"presaleDelegation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"presaleMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveAuctionETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"payable","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":"payable","type":"function"},{"inputs":[],"name":"secondUnlockTime","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"auctioneer_","type":"address"}],"name":"setAuctioneer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dnaAddress","type":"address"}],"name":"setDnaContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRegistrant","type":"address"}],"name":"setFilterRegistrant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"tier","type":"string"},{"internalType":"bool","name":"active","type":"bool"}],"name":"setIsTierActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"registryAddress","type":"address"}],"name":"setOperatorFilterRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint40","name":"startPrice_","type":"uint40"},{"internalType":"uint40","name":"minStackedBidIncrement_","type":"uint40"},{"internalType":"uint8","name":"minBidIncrementPercentage_","type":"uint8"},{"internalType":"uint16","name":"timeBuffer_","type":"uint16"}],"name":"setOverallAuctionParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setPresaleMintAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPublicMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"version","type":"uint256"}],"name":"setSignatureVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newUriBase","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"first","type":"uint24"},{"internalType":"uint24","name":"second","type":"uint24"},{"internalType":"uint24","name":"third","type":"uint24"}],"name":"setUnlockTimes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"signatureUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"signatureVersion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"numTokens","type":"uint8"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"}],"name":"startAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"thirdUnlockTime","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"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":"tokenUriBase","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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"withdrawAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610100604090815260a0818152906200460c60c03980516200002a91600a9160209091019062000164565b506040518060600160405280604081526020016200464c6040913980516200005b91600b9160209091019062000164565b503480156200006957600080fd5b506040516200468c3803806200468c8339810160408190526200008c916200020a565b604080518082018252600881526756616c68616c6c6160c01b60208083019182528351808501909452600384526215905360ea1b908401528151919291620000d79160019162000164565b508051620000ed90600290602084019062000164565b5050600160005550620001003362000112565b6001600160a01b031660805262000278565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805462000172906200023c565b90600052602060002090601f016020900481019282620001965760008555620001e1565b82601f10620001b157805160ff1916838001178555620001e1565b82800160010185558215620001e1579182015b82811115620001e1578251825591602001919060010190620001c4565b50620001ef929150620001f3565b5090565b5b80821115620001ef5760008155600101620001f4565b6000602082840312156200021d57600080fd5b81516001600160a01b03811681146200023557600080fd5b9392505050565b600181811c908216806200025157607f821691505b6020821081036200027257634e487b7160e01b600052602260045260246000fd5b50919050565b6080516143716200029b60003960008181610dd7015261215901526143716000f3fe6080604052600436106104645760003560e01c806375d0abfa11610243578063bc660cac11610143578063e53aa03a116100bb578063f015bc931161008a578063f3fef3a31161006f578063f3fef3a314610e19578063fe67a54b14610e39578063ffe8a9ee14610e4e57600080fd5b8063f015bc9314610dc5578063f2fde38b14610df957600080fd5b8063e53aa03a14610be5578063e87ce00314610d49578063e985e9c514610d69578063efd0cbf914610db257600080fd5b8063d8e3086211610112578063e0df5b6f116100f7578063e0df5b6f14610cd6578063e233212014610cf6578063e307fb3114610d1957600080fd5b8063d8e3086214610ca0578063dc53fd9214610cc057600080fd5b8063bc660cac14610c1a578063bddb279c14610c4a578063c1b7216714610c60578063c87b56dd14610c8057600080fd5b806398f1312e116101d6578063b18771fc116101a5578063b88d4fde1161018a578063b88d4fde14610bd2578063ba980f3214610be5578063baf3ff6014610bfa57600080fd5b8063b18771fc14610b75578063b1fdec6a14610bab57600080fd5b806398f1312e14610aee578063a22cb46514610b04578063aa5f1e9d14610b24578063adc1ebcc14610b5f57600080fd5b80638da5cb5b116102125780638da5cb5b14610a5b578063902d55a514610a7957806395370c8314610a8f57806395d89b4114610ad957600080fd5b806375d0abfa146109f85780637b4c198514610a0e57806380703cf414610a26578063813dcfad14610a4657600080fd5b80633962c10a116103695780635ec2c7bf116102e15780636c19e783116102b057806370a082311161029557806370a08231146109a3578063715018a6146109c3578063749f7c3c146109d857600080fd5b80636c19e783146109635780636c90a8b11461098357600080fd5b80635ec2c7bf146108b957806361d4d936146108d95780636352211e146108ec578063672b07741461090c57600080fd5b80635152ab8111610338578063568f02f81161031d578063568f02f81461079b5780635982e45d146108765780635d82cf6e1461089957600080fd5b80635152ab8114610766578063540c2a971461078657600080fd5b80633962c10a146106f35780633ae1cc631461071357806342842e0e146107335780634654fa4c1461074657600080fd5b806318160ddd116103fc57806322b27577116103cb57806323b872dd116103b057806323b872dd146106815780632a55205a1461069457806332220bc7146106d357600080fd5b806322b2757714610641578063238ac9331461066157600080fd5b806318160ddd146105bf5780631998aeef146105e25780631db0ad5a146105ea5780631fa82bd41461062157600080fd5b8063081812fc11610438578063081812fc14610502578063095ea7b31461053a5780630ab61de61461054d5780631642ac1c146105aa57600080fd5b8062ede7e41461046957806301ffc9a71461048b57806304634d8d146104c057806306fdde03146104e0575b600080fd5b34801561047557600080fd5b50610489610484366004613924565b610e64565b005b34801561049757600080fd5b506104ab6104a6366004613955565b610e8e565b60405190151581526020015b60405180910390f35b3480156104cc57600080fd5b506104896104db366004613972565b610eae565b3480156104ec57600080fd5b506104f5610ec4565b6040516104b79190613a12565b34801561050e57600080fd5b5061052261051d366004613a25565b610f56565b6040516001600160a01b0390911681526020016104b7565b610489610548366004613a3e565b610fb3565b34801561055957600080fd5b50610591610568366004613a68565b602260209081526000928352604080842090915290825290205460ff8082169161010090041682565b6040805160ff90931683529015156020830152016104b7565b3480156105b657600080fd5b506104f5611075565b3480156105cb57600080fd5b50600054600019015b6040519081526020016104b7565b610489611103565b3480156105f657600080fd5b50600e5461060d90600160a01b900462ffffff1681565b60405162ffffff90911681526020016104b7565b34801561062d57600080fd5b5061048961063c366004613aa7565b6116c6565b34801561064d57600080fd5b5061048961065c366004613b11565b611768565b34801561066d57600080fd5b50601254610522906001600160a01b031681565b61048961068f366004613b4b565b6119d5565b3480156106a057600080fd5b506106b46106af366004613b87565b611be3565b604080516001600160a01b0390931683526020830191909152016104b7565b3480156106df57600080fd5b506104896106ee366004613924565b611ca0565b3480156106ff57600080fd5b50600d54610522906001600160a01b031681565b34801561071f57600080fd5b50600c54610522906001600160a01b031681565b610489610741366004613b4b565b611cca565b34801561075257600080fd5b50600e54610522906001600160a01b031681565b34801561077257600080fd5b50610489610781366004613c6e565b611cea565b34801561079257600080fd5b506104f5611d27565b3480156107a757600080fd5b506023546108149061ffff8082169166ffffffffffffff620100008204811692690100000000000000000083049091169160ff600160801b8204811692600160881b8304169165ffffffffffff600160981b8204811692600160c81b830490911691600160f81b90041688565b6040805161ffff998a16815266ffffffffffffff9889166020820152969097169686019690965260ff938416606086015291909516608084015265ffffffffffff94851660a08401529390931660c0820152911660e0820152610100016104b7565b34801561088257600080fd5b50600e5461060d90600160d01b900462ffffff1681565b3480156108a557600080fd5b506104896108b4366004613a25565b611d34565b3480156108c557600080fd5b50601754610522906001600160a01b031681565b6104896108e7366004613cb5565b611d41565b3480156108f857600080fd5b50610522610907366004613a25565b611fc0565b34801561091857600080fd5b5061092c610927366004613a25565b611fcb565b604080516001600160a01b0390941684526001600160c01b03909216602084015267ffffffffffffffff16908201526060016104b7565b34801561096f57600080fd5b5061048961097e366004613924565b612013565b34801561098f57600080fd5b5061048961099e366004613dd4565b61203d565b3480156109af57600080fd5b506105d46109be366004613924565b612231565b3480156109cf57600080fd5b50610489612299565b3480156109e457600080fd5b506104896109f3366004613e64565b6122ad565b348015610a0457600080fd5b506105d461012c81565b348015610a1a57600080fd5b506105d4633b9aca0081565b348015610a3257600080fd5b50610489610a41366004613924565b61230f565b348015610a5257600080fd5b506104f5612339565b348015610a6757600080fd5b506007546001600160a01b0316610522565b348015610a8557600080fd5b506105d461271081565b348015610a9b57600080fd5b50610489610aaa366004613924565b33600090815260106020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b348015610ae557600080fd5b506104f5612346565b348015610afa57600080fd5b506105d461232881565b348015610b1057600080fd5b50610489610b1f366004613e99565b612355565b348015610b3057600080fd5b506104ab610b3f366004613ec5565b805160208183018101805160148252928201919093012091525460ff1681565b348015610b6b57600080fd5b506105d460135481565b348015610b8157600080fd5b50610522610b90366004613924565b6010602052600090815260409020546001600160a01b031681565b348015610bb757600080fd5b50610bc06123ca565b60405160ff90911681526020016104b7565b610489610be0366004613efa565b6124dc565b348015610bf157600080fd5b506105d4600581565b348015610c0657600080fd5b50610489610c15366004613924565b612526565b348015610c2657600080fd5b506104ab610c35366004613924565b600f6020526000908152604090205460ff1681565b348015610c5657600080fd5b506105d46103e881565b348015610c6c57600080fd5b50610489610c7b366004613f77565b612550565b348015610c8c57600080fd5b506104f5610c9b366004613a25565b61262c565b348015610cac57600080fd5b50610489610cbb366004613fd4565b612660565b348015610ccc57600080fd5b506105d460165481565b348015610ce257600080fd5b50610489610cf1366004613ec5565b612708565b348015610d0257600080fd5b50600e5461060d90600160b81b900462ffffff1681565b348015610d2557600080fd5b506104ab610d34366004613a25565b60156020526000908152604090205460ff1681565b348015610d5557600080fd5b50610489610d64366004613a25565b612723565b348015610d7557600080fd5b506104ab610d84366004614038565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b610489610dc0366004613a25565b612730565b348015610dd157600080fd5b506105227f000000000000000000000000000000000000000000000000000000000000000081565b348015610e0557600080fd5b50610489610e14366004613924565b61281e565b348015610e2557600080fd5b50610489610e34366004613a3e565b61286f565b348015610e4557600080fd5b506104896128ca565b348015610e5a57600080fd5b506105d460245481565b610e6c612a60565b601780546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e9982612aa4565b80610ea85750610ea882612b24565b92915050565b610eb6612a60565b610ec08282612b72565b5050565b606060018054610ed390614062565b80601f0160208091040260200160405190810160405280929190818152602001828054610eff90614062565b8015610f4c5780601f10610f2157610100808354040283529160200191610f4c565b820191906000526020600020905b815481529060010190602001808311610f2f57829003601f168201915b5050505050905090565b6000610f6182612c91565b610f97576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600560205260409020546001600160a01b031690565b610fbc82612ca7565b6000610fc782611fc0565b9050336001600160a01b0382161461101957610fe38133610d84565b611019576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600a805461108290614062565b80601f01602080910402602001604051908101604052809291908181526020018280546110ae90614062565b80156110fb5780601f106110d0576101008083540402835291602001916110fb565b820191906000526020600020905b8154815290600101906020018083116110de57829003601f168201915b505050505081565b33321461112357604051635d04968b60e11b815260040160405180910390fd5b602354600160f81b900460ff16600003611169576040517f34e3296000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602354600160981b900465ffffffffffff164210806111985750602354600160c81b900465ffffffffffff1642115b156111b6576040516358fd8d1160e01b815260040160405180910390fd5b60235461ffff16600090815260226020908152604080832033845282529182902082518084019093525460ff808216845261010090910416158015918301919091526113765760235461122490633b9aca00906901000000000000000000900466ffffffffffffff166140b2565b34101561125d576040517f7625af5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006018826000015160ff1660058110611279576112796140d1565b6002020160010154602480543490810190915583516001600160c01b03909216925082019060189060ff16600581106112b4576112b46140d1565b6002020160010160006101000a8154816001600160c01b0302191690836001600160c01b03160217905550426018836000015160ff16600581106112fa576112fa6140d1565b6002020160010180546001600160c01b03908116600160c01b67ffffffffffffffff9490941693909302929092179055602354604080519284168352346020840152339261ffff909216917f67ed2a3f281802488e97931efa7f4fe475fe4298b6f6fb5ef58607589c3b72be910160405180910390a350611615565b60235461139790633b9aca009062010000900466ffffffffffffff166140b2565b3410156113d0576040517f79bb5b6100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006113da6123ca565b9050600060188260ff16600581106113f4576113f46140d1565b60020201600101546001600160c01b031690506000601860ff84166005811061141f5761141f6140d1565b60020201546023546001600160a01b039091169150606490600160801b900460ff16830204820134101561147f576040517f56b7b30e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60248054348490030190556001600160a01b038116156114d75760235461ffff1660009081526022602090815260408083206001600160a01b03851684529091529020805461ffff191690556114d58183612d50565b505b6040518060600160405280336001600160a01b03168152602001346001600160c01b031681526020014267ffffffffffffffff1681525060188460ff1660058110611524576115246140d1565b82516002919091029190910180546001600160a01b039092166001600160a01b031990921691909117815560208083015160409384015167ffffffffffffffff16600160c01b026001600160c01b03909116176001928301558251808401845260ff80881682528183019384526023805461ffff90811660009081526022865287812033808352965287902093518454965115156101000261ffff1990971693169290921794909417909155915492519092909116907f558a0d5d5468d74b0db24c74eb348b42271c2ebb4c9e953ced38aaed95fa4361906116099034815260200190565b60405180910390a35050505b602354600160881b810461ffff169061163e904290600160c81b900465ffffffffffff166140fd565b10156116c3576023805465ffffffffffff4261ffff600160881b840481169190910191909116600160c81b027fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff83168117909355604051928116911617907fc2b459809119087ca9d2bc10dea53a51b7d848b1a11075db037bdca58292c3e890600090a25b50565b6116ce612a60565b600e80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b62ffffff958616027fffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffff1617600160b81b93851693909302929092177fffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b9190931602919091179055565b6017546001600160a01b03163314611793576040516374920f8d60e01b815260040160405180910390fd5b6123286117a36000546000190190565b10156117db576040517f802a9d5f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127108360ff166117ef6000546000190190565b6117f99190614114565b1115611831576040517f5aab8d9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60058360ff16111561186f576040517f5c19bcf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602354600160f81b900460ff16156118b3576040517f9ca4063800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60235462010000900466ffffffffffffff166000036118fe576040517f6e9f7b2900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6023805465ffffffffffff838116600160c81b027fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff918616600160981b027fffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffff60ff8916600160f81b02167effffffffffff000000000000ffffffffffffffffffffffffffffffffffffff9094169390931792909217908116821790925560405161ffff9182169190921617907f1bb96dff6ab5005aff98cdc0cf176bb7d8e0423cb48e02217d35b042cec81e9f90600090a2505050565b60006119e082612dce565b9050836001600160a01b0316816001600160a01b031614611a2d576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090208054338082146001600160a01b03881690911417611a9357611a5d8633610d84565b611a93576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516611ad3576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ae08686866001612e53565b8015611aeb57600082555b6001600160a01b038681166000908152600460205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260036020526040812091909155600160e11b84169003611b9a57600184016000818152600360205260409020546001600160e81b0316611b98576000548114611b9857600081815260036020526040902080546001600160e81b0319166001600160e81b0386161790555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b60008281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff16928201929092528291611c625750604080518082019091526008546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b602081015160009061271090611c86906bffffffffffffffffffffffff16876140b2565b611c90919061412c565b91519350909150505b9250929050565b611ca8612a60565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b611ce5838383604051806020016040528060008152506124dc565b505050565b611cf2612a60565b80601483604051611d03919061415c565b908152604051908190036020019020805491151560ff199092169190911790555050565b6011805461108290614062565b611d3c612a60565b601655565b61232882611d526000546000190190565b611d5c9190614114565b1115611d7b5760405163436a537960e01b815260040160405180910390fd5b601486604051611d8b919061415c565b9081526040519081900360200190205460ff16611dd4576040517f402b7a2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6013548414611e0f576040517ff8f60a7500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82821115611e49576040517ff3037b8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e5382866140b2565b3414611e72576040516326ea953d60e01b815260040160405180910390fd5b6000611ef2873088888833604051602001611e9296959493929190614178565b60408051601f1981840301815282825280516020918201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000084830152603c8085019190915282518085039091018152605c909301909152815191012090565b60008181526015602052604090205490915060ff1615611f3e576040517f900bb2c900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152601560205260409020805460ff191660011790556012546001600160a01b0316611f6d8284612f57565b6001600160a01b031614611fad576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fb73384612f7b565b50505050505050565b6000610ea882612dce565b60188160058110611fdb57600080fd5b6002020180546001909101546001600160a01b0390911691506001600160c01b03811690600160c01b900467ffffffffffffffff1683565b61201b612a60565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b612045612a60565b60005481515b8015611ce5576040805142602082015290810182905260009082906060016040516020818303038152906040528051906020012060001c61208c91906141c3565b905060008482815181106120a2576120a26140d1565b6020908102919091018101516001600160a01b0381166000908152600f90925260409091205490915060ff1615612105576040517f1bddafdd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038181166000818152600f6020526040808220805460ff19166001179055517f4532504c0000000000000000000000000000000000000000000000000000000081526004810192909252917f00000000000000000000000000000000000000000000000000000000000000001690634532504c90602401602060405180830381865afa1580156121a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c491906141d7565b90506121d18286836130b9565b836001900393508584815181106121ea576121ea6140d1565b6020026020010151868481518110612204576122046140d1565b60200260200101906001600160a01b031690816001600160a01b031681525050808501945050505061204b565b60006001600160a01b038216612273576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526004602052604090205467ffffffffffffffff1690565b6122a1612a60565b6122ab600061344d565b565b6122b5612a60565b60005b8151811015610ec0578181815181106122d3576122d36140d1565b60200260200101517f7ff05c79c2a3d239576a86d8af5c623d17e7a676e424313ca21481b15047783f60405160405180910390a26001016122b8565b612317612a60565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b600b805461108290614062565b606060028054610ed390614062565b61235e82612ca7565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6019546000906001600160c01b03168082036123e857600091505090565b601954600090600160c01b900467ffffffffffffffff1660015b60235460ff600160f81b909104811690821610156124d357600060188260ff1660058110612432576124326140d1565b60020201600101546001600160c01b031690506000601860ff84166005811061245d5761245d6140d1565b6002020160010160189054906101000a900467ffffffffffffffff1690508160000361248e57509095945050505050565b858210806124ba575085821480156124ba57508367ffffffffffffffff168167ffffffffffffffff1610155b156124c9578195508294508093505b5050600101612402565b50909392505050565b6124e78484846119d5565b6001600160a01b0383163b15612520576125038484848461349f565b612520576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b61252e612a60565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b612558612a60565b602380547fffffffffffffffffffffffffffffffff0000000000000000000000000000ffff1664ffffffffff95861662010000027fffffffffffffffffffffffffffffffff00000000000000ffffffffffffffffff161793909416690100000000000000000002929092177fffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffff16600160801b60ff92909216919091027fffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffffff1617600160881b61ffff9290921691909102179055565b606060116126398361358b565b60405160200161264a9291906141f0565b6040516020818303038152906040529050919050565b612668612a60565b60005b8251811015611ce5576126b0838281518110612689576126896140d1565b60200260200101518383815181106126a3576126a36140d1565b6020026020010151612f7b565b61012c6126c06000546000190190565b11156126f8576040517fd3531dcf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61270181614296565b905061266b565b612710612a60565b8051610ec090601190602084019061383a565b61272b612a60565b601355565b32331461275057604051635d04968b60e11b815260040160405180910390fd5b612328816127616000546000190190565b61276b9190614114565b111561278a5760405163436a537960e01b815260040160405180910390fd5b6016546000036127c6576040517f10d3e4c900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60058111156127e85760405163436a537960e01b815260040160405180910390fd5b6016546127f590826140b2565b3414612814576040516326ea953d60e01b815260040160405180910390fd5b6116c33382612f7b565b612826612a60565b6001600160a01b038116612866576040517fa2604f6a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116c38161344d565b612877612a60565b602454470381111561288a575060245447035b6128948282612d50565b610ec0576040517f750b219c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6017546001600160a01b031633146128f5576040516374920f8d60e01b815260040160405180910390fd5b602354600160f81b900460ff16600003612922576040516358fd8d1160e01b815260040160405180910390fd5b6000601861292e6123ca565b60ff1660058110612941576129416140d1565b60020201600101546001600160c01b0316905060005b602354600160f81b900460ff16811015612a1657600060188260058110612980576129806140d1565b60020201546001600160a01b031614612a16576129be601882600581106129a9576129a96140d1565b60020201546001600160a01b03166001612f7b565b612a0d601882600581106129d4576129d46140d1565b60020201546001600160a01b031683601884600581106129f6576129f66140d1565b60020201600101546001600160c01b031603612d50565b50600101612957565b50602380547effffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600101909116179055612a58601860006138be565b506000602455565b6007546001600160a01b031633146122ab576040517f5cd8319200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006301ffc9a760e01b6001600160e01b031983161480612aee57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610ea85750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480610ea857506301ffc9a760e01b6001600160e01b0319831614610ea8565b6127106bffffffffffffffffffffffff82161115612bfd5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c6550726963650000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b038216612c535760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401612bf4565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217600855565b600081600111158015610ea85750506000541190565b600c546001600160a01b03163b156116c357600c54600d54604051633185c44d60e21b81526001600160a01b039182166004820152838216602482015291169063c6171134906044016020604051808303816000875af1158015612d0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3391906142af565b6116c357604051638a10919360e01b815260040160405180910390fd5b6040805160008082526020820190925281906001600160a01b03851690617530908590604051612d80919061415c565b600060405180830381858888f193505050503d8060008114612dbe576040519150601f19603f3d011682016040523d82523d6000602084013e612dc3565b606091505b509095945050505050565b60008180600111612e2157600054811015612e21576000818152600360205260409020545b6001600160e81b038116612e1a575060001901600081815260036020526040902054612df3565b9392505050565b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c546001600160a01b03163b15612efa57600c54600d54604051633185c44d60e21b81526001600160a01b03918216600482015233602482015291169063c6171134906044016020604051808303816000875af1158015612eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612edd91906142af565b612efa57604051638a10919360e01b815260040160405180910390fd5b600082815260036020526040902054429060e81c612f1a90610e106140b2565b1115612f52576040517fe5b02d4600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612520565b6000806000612f6685856135cf565b91509150612f7381613611565b509392505050565b6000805490829003612fb9576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612fc66000848385612e53565b6001600160a01b03831660008181526004602090815260408083208054680100000000000000018802019055848352600390915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461307557808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161303d565b50816000036130b0576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b6001600160a01b038381166000908152601060205260409020541615613103576001600160a01b038084166000908152601060205260409020546130fe911682612f7b565b61310d565b61310d8382612f7b565b60005b600382048110156132b157600e546003820284019061316090829062ffffff600160d01b9091041660009182526003602052604090912080546001600160e81b031660e89290921b919091179055565b600e5460018201600090815260036020526040902080546001600160e81b0316600160b81b90920460e81b6001600160e81b031916919091179055600e5460028201600090815260036020526040902080546001600160e81b0316600160a01b90920460e81b6001600160e81b031916919091179055600e54604051600160d01b90910462ffffff16815281907ff43c632cabf9b23317efd3d40fdd5be89b56d735e96a36181c46684f9f9ea81c9060200160405180910390a2600e54604051600160b81b90910462ffffff16815260018201907ff43c632cabf9b23317efd3d40fdd5be89b56d735e96a36181c46684f9f9ea81c9060200160405180910390a2600e54604051600160a01b90910462ffffff16815260028201907ff43c632cabf9b23317efd3d40fdd5be89b56d735e96a36181c46684f9f9ea81c9060200160405180910390a250600101613110565b509081016000190190600381066002036133ca57600e546000198301600090815260036020526040902080546001600160e81b0316600160d01b90920460e81b6001600160e81b031916919091179055600e54604051600160d01b90910462ffffff1681526000198301907ff43c632cabf9b23317efd3d40fdd5be89b56d735e96a36181c46684f9f9ea81c9060200160405180910390a2600e54600083815260036020526040902080546001600160e81b0316600160b81b90920460e81b6001600160e81b031916919091179055600e54604051600160b81b90910462ffffff16815282907ff43c632cabf9b23317efd3d40fdd5be89b56d735e96a36181c46684f9f9ea81c906020015b60405180910390a2505050565b60038106600103611ce557600e54600083815260036020526040902080546001600160e81b0316600160d01b90920460e81b6001600160e81b031916919091179055600e54604051600160d01b90910462ffffff16815282907ff43c632cabf9b23317efd3d40fdd5be89b56d735e96a36181c46684f9f9ea81c906020016133bd565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906134d49033908990889088906004016142cc565b6020604051808303816000875af192505050801561350f575060408051601f3d908101601f1916820190925261350c91810190614308565b60015b61356d573d80801561353d576040519150601f19603f3d011682016040523d82523d6000602084013e613542565b606091505b508051600003613565576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806135a55750819003601f19909101908152919050565b60008082516041036136055760208301516040840151606085015160001a6135f987828585613776565b94509450505050611c99565b50600090506002611c99565b600081600481111561362557613625614325565b0361362d5750565b600181600481111561364157613641614325565b0361368e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401612bf4565b60028160048111156136a2576136a2614325565b036136ef5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401612bf4565b600381600481111561370357613703614325565b036116c35760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401612bf4565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156137ad5750600090506003613831565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613801573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661382a57600060019250925050613831565b9150600090505b94509492505050565b82805461384690614062565b90600052602060002090601f01602090048101928261386857600085556138ae565b82601f1061388157805160ff19168380011785556138ae565b828001600101855582156138ae579182015b828111156138ae578251825591602001919060010190613893565b506138ba9291506138cd565b5090565b506116c390600a8101906138e2565b5b808211156138ba57600081556001016138ce565b5b808211156138ba5780546001600160a01b0319168155600060018201556002016138e3565b80356001600160a01b038116811461391f57600080fd5b919050565b60006020828403121561393657600080fd5b612e1a82613908565b6001600160e01b0319811681146116c357600080fd5b60006020828403121561396757600080fd5b8135612e1a8161393f565b6000806040838503121561398557600080fd5b61398e83613908565b915060208301356bffffffffffffffffffffffff811681146139af57600080fd5b809150509250929050565b60005b838110156139d55781810151838201526020016139bd565b838111156125205750506000910152565b600081518084526139fe8160208601602086016139ba565b601f01601f19169290920160200192915050565b602081526000612e1a60208301846139e6565b600060208284031215613a3757600080fd5b5035919050565b60008060408385031215613a5157600080fd5b613a5a83613908565b946020939093013593505050565b60008060408385031215613a7b57600080fd5b82359150613a8b60208401613908565b90509250929050565b803562ffffff8116811461391f57600080fd5b600080600060608486031215613abc57600080fd5b613ac584613a94565b9250613ad360208501613a94565b9150613ae160408501613a94565b90509250925092565b803560ff8116811461391f57600080fd5b803565ffffffffffff8116811461391f57600080fd5b600080600060608486031215613b2657600080fd5b613b2f84613aea565b9250613b3d60208501613afb565b9150613ae160408501613afb565b600080600060608486031215613b6057600080fd5b613b6984613908565b9250613b7760208501613908565b9150604084013590509250925092565b60008060408385031215613b9a57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613be857613be8613ba9565b604052919050565b600082601f830112613c0157600080fd5b813567ffffffffffffffff811115613c1b57613c1b613ba9565b613c2e601f8201601f1916602001613bbf565b818152846020838601011115613c4357600080fd5b816020850160208301376000918101602001919091529392505050565b80151581146116c357600080fd5b60008060408385031215613c8157600080fd5b823567ffffffffffffffff811115613c9857600080fd5b613ca485828601613bf0565b92505060208301356139af81613c60565b60008060008060008060c08789031215613cce57600080fd5b863567ffffffffffffffff80821115613ce657600080fd5b613cf28a838b01613bf0565b97506020890135965060408901359550606089013594506080890135935060a0890135915080821115613d2457600080fd5b50613d3189828a01613bf0565b9150509295509295509295565b600067ffffffffffffffff821115613d5857613d58613ba9565b5060051b60200190565b600082601f830112613d7357600080fd5b81356020613d88613d8383613d3e565b613bbf565b82815260059290921b84018101918181019086841115613da757600080fd5b8286015b84811015613dc957613dbc81613908565b8352918301918301613dab565b509695505050505050565b600060208284031215613de657600080fd5b813567ffffffffffffffff811115613dfd57600080fd5b61358384828501613d62565b600082601f830112613e1a57600080fd5b81356020613e2a613d8383613d3e565b82815260059290921b84018101918181019086841115613e4957600080fd5b8286015b84811015613dc95780358352918301918301613e4d565b600060208284031215613e7657600080fd5b813567ffffffffffffffff811115613e8d57600080fd5b61358384828501613e09565b60008060408385031215613eac57600080fd5b613eb583613908565b915060208301356139af81613c60565b600060208284031215613ed757600080fd5b813567ffffffffffffffff811115613eee57600080fd5b61358384828501613bf0565b60008060008060808587031215613f1057600080fd5b613f1985613908565b9350613f2760208601613908565b925060408501359150606085013567ffffffffffffffff811115613f4a57600080fd5b613f5687828801613bf0565b91505092959194509250565b803564ffffffffff8116811461391f57600080fd5b60008060008060808587031215613f8d57600080fd5b613f9685613f62565b9350613fa460208601613f62565b9250613fb260408601613aea565b9150606085013561ffff81168114613fc957600080fd5b939692955090935050565b60008060408385031215613fe757600080fd5b823567ffffffffffffffff80821115613fff57600080fd5b61400b86838701613d62565b9350602085013591508082111561402157600080fd5b5061402e85828601613e09565b9150509250929050565b6000806040838503121561404b57600080fd5b61405483613908565b9150613a8b60208401613908565b600181811c9082168061407657607f821691505b60208210810361409657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156140cc576140cc61409c565b500290565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008282101561410f5761410f61409c565b500390565b600082198211156141275761412761409c565b500190565b60008261413b5761413b6140e7565b500490565b600081516141528185602086016139ba565b9290920192915050565b6000825161416e8184602087016139ba565b9190910192915050565b60c08152600061418b60c08301896139e6565b90506001600160a01b03808816602084015286604084015285606084015284608084015280841660a084015250979650505050505050565b6000826141d2576141d26140e7565b500690565b6000602082840312156141e957600080fd5b5051919050565b600080845481600182811c91508083168061420c57607f831692505b6020808410820361422b57634e487b7160e01b86526022600452602486fd5b81801561423f57600181146142505761427d565b60ff1986168952848901965061427d565b60008b81526020902060005b868110156142755781548b82015290850190830161425c565b505084890196505b50505050505061428d8185614140565b95945050505050565b6000600182016142a8576142a861409c565b5060010190565b6000602082840312156142c157600080fd5b8151612e1a81613c60565b60006001600160a01b038087168352808616602084015250836040830152608060608301526142fe60808301846139e6565b9695505050505050565b60006020828403121561431a57600080fd5b8151612e1a8161393f565b634e487b7160e01b600052602160045260246000fdfea26469706673582212206ada2794d58485d28201ca88a4c99629962e71fa1c18ec8f630a9852a05e959b64736f6c634300080d003330333732323662323136333633373630303164626664323266353264316464373238343565666139363133626166353161366130313161633733316232333237656238633838393639613462373736643735376465393632613139346635623466666161616462393931656366626232346438303663376263363339376433300000000000000000000000001da191b3172acc8b8c27554cf973b6168afcc5ff

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

0000000000000000000000001da191b3172acc8b8c27554cf973b6168afcc5ff

-----Decoded View---------------
Arg [0] : initialPresale (address): 0x1dA191b3172acc8B8C27554CF973B6168AFcC5ff

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000001da191b3172acc8b8c27554cf973b6168afcc5ff


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.