POL Price: $0.125421 (-3.44%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Accept Erc1155Pr...820745502026-01-24 15:37:526 mins ago1769269072IN
0x75aC28c9...cc457D5A0
0 POL0.05527262416.82787458
Create Many Prop...820741402026-01-24 15:24:1220 mins ago1769268252IN
0x75aC28c9...cc457D5A0
0 POL0.1074938515.42431772
Create Many Prop...820741022026-01-24 15:22:5621 mins ago1769268176IN
0x75aC28c9...cc457D5A0
0 POL0.11921687571.66843843
Cancel Many Prop...820740622026-01-24 15:21:3622 mins ago1769268096IN
0x75aC28c9...cc457D5A0
0 POL0.08090631590.99273287
Cancel Many Prop...820732762026-01-24 14:55:2448 mins ago1769266524IN
0x75aC28c9...cc457D5A0
0 POL0.03125727440.0573117
Accept Erc1155Pr...820730242026-01-24 14:47:0057 mins ago1769266020IN
0x75aC28c9...cc457D5A0
0 POL0.05921622465.50346136
Accept Erc1155Pr...820730062026-01-24 14:46:2457 mins ago1769265984IN
0x75aC28c9...cc457D5A0
0 POL0.08494664442.12417268
Accept Erc1155Pr...820729832026-01-24 14:45:3858 mins ago1769265938IN
0x75aC28c9...cc457D5A0
0 POL0.0586253460.85818093
Accept Erc1155Pr...820729702026-01-24 14:45:121 hr ago1769265912IN
0x75aC28c9...cc457D5A0
0 POL0.06180629468.11246453
Accept Erc1155Pr...820729602026-01-24 14:44:521 hr ago1769265892IN
0x75aC28c9...cc457D5A0
0 POL0.06952568466.19917582
Accept Erc1155Pr...820725722026-01-24 14:31:561 hr ago1769265116IN
0x75aC28c9...cc457D5A0
0 POL0.08083592612.24034671
Create Many Prop...820721712026-01-24 14:18:341 hr ago1769264314IN
0x75aC28c9...cc457D5A0
0 POL0.09311261493.73826688
Create Many Prop...820719572026-01-24 14:11:261 hr ago1769263886IN
0x75aC28c9...cc457D5A0
0 POL0.14788705784.23467624
Create Many Prop...820712202026-01-24 13:46:521 hr ago1769262412IN
0x75aC28c9...cc457D5A0
0 POL0.25679842516.00970191
Create Many Prop...820710612026-01-24 13:41:342 hrs ago1769262094IN
0x75aC28c9...cc457D5A0
0 POL0.14807773510.30494863
Cancel Many Prop...820710082026-01-24 13:39:482 hrs ago1769261988IN
0x75aC28c9...cc457D5A0
0 POL0.04494103499.34487056
Accept Erc1155Pr...820707362026-01-24 13:30:442 hrs ago1769261444IN
0x75aC28c9...cc457D5A0
0 POL0.05081759399.48114961
Create Many Prop...820706132026-01-24 13:26:382 hrs ago1769261198IN
0x75aC28c9...cc457D5A0
0 POL0.05705703301.63849422
Create Many Prop...820704502026-01-24 13:21:122 hrs ago1769260872IN
0x75aC28c9...cc457D5A0
0 POL0.05917596313.90584928
Create Many Prop...820704302026-01-24 13:20:322 hrs ago1769260832IN
0x75aC28c9...cc457D5A0
0 POL0.06048738320.73992992
Accept Erc1155Pr...820701082026-01-24 13:09:482 hrs ago1769260188IN
0x75aC28c9...cc457D5A0
0 POL0.04512319341.75696956
Accept Erc1155Pr...820700622026-01-24 13:08:162 hrs ago1769260096IN
0x75aC28c9...cc457D5A0
0 POL0.04015649315.67340556
Accept Erc1155Pr...820700402026-01-24 13:07:322 hrs ago1769260052IN
0x75aC28c9...cc457D5A0
0 POL0.04067437319.74444844
Accept Erc1155Pr...820699002026-01-24 13:02:522 hrs ago1769259772IN
0x75aC28c9...cc457D5A0
0 POL0.03466297296.17611446
Accept Erc1155Pr...820698892026-01-24 13:02:302 hrs ago1769259750IN
0x75aC28c9...cc457D5A0
0 POL0.03480445285.61253714
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GensoTradeProposal

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
//SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.x
pragma solidity 0.8.17;

import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {AccessGuard} from "../../utils/AccessGuard.sol";
import {SignatureVerifier} from "../../utils/SignatureVerifier.sol";
import {SelfFeePayment} from "../../utils/SelfFeePayment.sol";

interface IGensoERC721 {
  function safeTransferFrom(address from_, address to_, uint256 tokenId_) external;
}

interface IGensoERC1155 {
  function safeTransferFrom(address from_, address to_, uint256 id_, uint256 amount_, bytes memory data_) external;
}

contract GensoTradeProposal is AccessGuard, ReentrancyGuard, SignatureVerifier, SelfFeePayment {
  /* Event */
  event ProposalCreated(
    uint256 proposalGroupId,
    uint256[] proposalIds,
    ProposalInfo[] proposals,
    address proposer,
    uint256[] depositAmounts,
    uint256 timestamp
  );
  event ProposalCanceled(uint256[] proposalIds, address proposer, uint256[] withdrawAmounts, uint256 timestamp);
  event ProposalErc721Accepted(
    uint256 proposalGroupId,
    uint256 proposalId,
    uint256[] tokenIds,
    uint256 amount,
    uint8 currencyType,
    address trader,
    address proposer,
    uint256 timestamp
  );
  event ProposalErc1155Accepted(
    uint256 proposalGroupId,
    uint256 proposalId,
    uint240 nftItemId,
    uint48 quantity,
    uint256 amount,
    uint8 currencyType,
    address trader,
    address proposer,
    uint256 timestamp
  );

  /* Enum */
  enum ErcType {
    ERC721,
    ERC1155
  }

  /* Struct */
  struct PriceInfo {
    uint248 price;
    uint8 currencyType;
  }

  struct Proposal {
    uint256 proposalGroupId;
    ErcType ercType;
    uint8 nftType;
    uint240 nftItemId;
    PriceInfo priceInfo;
    address proposer;
    uint48 totalQuantity;
    uint48 remainQuantity;
    uint256 expireDate;
  }

  struct ProposalInfo {
    ErcType ercType;
    uint8 nftType;
    uint240 nftItemId;
    PriceInfo priceInfo;
    uint256 expireDate;
    uint48 quantity;
    string condition;
  }

  /* State variable */
  uint256 public currentProposalGroupId = 1;
  uint256 public currentProposalId = 1;

  mapping(uint256 => Proposal) public proposals;
  mapping(address => mapping(uint8 => uint256)) public lockedAmountOfUsers;

  mapping(ErcType => address[]) public nftAddresses;

  /* Constructor */
  constructor(address verificator_, uint256 expireTime_) SignatureVerifier(verificator_, expireTime_, keccak256("GensoTradeProposal")) {
    _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
  }

  /* Management function */
  function addNftAddresses(ErcType ercType_, address[] memory addresses_) external onlyAdmin {
    for (uint256 i; i < addresses_.length; i += 1) {
      nftAddresses[ercType_].push(addresses_[i]);
    }
  }

  function resetNftAddresses(ErcType ercType_) external onlyAdmin {
    delete nftAddresses[ercType_];
  }

  function resetCurrencies() external onlyAdmin {
    _resetCurrencies();
  }

  function addCurrencies(address[] calldata addresses_) external onlyAdmin {
    _addCurrencies(addresses_);
  }

  function setPlatformFees(address[] calldata addresses_, Fee[] calldata fees_) external onlyAdmin {
    _setPlatformFees(addresses_, fees_);
  }

  function setCommissionFees(uint8 currencyType_, address[] calldata addresses_, Fee[] calldata fees_) external onlyAdmin {
    _setCommissionFees(currencyType_, addresses_, fees_);
  }

  function setVerifierAddress(address addr_) external onlyAdmin {
    _setVerifierAddress(addr_);
  }

  function setSignatureExpireTime(uint256 time_) external onlyAdmin {
    _setSignatureExpireTime(time_);
  }

  /* Main function */
  function createManyProposals(ProposalInfo[] calldata proposals_) external nonReentrant {
    require(proposals_.length > 0, "Must have at least one proposal");
    uint256[] memory proposalIds = new uint256[](proposals_.length);
    uint256[] memory depositAmounts = new uint256[](currencyAddresses.length);
    address userAddress = _msgSender();
    uint256 proposalGroupId = currentProposalGroupId;
    currentProposalGroupId += 1;
    for (uint256 i; i < proposals_.length; i += 1) {
      (uint256 proposalId, uint256 amount, uint8 currencyType) = _createOneProposal(userAddress, proposalGroupId, proposals_[i]);
      proposalIds[i] = proposalId;
      depositAmounts[currencyType] += amount;
    }

    for (uint8 i; i < currencyAddresses.length; i += 1) {
      uint256 depositAmount = depositAmounts[i];
      if (depositAmount > 0) {
        _increaseLockedAmountOfUser(depositAmount, i, userAddress);
        _transferFrom(depositAmount, userAddress, address(this), i);
      }
    }
    emit ProposalCreated(proposalGroupId, proposalIds, proposals_, userAddress, depositAmounts, block.timestamp);
  }

  function cancelManyProposals(uint256[] calldata proposalIds_) external nonReentrant {
    require(proposalIds_.length > 0, "Must have at least one proposal");
    uint256[] memory withdrawAmounts = new uint256[](currencyAddresses.length);
    address userAddress = _msgSender();
    for (uint256 i; i < proposalIds_.length; i += 1) {
      (uint256 amount, uint8 currencyType) = _cancelOneProposal(userAddress, proposalIds_[i]);
      withdrawAmounts[currencyType] += amount;
    }

    for (uint8 i; i < currencyAddresses.length; i += 1) {
      uint256 withdrawAmount = withdrawAmounts[i];
      if (withdrawAmount > 0) {
        _decreaseLockedAmountOfUser(withdrawAmount, i, userAddress);
        _selfTransfer(withdrawAmount, userAddress, i);
      }
    }
    emit ProposalCanceled(proposalIds_, userAddress, withdrawAmounts, block.timestamp);
  }

  function acceptErc721Proposal(
    uint256 proposalId_,
    uint256[] calldata tokenIds_,
    Signature calldata signature_
  ) external nonReentrant isUsableSignature(signature_.timestamp, signature_.identifier) {
    address userAddress = _msgSender();
    require(_isValidErc721Signature(proposalId_, tokenIds_, userAddress, signature_), "Invalid signature");
    require(tokenIds_.length > 0, "Must have at least one token ID");
    Proposal memory proposal = proposals[proposalId_];
    require(proposal.ercType == ErcType.ERC721, "Must be ERC721 proposal");
    require(proposal.proposer != address(0), "Proposal does not exist");
    require(proposal.proposer != userAddress, "Cannot accept own proposal");
    require(proposal.expireDate == 0 || proposal.expireDate > block.timestamp, "Proposal has already expired");
    require(proposal.remainQuantity >= tokenIds_.length, "Insufficient quantity");

    // Decrease locked amount
    (uint248 price, uint8 currencyType) = (proposal.priceInfo.price, proposal.priceInfo.currencyType);
    uint256 transferAmount = uint256(price) * tokenIds_.length;
    _decreaseLockedAmountOfUser(transferAmount, currencyType, proposal.proposer);
    // Update remain quantity
    unchecked {
      proposal.remainQuantity -= uint48(tokenIds_.length);
    }
    proposals[proposalId_].remainQuantity = proposal.remainQuantity;
    if (proposal.remainQuantity == 0) {
      delete proposals[proposalId_];
    }

    address nftAddress = nftAddresses[proposal.ercType][proposal.nftType];
    // Transfer NFT
    for (uint256 i; i < tokenIds_.length; ) {
      IGensoERC721(nftAddress).safeTransferFrom(userAddress, proposal.proposer, tokenIds_[i]);
      unchecked {
        i += 1;
      }
    }
    // Transfer money
    _selfPayment(userAddress, transferAmount, nftAddress, currencyType);

    emit ProposalErc721Accepted(
      proposal.proposalGroupId,
      proposalId_,
      tokenIds_,
      transferAmount,
      currencyType,
      userAddress,
      proposal.proposer,
      block.timestamp
    );
  }

  function acceptErc1155Proposal(uint256 proposalId_, uint48 quantity_) external nonReentrant {
    require(quantity_ > 0, "Quantity must be greater than 0");
    Proposal memory proposal = proposals[proposalId_];
    require(proposal.ercType == ErcType.ERC1155, "Must be ERC1155 proposal");
    require(proposal.proposer != address(0), "Proposal does not exist");
    address userAddress = _msgSender();
    require(proposal.proposer != userAddress, "Cannot accept own proposal");
    require(proposal.expireDate == 0 || proposal.expireDate > block.timestamp, "Proposal has already expired");
    require(proposal.remainQuantity >= quantity_, "Insufficient quantity");

    // Decrease locked amount
    (uint248 price, uint8 currencyType) = (proposal.priceInfo.price, proposal.priceInfo.currencyType);
    uint256 transferAmount = uint256(price) * uint256(quantity_);
    _decreaseLockedAmountOfUser(transferAmount, currencyType, proposal.proposer);
    // Update remain quantity
    unchecked {
      proposal.remainQuantity -= quantity_;
    }
    proposals[proposalId_].remainQuantity = proposal.remainQuantity;
    if (proposal.remainQuantity == 0) {
      delete proposals[proposalId_];
    }

    address nftAddress = nftAddresses[proposal.ercType][proposal.nftType];
    // Transfer NFT
    IGensoERC1155(nftAddress).safeTransferFrom(userAddress, proposal.proposer, uint256(proposal.nftItemId), uint256(quantity_), "0x");
    // Transfer money
    _selfPayment(userAddress, transferAmount, nftAddress, currencyType);

    emit ProposalErc1155Accepted(
      proposal.proposalGroupId,
      proposalId_,
      proposal.nftItemId,
      quantity_,
      transferAmount,
      currencyType,
      userAddress,
      proposal.proposer,
      block.timestamp
    );
  }

  /* Private function */
  function _createOneProposal(
    address userAddress_,
    uint256 proposalGroupId_,
    ProposalInfo calldata proposal_
  ) private returns (uint256, uint256, uint8) {
    require(proposal_.nftType < nftAddresses[proposal_.ercType].length, "Invalid NFT type");
    require(nftAddresses[proposal_.ercType][proposal_.nftType] != address(0), "Invalid NFT type");
    require(proposal_.quantity > 0, "Invalid quantity");
    require(proposal_.expireDate == 0 || proposal_.expireDate > block.timestamp, "Invalid expire date");
    (uint248 price, uint8 currencyType) = (proposal_.priceInfo.price, proposal_.priceInfo.currencyType);
    require(price > 0, "Invalid price");
    require(currencyType < currencyAddresses.length, "Invalid currency type");
    uint256 proposalId = currentProposalId;
    proposals[proposalId] = Proposal({
      proposalGroupId: proposalGroupId_,
      ercType: proposal_.ercType,
      nftType: proposal_.nftType,
      nftItemId: proposal_.nftItemId,
      priceInfo: PriceInfo({price: price, currencyType: currencyType}),
      proposer: userAddress_,
      totalQuantity: proposal_.quantity,
      remainQuantity: proposal_.quantity,
      expireDate: proposal_.expireDate
    });
    currentProposalId += 1;
    uint256 amount = uint256(price) * uint256(proposal_.quantity);
    return (proposalId, amount, currencyType);
  }

  function _cancelOneProposal(address userAdress_, uint256 proposalId_) private returns (uint256, uint8) {
    Proposal storage proposal = proposals[proposalId_];
    require(proposal.proposer == userAdress_, "Only proposer can cancel");
    require(proposal.remainQuantity > 0, "Proposal has already done");

    (uint248 price, uint8 currencyType) = (proposal.priceInfo.price, proposal.priceInfo.currencyType);
    uint256 amount = uint256(price) * uint256(proposal.remainQuantity);
    delete proposals[proposalId_];
    return (amount, currencyType);
  }

  function _increaseLockedAmountOfUser(uint256 amount_, uint8 currencyType_, address sender_) private {
    lockedAmountOfUsers[sender_][currencyType_] += amount_;
  }

  function _decreaseLockedAmountOfUser(uint256 amount_, uint8 currencyType_, address sender_) private {
    require(lockedAmountOfUsers[sender_][currencyType_] >= amount_, "Insufficient locked amount");
    unchecked {
      lockedAmountOfUsers[sender_][currencyType_] -= amount_;
    }
  }

  function _isValidErc721Signature(
    uint256 proposalId_,
    uint256[] calldata tokenIds_,
    address sender_,
    Signature calldata signature_
  ) private view returns (bool) {
    bytes32 hashValue = keccak256(abi.encodePacked(signature_.identifier, sender_, proposalId_, tokenIds_, signature_.timestamp));
    return _verifySignature(hashValue, signature_.signature);
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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:
 *
 * ```
 * 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}:
 *
 * ```
 * 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.
 */
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());
        }
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 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 10, 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 * 8) < value ? 1 : 0);
        }
    }
}

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

