ETH Price: $3,359.93 (-3.28%)

Contract

0xc5EB4744C2a2Fa8cC54DA31Beb0b6719126725b4
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NymUpgradeable

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 21 : NymUpgradeable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;

import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts-upgradeable/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

import '@uniswap/lib/contracts/libraries/TransferHelper.sol';

import "../lib/access/OwnableUpgradeable.sol";
import "../lib/util/MathUtil.sol";

/**
 * @title NYM
 * @dev Extends ERC721 Non-Fungible Token Standard basic implementation
 */
contract NymUpgradeable is OwnableUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using SafeMathUpgradeable for uint256;
    using StringsUpgradeable for uint256;

    uint256 private _currentTokenId;

    // Capacity of token
    uint256 private _cap;

    uint256 public totalSupply;

    // Price to mint a token
    uint256 public mintPrice;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSetUpgradeable.UintSet) private _holderTokens;

    // Mapping from token ID to owner address
    mapping (uint256 => address) private _tokenOwners;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Optional mapping for token URIs
    mapping (uint256 => string) private _tokenURIs;

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    uint256[] private _freeTokenIds;

    bool public locked;

    // Events
    event NewNym (address indexed to, uint256 indexed tokenId, uint256 mintPrice);
    event NewCapacity (uint256 indexed newCapacity);
    event NewMintPrice (uint256 indexed newMintPrice);
    event NewLocked (bool indexed newLocked);

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function initialize(
        address ownerAddress_,
        string memory baseURI_
    ) public initializer {
        require(ownerAddress_ != address(0), "Invalid owner");

        _name = "NEONPUNK";
        _symbol = "NEON";
        _cap = 300;
        mintPrice = 15e16; // 0.15 ETH
        locked = true;

        __Ownable_init(ownerAddress_);
        __ERC165_init();

        // register the supported interfaces to conform to ERC721 via ERC165Upgradeable
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);

        _baseURI = baseURI_;

        _mintInternal(0xab0B18523e8fe8CBF947C55632e8aB5Ce936ae8c);
        _mintInternal(0xab0B18523e8fe8CBF947C55632e8aB5Ce936ae8c);
        _mintInternal(0xab0B18523e8fe8CBF947C55632e8aB5Ce936ae8c);
        _mintInternal(0x9A72088c3D45Da0b874CF42eDF285B0600B36FCc);
        _mintInternal(0xab0B18523e8fe8CBF947C55632e8aB5Ce936ae8c);
        _mintInternal(0x9A72088c3D45Da0b874CF42eDF285B0600B36FCc);
        _mintInternal(0xab0B18523e8fe8CBF947C55632e8aB5Ce936ae8c);
        _mintInternal(0x32a51d0Ad4Ff0876E94858970688FE80B80EAD6e);
        _mintInternal(0x6BD58Fccf92631d168A4635814eF6a1d8B9aaba7);
        _mintInternal(0xda59E40c7BD1d961D4c54c0AD55Ac13C4927b73a);

        for (uint id = _currentTokenId+1; id <= _cap; id ++) {
            _freeTokenIds.push(id);
        }
    }

    /**
     * @dev Returns the cap on the token's total supply.
     */
    function capacity() external view returns (uint256) {
        return _cap;
    }

    /**
     * @dev Set the cap.
     */
    function setCapacity(uint256 cap) onlyOwner external {
        require(totalSupply <= cap, "capacity is less than the current supply");

        _cap = cap;
        emit NewCapacity(_cap);
    }

    /**
     * @dev Set the minting price.
     */
    function setMintPrice(uint256 price) onlyOwner external {
        mintPrice = price;
        emit NewMintPrice(mintPrice);
    }

    /**
     * @dev Set the 'locked' flag.
     */
    function setLocked(bool _locked) onlyOwner external {
        locked = _locked;
        emit NewLocked(locked);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address tokenOwner) public view override returns (uint256) {
        require(tokenOwner != address(0), "ERC721: balance query for the zero address");
        return _holderTokens[tokenOwner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address owner_) {
        owner_ = _tokenOwners[tokenId];
        require(owner_ != address(0) , "ERC721: owner query for nonexistent token");
    }

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

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

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

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(base, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view virtual returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address tokenOwner, uint256 index) public view returns (uint256) {
        return _holderTokens[tokenOwner].at(index);
    }

    /**
    * @dev Mints a NYM
    */
    function mint(uint256 qty) external payable {
        require(0 < qty, "Quantity is zero");
        require(totalSupply.add(qty) <= _cap, "Exceeds capacity");
        require(mintPrice.mul(qty) == msg.value, "Ether value sent is not correct");

        address sender = _msgSender();
        for (uint i = 0; i < qty; i ++) {
            _mintInternal(sender);
        }
    }

    function _mintInternal(address to) internal {
        uint256 tokenId;
        uint256 count = _freeTokenIds.length;
        if (0 < count) {
            uint index = MathUtil.random() % count;
            tokenId = _freeTokenIds[index];
            _freeTokenIds[index] = _freeTokenIds[count-1];
            _freeTokenIds.pop();
        } else {
            tokenId = ++ _currentTokenId;
        }
        _safeMint(to, tokenId, "");
        emit NewNym(to, tokenId, mintPrice);
    }

    /**
     * @dev Withdraw ether from this contract (Callable by owner)
    */
    function withdraw() onlyOwner external {
        uint balance = address(this).balance;
        TransferHelper.safeTransferETH(owner(), balance);
    }

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

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

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) external virtual override {
        _safeTransferFrom(from, to, tokenId, _data);
    }

    function _safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not token 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, _data), "ERC721: 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`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return (_tokenOwners[tokenId] != address(0));
    }

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

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _holderTokens[to].add(tokenId);

        _tokenOwners[tokenId] = to;
        totalSupply ++;

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

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

        _beforeTokenTransfer(tokenOwner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }

        _holderTokens[tokenOwner].remove(tokenId);

        _tokenOwners[tokenId] = address(0);
        totalSupply --;

        emit Transfer(tokenOwner, address(0), 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 {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");
        require(!locked, "No transfer allowed yet");

        _beforeTokenTransfer(from, to, tokenId);

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

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function setTokenURI(uint256 tokenId, string memory _tokenURI) onlyOwner external {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function setBaseURI(string memory baseURI_) onlyOwner external {
        _baseURI = baseURI_;
    }

    /**
     * @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 tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721ReceiverUpgradeable(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    function _approve(address to, uint256 tokenId) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }

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

    function freeCount() public view returns(uint256) {
        return _freeTokenIds.length;
    }
}

contract NymUpgradeableProxy is TransparentUpgradeableProxy {

    constructor(address logic, address admin, bytes memory data) TransparentUpgradeableProxy(logic, admin, data) public {
    }

}

File 2 of 21 : TransparentUpgradeableProxy.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./UpgradeableProxy.sol";

/**
 * @dev This contract implements a proxy that is upgradeable by an admin.
 *
 * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
 * clashing], which can potentially be used in an attack, this contract uses the
 * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
 * things that go hand in hand:
 *
 * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
 * that call matches one of the admin functions exposed by the proxy itself.
 * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
 * implementation. If the admin tries to call a function on the implementation it will fail with an error that says
 * "admin cannot fallback to proxy target".
 *
 * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
 * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
 * to sudden errors when trying to call a function from the proxy implementation.
 *
 * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
 * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
 */
contract TransparentUpgradeableProxy is UpgradeableProxy {
    /**
     * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
     * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
     */
    constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) {
        assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
        _setAdmin(admin_);
    }

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
     */
    modifier ifAdmin() {
        if (msg.sender == _admin()) {
            _;
        } else {
            _fallback();
        }
    }

    /**
     * @dev Returns the current admin.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function admin() external ifAdmin returns (address admin_) {
        admin_ = _admin();
    }

    /**
     * @dev Returns the current implementation.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
     */
    function implementation() external ifAdmin returns (address implementation_) {
        implementation_ = _implementation();
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
     */
    function changeAdmin(address newAdmin) external virtual ifAdmin {
        require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
        emit AdminChanged(_admin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev Upgrade the implementation of the proxy.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
     */
    function upgradeTo(address newImplementation) external virtual ifAdmin {
        _upgradeTo(newImplementation);
    }

    /**
     * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
     * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
     * proxied contract.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
     */
    function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
        _upgradeTo(newImplementation);
        Address.functionDelegateCall(newImplementation, data);
    }

    /**
     * @dev Returns the current admin.
     */
    function _admin() internal view virtual returns (address adm) {
        bytes32 slot = _ADMIN_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            adm := sload(slot)
        }
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        bytes32 slot = _ADMIN_SLOT;

        // solhint-disable-next-line no-inline-assembly
        assembly {
            sstore(slot, newAdmin)
        }
    }

    /**
     * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
     */
    function _beforeFallback() internal virtual override {
        require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
        super._beforeFallback();
    }
}

File 3 of 21 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC165Upgradeable.sol";
import "../proxy/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    function __ERC165_init() internal initializer {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal initializer {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
    uint256[49] private __gap;
}

File 4 of 21 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMathUpgradeable {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 5 of 21 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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 6 of 21 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "./IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {

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

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

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

File 7 of 21 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

File 8 of 21 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, 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);
}

File 9 of 21 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20Upgradeable.sol";
import "../../math/SafeMathUpgradeable.sol";
import "../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using SafeMathUpgradeable for uint256;
    using AddressUpgradeable for address;

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

    function safeTransferFrom(IERC20Upgradeable 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(IERC20Upgradeable 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'
        // solhint-disable-next-line max-line-length
        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(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _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(IERC20Upgradeable 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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 10 of 21 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 21 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 12 of 21 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    /**
     * @dev Converts a `uint256` to its ASCII `string` 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);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = bytes1(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}

File 13 of 21 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeApprove: approve failed'
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeTransfer: transfer failed'
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::transferFrom: transferFrom failed'
        );
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
    }
}

File 14 of 21 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;
    address private _pendingOwner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init(address _ownerAddress) internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained(_ownerAddress);
    }

    function __Ownable_init_unchained(address _ownerAddress) internal initializer {
        _owner = _ownerAddress;
        emit OwnershipTransferred(address(0), _ownerAddress);
    }

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

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

    /**
     * @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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function safeTransferOwnership(address newOwner, bool safely) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        if (safely) {
            _pendingOwner = newOwner;
        } else {
            emit OwnershipTransferred(_owner, newOwner);
            _owner = newOwner;
            _pendingOwner = address(0);
        }
    }

    function safeAcceptOwnership() public virtual {
        require(_msgSender() == _pendingOwner, "acceptOwnership: Call must come from pendingOwner.");
        emit OwnershipTransferred(_owner, _pendingOwner);
        _owner = _pendingOwner;
    }

    uint256[48] private __gap;
}

File 15 of 21 : MathUtil.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;

library MathUtil {

    // implementation from https://github.com/Uniswap/uniswap-lib/commit/99f3f28770640ba1bb1ff460ac7c5292fb8291a0
    // original implementation: https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
    function sqrt(uint256 x) internal pure returns (uint256) {
        if (x == 0) return 0;
        uint256 xx = x;
        uint256 r = 1;

        if (xx >= 0x100000000000000000000000000000000) {
            xx >>= 128;
            r <<= 64;
        }
        if (xx >= 0x10000000000000000) {
            xx >>= 64;
            r <<= 32;
        }
        if (xx >= 0x100000000) {
            xx >>= 32;
            r <<= 16;
        }
        if (xx >= 0x10000) {
            xx >>= 16;
            r <<= 8;
        }
        if (xx >= 0x100) {
            xx >>= 8;
            r <<= 4;
        }
        if (xx >= 0x10) {
            xx >>= 4;
            r <<= 2;
        }
        if (xx >= 0x8) {
            r <<= 1;
        }

        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1; // Seven iterations should be enough
        uint256 r1 = x / r;
        return (r < r1 ? r : r1);
    }

    function random() internal view returns (uint256) {
        return uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty)));
    }
}

File 16 of 21 : UpgradeableProxy.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
 * implementation behind the proxy.
 *
 * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
 * {TransparentUpgradeableProxy}.
 */
contract UpgradeableProxy is Proxy {
    /**
     * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
     *
     * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
     * function call, and allows initializating the storage of the proxy like a Solidity constructor.
     */
    constructor(address _logic, bytes memory _data) public payable {
        assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
        _setImplementation(_logic);
        if(_data.length > 0) {
            Address.functionDelegateCall(_logic, _data);
        }
    }

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Returns the current implementation address.
     */
    function _implementation() internal view virtual override returns (address impl) {
        bytes32 slot = _IMPLEMENTATION_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            impl := sload(slot)
        }
    }

    /**
     * @dev Upgrades the proxy to a new implementation.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal virtual {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");

        bytes32 slot = _IMPLEMENTATION_SLOT;

        // solhint-disable-next-line no-inline-assembly
        assembly {
            sstore(slot, newImplementation)
        }
    }
}

File 17 of 21 : Proxy.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }

    /**
     * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
     * and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _beforeFallback();
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback () external payable virtual {
        _fallback();
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
     * is empty.
     */
    receive () external payable virtual {
        _fallback();
    }

    /**
     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
     * call, or as part of the Solidity `fallback` or `receive` functions.
     *
     * If overriden should call `super._beforeFallback()`.
     */
    function _beforeFallback() internal virtual {
    }
}

File 18 of 21 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 19 of 21 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

File 20 of 21 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;

import "../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 21 of 21 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

/*
 * @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 GSN 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 ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
    uint256[50] private __gap;
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newCapacity","type":"uint256"}],"name":"NewCapacity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"newLocked","type":"bool"}],"name":"NewLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newMintPrice","type":"uint256"}],"name":"NewMintPrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintPrice","type":"uint256"}],"name":"NewNym","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":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"capacity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"ownerAddress_","type":"address"},{"internalType":"string","name":"baseURI_","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"qty","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"safeAcceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"bool","name":"safely","type":"bool"}],"name":"safeTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cap","type":"uint256"}],"name":"setCapacity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_locked","type":"bool"}],"name":"setLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","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":"address","name":"tokenOwner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","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":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061326e806100206000396000f3fe6080604052600436106101ee5760003560e01c80636817c76c1161010d578063a22cb465116100a0578063cf3090121161006f578063cf30901214610850578063e30c397814610865578063e985e9c51461087a578063f399e22e146108b5578063f4a0a52814610976576101ee565b8063a22cb46514610705578063a6f48c9014610740578063b88d4fde14610755578063c87b56dd14610826576101ee565b80638da5cb5b116100dc5780638da5cb5b1461069457806391915ef8146106a957806395d89b41146106d3578063a0712d68146106e8576101ee565b80636817c76c146106225780636c0360eb1461063757806370a082311461064c578063715018a61461067f576101ee565b80632f745c591161018557806355f804b31161015457806355f804b31461051d5780635a7f7ff5146105ce5780635cfc1a51146105e35780636352211e146105f8576101ee565b80632f745c59146104945780633ccfd60b146104cd57806342842e0e1461045157806353424674146104e2576101ee565b8063162094c4116101c1578063162094c41461034657806318160ddd146103fe578063211e28b61461042557806323b872dd14610451576101ee565b806301ffc9a7146101f357806306fdde031461023b578063081812fc146102c5578063095ea7b31461030b575b600080fd5b3480156101ff57600080fd5b506102276004803603602081101561021657600080fd5b50356001600160e01b0319166109a0565b604080519115158252519081900360200190f35b34801561024757600080fd5b506102506109c3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028a578181015183820152602001610272565b50505050905090810190601f1680156102b75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d157600080fd5b506102ef600480360360208110156102e857600080fd5b5035610a59565b604080516001600160a01b039092168252519081900360200190f35b34801561031757600080fd5b506103446004803603604081101561032e57600080fd5b506001600160a01b038135169060200135610abb565b005b34801561035257600080fd5b506103446004803603604081101561036957600080fd5b81359190810190604081016020820135600160201b81111561038a57600080fd5b82018360208201111561039c57600080fd5b803590602001918460018302840111600160201b831117156103bd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610b96945050505050565b34801561040a57600080fd5b50610413610c5b565b60408051918252519081900360200190f35b34801561043157600080fd5b506103446004803603602081101561044857600080fd5b50351515610c61565b34801561045d57600080fd5b506103446004803603606081101561047457600080fd5b506001600160a01b03813581169160208101359091169060400135610d07565b3480156104a057600080fd5b50610413600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610d22565b3480156104d957600080fd5b50610344610d4d565b3480156104ee57600080fd5b506103446004803603604081101561050557600080fd5b506001600160a01b0381351690602001351515610dc4565b34801561052957600080fd5b506103446004803603602081101561054057600080fd5b810190602081018135600160201b81111561055a57600080fd5b82018360208201111561056c57600080fd5b803590602001918460018302840111600160201b8311171561058d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ee5945050505050565b3480156105da57600080fd5b50610344610f5a565b3480156105ef57600080fd5b50610413611004565b34801561060457600080fd5b506102ef6004803603602081101561061b57600080fd5b503561100a565b34801561062e57600080fd5b5061041361105e565b34801561064357600080fd5b50610250611064565b34801561065857600080fd5b506104136004803603602081101561066f57600080fd5b50356001600160a01b03166110c5565b34801561068b57600080fd5b5061034461112d565b3480156106a057600080fd5b506102ef6111c7565b3480156106b557600080fd5b50610344600480360360208110156106cc57600080fd5b50356111d6565b3480156106df57600080fd5b506102506112ac565b610344600480360360208110156106fe57600080fd5b503561130d565b34801561071157600080fd5b506103446004803603604081101561072857600080fd5b506001600160a01b0381351690602001351515611434565b34801561074c57600080fd5b50610413611539565b34801561076157600080fd5b506103446004803603608081101561077857600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b8111156107b257600080fd5b8201836020820111156107c457600080fd5b803590602001918460018302840111600160201b831117156107e557600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061153f945050505050565b34801561083257600080fd5b506102506004803603602081101561084957600080fd5b5035611551565b34801561085c57600080fd5b506102276117d2565b34801561087157600080fd5b506102ef6117db565b34801561088657600080fd5b506102276004803603604081101561089d57600080fd5b506001600160a01b03813581169160200135166117ea565b3480156108c157600080fd5b50610344600480360360408110156108d857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561090257600080fd5b82018360208201111561091457600080fd5b803590602001918460018302840111600160201b8311171561093557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611818945050505050565b34801561098257600080fd5b506103446004803603602081101561099957600080fd5b5035611b35565b6001600160e01b0319811660009081526065602052604090205460ff165b919050565b609f8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b820191906000526020600020905b815481529060010190602001808311610a3257829003601f168201915b5050505050905090565b6000610a6482611bca565b610a9f5760405162461bcd60e51b815260040180806020018281038252602c8152602001806130fa602c913960400191505060405180910390fd5b506000908152609d60205260409020546001600160a01b031690565b6000610ac68261100a565b9050806001600160a01b0316836001600160a01b03161415610b195760405162461bcd60e51b81526004018080602001828103825260278152602001806132126027913960400191505060405180910390fd5b806001600160a01b0316610b2b611be7565b6001600160a01b03161480610b4c5750610b4c81610b47611be7565b6117ea565b610b875760405162461bcd60e51b815260040180806020018281038252603e81526020018061309b603e913960400191505060405180910390fd5b610b918383611beb565b505050565b610b9e611be7565b6001600160a01b0316610baf6111c7565b6001600160a01b031614610bf8576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b610c0182611bca565b610c3c5760405162461bcd60e51b815260040180806020018281038252602c815260200180613126602c913960400191505060405180910390fd5b600082815260a1602090815260409091208251610b9192840190612deb565b60995481565b610c69611be7565b6001600160a01b0316610c7a6111c7565b6001600160a01b031614610cc3576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b60a4805460ff1916821515179081905560405160ff9091161515907fbf546b1f4b01db479c1ab1c934fda681edf19b1c9714bab92cecbe6c9e6131c490600090a250565b610b9183838360405180602001604052806000815250611c59565b6001600160a01b0382166000908152609b60205260408120610d449083611cb1565b90505b92915050565b610d55611be7565b6001600160a01b0316610d666111c7565b6001600160a01b031614610daf576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b47610dc1610dbb6111c7565b82611cbd565b50565b610dcc611be7565b6001600160a01b0316610ddd6111c7565b6001600160a01b031614610e26576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b6001600160a01b038216610e6b5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ee16026913960400191505060405180910390fd5b8015610e9157603480546001600160a01b0319166001600160a01b038416179055610ee1565b6033546040516001600160a01b0380851692169060008051602061317283398151915290600090a3603380546001600160a01b0384166001600160a01b0319918216179091556034805490911690555b5050565b610eed611be7565b6001600160a01b0316610efe6111c7565b6001600160a01b031614610f47576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b8051610ee19060a2906020840190612deb565b6034546001600160a01b0316610f6e611be7565b6001600160a01b031614610fb35760405162461bcd60e51b8152600401808060200182810382526032815260200180612fe86032913960400191505060405180910390fd5b6034546033546040516001600160a01b03928316929091169060008051602061317283398151915290600090a3603454603380546001600160a01b0319166001600160a01b03909216919091179055565b60985490565b6000818152609c60205260409020546001600160a01b0316806109be5760405162461bcd60e51b81526004018080602001828103825260298152602001806130446029913960400191505060405180910390fd5b609a5481565b60a28054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b60006001600160a01b03821661110c5760405162461bcd60e51b815260040180806020018281038252602a81526020018061301a602a913960400191505060405180910390fd5b6001600160a01b0382166000908152609b60205260409020610d4790611db0565b611135611be7565b6001600160a01b03166111466111c7565b6001600160a01b03161461118f576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020613172833981519152908390a3603380546001600160a01b0319169055565b6033546001600160a01b031690565b6111de611be7565b6001600160a01b03166111ef6111c7565b6001600160a01b031614611238576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b8060995411156112795760405162461bcd60e51b81526004018080602001828103825260288152602001806131ea6028913960400191505060405180910390fd5b609881905560405181907f92f46b86ad6ad404db85ac48b3566a2151b24b2821b63e03e04ee344c9b168f190600090a250565b60a08054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b80600010611355576040805162461bcd60e51b815260206004820152601060248201526f5175616e74697479206973207a65726f60801b604482015290519081900360640190fd5b6098546099546113659083611dbb565b11156113ab576040805162461bcd60e51b815260206004820152601060248201526f4578636565647320636170616369747960801b604482015290519081900360640190fd5b609a5434906113ba9083611e15565b1461140c576040805162461bcd60e51b815260206004820152601f60248201527f45746865722076616c75652073656e74206973206e6f7420636f727265637400604482015290519081900360640190fd5b6000611416611be7565b905060005b82811015610b915761142c82611e6e565b60010161141b565b61143c611be7565b6001600160a01b0316826001600160a01b031614156114a2576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b80609e60006114af611be7565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556114f3611be7565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b60a35490565b61154b84848484611c59565b50505050565b606061155c82611bca565b6115975760405162461bcd60e51b815260040180806020018281038252602f8152602001806131bb602f913960400191505060405180910390fd5b600082815260a1602090815260408083208054825160026001831615610100026000190190921691909104601f81018590048502820185019093528281529290919083018282801561162a5780601f106115ff5761010080835404028352916020019161162a565b820191906000526020600020905b81548152906001019060200180831161160d57829003601f168201915b50505050509050600061163b611064565b905080516000141561164f575090506109be565b8151156117105780826040516020018083805190602001908083835b6020831061168a5780518252601f19909201916020918201910161166b565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106116d25780518252601f1990920191602091820191016116b3565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052925050506109be565b8061171a85611f73565b6040516020018083805190602001908083835b6020831061174c5780518252601f19909201916020918201910161172d565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106117945780518252601f199092019160209182019101611775565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b60a45460ff1681565b6034546001600160a01b031690565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b600054610100900460ff1680611831575061183161204e565b8061183f575060005460ff16155b61187a5760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff161580156118a5576000805460ff1961ff0019909116610100171660011790555b6001600160a01b0383166118f0576040805162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b604482015290519081900360640190fd5b604080518082019091526008808252674e454f4e50554e4b60c01b602090920191825261191f91609f91612deb565b50604080518082019091526004808252632722a7a760e11b602090920191825261194b9160a091612deb565b5061012c609855670214e8348c4f0000609a5560a4805460ff191660011790556119748361205f565b61197c612112565b61198c6380ac58cd60e01b6121bb565b61199c635b5e139f60e01b6121bb565b81516119af9060a2906020850190612deb565b506119cd73ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b6119ea73ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a0773ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a24739a72088c3d45da0b874cf42edf285b0600b36fcc611e6e565b611a4173ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a5e739a72088c3d45da0b874cf42edf285b0600b36fcc611e6e565b611a7b73ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a987332a51d0ad4ff0876e94858970688fe80b80ead6e611e6e565b611ab5736bd58fccf92631d168a4635814ef6a1d8b9aaba7611e6e565b611ad273da59e40c7bd1d961d4c54c0ad55ac13c4927b73a611e6e565b6097546001015b6098548111611b1e5760a38054600181810183556000929092527f60859188cffe297f44dde29f2d2865634621f26215049caeb304ccba566a8b170182905501611ad9565b508015610b91576000805461ff0019169055505050565b611b3d611be7565b6001600160a01b0316611b4e6111c7565b6001600160a01b031614611b97576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b609a81905560405181907f87e91c4015c3b3877a81d4e5876627cdee8f55f6a28b8452d1db91caf03eeceb90600090a250565b6000908152609c60205260409020546001600160a01b0316151590565b3390565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611c208261100a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611c6a611c64611be7565b8361223f565b611ca55760405162461bcd60e51b8152600401808060200182810382526037815260200180612f5f6037913960400191505060405180910390fd5b61154b848484846122e3565b6000610d448383612335565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b60208310611d095780518252601f199092019160209182019101611cea565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611d6b576040519150601f19603f3d011682016040523d82523d6000602084013e611d70565b606091505b5050905080610b915760405162461bcd60e51b8152600401808060200182810382526034815260200180612f076034913960400191505060405180910390fd5b6000610d4782612399565b600082820183811015610d44576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082611e2457506000610d47565b82820282848281611e3157fe5b0414610d445760405162461bcd60e51b81526004018080602001828103825260218152602001806130d96021913960400191505060405180910390fd5b60a3546000908015611f0457600081611e8561239d565b81611e8c57fe5b06905060a38181548110611e9c57fe5b9060005260206000200154925060a36001830381548110611eb957fe5b906000526020600020015460a38281548110611ed157fe5b60009182526020909120015560a3805480611ee857fe5b6001900381819060005260206000200160009055905550611f12565b609780546001019081905591505b611f2c8383604051806020016040528060008152506123c9565b609a54604080519182525183916001600160a01b038616917fa9793482a9a1357059b6605434e11c9ca81302dd27dff9f49ce6f39cb44310b49181900360200190a3505050565b606081611f9857506040805180820190915260018152600360fc1b60208201526109be565b8160005b8115611fb057600101600a82049150611f9c565b60008167ffffffffffffffff81118015611fc957600080fd5b506040519080825280601f01601f191660200182016040528015611ff4576020820181803683370190505b50859350905060001982015b831561204557600a840660300160f81b8282806001900393508151811061202357fe5b60200101906001600160f81b031916908160001a905350600a84049350612000565b50949350505050565b60006120593061241b565b15905090565b600054610100900460ff1680612078575061207861204e565b80612086575060005460ff16155b6120c15760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff161580156120ec576000805460ff1961ff0019909116610100171660011790555b6120f4612421565b6120fd826124c1565b8015610ee1576000805461ff00191690555050565b600054610100900460ff168061212b575061212b61204e565b80612139575060005460ff16155b6121745760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff1615801561219f576000805460ff1961ff0019909116610100171660011790555b6121a761259a565b8015610dc1576000805461ff001916905550565b6001600160e01b0319808216141561221a576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152606560205260409020805460ff19166001179055565b600061224a82611bca565b6122855760405162461bcd60e51b815260040180806020018281038252602c815260200180612fbc602c913960400191505060405180910390fd5b60006122908361100a565b9050806001600160a01b0316846001600160a01b031614806122cb5750836001600160a01b03166122c084610a59565b6001600160a01b0316145b806122db57506122db81856117ea565b949350505050565b6122ee848484612637565b6122fa848484846127e4565b61154b5760405162461bcd60e51b8152600401808060200182810382526032815260200180612eaf6032913960400191505060405180910390fd5b815460009082106123775760405162461bcd60e51b8152600401808060200182810382526022815260200180612e8d6022913960400191505060405180910390fd5b82600001828154811061238657fe5b9060005260206000200154905092915050565b5490565b604080514260208083019190915244828401528251808303840181526060909201909252805191012090565b6123d3838361294c565b6123e060008484846127e4565b610b915760405162461bcd60e51b8152600401808060200182810382526032815260200180612eaf6032913960400191505060405180910390fd5b3b151590565b600054610100900460ff168061243a575061243a61204e565b80612448575060005460ff16155b6124835760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff161580156121a7576000805460ff1961ff0019909116610100171660011790558015610dc1576000805461ff001916905550565b600054610100900460ff16806124da57506124da61204e565b806124e8575060005460ff16155b6125235760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff1615801561254e576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b038416908117909155604051600090600080516020613172833981519152908290a38015610ee1576000805461ff00191690555050565b600054610100900460ff16806125b357506125b361204e565b806125c1575060005460ff16155b6125fc5760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff16158015612627576000805460ff1961ff0019909116610100171660011790555b6121a76301ffc9a760e01b6121bb565b826001600160a01b031661264a8261100a565b6001600160a01b03161461268f5760405162461bcd60e51b81526004018080602001828103825260298152602001806131926029913960400191505060405180910390fd5b6001600160a01b0382166126d45760405162461bcd60e51b8152600401808060200182810382526024815260200180612f3b6024913960400191505060405180910390fd5b60a45460ff161561272c576040805162461bcd60e51b815260206004820152601760248201527f4e6f207472616e7366657220616c6c6f77656420796574000000000000000000604482015290519081900360640190fd5b612737838383610b91565b612742600082611beb565b6001600160a01b0383166000908152609b602052604090206127649082612a93565b506001600160a01b0382166000908152609b602052604090206127879082612a9f565b506000818152609c602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006127f8846001600160a01b031661241b565b612804575060016122db565b6000612912630a85bd0160e11b612819611be7565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612880578181015183820152602001612868565b50505050905090810190601f1680156128ad5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001612eaf603291396001600160a01b0388169190612aab565b9050600081806020019051602081101561292b57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6001600160a01b0382166129a7576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6129b081611bca565b15612a02576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b612a0e60008383610b91565b6001600160a01b0382166000908152609b60205260409020612a309082612a9f565b506000818152609c602052604080822080546001600160a01b0319166001600160a01b03861690811790915560998054600101905590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000610d448383612ac4565b6000610d448383612b8a565b6060612aba8484600085612bd4565b90505b9392505050565b60008181526001830160205260408120548015612b805783546000198083019190810190600090879083908110612af757fe5b9060005260206000200154905080876000018481548110612b1457fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080612b4457fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610d47565b6000915050610d47565b6000612b968383612d2f565b612bcc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d47565b506000610d47565b606082471015612c155760405162461bcd60e51b8152600401808060200182810382526026815260200180612f966026913960400191505060405180910390fd5b612c1e8561241b565b612c6f576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612cad5780518252601f199092019160209182019101612c8e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612d0f576040519150601f19603f3d011682016040523d82523d6000602084013e612d14565b606091505b5091509150612d24828286612d47565b979650505050505050565b60009081526001919091016020526040902054151590565b60608315612d56575081612abd565b825115612d665782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612db0578181015183820152602001612d98565b50505050905090810190601f168015612ddd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612e215760008555612e67565b82601f10612e3a57805160ff1916838001178555612e67565b82800160010185558215612e67579182015b82811115612e67578251825591602001919060010190612e4c565b50612e73929150612e77565b5090565b5b80821115612e735760008155600101612e7856fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735472616e7366657248656c7065723a3a736166655472616e736665724554483a20455448207472616e73666572206661696c65644552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a207472616e736665722063616c6c6572206973206e6f7420746f6b656e206f776e6572206e6f7220617070726f766564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e6163636570744f776e6572736869703a2043616c6c206d75737420636f6d652066726f6d2070656e64696e674f776e65722e4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65644552433732313a20617070726f76652063616c6c6572206973206e6f7420746f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e6361706163697479206973206c657373207468616e207468652063757272656e7420737570706c794552433732313a20617070726f76616c20746f2063757272656e7420746f6b656e206f776e6572a2646970667358221220b094f1bcf0879835dfd02f12b718a27b55f450d655cdaaff0d695b3f55dac4ed64736f6c63430007060033

Deployed Bytecode

0x6080604052600436106101ee5760003560e01c80636817c76c1161010d578063a22cb465116100a0578063cf3090121161006f578063cf30901214610850578063e30c397814610865578063e985e9c51461087a578063f399e22e146108b5578063f4a0a52814610976576101ee565b8063a22cb46514610705578063a6f48c9014610740578063b88d4fde14610755578063c87b56dd14610826576101ee565b80638da5cb5b116100dc5780638da5cb5b1461069457806391915ef8146106a957806395d89b41146106d3578063a0712d68146106e8576101ee565b80636817c76c146106225780636c0360eb1461063757806370a082311461064c578063715018a61461067f576101ee565b80632f745c591161018557806355f804b31161015457806355f804b31461051d5780635a7f7ff5146105ce5780635cfc1a51146105e35780636352211e146105f8576101ee565b80632f745c59146104945780633ccfd60b146104cd57806342842e0e1461045157806353424674146104e2576101ee565b8063162094c4116101c1578063162094c41461034657806318160ddd146103fe578063211e28b61461042557806323b872dd14610451576101ee565b806301ffc9a7146101f357806306fdde031461023b578063081812fc146102c5578063095ea7b31461030b575b600080fd5b3480156101ff57600080fd5b506102276004803603602081101561021657600080fd5b50356001600160e01b0319166109a0565b604080519115158252519081900360200190f35b34801561024757600080fd5b506102506109c3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028a578181015183820152602001610272565b50505050905090810190601f1680156102b75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d157600080fd5b506102ef600480360360208110156102e857600080fd5b5035610a59565b604080516001600160a01b039092168252519081900360200190f35b34801561031757600080fd5b506103446004803603604081101561032e57600080fd5b506001600160a01b038135169060200135610abb565b005b34801561035257600080fd5b506103446004803603604081101561036957600080fd5b81359190810190604081016020820135600160201b81111561038a57600080fd5b82018360208201111561039c57600080fd5b803590602001918460018302840111600160201b831117156103bd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610b96945050505050565b34801561040a57600080fd5b50610413610c5b565b60408051918252519081900360200190f35b34801561043157600080fd5b506103446004803603602081101561044857600080fd5b50351515610c61565b34801561045d57600080fd5b506103446004803603606081101561047457600080fd5b506001600160a01b03813581169160208101359091169060400135610d07565b3480156104a057600080fd5b50610413600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610d22565b3480156104d957600080fd5b50610344610d4d565b3480156104ee57600080fd5b506103446004803603604081101561050557600080fd5b506001600160a01b0381351690602001351515610dc4565b34801561052957600080fd5b506103446004803603602081101561054057600080fd5b810190602081018135600160201b81111561055a57600080fd5b82018360208201111561056c57600080fd5b803590602001918460018302840111600160201b8311171561058d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ee5945050505050565b3480156105da57600080fd5b50610344610f5a565b3480156105ef57600080fd5b50610413611004565b34801561060457600080fd5b506102ef6004803603602081101561061b57600080fd5b503561100a565b34801561062e57600080fd5b5061041361105e565b34801561064357600080fd5b50610250611064565b34801561065857600080fd5b506104136004803603602081101561066f57600080fd5b50356001600160a01b03166110c5565b34801561068b57600080fd5b5061034461112d565b3480156106a057600080fd5b506102ef6111c7565b3480156106b557600080fd5b50610344600480360360208110156106cc57600080fd5b50356111d6565b3480156106df57600080fd5b506102506112ac565b610344600480360360208110156106fe57600080fd5b503561130d565b34801561071157600080fd5b506103446004803603604081101561072857600080fd5b506001600160a01b0381351690602001351515611434565b34801561074c57600080fd5b50610413611539565b34801561076157600080fd5b506103446004803603608081101561077857600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b8111156107b257600080fd5b8201836020820111156107c457600080fd5b803590602001918460018302840111600160201b831117156107e557600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061153f945050505050565b34801561083257600080fd5b506102506004803603602081101561084957600080fd5b5035611551565b34801561085c57600080fd5b506102276117d2565b34801561087157600080fd5b506102ef6117db565b34801561088657600080fd5b506102276004803603604081101561089d57600080fd5b506001600160a01b03813581169160200135166117ea565b3480156108c157600080fd5b50610344600480360360408110156108d857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561090257600080fd5b82018360208201111561091457600080fd5b803590602001918460018302840111600160201b8311171561093557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611818945050505050565b34801561098257600080fd5b506103446004803603602081101561099957600080fd5b5035611b35565b6001600160e01b0319811660009081526065602052604090205460ff165b919050565b609f8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b820191906000526020600020905b815481529060010190602001808311610a3257829003601f168201915b5050505050905090565b6000610a6482611bca565b610a9f5760405162461bcd60e51b815260040180806020018281038252602c8152602001806130fa602c913960400191505060405180910390fd5b506000908152609d60205260409020546001600160a01b031690565b6000610ac68261100a565b9050806001600160a01b0316836001600160a01b03161415610b195760405162461bcd60e51b81526004018080602001828103825260278152602001806132126027913960400191505060405180910390fd5b806001600160a01b0316610b2b611be7565b6001600160a01b03161480610b4c5750610b4c81610b47611be7565b6117ea565b610b875760405162461bcd60e51b815260040180806020018281038252603e81526020018061309b603e913960400191505060405180910390fd5b610b918383611beb565b505050565b610b9e611be7565b6001600160a01b0316610baf6111c7565b6001600160a01b031614610bf8576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b610c0182611bca565b610c3c5760405162461bcd60e51b815260040180806020018281038252602c815260200180613126602c913960400191505060405180910390fd5b600082815260a1602090815260409091208251610b9192840190612deb565b60995481565b610c69611be7565b6001600160a01b0316610c7a6111c7565b6001600160a01b031614610cc3576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b60a4805460ff1916821515179081905560405160ff9091161515907fbf546b1f4b01db479c1ab1c934fda681edf19b1c9714bab92cecbe6c9e6131c490600090a250565b610b9183838360405180602001604052806000815250611c59565b6001600160a01b0382166000908152609b60205260408120610d449083611cb1565b90505b92915050565b610d55611be7565b6001600160a01b0316610d666111c7565b6001600160a01b031614610daf576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b47610dc1610dbb6111c7565b82611cbd565b50565b610dcc611be7565b6001600160a01b0316610ddd6111c7565b6001600160a01b031614610e26576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b6001600160a01b038216610e6b5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ee16026913960400191505060405180910390fd5b8015610e9157603480546001600160a01b0319166001600160a01b038416179055610ee1565b6033546040516001600160a01b0380851692169060008051602061317283398151915290600090a3603380546001600160a01b0384166001600160a01b0319918216179091556034805490911690555b5050565b610eed611be7565b6001600160a01b0316610efe6111c7565b6001600160a01b031614610f47576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b8051610ee19060a2906020840190612deb565b6034546001600160a01b0316610f6e611be7565b6001600160a01b031614610fb35760405162461bcd60e51b8152600401808060200182810382526032815260200180612fe86032913960400191505060405180910390fd5b6034546033546040516001600160a01b03928316929091169060008051602061317283398151915290600090a3603454603380546001600160a01b0319166001600160a01b03909216919091179055565b60985490565b6000818152609c60205260409020546001600160a01b0316806109be5760405162461bcd60e51b81526004018080602001828103825260298152602001806130446029913960400191505060405180910390fd5b609a5481565b60a28054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b60006001600160a01b03821661110c5760405162461bcd60e51b815260040180806020018281038252602a81526020018061301a602a913960400191505060405180910390fd5b6001600160a01b0382166000908152609b60205260409020610d4790611db0565b611135611be7565b6001600160a01b03166111466111c7565b6001600160a01b03161461118f576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020613172833981519152908390a3603380546001600160a01b0319169055565b6033546001600160a01b031690565b6111de611be7565b6001600160a01b03166111ef6111c7565b6001600160a01b031614611238576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b8060995411156112795760405162461bcd60e51b81526004018080602001828103825260288152602001806131ea6028913960400191505060405180910390fd5b609881905560405181907f92f46b86ad6ad404db85ac48b3566a2151b24b2821b63e03e04ee344c9b168f190600090a250565b60a08054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a4f5780601f10610a2457610100808354040283529160200191610a4f565b80600010611355576040805162461bcd60e51b815260206004820152601060248201526f5175616e74697479206973207a65726f60801b604482015290519081900360640190fd5b6098546099546113659083611dbb565b11156113ab576040805162461bcd60e51b815260206004820152601060248201526f4578636565647320636170616369747960801b604482015290519081900360640190fd5b609a5434906113ba9083611e15565b1461140c576040805162461bcd60e51b815260206004820152601f60248201527f45746865722076616c75652073656e74206973206e6f7420636f727265637400604482015290519081900360640190fd5b6000611416611be7565b905060005b82811015610b915761142c82611e6e565b60010161141b565b61143c611be7565b6001600160a01b0316826001600160a01b031614156114a2576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b80609e60006114af611be7565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556114f3611be7565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b60a35490565b61154b84848484611c59565b50505050565b606061155c82611bca565b6115975760405162461bcd60e51b815260040180806020018281038252602f8152602001806131bb602f913960400191505060405180910390fd5b600082815260a1602090815260408083208054825160026001831615610100026000190190921691909104601f81018590048502820185019093528281529290919083018282801561162a5780601f106115ff5761010080835404028352916020019161162a565b820191906000526020600020905b81548152906001019060200180831161160d57829003601f168201915b50505050509050600061163b611064565b905080516000141561164f575090506109be565b8151156117105780826040516020018083805190602001908083835b6020831061168a5780518252601f19909201916020918201910161166b565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106116d25780518252601f1990920191602091820191016116b3565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052925050506109be565b8061171a85611f73565b6040516020018083805190602001908083835b6020831061174c5780518252601f19909201916020918201910161172d565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106117945780518252601f199092019160209182019101611775565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b60a45460ff1681565b6034546001600160a01b031690565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b600054610100900460ff1680611831575061183161204e565b8061183f575060005460ff16155b61187a5760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff161580156118a5576000805460ff1961ff0019909116610100171660011790555b6001600160a01b0383166118f0576040805162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b604482015290519081900360640190fd5b604080518082019091526008808252674e454f4e50554e4b60c01b602090920191825261191f91609f91612deb565b50604080518082019091526004808252632722a7a760e11b602090920191825261194b9160a091612deb565b5061012c609855670214e8348c4f0000609a5560a4805460ff191660011790556119748361205f565b61197c612112565b61198c6380ac58cd60e01b6121bb565b61199c635b5e139f60e01b6121bb565b81516119af9060a2906020850190612deb565b506119cd73ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b6119ea73ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a0773ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a24739a72088c3d45da0b874cf42edf285b0600b36fcc611e6e565b611a4173ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a5e739a72088c3d45da0b874cf42edf285b0600b36fcc611e6e565b611a7b73ab0b18523e8fe8cbf947c55632e8ab5ce936ae8c611e6e565b611a987332a51d0ad4ff0876e94858970688fe80b80ead6e611e6e565b611ab5736bd58fccf92631d168a4635814ef6a1d8b9aaba7611e6e565b611ad273da59e40c7bd1d961d4c54c0ad55ac13c4927b73a611e6e565b6097546001015b6098548111611b1e5760a38054600181810183556000929092527f60859188cffe297f44dde29f2d2865634621f26215049caeb304ccba566a8b170182905501611ad9565b508015610b91576000805461ff0019169055505050565b611b3d611be7565b6001600160a01b0316611b4e6111c7565b6001600160a01b031614611b97576040805162461bcd60e51b81526020600482018190526024820152600080516020613152833981519152604482015290519081900360640190fd5b609a81905560405181907f87e91c4015c3b3877a81d4e5876627cdee8f55f6a28b8452d1db91caf03eeceb90600090a250565b6000908152609c60205260409020546001600160a01b0316151590565b3390565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611c208261100a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611c6a611c64611be7565b8361223f565b611ca55760405162461bcd60e51b8152600401808060200182810382526037815260200180612f5f6037913960400191505060405180910390fd5b61154b848484846122e3565b6000610d448383612335565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b60208310611d095780518252601f199092019160209182019101611cea565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611d6b576040519150601f19603f3d011682016040523d82523d6000602084013e611d70565b606091505b5050905080610b915760405162461bcd60e51b8152600401808060200182810382526034815260200180612f076034913960400191505060405180910390fd5b6000610d4782612399565b600082820183811015610d44576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082611e2457506000610d47565b82820282848281611e3157fe5b0414610d445760405162461bcd60e51b81526004018080602001828103825260218152602001806130d96021913960400191505060405180910390fd5b60a3546000908015611f0457600081611e8561239d565b81611e8c57fe5b06905060a38181548110611e9c57fe5b9060005260206000200154925060a36001830381548110611eb957fe5b906000526020600020015460a38281548110611ed157fe5b60009182526020909120015560a3805480611ee857fe5b6001900381819060005260206000200160009055905550611f12565b609780546001019081905591505b611f2c8383604051806020016040528060008152506123c9565b609a54604080519182525183916001600160a01b038616917fa9793482a9a1357059b6605434e11c9ca81302dd27dff9f49ce6f39cb44310b49181900360200190a3505050565b606081611f9857506040805180820190915260018152600360fc1b60208201526109be565b8160005b8115611fb057600101600a82049150611f9c565b60008167ffffffffffffffff81118015611fc957600080fd5b506040519080825280601f01601f191660200182016040528015611ff4576020820181803683370190505b50859350905060001982015b831561204557600a840660300160f81b8282806001900393508151811061202357fe5b60200101906001600160f81b031916908160001a905350600a84049350612000565b50949350505050565b60006120593061241b565b15905090565b600054610100900460ff1680612078575061207861204e565b80612086575060005460ff16155b6120c15760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff161580156120ec576000805460ff1961ff0019909116610100171660011790555b6120f4612421565b6120fd826124c1565b8015610ee1576000805461ff00191690555050565b600054610100900460ff168061212b575061212b61204e565b80612139575060005460ff16155b6121745760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff1615801561219f576000805460ff1961ff0019909116610100171660011790555b6121a761259a565b8015610dc1576000805461ff001916905550565b6001600160e01b0319808216141561221a576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152606560205260409020805460ff19166001179055565b600061224a82611bca565b6122855760405162461bcd60e51b815260040180806020018281038252602c815260200180612fbc602c913960400191505060405180910390fd5b60006122908361100a565b9050806001600160a01b0316846001600160a01b031614806122cb5750836001600160a01b03166122c084610a59565b6001600160a01b0316145b806122db57506122db81856117ea565b949350505050565b6122ee848484612637565b6122fa848484846127e4565b61154b5760405162461bcd60e51b8152600401808060200182810382526032815260200180612eaf6032913960400191505060405180910390fd5b815460009082106123775760405162461bcd60e51b8152600401808060200182810382526022815260200180612e8d6022913960400191505060405180910390fd5b82600001828154811061238657fe5b9060005260206000200154905092915050565b5490565b604080514260208083019190915244828401528251808303840181526060909201909252805191012090565b6123d3838361294c565b6123e060008484846127e4565b610b915760405162461bcd60e51b8152600401808060200182810382526032815260200180612eaf6032913960400191505060405180910390fd5b3b151590565b600054610100900460ff168061243a575061243a61204e565b80612448575060005460ff16155b6124835760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff161580156121a7576000805460ff1961ff0019909116610100171660011790558015610dc1576000805461ff001916905550565b600054610100900460ff16806124da57506124da61204e565b806124e8575060005460ff16155b6125235760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff1615801561254e576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b038416908117909155604051600090600080516020613172833981519152908290a38015610ee1576000805461ff00191690555050565b600054610100900460ff16806125b357506125b361204e565b806125c1575060005460ff16155b6125fc5760405162461bcd60e51b815260040180806020018281038252602e81526020018061306d602e913960400191505060405180910390fd5b600054610100900460ff16158015612627576000805460ff1961ff0019909116610100171660011790555b6121a76301ffc9a760e01b6121bb565b826001600160a01b031661264a8261100a565b6001600160a01b03161461268f5760405162461bcd60e51b81526004018080602001828103825260298152602001806131926029913960400191505060405180910390fd5b6001600160a01b0382166126d45760405162461bcd60e51b8152600401808060200182810382526024815260200180612f3b6024913960400191505060405180910390fd5b60a45460ff161561272c576040805162461bcd60e51b815260206004820152601760248201527f4e6f207472616e7366657220616c6c6f77656420796574000000000000000000604482015290519081900360640190fd5b612737838383610b91565b612742600082611beb565b6001600160a01b0383166000908152609b602052604090206127649082612a93565b506001600160a01b0382166000908152609b602052604090206127879082612a9f565b506000818152609c602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006127f8846001600160a01b031661241b565b612804575060016122db565b6000612912630a85bd0160e11b612819611be7565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612880578181015183820152602001612868565b50505050905090810190601f1680156128ad5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001612eaf603291396001600160a01b0388169190612aab565b9050600081806020019051602081101561292b57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6001600160a01b0382166129a7576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6129b081611bca565b15612a02576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b612a0e60008383610b91565b6001600160a01b0382166000908152609b60205260409020612a309082612a9f565b506000818152609c602052604080822080546001600160a01b0319166001600160a01b03861690811790915560998054600101905590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000610d448383612ac4565b6000610d448383612b8a565b6060612aba8484600085612bd4565b90505b9392505050565b60008181526001830160205260408120548015612b805783546000198083019190810190600090879083908110612af757fe5b9060005260206000200154905080876000018481548110612b1457fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080612b4457fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610d47565b6000915050610d47565b6000612b968383612d2f565b612bcc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d47565b506000610d47565b606082471015612c155760405162461bcd60e51b8152600401808060200182810382526026815260200180612f966026913960400191505060405180910390fd5b612c1e8561241b565b612c6f576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612cad5780518252601f199092019160209182019101612c8e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612d0f576040519150601f19603f3d011682016040523d82523d6000602084013e612d14565b606091505b5091509150612d24828286612d47565b979650505050505050565b60009081526001919091016020526040902054151590565b60608315612d56575081612abd565b825115612d665782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612db0578181015183820152602001612d98565b50505050905090810190601f168015612ddd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612e215760008555612e67565b82601f10612e3a57805160ff1916838001178555612e67565b82800160010185558215612e67579182015b82811115612e67578251825591602001919060010190612e4c565b50612e73929150612e77565b5090565b5b80821115612e735760008155600101612e7856fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735472616e7366657248656c7065723a3a736166655472616e736665724554483a20455448207472616e73666572206661696c65644552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a207472616e736665722063616c6c6572206973206e6f7420746f6b656e206f776e6572206e6f7220617070726f766564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e6163636570744f776e6572736869703a2043616c6c206d75737420636f6d652066726f6d2070656e64696e674f776e65722e4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65644552433732313a20617070726f76652063616c6c6572206973206e6f7420746f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e6361706163697479206973206c657373207468616e207468652063757272656e7420737570706c794552433732313a20617070726f76616c20746f2063757272656e7420746f6b656e206f776e6572a2646970667358221220b094f1bcf0879835dfd02f12b718a27b55f450d655cdaaff0d695b3f55dac4ed64736f6c63430007060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

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

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.