ETH Price: $3,306.09 (-4.15%)

Token

GOLD (GOLD)
 

Overview

Max Total Supply

500 GOLD

Holders

192

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 GOLD
0x49E3cF47606a5Da7B11b270A790E2112a467485f
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

GOLD is a dynamic cryptoart series released in partnership with Fingerprints DAO. The artworks change in response to the collection's own live market activity. The actions of GOLD collectors are part of this ever-changing artwork, where prices, levels of activity and on-chain provenance define the art itself. Find out more: https://www.making.gold/ How does the market affect the way we see art? Does the sale price of an NFT change our perception of it? In GOLD, market factors literally influence the appearance of the dynamic imagery. From a sale to a listing, from the amount of time an artwork is held to whether it has recently been flipped, all this data is recorded by the contract and reflected live in each GOLD piece. GOLD is an artistic exploration of NFT market behaviour. It explores how we see in digital environments, and how market networks influence how we see. The full spectrum of possibilities for GOLD will take years to reveal.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Gold

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 500 runs

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

pragma solidity ^0.8.17;

import {PaymentSplitter} from "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {ERC721} from "./lib/ERC721.sol";
import {IDelegateCash} from "./lib/IDelegateCash.sol";

error NotAuthorized();
error MaxSupplyReached();
error ClaimingTooEarly();
error ClaimingTooLate();
error AlreadyClaimed();
error SupplyLocked();

interface IGoldRenderer {
  function tokenURI(uint256 tokenId) external view returns (string memory);

  function numberOfBonusPlates(uint256 tokenId) external view returns (uint256);
}

/// @title Gold
/// @author @0x_jj
contract Gold is ERC721, PaymentSplitter, AccessControl, Ownable, Pausable {
  using SafeCast for uint256;

  uint256 public totalSupply = 0;
  uint256 public maxSupply;
  bool public supplyLocked;

  address public minter;

  IGoldRenderer public renderer;
  IERC20 public wethContract;

  struct TokenData {
    uint256 transferCount;
    uint256[HISTORY_LENGTH] latestTransferTimestamps;
    uint256 mintTimestamp;
    bytes32 seed;
    address held6MonthsClaimedBy;
    address held12MonthsClaimedBy;
    address held24MonthsClaimedBy;
    address held60MonthsClaimedBy;
    address held120MonthsClaimedBy;
    address held240MonthsClaimedBy;
  }

  /// @dev Mapping from token ID to token data
  mapping(uint256 => TokenData) public tokenData;

  /// @dev Track when we receive royalty payments
  struct RoyaltyReceipt {
    uint64 timestamp;
    uint192 amount;
  }
  uint256 public ethReceivedCount;
  RoyaltyReceipt[HISTORY_LENGTH] public ethReceipts;

  /// @dev Track WETH roughly by checking balances between transfers
  struct WethStats {
    uint64 wethReceivedCount;
    uint192 latestWethBalance;
  }
  WethStats private wethStats;
  RoyaltyReceipt[HISTORY_LENGTH] public wethReceipts;

  /// @dev Number of transfers that have happened on the contract
  uint256 public transferCount;

  /// @dev Timestamp of the last transfer that happened on the contract
  uint256[HISTORY_LENGTH] public latestTransferTimestamps;

  /// @dev Base timestamp to use to calculate averages in the art script
  uint256 public baseTimestamp;

  /// @dev Delegate cash contract address
  IDelegateCash public delegateCash;

  constructor(
    address[] memory payees,
    uint256[] memory shares,
    address[] memory admins_,
    address wethContract_,
    address goldRenderer_,
    uint256 maxSupply_,
    address delegateCash_
  ) PaymentSplitter(payees, shares) ERC721("GOLD", "GOLD") {
    _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
    for (uint256 i = 0; i < admins_.length; i++) {
      _grantRole(DEFAULT_ADMIN_ROLE, admins_[i]);
    }

    wethContract = IERC20(wethContract_);
    renderer = IGoldRenderer(goldRenderer_);
    baseTimestamp = block.timestamp;
    maxSupply = maxSupply_;
    delegateCash = IDelegateCash(delegateCash_);
  }

  receive() external payable override {
    emit PaymentReceived(_msgSender(), msg.value);
    ethReceipts[ethReceivedCount % HISTORY_LENGTH] = RoyaltyReceipt(
      block.timestamp.toUint64(),
      msg.value.toUint192()
    );
    ethReceivedCount += 1;
  }

  function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
    _unpause();
  }

  function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {
    _pause();
  }

  function setBaseTimestamp(uint256 _baseTimestamp) external onlyRole(DEFAULT_ADMIN_ROLE) {
    baseTimestamp = _baseTimestamp;
  }

  function setMinterAddress(address _minter) external onlyRole(DEFAULT_ADMIN_ROLE) {
    minter = _minter;
  }

  function setRendererAddress(address _renderer) external onlyRole(DEFAULT_ADMIN_ROLE) {
    renderer = IGoldRenderer(_renderer);
  }

  function endMint() external onlyRole(DEFAULT_ADMIN_ROLE) {
    maxSupply = totalSupply;
  }

  function mint(address to) public whenNotPaused {
    if (totalSupply >= maxSupply) revert MaxSupplyReached();
    if (!(_msgSender() == minter || _msgSender() == owner())) revert NotAuthorized();

    uint256 tokenId = totalSupply;
    totalSupply++;
    tokenData[tokenId].mintTimestamp = block.timestamp;
    tokenData[tokenId].seed = keccak256(
      abi.encodePacked(blockhash(block.number - 1), block.number, block.timestamp, _msgSender(), tokenId)
    );
    _safeMint(to, tokenId);
  }

  function tokenURI(uint256 tokenId) public view override returns (string memory) {
    return renderer.tokenURI(tokenId);
  }

  function _afterTokenTransfer(address from, address, uint256 tokenId, uint256) internal override {
    if (from == address(0)) {
      return;
    }

    // Record latest transfer on contract
    latestTransferTimestamps[transferCount % HISTORY_LENGTH] = block.timestamp;

    // Record latest transfer on token. Unordered, to be sorted by timestamp off chain
    tokenData[tokenId].latestTransferTimestamps[tokenData[tokenId].transferCount % HISTORY_LENGTH] = block
      .timestamp;

    // Increase transfer counts on token and contract. Important so that we can correctly write to history arrays in a loop
    tokenData[tokenId].transferCount++;
    transferCount++;

    // Record WETH receipts, if any, attempting to match how we record native ETH receipts
    // We do this by checking the balance of the contract before and after the transfer, taking into account any WETH that has been released to payees
    // Of course this means we don't know when WETH was received multiple times between two transfers occurring, but that's fine, it's just a rough estimate
    WethStats memory stats = wethStats;
    uint256 prevBalance = stats.latestWethBalance;
    uint256 currentBalance = wethContract.balanceOf(address(this)) + totalReleased(wethContract);

    if (currentBalance > prevBalance) {
      stats.latestWethBalance = currentBalance.toUint192();
      wethReceipts[stats.wethReceivedCount % HISTORY_LENGTH] = RoyaltyReceipt(
        block.timestamp.toUint64(),
        (currentBalance - prevBalance).toUint192()
      );
      stats.wethReceivedCount++;

      wethStats = stats;
    }
  }

  function claimBonusPlates(uint256 tokenId, uint8 milestone, address vaultAddress) external {
    address claimant = _msgSender();

    if (vaultAddress != address(0) && vaultAddress != _msgSender()) {
      bool isDelegateValid = delegateCash.checkDelegateForContract(_msgSender(), vaultAddress, address(this));
      require(isDelegateValid, "invalid delegate-vault pairing");
      claimant = vaultAddress;
    }

    if (ownerOf(tokenId) != claimant) revert NotAuthorized();

    uint256 lastTransferTimestamp = latestTransferTimestamp(tokenData[tokenId]);

    if (milestone == 1) {
      if (tokenData[tokenId].held6MonthsClaimedBy != address(0)) {
        revert AlreadyClaimed();
      }

      uint256 eligibleAt = lastTransferTimestamp + (6 * 30 days);

      if (block.timestamp < eligibleAt) revert ClaimingTooEarly();
      if (block.timestamp > (eligibleAt + (24 days))) revert ClaimingTooLate();

      tokenData[tokenId].held6MonthsClaimedBy = claimant;
    }

    if (milestone == 2) {
      if (tokenData[tokenId].held12MonthsClaimedBy != address(0)) {
        revert AlreadyClaimed();
      }

      uint256 eligibleAt = lastTransferTimestamp + (12 * 30 days);

      if (block.timestamp < eligibleAt) revert ClaimingTooEarly();
      if (block.timestamp > (eligibleAt + (24 days))) revert ClaimingTooLate();

      tokenData[tokenId].held12MonthsClaimedBy = claimant;
    }

    if (milestone == 3) {
      if (tokenData[tokenId].held24MonthsClaimedBy != address(0)) {
        revert AlreadyClaimed();
      }

      uint256 eligibleAt = lastTransferTimestamp + (24 * 30 days);

      if (block.timestamp < eligibleAt) revert ClaimingTooEarly();
      if (block.timestamp > (eligibleAt + (24 days))) revert ClaimingTooLate();

      tokenData[tokenId].held24MonthsClaimedBy = claimant;
    }

    if (milestone == 4) {
      if (tokenData[tokenId].held60MonthsClaimedBy != address(0)) {
        revert AlreadyClaimed();
      }

      uint256 eligibleAt = lastTransferTimestamp + (60 * 30 days);

      if (block.timestamp < eligibleAt) revert ClaimingTooEarly();
      if (block.timestamp > (eligibleAt + (24 days))) revert ClaimingTooLate();

      tokenData[tokenId].held60MonthsClaimedBy = claimant;
    }

    if (milestone == 5) {
      if (tokenData[tokenId].held120MonthsClaimedBy != address(0)) {
        revert AlreadyClaimed();
      }

      uint256 eligibleAt = lastTransferTimestamp + (120 * 30 days);

      if (block.timestamp < eligibleAt) revert ClaimingTooEarly();
      if (block.timestamp > (eligibleAt + (24 days))) revert ClaimingTooLate();

      tokenData[tokenId].held120MonthsClaimedBy = claimant;
    }

    if (milestone == 6) {
      if (tokenData[tokenId].held240MonthsClaimedBy != address(0)) {
        revert AlreadyClaimed();
      }

      uint256 eligibleAt = lastTransferTimestamp + (240 * 30 days);

      if (block.timestamp < eligibleAt) revert ClaimingTooEarly();
      if (block.timestamp > (eligibleAt + (24 days))) revert ClaimingTooLate();

      tokenData[tokenId].held240MonthsClaimedBy = claimant;
    }
  }

  function getContractMetrics()
    external
    view
    returns (
      uint256,
      uint256[HISTORY_LENGTH] memory,
      uint256,
      uint256[HISTORY_LENGTH] memory,
      uint256,
      RoyaltyReceipt[HISTORY_LENGTH] memory,
      RoyaltyReceipt[HISTORY_LENGTH] memory,
      uint256
    )
  {
    return (
      approvalCount,
      latestApprovalTimestamps,
      transferCount,
      latestTransferTimestamps,
      getHolderCount(),
      ethReceipts,
      wethReceipts,
      totalSupply
    );
  }

  function getTokenMetrics(
    uint256 tokenId
  ) external view returns (uint256, uint256[HISTORY_LENGTH] memory, uint256, bytes32, uint256, uint256) {
    return (
      tokenData[tokenId].transferCount,
      tokenData[tokenId].latestTransferTimestamps,
      tokenData[tokenId].mintTimestamp,
      tokenData[tokenId].seed,
      balanceOf(ownerOf(tokenId)),
      renderer.numberOfBonusPlates(tokenId)
    );
  }

  function getHolderCount() internal view returns (uint256) {
    uint256 count = 0;
    address[] memory seen = new address[](totalSupply);
    for (uint256 i = 0; i < totalSupply; i++) {
      address owner = ownerOf(i);
      if (findElement(seen, owner) == false) {
        count++;
        seen[i] = owner;
      } else {
        seen[i] = address(0);
      }
    }
    return count;
  }

  function latestTransferTimestamp(TokenData memory _tokenData) internal pure returns (uint256) {
    if (_tokenData.transferCount == 0) return _tokenData.mintTimestamp;

    return _tokenData.latestTransferTimestamps[(_tokenData.transferCount - 1) % HISTORY_LENGTH];
  }

  function supportsInterface(bytes4 interfaceId) public view override(ERC721, AccessControl) returns (bool) {
    return super.supportsInterface(interfaceId);
  }

  function findElement(address[] memory arr, address element) internal pure returns (bool) {
    for (uint256 i = 0; i < arr.length; i++) {
      if (arr[i] == element) {
        return true;
      }
    }
    return false;
  }

  function toHexDigit(uint8 d) internal pure returns (bytes1) {
    if (0 <= d && d <= 9) {
      return bytes1(uint8(bytes1("0")) + d);
    } else if (10 <= uint8(d) && uint8(d) <= 15) {
      return bytes1(uint8(bytes1("a")) + d - 10);
    }
    revert();
  }

  function fromCode(bytes4 code) internal pure returns (string memory) {
    bytes memory result = new bytes(10);
    result[0] = bytes1("0");
    result[1] = bytes1("x");
    for (uint i = 0; i < 4; ++i) {
      result[2 * i + 2] = toHexDigit(uint8(code[i]) / 16);
      result[2 * i + 3] = toHexDigit(uint8(code[i]) % 16);
    }
    return string(result);
  }

  function getSelectors() public pure returns (string memory, string memory) {
    return (fromCode(this.getContractMetrics.selector), fromCode(this.getTokenMetrics.selector));
  }
}