pragma solidity ^0.8.0;

import "./math/Math.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 `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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.x
pragma solidity 0.8.17;

import "@openzeppelin/contracts/access/AccessControl.sol";

contract AccessGuard is AccessControl {
  bytes32 public constant OPERATOR = keccak256("OPERATOR");

  modifier onlyAdmin() {
    _checkRole(DEFAULT_ADMIN_ROLE);
    _;
  }

  modifier onlyOperator() {
    _checkRole(OPERATOR);
    _;
  }

  function addOperator(address operator) external onlyAdmin {
    _grantRole(OPERATOR, operator);
  }

  function removeOperator(address operator) external onlyAdmin {
    _revokeRole(OPERATOR, operator);
  }
}

//SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IERC20 {
  function transferFrom(address sender, address recipient, uint256 amount) external;

  function transfer(address to, uint256 value) external returns (bool);
}

contract SelfFeePayment {
  /* Struct */
  struct Fee {
    address receiver;
    uint48 value;
    uint48 decimal;
  }

  /* State variable */
  address[] public currencyAddresses;
  mapping(address => mapping(uint8 => Fee)) public commissionFeeByNfts;
  mapping(address => Fee) public platformFeeByNfts;

  /* Management function */
  function _resetCurrencies() internal {
    delete currencyAddresses;
  }

  function _addCurrencies(address[] calldata addresses_) internal {
    for (uint256 i; i < addresses_.length; i += 1) {
      currencyAddresses.push(addresses_[i]);
    }
  }

  function _setPlatformFees(address[] calldata addresses_, Fee[] calldata fees_) internal {
    require(addresses_.length == fees_.length, "FP::Invalid input");
    for (uint256 i; i < addresses_.length; i += 1) {
      platformFeeByNfts[addresses_[i]] = fees_[i];
    }
  }

  function _setCommissionFees(uint8 currencyType_, address[] calldata addresses_, Fee[] calldata fees_) internal {
    require(addresses_.length == fees_.length, "FP::Invalid input");
    _isValidCurrency(currencyType_);
    for (uint256 i; i < addresses_.length; i += 1) {
      commissionFeeByNfts[addresses_[i]][currencyType_] = fees_[i];
    }
  }

  /* Utils function */
  function _isValidCurrency(uint8 currencyType_) internal view {
    require(currencyType_ < currencyAddresses.length, "FP::Invalid currency type");
  }

  /* Internal function */
  function _selfPayment(address to_, uint256 price_, address nftAddress_, uint8 currencyType_) internal virtual {
    _isValidCurrency(currencyType_);
    Fee memory platformFee = platformFeeByNfts[nftAddress_];
    Fee memory commissionFee = commissionFeeByNfts[nftAddress_][currencyType_];
    uint256 platformFeeAmount = _selfTransferFee(platformFee, price_, currencyType_);
    uint256 commissionFeeAmount = _selfTransferFee(commissionFee, price_, currencyType_);
    uint256 remainAmount = price_ - platformFeeAmount - commissionFeeAmount;
    _selfTransfer(remainAmount, to_, currencyType_);
  }

  function _selfTransferFee(Fee memory fee_, uint256 price_, uint8 currencyType_) internal virtual returns (uint256) {
    (address receiver, uint48 value, uint48 decimal) = _destructFee(fee_);
    require(receiver != address(0), "FP::Invalid receiver");
    require(decimal != 0, "FP::Invalid decimal");

    uint256 feeAmount = (price_ * uint256(value)) / (uint256(decimal) * 100);
    if (feeAmount > 0) {
      _selfTransfer(feeAmount, receiver, currencyType_);
    }
    return feeAmount;
  }

  function _transferFrom(uint256 amount_, address from_, address to_, uint8 currencyType_) internal virtual {
    IERC20(currencyAddresses[currencyType_]).transferFrom(from_, to_, amount_);
  }

  // Transfer from contract
  function _selfTransfer(uint256 amount_, address to_, uint8 currencyType_) internal virtual {
    IERC20(currencyAddresses[currencyType_]).transfer(to_, amount_);
  }

  function _destructFee(Fee memory fee_) internal pure returns (address, uint48, uint48) {
    return (fee_.receiver, fee_.value, fee_.decimal);
  }
}

//SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.x
pragma solidity 0.8.17;

import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

contract SignatureVerifier {
  using ECDSA for bytes32;

  /* Struct */
  struct Signature {
    uint256 timestamp;
    bytes32 identifier;
    bytes signature;
  }

  /* State variable */
  bytes32 public immutable CONTRACT_IDENTIFIER;
  address private _verifierAddress;
  uint256 private _signatureExpireTime;

  /* Constructor */
  constructor(address verificator_, uint256 expireTime_, bytes32 identifier_) {
    _verifierAddress = verificator_;
    _signatureExpireTime = expireTime_;
    CONTRACT_IDENTIFIER = identifier_;
  }

  /* Management function */
  function _setVerifierAddress(address addr_) internal {
    _verifierAddress = addr_;
  }

  function _setSignatureExpireTime(uint256 time_) internal {
    _signatureExpireTime = time_;
  }

  /* Modifier */
  modifier isUsableSignature(uint256 timestamp_, bytes32 identifier_) {
    require(identifier_ == CONTRACT_IDENTIFIER, "SignatureVerifier:Invalid contract identifier");
    require(timestamp_ + _signatureExpireTime >= block.timestamp, "SignatureVerifier:Signature has already expired");
    _;
  }

  /* Internal function */
  function _verifySignature(bytes32 data, bytes calldata signature_) internal view returns (bool) {
    return data.toEthSignedMessageHash().recover(signature_) == _verifierAddress;
  }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"verificator_","type":"address"},{"internalType":"uint256","name":"expireTime_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"withdrawAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProposalCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"proposalGroupId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"},{"components":[{"internalType":"enum GensoTradeProposal.ErcType","name":"ercType","type":"uint8"},{"internalType":"uint8","name":"nftType","type":"uint8"},{"internalType":"uint240","name":"nftItemId","type":"uint240"},{"components":[{"internalType":"uint248","name":"price","type":"uint248"},{"internalType":"uint8","name":"currencyType","type":"uint8"}],"internalType":"struct GensoTradeProposal.PriceInfo","name":"priceInfo","type":"tuple"},{"internalType":"uint256","name":"expireDate","type":"uint256"},{"internalType":"uint48","name":"quantity","type":"uint48"},{"internalType":"string","name":"condition","type":"string"}],"indexed":false,"internalType":"struct GensoTradeProposal.ProposalInfo[]","name":"proposals","type":"tuple[]"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"depositAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"proposalGroupId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"uint240","name":"nftItemId","type":"uint240"},{"indexed":false,"internalType":"uint48","name":"quantity","type":"uint48"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"currencyType","type":"uint8"},{"indexed":false,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProposalErc1155Accepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"proposalGroupId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"currencyType","type":"uint8"},{"indexed":false,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProposalErc721Accepted","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"},{"inputs":[],"name":"CONTRACT_IDENTIFIER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId_","type":"uint256"},{"internalType":"uint48","name":"quantity_","type":"uint48"}],"name":"acceptErc1155Proposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId_","type":"uint256"},{"internalType":"uint256[]","name":"tokenIds_","type":"uint256[]"},{"components":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes32","name":"identifier","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct SignatureVerifier.Signature","name":"signature_","type":"tuple"}],"name":"acceptErc721Proposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses_","type":"address[]"}],"name":"addCurrencies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum GensoTradeProposal.ErcType","name":"ercType_","type":"uint8"},{"internalType":"address[]","name":"addresses_","type":"address[]"}],"name":"addNftAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"addOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"proposalIds_","type":"uint256[]"}],"name":"cancelManyProposals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint8","name":"","type":"uint8"}],"name":"commissionFeeByNfts","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint48","name":"value","type":"uint48"},{"internalType":"uint48","name":"decimal","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"enum GensoTradeProposal.ErcType","name":"ercType","type":"uint8"},{"internalType":"uint8","name":"nftType","type":"uint8"},{"internalType":"uint240","name":"nftItemId","type":"uint240"},{"components":[{"internalType":"uint248","name":"price","type":"uint248"},{"internalType":"uint8","name":"currencyType","type":"uint8"}],"internalType":"struct GensoTradeProposal.PriceInfo","name":"priceInfo","type":"tuple"},{"internalType":"uint256","name":"expireDate","type":"uint256"},{"internalType":"uint48","name":"quantity","type":"uint48"},{"internalType":"string","name":"condition","type":"string"}],"internalType":"struct GensoTradeProposal.ProposalInfo[]","name":"proposals_","type":"tuple[]"}],"name":"createManyProposals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currencyAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentProposalGroupId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentProposalId","outputs":[{"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":[{"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":"","type":"address"},{"internalType":"uint8","name":"","type":"uint8"}],"name":"lockedAmountOfUsers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum GensoTradeProposal.ErcType","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"platformFeeByNfts","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint48","name":"value","type":"uint48"},{"internalType":"uint48","name":"decimal","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposals","outputs":[{"internalType":"uint256","name":"proposalGroupId","type":"uint256"},{"internalType":"enum GensoTradeProposal.ErcType","name":"ercType","type":"uint8"},{"internalType":"uint8","name":"nftType","type":"uint8"},{"internalType":"uint240","name":"nftItemId","type":"uint240"},{"components":[{"internalType":"uint248","name":"price","type":"uint248"},{"internalType":"uint8","name":"currencyType","type":"uint8"}],"internalType":"struct GensoTradeProposal.PriceInfo","name":"priceInfo","type":"tuple"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint48","name":"totalQuantity","type":"uint48"},{"internalType":"uint48","name":"remainQuantity","type":"uint48"},{"internalType":"uint256","name":"expireDate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"removeOperator","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":[],"name":"resetCurrencies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum GensoTradeProposal.ErcType","name":"ercType_","type":"uint8"}],"name":"resetNftAddresses","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":"uint8","name":"currencyType_","type":"uint8"},{"internalType":"address[]","name":"addresses_","type":"address[]"},{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint48","name":"value","type":"uint48"},{"internalType":"uint48","name":"decimal","type":"uint48"}],"internalType":"struct SelfFeePayment.Fee[]","name":"fees_","type":"tuple[]"}],"name":"setCommissionFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses_","type":"address[]"},{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint48","name":"value","type":"uint48"},{"internalType":"uint48","name":"decimal","type":"uint48"}],"internalType":"struct SelfFeePayment.Fee[]","name":"fees_","type":"tuple[]"}],"name":"setPlatformFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"time_","type":"uint256"}],"name":"setSignatureExpireTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"setVerifierAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60a0604052600160075560016008553480156200001b57600080fd5b5060405162003b6a38038062003b6a8339810160408190526200003e9162000152565b60018055600280546001600160a01b0319166001600160a01b03841617905560038190557f9d485b614a48afee9f47148d6f625486f74b5ac89edeb08e8f6b7bcdd295e3556080526200009a6000620000943390565b620000a2565b50506200018e565b620000ae8282620000b2565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000ae576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200010e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600080604083850312156200016657600080fd5b82516001600160a01b03811681146200017e57600080fd5b6020939093015192949293505050565b6080516139b9620001b1600039600081816104b401526107f701526139b96000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638f2c5cdc1161010f578063b5c5692b116100a2578063c48acf0c11610071578063c48acf0c146105a0578063d547741f146105b3578063ebc2a789146105c6578063feac729d146105d957600080fd5b8063b5c5692b14610546578063bf779b031461054f578063c410279914610562578063c441e73f1461058d57600080fd5b8063983d2737116100de578063983d2737146104f15780639870d7fe14610518578063a217fddf1461052b578063ac8a584a1461053357600080fd5b80638f2c5cdc1461049c5780638f49bb6b146104af57806390a708ab146104d657806391d14854146104de57600080fd5b806335755dfc1161018757806359d599e91161015657806359d599e91461041f5780635faf9b0b1461043257806379aecf33146104765780638ca1fad01461048957600080fd5b806335755dfc1461036957806336568abe1461037c5780633c23163e1461038f578063461da039146103a257600080fd5b806317e95526116101c357806317e95526146102fd578063248a9ca3146103125780632d39e69a146103435780632f2ff15d1461035657600080fd5b8063013cf08b146101ea57806301ffc9a7146102af5780630cc45d59146102d2575b600080fd5b6102916101f8366004612db3565b60096020908152600091825260409182902080546001820154845180860190955260028301546001600160f81b038116865260ff600160f81b909104811694860194909452600383015460049093015491948482169461010083041693620100009092046001600160f01b03169290916001600160a01b03811691600160a01b820465ffffffffffff90811692600160d01b9004169089565b6040516102a699989796959493929190612e04565b60405180910390f35b6102c26102bd366004612e87565b6105e2565b60405190151581526020016102a6565b6102e56102e0366004612db3565b610619565b6040516001600160a01b0390911681526020016102a6565b61031061030b366004612ed6565b610643565b005b610335610320366004612db3565b60009081526020819052604090206001015490565b6040519081526020016102a6565b610310610351366004612f8c565b61066e565b61031061036436600461300c565b61068c565b610310610377366004613061565b6106b6565b61031061038a36600461300c565b610763565b61031061039d366004613138565b6107e6565b6103f16103b03660046131af565b60056020908152600092835260408084209091529082529020546001600160a01b0381169065ffffffffffff600160a01b8204811691600160d01b90041683565b604080516001600160a01b03909416845265ffffffffffff92831660208501529116908201526060016102a6565b61031061042d3660046131e4565b610e85565b6103f1610440366004612ed6565b6006602052600090815260409020546001600160a01b0381169065ffffffffffff600160a01b8204811691600160d01b90041683565b610310610484366004613244565b61104a565b610310610497366004613269565b6115e2565b6103106104aa366004612db3565b6115f8565b6103357f000000000000000000000000000000000000000000000000000000000000000081565b61031061160b565b6102c26104ec36600461300c565b61161f565b6103357f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b610310610526366004612ed6565b611648565b610335600081565b610310610541366004612ed6565b61167c565b61033560075481565b61031061055d3660046132d4565b6116b0565b6103356105703660046131af565b600a60209081526000928352604080842090915290825290205481565b61031061059b3660046131e4565b6116fb565b6102e56105ae3660046132ef565b61195b565b6103106105c136600461300c565b611993565b6103106105d43660046131e4565b6119b8565b61033560085481565b60006001600160e01b03198216637965db0b60e01b148061061357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6004818154811061062957600080fd5b6000918252602090912001546001600160a01b0316905081565b61064d60006119cc565b600280546001600160a01b0319166001600160a01b03831617905550565b50565b61067860006119cc565b61068585858585856119d6565b5050505050565b6000828152602081905260409020600101546106a7816119cc565b6106b18383611ac0565b505050565b6106c060006119cc565b60005b81518110156106b157600b60008460018111156106e2576106e2612dcc565b60018111156106f3576106f3612dcc565b815260200190815260200160002082828151811061071357610713613319565b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915561075c9082613345565b90506106c3565b6001600160a01b03811633146107d85760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107e28282611b44565b5050565b6107ee611ba9565b803560208201357f0000000000000000000000000000000000000000000000000000000000000000811461087a5760405162461bcd60e51b815260206004820152602d60248201527f5369676e617475726556657269666965723a496e76616c696420636f6e74726160448201526c31ba1034b232b73a34b334b2b960991b60648201526084016107cf565b42600354836108899190613345565b10156108ef5760405162461bcd60e51b815260206004820152602f60248201527f5369676e617475726556657269666965723a5369676e6174757265206861732060448201526e185b1c9958591e48195e1c1a5c9959608a1b60648201526084016107cf565b336108fd8787878488611c02565b61093d5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b60448201526064016107cf565b8461098a5760405162461bcd60e51b815260206004820152601f60248201527f4d7573742068617665206174206c65617374206f6e6520746f6b656e2049440060448201526064016107cf565b60008781526009602090815260408083208151610120810190925280548252600180820154929391929184019160ff16908111156109ca576109ca612dcc565b60018111156109db576109db612dcc565b81526001820154610100810460ff908116602080850191909152620100009092046001600160f01b0316604080850191909152805180820190915260028501546001600160f81b0381168252600160f81b900490911691810191909152606082015260038201546001600160a01b0381166080830152600160a01b810465ffffffffffff90811660a0840152600160d01b9091041660c082015260049091015460e0909101529050600081602001516001811115610a9b57610a9b612dcc565b14610ae85760405162461bcd60e51b815260206004820152601760248201527f4d757374206265204552433732312070726f706f73616c00000000000000000060448201526064016107cf565b60a08101516001600160a01b0316610b3c5760405162461bcd60e51b8152602060048201526017602482015276141c9bdc1bdcd85b08191bd95cc81b9bdd08195e1a5cdd604a1b60448201526064016107cf565b816001600160a01b03168160a001516001600160a01b031603610ba15760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f7420616363657074206f776e2070726f706f73616c00000000000060448201526064016107cf565b6101008101511580610bb7575042816101000151115b610c035760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2068617320616c726561647920657870697265640000000060448201526064016107cf565b60e081015165ffffffffffff16861115610c575760405162461bcd60e51b8152602060048201526015602482015274496e73756666696369656e74207175616e7469747960581b60448201526064016107cf565b608081015180516020909101516000610c79896001600160f81b038516613358565b9050610c8a81838660a00151611c64565b60e0840180518a900365ffffffffffff90811680835260008e815260096020526040812060030180546001600160d01b0316600160d01b909302929092179091559151169003610cff5760008b8152600960205260408120818155600181018290556002810182905560038101829055600401555b6000600b600086602001516001811115610d1b57610d1b612dcc565b6001811115610d2c57610d2c612dcc565b8152602001908152602001600020856040015160ff1681548110610d5257610d52613319565b60009182526020822001546001600160a01b031691505b8a811015610e1257816001600160a01b03166342842e0e888860a001518f8f86818110610d9857610d98613319565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610def57600080fd5b505af1158015610e03573d6000803e3d6000fd5b50505050600181019050610d69565b50610e1f86838386611d09565b7f88c044ea4ab7357d432e58bc7ed5554108338fd9004ab5bca2b46043469647d985600001518d8d8d86888c8c60a0015142604051610e66999897969594939291906133a1565b60405180910390a15050505050505050610e7f60018055565b50505050565b610e8d611ba9565b80610eda5760405162461bcd60e51b815260206004820152601f60248201527f4d7573742068617665206174206c65617374206f6e652070726f706f73616c0060448201526064016107cf565b6004546000906001600160401b03811115610ef757610ef761304b565b604051908082528060200260200182016040528015610f20578160200160208202803683370190505b5090503360005b83811015610f9b57600080610f5484888886818110610f4857610f48613319565b90506020020135611dec565b9150915081858260ff1681518110610f6e57610f6e613319565b60200260200101818151610f829190613345565b905250610f9491506001905082613345565b9050610f27565b5060005b60045460ff82161015610fff576000838260ff1681518110610fc357610fc3613319565b602002602001015190506000811115610fec57610fe1818385611c64565b610fec818484611f32565b50610ff86001826133fc565b9050610f9f565b507f4b482dfc5a7e4304b49429716784710edbb77a745d8adf43900dcad0e7b609c78484838542604051611037959493929190613450565b60405180910390a150506107e260018055565b611052611ba9565b60008165ffffffffffff16116110aa5760405162461bcd60e51b815260206004820152601f60248201527f5175616e74697479206d7573742062652067726561746572207468616e20300060448201526064016107cf565b60008281526009602090815260408083208151610120810190925280548252600180820154929391929184019160ff16908111156110ea576110ea612dcc565b60018111156110fb576110fb612dcc565b8152600182810154610100810460ff908116602080860191909152620100009092046001600160f01b0316604080860191909152805180820190915260028601546001600160f81b0381168252600160f81b900490911691810191909152606083015260038301546001600160a01b0381166080840152600160a01b810465ffffffffffff90811660a0850152600160d01b9091041660c083015260049092015460e090910152909150816020015160018111156111bb576111bb612dcc565b146112085760405162461bcd60e51b815260206004820152601860248201527f4d75737420626520455243313135352070726f706f73616c000000000000000060448201526064016107cf565b60a08101516001600160a01b031661125c5760405162461bcd60e51b8152602060048201526017602482015276141c9bdc1bdcd85b08191bd95cc81b9bdd08195e1a5cdd604a1b60448201526064016107cf565b60a081015133906001600160a01b03168190036112bb5760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f7420616363657074206f776e2070726f706f73616c00000000000060448201526064016107cf565b61010082015115806112d1575042826101000151115b61131d5760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2068617320616c726561647920657870697265640000000060448201526064016107cf565b8265ffffffffffff168260e0015165ffffffffffff1610156113795760405162461bcd60e51b8152602060048201526015602482015274496e73756666696369656e74207175616e7469747960581b60448201526064016107cf565b6080820151805160209091015160006113a365ffffffffffff87166001600160f81b038516613358565b90506113b481838760a00151611c64565b60e08501805187900365ffffffffffff90811680835260008a815260096020526040812060030180546001600160d01b0316600160d01b909302929092179091559151169003611429576000878152600960205260408120818155600181018290556002810182905560038101829055600401555b6000600b60008760200151600181111561144557611445612dcc565b600181111561145657611456612dcc565b8152602001908152602001600020866040015160ff168154811061147c5761147c613319565b60009182526020909120015460a0878101516060890151604051637921219560e11b81526001600160a01b038a8116600483015292831660248201526001600160f01b03909116604482015265ffffffffffff8b1660648201526084810192909252600260a483015261060f60f31b60c48301529091169150819063f242432a9060e401600060405180830381600087803b15801561151a57600080fd5b505af115801561152e573d6000803e3d6000fd5b5050505061153e85838386611d09565b855160608088015160a0808a015160408051958652602086018e90526001600160f01b039093168584015265ffffffffffff8c16938501939093526080840186905260ff8716908401526001600160a01b0388811660c085015290911660e083015242610100830152517f998b997948f4e52c65d38c04e811ec24af58a769594d592bba1e0bb726646304918190036101200190a15050505050506107e260018055565b6115ec60006119cc565b610e7f84848484611fc8565b61160260006119cc565b61066b81600355565b61161560006119cc565b61161d612091565b565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61165260006119cc565b61066b7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611ac0565b61168660006119cc565b61066b7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611b44565b6116ba60006119cc565b600b60008260018111156116d0576116d0612dcc565b60018111156116e1576116e1612dcc565b8152602001908152602001600020600061066b9190612d81565b611703611ba9565b806117505760405162461bcd60e51b815260206004820152601f60248201527f4d7573742068617665206174206c65617374206f6e652070726f706f73616c0060448201526064016107cf565b6000816001600160401b0381111561176a5761176a61304b565b604051908082528060200260200182016040528015611793578160200160208202803683370190505b506004549091506000906001600160401b038111156117b4576117b461304b565b6040519080825280602002602001820160405280156117dd578160200160208202803683370190505b506007805491925033919060019060006117f78385613345565b90915550600090505b858110156118a557600080600061183b86868c8c8881811061182457611824613319565b90506020028101906118369190613498565b61209d565b9250925092508288858151811061185457611854613319565b60200260200101818152505081878260ff168151811061187657611876613319565b6020026020010181815161188a9190613345565b90525061189e925060019150839050613345565b9050611800565b5060005b60045460ff8216101561190a576000848260ff16815181106118cd576118cd613319565b6020026020010151905060008111156118f7576118eb8183866125a2565b6118f7818530856125e2565b506119036001826133fc565b90506118a9565b507f06faa29df47a52f63a9e50bca057cceba5be62d70ab7fe5af686e0506696bf71818588888688426040516119469796959493929190613554565b60405180910390a1505050506107e260018055565b600b602052816000526040600020818154811061197757600080fd5b6000918252602090912001546001600160a01b03169150829050565b6000828152602081905260409020600101546119ae816119cc565b6106b18383611b44565b6119c260006119cc565b6107e28282612675565b61066b81336126ec565b828114611a195760405162461bcd60e51b815260206004820152601160248201527011940e8e925b9d985b1a59081a5b9c1d5d607a1b60448201526064016107cf565b611a2285612745565b60005b83811015611ab857828282818110611a3f57611a3f613319565b90506060020160056000878785818110611a5b57611a5b613319565b9050602002016020810190611a709190612ed6565b6001600160a01b031681526020808201929092526040908101600090812060ff8b1682529092529020611aa382826136bf565b50611ab19050600182613345565b9050611a25565b505050505050565b611aca828261161f565b6107e2576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611b003390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611b4e828261161f565b156107e2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600260015403611bfb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107cf565b6002600155565b6000808260200135848888888760000135604051602001611c2896959493929190613739565b604051602081830303815290604052805190602001209050611c5981848060400190611c549190613795565b612799565b979650505050505050565b6001600160a01b0381166000908152600a6020908152604080832060ff86168452909152902054831115611cda5760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e74206c6f636b656420616d6f756e7400000000000060448201526064016107cf565b6001600160a01b03166000908152600a6020908152604080832060ff9094168352929052208054919091039055565b611d1281612745565b6001600160a01b0380831660008181526006602090815260408083208151606080820184529154808816825265ffffffffffff600160a01b808304821684880152600160d01b928390048216848701529787526005865284872060ff8b1688528652848720855194850186525498891684529688048716948301949094529290950490931692840192909252909190611dac838786612805565b90506000611dbb838887612805565b9050600081611dca848a6137db565b611dd491906137db565b9050611de1818a88611f32565b505050505050505050565b600081815260096020526040812060038101548291906001600160a01b03868116911614611e5c5760405162461bcd60e51b815260206004820152601860248201527f4f6e6c792070726f706f7365722063616e2063616e63656c000000000000000060448201526064016107cf565b6003810154600160d01b900465ffffffffffff16611ebc5760405162461bcd60e51b815260206004820152601960248201527f50726f706f73616c2068617320616c726561647920646f6e650000000000000060448201526064016107cf565b600281015460038201546001600160f81b03821691600160f81b900460ff1690600090611ef890600160d01b900465ffffffffffff1684613358565b60008881526009602052604081208181556001810182905560028101829055600381018290556004015595509093505050505b9250929050565b60048160ff1681548110611f4857611f48613319565b60009182526020909120015460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018690529091169063a9059cbb906044016020604051808303816000875af1158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7f91906137ee565b82811461200b5760405162461bcd60e51b815260206004820152601160248201527011940e8e925b9d985b1a59081a5b9c1d5d607a1b60448201526064016107cf565b60005b838110156106855782828281811061202857612028613319565b9050606002016006600087878581811061204457612044613319565b90506020020160208101906120599190612ed6565b6001600160a01b03168152602081019190915260400160002061207c82826136bf565b5061208a9050600182613345565b905061200e565b61161d60046000612d81565b60008080600b816120b160208701876132d4565b60018111156120c2576120c2612dcc565b60018111156120d3576120d3612dcc565b8152602001908152602001600020805490508460200160208101906120f89190613810565b60ff161061213b5760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964204e4654207479706560801b60448201526064016107cf565b6000600b8161214d60208801886132d4565b600181111561215e5761215e612dcc565b600181111561216f5761216f612dcc565b81526020019081526020016000208560200160208101906121909190613810565b60ff16815481106121a3576121a3613319565b6000918252602090912001546001600160a01b0316036121f85760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964204e4654207479706560801b60448201526064016107cf565b600061220a60e0860160c0870161382b565b65ffffffffffff16116122525760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964207175616e7469747960801b60448201526064016107cf565b60a084013515806122665750428460a00135115b6122a85760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420657870697265206461746560681b60448201526064016107cf565b6000806122bb6080870160608801613848565b6122cb60a0880160808901613810565b915091506000826001600160f81b0316116123185760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b60448201526064016107cf565b60045460ff8216106123645760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063757272656e6379207479706560581b60448201526064016107cf565b600854604080516101208101909152888152602080820190612388908a018a6132d4565b600181111561239957612399612dcc565b81526020018860200160208101906123b19190613810565b60ff1681526020016123c960608a0160408b01613863565b6001600160f01b031681526040805180820182526001600160f81b038716815260ff86166020828101919091528301526001600160a01b038c169082015260600161241a60e08a0160c08b0161382b565b65ffffffffffff16815260200161243760e08a0160c08b0161382b565b65ffffffffffff16815260a089013560209182015260008381526009825260409020825181559082015160018083018054909160ff1990911690838181111561248257612482612dcc565b0217905550604082015160018281018054606086015160ff918216610100958316860261ffff1617620100006001600160f01b039092169190910217909155608085015180516020909101516001600160f81b03909116600160f81b919092160217600284015560a084015160038401805460c087015160e08801516001600160a01b039094166001600160d01b031990921691909117600160a01b65ffffffffffff92831602176001600160d01b0316600160d01b91909316029190911790559201516004909101556008805460009061255e908490613345565b909155506000905061257660e0890160c08a0161382b565b6125919065ffffffffffff166001600160f81b038616613358565b919a91995091975095505050505050565b6001600160a01b0381166000908152600a6020908152604080832060ff86168452909152812080548592906125d8908490613345565b9091555050505050565b60048160ff16815481106125f8576125f8613319565b6000918252602090912001546040516323b872dd60e01b81526001600160a01b038581166004830152848116602483015260448201879052909116906323b872dd90606401600060405180830381600087803b15801561265757600080fd5b505af115801561266b573d6000803e3d6000fd5b5050505050505050565b60005b818110156106b157600483838381811061269457612694613319565b90506020020160208101906126a99190612ed6565b815460018082018455600093845260209093200180546001600160a01b0319166001600160a01b03929092169190911790556126e59082613345565b9050612678565b6126f6828261161f565b6107e25761270381612906565b61270e836020612918565b60405160200161271f9291906138a2565b60408051601f198184030181529082905262461bcd60e51b82526107cf91600401613917565b60045460ff82161061066b5760405162461bcd60e51b815260206004820152601960248201527f46503a3a496e76616c69642063757272656e637920747970650000000000000060448201526064016107cf565b600254604080516020601f85018190048102820181019092528381526000926001600160a01b0316916127f3919086908690819084018382808284376000920191909152506127ed9250899150612aba9050565b90612b0d565b6001600160a01b031614949350505050565b60008060008061282087805160208201516040909201519092565b919450925090506001600160a01b0383166128745760405162461bcd60e51b815260206004820152601460248201527323281d1d24b73b30b634b2103932b1b2b4bb32b960611b60448201526064016107cf565b8065ffffffffffff166000036128c25760405162461bcd60e51b815260206004820152601360248201527211940e8e925b9d985b1a5908191958da5b585b606a1b60448201526064016107cf565b60006128d765ffffffffffff83166064613358565b6128e965ffffffffffff851689613358565b6128f3919061394a565b90508015611c5957611c59818588611f32565b60606106136001600160a01b03831660145b60606000612927836002613358565b612932906002613345565b6001600160401b038111156129495761294961304b565b6040519080825280601f01601f191660200182016040528015612973576020820181803683370190505b509050600360fc1b8160008151811061298e5761298e613319565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106129bd576129bd613319565b60200101906001600160f81b031916908160001a90535060006129e1846002613358565b6129ec906001613345565b90505b6001811115612a64576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612a2057612a20613319565b1a60f81b828281518110612a3657612a36613319565b60200101906001600160f81b031916908160001a90535060049490941c93612a5d8161396c565b90506129ef565b508315612ab35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016107cf565b9392505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000612b1c8585612b31565b91509150612b2981612b73565b509392505050565b6000808251604103612b675760208301516040840151606085015160001a612b5b87828585612cbd565b94509450505050611f2b565b50600090506002611f2b565b6000816004811115612b8757612b87612dcc565b03612b8f5750565b6001816004811115612ba357612ba3612dcc565b03612bf05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016107cf565b6002816004811115612c0457612c04612dcc565b03612c515760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016107cf565b6003816004811115612c6557612c65612dcc565b0361066b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016107cf565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612cf45750600090506003612d78565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612d48573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612d7157600060019250925050612d78565b9150600090505b94509492505050565b508054600082559060005260206000209081019061066b91905b80821115612daf5760008155600101612d9b565b5090565b600060208284031215612dc557600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60028110612e0057634e487b7160e01b600052602160045260246000fd5b9052565b8981526101408101612e19602083018b612de2565b60ff98891660408301526001600160f01b0397909716606082015285516001600160f81b0316608082015260209095015190961660a08501526001600160a01b039290921660c084015265ffffffffffff90811660e084015216610100820152610120019190915292915050565b600060208284031215612e9957600080fd5b81356001600160e01b031981168114612ab357600080fd5b6001600160a01b038116811461066b57600080fd5b8035612ed181612eb1565b919050565b600060208284031215612ee857600080fd5b8135612ab381612eb1565b803560ff81168114612ed157600080fd5b60008083601f840112612f1657600080fd5b5081356001600160401b03811115612f2d57600080fd5b6020830191508360208260051b8501011115611f2b57600080fd5b60008083601f840112612f5a57600080fd5b5081356001600160401b03811115612f7157600080fd5b602083019150836020606083028501011115611f2b57600080fd5b600080600080600060608688031215612fa457600080fd5b612fad86612ef3565b945060208601356001600160401b0380821115612fc957600080fd5b612fd589838a01612f04565b90965094506040880135915080821115612fee57600080fd5b50612ffb88828901612f48565b969995985093965092949392505050565b6000806040838503121561301f57600080fd5b82359150602083013561303181612eb1565b809150509250929050565b803560028110612ed157600080fd5b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561307457600080fd5b61307d8361303c565b91506020808401356001600160401b038082111561309a57600080fd5b818601915086601f8301126130ae57600080fd5b8135818111156130c0576130c061304b565b8060051b604051601f19603f830116810181811085821117156130e5576130e561304b565b60405291825284820192508381018501918983111561310357600080fd5b938501935b828510156131285761311985612ec6565b84529385019392850192613108565b8096505050505050509250929050565b6000806000806060858703121561314e57600080fd5b8435935060208501356001600160401b038082111561316c57600080fd5b61317888838901612f04565b9095509350604087013591508082111561319157600080fd5b508501606081880312156131a457600080fd5b939692955090935050565b600080604083850312156131c257600080fd5b82356131cd81612eb1565b91506131db60208401612ef3565b90509250929050565b600080602083850312156131f757600080fd5b82356001600160401b0381111561320d57600080fd5b61321985828601612f04565b90969095509350505050565b65ffffffffffff8116811461066b57600080fd5b8035612ed181613225565b6000806040838503121561325757600080fd5b82359150602083013561303181613225565b6000806000806040858703121561327f57600080fd5b84356001600160401b038082111561329657600080fd5b6132a288838901612f04565b909650945060208701359150808211156132bb57600080fd5b506132c887828801612f48565b95989497509550505050565b6000602082840312156132e657600080fd5b612ab38261303c565b6000806040838503121561330257600080fd5b61330b8361303c565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156106135761061361332f565b80820281158282048414176106135761061361332f565b81835260006001600160fb1b0383111561338857600080fd5b8260051b80836020870137939093016020019392505050565b60006101008b83528a60208401528060408401526133c28184018a8c61336f565b6060840198909852505060ff9490941660808501526001600160a01b0392831660a0850152911660c083015260e090910152949350505050565b60ff81811683821601908111156106135761061361332f565b600081518084526020808501945080840160005b8381101561344557815187529582019590820190600101613429565b509495945050505050565b60808152600061346460808301878961336f565b6001600160a01b038616602084015282810360408401526134858186613415565b9150508260608301529695505050505050565b6000823560fe198336030181126134ae57600080fd5b9190910192915050565b80356001600160f01b0381168114612ed157600080fd5b80356001600160f81b0381168114612ed157600080fd5b6000808335601e198436030181126134fd57600080fd5b83016020810192503590506001600160401b0381111561351c57600080fd5b803603821315611f2b57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8781526000602060c08184015261356e60c084018a613415565b8381036040850152878152818101600589901b820183018a6000805b8c81101561368357858403601f190185528235368f900360fe190181126135af578283fd5b8e016101006135c6866135c18461303c565b612de2565b6135d1898301612ef3565b60ff818116888c01526001600160f01b036135ee604086016134b8565b166040890152606091506001600160f81b0361360b8584016134cf565b16828901526080915080613620838601612ef3565b1682890152505060a080830135818801525061363e60c08301613239565b65ffffffffffff1660c087015260e0613659838201846134e6565b9350828289015261366d838901858361352b565b988b01989750505093880193505060010161358a565b5050506001600160a01b038916606087015285810360808701526136a78189613415565b9450505050508260a083015298975050505050505050565b81356136ca81612eb1565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356136f681613225565b65ffffffffffff60a01b60a09190911b166001600160d01b031991821683178117845560408501359161372883613225565b921760d09190911b90911617905550565b868152606086901b6bffffffffffffffffffffffff191660208201526034810185905260006001600160fb1b0384111561377257600080fd5b8360051b8086605485013760549201918201929092526074019695505050505050565b6000808335601e198436030181126137ac57600080fd5b8301803591506001600160401b038211156137c657600080fd5b602001915036819003821315611f2b57600080fd5b818103818111156106135761061361332f565b60006020828403121561380057600080fd5b81518015158114612ab357600080fd5b60006020828403121561382257600080fd5b612ab382612ef3565b60006020828403121561383d57600080fd5b8135612ab381613225565b60006020828403121561385a57600080fd5b612ab3826134cf565b60006020828403121561387557600080fd5b612ab3826134b8565b60005b83811015613899578181015183820152602001613881565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516138da81601785016020880161387e565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161390b81602884016020880161387e565b01602801949350505050565b602081526000825180602084015261393681604085016020870161387e565b601f01601f19169190910160400192915050565b60008261396757634e487b7160e01b600052601260045260246000fd5b500490565b60008161397b5761397b61332f565b50600019019056fea264697066735822122063387aa30c970af7fd7a9d2a4267dd3898d3b3b1ffc7622c78c85523ab28dbbf64736f6c6343000811003300000000000000000000000062d0e5e193854a4943dec1a48ffc3d6744ab5f54000000000000000000000000000000000000000000000000000000000000012c

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638f2c5cdc1161010f578063b5c5692b116100a2578063c48acf0c11610071578063c48acf0c146105a0578063d547741f146105b3578063ebc2a789146105c6578063feac729d146105d957600080fd5b8063b5c5692b14610546578063bf779b031461054f578063c410279914610562578063c441e73f1461058d57600080fd5b8063983d2737116100de578063983d2737146104f15780639870d7fe14610518578063a217fddf1461052b578063ac8a584a1461053357600080fd5b80638f2c5cdc1461049c5780638f49bb6b146104af57806390a708ab146104d657806391d14854146104de57600080fd5b806335755dfc1161018757806359d599e91161015657806359d599e91461041f5780635faf9b0b1461043257806379aecf33146104765780638ca1fad01461048957600080fd5b806335755dfc1461036957806336568abe1461037c5780633c23163e1461038f578063461da039146103a257600080fd5b806317e95526116101c357806317e95526146102fd578063248a9ca3146103125780632d39e69a146103435780632f2ff15d1461035657600080fd5b8063013cf08b146101ea57806301ffc9a7146102af5780630cc45d59146102d2575b600080fd5b6102916101f8366004612db3565b60096020908152600091825260409182902080546001820154845180860190955260028301546001600160f81b038116865260ff600160f81b909104811694860194909452600383015460049093015491948482169461010083041693620100009092046001600160f01b03169290916001600160a01b03811691600160a01b820465ffffffffffff90811692600160d01b9004169089565b6040516102a699989796959493929190612e04565b60405180910390f35b6102c26102bd366004612e87565b6105e2565b60405190151581526020016102a6565b6102e56102e0366004612db3565b610619565b6040516001600160a01b0390911681526020016102a6565b61031061030b366004612ed6565b610643565b005b610335610320366004612db3565b60009081526020819052604090206001015490565b6040519081526020016102a6565b610310610351366004612f8c565b61066e565b61031061036436600461300c565b61068c565b610310610377366004613061565b6106b6565b61031061038a36600461300c565b610763565b61031061039d366004613138565b6107e6565b6103f16103b03660046131af565b60056020908152600092835260408084209091529082529020546001600160a01b0381169065ffffffffffff600160a01b8204811691600160d01b90041683565b604080516001600160a01b03909416845265ffffffffffff92831660208501529116908201526060016102a6565b61031061042d3660046131e4565b610e85565b6103f1610440366004612ed6565b6006602052600090815260409020546001600160a01b0381169065ffffffffffff600160a01b8204811691600160d01b90041683565b610310610484366004613244565b61104a565b610310610497366004613269565b6115e2565b6103106104aa366004612db3565b6115f8565b6103357f9d485b614a48afee9f47148d6f625486f74b5ac89edeb08e8f6b7bcdd295e35581565b61031061160b565b6102c26104ec36600461300c565b61161f565b6103357f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b610310610526366004612ed6565b611648565b610335600081565b610310610541366004612ed6565b61167c565b61033560075481565b61031061055d3660046132d4565b6116b0565b6103356105703660046131af565b600a60209081526000928352604080842090915290825290205481565b61031061059b3660046131e4565b6116fb565b6102e56105ae3660046132ef565b61195b565b6103106105c136600461300c565b611993565b6103106105d43660046131e4565b6119b8565b61033560085481565b60006001600160e01b03198216637965db0b60e01b148061061357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6004818154811061062957600080fd5b6000918252602090912001546001600160a01b0316905081565b61064d60006119cc565b600280546001600160a01b0319166001600160a01b03831617905550565b50565b61067860006119cc565b61068585858585856119d6565b5050505050565b6000828152602081905260409020600101546106a7816119cc565b6106b18383611ac0565b505050565b6106c060006119cc565b60005b81518110156106b157600b60008460018111156106e2576106e2612dcc565b60018111156106f3576106f3612dcc565b815260200190815260200160002082828151811061071357610713613319565b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915561075c9082613345565b90506106c3565b6001600160a01b03811633146107d85760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107e28282611b44565b5050565b6107ee611ba9565b803560208201357f9d485b614a48afee9f47148d6f625486f74b5ac89edeb08e8f6b7bcdd295e355811461087a5760405162461bcd60e51b815260206004820152602d60248201527f5369676e617475726556657269666965723a496e76616c696420636f6e74726160448201526c31ba1034b232b73a34b334b2b960991b60648201526084016107cf565b42600354836108899190613345565b10156108ef5760405162461bcd60e51b815260206004820152602f60248201527f5369676e617475726556657269666965723a5369676e6174757265206861732060448201526e185b1c9958591e48195e1c1a5c9959608a1b60648201526084016107cf565b336108fd8787878488611c02565b61093d5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b60448201526064016107cf565b8461098a5760405162461bcd60e51b815260206004820152601f60248201527f4d7573742068617665206174206c65617374206f6e6520746f6b656e2049440060448201526064016107cf565b60008781526009602090815260408083208151610120810190925280548252600180820154929391929184019160ff16908111156109ca576109ca612dcc565b60018111156109db576109db612dcc565b81526001820154610100810460ff908116602080850191909152620100009092046001600160f01b0316604080850191909152805180820190915260028501546001600160f81b0381168252600160f81b900490911691810191909152606082015260038201546001600160a01b0381166080830152600160a01b810465ffffffffffff90811660a0840152600160d01b9091041660c082015260049091015460e0909101529050600081602001516001811115610a9b57610a9b612dcc565b14610ae85760405162461bcd60e51b815260206004820152601760248201527f4d757374206265204552433732312070726f706f73616c00000000000000000060448201526064016107cf565b60a08101516001600160a01b0316610b3c5760405162461bcd60e51b8152602060048201526017602482015276141c9bdc1bdcd85b08191bd95cc81b9bdd08195e1a5cdd604a1b60448201526064016107cf565b816001600160a01b03168160a001516001600160a01b031603610ba15760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f7420616363657074206f776e2070726f706f73616c00000000000060448201526064016107cf565b6101008101511580610bb7575042816101000151115b610c035760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2068617320616c726561647920657870697265640000000060448201526064016107cf565b60e081015165ffffffffffff16861115610c575760405162461bcd60e51b8152602060048201526015602482015274496e73756666696369656e74207175616e7469747960581b60448201526064016107cf565b608081015180516020909101516000610c79896001600160f81b038516613358565b9050610c8a81838660a00151611c64565b60e0840180518a900365ffffffffffff90811680835260008e815260096020526040812060030180546001600160d01b0316600160d01b909302929092179091559151169003610cff5760008b8152600960205260408120818155600181018290556002810182905560038101829055600401555b6000600b600086602001516001811115610d1b57610d1b612dcc565b6001811115610d2c57610d2c612dcc565b8152602001908152602001600020856040015160ff1681548110610d5257610d52613319565b60009182526020822001546001600160a01b031691505b8a811015610e1257816001600160a01b03166342842e0e888860a001518f8f86818110610d9857610d98613319565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610def57600080fd5b505af1158015610e03573d6000803e3d6000fd5b50505050600181019050610d69565b50610e1f86838386611d09565b7f88c044ea4ab7357d432e58bc7ed5554108338fd9004ab5bca2b46043469647d985600001518d8d8d86888c8c60a0015142604051610e66999897969594939291906133a1565b60405180910390a15050505050505050610e7f60018055565b50505050565b610e8d611ba9565b80610eda5760405162461bcd60e51b815260206004820152601f60248201527f4d7573742068617665206174206c65617374206f6e652070726f706f73616c0060448201526064016107cf565b6004546000906001600160401b03811115610ef757610ef761304b565b604051908082528060200260200182016040528015610f20578160200160208202803683370190505b5090503360005b83811015610f9b57600080610f5484888886818110610f4857610f48613319565b90506020020135611dec565b9150915081858260ff1681518110610f6e57610f6e613319565b60200260200101818151610f829190613345565b905250610f9491506001905082613345565b9050610f27565b5060005b60045460ff82161015610fff576000838260ff1681518110610fc357610fc3613319565b602002602001015190506000811115610fec57610fe1818385611c64565b610fec818484611f32565b50610ff86001826133fc565b9050610f9f565b507f4b482dfc5a7e4304b49429716784710edbb77a745d8adf43900dcad0e7b609c78484838542604051611037959493929190613450565b60405180910390a150506107e260018055565b611052611ba9565b60008165ffffffffffff16116110aa5760405162461bcd60e51b815260206004820152601f60248201527f5175616e74697479206d7573742062652067726561746572207468616e20300060448201526064016107cf565b60008281526009602090815260408083208151610120810190925280548252600180820154929391929184019160ff16908111156110ea576110ea612dcc565b60018111156110fb576110fb612dcc565b8152600182810154610100810460ff908116602080860191909152620100009092046001600160f01b0316604080860191909152805180820190915260028601546001600160f81b0381168252600160f81b900490911691810191909152606083015260038301546001600160a01b0381166080840152600160a01b810465ffffffffffff90811660a0850152600160d01b9091041660c083015260049092015460e090910152909150816020015160018111156111bb576111bb612dcc565b146112085760405162461bcd60e51b815260206004820152601860248201527f4d75737420626520455243313135352070726f706f73616c000000000000000060448201526064016107cf565b60a08101516001600160a01b031661125c5760405162461bcd60e51b8152602060048201526017602482015276141c9bdc1bdcd85b08191bd95cc81b9bdd08195e1a5cdd604a1b60448201526064016107cf565b60a081015133906001600160a01b03168190036112bb5760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f7420616363657074206f776e2070726f706f73616c00000000000060448201526064016107cf565b61010082015115806112d1575042826101000151115b61131d5760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2068617320616c726561647920657870697265640000000060448201526064016107cf565b8265ffffffffffff168260e0015165ffffffffffff1610156113795760405162461bcd60e51b8152602060048201526015602482015274496e73756666696369656e74207175616e7469747960581b60448201526064016107cf565b6080820151805160209091015160006113a365ffffffffffff87166001600160f81b038516613358565b90506113b481838760a00151611c64565b60e08501805187900365ffffffffffff90811680835260008a815260096020526040812060030180546001600160d01b0316600160d01b909302929092179091559151169003611429576000878152600960205260408120818155600181018290556002810182905560038101829055600401555b6000600b60008760200151600181111561144557611445612dcc565b600181111561145657611456612dcc565b8152602001908152602001600020866040015160ff168154811061147c5761147c613319565b60009182526020909120015460a0878101516060890151604051637921219560e11b81526001600160a01b038a8116600483015292831660248201526001600160f01b03909116604482015265ffffffffffff8b1660648201526084810192909252600260a483015261060f60f31b60c48301529091169150819063f242432a9060e401600060405180830381600087803b15801561151a57600080fd5b505af115801561152e573d6000803e3d6000fd5b5050505061153e85838386611d09565b855160608088015160a0808a015160408051958652602086018e90526001600160f01b039093168584015265ffffffffffff8c16938501939093526080840186905260ff8716908401526001600160a01b0388811660c085015290911660e083015242610100830152517f998b997948f4e52c65d38c04e811ec24af58a769594d592bba1e0bb726646304918190036101200190a15050505050506107e260018055565b6115ec60006119cc565b610e7f84848484611fc8565b61160260006119cc565b61066b81600355565b61161560006119cc565b61161d612091565b565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61165260006119cc565b61066b7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611ac0565b61168660006119cc565b61066b7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611b44565b6116ba60006119cc565b600b60008260018111156116d0576116d0612dcc565b60018111156116e1576116e1612dcc565b8152602001908152602001600020600061066b9190612d81565b611703611ba9565b806117505760405162461bcd60e51b815260206004820152601f60248201527f4d7573742068617665206174206c65617374206f6e652070726f706f73616c0060448201526064016107cf565b6000816001600160401b0381111561176a5761176a61304b565b604051908082528060200260200182016040528015611793578160200160208202803683370190505b506004549091506000906001600160401b038111156117b4576117b461304b565b6040519080825280602002602001820160405280156117dd578160200160208202803683370190505b506007805491925033919060019060006117f78385613345565b90915550600090505b858110156118a557600080600061183b86868c8c8881811061182457611824613319565b90506020028101906118369190613498565b61209d565b9250925092508288858151811061185457611854613319565b60200260200101818152505081878260ff168151811061187657611876613319565b6020026020010181815161188a9190613345565b90525061189e925060019150839050613345565b9050611800565b5060005b60045460ff8216101561190a576000848260ff16815181106118cd576118cd613319565b6020026020010151905060008111156118f7576118eb8183866125a2565b6118f7818530856125e2565b506119036001826133fc565b90506118a9565b507f06faa29df47a52f63a9e50bca057cceba5be62d70ab7fe5af686e0506696bf71818588888688426040516119469796959493929190613554565b60405180910390a1505050506107e260018055565b600b602052816000526040600020818154811061197757600080fd5b6000918252602090912001546001600160a01b03169150829050565b6000828152602081905260409020600101546119ae816119cc565b6106b18383611b44565b6119c260006119cc565b6107e28282612675565b61066b81336126ec565b828114611a195760405162461bcd60e51b815260206004820152601160248201527011940e8e925b9d985b1a59081a5b9c1d5d607a1b60448201526064016107cf565b611a2285612745565b60005b83811015611ab857828282818110611a3f57611a3f613319565b90506060020160056000878785818110611a5b57611a5b613319565b9050602002016020810190611a709190612ed6565b6001600160a01b031681526020808201929092526040908101600090812060ff8b1682529092529020611aa382826136bf565b50611ab19050600182613345565b9050611a25565b505050505050565b611aca828261161f565b6107e2576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611b003390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611b4e828261161f565b156107e2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600260015403611bfb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107cf565b6002600155565b6000808260200135848888888760000135604051602001611c2896959493929190613739565b604051602081830303815290604052805190602001209050611c5981848060400190611c549190613795565b612799565b979650505050505050565b6001600160a01b0381166000908152600a6020908152604080832060ff86168452909152902054831115611cda5760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e74206c6f636b656420616d6f756e7400000000000060448201526064016107cf565b6001600160a01b03166000908152600a6020908152604080832060ff9094168352929052208054919091039055565b611d1281612745565b6001600160a01b0380831660008181526006602090815260408083208151606080820184529154808816825265ffffffffffff600160a01b808304821684880152600160d01b928390048216848701529787526005865284872060ff8b1688528652848720855194850186525498891684529688048716948301949094529290950490931692840192909252909190611dac838786612805565b90506000611dbb838887612805565b9050600081611dca848a6137db565b611dd491906137db565b9050611de1818a88611f32565b505050505050505050565b600081815260096020526040812060038101548291906001600160a01b03868116911614611e5c5760405162461bcd60e51b815260206004820152601860248201527f4f6e6c792070726f706f7365722063616e2063616e63656c000000000000000060448201526064016107cf565b6003810154600160d01b900465ffffffffffff16611ebc5760405162461bcd60e51b815260206004820152601960248201527f50726f706f73616c2068617320616c726561647920646f6e650000000000000060448201526064016107cf565b600281015460038201546001600160f81b03821691600160f81b900460ff1690600090611ef890600160d01b900465ffffffffffff1684613358565b60008881526009602052604081208181556001810182905560028101829055600381018290556004015595509093505050505b9250929050565b60048160ff1681548110611f4857611f48613319565b60009182526020909120015460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018690529091169063a9059cbb906044016020604051808303816000875af1158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7f91906137ee565b82811461200b5760405162461bcd60e51b815260206004820152601160248201527011940e8e925b9d985b1a59081a5b9c1d5d607a1b60448201526064016107cf565b60005b838110156106855782828281811061202857612028613319565b9050606002016006600087878581811061204457612044613319565b90506020020160208101906120599190612ed6565b6001600160a01b03168152602081019190915260400160002061207c82826136bf565b5061208a9050600182613345565b905061200e565b61161d60046000612d81565b60008080600b816120b160208701876132d4565b60018111156120c2576120c2612dcc565b60018111156120d3576120d3612dcc565b8152602001908152602001600020805490508460200160208101906120f89190613810565b60ff161061213b5760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964204e4654207479706560801b60448201526064016107cf565b6000600b8161214d60208801886132d4565b600181111561215e5761215e612dcc565b600181111561216f5761216f612dcc565b81526020019081526020016000208560200160208101906121909190613810565b60ff16815481106121a3576121a3613319565b6000918252602090912001546001600160a01b0316036121f85760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964204e4654207479706560801b60448201526064016107cf565b600061220a60e0860160c0870161382b565b65ffffffffffff16116122525760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964207175616e7469747960801b60448201526064016107cf565b60a084013515806122665750428460a00135115b6122a85760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420657870697265206461746560681b60448201526064016107cf565b6000806122bb6080870160608801613848565b6122cb60a0880160808901613810565b915091506000826001600160f81b0316116123185760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b60448201526064016107cf565b60045460ff8216106123645760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063757272656e6379207479706560581b60448201526064016107cf565b600854604080516101208101909152888152602080820190612388908a018a6132d4565b600181111561239957612399612dcc565b81526020018860200160208101906123b19190613810565b60ff1681526020016123c960608a0160408b01613863565b6001600160f01b031681526040805180820182526001600160f81b038716815260ff86166020828101919091528301526001600160a01b038c169082015260600161241a60e08a0160c08b0161382b565b65ffffffffffff16815260200161243760e08a0160c08b0161382b565b65ffffffffffff16815260a089013560209182015260008381526009825260409020825181559082015160018083018054909160ff1990911690838181111561248257612482612dcc565b0217905550604082015160018281018054606086015160ff918216610100958316860261ffff1617620100006001600160f01b039092169190910217909155608085015180516020909101516001600160f81b03909116600160f81b919092160217600284015560a084015160038401805460c087015160e08801516001600160a01b039094166001600160d01b031990921691909117600160a01b65ffffffffffff92831602176001600160d01b0316600160d01b91909316029190911790559201516004909101556008805460009061255e908490613345565b909155506000905061257660e0890160c08a0161382b565b6125919065ffffffffffff166001600160f81b038616613358565b919a91995091975095505050505050565b6001600160a01b0381166000908152600a6020908152604080832060ff86168452909152812080548592906125d8908490613345565b9091555050505050565b60048160ff16815481106125f8576125f8613319565b6000918252602090912001546040516323b872dd60e01b81526001600160a01b038581166004830152848116602483015260448201879052909116906323b872dd90606401600060405180830381600087803b15801561265757600080fd5b505af115801561266b573d6000803e3d6000fd5b5050505050505050565b60005b818110156106b157600483838381811061269457612694613319565b90506020020160208101906126a99190612ed6565b815460018082018455600093845260209093200180546001600160a01b0319166001600160a01b03929092169190911790556126e59082613345565b9050612678565b6126f6828261161f565b6107e25761270381612906565b61270e836020612918565b60405160200161271f9291906138a2565b60408051601f198184030181529082905262461bcd60e51b82526107cf91600401613917565b60045460ff82161061066b5760405162461bcd60e51b815260206004820152601960248201527f46503a3a496e76616c69642063757272656e637920747970650000000000000060448201526064016107cf565b600254604080516020601f85018190048102820181019092528381526000926001600160a01b0316916127f3919086908690819084018382808284376000920191909152506127ed9250899150612aba9050565b90612b0d565b6001600160a01b031614949350505050565b60008060008061282087805160208201516040909201519092565b919450925090506001600160a01b0383166128745760405162461bcd60e51b815260206004820152601460248201527323281d1d24b73b30b634b2103932b1b2b4bb32b960611b60448201526064016107cf565b8065ffffffffffff166000036128c25760405162461bcd60e51b815260206004820152601360248201527211940e8e925b9d985b1a5908191958da5b585b606a1b60448201526064016107cf565b60006128d765ffffffffffff83166064613358565b6128e965ffffffffffff851689613358565b6128f3919061394a565b90508015611c5957611c59818588611f32565b60606106136001600160a01b03831660145b60606000612927836002613358565b612932906002613345565b6001600160401b038111156129495761294961304b565b6040519080825280601f01601f191660200182016040528015612973576020820181803683370190505b509050600360fc1b8160008151811061298e5761298e613319565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106129bd576129bd613319565b60200101906001600160f81b031916908160001a90535060006129e1846002613358565b6129ec906001613345565b90505b6001811115612a64576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612a2057612a20613319565b1a60f81b828281518110612a3657612a36613319565b60200101906001600160f81b031916908160001a90535060049490941c93612a5d8161396c565b90506129ef565b508315612ab35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016107cf565b9392505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000612b1c8585612b31565b91509150612b2981612b73565b509392505050565b6000808251604103612b675760208301516040840151606085015160001a612b5b87828585612cbd565b94509450505050611f2b565b50600090506002611f2b565b6000816004811115612b8757612b87612dcc565b03612b8f5750565b6001816004811115612ba357612ba3612dcc565b03612bf05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016107cf565b6002816004811115612c0457612c04612dcc565b03612c515760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016107cf565b6003816004811115612c6557612c65612dcc565b0361066b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016107cf565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612cf45750600090506003612d78565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612d48573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612d7157600060019250925050612d78565b9150600090505b94509492505050565b508054600082559060005260206000209081019061066b91905b80821115612daf5760008155600101612d9b565b5090565b600060208284031215612dc557600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60028110612e0057634e487b7160e01b600052602160045260246000fd5b9052565b8981526101408101612e19602083018b612de2565b60ff98891660408301526001600160f01b0397909716606082015285516001600160f81b0316608082015260209095015190961660a08501526001600160a01b039290921660c084015265ffffffffffff90811660e084015216610100820152610120019190915292915050565b600060208284031215612e9957600080fd5b81356001600160e01b031981168114612ab357600080fd5b6001600160a01b038116811461066b57600080fd5b8035612ed181612eb1565b919050565b600060208284031215612ee857600080fd5b8135612ab381612eb1565b803560ff81168114612ed157600080fd5b60008083601f840112612f1657600080fd5b5081356001600160401b03811115612f2d57600080fd5b6020830191508360208260051b8501011115611f2b57600080fd5b60008083601f840112612f5a57600080fd5b5081356001600160401b03811115612f7157600080fd5b602083019150836020606083028501011115611f2b57600080fd5b600080600080600060608688031215612fa457600080fd5b612fad86612ef3565b945060208601356001600160401b0380821115612fc957600080fd5b612fd589838a01612f04565b90965094506040880135915080821115612fee57600080fd5b50612ffb88828901612f48565b969995985093965092949392505050565b6000806040838503121561301f57600080fd5b82359150602083013561303181612eb1565b809150509250929050565b803560028110612ed157600080fd5b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561307457600080fd5b61307d8361303c565b91506020808401356001600160401b038082111561309a57600080fd5b818601915086601f8301126130ae57600080fd5b8135818111156130c0576130c061304b565b8060051b604051601f19603f830116810181811085821117156130e5576130e561304b565b60405291825284820192508381018501918983111561310357600080fd5b938501935b828510156131285761311985612ec6565b84529385019392850192613108565b8096505050505050509250929050565b6000806000806060858703121561314e57600080fd5b8435935060208501356001600160401b038082111561316c57600080fd5b61317888838901612f04565b9095509350604087013591508082111561319157600080fd5b508501606081880312156131a457600080fd5b939692955090935050565b600080604083850312156131c257600080fd5b82356131cd81612eb1565b91506131db60208401612ef3565b90509250929050565b600080602083850312156131f757600080fd5b82356001600160401b0381111561320d57600080fd5b61321985828601612f04565b90969095509350505050565b65ffffffffffff8116811461066b57600080fd5b8035612ed181613225565b6000806040838503121561325757600080fd5b82359150602083013561303181613225565b6000806000806040858703121561327f57600080fd5b84356001600160401b038082111561329657600080fd5b6132a288838901612f04565b909650945060208701359150808211156132bb57600080fd5b506132c887828801612f48565b95989497509550505050565b6000602082840312156132e657600080fd5b612ab38261303c565b6000806040838503121561330257600080fd5b61330b8361303c565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156106135761061361332f565b80820281158282048414176106135761061361332f565b81835260006001600160fb1b0383111561338857600080fd5b8260051b80836020870137939093016020019392505050565b60006101008b83528a60208401528060408401526133c28184018a8c61336f565b6060840198909852505060ff9490941660808501526001600160a01b0392831660a0850152911660c083015260e090910152949350505050565b60ff81811683821601908111156106135761061361332f565b600081518084526020808501945080840160005b8381101561344557815187529582019590820190600101613429565b509495945050505050565b60808152600061346460808301878961336f565b6001600160a01b038616602084015282810360408401526134858186613415565b9150508260608301529695505050505050565b6000823560fe198336030181126134ae57600080fd5b9190910192915050565b80356001600160f01b0381168114612ed157600080fd5b80356001600160f81b0381168114612ed157600080fd5b6000808335601e198436030181126134fd57600080fd5b83016020810192503590506001600160401b0381111561351c57600080fd5b803603821315611f2b57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8781526000602060c08184015261356e60c084018a613415565b8381036040850152878152818101600589901b820183018a6000805b8c81101561368357858403601f190185528235368f900360fe190181126135af578283fd5b8e016101006135c6866135c18461303c565b612de2565b6135d1898301612ef3565b60ff818116888c01526001600160f01b036135ee604086016134b8565b166040890152606091506001600160f81b0361360b8584016134cf565b16828901526080915080613620838601612ef3565b1682890152505060a080830135818801525061363e60c08301613239565b65ffffffffffff1660c087015260e0613659838201846134e6565b9350828289015261366d838901858361352b565b988b01989750505093880193505060010161358a565b5050506001600160a01b038916606087015285810360808701526136a78189613415565b9450505050508260a083015298975050505050505050565b81356136ca81612eb1565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356136f681613225565b65ffffffffffff60a01b60a09190911b166001600160d01b031991821683178117845560408501359161372883613225565b921760d09190911b90911617905550565b868152606086901b6bffffffffffffffffffffffff191660208201526034810185905260006001600160fb1b0384111561377257600080fd5b8360051b8086605485013760549201918201929092526074019695505050505050565b6000808335601e198436030181126137ac57600080fd5b8301803591506001600160401b038211156137c657600080fd5b602001915036819003821315611f2b57600080fd5b818103818111156106135761061361332f565b60006020828403121561380057600080fd5b81518015158114612ab357600080fd5b60006020828403121561382257600080fd5b612ab382612ef3565b60006020828403121561383d57600080fd5b8135612ab381613225565b60006020828403121561385a57600080fd5b612ab3826134cf565b60006020828403121561387557600080fd5b612ab3826134b8565b60005b83811015613899578181015183820152602001613881565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516138da81601785016020880161387e565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161390b81602884016020880161387e565b01602801949350505050565b602081526000825180602084015261393681604085016020870161387e565b601f01601f19169190910160400192915050565b60008261396757634e487b7160e01b600052601260045260246000fd5b500490565b60008161397b5761397b61332f565b50600019019056fea264697066735822122063387aa30c970af7fd7a9d2a4267dd3898d3b3b1ffc7622c78c85523ab28dbbf64736f6c63430008110033

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

00000000000000000000000062d0e5e193854a4943dec1a48ffc3d6744ab5f54000000000000000000000000000000000000000000000000000000000000012c

-----Decoded View---------------
Arg [0] : verificator_ (address): 0x62d0E5E193854A4943dec1a48FfC3D6744Ab5f54
Arg [1] : expireTime_ (uint256): 300

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000062d0e5e193854a4943dec1a48ffc3d6744ab5f54
Arg [1] : 000000000000000000000000000000000000000000000000000000000000012c


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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