ETH Price: $1,955.31 (-5.32%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw167856392023-03-08 19:34:111086 days ago1678304051IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0044688362.86876844
Withdraw167856362023-03-08 19:33:351086 days ago1678304015IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0044872665.86328041
Withdraw167852902023-03-08 18:23:231086 days ago1678299803IN
0xd2cA0Fc9...a26b693B6
0 ETH0.001077745.18473594
Set Approval For...163810222023-01-11 3:56:351143 days ago1673409395IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0004130317.08327582
Set Approval For...163800822023-01-11 0:47:471143 days ago1673398067IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0008613918.6893142
Withdraw155281012022-09-13 17:07:101262 days ago1663088830IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0004456814.58822488
Airdrop155103212022-09-10 18:36:041265 days ago1662834964IN
0xd2cA0Fc9...a26b693B6
0.1733 ETH0.00017925.77265296
Airdrop155054902022-09-09 23:22:291266 days ago1662765749IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0003779112.82880093
Airdrop155054872022-09-09 23:21:511266 days ago1662765711IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0003960813.44565059
Airdrop155054762022-09-09 23:20:191266 days ago1662765619IN
0xd2cA0Fc9...a26b693B6
0.1737 ETH0.0005359218.22256487
Airdrop155031442022-09-09 14:09:241266 days ago1662732564IN
0xd2cA0Fc9...a26b693B6
0.1734 ETH0.0012961241.76457444
Airdrop155011602022-09-09 6:03:051267 days ago1662703385IN
0xd2cA0Fc9...a26b693B6
0.1759 ETH0.000256968.73741298
Airdrop155011502022-09-09 6:01:301267 days ago1662703290IN
0xd2cA0Fc9...a26b693B6
0.1759 ETH0.000251978.56770699
Airdrop155011222022-09-09 5:56:471267 days ago1662703007IN
0xd2cA0Fc9...a26b693B6
0.1759 ETH0.000247618.41933857
Airdrop155010592022-09-09 5:43:591267 days ago1662702239IN
0xd2cA0Fc9...a26b693B6
0.1755 ETH0.0003452211.73842578
Airdrop155010522022-09-09 5:41:161267 days ago1662702076IN
0xd2cA0Fc9...a26b693B6
0.1755 ETH0.0003048310.3649787
Airdrop155009812022-09-09 5:21:161267 days ago1662700876IN
0xd2cA0Fc9...a26b693B6
0.1767 ETH0.0004578715.56871451
Airdrop155009672022-09-09 5:16:421267 days ago1662700602IN
0xd2cA0Fc9...a26b693B6
0 ETH0.0003448511.706702
Airdrop155006022022-09-09 3:59:261267 days ago1662695966IN
0xd2cA0Fc9...a26b693B6
0.1798 ETH0.0003605411.61776734
Airdrop155005912022-09-09 3:57:471267 days ago1662695867IN
0xd2cA0Fc9...a26b693B6
0.1798 ETH0.0003271410.54148973
Airdrop155005872022-09-09 3:57:091267 days ago1662695829IN
0xd2cA0Fc9...a26b693B6
0.1798 ETH0.0003532111.38139161
Airdrop155005812022-09-09 3:56:061267 days ago1662695766IN
0xd2cA0Fc9...a26b693B6
0.1798 ETH0.0003712711.96354319
Airdrop155005662022-09-09 3:52:401267 days ago1662695560IN
0xd2cA0Fc9...a26b693B6
0.1805 ETH0.000296069.54008172
Airdrop155005452022-09-09 3:48:381267 days ago1662695318IN
0xd2cA0Fc9...a26b693B6
0.1805 ETH0.0003684911.87379305
Airdrop154965802022-09-08 12:29:291268 days ago1662640169IN
0xd2cA0Fc9...a26b693B6
0.1843 ETH0.000247938.19802695
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer155281012022-09-13 17:07:101262 days ago1663088830
0xd2cA0Fc9...a26b693B6
6.9046 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BodegaAirdrop

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "erc721psi/contracts/ERC721Psi.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
pragma solidity ^0.8.9;

interface AggregatorV3Interface {

  function decimals()
    external
    view
    returns (
      uint8
    );

  function description()
    external
    view
    returns (
      string memory
    );

  function version()
    external
    view
    returns (
      uint256
    );

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(
    uint80 _roundId
  )
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

}
contract BodegaAirdrop is 
    ERC721Psi, 
    Ownable, 
    ReentrancyGuard
{
    using Strings for uint256;
    using Counters for Counters.Counter;
    using SafeERC20 for IERC20;

    bytes32 public root;

    uint256 public maxSupply = 111;
    uint256 public airdropAmountLimit = 1;

    string public baseURI; 
    string public notRevealedUri = "ipfs://QmYUuwLoiRb8woXwJCCsr1gvbr8E21KuxRtmVBmnH1tZz7/hidden.json";
    string public baseExtension = ".json";

    Counters.Counter private _tokenIds;
    mapping(uint256 => address) public airdropAddresses;
    AggregatorV3Interface internal eth_usd_price_feed;
    IERC20 USDT;
    IERC20 USDC;
    uint256 USDT_DECIMAl = 10**6;
    uint256 USDC_DECIMAL = 10**6;
    uint256 default_decimal = 10**18;
    uint256 eth_usd_decimal = 10**8;
    uint256 public usdPrice = 300*eth_usd_decimal;

    constructor(string memory uri, bytes32 merkleroot)
        ERC721Psi("BodegaAirdrop", "NFT")
        ReentrancyGuard()
    {
        root = merkleroot;
        USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);
        USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
        eth_usd_price_feed = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
        setBaseURI(uri);
    }

    /**
     * Returns the ETH To USD Price
     */
    function getETHToUSD() public view returns (uint256) {
        (
            ,
            int256 answer,
            ,
            ,
        ) = eth_usd_price_feed.latestRoundData();
        return uint256(answer);
    }

    function getEthAmount() public view returns (uint256) {
        uint256 eth_to_usd = getETHToUSD();
        return default_decimal*usdPrice/eth_to_usd;
    }

    function getUSDTAllowance() public view returns(uint256){
        return USDT.allowance(msg.sender, address(this));
    }

    function getUSDCAllowance() public view returns(uint256) {
        return USDC.allowance(msg.sender, address(this));
    }

    function changeUSDPrice(uint256 price) public onlyOwner {
        usdPrice = price;
    }

    function setBaseURI(string memory _tokenBaseURI) public onlyOwner {
        baseURI = _tokenBaseURI;
    }

    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    modifier onlyAccounts () {
        require(msg.sender == tx.origin, "Not allowed origin");
        _;
    }

    modifier isValidMerkleProof(bytes32[] calldata _proof) {
         require(MerkleProof.verify(
            _proof,
            root,
            keccak256(abi.encodePacked(msg.sender))
            ) == true, "Not allowed origin");
        _;
   }

    function airdrop(address account, uint256 _amount, uint256 cryptotype, uint256 coinamount,bytes32[] calldata _proof) 
    external 
    payable
    isValidMerkleProof(_proof)
    onlyAccounts
    {
        require(msg.sender == account,          "Not allowed");
        require(_amount > 0, "zero amount");
        require(_amount <= airdropAmountLimit, "Airdrop AmountLimit");

        uint current = _tokenIds.current();

        require(
            current + _amount <= maxSupply,
            "Max supply exceeded"
        );

        if(cryptotype == 0){
            require(
                getEthAmount() * _amount <= msg.value,
                "Not enough ethers sent"
            );
        }else if(cryptotype == 1){
            require(coinamount <= getUSDTAllowance(), "Please approve tokens before transferring");
            require(usdPrice * _amount <= (coinamount*eth_usd_decimal/USDT_DECIMAl) ,"Not enough usdt sent");
            USDT.safeTransferFrom(msg.sender, address(this), coinamount);
        }else if(cryptotype == 2) {
            require(coinamount <= getUSDCAllowance(), "Please approve tokens before transferring");
            require(usdPrice * _amount <= (coinamount*eth_usd_decimal/USDC_DECIMAL) ,"Not enough usdc sent");
            USDC.safeTransferFrom(msg.sender, address(this), coinamount);
        }else{
            return;
        }

        for (uint i = 0; i < _amount; i++) {
            mintInternal();
        }
    }

    function mintInternal() internal nonReentrant {
        _tokenIds.increment();

        uint256 tokenId = _tokenIds.current();
        _safeMint(msg.sender, 1);
        airdropAddresses[tokenId] = msg.sender;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );

        string memory currentBaseURI = _baseURI();
    
        return
            bytes(currentBaseURI).length > 0
                ? string(
                    abi.encodePacked(
                        currentBaseURI,
                        tokenId.toString(),
                        baseExtension
                    )
                )
                : "";
    }

    function setBaseExtension(string memory _newBaseExtension)
        public
        onlyOwner
    {
        baseExtension = _newBaseExtension;
    }

    function setMerkleRoot(bytes32 merkleroot) 
    onlyOwner 
    public 
    {
        root = merkleroot;
    }

    function setAirdropAmountLimit(uint256 amount)
        public
        onlyOwner
    {
        airdropAmountLimit = amount;
    }

    function totalSupply() public override view returns (uint) {
        return _tokenIds.current();
    }

    function withdraw(uint256 cryptotype) external onlyOwner {
        if(cryptotype == 0) {
            payable(msg.sender).transfer(address(this).balance); 
        }else if(cryptotype == 1) {
            USDT.safeTransfer(msg.sender, USDT.balanceOf(address(this)));
        }else {
            USDC.safeTransfer(msg.sender, USDC.balanceOf(address(this)));
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, _allowances[owner][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = _allowances[owner][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Spend `amount` form the allowance of `owner` toward `spender`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   
                                              
                                            
 */

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
import "solidity-bits/contracts/BitMaps.sol";


contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using Address for address;
    using Strings for uint256;
    using BitMaps for BitMaps.BitMap;

    BitMaps.BitMap private _batchHead;

    string private _name;
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) internal _owners;
    uint256 internal _minted;

    mapping(uint256 => address) private _tokenApprovals;
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) 
        public 
        view 
        virtual 
        override 
        returns (uint) 
    {
        require(owner != address(0), "ERC721Psi: balance query for the zero address");

        uint count;
        for( uint i; i < _minted; ++i ){
            if(_exists(i)){
                if( owner == ownerOf(i)){
                    ++count;
                }
            }
        }
        return count;
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(tokenId);
        return owner;
    }

    function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead){
        require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token");
        tokenIdBatchHead = _getBatchHead(tokenId);
        owner = _owners[tokenIdBatchHead];
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token");

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

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


    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ownerOf(tokenId);
        require(to != owner, "ERC721Psi: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721Psi: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        require(
            _exists(tokenId),
            "ERC721Psi: approved query for nonexistent token"
        );

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
    {
        require(operator != _msgSender(), "ERC721Psi: approve to caller");

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721Psi: transfer caller is not owner nor approved"
        );

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721Psi: transfer caller is not owner nor approved"
        );
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, 1,_data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return tokenId < _minted;
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId)
        internal
        view
        virtual
        returns (bool)
    {
        require(
            _exists(tokenId),
            "ERC721Psi: operator query for nonexistent token"
        );
        address owner = ownerOf(tokenId);
        return (spender == owner ||
            getApproved(tokenId) == spender ||
            isApprovedForAll(owner, spender));
    }

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

    
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        uint256 startTokenId = _minted;
        _mint(to, quantity);
        require(
            _checkOnERC721Received(address(0), to, startTokenId, quantity, _data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }


    function _mint(
        address to,
        uint256 quantity
    ) internal virtual {
        uint256 tokenIdBatchHead = _minted;
        
        require(quantity > 0, "ERC721Psi: quantity must be greater 0");
        require(to != address(0), "ERC721Psi: mint to the zero address");
        
        _beforeTokenTransfers(address(0), to, tokenIdBatchHead, quantity);
        _minted += quantity;
        _owners[tokenIdBatchHead] = to;
        _batchHead.set(tokenIdBatchHead);
        _afterTokenTransfers(address(0), to, tokenIdBatchHead, quantity);
        
        // Emit events
        for(uint256 tokenId=tokenIdBatchHead;tokenId < tokenIdBatchHead + quantity; tokenId++){
            emit Transfer(address(0), to, tokenId);
        } 
    }


    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(tokenId);

        require(
            owner == from,
            "ERC721Psi: transfer of token that is not own"
        );
        require(to != address(0), "ERC721Psi: transfer to the zero address");

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        uint256 nextTokenId = tokenId + 1;

        if(!_batchHead.get(nextTokenId) &&  
            nextTokenId < _minted
        ) {
            _owners[nextTokenId] = from;
            _batchHead.set(nextTokenId);
        }

        _owners[tokenId] = to;
        if(tokenId != tokenIdBatchHead) {
            _batchHead.set(tokenId);
        }

        emit Transfer(from, to, tokenId);

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

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param startTokenId uint256 the first ID of the tokens to be transferred
     * @param quantity uint256 amount of the tokens to be transfered.
     * @param _data bytes optional data to send along with the call
     * @return r bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity,
        bytes memory _data
    ) private returns (bool r) {
        if (to.isContract()) {
            r = true;
            for(uint256 tokenId = startTokenId; tokenId < startTokenId + quantity; tokenId++){
                try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                    r = r && retval == IERC721Receiver.onERC721Received.selector;
                } catch (bytes memory reason) {
                    if (reason.length == 0) {
                        revert("ERC721Psi: transfer to non ERC721Receiver implementer");
                    } else {
                        assembly {
                            revert(add(32, reason), mload(reason))
                        }
                    }
                }
            }
            return r;
        } else {
            return true;
        }
    }

    function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) {
        tokenIdBatchHead = _batchHead.scanForward(tokenId); 
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _minted;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < totalSupply(), "ERC721Psi: global index out of bounds");
        
        uint count;
        for(uint i; i < _minted; i++){
            if(_exists(i)){
                if(count == index) return i;
                else count++;
            }
        }
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) {
        uint count;
        for(uint i; i < _minted; i++){
            if(_exists(i) && owner == ownerOf(i)){
                if(count == index) return i;
                else count++;
            }
        }

        revert("ERC721Psi: owner index out of bounds");
    }


    /**
     * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
     *
     * 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`.
     */
    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.
     *
     * 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` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

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

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 6 of 22 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}

// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */
pragma solidity ^0.8.0;

import "./BitScan.sol";

/**
 * @dev This Library is a modified version of Openzeppelin's BitMaps library.
 * Functions of finding the index of the closest set bit from a given index are added.
 * The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB.
 * The modification of indexing makes finding the closest previous set bit more efficient in gas usage.
*/

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */

library BitMaps {
    using BitScan for uint256;
    uint256 private constant MASK_INDEX_ZERO = (1 << 255);
    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(
        BitMap storage bitmap,
        uint256 index,
        bool value
    ) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }

    /**
     * @dev Find the closest index of the set bit before `index`.
     */
    function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256) {
        uint256 bucket = index >> 8;

        // index within the bucket
        uint256 bucketIndex = (index & 0xff);

        // load a bitboard from the bitmap.
        uint256 bb = bitmap._data[bucket];

        // offset the bitboard to scan from `bucketIndex`.
        bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
        
        if(bb > 0) {
            unchecked {
                return (bucket << 8) | (bucketIndex -  bb.bitScanForward256());    
            }
        } else {
            while(true) {
                require(bucket > 0, "BitMaps: The set bit before the index doesn't exist.");
                unchecked {
                    bucket--;
                }
                // No offset. Always scan from the least significiant bit now.
                bb = bitmap._data[bucket];
                
                if(bb > 0) {
                    unchecked {
                        return (bucket << 8) | (255 -  bb.bitScanForward256());    
                    }
                } 
            }
        }
    }

    function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) {
        return bitmap._data[bucket];
    }
}

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

// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */

pragma solidity ^0.8.0;


library BitScan {
    uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff;
    bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8";

    /**
        @dev Isolate the least significant set bit.
     */ 
    function isolateLS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            return bb & (0 - bb);
        }
    } 

    /**
        @dev Isolate the most significant set bit.
     */ 
    function isolateMS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            bb |= bb >> 256;
            bb |= bb >> 128;
            bb |= bb >> 64;
            bb |= bb >> 32;
            bb |= bb >> 16;
            bb |= bb >> 8;
            bb |= bb >> 4;
            bb |= bb >> 2;
            bb |= bb >> 1;
            
            return (bb >> 1) + 1;
        }
    } 

    /**
        @dev Find the index of the lest significant set bit. (trailing zero count)
     */ 
    function bitScanForward256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]);
        }   
    }

    /**
        @dev Find the index of the most significant set bit.
     */ 
    function bitScanReverse256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]);
        }   
    }

    function log2(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]);
        } 
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes32","name":"merkleroot","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"cryptotype","type":"uint256"},{"internalType":"uint256","name":"coinamount","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"airdrop","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"airdropAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"airdropAmountLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"changeUSDPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getETHToUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEthAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUSDCAllowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUSDTAllowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"notRevealedUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"root","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setAirdropAmountLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseExtension","type":"string"}],"name":"setBaseExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_tokenBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleroot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cryptotype","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

606f600a556001600b5561010060405260416080818152906200343d60a03980516200003491600d916020909101906200029f565b5060408051808201909152600580825264173539b7b760d91b60209092019182526200006391600e916200029f565b50620f4240601455620f4240601555670de0b6b3a76400006016556305f5e10060175560175461012c62000098919062000345565b601855348015620000a857600080fd5b506040516200347e3803806200347e833981016040819052620000cb9162000389565b604080518082018252600d81526c0426f6465676141697264726f7609c1b60208083019182528351808501909452600384526213919560ea1b9084015281519192916200011b916001916200029f565b508051620001319060029060208401906200029f565b5050506200014e62000148620001d160201b60201c565b620001d5565b60016008556009819055601280546001600160a01b031990811673dac17f958d2ee523a2206206994597c13d831ec71790915560138054821673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4817905560118054909116735f4ec3df9cbd43714fe2740f5e3616155c5b8419179055620001c98262000227565b5050620004ab565b3390565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6007546001600160a01b03163314620002865760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b80516200029b90600c9060208401906200029f565b5050565b828054620002ad906200046e565b90600052602060002090601f016020900481019282620002d157600085556200031c565b82601f10620002ec57805160ff19168380011785556200031c565b828001600101855582156200031c579182015b828111156200031c578251825591602001919060010190620002ff565b506200032a9291506200032e565b5090565b5b808211156200032a57600081556001016200032f565b60008160001904831182151516156200036e57634e487b7160e01b600052601160045260246000fd5b500290565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156200039d57600080fd5b82516001600160401b0380821115620003b557600080fd5b818501915085601f830112620003ca57600080fd5b815181811115620003df57620003df62000373565b604051601f8201601f19908116603f011681019083821181831017156200040a576200040a62000373565b816040528281526020935088848487010111156200042757600080fd5b600091505b828210156200044b57848201840151818301850152908301906200042c565b828211156200045d5760008484830101525b969092015195979596505050505050565b600181811c908216806200048357607f821691505b60208210811415620004a557634e487b7160e01b600052602260045260246000fd5b50919050565b612f8280620004bb6000396000f3fe6080604052600436106102255760003560e01c80636619aa8611610123578063a22cb465116100ab578063da3ef23f1161006f578063da3ef23f1461060f578063de2ebaf71461062f578063e985e9c514610644578063ebf0c7171461068d578063f2fde38b146106a357600080fd5b8063a22cb46514610584578063b88d4fde146105a4578063c6682862146105c4578063c87b56dd146105d9578063d5abeb01146105f957600080fd5b8063728deeff116100f2578063728deeff146104fc5780637cb64759146105115780638da5cb5b146105315780638ef1bb601461054f57806395d89b411461056f57600080fd5b80636619aa861461049c5780636c0360eb146104b257806370a08231146104c7578063715018a6146104e757600080fd5b8063230e6ecb116101b157806342842e0e1161017557806342842e0e146104095780634f6ccce71461042957806351c2ba711461044957806355f804b31461045c5780636352211e1461047c57600080fd5b8063230e6ecb1461037e57806323b872dd146103945780632e1a7d4d146103b45780632f745c59146103d45780633200e601146103f457600080fd5b8063081c8c44116101f8578063081c8c44146102ef578063087d01df14610304578063095ea7b31461032757806318160ddd146103495780631fbcddb41461035e57600080fd5b806301ffc9a71461022a57806306ca3ab71461025f57806306fdde03146102ad578063081812fc146102cf575b600080fd5b34801561023657600080fd5b5061024a610245366004612694565b6106c3565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b5061029561027a3660046126b1565b6010602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610256565b3480156102b957600080fd5b506102c2610730565b6040516102569190612722565b3480156102db57600080fd5b506102956102ea3660046126b1565b6107c2565b3480156102fb57600080fd5b506102c2610854565b34801561031057600080fd5b506103196108e2565b604051908152602001610256565b34801561033357600080fd5b50610347610342366004612751565b610910565b005b34801561035557600080fd5b50610319610a28565b34801561036a57600080fd5b506103476103793660046126b1565b610a38565b34801561038a57600080fd5b50610319600b5481565b3480156103a057600080fd5b506103476103af36600461277b565b610a67565b3480156103c057600080fd5b506103476103cf3660046126b1565b610a98565b3480156103e057600080fd5b506103196103ef366004612751565b610c2b565b34801561040057600080fd5b50610319610cf6565b34801561041557600080fd5b5061034761042436600461277b565b610d8a565b34801561043557600080fd5b506103196104443660046126b1565b610da5565b6103476104573660046127b7565b610e5f565b34801561046857600080fd5b506103476104773660046128e5565b611292565b34801561048857600080fd5b506102956104973660046126b1565b6112cf565b3480156104a857600080fd5b5061031960185481565b3480156104be57600080fd5b506102c26112e6565b3480156104d357600080fd5b506103196104e236600461292e565b6112f3565b3480156104f357600080fd5b506103476113c4565b34801561050857600080fd5b506103196113fa565b34801561051d57600080fd5b5061034761052c3660046126b1565b61147d565b34801561053d57600080fd5b506007546001600160a01b0316610295565b34801561055b57600080fd5b5061034761056a3660046126b1565b6114ac565b34801561057b57600080fd5b506102c26114db565b34801561059057600080fd5b5061034761059f366004612957565b6114ea565b3480156105b057600080fd5b506103476105bf36600461298e565b6115af565b3480156105d057600080fd5b506102c26115e7565b3480156105e557600080fd5b506102c26105f43660046126b1565b6115f4565b34801561060557600080fd5b50610319600a5481565b34801561061b57600080fd5b5061034761062a3660046128e5565b6116c4565b34801561063b57600080fd5b50610319611701565b34801561065057600080fd5b5061024a61065f366004612a0a565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561069957600080fd5b5061031960095481565b3480156106af57600080fd5b506103476106be36600461292e565b611738565b60006001600160e01b031982166380ac58cd60e01b14806106f457506001600160e01b03198216635b5e139f60e01b145b8061070f57506001600160e01b0319821663780e9d6360e01b145b8061072a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606001805461073f90612a3d565b80601f016020809104026020016040519081016040528092919081815260200182805461076b90612a3d565b80156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b5050505050905090565b60006107cf826004541190565b6108385760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600d805461086190612a3d565b80601f016020809104026020016040519081016040528092919081815260200182805461088d90612a3d565b80156108da5780601f106108af576101008083540402835291602001916108da565b820191906000526020600020905b8154815290600101906020018083116108bd57829003601f168201915b505050505081565b6000806108ed610cf6565b9050806018546016546109009190612a8e565b61090a9190612ac3565b91505090565b600061091b826112cf565b9050806001600160a01b0316836001600160a01b0316141561098b5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b606482015260840161082f565b336001600160a01b03821614806109a757506109a7813361065f565b610a195760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c0000000000606482015260840161082f565b610a2383836117d0565b505050565b6000610a33600f5490565b905090565b6007546001600160a01b03163314610a625760405162461bcd60e51b815260040161082f90612ad7565b600b55565b610a71338261183e565b610a8d5760405162461bcd60e51b815260040161082f90612b0c565b610a2383838361192d565b6007546001600160a01b03163314610ac25760405162461bcd60e51b815260040161082f90612ad7565b80610af75760405133904780156108fc02916000818181858888f19350505050158015610af3573d6000803e3d6000fd5b5050565b8060011415610b97576012546040516370a0823160e01b8152306004820152610b949133916001600160a01b03909116906370a082319060240160206040518083038186803b158015610b4957600080fd5b505afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b819190612b60565b6012546001600160a01b03169190611b19565b50565b6013546040516370a0823160e01b8152306004820152610b949133916001600160a01b03909116906370a082319060240160206040518083038186803b158015610be057600080fd5b505afa158015610bf4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c189190612b60565b6013546001600160a01b03169190611b19565b60008060005b600454811015610ca157610c46816004541190565b8015610c6b5750610c56816112cf565b6001600160a01b0316856001600160a01b0316145b15610c8f5783821415610c8157915061072a9050565b81610c8b81612b79565b9250505b80610c9981612b79565b915050610c31565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b606482015260840161082f565b600080601160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015610d4757600080fd5b505afa158015610d5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7f9190612bae565b509195945050505050565b610a23838383604051806020016040528060008152506115af565b6000610daf610a28565b8210610e0b5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b606482015260840161082f565b6000805b600454811015610e5857610e24816004541190565b15610e465783821415610e38579392505050565b81610e4281612b79565b9250505b80610e5081612b79565b915050610e0f565b5050919050565b8181610ed6828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506009546040516bffffffffffffffffffffffff193360601b166020820152909250603401905060405160208183030381529060405280519060200120611b7c565b1515600114610f1c5760405162461bcd60e51b81526020600482015260126024820152712737ba1030b63637bbb2b21037b934b3b4b760711b604482015260640161082f565b333214610f605760405162461bcd60e51b81526020600482015260126024820152712737ba1030b63637bbb2b21037b934b3b4b760711b604482015260640161082f565b336001600160a01b03891614610fa65760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b604482015260640161082f565b60008711610fe45760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015260640161082f565b600b5487111561102c5760405162461bcd60e51b8152602060048201526013602482015272105a5c991c9bdc08105b5bdd5b9d131a5b5a5d606a1b604482015260640161082f565b6000611037600f5490565b600a549091506110478983612bfe565b111561108b5760405162461bcd60e51b815260206004820152601360248201527213585e081cdd5c1c1b1e48195e18d959591959606a1b604482015260640161082f565b866110f057348861109a6108e2565b6110a49190612a8e565b11156110eb5760405162461bcd60e51b8152602060048201526016602482015275139bdd08195b9bdd59da08195d1a195c9cc81cd95b9d60521b604482015260640161082f565b611260565b86600114156111a557611101611701565b8611156111205760405162461bcd60e51b815260040161082f90612c16565b6014546017546111309088612a8e565b61113a9190612ac3565b886018546111489190612a8e565b111561118d5760405162461bcd60e51b8152602060048201526014602482015273139bdd08195b9bdd59da081d5cd91d081cd95b9d60621b604482015260640161082f565b6012546110eb906001600160a01b0316333089611b92565b866002141561125a576111b66113fa565b8611156111d55760405162461bcd60e51b815260040161082f90612c16565b6015546017546111e59088612a8e565b6111ef9190612ac3565b886018546111fd9190612a8e565b11156112425760405162461bcd60e51b8152602060048201526014602482015273139bdd08195b9bdd59da081d5cd918c81cd95b9d60621b604482015260640161082f565b6013546110eb906001600160a01b0316333089611b92565b50611288565b60005b8881101561128557611273611bca565b8061127d81612b79565b915050611263565b50505b5050505050505050565b6007546001600160a01b031633146112bc5760405162461bcd60e51b815260040161082f90612ad7565b8051610af390600c9060208401906125e5565b60008060006112dd84611c6d565b50949350505050565b600c805461086190612a3d565b60006001600160a01b0382166113615760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b606482015260840161082f565b6000805b6004548110156113bd5761137a816004541190565b156113ad57611388816112cf565b6001600160a01b0316846001600160a01b031614156113ad576113aa82612b79565b91505b6113b681612b79565b9050611365565b5092915050565b6007546001600160a01b031633146113ee5760405162461bcd60e51b815260040161082f90612ad7565b6113f86000611d06565b565b601354604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e906044015b60206040518083038186803b15801561144557600080fd5b505afa158015611459573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a339190612b60565b6007546001600160a01b031633146114a75760405162461bcd60e51b815260040161082f90612ad7565b600955565b6007546001600160a01b031633146114d65760405162461bcd60e51b815260040161082f90612ad7565b601855565b60606002805461073f90612a3d565b6001600160a01b0382163314156115435760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c657200000000604482015260640161082f565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6115b9338361183e565b6115d55760405162461bcd60e51b815260040161082f90612b0c565b6115e184848484611d58565b50505050565b600e805461086190612a3d565b6060611601826004541190565b6116655760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082f565b600061166f611d8d565b9050600081511161168f57604051806020016040528060008152506116bd565b8061169984611d9c565b600e6040516020016116ad93929190612c5f565b6040516020818303038152906040525b9392505050565b6007546001600160a01b031633146116ee5760405162461bcd60e51b815260040161082f90612ad7565b8051610af390600e9060208401906125e5565b601254604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e9060440161142d565b6007546001600160a01b031633146117625760405162461bcd60e51b815260040161082f90612ad7565b6001600160a01b0381166117c75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161082f565b610b9481611d06565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611805826112cf565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061184b826004541190565b6118af5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082f565b60006118ba836112cf565b9050806001600160a01b0316846001600160a01b031614806118f55750836001600160a01b03166118ea846107c2565b6001600160a01b0316145b8061192557506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b60008061193983611c6d565b91509150846001600160a01b0316826001600160a01b0316146119b35760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b606482015260840161082f565b6001600160a01b038416611a195760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b606482015260840161082f565b611a246000846117d0565b6000611a31846001612bfe565b600881901c600090815260208190526040902054909150600160ff1b60ff83161c16158015611a61575060045481105b15611a9757600081815260036020526040812080546001600160a01b0319166001600160a01b038916179055611a979082611e9a565b600084815260036020526040902080546001600160a01b0319166001600160a01b038716179055818414611ad057611ad0600085611e9a565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6040516001600160a01b038316602482015260448101829052610a2390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ec6565b600082611b898584611f98565b14949350505050565b6040516001600160a01b03808516602483015283166044820152606481018290526115e19085906323b872dd60e01b90608401611b45565b60026008541415611c1d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161082f565b6002600855611c30600f80546001019055565b6000611c3b600f5490565b9050611c4833600161200c565b600090815260106020526040902080546001600160a01b031916331790556001600855565b600080611c7b836004541190565b611cdc5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161082f565b611ce583612026565b6000818152600360205260409020546001600160a01b031694909350915050565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611d6384848461192d565b611d71848484600185612032565b6115e15760405162461bcd60e51b815260040161082f90612d23565b6060600c805461073f90612a3d565b606081611dc05750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611dea5780611dd481612b79565b9150611de39050600a83612ac3565b9150611dc4565b60008167ffffffffffffffff811115611e0557611e05612859565b6040519080825280601f01601f191660200182016040528015611e2f576020820181803683370190505b5090505b841561192557611e44600183612d78565b9150611e51600a86612d8f565b611e5c906030612bfe565b60f81b818381518110611e7157611e71612da3565b60200101906001600160f81b031916908160001a905350611e93600a86612ac3565b9450611e33565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6000611f1b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121759092919063ffffffff16565b805190915015610a235780806020019051810190611f399190612db9565b610a235760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161082f565b600081815b8451811015612004576000858281518110611fba57611fba612da3565b60200260200101519050808311611fe05760008381526020829052604090209250611ff1565b600081815260208490526040902092505b5080611ffc81612b79565b915050611f9d565b509392505050565b610af3828260405180602001604052806000815250612184565b600061072a818361219f565b60006001600160a01b0385163b1561216857506001835b6120538486612bfe565b81101561216257604051630a85bd0160e11b81526001600160a01b0387169063150b7a029061208c9033908b9086908990600401612dd6565b602060405180830381600087803b1580156120a657600080fd5b505af19250505080156120d6575060408051601f3d908101601f191682019092526120d391810190612e13565b60015b612130573d808015612104576040519150601f19603f3d011682016040523d82523d6000602084013e612109565b606091505b5080516121285760405162461bcd60e51b815260040161082f90612d23565b805181602001fd5b82801561214d57506001600160e01b03198116630a85bd0160e11b145b9250508061215a81612b79565b915050612049565b5061216c565b5060015b95945050505050565b60606119258484600085612294565b60045461219184846123c5565b611d71600085838686612032565b600881901c60008181526020849052604081205490919060ff808516919082181c80156121e4576121cf8161252a565b60ff168203600884901b17935050505061072a565b600083116122515760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b606482015260840161082f565b50600019909101600081815260208690526040902054909190801561228f576122798161252a565b60ff0360ff16600884901b17935050505061072a565b6121e4565b6060824710156122f55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161082f565b6001600160a01b0385163b61234c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161082f565b600080866001600160a01b031685876040516123689190612e30565b60006040518083038185875af1925050503d80600081146123a5576040519150601f19603f3d011682016040523d82523d6000602084013e6123aa565b606091505b50915091506123ba828286612594565b979650505050505050565b600454816124235760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b606482015260840161082f565b6001600160a01b0383166124855760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b606482015260840161082f565b81600460008282546124979190612bfe565b9091555050600081815260036020526040812080546001600160a01b0319166001600160a01b0386161790556124cd9082611e9a565b805b6124d98383612bfe565b8110156115e15760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48061252281612b79565b9150506124cf565b60006040518061012001604052806101008152602001612e4d610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612573856125cd565b02901c8151811061258657612586612da3565b016020015160f81c92915050565b606083156125a35750816116bd565b8251156125b35782518084602001fd5b8160405162461bcd60e51b815260040161082f9190612722565b60008082116125db57600080fd5b5060008190031690565b8280546125f190612a3d565b90600052602060002090601f0160209004810192826126135760008555612659565b82601f1061262c57805160ff1916838001178555612659565b82800160010185558215612659579182015b8281111561265957825182559160200191906001019061263e565b50612665929150612669565b5090565b5b80821115612665576000815560010161266a565b6001600160e01b031981168114610b9457600080fd5b6000602082840312156126a657600080fd5b81356116bd8161267e565b6000602082840312156126c357600080fd5b5035919050565b60005b838110156126e55781810151838201526020016126cd565b838111156115e15750506000910152565b6000815180845261270e8160208601602086016126ca565b601f01601f19169290920160200192915050565b6020815260006116bd60208301846126f6565b80356001600160a01b038116811461274c57600080fd5b919050565b6000806040838503121561276457600080fd5b61276d83612735565b946020939093013593505050565b60008060006060848603121561279057600080fd5b61279984612735565b92506127a760208501612735565b9150604084013590509250925092565b60008060008060008060a087890312156127d057600080fd5b6127d987612735565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561280b57600080fd5b818901915089601f83011261281f57600080fd5b81358181111561282e57600080fd5b8a60208260051b850101111561284357600080fd5b6020830194508093505050509295509295509295565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561288a5761288a612859565b604051601f8501601f19908116603f011681019082821181831017156128b2576128b2612859565b816040528093508581528686860111156128cb57600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156128f757600080fd5b813567ffffffffffffffff81111561290e57600080fd5b8201601f8101841361291f57600080fd5b6119258482356020840161286f565b60006020828403121561294057600080fd5b6116bd82612735565b8015158114610b9457600080fd5b6000806040838503121561296a57600080fd5b61297383612735565b9150602083013561298381612949565b809150509250929050565b600080600080608085870312156129a457600080fd5b6129ad85612735565b93506129bb60208601612735565b925060408501359150606085013567ffffffffffffffff8111156129de57600080fd5b8501601f810187136129ef57600080fd5b6129fe8782356020840161286f565b91505092959194509250565b60008060408385031215612a1d57600080fd5b612a2683612735565b9150612a3460208401612735565b90509250929050565b600181811c90821680612a5157607f821691505b60208210811415612a7257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612aa857612aa8612a78565b500290565b634e487b7160e01b600052601260045260246000fd5b600082612ad257612ad2612aad565b500490565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b600060208284031215612b7257600080fd5b5051919050565b6000600019821415612b8d57612b8d612a78565b5060010190565b805169ffffffffffffffffffff8116811461274c57600080fd5b600080600080600060a08688031215612bc657600080fd5b612bcf86612b94565b9450602086015193506040860151925060608601519150612bf260808701612b94565b90509295509295909350565b60008219821115612c1157612c11612a78565b500190565b60208082526029908201527f506c6561736520617070726f766520746f6b656e73206265666f7265207472616040820152686e7366657272696e6760b81b606082015260800190565b600084516020612c728285838a016126ca565b855191840191612c858184848a016126ca565b8554920191600090600181811c9080831680612ca257607f831692505b858310811415612cc057634e487b7160e01b85526022600452602485fd5b808015612cd45760018114612ce557612d12565b60ff19851688528388019550612d12565b60008b81526020902060005b85811015612d0a5781548a820152908401908801612cf1565b505083880195505b50939b9a5050505050505050505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b600082821015612d8a57612d8a612a78565b500390565b600082612d9e57612d9e612aad565b500690565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612dcb57600080fd5b81516116bd81612949565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612e09908301846126f6565b9695505050505050565b600060208284031215612e2557600080fd5b81516116bd8161267e565b60008251612e428184602087016126ca565b919091019291505056fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a26469706673582212201608e10c0d1fb9a2c7e5391a6b09f84d2c45731e801ce854147903699e22cda964736f6c63430008090033697066733a2f2f516d595575774c6f69526238776f58774a434373723167766272384532314b757852746d56426d6e4831745a7a372f68696464656e2e6a736f6e0000000000000000000000000000000000000000000000000000000000000040a7901cda71fea59548ca9ffeb2fc988f54691d8583be52be5c85a4bc96f214ef0000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d56324c466263744d67644e55414336553631364b724d6a666e616f4a4d69537335394165783679354e6650362f00000000000000000000

Deployed Bytecode

0x6080604052600436106102255760003560e01c80636619aa8611610123578063a22cb465116100ab578063da3ef23f1161006f578063da3ef23f1461060f578063de2ebaf71461062f578063e985e9c514610644578063ebf0c7171461068d578063f2fde38b146106a357600080fd5b8063a22cb46514610584578063b88d4fde146105a4578063c6682862146105c4578063c87b56dd146105d9578063d5abeb01146105f957600080fd5b8063728deeff116100f2578063728deeff146104fc5780637cb64759146105115780638da5cb5b146105315780638ef1bb601461054f57806395d89b411461056f57600080fd5b80636619aa861461049c5780636c0360eb146104b257806370a08231146104c7578063715018a6146104e757600080fd5b8063230e6ecb116101b157806342842e0e1161017557806342842e0e146104095780634f6ccce71461042957806351c2ba711461044957806355f804b31461045c5780636352211e1461047c57600080fd5b8063230e6ecb1461037e57806323b872dd146103945780632e1a7d4d146103b45780632f745c59146103d45780633200e601146103f457600080fd5b8063081c8c44116101f8578063081c8c44146102ef578063087d01df14610304578063095ea7b31461032757806318160ddd146103495780631fbcddb41461035e57600080fd5b806301ffc9a71461022a57806306ca3ab71461025f57806306fdde03146102ad578063081812fc146102cf575b600080fd5b34801561023657600080fd5b5061024a610245366004612694565b6106c3565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b5061029561027a3660046126b1565b6010602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610256565b3480156102b957600080fd5b506102c2610730565b6040516102569190612722565b3480156102db57600080fd5b506102956102ea3660046126b1565b6107c2565b3480156102fb57600080fd5b506102c2610854565b34801561031057600080fd5b506103196108e2565b604051908152602001610256565b34801561033357600080fd5b50610347610342366004612751565b610910565b005b34801561035557600080fd5b50610319610a28565b34801561036a57600080fd5b506103476103793660046126b1565b610a38565b34801561038a57600080fd5b50610319600b5481565b3480156103a057600080fd5b506103476103af36600461277b565b610a67565b3480156103c057600080fd5b506103476103cf3660046126b1565b610a98565b3480156103e057600080fd5b506103196103ef366004612751565b610c2b565b34801561040057600080fd5b50610319610cf6565b34801561041557600080fd5b5061034761042436600461277b565b610d8a565b34801561043557600080fd5b506103196104443660046126b1565b610da5565b6103476104573660046127b7565b610e5f565b34801561046857600080fd5b506103476104773660046128e5565b611292565b34801561048857600080fd5b506102956104973660046126b1565b6112cf565b3480156104a857600080fd5b5061031960185481565b3480156104be57600080fd5b506102c26112e6565b3480156104d357600080fd5b506103196104e236600461292e565b6112f3565b3480156104f357600080fd5b506103476113c4565b34801561050857600080fd5b506103196113fa565b34801561051d57600080fd5b5061034761052c3660046126b1565b61147d565b34801561053d57600080fd5b506007546001600160a01b0316610295565b34801561055b57600080fd5b5061034761056a3660046126b1565b6114ac565b34801561057b57600080fd5b506102c26114db565b34801561059057600080fd5b5061034761059f366004612957565b6114ea565b3480156105b057600080fd5b506103476105bf36600461298e565b6115af565b3480156105d057600080fd5b506102c26115e7565b3480156105e557600080fd5b506102c26105f43660046126b1565b6115f4565b34801561060557600080fd5b50610319600a5481565b34801561061b57600080fd5b5061034761062a3660046128e5565b6116c4565b34801561063b57600080fd5b50610319611701565b34801561065057600080fd5b5061024a61065f366004612a0a565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561069957600080fd5b5061031960095481565b3480156106af57600080fd5b506103476106be36600461292e565b611738565b60006001600160e01b031982166380ac58cd60e01b14806106f457506001600160e01b03198216635b5e139f60e01b145b8061070f57506001600160e01b0319821663780e9d6360e01b145b8061072a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606001805461073f90612a3d565b80601f016020809104026020016040519081016040528092919081815260200182805461076b90612a3d565b80156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b5050505050905090565b60006107cf826004541190565b6108385760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600d805461086190612a3d565b80601f016020809104026020016040519081016040528092919081815260200182805461088d90612a3d565b80156108da5780601f106108af576101008083540402835291602001916108da565b820191906000526020600020905b8154815290600101906020018083116108bd57829003601f168201915b505050505081565b6000806108ed610cf6565b9050806018546016546109009190612a8e565b61090a9190612ac3565b91505090565b600061091b826112cf565b9050806001600160a01b0316836001600160a01b0316141561098b5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b606482015260840161082f565b336001600160a01b03821614806109a757506109a7813361065f565b610a195760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c0000000000606482015260840161082f565b610a2383836117d0565b505050565b6000610a33600f5490565b905090565b6007546001600160a01b03163314610a625760405162461bcd60e51b815260040161082f90612ad7565b600b55565b610a71338261183e565b610a8d5760405162461bcd60e51b815260040161082f90612b0c565b610a2383838361192d565b6007546001600160a01b03163314610ac25760405162461bcd60e51b815260040161082f90612ad7565b80610af75760405133904780156108fc02916000818181858888f19350505050158015610af3573d6000803e3d6000fd5b5050565b8060011415610b97576012546040516370a0823160e01b8152306004820152610b949133916001600160a01b03909116906370a082319060240160206040518083038186803b158015610b4957600080fd5b505afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b819190612b60565b6012546001600160a01b03169190611b19565b50565b6013546040516370a0823160e01b8152306004820152610b949133916001600160a01b03909116906370a082319060240160206040518083038186803b158015610be057600080fd5b505afa158015610bf4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c189190612b60565b6013546001600160a01b03169190611b19565b60008060005b600454811015610ca157610c46816004541190565b8015610c6b5750610c56816112cf565b6001600160a01b0316856001600160a01b0316145b15610c8f5783821415610c8157915061072a9050565b81610c8b81612b79565b9250505b80610c9981612b79565b915050610c31565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b606482015260840161082f565b600080601160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015610d4757600080fd5b505afa158015610d5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7f9190612bae565b509195945050505050565b610a23838383604051806020016040528060008152506115af565b6000610daf610a28565b8210610e0b5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b606482015260840161082f565b6000805b600454811015610e5857610e24816004541190565b15610e465783821415610e38579392505050565b81610e4281612b79565b9250505b80610e5081612b79565b915050610e0f565b5050919050565b8181610ed6828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506009546040516bffffffffffffffffffffffff193360601b166020820152909250603401905060405160208183030381529060405280519060200120611b7c565b1515600114610f1c5760405162461bcd60e51b81526020600482015260126024820152712737ba1030b63637bbb2b21037b934b3b4b760711b604482015260640161082f565b333214610f605760405162461bcd60e51b81526020600482015260126024820152712737ba1030b63637bbb2b21037b934b3b4b760711b604482015260640161082f565b336001600160a01b03891614610fa65760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b604482015260640161082f565b60008711610fe45760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015260640161082f565b600b5487111561102c5760405162461bcd60e51b8152602060048201526013602482015272105a5c991c9bdc08105b5bdd5b9d131a5b5a5d606a1b604482015260640161082f565b6000611037600f5490565b600a549091506110478983612bfe565b111561108b5760405162461bcd60e51b815260206004820152601360248201527213585e081cdd5c1c1b1e48195e18d959591959606a1b604482015260640161082f565b866110f057348861109a6108e2565b6110a49190612a8e565b11156110eb5760405162461bcd60e51b8152602060048201526016602482015275139bdd08195b9bdd59da08195d1a195c9cc81cd95b9d60521b604482015260640161082f565b611260565b86600114156111a557611101611701565b8611156111205760405162461bcd60e51b815260040161082f90612c16565b6014546017546111309088612a8e565b61113a9190612ac3565b886018546111489190612a8e565b111561118d5760405162461bcd60e51b8152602060048201526014602482015273139bdd08195b9bdd59da081d5cd91d081cd95b9d60621b604482015260640161082f565b6012546110eb906001600160a01b0316333089611b92565b866002141561125a576111b66113fa565b8611156111d55760405162461bcd60e51b815260040161082f90612c16565b6015546017546111e59088612a8e565b6111ef9190612ac3565b886018546111fd9190612a8e565b11156112425760405162461bcd60e51b8152602060048201526014602482015273139bdd08195b9bdd59da081d5cd918c81cd95b9d60621b604482015260640161082f565b6013546110eb906001600160a01b0316333089611b92565b50611288565b60005b8881101561128557611273611bca565b8061127d81612b79565b915050611263565b50505b5050505050505050565b6007546001600160a01b031633146112bc5760405162461bcd60e51b815260040161082f90612ad7565b8051610af390600c9060208401906125e5565b60008060006112dd84611c6d565b50949350505050565b600c805461086190612a3d565b60006001600160a01b0382166113615760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b606482015260840161082f565b6000805b6004548110156113bd5761137a816004541190565b156113ad57611388816112cf565b6001600160a01b0316846001600160a01b031614156113ad576113aa82612b79565b91505b6113b681612b79565b9050611365565b5092915050565b6007546001600160a01b031633146113ee5760405162461bcd60e51b815260040161082f90612ad7565b6113f86000611d06565b565b601354604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e906044015b60206040518083038186803b15801561144557600080fd5b505afa158015611459573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a339190612b60565b6007546001600160a01b031633146114a75760405162461bcd60e51b815260040161082f90612ad7565b600955565b6007546001600160a01b031633146114d65760405162461bcd60e51b815260040161082f90612ad7565b601855565b60606002805461073f90612a3d565b6001600160a01b0382163314156115435760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c657200000000604482015260640161082f565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6115b9338361183e565b6115d55760405162461bcd60e51b815260040161082f90612b0c565b6115e184848484611d58565b50505050565b600e805461086190612a3d565b6060611601826004541190565b6116655760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082f565b600061166f611d8d565b9050600081511161168f57604051806020016040528060008152506116bd565b8061169984611d9c565b600e6040516020016116ad93929190612c5f565b6040516020818303038152906040525b9392505050565b6007546001600160a01b031633146116ee5760405162461bcd60e51b815260040161082f90612ad7565b8051610af390600e9060208401906125e5565b601254604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e9060440161142d565b6007546001600160a01b031633146117625760405162461bcd60e51b815260040161082f90612ad7565b6001600160a01b0381166117c75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161082f565b610b9481611d06565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611805826112cf565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061184b826004541190565b6118af5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082f565b60006118ba836112cf565b9050806001600160a01b0316846001600160a01b031614806118f55750836001600160a01b03166118ea846107c2565b6001600160a01b0316145b8061192557506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b60008061193983611c6d565b91509150846001600160a01b0316826001600160a01b0316146119b35760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b606482015260840161082f565b6001600160a01b038416611a195760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b606482015260840161082f565b611a246000846117d0565b6000611a31846001612bfe565b600881901c600090815260208190526040902054909150600160ff1b60ff83161c16158015611a61575060045481105b15611a9757600081815260036020526040812080546001600160a01b0319166001600160a01b038916179055611a979082611e9a565b600084815260036020526040902080546001600160a01b0319166001600160a01b038716179055818414611ad057611ad0600085611e9a565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6040516001600160a01b038316602482015260448101829052610a2390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ec6565b600082611b898584611f98565b14949350505050565b6040516001600160a01b03808516602483015283166044820152606481018290526115e19085906323b872dd60e01b90608401611b45565b60026008541415611c1d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161082f565b6002600855611c30600f80546001019055565b6000611c3b600f5490565b9050611c4833600161200c565b600090815260106020526040902080546001600160a01b031916331790556001600855565b600080611c7b836004541190565b611cdc5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161082f565b611ce583612026565b6000818152600360205260409020546001600160a01b031694909350915050565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611d6384848461192d565b611d71848484600185612032565b6115e15760405162461bcd60e51b815260040161082f90612d23565b6060600c805461073f90612a3d565b606081611dc05750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611dea5780611dd481612b79565b9150611de39050600a83612ac3565b9150611dc4565b60008167ffffffffffffffff811115611e0557611e05612859565b6040519080825280601f01601f191660200182016040528015611e2f576020820181803683370190505b5090505b841561192557611e44600183612d78565b9150611e51600a86612d8f565b611e5c906030612bfe565b60f81b818381518110611e7157611e71612da3565b60200101906001600160f81b031916908160001a905350611e93600a86612ac3565b9450611e33565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6000611f1b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121759092919063ffffffff16565b805190915015610a235780806020019051810190611f399190612db9565b610a235760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161082f565b600081815b8451811015612004576000858281518110611fba57611fba612da3565b60200260200101519050808311611fe05760008381526020829052604090209250611ff1565b600081815260208490526040902092505b5080611ffc81612b79565b915050611f9d565b509392505050565b610af3828260405180602001604052806000815250612184565b600061072a818361219f565b60006001600160a01b0385163b1561216857506001835b6120538486612bfe565b81101561216257604051630a85bd0160e11b81526001600160a01b0387169063150b7a029061208c9033908b9086908990600401612dd6565b602060405180830381600087803b1580156120a657600080fd5b505af19250505080156120d6575060408051601f3d908101601f191682019092526120d391810190612e13565b60015b612130573d808015612104576040519150601f19603f3d011682016040523d82523d6000602084013e612109565b606091505b5080516121285760405162461bcd60e51b815260040161082f90612d23565b805181602001fd5b82801561214d57506001600160e01b03198116630a85bd0160e11b145b9250508061215a81612b79565b915050612049565b5061216c565b5060015b95945050505050565b60606119258484600085612294565b60045461219184846123c5565b611d71600085838686612032565b600881901c60008181526020849052604081205490919060ff808516919082181c80156121e4576121cf8161252a565b60ff168203600884901b17935050505061072a565b600083116122515760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b606482015260840161082f565b50600019909101600081815260208690526040902054909190801561228f576122798161252a565b60ff0360ff16600884901b17935050505061072a565b6121e4565b6060824710156122f55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161082f565b6001600160a01b0385163b61234c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161082f565b600080866001600160a01b031685876040516123689190612e30565b60006040518083038185875af1925050503d80600081146123a5576040519150601f19603f3d011682016040523d82523d6000602084013e6123aa565b606091505b50915091506123ba828286612594565b979650505050505050565b600454816124235760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b606482015260840161082f565b6001600160a01b0383166124855760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b606482015260840161082f565b81600460008282546124979190612bfe565b9091555050600081815260036020526040812080546001600160a01b0319166001600160a01b0386161790556124cd9082611e9a565b805b6124d98383612bfe565b8110156115e15760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48061252281612b79565b9150506124cf565b60006040518061012001604052806101008152602001612e4d610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612573856125cd565b02901c8151811061258657612586612da3565b016020015160f81c92915050565b606083156125a35750816116bd565b8251156125b35782518084602001fd5b8160405162461bcd60e51b815260040161082f9190612722565b60008082116125db57600080fd5b5060008190031690565b8280546125f190612a3d565b90600052602060002090601f0160209004810192826126135760008555612659565b82601f1061262c57805160ff1916838001178555612659565b82800160010185558215612659579182015b8281111561265957825182559160200191906001019061263e565b50612665929150612669565b5090565b5b80821115612665576000815560010161266a565b6001600160e01b031981168114610b9457600080fd5b6000602082840312156126a657600080fd5b81356116bd8161267e565b6000602082840312156126c357600080fd5b5035919050565b60005b838110156126e55781810151838201526020016126cd565b838111156115e15750506000910152565b6000815180845261270e8160208601602086016126ca565b601f01601f19169290920160200192915050565b6020815260006116bd60208301846126f6565b80356001600160a01b038116811461274c57600080fd5b919050565b6000806040838503121561276457600080fd5b61276d83612735565b946020939093013593505050565b60008060006060848603121561279057600080fd5b61279984612735565b92506127a760208501612735565b9150604084013590509250925092565b60008060008060008060a087890312156127d057600080fd5b6127d987612735565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561280b57600080fd5b818901915089601f83011261281f57600080fd5b81358181111561282e57600080fd5b8a60208260051b850101111561284357600080fd5b6020830194508093505050509295509295509295565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561288a5761288a612859565b604051601f8501601f19908116603f011681019082821181831017156128b2576128b2612859565b816040528093508581528686860111156128cb57600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156128f757600080fd5b813567ffffffffffffffff81111561290e57600080fd5b8201601f8101841361291f57600080fd5b6119258482356020840161286f565b60006020828403121561294057600080fd5b6116bd82612735565b8015158114610b9457600080fd5b6000806040838503121561296a57600080fd5b61297383612735565b9150602083013561298381612949565b809150509250929050565b600080600080608085870312156129a457600080fd5b6129ad85612735565b93506129bb60208601612735565b925060408501359150606085013567ffffffffffffffff8111156129de57600080fd5b8501601f810187136129ef57600080fd5b6129fe8782356020840161286f565b91505092959194509250565b60008060408385031215612a1d57600080fd5b612a2683612735565b9150612a3460208401612735565b90509250929050565b600181811c90821680612a5157607f821691505b60208210811415612a7257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612aa857612aa8612a78565b500290565b634e487b7160e01b600052601260045260246000fd5b600082612ad257612ad2612aad565b500490565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b600060208284031215612b7257600080fd5b5051919050565b6000600019821415612b8d57612b8d612a78565b5060010190565b805169ffffffffffffffffffff8116811461274c57600080fd5b600080600080600060a08688031215612bc657600080fd5b612bcf86612b94565b9450602086015193506040860151925060608601519150612bf260808701612b94565b90509295509295909350565b60008219821115612c1157612c11612a78565b500190565b60208082526029908201527f506c6561736520617070726f766520746f6b656e73206265666f7265207472616040820152686e7366657272696e6760b81b606082015260800190565b600084516020612c728285838a016126ca565b855191840191612c858184848a016126ca565b8554920191600090600181811c9080831680612ca257607f831692505b858310811415612cc057634e487b7160e01b85526022600452602485fd5b808015612cd45760018114612ce557612d12565b60ff19851688528388019550612d12565b60008b81526020902060005b85811015612d0a5781548a820152908401908801612cf1565b505083880195505b50939b9a5050505050505050505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b600082821015612d8a57612d8a612a78565b500390565b600082612d9e57612d9e612aad565b500690565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612dcb57600080fd5b81516116bd81612949565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612e09908301846126f6565b9695505050505050565b600060208284031215612e2557600080fd5b81516116bd8161267e565b60008251612e428184602087016126ca565b919091019291505056fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a26469706673582212201608e10c0d1fb9a2c7e5391a6b09f84d2c45731e801ce854147903699e22cda964736f6c63430008090033

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

0000000000000000000000000000000000000000000000000000000000000040a7901cda71fea59548ca9ffeb2fc988f54691d8583be52be5c85a4bc96f214ef0000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d56324c466263744d67644e55414336553631364b724d6a666e616f4a4d69537335394165783679354e6650362f00000000000000000000

-----Decoded View---------------
Arg [0] : uri (string): ipfs://QmV2LFbctMgdNUAC6U616KrMjfnaoJMiSs59Aex6y5NfP6/
Arg [1] : merkleroot (bytes32): 0xa7901cda71fea59548ca9ffeb2fc988f54691d8583be52be5c85a4bc96f214ef

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : a7901cda71fea59548ca9ffeb2fc988f54691d8583be52be5c85a4bc96f214ef
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000036
Arg [3] : 697066733a2f2f516d56324c466263744d67644e55414336553631364b724d6a
Arg [4] : 666e616f4a4d69537335394165783679354e6650362f00000000000000000000


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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.