File 2 of 22 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 22 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 22 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

File 5 of 22 : PaymentSplitter.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/utils/SafeERC20.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";

/**
 * @title PaymentSplitter
 * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
 * that the Ether will be split in this way, since it is handled transparently by the contract.
 *
 * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
 * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
 * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the
 * time of contract deployment and can't be updated thereafter.
 *
 * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
 * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
 * function.
 *
 * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and
 * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you
 * to run tests before sending real value to this contract.
 */
contract PaymentSplitter is Context {
    event PayeeAdded(address account, uint256 shares);
    event PaymentReleased(address to, uint256 amount);
    event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
    event PaymentReceived(address from, uint256 amount);

    uint256 private _totalShares;
    uint256 private _totalReleased;

    mapping(address => uint256) private _shares;
    mapping(address => uint256) private _released;
    address[] private _payees;

    mapping(IERC20 => uint256) private _erc20TotalReleased;
    mapping(IERC20 => mapping(address => uint256)) private _erc20Released;

    /**
     * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
     * the matching position in the `shares` array.
     *
     * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
     * duplicates in `payees`.
     */
    constructor(address[] memory payees, uint256[] memory shares_) payable {
        require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
        require(payees.length > 0, "PaymentSplitter: no payees");

        for (uint256 i = 0; i < payees.length; i++) {
            _addPayee(payees[i], shares_[i]);
        }
    }

    /**
     * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
     * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
     * reliability of the events, and not the actual splitting of Ether.
     *
     * To learn more about this see the Solidity documentation for
     * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
     * functions].
     */
    receive() external payable virtual {
        emit PaymentReceived(_msgSender(), msg.value);
    }

    /**
     * @dev Getter for the total shares held by payees.
     */
    function totalShares() public view returns (uint256) {
        return _totalShares;
    }

    /**
     * @dev Getter for the total amount of Ether already released.
     */
    function totalReleased() public view returns (uint256) {
        return _totalReleased;
    }

    /**
     * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20
     * contract.
     */
    function totalReleased(IERC20 token) public view returns (uint256) {
        return _erc20TotalReleased[token];
    }

    /**
     * @dev Getter for the amount of shares held by an account.
     */
    function shares(address account) public view returns (uint256) {
        return _shares[account];
    }

    /**
     * @dev Getter for the amount of Ether already released to a payee.
     */
    function released(address account) public view returns (uint256) {
        return _released[account];
    }

    /**
     * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an
     * IERC20 contract.
     */
    function released(IERC20 token, address account) public view returns (uint256) {
        return _erc20Released[token][account];
    }

    /**
     * @dev Getter for the address of the payee number `index`.
     */
    function payee(uint256 index) public view returns (address) {
        return _payees[index];
    }

    /**
     * @dev Getter for the amount of payee's releasable Ether.
     */
    function releasable(address account) public view returns (uint256) {
        uint256 totalReceived = address(this).balance + totalReleased();
        return _pendingPayment(account, totalReceived, released(account));
    }

    /**
     * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an
     * IERC20 contract.
     */
    function releasable(IERC20 token, address account) public view returns (uint256) {
        uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
        return _pendingPayment(account, totalReceived, released(token, account));
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
     * total shares and their previous withdrawals.
     */
    function release(address payable account) public virtual {
        require(_shares[account] > 0, "PaymentSplitter: account has no shares");

        uint256 payment = releasable(account);

        require(payment != 0, "PaymentSplitter: account is not due payment");

        // _totalReleased is the sum of all values in _released.
        // If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow.
        _totalReleased += payment;
        unchecked {
            _released[account] += payment;
        }

        Address.sendValue(account, payment);
        emit PaymentReleased(account, payment);
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their
     * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20
     * contract.
     */
    function release(IERC20 token, address account) public virtual {
        require(_shares[account] > 0, "PaymentSplitter: account has no shares");

        uint256 payment = releasable(token, account);

        require(payment != 0, "PaymentSplitter: account is not due payment");

        // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token].
        // If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment"
        // cannot overflow.
        _erc20TotalReleased[token] += payment;
        unchecked {
            _erc20Released[token][account] += payment;
        }

        SafeERC20.safeTransfer(token, account, payment);
        emit ERC20PaymentReleased(token, account, payment);
    }

    /**
     * @dev internal logic for computing the pending payment of an `account` given the token historical balances and
     * already released amounts.
     */
    function _pendingPayment(
        address account,
        uint256 totalReceived,
        uint256 alreadyReleased
    ) private view returns (uint256) {
        return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;
    }

    /**
     * @dev Add a new payee to the contract.
     * @param account The address of the payee to add.
     * @param shares_ The number of shares owned by the payee.
     */
    function _addPayee(address account, uint256 shares_) private {
        require(account != address(0), "PaymentSplitter: account is the zero address");
        require(shares_ > 0, "PaymentSplitter: shares are 0");
        require(_shares[account] == 0, "PaymentSplitter: account already has shares");

        _payees.push(account);
        _shares[account] = shares_;
        _totalShares = _totalShares + shares_;
        emit PayeeAdded(account, shares_);
    }
}

File 6 of 22 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 7 of 22 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 8 of 22 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 9 of 22 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 11 of 22 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * 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;

    /**
     * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

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

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

File 12 of 22 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 13 of 22 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 14 of 22 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 17 of 22 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 18 of 22 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 19 of 22 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 20 of 22 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

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

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/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;

  // Number of datapoints to store
  uint256 public constant HISTORY_LENGTH = 200;

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

  // Tracking
  uint256 public approvalCount;
  uint256[HISTORY_LENGTH] public latestApprovalTimestamps;

  /**
   * @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: address zero is not a valid owner");
    return _balances[owner];
  }

  /**
   * @dev See {IERC721-ownerOf}.
   */
  function ownerOf(
    uint256 tokenId
  ) public view virtual override returns (address) {
    address owner = _ownerOf(tokenId);
    require(owner != address(0), "ERC721: invalid token ID");
    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) {
    _requireMinted(tokenId);

    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 overridden 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 token owner or approved for all"
    );

    latestApprovalTimestamps[approvalCount % HISTORY_LENGTH] = block.timestamp;
    approvalCount++;
    _approve(to, tokenId);
  }

  /**
   * @dev See {IERC721-getApproved}.
   */
  function getApproved(
    uint256 tokenId
  ) public view virtual override returns (address) {
    _requireMinted(tokenId);

    return _tokenApprovals[tokenId];
  }

  /**
   * @dev See {IERC721-setApprovalForAll}.
   */
  function setApprovalForAll(
    address operator,
    bool approved
  ) public virtual override {
    if (approved) {
      latestApprovalTimestamps[approvalCount % HISTORY_LENGTH] = block
        .timestamp;
      approvalCount++;
    }
    _setApprovalForAll(_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: caller is not token owner or 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: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
   */
  function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
    return _owners[tokenId];
  }

  /**
   * @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 _ownerOf(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) {
    address owner = ERC721.ownerOf(tokenId);
    return (spender == owner ||
      isApprovedForAll(owner, spender) ||
      getApproved(tokenId) == 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, 1);

    // Check that tokenId was not minted by `_beforeTokenTransfer` hook
    require(!_exists(tokenId), "ERC721: token already minted");

    unchecked {
      // Will not overflow unless all 2**256 token ids are minted to the same owner.
      // Given that tokens are minted one by one, it is impossible in practice that
      // this ever happens. Might change if we allow batch minting.
      // The ERC fails to describe this case.
      _balances[to] += 1;
    }

    _owners[tokenId] = to;

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

    _afterTokenTransfer(address(0), to, tokenId, 1);
  }

  /**
   * @dev Destroys `tokenId`.
   * The approval is cleared when the token is burned.
   * This is an internal function that does not check if the sender is authorized to operate on the token.
   *
   * Requirements:
   *
   * - `tokenId` must exist.
   *
   * Emits a {Transfer} event.
   */
  function _burn(uint256 tokenId) internal virtual {
    address owner = ERC721.ownerOf(tokenId);

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

    // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
    owner = ERC721.ownerOf(tokenId);

    // Clear approvals
    delete _tokenApprovals[tokenId];

    unchecked {
      // Cannot overflow, as that would require more tokens to be burned/transferred
      // out than the owner initially received through minting and transferring in.
      _balances[owner] -= 1;
    }
    delete _owners[tokenId];

    emit Transfer(owner, address(0), tokenId);

    _afterTokenTransfer(owner, address(0), tokenId, 1);
  }

  /**
   * @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 from incorrect owner"
    );
    require(to != address(0), "ERC721: transfer to the zero address");

    _beforeTokenTransfer(from, to, tokenId, 1);

    // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
    require(
      ERC721.ownerOf(tokenId) == from,
      "ERC721: transfer from incorrect owner"
    );

    // Clear approvals from the previous owner
    delete _tokenApprovals[tokenId];

    unchecked {
      // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
      // `from`'s balance is the number of token held, which is at least one before the current
      // transfer.
      // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
      // all 2**256 token ids to be minted, which in practice is impossible.
      _balances[from] -= 1;
      _balances[to] += 1;
    }
    _owners[tokenId] = to;

    emit Transfer(from, to, tokenId);

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

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

  /**
   * @dev Approve `operator` to operate on all of `owner` tokens
   *
   * Emits an {ApprovalForAll} event.
   */
  function _setApprovalForAll(
    address owner,
    address operator,
    bool approved
  ) internal virtual {
    require(owner != operator, "ERC721: approve to caller");
    _operatorApprovals[owner][operator] = approved;
    emit ApprovalForAll(owner, operator, approved);
  }

  /**
   * @dev Reverts if the `tokenId` has not been minted yet.
   */
  function _requireMinted(uint256 tokenId) internal view virtual {
    require(_exists(tokenId), "ERC721: invalid token ID");
  }

  /**
   * @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 {
          /// @solidity memory-safe-assembly
          assembly {
            revert(add(32, reason), mload(reason))
          }
        }
      }
    } else {
      return true;
    }
  }

  /**
   * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
   * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
   *
   * Calling conditions:
   *
   * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
   * - When `from` is zero, the tokens will be minted for `to`.
   * - When `to` is zero, ``from``'s tokens will be burned.
   * - `from` and `to` are never both zero.
   * - `batchSize` is non-zero.
   *
   * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
   */
  function _beforeTokenTransfer(
    address from,
    address to,
    uint256 /* firstTokenId */,
    uint256 batchSize
  ) internal virtual {
    if (batchSize > 1) {
      if (from != address(0)) {
        _balances[from] -= batchSize;
      }
      if (to != address(0)) {
        _balances[to] += batchSize;
      }
    }
  }

  /**
   * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
   * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
   *
   * Calling conditions:
   *
   * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
   * - When `from` is zero, the tokens were minted for `to`.
   * - When `to` is zero, ``from``'s tokens were burned.
   * - `from` and `to` are never both zero.
   * - `batchSize` is non-zero.
   *
   * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
   */
  function _afterTokenTransfer(
    address from,
    address to,
    uint256 firstTokenId,
    uint256 batchSize
  ) internal virtual {}
}

File 22 of 22 : IDelegateCash.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IDelegateCash {
  function checkDelegateForContract(
    address hot,
    address cold,
    address contractAddress
  ) external view returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 500,
    "details": {
      "yul": true,
      "yulDetails": {
        "stackAllocation": true,
        "optimizerSteps": "dhfoDgvulfnTUtnIf"
      }
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"},{"internalType":"address[]","name":"admins_","type":"address[]"},{"internalType":"address","name":"wethContract_","type":"address"},{"internalType":"address","name":"goldRenderer_","type":"address"},{"internalType":"uint256","name":"maxSupply_","type":"uint256"},{"internalType":"address","name":"delegateCash_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"ClaimingTooEarly","type":"error"},{"inputs":[],"name":"ClaimingTooLate","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","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":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","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":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HISTORY_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"approvalCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint8","name":"milestone","type":"uint8"},{"internalType":"address","name":"vaultAddress","type":"address"}],"name":"claimBonusPlates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"delegateCash","outputs":[{"internalType":"contract IDelegateCash","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ethReceipts","outputs":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethReceivedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractMetrics","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[200]","name":"","type":"uint256[200]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[200]","name":"","type":"uint256[200]"},{"internalType":"uint256","name":"","type":"uint256"},{"components":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"internalType":"struct Gold.RoyaltyReceipt[200]","name":"","type":"tuple[200]"},{"components":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"internalType":"struct Gold.RoyaltyReceipt[200]","name":"","type":"tuple[200]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSelectors","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenMetrics","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[200]","name":"","type":"uint256[200]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"latestApprovalTimestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"latestTransferTimestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renderer","outputs":[{"internalType":"contract IGoldRenderer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","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":"uint256","name":"_baseTimestamp","type":"uint256"}],"name":"setBaseTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"setMinterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_renderer","type":"address"}],"name":"setRendererAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supplyLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"","type":"uint256"}],"name":"tokenData","outputs":[{"internalType":"uint256","name":"transferCount","type":"uint256"},{"internalType":"uint256","name":"mintTimestamp","type":"uint256"},{"internalType":"bytes32","name":"seed","type":"bytes32"},{"internalType":"address","name":"held6MonthsClaimedBy","type":"address"},{"internalType":"address","name":"held12MonthsClaimedBy","type":"address"},{"internalType":"address","name":"held24MonthsClaimedBy","type":"address"},{"internalType":"address","name":"held60MonthsClaimedBy","type":"address"},{"internalType":"address","name":"held120MonthsClaimedBy","type":"address"},{"internalType":"address","name":"held240MonthsClaimedBy","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wethContract","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"wethReceipts","outputs":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052600060d8553480156200001657600080fd5b506040516200543b3803806200543b833981016040819052620000399162000662565b86866040518060400160405280600481526020016311d3d31160e21b8152506040518060400160405280600481526020016311d3d31160e21b815250816000908162000086919062000861565b50600162000095828262000861565b5050508051825114620000c55760405162461bcd60e51b8152600401620000bc906200097c565b60405180910390fd5b6000825111620000e95760405162461bcd60e51b8152600401620000bc90620009c2565b60005b82518110156200015557620001408382815181106200010f576200010f620009d4565b60200260200101518383815181106200012c576200012c620009d4565b60200260200101516200023360201b60201c565b806200014c8162000a00565b915050620000ec565b505050620001726200016c6200036560201b60201c565b62000369565b60d7805460ff60a01b191690556200018c600033620003bb565b60005b8551811015620001df57620001ca6000801b878381518110620001b657620001b6620009d4565b6020026020010151620003bb60201b60201c565b80620001d68162000a00565b9150506200018f565b5060dc80546001600160a01b039586166001600160a01b03199182161790915560db805494861694821694909417909355426103395560d99190915561033a80549190931691161790555062000b68915050565b6001600160a01b0382166200025c5760405162461bcd60e51b8152600401620000bc9062000a64565b600081116200027f5760405162461bcd60e51b8152600401620000bc9062000aa9565b6001600160a01b038216600090815260d1602052604090205415620002b85760405162461bcd60e51b8152600401620000bc9062000b02565b60d38054600181019091557f915c3eb987b20e1af620c1403197bf687fb7f18513b3a73fde6e78c7072c41a60180546001600160a01b0319166001600160a01b038416908117909155600090815260d16020526040902081905560cf546200032290829062000b14565b60cf556040517f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac9062000359908490849062000b42565b60405180910390a15050565b3390565b60d780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620003c7828262000446565b6200044257600082815260d6602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620004013390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681016001600160401b0381118282101715620004b157620004b162000473565b6040525050565b6000620004c460405190565b9050620004d2828262000489565b919050565b60006001600160401b03821115620004f357620004f362000473565b5060209081020190565b60006001600160a01b0382166200046d565b6200051a81620004fd565b81146200052657600080fd5b50565b80516200046d816200050f565b60006200054d6200054784620004d7565b620004b8565b838152905060208082019084028301858111156200056e576200056e600080fd5b835b81811015620005945762000585878262000529565b83526020928301920162000570565b5050509392505050565b600082601f830112620005b457620005b4600080fd5b8151620005c684826020860162000536565b949350505050565b806200051a565b80516200046d81620005ce565b6000620005f36200054784620004d7565b83815290506020808201908402830185811115620006145762000614600080fd5b835b8181101562000594576200062b8782620005d5565b83526020928301920162000616565b600082601f830112620006505762000650600080fd5b8151620005c6848260208601620005e2565b600080600080600080600060e0888a031215620006825762000682600080fd5b87516001600160401b038111156200069d576200069d600080fd5b620006ab8a828b016200059e565b60208a015190985090506001600160401b03811115620006ce57620006ce600080fd5b620006dc8a828b016200063a565b60408a015190975090506001600160401b03811115620006ff57620006ff600080fd5b6200070d8a828b016200059e565b9550506060620007208a828b0162000529565b9450506080620007338a828b0162000529565b93505060a0620007468a828b01620005d5565b92505060c0620007598a828b0162000529565b91505092959891949750929550565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806200079357607f821691505b602082108103620007a857620007a862000768565b50919050565b60006200046d620007bc8381565b90565b620007ca83620007ae565b81546008840282811b60001990911b908116901990911617825550505050565b6000620007f9818484620007bf565b505050565b81811015620004425762000814600082620007ea565b600101620007fe565b601f821115620007f9576000818152602090206020601f85010481016020851015620008465750805b6200085a6020601f860104830182620007fe565b5050505050565b81516001600160401b038111156200087d576200087d62000473565b6200088982546200077e565b620008968282856200081d565b506020601f821160018114620008ce5760008315620008b55750848201515b600019600885021c19811660028502178555506200085a565b600084815260208120601f198516915b82811015620009005787850151825560209485019460019092019101620008de565b50848210156200091e5783870151600019601f87166008021c191681555b50505050600202600101905550565b60328152602081017f5061796d656e7453706c69747465723a2070617965657320616e6420736861728152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b602082015290505b60400190565b602080825281016200046d816200092d565b601a8152602081017f5061796d656e7453706c69747465723a206e6f20706179656573000000000000815290505b60200190565b602080825281016200046d816200098e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162000a155762000a15620009ea565b5060010190565b602c8152602081017f5061796d656e7453706c69747465723a206163636f756e74206973207468652081526b7a65726f206164647265737360a01b6020820152905062000976565b602080825281016200046d8162000a1c565b601d8152602081017f5061796d656e7453706c69747465723a2073686172657320617265203000000081529050620009bc565b602080825281016200046d8162000a76565b602b8152602081017f5061796d656e7453706c69747465723a206163636f756e7420616c726561647981526a206861732073686172657360a81b6020820152905062000976565b602080825281016200046d8162000abb565b808201808211156200046d576200046d620009ea565b62000b3581620004fd565b82525050565b8062000b35565b6040810162000b52828562000b2a565b62000b61602083018462000b3b565b9392505050565b6148c38062000b786000396000f3fe6080604052600436106103b15760003560e01c806370a08231116101e7578063a556f60f1161010d578063d79779b2116100a0578063e6a8efb91161006f578063e6a8efb914610caf578063e985e9c514610ccf578063f0cdc1de14610d18578063f2fde38b14610d3857600080fd5b8063d79779b214610c37578063e33b7de314610c6d578063e3d33fc914610c82578063e41a131714610c9957600080fd5b8063c87b56dd116100dc578063c87b56dd14610bab578063ce7c2ac214610bcb578063d547741f14610c01578063d5abeb0114610c2157600080fd5b8063a556f60f14610abc578063b4b5b48f14610adc578063b88d4fde14610b6b578063c45ac05014610b8b57600080fd5b8063943eb50411610185578063a217fddf11610154578063a217fddf14610a47578063a22cb46514610a5c578063a3106b9514610a7c578063a3f8eace14610a9c57600080fd5b8063943eb504146109c157806394856295146109db57806395d89b41146109fc5780639852595c14610a1157600080fd5b80638ada6b0f116101c15780638ada6b0f1461091d5780638b83209b1461093d5780638da5cb5b1461095d57806391d148541461097b57600080fd5b806370a08231146108d3578063715018a6146108f35780638456cb591461090857600080fd5b80633f4ba83a116102d75780634b503f0b1161026a5780636352211e116102395780636352211e146108685780636884d0a6146108885780636a6278421461089e5780636c41808a146108be57600080fd5b80634b503f0b146107dd5780635681e00b14610800578063568e0eac146108295780635c975abb1461084957600080fd5b806346c4d346116102a657806346c4d346146107425780634780eac11461077057806348b750441461079d5780634976bddb146107bd57600080fd5b80633f4ba83a146106a7578063406072a9146106bc57806342842e0e1461070257806344a0c8a11461072257600080fd5b806318160ddd1161034f5780632d56ab421161031e5780632d56ab42146106205780632f2ff15d1461065257806336568abe146106725780633a98ef391461069257600080fd5b806318160ddd1461059a57806319165587146105b057806323b872dd146105d0578063248a9ca3146105f057600080fd5b8063075461721161038b5780630754617214610504578063081812fc14610536578063095ea7b31461055657806313cf2f4f1461057657600080fd5b8063017043a51461049557806301ffc9a7146104ac57806306fdde03146104e257600080fd5b36610490577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033346040516103e79291906134e8565b60405180910390a1604051806040016040528061040342610d58565b67ffffffffffffffff16815260200161041b34610d8f565b6001600160c01b031681525060df60c860de546104389190613519565b60c8811061044857610448613531565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff9093169290921791015560de80546001919060009061048890849061355d565b925050819055005b600080fd5b3480156104a157600080fd5b506104aa610db8565b005b3480156104b857600080fd5b506104cc6104c7366004613592565b610dcc565b6040516104d991906135bb565b60405180910390f35b3480156104ee57600080fd5b506104f7610ddd565b6040516104d9919061361f565b34801561051057600080fd5b5060da546105299061010090046001600160a01b031681565b6040516104d99190613630565b34801561054257600080fd5b5061052961055136600461364f565b610e6f565b34801561056257600080fd5b506104aa610571366004613684565b610e96565b34801561058257600080fd5b5061058d6103395481565b6040516104d991906136c1565b3480156105a657600080fd5b5061058d60d85481565b3480156105bc57600080fd5b506104aa6105cb3660046136cf565b610f54565b3480156105dc57600080fd5b506104aa6105eb3660046136f0565b611032565b3480156105fc57600080fd5b5061058d61060b36600461364f565b600090815260d6602052604090206001015490565b34801561062c57600080fd5b5061064061063b36600461364f565b611063565b6040516104d996959493929190613782565b34801561065e57600080fd5b506104aa61066d3660046137d6565b611157565b34801561067e57600080fd5b506104aa61068d3660046137d6565b61117c565b34801561069e57600080fd5b5060cf5461058d565b3480156106b357600080fd5b506104aa6111b2565b3480156106c857600080fd5b5061058d6106d7366004613828565b6001600160a01b03918216600090815260d56020908152604080832093909416825291909152205490565b34801561070e57600080fd5b506104aa61071d3660046136f0565b6111c8565b34801561072e57600080fd5b506104aa61073d36600461364f565b6111e3565b34801561074e57600080fd5b5061076261075d36600461364f565b6111f5565b6040516104d9929190613869565b34801561077c57600080fd5b5060dc54610790906001600160a01b031681565b6040516104d99190613898565b3480156107a957600080fd5b506104aa6107b8366004613828565b611228565b3480156107c957600080fd5b5061058d6107d836600461364f565b611336565b3480156107e957600080fd5b506107f261134e565b6040516104d99291906138a6565b34801561080c57600080fd5b50610815611379565b6040516104d9989796959493929190613926565b34801561083557600080fd5b5061058d61084436600461364f565b61150c565b34801561085557600080fd5b5060d754600160a01b900460ff166104cc565b34801561087457600080fd5b5061052961088336600461364f565b61151c565b34801561089457600080fd5b5061058d60065481565b3480156108aa57600080fd5b506104aa6108b93660046136cf565b611551565b3480156108ca57600080fd5b5061058d60c881565b3480156108df57600080fd5b5061058d6108ee3660046136cf565b61164d565b3480156108ff57600080fd5b506104aa611691565b34801561091457600080fd5b506104aa6116a5565b34801561092957600080fd5b5060db54610790906001600160a01b031681565b34801561094957600080fd5b5061052961095836600461364f565b6116b8565b34801561096957600080fd5b5060d7546001600160a01b0316610529565b34801561098757600080fd5b506104cc6109963660046137d6565b600091825260d6602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156109cd57600080fd5b5060da546104cc9060ff1681565b3480156109e757600080fd5b5061033a54610790906001600160a01b031681565b348015610a0857600080fd5b506104f76116e8565b348015610a1d57600080fd5b5061058d610a2c3660046136cf565b6001600160a01b0316600090815260d2602052604090205490565b348015610a5357600080fd5b5061058d600081565b348015610a6857600080fd5b506104aa610a773660046139b6565b6116f7565b348015610a8857600080fd5b506104aa610a973660046136cf565b611742565b348015610aa857600080fd5b5061058d610ab73660046136cf565b611783565b348015610ac857600080fd5b506104aa610ad73660046136cf565b6117cb565b348015610ae857600080fd5b50610b56610af736600461364f565b60dd602052600090815260409020805460c982015460ca83015460cb84015460cc85015460cd86015460ce87015460cf88015460d0909801549697959694956001600160a01b0394851695938516949283169391831692908116911689565b6040516104d9999897969594939291906139e9565b348015610b7757600080fd5b506104aa610b86366004613b6a565b6117f9565b348015610b9757600080fd5b5061058d610ba6366004613828565b611831565b348015610bb757600080fd5b506104f7610bc636600461364f565b6118f8565b348015610bd757600080fd5b5061058d610be63660046136cf565b6001600160a01b0316600090815260d1602052604090205490565b348015610c0d57600080fd5b506104aa610c1c3660046137d6565b61196e565b348015610c2d57600080fd5b5061058d60d95481565b348015610c4357600080fd5b5061058d610c52366004613be9565b6001600160a01b0316600090815260d4602052604090205490565b348015610c7957600080fd5b5060d05461058d565b348015610c8e57600080fd5b5061058d6102705481565b348015610ca557600080fd5b5061058d60de5481565b348015610cbb57600080fd5b50610762610cca36600461364f565b611993565b348015610cdb57600080fd5b506104cc610cea366004613c0a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610d2457600080fd5b506104aa610d33366004613c40565b6119a3565b348015610d4457600080fd5b506104aa610d533660046136cf565b61204e565b600067ffffffffffffffff821115610d8b5760405162461bcd60e51b8152600401610d8290613cc9565b60405180910390fd5b5090565b60006001600160c01b03821115610d8b5760405162461bcd60e51b8152600401610d8290613d1b565b6000610dc381612085565b5060d85460d955565b6000610dd78261208f565b92915050565b606060008054610dec90613d41565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1890613d41565b8015610e655780601f10610e3a57610100808354040283529160200191610e65565b820191906000526020600020905b815481529060010190602001808311610e4857829003601f168201915b5050505050905090565b6000610e7a826120b4565b506000908152600460205260409020546001600160a01b031690565b6000610ea18261151c565b9050806001600160a01b0316836001600160a01b031603610ed45760405162461bcd60e51b8152600401610d8290613da9565b336001600160a01b0382161480610ef05750610ef08133610cea565b610f0c5760405162461bcd60e51b8152600401610d8290613e11565b42600760c8600654610f1e9190613519565b60c88110610f2e57610f2e613531565b015560068054906000610f4083613e21565b9190505550610f4f83836120e8565b505050565b6001600160a01b038116600090815260d16020526040902054610f895760405162461bcd60e51b8152600401610d8290613e7b565b6000610f9482611783565b905080600003610fb65760405162461bcd60e51b8152600401610d8290613ed1565b8060d06000828254610fc8919061355d565b90915550506001600160a01b038216600090815260d260205260409020805482019055610ff58282612156565b7fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0568282604051611026929190613ee1565b60405180910390a15050565b61103c33826121e9565b6110585760405162461bcd60e51b8152600401610d8290613f37565b610f4f838383612267565b600061106d613469565b600083815260dd60205260408120805460c982015460ca83015484938493849390926001909201916110a16108ee8c61151c565b60db5460405163086b806960e31b81526001600160a01b039091169063435c0348906110d1908f906004016136c1565b602060405180830381865afa1580156110ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111129190613f52565b6040805161190081019182905290869060c89082845b815481526020019060010190808311611128575050505050945095509550955095509550955091939550919395565b600082815260d6602052604090206001015461117281612085565b610f4f83836123a4565b6001600160a01b03811633146111a45760405162461bcd60e51b8152600401610d8290613fcb565b6111ae8282612446565b5050565b60006111bd81612085565b6111c56124c9565b50565b610f4f838383604051806020016040528060008152506117f9565b60006111ee81612085565b5061033955565b6101a88160c8811061120657600080fd5b015467ffffffffffffffff81169150600160401b90046001600160c01b031682565b6001600160a01b038116600090815260d1602052604090205461125d5760405162461bcd60e51b8152600401610d8290613e7b565b60006112698383611831565b90508060000361128b5760405162461bcd60e51b8152600401610d8290613ed1565b6001600160a01b038316600090815260d46020526040812080548392906112b390849061355d565b90915550506001600160a01b03808416600090815260d5602090815260408083209386168352929052208054820190556112ee838383612518565b826001600160a01b03167f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a83836040516113299291906134e8565b60405180910390a2505050565b6102718160c8811061134757600080fd5b0154905081565b606080611361635681e00b60e01b612583565b6113716316ab55a160e11b612583565b915091509091565b6000611383613469565b600061138d613469565b6000611397613488565b61139f613488565b60006006546007610270546102716113b56126f0565b60d85460408051611900810190915260df916101a8918760c88282826020028201915b8154815260200190600101908083116113d857505060408051611900810191829052949b5089935060c89250905082845b81548152602001906001019080831161140957505060408051611900810190915293985086925060c8915060009050835b8282101561148557604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b03166020808301919091529082526001909201910161143a565b505060408051611900810190915292955084915060c890506000835b828210156114ec57604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830191909152908252600190920191016114a1565b505050509150975097509750975097509750975097509091929394959697565b60078160c8811061134757600080fd5b6000818152600260205260408120546001600160a01b031680610dd75760405162461bcd60e51b8152600401610d829061400d565b611559612802565b60d95460d8541061157d5760405163d05cb60960e01b815260040160405180910390fd5b60da5461010090046001600160a01b0316336001600160a01b031614806115ae575060d7546001600160a01b031633145b6115cb5760405163ea8e4eb560e01b815260040160405180910390fd5b60d8805490819060006115dd83613e21565b9091555050600081815260dd602052604090204260c99091015561160260014361401d565b404342338460405160200161161b959493929190614058565b60408051601f198184030181529181528151602092830120600084815260dd909352912060ca01556111ae828261282c565b60006001600160a01b0382166116755760405162461bcd60e51b8152600401610d82906140e6565b506001600160a01b031660009081526003602052604090205490565b611699612846565b6116a36000612870565b565b60006116b081612085565b6111c56128c2565b600060d382815481106116cd576116cd613531565b6000918252602090912001546001600160a01b031692915050565b606060018054610dec90613d41565b80156117375742600760c860065461170f9190613519565b60c8811061171f5761171f613531565b01556006805490600061173183613e21565b91905055505b6111ae338383612905565b600061174d81612085565b5060da80546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b60008061178f60d05490565b611799904761355d565b90506117c483826117bf866001600160a01b0316600090815260d2602052604090205490565b6129a7565b9392505050565b60006117d681612085565b5060db80546001600160a01b0319166001600160a01b0392909216919091179055565b61180333836121e9565b61181f5760405162461bcd60e51b8152600401610d8290613f37565b61182b848484846129e5565b50505050565b6001600160a01b038216600081815260d460205260408082205490516370a0823160e01b8152919283926370a082319061186f903090600401613630565b602060405180830381865afa15801561188c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b09190613f52565b6118ba919061355d565b6001600160a01b03808616600090815260d560209081526040808320938816835292905220549091506118f090849083906129a7565b949350505050565b60db5460405163c87b56dd60e01b81526060916001600160a01b03169063c87b56dd906119299085906004016136c1565b600060405180830381865afa158015611946573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dd7919081019061414e565b600082815260d6602052604090206001015461198981612085565b610f4f8383612446565b60df8160c8811061120657600080fd5b336001600160a01b038216158015906119c557506001600160a01b0382163314155b15611a655761033a5460405163090c9a2d60e41b81526000916001600160a01b0316906390c9a2d090611a0090339087903090600401614189565b602060405180830381865afa158015611a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4191906141bc565b905080611a605760405162461bcd60e51b8152600401610d829061420f565b829150505b806001600160a01b0316611a788561151c565b6001600160a01b031614611a9f5760405163ea8e4eb560e01b815260040160405180910390fd5b600084815260dd60209081526040808320815161014081018352815481528251611900810193849052611b6694919391840191600184019060c89082845b815481526020019060010190808311611add57505050918352505060c9820154602082015260ca820154604082015260cb8201546001600160a01b03908116606083015260cc8301548116608083015260cd830154811660a083015260ce830154811660c083015260cf830154811660e083015260d09092015490911661010090910152612a18565b90508360ff16600103611c3757600085815260dd6020526040902060cb01546001600160a01b031615611bac57604051630c8d9eab60e31b815260040160405180910390fd5b6000611bbb8262ed4e0061355d565b905080421015611bde5760405163a4a222c360e01b815260040160405180910390fd5b611beb81621fa40061355d565b421115611c0b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cb0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600203611d0757600085815260dd6020526040902060cc01546001600160a01b031615611c7b57604051630c8d9eab60e31b815260040160405180910390fd5b6000611c8b826301da9c0061355d565b905080421015611cae5760405163a4a222c360e01b815260040160405180910390fd5b611cbb81621fa40061355d565b421115611cdb5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cc0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600303611dd757600085815260dd6020526040902060cd01546001600160a01b031615611d4b57604051630c8d9eab60e31b815260040160405180910390fd5b6000611d5b826303b5380061355d565b905080421015611d7e5760405163a4a222c360e01b815260040160405180910390fd5b611d8b81621fa40061355d565b421115611dab5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cd0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600403611ea757600085815260dd6020526040902060ce01546001600160a01b031615611e1b57604051630c8d9eab60e31b815260040160405180910390fd5b6000611e2b826309450c0061355d565b905080421015611e4e5760405163a4a222c360e01b815260040160405180910390fd5b611e5b81621fa40061355d565b421115611e7b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060ce0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600503611f7757600085815260dd6020526040902060cf01546001600160a01b031615611eeb57604051630c8d9eab60e31b815260040160405180910390fd5b6000611efb8263128a180061355d565b905080421015611f1e5760405163a4a222c360e01b815260040160405180910390fd5b611f2b81621fa40061355d565b421115611f4b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cf0180546001600160a01b0319166001600160a01b0384161790555b8360ff1660060361204757600085815260dd6020526040902060d001546001600160a01b031615611fbb57604051630c8d9eab60e31b815260040160405180910390fd5b6000611fcb82632514300061355d565b905080421015611fee5760405163a4a222c360e01b815260040160405180910390fd5b611ffb81621fa40061355d565b42111561201b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060d00180546001600160a01b0319166001600160a01b0384161790555b5050505050565b612056612846565b6001600160a01b03811661207c5760405162461bcd60e51b8152600401610d8290614260565b6111c581612870565b6111c58133612a66565b60006001600160e01b03198216637965db0b60e01b1480610dd75750610dd782612adb565b6000818152600260205260409020546001600160a01b03166111c55760405162461bcd60e51b8152600401610d829061400d565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061211d8261151c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b804710156121765760405162461bcd60e51b8152600401610d82906142a2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146121c3576040519150601f19603f3d011682016040523d82523d6000602084013e6121c8565b606091505b5050905080610f4f5760405162461bcd60e51b8152600401610d829061430a565b6000806121f58361151c565b9050806001600160a01b0316846001600160a01b0316148061223c57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806118f05750836001600160a01b031661225584610e6f565b6001600160a01b031614949350505050565b826001600160a01b031661227a8261151c565b6001600160a01b0316146122a05760405162461bcd60e51b8152600401610d829061435a565b6001600160a01b0382166122c65760405162461bcd60e51b8152600401610d82906143a9565b6122d38383836001612b2b565b826001600160a01b03166122e68261151c565b6001600160a01b03161461230c5760405162461bcd60e51b8152600401610d829061435a565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f4f8383836001612bb3565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff166111ae57600082815260d6602090815260408083206001600160a01b03851684529091529020805460ff191660011790556124023390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff16156111ae57600082815260d6602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6124d1612e09565b60d7805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161250e9190613630565b60405180910390a1565b610f4f8363a9059cbb60e01b84846040516024016125379291906134e8565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612e32565b60408051600a80825281830190925260609160009190602082018180368337019050509050600360fc1b816000815181106125c0576125c0613531565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106125ef576125ef613531565b60200101906001600160f81b031916908160001a90535060005b60048110156126e95761263a601085836004811061262957612629613531565b6126359291901a6143b9565b612ec4565b826126468360026143d8565b61265190600261355d565b8151811061266157612661613531565b60200101906001600160f81b031916908160001a90535061269b601085836004811061268f5761268f613531565b6126359291901a6143ef565b826126a78360026143d8565b6126b290600361355d565b815181106126c2576126c2613531565b60200101906001600160f81b031916908160001a9053506126e281613e21565b9050612609565b5092915050565b60008060009050600060d85467ffffffffffffffff81111561271457612714613a6f565b60405190808252806020026020018201604052801561273d578160200160208202803683370190505b50905060005b60d8548110156127fa5760006127588261151c565b90506127648382612f19565b15156000036127b2578361277781613e21565b9450508083838151811061278d5761278d613531565b60200260200101906001600160a01b031690816001600160a01b0316815250506127e7565b60008383815181106127c6576127c6613531565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50806127f281613e21565b915050612743565b509092915050565b60d754600160a01b900460ff16156116a35760405162461bcd60e51b8152600401610d829061442e565b6111ae828260405180602001604052806000815250612f7e565b60d7546001600160a01b031633146116a35760405162461bcd60e51b8152600401610d829061446e565b60d780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6128ca612802565b60d7805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586125013390565b816001600160a01b0316836001600160a01b0316036129365760405162461bcd60e51b8152600401610d82906144b0565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319061299a9085906135bb565b60405180910390a3505050565b60cf546001600160a01b038416600090815260d16020526040812054909183916129d190866143d8565b6129db91906144c0565b6118f0919061401d565b6129f0848484612267565b6129fc84848484612fb1565b61182b5760405162461bcd60e51b8152600401610d829061451e565b80516000908103612a2b57506040015190565b6020820151825160c890612a419060019061401d565b612a4b9190613519565b60c88110612a5b57612a5b613531565b602002015192915050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff166111ae57612a99816130b2565b612aa48360206130c4565b604051602001612ab5929190614550565b60408051601f198184030181529082905262461bcd60e51b8252610d829160040161361f565b60006001600160e01b031982166380ac58cd60e01b1480612b0c57506001600160e01b03198216635b5e139f60e01b145b80610dd757506301ffc9a760e01b6001600160e01b0319831614610dd7565b600181111561182b576001600160a01b03841615612b71576001600160a01b03841660009081526003602052604081208054839290612b6b90849061401d565b90915550505b6001600160a01b0383161561182b576001600160a01b03831660009081526003602052604081208054839290612ba890849061355d565b909155505050505050565b6001600160a01b0384161561182b574261027160c861027054612bd69190613519565b60c88110612be657612be6613531565b0155600082815260dd602052604090208054429160010190612c0a9060c890613519565b60c88110612c1a57612c1a613531565b0155600082815260dd60205260408120805491612c3683613e21565b90915550506102708054906000612c4c83613e21565b90915550506040805180820182526101a75467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830182905260dc546001600160a01b0316600081815260d49092528482205494516370a0823160e01b8152939492939192916370a0823190612cc4903090600401613630565b602060405180830381865afa158015612ce1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d059190613f52565b612d0f919061355d565b905081811115612e0057612d2281610d8f565b6001600160c01b031660208401526040805180820190915280612d4442610d58565b67ffffffffffffffff168152602001612d65612d60858561401d565b610d8f565b6001600160c01b0316905283516101a890612d8c9060c89067ffffffffffffffff16613519565b60c88110612d9c57612d9c613531565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff90931692909217910155825183612dd2826145b2565b67ffffffffffffffff908116909152845160208601516001600160c01b0316600160401b029116176101a755505b50505050505050565b60d754600160a01b900460ff166116a35760405162461bcd60e51b8152600401610d8290614608565b6000612e87826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661323d9092919063ffffffff16565b9050805160001480612ea8575080806020019051810190612ea891906141bc565b610f4f5760405162461bcd60e51b8152600401610d829061465d565b600060098260ff1611612ee557612edc82603061466d565b60f81b92915050565b8160ff16600a11158015612efd5750600f8260ff1611155b1561049057600a612f0f83606161466d565b612edc919061468a565b6000805b8351811015612f7457826001600160a01b0316848281518110612f4257612f42613531565b60200260200101516001600160a01b031603612f62576001915050610dd7565b80612f6c81613e21565b915050612f1d565b5060009392505050565b612f88838361324c565b612f956000848484612fb1565b610f4f5760405162461bcd60e51b8152600401610d829061451e565b60006001600160a01b0384163b156130a757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612ff59033908990889088906004016146a7565b6020604051808303816000875af1925050508015613030575060408051601f3d908101601f1916820190925261302d918101906146f6565b60015b61308d573d80801561305e576040519150601f19603f3d011682016040523d82523d6000602084013e613063565b606091505b5080516000036130855760405162461bcd60e51b8152600401610d829061451e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506118f0565b506001949350505050565b6060610dd76001600160a01b03831660145b606060006130d38360026143d8565b6130de90600261355d565b67ffffffffffffffff8111156130f6576130f6613a6f565b6040519080825280601f01601f191660200182016040528015613120576020820181803683370190505b509050600360fc1b8160008151811061313b5761313b613531565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061316a5761316a613531565b60200101906001600160f81b031916908160001a905350600061318e8460026143d8565b61319990600161355d565b90505b600181111561321e577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106131da576131da613531565b1a60f81b8282815181106131f0576131f0613531565b60200101906001600160f81b031916908160001a90535060049490941c9361321781614717565b905061319c565b5083156117c45760405162461bcd60e51b8152600401610d829061475e565b60606118f0848460008561335f565b6001600160a01b0382166132725760405162461bcd60e51b8152600401610d829061479e565b6000818152600260205260409020546001600160a01b0316156132a75760405162461bcd60e51b8152600401610d82906147e0565b6132b5600083836001612b2b565b6000818152600260205260409020546001600160a01b0316156132ea5760405162461bcd60e51b8152600401610d82906147e0565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46111ae600083836001612bb3565b6060824710156133815760405162461bcd60e51b8152600401610d8290614831565b600080866001600160a01b0316858760405161339d9190614841565b60006040518083038185875af1925050503d80600081146133da576040519150601f19603f3d011682016040523d82523d6000602084013e6133df565b606091505b50915091506133f0878383876133fb565b979650505050505050565b6060831561343a578251600003613433576001600160a01b0385163b6134335760405162461bcd60e51b8152600401610d829061487d565b50816118f0565b6118f0838381511561344f5781518083602001fd5b8060405162461bcd60e51b8152600401610d82919061361f565b60405180611900016040528060c8906020820280368337509192915050565b60405180611900016040528060c8905b60408051808201909152600080825260208201528152602001906001900390816134985790505090565b60006001600160a01b038216610dd7565b6134dc816134c2565b82525050565b806134dc565b604081016134f682856134d3565b6117c460208301846134e2565b634e487b7160e01b600052601260045260246000fd5b815b915060008261352c5761352c613503565b500690565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610dd757610dd7613547565b6001600160e01b031981165b81146111c557600080fd5b8035610dd781613570565b6000602082840312156135a7576135a7600080fd5b60006118f08484613587565b8015156134dc565b60208101610dd782846135b3565b60005b838110156135e45781810151838201526020016135cc565b50506000910152565b60006135f7825190565b80845260208401935061360e8185602086016135c9565b601f01601f19169290920192915050565b602080825281016117c481846135ed565b60208101610dd782846134d3565b8061357c565b8035610dd78161363e565b60006020828403121561366457613664600080fd5b60006118f08484613644565b61357c816134c2565b8035610dd781613670565b6000806040838503121561369a5761369a600080fd5b60006136a68585613679565b92505060206136b785828601613644565b9150509250929050565b60208101610dd782846134e2565b6000602082840312156136e4576136e4600080fd5b60006118f08484613679565b60008060006060848603121561370857613708600080fd5b60006137148686613679565b935050602061372586828701613679565b925050604061373686828701613644565b9150509250925092565b61374a82826134e2565b5060200190565b60200190565b60c88160005b828110156120475781516137718682613740565b95505060208201915060010161375d565b6119a0810161379182896134e2565b61379e6020830188613757565b6137ac6119208301876134e2565b6137ba6119408301866134e2565b6137c86119608301856134e2565b6133f06119808301846134e2565b600080604083850312156137ec576137ec600080fd5b60006137f88585613644565b92505060206136b785828601613679565b6000610dd7826134c2565b61357c81613809565b8035610dd781613814565b6000806040838503121561383e5761383e600080fd5b60006137f8858561381d565b67ffffffffffffffff81166134dc565b6001600160c01b0381166134dc565b60408101613877828561384a565b6117c4602083018461385a565b6000610dd782613809565b6134dc81613884565b60208101610dd7828461388f565b604080825281016138b781856135ed565b905081810360208301526118f081846135ed565b80516138d7838261384a565b506020810151610f4f602084018261385a565b6138f482826138cb565b5060400190565b60c88160005b8281101561204757815161391586826138ea565b955050602082019150600101613901565b6196808101613935828b6134e2565b613942602083018a613757565b6139506119208301896134e2565b61395e611940830188613757565b61396c6132408301876134e2565b61397a6132608301866138fb565b6139886164608301856138fb565b6139966196608301846134e2565b9998505050505050505050565b80151561357c565b8035610dd7816139a3565b600080604083850312156139cc576139cc600080fd5b60006139d88585613679565b92505060206136b7858286016139ab565b61012081016139f8828c6134e2565b613a05602083018b6134e2565b613a12604083018a6134e2565b613a1f60608301896134d3565b613a2c60808301886134d3565b613a3960a08301876134d3565b613a4660c08301866134d3565b613a5360e08301856134d3565b613a616101008301846134d3565b9a9950505050505050505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715613aab57613aab613a6f565b6040525050565b6000613abd60405190565b9050613ac98282613a85565b919050565b600067ffffffffffffffff821115613ae857613ae8613a6f565b601f19601f83011660200192915050565b82818337506000910152565b6000613b18613b1384613ace565b613ab2565b905082815260208101848484011115613b3357613b33600080fd5b613b3e848285613af9565b509392505050565b600082601f830112613b5a57613b5a600080fd5b81356118f0848260208601613b05565b60008060008060808587031215613b8357613b83600080fd5b6000613b8f8787613679565b9450506020613ba087828801613679565b9350506040613bb187828801613644565b925050606085013567ffffffffffffffff811115613bd157613bd1600080fd5b613bdd87828801613b46565b91505092959194509250565b600060208284031215613bfe57613bfe600080fd5b60006118f0848461381d565b60008060408385031215613c2057613c20600080fd5b60006137f88585613679565b60ff811661357c565b8035610dd781613c2c565b600080600060608486031215613c5857613c58600080fd5b6000613c648686613644565b9350506020613c7586828701613c35565b925050604061373686828701613679565b60268152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e203681526534206269747360d01b602082015290505b60400190565b60208082528101610dd781613c86565b60278152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e20318152663932206269747360c81b60208201529050613cc3565b60208082528101610dd781613cd9565b634e487b7160e01b600052602260045260246000fd5b600281046001821680613d5557607f821691505b602082108103613d6757613d67613d2b565b50919050565b60218152602081017f4552433732313a20617070726f76616c20746f2063757272656e74206f776e658152603960f91b60208201529050613cc3565b60208082528101610dd781613d6d565b603d8152602081017f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f81527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060208201529050613cc3565b60208082528101610dd781613db9565b600060018201613e3357613e33613547565b5060010190565b60268152602081017f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2081526573686172657360d01b60208201529050613cc3565b60208082528101610dd781613e3a565b602b8152602081017f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742081526a191d59481c185e5b595b9d60aa1b60208201529050613cc3565b60208082528101610dd781613e8b565b604081016134f6828561388f565b602d8152602081017f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6581526c1c881bdc88185c1c1c9bdd9959609a1b60208201529050613cc3565b60208082528101610dd781613eef565b8051610dd78161363e565b600060208284031215613f6757613f67600080fd5b60006118f08484613f47565b602f8152602081017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581527f20726f6c657320666f722073656c66000000000000000000000000000000000060208201529050613cc3565b60208082528101610dd781613f73565b60188152602081017f4552433732313a20696e76616c696420746f6b656e204944000000000000000081529050613751565b60208082528101610dd781613fdb565b81810381811115610dd757610dd7613547565b6000610dd78260601b90565b6000610dd782614030565b6134dc614053826134c2565b61403c565b61406281876134e2565b60200161406f81866134e2565b60200161407c81856134e2565b6020016140898184614047565b60140161409681836134e2565b60200195945050505050565b60298152602081017f4552433732313a2061646472657373207a65726f206973206e6f7420612076618152683634b21037bbb732b960b91b60208201529050613cc3565b60208082528101610dd7816140a2565b6000614104613b1384613ace565b90508281526020810184848401111561411f5761411f600080fd5b613b3e8482856135c9565b600082601f83011261413e5761413e600080fd5b81516118f08482602086016140f6565b60006020828403121561416357614163600080fd5b815167ffffffffffffffff81111561417d5761417d600080fd5b6118f08482850161412a565b6060810161419782866134d3565b6141a460208301856134d3565b6118f060408301846134d3565b8051610dd7816139a3565b6000602082840312156141d1576141d1600080fd5b60006118f084846141b1565b601e8152602081017f696e76616c69642064656c65676174652d7661756c742070616972696e67000081529050613751565b60208082528101610dd7816141dd565b60268152602081017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b60208201529050613cc3565b60208082528101610dd78161421f565b601d8152602081017f416464726573733a20696e73756666696369656e742062616c616e636500000081529050613751565b60208082528101610dd781614270565b603a8152602081017f416464726573733a20756e61626c6520746f2073656e642076616c75652c207281527f6563697069656e74206d6179206861766520726576657274656400000000000060208201529050613cc3565b60208082528101610dd7816142b2565b60258152602081017f4552433732313a207472616e736665722066726f6d20696e636f72726563742081526437bbb732b960d91b60208201529050613cc3565b60208082528101610dd78161431a565b60248152602081017f4552433732313a207472616e7366657220746f20746865207a65726f206164648152637265737360e01b60208201529050613cc3565b60208082528101610dd78161436a565b60ff9081169082165b91506000826143d3576143d3613503565b500490565b8181028115828204841417610dd757610dd7613547565b60ff90811690821661351b565b60108152602081017f5061757361626c653a207061757365640000000000000000000000000000000081529050613751565b60208082528101610dd7816143fc565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65729101908152613751565b60208082528101610dd78161443e565b60198152602081017f4552433732313a20617070726f766520746f2063616c6c65720000000000000081529050613751565b60208082528101610dd78161447e565b816143c2565b60328152602081017f4552433732313a207472616e7366657220746f206e6f6e20455243373231526581527f63656976657220696d706c656d656e746572000000000000000000000000000060208201529050613cc3565b60208082528101610dd7816144c6565b6000614538825190565b6145468185602086016135c9565b9290920192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152601701614580818461452e565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190506117c4818361452e565b67ffffffffffffffff16600067fffffffffffffffe198201613e3357613e33613547565b60148152602081017f5061757361626c653a206e6f742070617573656400000000000000000000000081529050613751565b60208082528101610dd7816145d6565b602a8152602081017f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b60208201529050613cc3565b60208082528101610dd781614618565b60ff918216919081169082820190811115610dd757610dd7613547565b60ff918216919081169082820390811115610dd757610dd7613547565b608081016146b582876134d3565b6146c260208301866134d3565b6146cf60408301856134e2565b81810360608301526146e181846135ed565b9695505050505050565b8051610dd781613570565b60006020828403121561470b5761470b600080fd5b60006118f084846146eb565b60008161472657614726613547565b506000190190565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e749101908152613751565b60208082528101610dd78161472e565b60208082527f4552433732313a206d696e7420746f20746865207a65726f20616464726573739101908152613751565b60208082528101610dd78161476e565b601c8152602081017f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000081529050613751565b60208082528101610dd7816147ae565b60268152602081017f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b60208201529050613cc3565b60208082528101610dd7816147f0565b610dd7818361452e565b601d8152602081017f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081529050613751565b60208082528101610dd78161484b56fea26469706673582212201adf8fd43f92f099a49ca9121d1a45cee2a416cf8c089020dd1336fe1afc5d1564736f6c6343000811003300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000220000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000dc49b9d7de7b1b4d6d153d9857b3942dc4baddfa00000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000076a84fef008cdabe6409d2fe638b0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000b28b71c694f53c7cfea8dffdc85733237e0c981e00000000000000000000000065c7432e6662a96f4e999603991d5e929e57f60a000000000000000000000000134309c4cf57bfa43ef66bf20bd0eeccdeb2d80c00000000000000000000000006cb0a03c2518873befc6bc257cbf4c438d14b4a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000100000000000000000000000020ec68ba5dc8af5380bdb37465b3f9bde75f9635

Deployed Bytecode

0x6080604052600436106103b15760003560e01c806370a08231116101e7578063a556f60f1161010d578063d79779b2116100a0578063e6a8efb91161006f578063e6a8efb914610caf578063e985e9c514610ccf578063f0cdc1de14610d18578063f2fde38b14610d3857600080fd5b8063d79779b214610c37578063e33b7de314610c6d578063e3d33fc914610c82578063e41a131714610c9957600080fd5b8063c87b56dd116100dc578063c87b56dd14610bab578063ce7c2ac214610bcb578063d547741f14610c01578063d5abeb0114610c2157600080fd5b8063a556f60f14610abc578063b4b5b48f14610adc578063b88d4fde14610b6b578063c45ac05014610b8b57600080fd5b8063943eb50411610185578063a217fddf11610154578063a217fddf14610a47578063a22cb46514610a5c578063a3106b9514610a7c578063a3f8eace14610a9c57600080fd5b8063943eb504146109c157806394856295146109db57806395d89b41146109fc5780639852595c14610a1157600080fd5b80638ada6b0f116101c15780638ada6b0f1461091d5780638b83209b1461093d5780638da5cb5b1461095d57806391d148541461097b57600080fd5b806370a08231146108d3578063715018a6146108f35780638456cb591461090857600080fd5b80633f4ba83a116102d75780634b503f0b1161026a5780636352211e116102395780636352211e146108685780636884d0a6146108885780636a6278421461089e5780636c41808a146108be57600080fd5b80634b503f0b146107dd5780635681e00b14610800578063568e0eac146108295780635c975abb1461084957600080fd5b806346c4d346116102a657806346c4d346146107425780634780eac11461077057806348b750441461079d5780634976bddb146107bd57600080fd5b80633f4ba83a146106a7578063406072a9146106bc57806342842e0e1461070257806344a0c8a11461072257600080fd5b806318160ddd1161034f5780632d56ab421161031e5780632d56ab42146106205780632f2ff15d1461065257806336568abe146106725780633a98ef391461069257600080fd5b806318160ddd1461059a57806319165587146105b057806323b872dd146105d0578063248a9ca3146105f057600080fd5b8063075461721161038b5780630754617214610504578063081812fc14610536578063095ea7b31461055657806313cf2f4f1461057657600080fd5b8063017043a51461049557806301ffc9a7146104ac57806306fdde03146104e257600080fd5b36610490577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033346040516103e79291906134e8565b60405180910390a1604051806040016040528061040342610d58565b67ffffffffffffffff16815260200161041b34610d8f565b6001600160c01b031681525060df60c860de546104389190613519565b60c8811061044857610448613531565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff9093169290921791015560de80546001919060009061048890849061355d565b925050819055005b600080fd5b3480156104a157600080fd5b506104aa610db8565b005b3480156104b857600080fd5b506104cc6104c7366004613592565b610dcc565b6040516104d991906135bb565b60405180910390f35b3480156104ee57600080fd5b506104f7610ddd565b6040516104d9919061361f565b34801561051057600080fd5b5060da546105299061010090046001600160a01b031681565b6040516104d99190613630565b34801561054257600080fd5b5061052961055136600461364f565b610e6f565b34801561056257600080fd5b506104aa610571366004613684565b610e96565b34801561058257600080fd5b5061058d6103395481565b6040516104d991906136c1565b3480156105a657600080fd5b5061058d60d85481565b3480156105bc57600080fd5b506104aa6105cb3660046136cf565b610f54565b3480156105dc57600080fd5b506104aa6105eb3660046136f0565b611032565b3480156105fc57600080fd5b5061058d61060b36600461364f565b600090815260d6602052604090206001015490565b34801561062c57600080fd5b5061064061063b36600461364f565b611063565b6040516104d996959493929190613782565b34801561065e57600080fd5b506104aa61066d3660046137d6565b611157565b34801561067e57600080fd5b506104aa61068d3660046137d6565b61117c565b34801561069e57600080fd5b5060cf5461058d565b3480156106b357600080fd5b506104aa6111b2565b3480156106c857600080fd5b5061058d6106d7366004613828565b6001600160a01b03918216600090815260d56020908152604080832093909416825291909152205490565b34801561070e57600080fd5b506104aa61071d3660046136f0565b6111c8565b34801561072e57600080fd5b506104aa61073d36600461364f565b6111e3565b34801561074e57600080fd5b5061076261075d36600461364f565b6111f5565b6040516104d9929190613869565b34801561077c57600080fd5b5060dc54610790906001600160a01b031681565b6040516104d99190613898565b3480156107a957600080fd5b506104aa6107b8366004613828565b611228565b3480156107c957600080fd5b5061058d6107d836600461364f565b611336565b3480156107e957600080fd5b506107f261134e565b6040516104d99291906138a6565b34801561080c57600080fd5b50610815611379565b6040516104d9989796959493929190613926565b34801561083557600080fd5b5061058d61084436600461364f565b61150c565b34801561085557600080fd5b5060d754600160a01b900460ff166104cc565b34801561087457600080fd5b5061052961088336600461364f565b61151c565b34801561089457600080fd5b5061058d60065481565b3480156108aa57600080fd5b506104aa6108b93660046136cf565b611551565b3480156108ca57600080fd5b5061058d60c881565b3480156108df57600080fd5b5061058d6108ee3660046136cf565b61164d565b3480156108ff57600080fd5b506104aa611691565b34801561091457600080fd5b506104aa6116a5565b34801561092957600080fd5b5060db54610790906001600160a01b031681565b34801561094957600080fd5b5061052961095836600461364f565b6116b8565b34801561096957600080fd5b5060d7546001600160a01b0316610529565b34801561098757600080fd5b506104cc6109963660046137d6565b600091825260d6602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156109cd57600080fd5b5060da546104cc9060ff1681565b3480156109e757600080fd5b5061033a54610790906001600160a01b031681565b348015610a0857600080fd5b506104f76116e8565b348015610a1d57600080fd5b5061058d610a2c3660046136cf565b6001600160a01b0316600090815260d2602052604090205490565b348015610a5357600080fd5b5061058d600081565b348015610a6857600080fd5b506104aa610a773660046139b6565b6116f7565b348015610a8857600080fd5b506104aa610a973660046136cf565b611742565b348015610aa857600080fd5b5061058d610ab73660046136cf565b611783565b348015610ac857600080fd5b506104aa610ad73660046136cf565b6117cb565b348015610ae857600080fd5b50610b56610af736600461364f565b60dd602052600090815260409020805460c982015460ca83015460cb84015460cc85015460cd86015460ce87015460cf88015460d0909801549697959694956001600160a01b0394851695938516949283169391831692908116911689565b6040516104d9999897969594939291906139e9565b348015610b7757600080fd5b506104aa610b86366004613b6a565b6117f9565b348015610b9757600080fd5b5061058d610ba6366004613828565b611831565b348015610bb757600080fd5b506104f7610bc636600461364f565b6118f8565b348015610bd757600080fd5b5061058d610be63660046136cf565b6001600160a01b0316600090815260d1602052604090205490565b348015610c0d57600080fd5b506104aa610c1c3660046137d6565b61196e565b348015610c2d57600080fd5b5061058d60d95481565b348015610c4357600080fd5b5061058d610c52366004613be9565b6001600160a01b0316600090815260d4602052604090205490565b348015610c7957600080fd5b5060d05461058d565b348015610c8e57600080fd5b5061058d6102705481565b348015610ca557600080fd5b5061058d60de5481565b348015610cbb57600080fd5b50610762610cca36600461364f565b611993565b348015610cdb57600080fd5b506104cc610cea366004613c0a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610d2457600080fd5b506104aa610d33366004613c40565b6119a3565b348015610d4457600080fd5b506104aa610d533660046136cf565b61204e565b600067ffffffffffffffff821115610d8b5760405162461bcd60e51b8152600401610d8290613cc9565b60405180910390fd5b5090565b60006001600160c01b03821115610d8b5760405162461bcd60e51b8152600401610d8290613d1b565b6000610dc381612085565b5060d85460d955565b6000610dd78261208f565b92915050565b606060008054610dec90613d41565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1890613d41565b8015610e655780601f10610e3a57610100808354040283529160200191610e65565b820191906000526020600020905b815481529060010190602001808311610e4857829003601f168201915b5050505050905090565b6000610e7a826120b4565b506000908152600460205260409020546001600160a01b031690565b6000610ea18261151c565b9050806001600160a01b0316836001600160a01b031603610ed45760405162461bcd60e51b8152600401610d8290613da9565b336001600160a01b0382161480610ef05750610ef08133610cea565b610f0c5760405162461bcd60e51b8152600401610d8290613e11565b42600760c8600654610f1e9190613519565b60c88110610f2e57610f2e613531565b015560068054906000610f4083613e21565b9190505550610f4f83836120e8565b505050565b6001600160a01b038116600090815260d16020526040902054610f895760405162461bcd60e51b8152600401610d8290613e7b565b6000610f9482611783565b905080600003610fb65760405162461bcd60e51b8152600401610d8290613ed1565b8060d06000828254610fc8919061355d565b90915550506001600160a01b038216600090815260d260205260409020805482019055610ff58282612156565b7fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0568282604051611026929190613ee1565b60405180910390a15050565b61103c33826121e9565b6110585760405162461bcd60e51b8152600401610d8290613f37565b610f4f838383612267565b600061106d613469565b600083815260dd60205260408120805460c982015460ca83015484938493849390926001909201916110a16108ee8c61151c565b60db5460405163086b806960e31b81526001600160a01b039091169063435c0348906110d1908f906004016136c1565b602060405180830381865afa1580156110ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111129190613f52565b6040805161190081019182905290869060c89082845b815481526020019060010190808311611128575050505050945095509550955095509550955091939550919395565b600082815260d6602052604090206001015461117281612085565b610f4f83836123a4565b6001600160a01b03811633146111a45760405162461bcd60e51b8152600401610d8290613fcb565b6111ae8282612446565b5050565b60006111bd81612085565b6111c56124c9565b50565b610f4f838383604051806020016040528060008152506117f9565b60006111ee81612085565b5061033955565b6101a88160c8811061120657600080fd5b015467ffffffffffffffff81169150600160401b90046001600160c01b031682565b6001600160a01b038116600090815260d1602052604090205461125d5760405162461bcd60e51b8152600401610d8290613e7b565b60006112698383611831565b90508060000361128b5760405162461bcd60e51b8152600401610d8290613ed1565b6001600160a01b038316600090815260d46020526040812080548392906112b390849061355d565b90915550506001600160a01b03808416600090815260d5602090815260408083209386168352929052208054820190556112ee838383612518565b826001600160a01b03167f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a83836040516113299291906134e8565b60405180910390a2505050565b6102718160c8811061134757600080fd5b0154905081565b606080611361635681e00b60e01b612583565b6113716316ab55a160e11b612583565b915091509091565b6000611383613469565b600061138d613469565b6000611397613488565b61139f613488565b60006006546007610270546102716113b56126f0565b60d85460408051611900810190915260df916101a8918760c88282826020028201915b8154815260200190600101908083116113d857505060408051611900810191829052949b5089935060c89250905082845b81548152602001906001019080831161140957505060408051611900810190915293985086925060c8915060009050835b8282101561148557604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b03166020808301919091529082526001909201910161143a565b505060408051611900810190915292955084915060c890506000835b828210156114ec57604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830191909152908252600190920191016114a1565b505050509150975097509750975097509750975097509091929394959697565b60078160c8811061134757600080fd5b6000818152600260205260408120546001600160a01b031680610dd75760405162461bcd60e51b8152600401610d829061400d565b611559612802565b60d95460d8541061157d5760405163d05cb60960e01b815260040160405180910390fd5b60da5461010090046001600160a01b0316336001600160a01b031614806115ae575060d7546001600160a01b031633145b6115cb5760405163ea8e4eb560e01b815260040160405180910390fd5b60d8805490819060006115dd83613e21565b9091555050600081815260dd602052604090204260c99091015561160260014361401d565b404342338460405160200161161b959493929190614058565b60408051601f198184030181529181528151602092830120600084815260dd909352912060ca01556111ae828261282c565b60006001600160a01b0382166116755760405162461bcd60e51b8152600401610d82906140e6565b506001600160a01b031660009081526003602052604090205490565b611699612846565b6116a36000612870565b565b60006116b081612085565b6111c56128c2565b600060d382815481106116cd576116cd613531565b6000918252602090912001546001600160a01b031692915050565b606060018054610dec90613d41565b80156117375742600760c860065461170f9190613519565b60c8811061171f5761171f613531565b01556006805490600061173183613e21565b91905055505b6111ae338383612905565b600061174d81612085565b5060da80546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b60008061178f60d05490565b611799904761355d565b90506117c483826117bf866001600160a01b0316600090815260d2602052604090205490565b6129a7565b9392505050565b60006117d681612085565b5060db80546001600160a01b0319166001600160a01b0392909216919091179055565b61180333836121e9565b61181f5760405162461bcd60e51b8152600401610d8290613f37565b61182b848484846129e5565b50505050565b6001600160a01b038216600081815260d460205260408082205490516370a0823160e01b8152919283926370a082319061186f903090600401613630565b602060405180830381865afa15801561188c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b09190613f52565b6118ba919061355d565b6001600160a01b03808616600090815260d560209081526040808320938816835292905220549091506118f090849083906129a7565b949350505050565b60db5460405163c87b56dd60e01b81526060916001600160a01b03169063c87b56dd906119299085906004016136c1565b600060405180830381865afa158015611946573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dd7919081019061414e565b600082815260d6602052604090206001015461198981612085565b610f4f8383612446565b60df8160c8811061120657600080fd5b336001600160a01b038216158015906119c557506001600160a01b0382163314155b15611a655761033a5460405163090c9a2d60e41b81526000916001600160a01b0316906390c9a2d090611a0090339087903090600401614189565b602060405180830381865afa158015611a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4191906141bc565b905080611a605760405162461bcd60e51b8152600401610d829061420f565b829150505b806001600160a01b0316611a788561151c565b6001600160a01b031614611a9f5760405163ea8e4eb560e01b815260040160405180910390fd5b600084815260dd60209081526040808320815161014081018352815481528251611900810193849052611b6694919391840191600184019060c89082845b815481526020019060010190808311611add57505050918352505060c9820154602082015260ca820154604082015260cb8201546001600160a01b03908116606083015260cc8301548116608083015260cd830154811660a083015260ce830154811660c083015260cf830154811660e083015260d09092015490911661010090910152612a18565b90508360ff16600103611c3757600085815260dd6020526040902060cb01546001600160a01b031615611bac57604051630c8d9eab60e31b815260040160405180910390fd5b6000611bbb8262ed4e0061355d565b905080421015611bde5760405163a4a222c360e01b815260040160405180910390fd5b611beb81621fa40061355d565b421115611c0b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cb0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600203611d0757600085815260dd6020526040902060cc01546001600160a01b031615611c7b57604051630c8d9eab60e31b815260040160405180910390fd5b6000611c8b826301da9c0061355d565b905080421015611cae5760405163a4a222c360e01b815260040160405180910390fd5b611cbb81621fa40061355d565b421115611cdb5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cc0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600303611dd757600085815260dd6020526040902060cd01546001600160a01b031615611d4b57604051630c8d9eab60e31b815260040160405180910390fd5b6000611d5b826303b5380061355d565b905080421015611d7e5760405163a4a222c360e01b815260040160405180910390fd5b611d8b81621fa40061355d565b421115611dab5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cd0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600403611ea757600085815260dd6020526040902060ce01546001600160a01b031615611e1b57604051630c8d9eab60e31b815260040160405180910390fd5b6000611e2b826309450c0061355d565b905080421015611e4e5760405163a4a222c360e01b815260040160405180910390fd5b611e5b81621fa40061355d565b421115611e7b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060ce0180546001600160a01b0319166001600160a01b0384161790555b8360ff16600503611f7757600085815260dd6020526040902060cf01546001600160a01b031615611eeb57604051630c8d9eab60e31b815260040160405180910390fd5b6000611efb8263128a180061355d565b905080421015611f1e5760405163a4a222c360e01b815260040160405180910390fd5b611f2b81621fa40061355d565b421115611f4b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060cf0180546001600160a01b0319166001600160a01b0384161790555b8360ff1660060361204757600085815260dd6020526040902060d001546001600160a01b031615611fbb57604051630c8d9eab60e31b815260040160405180910390fd5b6000611fcb82632514300061355d565b905080421015611fee5760405163a4a222c360e01b815260040160405180910390fd5b611ffb81621fa40061355d565b42111561201b5760405163256b87c360e21b815260040160405180910390fd5b50600085815260dd6020526040902060d00180546001600160a01b0319166001600160a01b0384161790555b5050505050565b612056612846565b6001600160a01b03811661207c5760405162461bcd60e51b8152600401610d8290614260565b6111c581612870565b6111c58133612a66565b60006001600160e01b03198216637965db0b60e01b1480610dd75750610dd782612adb565b6000818152600260205260409020546001600160a01b03166111c55760405162461bcd60e51b8152600401610d829061400d565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061211d8261151c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b804710156121765760405162461bcd60e51b8152600401610d82906142a2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146121c3576040519150601f19603f3d011682016040523d82523d6000602084013e6121c8565b606091505b5050905080610f4f5760405162461bcd60e51b8152600401610d829061430a565b6000806121f58361151c565b9050806001600160a01b0316846001600160a01b0316148061223c57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806118f05750836001600160a01b031661225584610e6f565b6001600160a01b031614949350505050565b826001600160a01b031661227a8261151c565b6001600160a01b0316146122a05760405162461bcd60e51b8152600401610d829061435a565b6001600160a01b0382166122c65760405162461bcd60e51b8152600401610d82906143a9565b6122d38383836001612b2b565b826001600160a01b03166122e68261151c565b6001600160a01b03161461230c5760405162461bcd60e51b8152600401610d829061435a565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f4f8383836001612bb3565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff166111ae57600082815260d6602090815260408083206001600160a01b03851684529091529020805460ff191660011790556124023390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff16156111ae57600082815260d6602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6124d1612e09565b60d7805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161250e9190613630565b60405180910390a1565b610f4f8363a9059cbb60e01b84846040516024016125379291906134e8565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612e32565b60408051600a80825281830190925260609160009190602082018180368337019050509050600360fc1b816000815181106125c0576125c0613531565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106125ef576125ef613531565b60200101906001600160f81b031916908160001a90535060005b60048110156126e95761263a601085836004811061262957612629613531565b6126359291901a6143b9565b612ec4565b826126468360026143d8565b61265190600261355d565b8151811061266157612661613531565b60200101906001600160f81b031916908160001a90535061269b601085836004811061268f5761268f613531565b6126359291901a6143ef565b826126a78360026143d8565b6126b290600361355d565b815181106126c2576126c2613531565b60200101906001600160f81b031916908160001a9053506126e281613e21565b9050612609565b5092915050565b60008060009050600060d85467ffffffffffffffff81111561271457612714613a6f565b60405190808252806020026020018201604052801561273d578160200160208202803683370190505b50905060005b60d8548110156127fa5760006127588261151c565b90506127648382612f19565b15156000036127b2578361277781613e21565b9450508083838151811061278d5761278d613531565b60200260200101906001600160a01b031690816001600160a01b0316815250506127e7565b60008383815181106127c6576127c6613531565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50806127f281613e21565b915050612743565b509092915050565b60d754600160a01b900460ff16156116a35760405162461bcd60e51b8152600401610d829061442e565b6111ae828260405180602001604052806000815250612f7e565b60d7546001600160a01b031633146116a35760405162461bcd60e51b8152600401610d829061446e565b60d780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6128ca612802565b60d7805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586125013390565b816001600160a01b0316836001600160a01b0316036129365760405162461bcd60e51b8152600401610d82906144b0565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319061299a9085906135bb565b60405180910390a3505050565b60cf546001600160a01b038416600090815260d16020526040812054909183916129d190866143d8565b6129db91906144c0565b6118f0919061401d565b6129f0848484612267565b6129fc84848484612fb1565b61182b5760405162461bcd60e51b8152600401610d829061451e565b80516000908103612a2b57506040015190565b6020820151825160c890612a419060019061401d565b612a4b9190613519565b60c88110612a5b57612a5b613531565b602002015192915050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff166111ae57612a99816130b2565b612aa48360206130c4565b604051602001612ab5929190614550565b60408051601f198184030181529082905262461bcd60e51b8252610d829160040161361f565b60006001600160e01b031982166380ac58cd60e01b1480612b0c57506001600160e01b03198216635b5e139f60e01b145b80610dd757506301ffc9a760e01b6001600160e01b0319831614610dd7565b600181111561182b576001600160a01b03841615612b71576001600160a01b03841660009081526003602052604081208054839290612b6b90849061401d565b90915550505b6001600160a01b0383161561182b576001600160a01b03831660009081526003602052604081208054839290612ba890849061355d565b909155505050505050565b6001600160a01b0384161561182b574261027160c861027054612bd69190613519565b60c88110612be657612be6613531565b0155600082815260dd602052604090208054429160010190612c0a9060c890613519565b60c88110612c1a57612c1a613531565b0155600082815260dd60205260408120805491612c3683613e21565b90915550506102708054906000612c4c83613e21565b90915550506040805180820182526101a75467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830182905260dc546001600160a01b0316600081815260d49092528482205494516370a0823160e01b8152939492939192916370a0823190612cc4903090600401613630565b602060405180830381865afa158015612ce1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d059190613f52565b612d0f919061355d565b905081811115612e0057612d2281610d8f565b6001600160c01b031660208401526040805180820190915280612d4442610d58565b67ffffffffffffffff168152602001612d65612d60858561401d565b610d8f565b6001600160c01b0316905283516101a890612d8c9060c89067ffffffffffffffff16613519565b60c88110612d9c57612d9c613531565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff90931692909217910155825183612dd2826145b2565b67ffffffffffffffff908116909152845160208601516001600160c01b0316600160401b029116176101a755505b50505050505050565b60d754600160a01b900460ff166116a35760405162461bcd60e51b8152600401610d8290614608565b6000612e87826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661323d9092919063ffffffff16565b9050805160001480612ea8575080806020019051810190612ea891906141bc565b610f4f5760405162461bcd60e51b8152600401610d829061465d565b600060098260ff1611612ee557612edc82603061466d565b60f81b92915050565b8160ff16600a11158015612efd5750600f8260ff1611155b1561049057600a612f0f83606161466d565b612edc919061468a565b6000805b8351811015612f7457826001600160a01b0316848281518110612f4257612f42613531565b60200260200101516001600160a01b031603612f62576001915050610dd7565b80612f6c81613e21565b915050612f1d565b5060009392505050565b612f88838361324c565b612f956000848484612fb1565b610f4f5760405162461bcd60e51b8152600401610d829061451e565b60006001600160a01b0384163b156130a757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612ff59033908990889088906004016146a7565b6020604051808303816000875af1925050508015613030575060408051601f3d908101601f1916820190925261302d918101906146f6565b60015b61308d573d80801561305e576040519150601f19603f3d011682016040523d82523d6000602084013e613063565b606091505b5080516000036130855760405162461bcd60e51b8152600401610d829061451e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506118f0565b506001949350505050565b6060610dd76001600160a01b03831660145b606060006130d38360026143d8565b6130de90600261355d565b67ffffffffffffffff8111156130f6576130f6613a6f565b6040519080825280601f01601f191660200182016040528015613120576020820181803683370190505b509050600360fc1b8160008151811061313b5761313b613531565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061316a5761316a613531565b60200101906001600160f81b031916908160001a905350600061318e8460026143d8565b61319990600161355d565b90505b600181111561321e577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106131da576131da613531565b1a60f81b8282815181106131f0576131f0613531565b60200101906001600160f81b031916908160001a90535060049490941c9361321781614717565b905061319c565b5083156117c45760405162461bcd60e51b8152600401610d829061475e565b60606118f0848460008561335f565b6001600160a01b0382166132725760405162461bcd60e51b8152600401610d829061479e565b6000818152600260205260409020546001600160a01b0316156132a75760405162461bcd60e51b8152600401610d82906147e0565b6132b5600083836001612b2b565b6000818152600260205260409020546001600160a01b0316156132ea5760405162461bcd60e51b8152600401610d82906147e0565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46111ae600083836001612bb3565b6060824710156133815760405162461bcd60e51b8152600401610d8290614831565b600080866001600160a01b0316858760405161339d9190614841565b60006040518083038185875af1925050503d80600081146133da576040519150601f19603f3d011682016040523d82523d6000602084013e6133df565b606091505b50915091506133f0878383876133fb565b979650505050505050565b6060831561343a578251600003613433576001600160a01b0385163b6134335760405162461bcd60e51b8152600401610d829061487d565b50816118f0565b6118f0838381511561344f5781518083602001fd5b8060405162461bcd60e51b8152600401610d82919061361f565b60405180611900016040528060c8906020820280368337509192915050565b60405180611900016040528060c8905b60408051808201909152600080825260208201528152602001906001900390816134985790505090565b60006001600160a01b038216610dd7565b6134dc816134c2565b82525050565b806134dc565b604081016134f682856134d3565b6117c460208301846134e2565b634e487b7160e01b600052601260045260246000fd5b815b915060008261352c5761352c613503565b500690565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610dd757610dd7613547565b6001600160e01b031981165b81146111c557600080fd5b8035610dd781613570565b6000602082840312156135a7576135a7600080fd5b60006118f08484613587565b8015156134dc565b60208101610dd782846135b3565b60005b838110156135e45781810151838201526020016135cc565b50506000910152565b60006135f7825190565b80845260208401935061360e8185602086016135c9565b601f01601f19169290920192915050565b602080825281016117c481846135ed565b60208101610dd782846134d3565b8061357c565b8035610dd78161363e565b60006020828403121561366457613664600080fd5b60006118f08484613644565b61357c816134c2565b8035610dd781613670565b6000806040838503121561369a5761369a600080fd5b60006136a68585613679565b92505060206136b785828601613644565b9150509250929050565b60208101610dd782846134e2565b6000602082840312156136e4576136e4600080fd5b60006118f08484613679565b60008060006060848603121561370857613708600080fd5b60006137148686613679565b935050602061372586828701613679565b925050604061373686828701613644565b9150509250925092565b61374a82826134e2565b5060200190565b60200190565b60c88160005b828110156120475781516137718682613740565b95505060208201915060010161375d565b6119a0810161379182896134e2565b61379e6020830188613757565b6137ac6119208301876134e2565b6137ba6119408301866134e2565b6137c86119608301856134e2565b6133f06119808301846134e2565b600080604083850312156137ec576137ec600080fd5b60006137f88585613644565b92505060206136b785828601613679565b6000610dd7826134c2565b61357c81613809565b8035610dd781613814565b6000806040838503121561383e5761383e600080fd5b60006137f8858561381d565b67ffffffffffffffff81166134dc565b6001600160c01b0381166134dc565b60408101613877828561384a565b6117c4602083018461385a565b6000610dd782613809565b6134dc81613884565b60208101610dd7828461388f565b604080825281016138b781856135ed565b905081810360208301526118f081846135ed565b80516138d7838261384a565b506020810151610f4f602084018261385a565b6138f482826138cb565b5060400190565b60c88160005b8281101561204757815161391586826138ea565b955050602082019150600101613901565b6196808101613935828b6134e2565b613942602083018a613757565b6139506119208301896134e2565b61395e611940830188613757565b61396c6132408301876134e2565b61397a6132608301866138fb565b6139886164608301856138fb565b6139966196608301846134e2565b9998505050505050505050565b80151561357c565b8035610dd7816139a3565b600080604083850312156139cc576139cc600080fd5b60006139d88585613679565b92505060206136b7858286016139ab565b61012081016139f8828c6134e2565b613a05602083018b6134e2565b613a12604083018a6134e2565b613a1f60608301896134d3565b613a2c60808301886134d3565b613a3960a08301876134d3565b613a4660c08301866134d3565b613a5360e08301856134d3565b613a616101008301846134d3565b9a9950505050505050505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715613aab57613aab613a6f565b6040525050565b6000613abd60405190565b9050613ac98282613a85565b919050565b600067ffffffffffffffff821115613ae857613ae8613a6f565b601f19601f83011660200192915050565b82818337506000910152565b6000613b18613b1384613ace565b613ab2565b905082815260208101848484011115613b3357613b33600080fd5b613b3e848285613af9565b509392505050565b600082601f830112613b5a57613b5a600080fd5b81356118f0848260208601613b05565b60008060008060808587031215613b8357613b83600080fd5b6000613b8f8787613679565b9450506020613ba087828801613679565b9350506040613bb187828801613644565b925050606085013567ffffffffffffffff811115613bd157613bd1600080fd5b613bdd87828801613b46565b91505092959194509250565b600060208284031215613bfe57613bfe600080fd5b60006118f0848461381d565b60008060408385031215613c2057613c20600080fd5b60006137f88585613679565b60ff811661357c565b8035610dd781613c2c565b600080600060608486031215613c5857613c58600080fd5b6000613c648686613644565b9350506020613c7586828701613c35565b925050604061373686828701613679565b60268152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e203681526534206269747360d01b602082015290505b60400190565b60208082528101610dd781613c86565b60278152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e20318152663932206269747360c81b60208201529050613cc3565b60208082528101610dd781613cd9565b634e487b7160e01b600052602260045260246000fd5b600281046001821680613d5557607f821691505b602082108103613d6757613d67613d2b565b50919050565b60218152602081017f4552433732313a20617070726f76616c20746f2063757272656e74206f776e658152603960f91b60208201529050613cc3565b60208082528101610dd781613d6d565b603d8152602081017f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f81527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060208201529050613cc3565b60208082528101610dd781613db9565b600060018201613e3357613e33613547565b5060010190565b60268152602081017f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2081526573686172657360d01b60208201529050613cc3565b60208082528101610dd781613e3a565b602b8152602081017f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742081526a191d59481c185e5b595b9d60aa1b60208201529050613cc3565b60208082528101610dd781613e8b565b604081016134f6828561388f565b602d8152602081017f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6581526c1c881bdc88185c1c1c9bdd9959609a1b60208201529050613cc3565b60208082528101610dd781613eef565b8051610dd78161363e565b600060208284031215613f6757613f67600080fd5b60006118f08484613f47565b602f8152602081017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581527f20726f6c657320666f722073656c66000000000000000000000000000000000060208201529050613cc3565b60208082528101610dd781613f73565b60188152602081017f4552433732313a20696e76616c696420746f6b656e204944000000000000000081529050613751565b60208082528101610dd781613fdb565b81810381811115610dd757610dd7613547565b6000610dd78260601b90565b6000610dd782614030565b6134dc614053826134c2565b61403c565b61406281876134e2565b60200161406f81866134e2565b60200161407c81856134e2565b6020016140898184614047565b60140161409681836134e2565b60200195945050505050565b60298152602081017f4552433732313a2061646472657373207a65726f206973206e6f7420612076618152683634b21037bbb732b960b91b60208201529050613cc3565b60208082528101610dd7816140a2565b6000614104613b1384613ace565b90508281526020810184848401111561411f5761411f600080fd5b613b3e8482856135c9565b600082601f83011261413e5761413e600080fd5b81516118f08482602086016140f6565b60006020828403121561416357614163600080fd5b815167ffffffffffffffff81111561417d5761417d600080fd5b6118f08482850161412a565b6060810161419782866134d3565b6141a460208301856134d3565b6118f060408301846134d3565b8051610dd7816139a3565b6000602082840312156141d1576141d1600080fd5b60006118f084846141b1565b601e8152602081017f696e76616c69642064656c65676174652d7661756c742070616972696e67000081529050613751565b60208082528101610dd7816141dd565b60268152602081017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b60208201529050613cc3565b60208082528101610dd78161421f565b601d8152602081017f416464726573733a20696e73756666696369656e742062616c616e636500000081529050613751565b60208082528101610dd781614270565b603a8152602081017f416464726573733a20756e61626c6520746f2073656e642076616c75652c207281527f6563697069656e74206d6179206861766520726576657274656400000000000060208201529050613cc3565b60208082528101610dd7816142b2565b60258152602081017f4552433732313a207472616e736665722066726f6d20696e636f72726563742081526437bbb732b960d91b60208201529050613cc3565b60208082528101610dd78161431a565b60248152602081017f4552433732313a207472616e7366657220746f20746865207a65726f206164648152637265737360e01b60208201529050613cc3565b60208082528101610dd78161436a565b60ff9081169082165b91506000826143d3576143d3613503565b500490565b8181028115828204841417610dd757610dd7613547565b60ff90811690821661351b565b60108152602081017f5061757361626c653a207061757365640000000000000000000000000000000081529050613751565b60208082528101610dd7816143fc565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65729101908152613751565b60208082528101610dd78161443e565b60198152602081017f4552433732313a20617070726f766520746f2063616c6c65720000000000000081529050613751565b60208082528101610dd78161447e565b816143c2565b60328152602081017f4552433732313a207472616e7366657220746f206e6f6e20455243373231526581527f63656976657220696d706c656d656e746572000000000000000000000000000060208201529050613cc3565b60208082528101610dd7816144c6565b6000614538825190565b6145468185602086016135c9565b9290920192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152601701614580818461452e565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190506117c4818361452e565b67ffffffffffffffff16600067fffffffffffffffe198201613e3357613e33613547565b60148152602081017f5061757361626c653a206e6f742070617573656400000000000000000000000081529050613751565b60208082528101610dd7816145d6565b602a8152602081017f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b60208201529050613cc3565b60208082528101610dd781614618565b60ff918216919081169082820190811115610dd757610dd7613547565b60ff918216919081169082820390811115610dd757610dd7613547565b608081016146b582876134d3565b6146c260208301866134d3565b6146cf60408301856134e2565b81810360608301526146e181846135ed565b9695505050505050565b8051610dd781613570565b60006020828403121561470b5761470b600080fd5b60006118f084846146eb565b60008161472657614726613547565b506000190190565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e749101908152613751565b60208082528101610dd78161472e565b60208082527f4552433732313a206d696e7420746f20746865207a65726f20616464726573739101908152613751565b60208082528101610dd78161476e565b601c8152602081017f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000081529050613751565b60208082528101610dd7816147ae565b60268152602081017f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b60208201529050613cc3565b60208082528101610dd7816147f0565b610dd7818361452e565b601d8152602081017f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081529050613751565b60208082528101610dd78161484b56fea26469706673582212201adf8fd43f92f099a49ca9121d1a45cee2a416cf8c089020dd1336fe1afc5d1564736f6c63430008110033

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

00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000220000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000dc49b9d7de7b1b4d6d153d9857b3942dc4baddfa00000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000076a84fef008cdabe6409d2fe638b0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000b28b71c694f53c7cfea8dffdc85733237e0c981e00000000000000000000000065c7432e6662a96f4e999603991d5e929e57f60a000000000000000000000000134309c4cf57bfa43ef66bf20bd0eeccdeb2d80c00000000000000000000000006cb0a03c2518873befc6bc257cbf4c438d14b4a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000100000000000000000000000020ec68ba5dc8af5380bdb37465b3f9bde75f9635

-----Decoded View---------------
Arg [0] : payees (address[]): 0xB28B71C694F53C7CfEA8dffDC85733237e0C981e,0x65C7432E6662A96f4e999603991d5E929E57f60A,0x134309c4cf57BfA43EF66bF20bD0EEcCDEb2D80c,0x06CB0A03C2518873BeFC6BC257CBf4C438D14b4A
Arg [1] : shares (uint256[]): 33,53,10,4
Arg [2] : admins_ (address[]): 0x20Ec68Ba5dC8aF5380BDb37465b3F9BDE75f9635
Arg [3] : wethContract_ (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [4] : goldRenderer_ (address): 0xDc49B9D7De7b1B4d6d153d9857b3942Dc4BADDfA
Arg [5] : maxSupply_ (uint256): 500
Arg [6] : delegateCash_ (address): 0x00000000000076A84feF008CDAbe6409d2FE638B

-----Encoded View---------------
19 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [3] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [4] : 000000000000000000000000dc49b9d7de7b1b4d6d153d9857b3942dc4baddfa
Arg [5] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [6] : 00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [8] : 000000000000000000000000b28b71c694f53c7cfea8dffdc85733237e0c981e
Arg [9] : 00000000000000000000000065c7432e6662a96f4e999603991d5e929e57f60a
Arg [10] : 000000000000000000000000134309c4cf57bfa43ef66bf20bd0eeccdeb2d80c
Arg [11] : 00000000000000000000000006cb0a03c2518873befc6bc257cbf4c438d14b4a
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000021
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [15] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [18] : 00000000000000000000000020ec68ba5dc8af5380bdb37465b3f9bde75f9635


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.