Token Realm

 

Overview

TokenID:
2587

Transfers:
-

Loading
[ Download CSV Export  ] 
Loading
Loading

Click here to update the token ICO / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Realm

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 14 : Realm.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

interface IConnector {
  function ownerOf(uint256 tokenId) external view returns (address owner);
}

contract Realm is ERC721Enumerable, ReentrancyGuard, Ownable {
  bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

  uint256 private constant REALM_SIZE = 10**6 * 3;
  uint256 private constant DEFAULT_WEALTH = 1000;
  uint256 private constant ACTION_HOURS = 12 hours;

  uint256 public price = 10000000000000000;
  uint256 public partnerPrice = 5000000000000000;
  uint256 public supply = 10000;

  uint256[35] private PROBABILITY = [
    2,
    3,
    5,
    7,
    11,
    13,
    17,
    19,
    23,
    25,
    29,
    31,
    37,
    39,
    41,
    43,
    47,
    51,
    53,
    57,
    59,
    61,
    65,
    67,
    71,
    75,
    77,
    79,
    83,
    85,
    89,
    92,
    94,
    96,
    100
  ];

  string[35] public features = [
    "Pond",
    "Valley",
    "Gulf",
    "Basin",
    "Butte",
    "Canal",
    "Cape",
    "Prairie",
    "Plateau",
    "Mesa",
    "Peninsula",
    "River",
    "Sea",
    "Cove",
    "Lake",
    "Swamp",
    "Tundra",
    "Bay",
    "Ice shelf",
    "Dune",
    "Fjord",
    "Geyser",
    "Glacier",
    "Ocean",
    "Desert",
    "Biosphere",
    "Lagoon",
    "Mountain",
    "Island",
    "Canyon",
    "Cave",
    "Oasis",
    "Waterfall",
    "Reef",
    "Volcano"
  ];

  struct realm {
    string name;
    uint256 size;
    uint256 createdAt;
    bool partner;
  }

  struct Connector {
    address _contract;
    uint256 start;
    uint256 end;
    bool exists;
  }

  mapping(uint256 => realm) public realms;
  mapping(uint256 => uint256) public wealth;
  mapping(uint256 => uint256) public explorer;
  mapping(uint256 => uint256) public explorerTime;
  mapping(uint256 => uint256) public terraformTime;
  mapping(address => Connector) public connectors;
  mapping(uint256 => mapping(uint256 => uint256)) public realmFeatures;

  event RealmCreated(string name, uint256 size, bool partner, string feature1, string feature2, string feature3);
  event Explored(uint256 realmId, uint256 explored, uint256 wealthGained, uint256 totalExplored, uint256 totalWealth);
  event Terraform(uint256 realmId, string feature1, string feature2, string feature3);
  event ConnectorCreated(address _contract, uint256 start, uint256 end);
  event ConnectorRemoved(address _contract);
  event WealthSpent(uint256 realmId, uint256 WealthSpent, uint256 totalWealth);

  constructor() ERC721("Realm", "REALM") Ownable() {}

  function explore(uint256 _realmId) external {
    require(_isApprovedOrOwner(msg.sender, _realmId));
    require(block.timestamp > explorerTime[_realmId], "You are currently exploring");
    require(explorer[_realmId] < realms[_realmId].size, "You've explored the whole map");

    uint256 _wealthGained = _random(wealth[_realmId], DEFAULT_WEALTH) + DEFAULT_WEALTH;

    explorer[_realmId] += _wealthGained;
    wealth[_realmId] += _wealthGained;

    // You can explore every hour 12 hours
    explorerTime[_realmId] = block.timestamp + ACTION_HOURS;

    emit Explored(_realmId, _wealthGained, _wealthGained, explorer[_realmId], wealth[_realmId]);
  }

  function spendWealth(uint256 _realmId, uint256 _wealth) external {
    require(_wealth <= wealth[_realmId], "Not enough wealth");
    require(_isApprovedOrOwner(msg.sender, _realmId));

    wealth[_realmId] -= _wealth;

    emit WealthSpent(_realmId, _wealth, wealth[_realmId]);
  }

  function terraform(uint256 _realmId, uint256 _feature) external {
    require(_isApprovedOrOwner(msg.sender, _realmId));
    require(_feature <= 2, "Feature must be 0 to 2");
    require(block.timestamp > terraformTime[_realmId], "Allowed once a year");

    uint256 _newFeatureId = _random(realms[_realmId].size, features.length);

    // Update feature
    realmFeatures[_realmId][_feature] = _newFeatureId;

    // Allowed once a year
    terraformTime[_realmId] = block.timestamp + 365 days;

    emit Terraform(
      _realmId,
      features[realmFeatures[_realmId][0]],
      features[realmFeatures[_realmId][1]],
      features[realmFeatures[_realmId][2]]
    );
  }

  function claim(uint256 _realmId, string memory _name) external payable nonReentrant {
    require(msg.value >= price, "Eth sent is not enough");
    require(_realmId > 5 && _realmId <= supply, "_realmId invalid");
    require(!_exists(_realmId), "_realmId invalid");

    _createRealm(_realmId, _name, false);
    _safeMint(_msgSender(), _realmId);
  }

  function claimAsPartner(
    address _contract,
    uint256 _partnerId,
    uint256 _realmId,
    string memory _name
  ) external payable nonReentrant {
    require(connectors[_contract].exists, "Contract not allowed");
    require(msg.value >= partnerPrice, "Eth sent is not enough");
    require(_realmId > connectors[_contract].start && _realmId < connectors[_contract].end, "_realmId not in range");
    require(!_exists(_realmId), "_realmId doesn't exist");

    IConnector connector = IConnector(_contract);

    require(connector.ownerOf(_partnerId) == msg.sender, "You do not own the _partnerId");

    _createRealm(_realmId, _name, true);
    _safeMint(_msgSender(), _realmId);
  }

  function ownerClaim(uint256 _realmId, string memory _name) external nonReentrant onlyOwner {
    require(_realmId <= 5, "_realmId invalid");
    require(!_exists(_realmId), "_realmId invalid");

    _createRealm(_realmId, _name, false);
    _safeMint(owner(), _realmId);
  }

  function setPrice(uint256 _newPrice, uint256 _type) external onlyOwner {
    if (_type == 0) {
      price = _newPrice;
    } else {
      partnerPrice = _newPrice;
    }
  }

  function setSupply(uint256 _supply) external onlyOwner {
    supply = _supply;
  }

  function setConnector(
    address _contract,
    uint256 _start,
    uint256 _end
  ) external onlyOwner {
    connectors[_contract]._contract = _contract;
    connectors[_contract].start = _start;
    connectors[_contract].end = _end;
    connectors[_contract].exists = true;

    emit ConnectorCreated(_contract, _start, _end);
  }

  function removeConnector(address _contract) external onlyOwner {
    delete connectors[_contract];

    emit ConnectorRemoved(_contract);
  }

  function getRealm(uint256 _realmId)
    external
    view
    returns (
      string memory,
      uint256,
      uint256,
      bool
    )
  {
    return (realms[_realmId].name, realms[_realmId].size, realms[_realmId].createdAt, realms[_realmId].partner);
  }

  function hasConnector(address _contract) external view returns (bool) {
    return connectors[_contract].exists;
  }

  function ownerWithdraw() external onlyOwner {
    payable(owner()).transfer(address(this).balance);
  }

  function tokenURI(uint256 _realmId) public view override returns (string memory) {
    string[5] memory _parts;

    _parts[
      0
    ] = '<?xml version="1.0" encoding="UTF-8"?><svg width="350px" height="350px" viewBox="0 0 350 350" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect fill="#ffb300" x="0" y="0" width="350" height="350"></rect><text x="50%" y="40%" dominant-baseline="middle" text-anchor="middle" fill-opacity="50%" font-size="65px" fill="#fff" font-family="Georgia">Realm</text><text x="50%" y="62%" fill-opacity="100%" fill="#fff" dominant-baseline="middle" text-anchor="middle" font-size="24px" font-family="Georgia">';
    _parts[1] = realms[_realmId].name;
    _parts[
      2
    ] = '</text><text x="50%" y="69%" fill-opacity="100%" fill="#fff" dominant-baseline="middle" text-anchor="middle" font-size="12px" font-family="Georgia">';
    _parts[3] = _featureNames(_realmId);
    _parts[
      4
    ] = '</text><line class="line" stroke-width="5" x1="125" x2="137" y1="185" y2="185"></line> <line class="line" stroke-width="5" x1="147" x2="148" y1="185" y2="185"></line> <line class="line" stroke-width="5" x1="158" x2="170" y1="185" y2="185"></line> <line class="line" stroke-width="5" x1="180" x2="181" y1="185" y2="185"></line> <line class="line" stroke-width="5" x1="191" x2="192" y1="185" y2="185"></line> <line class="line" stroke-width="5" x1="202" x2="214" y1="185" y2="185"></line> <line class="line" stroke-width="5" x1="224" x2="225" y1="185" y2="185"></line><style type="text/css">.line{stroke:white;stroke-linecap:round;opacity:50%}</style></svg>';

    string memory _output = string(abi.encodePacked(_parts[0], _parts[1], _parts[2], _parts[3], _parts[4]));

    string memory _atrrOutput = _makeAttributeParts(_realmId);
    string memory _json = _encode(
      bytes(
        string(
          abi.encodePacked(
            '{"name": "Realm #',
            _toString(_realmId),
            '", "description": "Discover your Realm. Explore. Mine. Research. Build.", "image": "data:image/svg+xml;base64,',
            _encode(bytes(_output)),
            '"',
            ',"attributes":',
            _atrrOutput,
            "}"
          )
        )
      )
    );
    _output = string(abi.encodePacked("data:application/json;base64,", _json));

    return _output;
  }

  function _createRealm(
    uint256 _realmId,
    string memory _name,
    bool _partner
  ) internal {
    realms[_realmId].name = _name;
    realms[_realmId].size = _randomFromString(_name, REALM_SIZE) + REALM_SIZE;
    realms[_realmId].createdAt = block.timestamp;
    realms[_realmId].partner = _partner;

    realmFeatures[_realmId][0] = _randomFromString(realms[_realmId].name, features.length);
    realmFeatures[_realmId][1] = _random(realms[_realmId].size, features.length);
    realmFeatures[_realmId][2] = _random(realms[_realmId].createdAt, features.length);

    emit RealmCreated(
      realms[_realmId].name,
      realms[_realmId].size,
      _partner,
      features[realmFeatures[_realmId][0]],
      features[realmFeatures[_realmId][1]],
      features[realmFeatures[_realmId][2]]
    );
  }

  function _random(uint256 _salt, uint256 _limit) internal view returns (uint256) {
    return uint256(keccak256(abi.encodePacked(block.number, block.timestamp, _salt))) % _limit;
  }

  function _randomFromString(string memory _salt, uint256 _limit) internal view returns (uint256) {
    return uint256(keccak256(abi.encodePacked(block.number, block.timestamp, _salt))) % _limit;
  }

  function _rarity(uint256 _salt, uint256 _limit) internal view returns (uint256) {
    uint256 _rand = _randomFromString(string(abi.encodePacked(_salt)), _limit);

    uint256 j = 0;
    for (; j < PROBABILITY.length; j++) {
      if (_rand <= PROBABILITY[j]) {
        break;
      }
    }
    return j;
  }

  function _makeAttributeParts(uint256 _realmId) internal view returns (string memory) {
    string[9] memory _parts;

    _parts[0] = '[{ "trait_type": "Realm", "value": "';
    _parts[1] = realms[_realmId].name;
    _parts[2] = '" }, { "trait_type": "Geographical Feature 1", "value": "';
    _parts[3] = features[realmFeatures[_realmId][0]];
    _parts[4] = '" }, { "trait_type": "Geographical Feature 2", "value": "';
    _parts[5] = features[realmFeatures[_realmId][1]];
    _parts[6] = '" }, { "trait_type": "Geographical Feature 3", "value": "';
    _parts[7] = features[realmFeatures[_realmId][2]];
    _parts[8] = '" }]';

    string memory _output = string(abi.encodePacked(_parts[0], _parts[1], _parts[2], _parts[3], _parts[4]));
    _output = string(abi.encodePacked(_output, _parts[5], _parts[6], _parts[7], _parts[8]));

    return _output;
  }

  function _featureNames(uint256 _realmId) internal view returns (string memory) {
    return
      string(
        abi.encodePacked(
          features[realmFeatures[_realmId][0]],
          " | ",
          features[realmFeatures[_realmId][1]],
          " | ",
          features[realmFeatures[_realmId][2]]
        )
      );
  }

  function _toString(uint256 value) internal pure returns (string memory) {
    // Inspired by OraclizeAPI's implementation - MIT license
    // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

  function _encode(bytes memory data) internal pure returns (string memory) {
    uint256 len = data.length;
    if (len == 0) return "";

    // multiply by 4/3 rounded up
    uint256 encodedLen = 4 * ((len + 2) / 3);

    // Add some extra buffer at the end
    bytes memory result = new bytes(encodedLen + 32);

    bytes memory table = TABLE;

    assembly {
      let tablePtr := add(table, 1)
      let resultPtr := add(result, 32)

      for {
        let i := 0
      } lt(i, len) {

      } {
        i := add(i, 3)
        let input := and(mload(add(data, i)), 0xffffff)

        let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
        out := shl(8, out)
        out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
        out := shl(8, out)
        out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
        out := shl(8, out)
        out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
        out := shl(224, out)

        mstore(resultPtr, out)

        resultPtr := add(resultPtr, 4)
      }

      switch mod(len, 3)
      case 1 {
        mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
      }
      case 2 {
        mstore(sub(resultPtr, 1), shl(248, 0x3d))
      }

      mstore(result, encodedLen)
    }

    return string(result);
  }
}

File 2 of 14 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "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 owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

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

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _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 virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

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

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `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);

        _balances[to] += 1;
        _owners[tokenId] = to;

        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 owner = ERC721.ownerOf(tokenId);

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

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

        _balances[owner] -= 1;
        delete _owners[tokenId];

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

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

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

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param 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()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @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` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 3 of 14 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

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

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @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 override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 4 of 14 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 14 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 6 of 14 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 14 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 8 of 14 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 9 of 14 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^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;
        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");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 14 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 11 of 14 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 12 of 14 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 13 of 14 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 14 of 14 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_contract","type":"address"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"}],"name":"ConnectorCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_contract","type":"address"}],"name":"ConnectorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"realmId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"explored","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"wealthGained","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalExplored","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWealth","type":"uint256"}],"name":"Explored","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"size","type":"uint256"},{"indexed":false,"internalType":"bool","name":"partner","type":"bool"},{"indexed":false,"internalType":"string","name":"feature1","type":"string"},{"indexed":false,"internalType":"string","name":"feature2","type":"string"},{"indexed":false,"internalType":"string","name":"feature3","type":"string"}],"name":"RealmCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"realmId","type":"uint256"},{"indexed":false,"internalType":"string","name":"feature1","type":"string"},{"indexed":false,"internalType":"string","name":"feature2","type":"string"},{"indexed":false,"internalType":"string","name":"feature3","type":"string"}],"name":"Terraform","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"realmId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"WealthSpent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWealth","type":"uint256"}],"name":"WealthSpent","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":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_partnerId","type":"uint256"},{"internalType":"uint256","name":"_realmId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"}],"name":"claimAsPartner","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"connectors","outputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"}],"name":"explore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"explorer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"explorerTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"features","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"}],"name":"getRealm","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"hasConnector","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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":"_realmId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"}],"name":"ownerClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"partnerPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"realmFeatures","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"realms","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"bool","name":"partner","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"removeConnector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"setConnector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newPrice","type":"uint256"},{"internalType":"uint256","name":"_type","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"name":"setSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"},{"internalType":"uint256","name":"_wealth","type":"uint256"}],"name":"spendWealth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"},{"internalType":"uint256","name":"_feature","type":"uint256"}],"name":"terraform","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"terraformTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"wealth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

662386f26fc10000600c556611c37937e08000600d908155612710600e556104e060405260026080908152600360a052600560c052600760e052600b610100526101209190915260116101405260136101605260176101805260196101a052601d6101c052601f6101e052602561020052602761022052602961024052602b61026052602f6102805260336102a05260356102c05260396102e052603b61030052603d61032052604161034052604361036052604761038052604b6103a052604d6103c052604f6103e052605361040052605561042052605961044052605c61046052605e6104805260606104a05260646104c0526200010490600f90602362000634565b50604080516104a0810182526004610460820181815263141bdb9960e21b61048084015282528251808401845260068082526556616c6c657960d01b60208381019190915280850192909252845180860186528381526323bab63360e11b8184015284860152845180860186526005808252642130b9b4b760d91b8285015260608601919091528551808701875281815264427574746560d81b818501526080860152855180870187528181526410d85b985b60da1b8185015260a086015285518087018752848152634361706560e01b8185015260c0860152855180870187526007808252665072616972696560c81b8286015260e08701919091528651808801885281815266506c617465617560c81b8186015261010087015286518088018852858152634d65736160e01b818601526101208701528651808801885260098082526850656e696e73756c6160b81b8287015261014088019190915287518089018952838152642934bb32b960d91b818701526101608801528751808901895260038082526253656160e81b828801526101808901919091528851808a018a5287815263436f766560e01b818801526101a08901528851808a018a52878152634c616b6560e01b818801526101c08901528851808a018a528481526405377616d760dc1b818801526101e08901528851808a018a528581526554756e64726160d01b818801526102008901528851808a018a529081526242617960e81b81870152610220880152875180890189528181526824b1b29039b432b63360b91b81870152610240880152875180890189528681526344756e6560e01b818701526102608801528751808901895283815264119a9bdc9960da1b81870152610280880152875180890189528481526523b2bcb9b2b960d11b818701526102a0880152875180890189528281526623b630b1b4b2b960c91b818701526102c0880152875180890189528381526427b1b2b0b760d91b818701526102e0880152875180890189528481526511195cd95c9d60d21b81870152610300880152875180890189528181526842696f73706865726560b81b8187015261032088015287518089018952848152652630b3b7b7b760d11b8187015261034088015287518089018952600881526726b7bab73a30b4b760c11b818701526103608801528751808901895284815265125cdb185b9960d21b81870152610380880152875180890189529384526521b0b73cb7b760d11b848601526103a087019390935286518088018852858152634361766560e01b818601526103c087015286518088018852918252644f6173697360d81b828501526103e0860191909152855180870187529182526815d85d195c99985b1b60ba1b8284015261040085019190915284518086018652928352632932b2b360e11b83830152610420840192909252835180850190945290835266566f6c63616e6f60c81b90830152610440810191909152620005509060329060236200067c565b503480156200055e57600080fd5b50604051806040016040528060058152602001645265616c6d60d81b815250604051806040016040528060058152602001645245414c4d60d81b8152508160009080519060200190620005b3929190620006cf565b508051620005c9906001906020840190620006cf565b50506001600a5550620005dc33620005e2565b62000803565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82602381019282156200066a579160200282015b828111156200066a578251829060ff1690559160200191906001019062000648565b50620006789291506200074c565b5090565b8260238101928215620006c1579160200282015b82811115620006c15782518051620006b0918491602090910190620006cf565b509160200191906001019062000690565b506200067892915062000763565b828054620006dd90620007c6565b90600052602060002090601f0160209004810192826200070157600085556200066a565b82601f106200071c57805160ff19168380011785556200066a565b828001600101855582156200066a579182015b828111156200066a5782518255916020019190600101906200072f565b5b808211156200067857600081556001016200074d565b80821115620006785760006200077a828262000784565b5060010162000763565b5080546200079290620007c6565b6000825580601f10620007a3575050565b601f016020900490600052602060002090810190620007c391906200074c565b50565b600181811c90821680620007db57607f821691505b60208210811415620007fd57634e487b7160e01b600052602260045260246000fd5b50919050565b61445180620008136000396000f3fe60806040526004361061025c5760003560e01c80636352211e11610144578063a1945e28116100b6578063c8d523d71161007a578063c8d523d7146107ad578063e77232c3146107c0578063e985e9c5146107ed578063f2fde38b14610836578063f7d9757714610856578063fe302d5e1461087657600080fd5b8063a1945e2814610700578063a22cb46514610720578063b88d4fde14610740578063bd3f9c4d14610760578063c87b56dd1461078d57600080fd5b806375c389651161010857806375c389651461062e578063829efdc11461066a5780638da5cb5b146106975780638ede6f9f146106b557806395d89b41146106d5578063a035b1fe146106ea57600080fd5b80636352211e146105995780636457e389146105b95780636632812c146105d957806370a08231146105f9578063715018a61461061957600080fd5b806324f86241116101dd57806342842e0e116101a157806342842e0e146104d65780634311de8f146104f657806346bfeda31461050b578063492e20a11461052b5780634c0a04bb146105415780634f6ccce71461057957600080fd5b806324f8624114610433578063268b15ed146104535780632f745c5914610466578063301194d6146104865780633b4c4b25146104b657600080fd5b80630e53aae9116102245780630e53aae91461033657806318160ddd146103b15780631a6c6a98146103c65780631efb596e146103e657806323b872dd1461041357600080fd5b806301ffc9a714610261578063047fc9aa1461029657806306fdde03146102ba578063081812fc146102dc578063095ea7b314610314575b600080fd5b34801561026d57600080fd5b5061028161027c3660046135fd565b610896565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102ac600e5481565b60405190815260200161028d565b3480156102c657600080fd5b506102cf6108c1565b60405161028d9190613a35565b3480156102e857600080fd5b506102fc6102f7366004613635565b610953565b6040516001600160a01b03909116815260200161028d565b34801561032057600080fd5b5061033461032f366004613549565b6109e0565b005b34801561034257600080fd5b506103856103513660046133eb565b605a6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909160ff1684565b604080516001600160a01b0390951685526020850193909352918301521515606082015260800161028d565b3480156103bd57600080fd5b506008546102ac565b3480156103d257600080fd5b506103346103e13660046133eb565b610af6565b3480156103f257600080fd5b506102ac610401366004613635565b60586020526000908152604090205481565b34801561041f57600080fd5b5061033461042e36600461345b565b610b98565b34801561043f57600080fd5b5061033461044e366004613692565b610bc9565b61033461046136600461364d565b610ca8565b34801561047257600080fd5b506102ac610481366004613549565b610d8f565b34801561049257600080fd5b506104a66104a1366004613635565b610e25565b60405161028d9493929190613a48565b3480156104c257600080fd5b506103346104d1366004613635565b610eda565b3480156104e257600080fd5b506103346104f136600461345b565b610f09565b34801561050257600080fd5b50610334610f24565b34801561051757600080fd5b506104a6610526366004613635565b610f8a565b34801561053757600080fd5b506102ac600d5481565b34801561054d57600080fd5b506102ac61055c366004613692565b605b60209081526000928352604080842090915290825290205481565b34801561058557600080fd5b506102ac610594366004613635565b611055565b3480156105a557600080fd5b506102fc6105b4366004613635565b6110f6565b3480156105c557600080fd5b506103346105d4366004613635565b61116d565b3480156105e557600080fd5b506103346105f436600461364d565b61133a565b34801561060557600080fd5b506102ac6106143660046133eb565b6113f4565b34801561062557600080fd5b5061033461147b565b34801561063a57600080fd5b506102816106493660046133eb565b6001600160a01b03166000908152605a602052604090206003015460ff1690565b34801561067657600080fd5b506102ac610685366004613635565b60576020526000908152604090205481565b3480156106a357600080fd5b50600b546001600160a01b03166102fc565b3480156106c157600080fd5b506102cf6106d0366004613635565b6114b1565b3480156106e157600080fd5b506102cf611551565b3480156106f657600080fd5b506102ac600c5481565b34801561070c57600080fd5b5061033461071b366004613574565b611560565b34801561072c57600080fd5b5061033461073b366004613518565b611617565b34801561074c57600080fd5b5061033461075b36600461349b565b6116dc565b34801561076c57600080fd5b506102ac61077b366004613635565b60596020526000908152604090205481565b34801561079957600080fd5b506102cf6107a8366004613635565b611714565b6103346107bb3660046135a8565b6118fa565b3480156107cc57600080fd5b506102ac6107db366004613635565b60566020526000908152604090205481565b3480156107f957600080fd5b50610281610808366004613423565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561084257600080fd5b506103346108513660046133eb565b611b9a565b34801561086257600080fd5b50610334610871366004613692565b611c32565b34801561088257600080fd5b50610334610891366004613692565b611c71565b60006001600160e01b0319821663780e9d6360e01b14806108bb57506108bb82611e61565b92915050565b6060600080546108d090613cf2565b80601f01602080910402602001604051908101604052809291908181526020018280546108fc90613cf2565b80156109495780601f1061091e57610100808354040283529160200191610949565b820191906000526020600020905b81548152906001019060200180831161092c57829003601f168201915b5050505050905090565b600061095e82611eb1565b6109c45760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006109eb826110f6565b9050806001600160a01b0316836001600160a01b03161415610a595760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016109bb565b336001600160a01b0382161480610a755750610a758133610808565b610ae75760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016109bb565b610af18383611ece565b505050565b600b546001600160a01b03163314610b205760405162461bcd60e51b81526004016109bb90613b33565b6001600160a01b0381166000818152605a6020908152604080832080546001600160a01b03191681556001810184905560028101939093556003909201805460ff1916905590519182527f6825b26a0827e9c2ceca01d6289ce4a40e629dc074ec48ea4727d1afbff359f5910160405180910390a150565b610ba23382611f3c565b610bbe5760405162461bcd60e51b81526004016109bb90613b68565b610af1838383612026565b600082815260566020526040902054811115610c1b5760405162461bcd60e51b815260206004820152601160248201527009cdee840cadcdeeaced040eecac2d8e8d607b1b60448201526064016109bb565b610c253383611f3c565b610c2e57600080fd5b60008281526056602052604081208054839290610c4c908490613caf565b9091555050600082815260566020908152604091829020548251858152918201849052918101919091527f0eb3862beba1e19553864dc7509d70eee603c0471048d26350e7ebb6652a5473906060015b60405180910390a15050565b6002600a541415610ccb5760405162461bcd60e51b81526004016109bb90613be3565b6002600a55600c54341015610d1b5760405162461bcd60e51b815260206004820152601660248201527508ae8d040e6cadce840d2e640dcdee840cadcdeeaced60531b60448201526064016109bb565b600582118015610d2d5750600e548211155b610d495760405162461bcd60e51b81526004016109bb90613bb9565b610d5282611eb1565b15610d6f5760405162461bcd60e51b81526004016109bb90613bb9565b610d7b828260006121d1565b610d86335b83612446565b50506001600a55565b6000610d9a836113f4565b8210610dfc5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016109bb565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b605560205260009081526040902080548190610e4090613cf2565b80601f0160208091040260200160405190810160405280929190818152602001828054610e6c90613cf2565b8015610eb95780601f10610e8e57610100808354040283529160200191610eb9565b820191906000526020600020905b815481529060010190602001808311610e9c57829003601f168201915b50505050600183015460028401546003909401549293909290915060ff1684565b600b546001600160a01b03163314610f045760405162461bcd60e51b81526004016109bb90613b33565b600e55565b610af1838383604051806020016040528060008152506116dc565b600b546001600160a01b03163314610f4e5760405162461bcd60e51b81526004016109bb90613b33565b600b546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610f87573d6000803e3d6000fd5b50565b6000818152605560205260408120600181015460028201546003830154835460609594859485949193909260ff909116908490610fc690613cf2565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff290613cf2565b801561103f5780601f106110145761010080835404028352916020019161103f565b820191906000526020600020905b81548152906001019060200180831161102257829003601f168201915b5050505050935093509350935093509193509193565b600061106060085490565b82106110c35760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016109bb565b600882815481106110e457634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806108bb5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016109bb565b6111773382611f3c565b61118057600080fd5b60008181526058602052604090205442116111dd5760405162461bcd60e51b815260206004820152601b60248201527f596f75206172652063757272656e746c79206578706c6f72696e67000000000060448201526064016109bb565b600081815260556020908152604080832060010154605790925290912054106112485760405162461bcd60e51b815260206004820152601d60248201527f596f75277665206578706c6f726564207468652077686f6c65206d617000000060448201526064016109bb565b6000818152605660205260408120546103e8906112659082612460565b61126f9190613c64565b9050806057600084815260200190815260200160002060008282546112949190613c64565b9091555050600082815260566020526040812080548392906112b7908490613c64565b909155506112c9905061a8c042613c64565b60008381526058602090815260408083209390935560578152828220546056825291839020548351868152918201859052928101849052606081019190915260808101919091527fd39fb64997b876f8b84ecdd5463c0fce4fe97dfba3a592416925f2f5fff079d09060a001610c9c565b6002600a54141561135d5760405162461bcd60e51b81526004016109bb90613be3565b6002600a55600b546001600160a01b0316331461138c5760405162461bcd60e51b81526004016109bb90613b33565b60058211156113ad5760405162461bcd60e51b81526004016109bb90613bb9565b6113b682611eb1565b156113d35760405162461bcd60e51b81526004016109bb90613bb9565b6113df828260006121d1565b610d86610d80600b546001600160a01b031690565b60006001600160a01b03821661145f5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016109bb565b506001600160a01b031660009081526003602052604090205490565b600b546001600160a01b031633146114a55760405162461bcd60e51b81526004016109bb90613b33565b6114af60006124ac565b565b603281602381106114c157600080fd5b0180549091506114d090613cf2565b80601f01602080910402602001604051908101604052809291908181526020018280546114fc90613cf2565b80156115495780601f1061151e57610100808354040283529160200191611549565b820191906000526020600020905b81548152906001019060200180831161152c57829003601f168201915b505050505081565b6060600180546108d090613cf2565b600b546001600160a01b0316331461158a5760405162461bcd60e51b81526004016109bb90613b33565b6001600160a01b0383166000818152605a602090815260409182902080546001600160a01b031916841781556001808201879055600282018690556003909101805460ff191690911790558151928352820184905281018290527faa6968d291905a4e7f9e4b877663f1131072a9e83f052a26d5ee3bd5c15393bc906060015b60405180910390a1505050565b6001600160a01b0382163314156116705760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109bb565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6116e63383611f3c565b6117025760405162461bcd60e51b81526004016109bb90613b68565b61170e848484846124fe565b50505050565b606061171e61327b565b60405180610240016040528061022081526020016141fc610220913981526000838152605560205260409020805461175590613cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461178190613cf2565b80156117ce5780601f106117a3576101008083540402835291602001916117ce565b820191906000526020600020905b8154815290600101906020018083116117b157829003601f168201915b5050505050816001600581106117f457634e487b7160e01b600052603260045260246000fd5b60200201819052506040518060c0016040528060948152602001613e0360949139604082015261182383612531565b6060820152604080516102c0810190915261028f808252613f6d60208301396080820181905281516020808401516040808601516060870151915160009661187196959293929091016137c5565b6040516020818303038152906040529050600061188d85612616565b905060006118cd61189d87612ae4565b6118a685612bfe565b846040516020016118b99392919061386f565b604051602081830303815290604052612bfe565b9050806040516020016118e09190613990565b60408051601f198184030181529190529695505050505050565b6002600a54141561191d5760405162461bcd60e51b81526004016109bb90613be3565b6002600a556001600160a01b0384166000908152605a602052604090206003015460ff166119845760405162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081b9bdd08185b1b1bddd95960621b60448201526064016109bb565b600d543410156119cf5760405162461bcd60e51b815260206004820152601660248201527508ae8d040e6cadce840d2e640dcdee840cadcdeeaced60531b60448201526064016109bb565b6001600160a01b0384166000908152605a602052604090206001015482118015611a1357506001600160a01b0384166000908152605a602052604090206002015482105b611a575760405162461bcd60e51b81526020600482015260156024820152745f7265616c6d4964206e6f7420696e2072616e676560581b60448201526064016109bb565b611a6082611eb1565b15611aa65760405162461bcd60e51b815260206004820152601660248201527517dc99585b1b525908191bd95cdb89dd08195e1a5cdd60521b60448201526064016109bb565b6040516331a9108f60e11b815260048101849052849033906001600160a01b03831690636352211e9060240160206040518083038186803b158015611aea57600080fd5b505afa158015611afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b229190613407565b6001600160a01b031614611b785760405162461bcd60e51b815260206004820152601d60248201527f596f7520646f206e6f74206f776e20746865205f706172746e6572496400000060448201526064016109bb565b611b84838360016121d1565b611b8e3384612446565b50506001600a55505050565b600b546001600160a01b03163314611bc45760405162461bcd60e51b81526004016109bb90613b33565b6001600160a01b038116611c295760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109bb565b610f87816124ac565b600b546001600160a01b03163314611c5c5760405162461bcd60e51b81526004016109bb90613b33565b80611c675750600c55565b600d8290555b5050565b611c7b3383611f3c565b611c8457600080fd5b6002811115611cce5760405162461bcd60e51b81526020600482015260166024820152752332b0ba3ab9329036bab9ba1031329018103a37901960511b60448201526064016109bb565b6000828152605960205260409020544211611d215760405162461bcd60e51b815260206004820152601360248201527220b63637bbb2b21037b731b29030903cb2b0b960691b60448201526064016109bb565b600082815260556020526040812060010154611d3e906023612460565b6000848152605b6020908152604080832086845290915290208190559050611d6a426301e13380613c64565b600084815260596020908152604080832093909355605b8152828220828052905220547f73828ceb5dd22f186ba11ed61206b452dccbe576504b9a1079e5cbedecfa84cb90849060329060238110611dd257634e487b7160e01b600052603260045260246000fd5b6000878152605b602090815260408083206001845290915290205491019060329060238110611e1157634e487b7160e01b600052603260045260246000fd5b6000888152605b602090815260408083206002845290915290205491019060329060238110611e5057634e487b7160e01b600052603260045260246000fd5b0160405161160a9493929190613c1a565b60006001600160e01b031982166380ac58cd60e01b1480611e9257506001600160e01b03198216635b5e139f60e01b145b806108bb57506301ffc9a760e01b6001600160e01b03198316146108bb565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f03826110f6565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611f4782611eb1565b611fa85760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016109bb565b6000611fb3836110f6565b9050806001600160a01b0316846001600160a01b03161480611fee5750836001600160a01b0316611fe384610953565b6001600160a01b0316145b8061201e57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316612039826110f6565b6001600160a01b0316146120a15760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016109bb565b6001600160a01b0382166121035760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109bb565b61210e838383612d72565b612119600082611ece565b6001600160a01b0383166000908152600360205260408120805460019290612142908490613caf565b90915550506001600160a01b0382166000908152600360205260408120805460019290612170908490613c64565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600083815260556020908152604090912083516121f0928501906132a2565b50622dc6c061220283622dc6c0612e2a565b61220c9190613c64565b6000848152605560205260409020600181019190915542600282015560038101805460ff191683151517905580546122cd919061224890613cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461227490613cf2565b80156122c15780601f10612296576101008083540402835291602001916122c1565b820191906000526020600020905b8154815290600101906020018083116122a457829003601f168201915b50505050506023612e2a565b6000848152605b60209081526040808320838052825280832093909355858252605590522060010154612301906023612460565b6000848152605b6020908152604080832060018452825280832093909355858252605590522060020154612336906023612460565b6000848152605b60209081526040808320600284528083528184209490945586835260558252808320600181015484805294909252909120547f389691e7c907394c40879475a77c9467e554c40e307ae3ff7304833cd044264d92908490603290602381106123b557634e487b7160e01b600052603260045260246000fd5b6000898152605b6020908152604080832060018452909152902054910190603290602381106123f457634e487b7160e01b600052603260045260246000fd5b60008a8152605b60209081526040808320600284529091529020549101906032906023811061243357634e487b7160e01b600052603260045260246000fd5b0160405161160a96959493929190613a79565b611c6d828260405180602001604052806000815250612e42565b6040805143602082015242918101919091526060810183905260009082906080015b6040516020818303038152906040528051906020012060001c6124a59190613d48565b9392505050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612509848484612026565b61251584848484612e75565b61170e5760405162461bcd60e51b81526004016109bb90613ae1565b6000818152605b602090815260408083208380529091529020546060906032906023811061256f57634e487b7160e01b600052603260045260246000fd5b6000848152605b6020908152604080832060018452909152902054910190603290602381106125ae57634e487b7160e01b600052603260045260246000fd5b6000858152605b6020908152604080832060028452909152902054910190603290602381106125ed57634e487b7160e01b600052603260045260246000fd5b0160405160200161260093929190613830565b6040516020818303038152906040529050919050565b6060612620613326565b604051806060016040528060248152602001613f106024913981526000838152605560205260409020805461265490613cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461268090613cf2565b80156126cd5780601f106126a2576101008083540402835291602001916126cd565b820191906000526020600020905b8154815290600101906020018083116126b057829003601f168201915b5050505050816001600981106126f357634e487b7160e01b600052603260045260246000fd5b6020020181905250604051806060016040528060398152602001613dca603991396040808301919091526000848152605b6020908152828220828052905220546032906023811061275457634e487b7160e01b600052603260045260246000fd5b01805461276090613cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461278c90613cf2565b80156127d95780601f106127ae576101008083540402835291602001916127d9565b820191906000526020600020905b8154815290600101906020018083116127bc57829003601f168201915b5050505050816003600981106127ff57634e487b7160e01b600052603260045260246000fd5b6020020181905250604051806060016040528060398152602001613f346039913960808201526000838152605b60209081526040808320600184529091529020546032906023811061286157634e487b7160e01b600052603260045260246000fd5b01805461286d90613cf2565b80601f016020809104026020016040519081016040528092919081815260200182805461289990613cf2565b80156128e65780601f106128bb576101008083540402835291602001916128e6565b820191906000526020600020905b8154815290600101906020018083116128c957829003601f168201915b50505050508160056009811061290c57634e487b7160e01b600052603260045260246000fd5b6020020181905250604051806060016040528060398152602001613ed76039913960c08201526000838152605b60209081526040808320600284529091529020546032906023811061296e57634e487b7160e01b600052603260045260246000fd5b01805461297a90613cf2565b80601f01602080910402602001604051908101604052809291908181526020018280546129a690613cf2565b80156129f35780601f106129c8576101008083540402835291602001916129f3565b820191906000526020600020905b8154815290600101906020018083116129d657829003601f168201915b505050505081600760098110612a1957634e487b7160e01b600052603260045260246000fd5b60200201819052506040518060400160405280600481526020016322207d5d60e01b81525081600860098110612a5f57634e487b7160e01b600052603260045260246000fd5b60209081029190910191909152815182820151604080850151606086015160808701519251600096612a9496959491016137c5565b60408051808303601f190181529082905260a084015160c085015160e0860151610100870151939550612acc948694906020016137c5565b60408051601f19818403018152919052949350505050565b606081612b085750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612b325780612b1c81613d2d565b9150612b2b9050600a83613c7c565b9150612b0c565b60008167ffffffffffffffff811115612b5b57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612b85576020820181803683370190505b5090505b841561201e57612b9a600183613caf565b9150612ba7600a86613d48565b612bb2906030613c64565b60f81b818381518110612bd557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612bf7600a86613c7c565b9450612b89565b805160609080612c1e575050604080516020810190915260008152919050565b60006003612c2d836002613c64565b612c379190613c7c565b612c42906004613c90565b90506000612c51826020613c64565b67ffffffffffffffff811115612c7757634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612ca1576020820181803683370190505b5090506000604051806060016040528060408152602001613e97604091399050600181016020830160005b86811015612d2d576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101612ccc565b506003860660018114612d475760028114612d5857612d64565b613d3d60f01b600119830152612d64565b603d60f81b6000198301525b505050918152949350505050565b6001600160a01b038316612dcd57612dc881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612df0565b816001600160a01b0316836001600160a01b031614612df057612df08382612f82565b6001600160a01b038216612e0757610af18161301f565b826001600160a01b0316826001600160a01b031614610af157610af182826130f8565b600081434285604051602001612482939291906139d5565b612e4c838361313c565b612e596000848484612e75565b610af15760405162461bcd60e51b81526004016109bb90613ae1565b60006001600160a01b0384163b15612f7757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612eb9903390899088908890600401613a02565b602060405180830381600087803b158015612ed357600080fd5b505af1925050508015612f03575060408051601f3d908101601f19168201909252612f0091810190613619565b60015b612f5d573d808015612f31576040519150601f19603f3d011682016040523d82523d6000602084013e612f36565b606091505b508051612f555760405162461bcd60e51b81526004016109bb90613ae1565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061201e565b506001949350505050565b60006001612f8f846113f4565b612f999190613caf565b600083815260076020526040902054909150808214612fec576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061303190600190613caf565b6000838152600960205260408120546008805493945090928490811061306757634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061309657634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806130dc57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000613103836113f4565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166131925760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109bb565b61319b81611eb1565b156131e85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109bb565b6131f460008383612d72565b6001600160a01b038216600090815260036020526040812080546001929061321d908490613c64565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6040518060a001604052806005905b606081526020019060019003908161328a5790505090565b8280546132ae90613cf2565b90600052602060002090601f0160209004810192826132d05760008555613316565b82601f106132e957805160ff1916838001178555613316565b82800160010185558215613316579182015b828111156133165782518255916020019190600101906132fb565b50613322929150613341565b5090565b6040805161012081019091526060815260086020820161328a565b5b808211156133225760008155600101613342565b600067ffffffffffffffff8084111561337157613371613d88565b604051601f8501601f19908116603f0116810190828211818310171561339957613399613d88565b816040528093508581528686860111156133b257600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126133dc578081fd5b6124a583833560208501613356565b6000602082840312156133fc578081fd5b81356124a581613d9e565b600060208284031215613418578081fd5b81516124a581613d9e565b60008060408385031215613435578081fd5b823561344081613d9e565b9150602083013561345081613d9e565b809150509250929050565b60008060006060848603121561346f578081fd5b833561347a81613d9e565b9250602084013561348a81613d9e565b929592945050506040919091013590565b600080600080608085870312156134b0578081fd5b84356134bb81613d9e565b935060208501356134cb81613d9e565b925060408501359150606085013567ffffffffffffffff8111156134ed578182fd5b8501601f810187136134fd578182fd5b61350c87823560208401613356565b91505092959194509250565b6000806040838503121561352a578182fd5b823561353581613d9e565b915060208301358015158114613450578182fd5b6000806040838503121561355b578182fd5b823561356681613d9e565b946020939093013593505050565b600080600060608486031215613588578283fd5b833561359381613d9e565b95602085013595506040909401359392505050565b600080600080608085870312156135bd578384fd5b84356135c881613d9e565b93506020850135925060408501359150606085013567ffffffffffffffff8111156135f1578182fd5b61350c878288016133cc565b60006020828403121561360e578081fd5b81356124a581613db3565b60006020828403121561362a578081fd5b81516124a581613db3565b600060208284031215613646578081fd5b5035919050565b6000806040838503121561365f578182fd5b82359150602083013567ffffffffffffffff81111561367c578182fd5b613688858286016133cc565b9150509250929050565b600080604083850312156136a4578182fd5b50508035926020909101359150565b600081518084526136cb816020860160208601613cc6565b601f01601f19169290920160200192915050565b600081546136ec81613cf2565b808552602060018381168015613709576001811461371d5761374b565b60ff1985168884015260408801955061374b565b866000528260002060005b858110156137435781548a8201860152908301908401613728565b890184019650505b505050505092915050565b6000815461376381613cf2565b6001828116801561377b576001811461378c576137bb565b60ff198416875282870194506137bb565b8560005260208060002060005b858110156137b25781548a820152908401908201613799565b50505082870194505b5050505092915050565b600086516137d7818460208b01613cc6565b8651908301906137eb818360208b01613cc6565b86519101906137fe818360208a01613cc6565b8551910190613811818360208901613cc6565b8451910190613824818360208801613cc6565b01979650505050505050565b600061383c8286613756565b620103e160ed1b8082526138536003830187613756565b90815290506138656003820185613756565b9695505050505050565b707b226e616d65223a20225265616c6d202360781b8152835160009061389c816011850160208901613cc6565b7f222c20226465736372697074696f6e223a2022446973636f76657220796f75726011918401918201527f205265616c6d2e204578706c6f72652e204d696e652e2052657365617263682e60318201527f204275696c642e222c2022696d616765223a2022646174613a696d6167652f7360518201526d1d99cade1b5b0ed8985cd94d8d0b60921b6071820152845161393c81607f840160208901613cc6565b601160f91b607f92909101918201526d161130ba3a3934b13aba32b9911d60911b6080820152835161397581608e840160208801613cc6565b607d60f81b608e9290910191820152608f0195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516139c881601d850160208701613cc6565b91909101601d0192915050565b838152826020820152600082516139f3816040850160208701613cc6565b91909101604001949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613865908301846136b3565b6020815260006124a560208301846136b3565b608081526000613a5b60808301876136b3565b60208301959095525060408101929092521515606090910152919050565b60c081526000613a8c60c08301896136df565b87602084015286151560408401528281036060840152613aac81876136df565b90508281036080840152613ac081866136df565b905082810360a0840152613ad481856136df565b9998505050505050505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526010908201526f17dc99585b1b5259081a5b9d985b1a5960821b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b848152608060208201526000613c3360808301866136df565b8281036040840152613c4581866136df565b90508281036060840152613c5981856136df565b979650505050505050565b60008219821115613c7757613c77613d5c565b500190565b600082613c8b57613c8b613d72565b500490565b6000816000190483118215151615613caa57613caa613d5c565b500290565b600082821015613cc157613cc1613d5c565b500390565b60005b83811015613ce1578181015183820152602001613cc9565b8381111561170e5750506000910152565b600181811c90821680613d0657607f821691505b60208210811415613d2757634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613d4157613d41613d5c565b5060010190565b600082613d5757613d57613d72565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610f8757600080fd5b6001600160e01b031981168114610f8757600080fdfe22207d2c207b202274726169745f74797065223a202247656f67726170686963616c20466561747572652031222c202276616c7565223a20223c2f746578743e3c7465787420783d223530252220793d22363925222066696c6c2d6f7061636974793d2231303025222066696c6c3d22236666662220646f6d696e616e742d626173656c696e653d226d6964646c652220746578742d616e63686f723d226d6964646c652220666f6e742d73697a653d22313270782220666f6e742d66616d696c793d2247656f72676961223e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f22207d2c207b202274726169745f74797065223a202247656f67726170686963616c20466561747572652033222c202276616c7565223a20225b7b202274726169745f74797065223a20225265616c6d222c202276616c7565223a202222207d2c207b202274726169745f74797065223a202247656f67726170686963616c20466561747572652032222c202276616c7565223a20223c2f746578743e3c6c696e6520636c6173733d226c696e6522207374726f6b652d77696474683d2235222078313d22313235222078323d22313337222079313d22313835222079323d22313835223e3c2f6c696e653e203c6c696e6520636c6173733d226c696e6522207374726f6b652d77696474683d2235222078313d22313437222078323d22313438222079313d22313835222079323d22313835223e3c2f6c696e653e203c6c696e6520636c6173733d226c696e6522207374726f6b652d77696474683d2235222078313d22313538222078323d22313730222079313d22313835222079323d22313835223e3c2f6c696e653e203c6c696e6520636c6173733d226c696e6522207374726f6b652d77696474683d2235222078313d22313830222078323d22313831222079313d22313835222079323d22313835223e3c2f6c696e653e203c6c696e6520636c6173733d226c696e6522207374726f6b652d77696474683d2235222078313d22313931222078323d22313932222079313d22313835222079323d22313835223e3c2f6c696e653e203c6c696e6520636c6173733d226c696e6522207374726f6b652d77696474683d2235222078313d22323032222078323d22323134222079313d22313835222079323d22313835223e3c2f6c696e653e203c6c696e6520636c6173733d226c696e6522207374726f6b652d77696474683d2235222078313d22323234222078323d22323235222079313d22313835222079323d22313835223e3c2f6c696e653e3c7374796c6520747970653d22746578742f637373223e2e6c696e657b7374726f6b653a77686974653b7374726f6b652d6c696e656361703a726f756e643b6f7061636974793a3530257d3c2f7374796c653e3c2f7376673e3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c7376672077696474683d22333530707822206865696768743d223335307078222076696577426f783d223020302033353020333530222076657273696f6e3d22312e312220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f7376672220786d6c6e733a786c696e6b3d22687474703a2f2f7777772e77332e6f72672f313939392f786c696e6b223e3c726563742066696c6c3d22236666623330302220783d22302220793d2230222077696474683d2233353022206865696768743d22333530223e3c2f726563743e3c7465787420783d223530252220793d223430252220646f6d696e616e742d626173656c696e653d226d6964646c652220746578742d616e63686f723d226d6964646c65222066696c6c2d6f7061636974793d223530252220666f6e742d73697a653d2236357078222066696c6c3d22236666662220666f6e742d66616d696c793d2247656f72676961223e5265616c6d3c2f746578743e3c7465787420783d223530252220793d22363225222066696c6c2d6f7061636974793d2231303025222066696c6c3d22236666662220646f6d696e616e742d626173656c696e653d226d6964646c652220746578742d616e63686f723d226d6964646c652220666f6e742d73697a653d22323470782220666f6e742d66616d696c793d2247656f72676961223ea26469706673582212201dad1eabab73ca1a29223e1ed81be3ec06090d6b6b59807a3b53926d6d9e43cd64736f6c63430008040033

Loading