Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- GameItemContract
- Optimization enabled
- true
- Compiler version
- v0.8.9+commit.e5eed63a
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2025-02-28T10:03:44.419414Z
Contract source code
// Sources flattened with hardhat v2.22.17 https://hardhat.org // SPDX-License-Identifier: MIT // File contracts/interfaces/IGameItem.sol // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @notice Interface for GameItemContract interface IGameItem { /// @notice this event is emitted when NFT GameItem is minted /// @param to new owner of GameItem /// @param tokenId id ow new GameItem /// @param quality quality(0-4) of new GameItem /// @param hacker the hacker who minted this item /// @param licenseId the id of hacker license who minted this item event Minted( address indexed to, uint256 indexed tokenId, uint8 quality, address hacker, uint256 licenseId); event MintedForUser( address indexed to, uint256 indexed tokenId, uint8 quality, uint256 financialWalletPayment, address hacker, uint256 licenseId); function version() external view returns (uint32); /// @notice gets creator's address of specific GameItem /// @param _tokenId token id of specific GameItem /// @return minter's address function getItemCreator(uint256 _tokenId) external view returns (address); /// @notice returns hacker address of specific GameItem /// @param _tokenId token id of specific GameItem /// @return hacker's address function getItemHacker(uint256 _tokenId) external view returns (address); /// @notice returns hacker address of specific GameItem /// @param _tokenId token id of specific GameItem /// @return hacker's address function getItemValidator(uint256 _tokenId) external view returns (uint256); /// @notice gets quality of specific GameItem /// @param _tokenId token id of specific GameItem /// @return uint8 parameter. quality of GameItem function getItemQuality(uint256 _tokenId) external view returns (uint8); /// @notice gets season of specific GameItem /// @param _tokenId token id of specific GameItem /// @return uint256 parameter. season id function getItemSeason(uint256 _tokenId) external view returns (uint256); /// @notice gets market state of specific GameItem /// @param _tokenId token id of specific GameItem /// @return uint8 parameter. Market state of GameItem function getItemState(uint256 _tokenId) external view returns (uint8); /// @notice changes market state of specific GameItem /// @param _tokenId token id of specific GameItem /// @param _state (0-2) new item state function changeItemState(uint256 _tokenId, uint8 _state) external; /// @notice mints new GameItem /// @dev can be called only via DataCubeContract or ValidatorLicenseContract /// @dev emits "Minted" event /// @param _receiver receiver's address of new GameItem /// @param _HLTokenId token id of specific ValidatorLicense /// @param _seasonId token id of season /// @param _HEXQuality quality of new GameItem /// @param _metadataURL URL to metadata storage function mintFromCube( address _receiver, uint256 _HLTokenId, uint256 _seasonId, uint8 _HEXQuality, string memory _metadataURL) external; /// @notice mints new GameItem /// @dev can be called by user, with signature /// @dev sends GUNs to this contract address /// @param _HLTokenId token id of specific ValidatorLicense /// @param _seasonId token id of season /// @param _quality quality of new GameItem /// @param _price price(in GUNs) od DataCube decoding /// @param _metadataURL URL to metadata storage function mintForUser( uint256 _HLTokenId, uint256 _seasonId, uint8 _quality, uint256 _price, string memory _metadataURL, address receiver ) payable external; function burn(uint256 _tokenId) external; function bridgeBurn(uint256 _tokenId) external; function bridgeMint(address to, uint256 _tokenId) external; } // File openzeppelin-contracts-upgradeable/access/IAccessControlUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } // File openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } // File openzeppelin-contracts-upgradeable/utils/ContextUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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 ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; } // File openzeppelin-contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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 IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File openzeppelin-contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; } // File openzeppelin-contracts-upgradeable/utils/StringsUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File openzeppelin-contracts-upgradeable/access/AccessControlUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol) pragma solidity ^0.8.0; /** * @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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } 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, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @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 { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.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 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. */ 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. */ 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`. */ 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. * * [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. */ 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. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; } // File openzeppelin-contracts-upgradeable/security/PausableUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (security/Pausable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal initializer { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal initializer { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; } // File contracts/PlatformSettings.sol // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @title A platform settings for OTG contracts /// @notice Admin can use this contract for granting and revoking roles, pause and unpause platform, set new wallets for fee receiving /// @dev This contract inherits 'Initializable', 'AccessControlUpgradeable', 'PausableUpgradeable' contracts form openzeppelin library contract PlatformSettings is Initializable, AccessControlUpgradeable, PausableUpgradeable{ bytes32 public constant SECONDARY_ADMIN_ROLE = keccak256("SECONDARY_ADMIN_ROLE"); bytes32 public constant BACKEND_ROLE = keccak256("BACKEND_ROLE"); uint256 public constant gunDecimals = 10**18; uint256 public constant PERCENT_DENOMINATOR = 100; // address of main admin address public initialAdmin; // address of financial wallet (withdraws GUNs from contract) address payable public financialWallet; // percentage that represents validator fee during decoding process uint256 public validatorFeePercentageForDecoding; // percentage that represents platform fee during decoding process uint256 public platformFeePercentageForDecoding; bytes32 public constant BRIDGE_ROLE = keccak256("BRIDGE_ROLE"); bytes32 public constant DECODER_ROLE = keccak256("DECODER_ROLE"); /// @notice this event is emitted when new financial wallet is set /// @param newWallet address of new financial wallet event ChangedFinancialWallet( address indexed newWallet ); error InvalidRole(address caller, bytes32 role); error IncorrectFeeDistribution(); error AlreadyHasRole(address account, bytes32 role); error AlreadyHasNotRole(address account, bytes32 role); /// @notice A disposable function for initializing contract /// @param _admin address of initial admin of contract /// @dev Grants caller with admin role /// @dev Also calls initializers of AccessControl and Pausable contracts. /// @dev Sets caller as an initialAdmin and financeWallet(wallet for receiving fees and royalties) /// @dev Sets initial fee percentage for decoding process function initialize( address _admin )public initializer{ __AccessControl_init(); __Pausable_init_unchained(); _setupRole(DEFAULT_ADMIN_ROLE, _admin); initialAdmin = _admin; financialWallet = payable(msg.sender); validatorFeePercentageForDecoding = 50; platformFeePercentageForDecoding = 50; } // *********************** MODIFIERS ********************************************* /// @notice verifies if message sender is an admin or secondary admin modifier onlyAdmin{ if(!(hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(SECONDARY_ADMIN_ROLE,msg.sender))){ revert InvalidRole(msg.sender, SECONDARY_ADMIN_ROLE); } _; } // *********************** VIEW FUNCTIONS ********************************************* function version() public pure returns (uint32){ //version in format aaa.bbb.ccc => aaa*1E6+bbb*1E3+ccc; return uint32(2_001_011); } // *********************** FUNCTIONS ********************************************* /// @notice checks account for admin roles function isAdmin(address account) public view returns(bool){ return (hasRole(DEFAULT_ADMIN_ROLE, account)||hasRole(SECONDARY_ADMIN_ROLE, account)); } /// @notice checks account for backend role function isBackendRole(address account) public view returns(bool){ return hasRole(BACKEND_ROLE, account); } function isBridgeRole(address account) public view returns(bool){ return hasRole(BRIDGE_ROLE, account); } function isDecoderRole(address account) public view returns(bool){ return hasRole(DECODER_ROLE, account); } /// @notice checks account for admin roles or if platform is not paused function isAdminOrNotPaused(address caller) public view returns(bool){ return(!paused()||hasRole(DEFAULT_ADMIN_ROLE,caller)||hasRole(SECONDARY_ADMIN_ROLE,caller)); } /// TODO check if this function must exist /// @notice returns a number, that represents amount of fee, which validator will receive after decoding process function getValidatorFeeForDecoding(uint256 _price)public view returns(uint256){ if((platformFeePercentageForDecoding + validatorFeePercentageForDecoding)!=100){ revert IncorrectFeeDistribution(); } return (_price* gunDecimals * validatorFeePercentageForDecoding)/PERCENT_DENOMINATOR; } /// TODO check if this function must exist /// @notice returns a number, that represents amount of fee, which financialWallet will receive after decoding process function getPlatformFeeForDecoding(uint256 _price)public view returns(uint256){ if((platformFeePercentageForDecoding + validatorFeePercentageForDecoding)!=100){ revert IncorrectFeeDistribution(); } return (_price* gunDecimals * platformFeePercentageForDecoding)/PERCENT_DENOMINATOR; } /// @notice suspends most functions in contracts /// @dev Caller must be admin function pause() public onlyAdmin{ _pause(); } /// @notice restores most functions in contracts /// @dev Caller must be admin function unpause() public onlyAdmin{ _unpause(); } /// @notice sets new address as a payable financialWallet /// @dev caller must be admin, emits 'ChangedFinancialWallet' function setNewFinancialWallet(address _newWalletAddress) public onlyAdmin{ financialWallet = payable(_newWalletAddress); emit ChangedFinancialWallet(_newWalletAddress); } /// @notice granting secondary admin role to a specific address /// @param account address of a specific account function grantSecondaryAdminRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(hasRole(SECONDARY_ADMIN_ROLE, account)){ revert AlreadyHasRole(account, SECONDARY_ADMIN_ROLE); } grantRole(SECONDARY_ADMIN_ROLE, account); } /// @notice revoking secondary admin role from a specific address /// @param account address of a specific account function revokeSecondaryAdminRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(!hasRole(SECONDARY_ADMIN_ROLE, account)){ revert AlreadyHasNotRole(account, SECONDARY_ADMIN_ROLE); } revokeRole(SECONDARY_ADMIN_ROLE, account); } /// @notice granting backend admin role from a specific address /// @param account address of a specific account function grantBackendRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(hasRole(BACKEND_ROLE, account)){ revert AlreadyHasRole(account, BACKEND_ROLE); } grantRole(BACKEND_ROLE, account); } /// @notice revoking backend admin role from a specific address /// @param account address of a specific account function revokeBackendRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(!hasRole(BACKEND_ROLE, account)){ revert AlreadyHasNotRole(account, BACKEND_ROLE); } revokeRole(BACKEND_ROLE, account); } function grantBridgeRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(hasRole(BRIDGE_ROLE, account)){ revert AlreadyHasRole(account, BRIDGE_ROLE); } grantRole(BRIDGE_ROLE, account); } function revokeBridgeRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(!hasRole(BRIDGE_ROLE, account)){ revert AlreadyHasNotRole(account, BRIDGE_ROLE); } revokeRole(BRIDGE_ROLE, account); } function grantDecoderRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(hasRole(DECODER_ROLE, account)){ revert AlreadyHasRole(account, DECODER_ROLE); } grantRole(DECODER_ROLE, account); } function revokeDecoderRole(address account) public onlyRole(DEFAULT_ADMIN_ROLE){ if(!hasRole(DECODER_ROLE, account)){ revert AlreadyHasNotRole(account, DECODER_ROLE); } revokeRole(DECODER_ROLE, account); } /// TODO maybe it will be better, to set validatorFeePercentageForDecoding and platformFeePercentageForDecoding with one function /// @notice Sets a number, that represents amount of fee, which validator will receive after /// @dev caller must be admin function setValidatorFeePercentageForDecoding(uint256 _percentage) public onlyAdmin{ validatorFeePercentageForDecoding = _percentage; } /// @notice Sets a number, that represents amount of fee, which financialWallet will receive after /// @dev caller must be admin function setPlatformFeePercentageForDecoding(uint256 _percentage) public onlyAdmin{ platformFeePercentageForDecoding = _percentage; } // TODO DEPRECATED, will be deleted sooner function getValidatorFeePercentageForDecoding() external view returns(uint256){ return(validatorFeePercentageForDecoding); } // TODO DEPRECATED, will be deleted sooner function getPlatformFeePercentageForDecoding() external view returns(uint256){ return(platformFeePercentageForDecoding); } } // File openzeppelin-contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; /** * @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 ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } 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"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' 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) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ 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. 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 if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } 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; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // 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", StringsUpgradeable.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)); } } // File openzeppelin-contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712Upgradeable is Initializable { /* solhint-disable var-name-mixedcase */ bytes32 private _HASHED_NAME; bytes32 private _HASHED_VERSION; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal initializer { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal initializer { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash()); } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712VersionHash() internal virtual view returns (bytes32) { return _HASHED_VERSION; } uint256[50] private __gap; } // File contracts/utils/EIP712Custom.sol // contracts/Market.sol // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @title Contract for game Item sale /// @notice User can use this contract for selling and buying game Items /// @dev this's an upgradeable contract with creating item for sale, selling and unlisting gameItem from sale /// @dev Marketplace is inheriting from IMarketplace and EIP712Upgradeable contract EIP712Custom is EIP712Upgradeable { error IncorrectSigner(address signer); error DeadlineExpired(uint256 deadline, uint256 currentTimestamp); } // File openzeppelin-contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File openzeppelin-contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File openzeppelin-contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File openzeppelin-contracts-upgradeable/utils/AddressUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File openzeppelin-contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} uint256[44] private __gap; } // File openzeppelin-contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File openzeppelin-contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Enumerable_init_unchained(); } function __ERC721Enumerable_init_unchained() internal initializer { } // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721Upgradeable.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } uint256[46] private __gap; } // File contracts/utils/ERC721BatchUpgradeable.sol // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; contract ERC721BatchUpgradeable is ERC721EnumerableUpgradeable { function batchApprove(address to, uint256[] memory tokenIDs) public { for (uint256 i = 0; i < tokenIDs.length; ++i) { approve(to, tokenIDs[i]); } } } // File openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } uint256[49] private __gap; } // File contracts/GameItemContract.sol // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @title Contract for game item management /// @notice User can use this contract for reading info about GameItem, also user can transfer GameItem /// @dev EIP712Upgradeable will be removed sooner /// @notice Abbreviations: GI - GameItem contract GameItemContract is ERC721BatchUpgradeable, IGameItem, EIP712Custom { using StringsUpgradeable for uint256; // last minted token id of GameItem uint256 public lastMintedTokenID; // address of Decoder contract address address public decoderAddress; // address of HEXContract address public dataCubeContractAddress; // address of BattlePassContract address public battlePassContractAddress; // address of PlatformSettings contracct address public platformSettingsContractAddress; // GameItem tokens mapping(uint256 => GameItem) public items; address public validatorLicenseContractAddress; string public metadataURL; /// structure of GameItem token /// creator - minter, hacker - owner of HackerLicense, quality - item quality, season - item season, state - (Instant, Auction, Sold) state of item,metadataURL - URL to metadata storage struct GameItem { address creator; uint256 validator; Quality quality; uint256 season; MarketState state; string metadataURL; address hacker; } /// enumeration for GameItem marketplace state, new state will be added sooner enum MarketState{ Instant, Auction, Sold } /// enumeration for GameItem quality enum Quality{ Standard, Professional, Elite, Overclocked, Hacked } event ChangedHackerForItem(uint256 tokenID, address hacker); error ContractsIsPaused(); error ContractsIsNotPaused(); error InvalidRole(address caller, bytes32 role); error CallerNotDataCubeContractNorDecoder(address caller); error CallerNotOwner(address caller, address owner, uint256 tokenID); error IncorrectValue(uint256 value, uint256 price); error UnsuccessfulPayment(address from, address to, uint256 amount); /// @notice A disposable function for initializing contract /// @param _HEXContractAddress address of HEXContract /// @param _platformSettingsContractAddress address of PlatformSettings contract /// @param _hackerLicenseContractAddress address of PlatformSettings contract /// @dev calls initializer from ERC721Upgradeable and EIP712Upgradeable contract function initialize( address _HEXContractAddress, address _platformSettingsContractAddress, address _hackerLicenseContractAddress ) public initializer { __ERC721_init("Game Item", "GI"); __EIP712_init('GameItemContract', '1'); dataCubeContractAddress = _HEXContractAddress; platformSettingsContractAddress = _platformSettingsContractAddress; validatorLicenseContractAddress = _hackerLicenseContractAddress; } // *********************** MODIFIERS ********************************************* /// TODO check if this modifier must exist /// @notice verifies if switch "_paused" in PlatformSettings contract is on modifier whenPaused{ if (!PlatformSettings(platformSettingsContractAddress).paused()) { revert ContractsIsPaused(); } _; } /// @notice verifies if switch "_paused" in PlatformSettings contract is off modifier whenNotPaused{ if (PlatformSettings(platformSettingsContractAddress).paused()) { revert ContractsIsNotPaused(); } _; } /// @notice verifies if message sender is an admin or secondary admin modifier onlyAdmin{ if (!(PlatformSettings(platformSettingsContractAddress).hasRole(PlatformSettings(platformSettingsContractAddress).DEFAULT_ADMIN_ROLE(), msg.sender) || PlatformSettings(platformSettingsContractAddress).hasRole(PlatformSettings(platformSettingsContractAddress).SECONDARY_ADMIN_ROLE(), msg.sender))) { revert InvalidRole(msg.sender, PlatformSettings(platformSettingsContractAddress).SECONDARY_ADMIN_ROLE()); } _; } modifier onlyDataCubeContractOrDecoder{ if (decoderAddress != msg.sender && dataCubeContractAddress != msg.sender) { revert CallerNotDataCubeContractNorDecoder(msg.sender); } _; } modifier onlyBridge{ if (!PlatformSettings(platformSettingsContractAddress).isBridgeRole(msg.sender)) { revert InvalidRole(msg.sender, PlatformSettings(platformSettingsContractAddress).BRIDGE_ROLE()); } _; } // *********************** VIEW FUNCTIONS ********************************************* /// TODO restrict function visibility from view to pure function version() public override pure returns (uint32){ //version in format aaa.bbb.ccc => aaa*1E6+bbb*1E3+ccc; return uint32(2_001_011); } /// @notice gets creator's address of specific GameItem /// @dev inherited from IGameItem interface /// @param _tokenId token id of specific GameItem /// @return minter's address function getItemCreator(uint256 _tokenId) public view override returns (address){ return items[_tokenId].creator; } /// @notice returns hacker address of specific GameItem /// @dev inherited from IGameItem interface /// @param _tokenId token id of specific GameItem /// @return hacker address function getItemValidator(uint256 _tokenId) public view override returns (uint256){ return items[_tokenId].validator; } /// @notice gets (hacker) address of specific GameItem /// @dev inherited from IGameItem interface /// @param _tokenId token id of specific GameItem /// @return hacker's address function getItemHacker(uint256 _tokenId) public view override returns (address){ return items[_tokenId].hacker; } /// @notice gets quality of specific GameItem /// @dev inherited from IGameItem interface /// @param _tokenId token id of specific GameItem /// @return uint8 parameter. quality of GameItem function getItemQuality(uint256 _tokenId) public view override returns (uint8){ return uint8(items[_tokenId].quality); } /// @notice gets season of specific GameItem /// @dev inherited from IGameItem interface /// @param _tokenId token id of specific GameItem /// @return uint256 parameter. season id function getItemSeason(uint256 _tokenId) public view override returns (uint256){ return items[_tokenId].season; } /// @notice gets market state of specific GameItem /// @dev inherited from IGameItem interface /// @param _tokenId token id of specific GameItem /// @return uint8 parameter. Market state of GameItem function getItemState(uint256 _tokenId) public view override returns (uint8){ return uint8(items[_tokenId].state); } /// @dev Returns the Uniform Resource Identifier (URI) for `_tokenId` GameItem function tokenURI(uint256 _tokenId) public view override returns (string memory) { string memory baseURI = items[_tokenId].metadataURL; return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, _tokenId.toString())) : "GameItemContract: There isn`t metadata for this item"; } // *********************** FUNCTIONS ********************************************* /// @notice Admin sets new address for Decoder contract function setDecoderAddress(address _contractAddress) public onlyAdmin { decoderAddress = _contractAddress; } /// @notice Admin sets new address for hackerLicense contract function setValidatorLicenseAddress(address _contractAddress) public onlyAdmin { validatorLicenseContractAddress = _contractAddress; } /// @notice changes market state of specific GameItem /// @dev inherited from IGameItem interface /// @param _tokenId token id of specific GameItem /// @param _state (0-2) new item state function changeItemState(uint256 _tokenId, uint8 _state) public override { items[_tokenId].state = MarketState(_state); } function setItemHacker(uint256 _tokenId) public onlyAdmin { address hacker = IERC721Upgradeable(validatorLicenseContractAddress).ownerOf(getItemValidator(_tokenId)); items[_tokenId].hacker = hacker; emit ChangedHackerForItem(_tokenId, hacker); } ///TODO add check if VL is activated /// @notice mints new GameItem /// @dev can be called only via HEXContract or Decoder contract /// @dev emits "Minted" event, calls '_safeMint' function from ERC721Upgradeable contract /// @param _receiver receiver's address of new GameItem /// @param _HLTokenId token id of specific HackerLicense /// @param _seasonId token id of season /// @param _HEXQuality quality of new GameItem /// @param _metadataURL URL to metadata storage function mintFromCube( address _receiver, uint256 _HLTokenId, uint256 _seasonId, uint8 _HEXQuality, string memory _metadataURL ) public override onlyDataCubeContractOrDecoder() { uint256 _tokenId = ++lastMintedTokenID; address hacker = IERC721Upgradeable(validatorLicenseContractAddress).ownerOf(_HLTokenId); _safeMint(_receiver, _tokenId); items[_tokenId].creator = _receiver; items[_tokenId].quality = Quality(_HEXQuality); items[_tokenId].validator = _HLTokenId; items[_tokenId].hacker = hacker; items[_tokenId].metadataURL = _metadataURL; items[_tokenId].season = _seasonId; emit Minted( _receiver, _tokenId, _HEXQuality, hacker, _HLTokenId); } ///TODO add check if VL is activated /// @notice mints new GameItem /// @dev can be called by user, with signature /// @dev emits "Minted" event, sends GUNs to this contract address /// @param _HLTokenId token id of specific HackerLicense /// @param _seasonId token id of season /// @param _quality quality of new GameItem /// @param _price price(in GUNs) od HEX decoding /// @param _metadataURL URL to metadata storage function mintForUser( uint256 _HLTokenId, uint256 _seasonId, uint8 _quality, uint256 _price, string memory _metadataURL, address receiver ) public payable override whenNotPaused onlyAdmin { if (msg.value != _price) { revert IncorrectValue(msg.value, _price); } address payable financialWallet = PlatformSettings(platformSettingsContractAddress).financialWallet(); (bool success,) = financialWallet.call{value: (_price)}(""); if (!success) { revert UnsuccessfulPayment(address(this), financialWallet, _price); } //// uint256 _tokenId = ++lastMintedTokenID; address hacker = IERC721Upgradeable(validatorLicenseContractAddress).ownerOf(_HLTokenId); _safeMint(receiver, _tokenId); items[_tokenId].creator = receiver; items[_tokenId].quality = Quality(_quality); items[_tokenId].validator = _HLTokenId; items[_tokenId].hacker = hacker; items[_tokenId].metadataURL = _metadataURL; items[_tokenId].season = _seasonId; emit MintedForUser( receiver, _tokenId, _quality, (_price), hacker, _HLTokenId); } /// TODO tech debt for current version - contract will inherit ERC721BurnableUpgradeable contract sooner /// @notice burns token with specific id /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - caller must be owner of 'tokenId' * - `tokenId` must exist. * * Emits a {Transfer} event. */ function burn(uint256 _tokenId) public override { if (ERC721Upgradeable.ownerOf(_tokenId) != msg.sender) { revert CallerNotOwner(msg.sender, ERC721Upgradeable.ownerOf(_tokenId), _tokenId); } super._burn(_tokenId); } function bridgeMint(address to, uint256 _tokenId) public override onlyBridge { _mint(to, _tokenId); } function bridgeBurn(uint256 _tokenId) public override onlyBridge { super._burn(_tokenId); } function setMetadataURL(string calldata newMetadataURL) external onlyAdmin { metadataURL = newMetadataURL; } // *********************** INTERNAL FUNCTIONS ********************************************* /// @dev verifies if caller is an admin /// @dev tech debt for current version - inherits same function from ERC721EnumerableUpgradeable contract /// @dev inherited from contract ERC721Upgradeable function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override virtual { // require(!PlatformSettings(platformSettingsContractAddress).paused()||PlatformSettings(platformSettingsContractAddress).hasRole(PlatformSettings(platformSettingsContractAddress).DEFAULT_ADMIN_ROLE(),msg.sender)||PlatformSettings(platformSettingsContractAddress).hasRole(PlatformSettings(platformSettingsContractAddress).SECONDARY_ADMIN_ROLE(),msg.sender),"IP1"); super._beforeTokenTransfer(from, to, tokenId); from; to; tokenId; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view override returns (string memory) { return metadataURL; } // Function to receive Ether. msg.data must be empty receive() external payable {} // Fallback function is called when msg.data is not empty fallback() external payable {} }
Contract ABI
[{"type":"error","name":"CallerNotDataCubeContractNorDecoder","inputs":[{"type":"address","name":"caller","internalType":"address"}]},{"type":"error","name":"CallerNotOwner","inputs":[{"type":"address","name":"caller","internalType":"address"},{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"tokenID","internalType":"uint256"}]},{"type":"error","name":"ContractsIsNotPaused","inputs":[]},{"type":"error","name":"ContractsIsPaused","inputs":[]},{"type":"error","name":"DeadlineExpired","inputs":[{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"uint256","name":"currentTimestamp","internalType":"uint256"}]},{"type":"error","name":"IncorrectSigner","inputs":[{"type":"address","name":"signer","internalType":"address"}]},{"type":"error","name":"IncorrectValue","inputs":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"}]},{"type":"error","name":"InvalidRole","inputs":[{"type":"address","name":"caller","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"error","name":"UnsuccessfulPayment","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"ChangedHackerForItem","inputs":[{"type":"uint256","name":"tokenID","internalType":"uint256","indexed":false},{"type":"address","name":"hacker","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Minted","inputs":[{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint8","name":"quality","internalType":"uint8","indexed":false},{"type":"address","name":"hacker","internalType":"address","indexed":false},{"type":"uint256","name":"licenseId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"MintedForUser","inputs":[{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint8","name":"quality","internalType":"uint8","indexed":false},{"type":"uint256","name":"financialWalletPayment","internalType":"uint256","indexed":false},{"type":"address","name":"hacker","internalType":"address","indexed":false},{"type":"uint256","name":"licenseId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchApprove","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256[]","name":"tokenIDs","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"battlePassContractAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"bridgeBurn","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"bridgeMint","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeItemState","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"},{"type":"uint8","name":"_state","internalType":"uint8"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"dataCubeContractAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"decoderAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getItemCreator","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getItemHacker","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"getItemQuality","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getItemSeason","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"getItemState","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getItemValidator","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_HEXContractAddress","internalType":"address"},{"type":"address","name":"_platformSettingsContractAddress","internalType":"address"},{"type":"address","name":"_hackerLicenseContractAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"creator","internalType":"address"},{"type":"uint256","name":"validator","internalType":"uint256"},{"type":"uint8","name":"quality","internalType":"enum GameItemContract.Quality"},{"type":"uint256","name":"season","internalType":"uint256"},{"type":"uint8","name":"state","internalType":"enum GameItemContract.MarketState"},{"type":"string","name":"metadataURL","internalType":"string"},{"type":"address","name":"hacker","internalType":"address"}],"name":"items","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastMintedTokenID","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"metadataURL","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"mintForUser","inputs":[{"type":"uint256","name":"_HLTokenId","internalType":"uint256"},{"type":"uint256","name":"_seasonId","internalType":"uint256"},{"type":"uint8","name":"_quality","internalType":"uint8"},{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"string","name":"_metadataURL","internalType":"string"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mintFromCube","inputs":[{"type":"address","name":"_receiver","internalType":"address"},{"type":"uint256","name":"_HLTokenId","internalType":"uint256"},{"type":"uint256","name":"_seasonId","internalType":"uint256"},{"type":"uint8","name":"_HEXQuality","internalType":"uint8"},{"type":"string","name":"_metadataURL","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"platformSettingsContractAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDecoderAddress","inputs":[{"type":"address","name":"_contractAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setItemHacker","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMetadataURL","inputs":[{"type":"string","name":"newMetadataURL","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setValidatorLicenseAddress","inputs":[{"type":"address","name":"_contractAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"validatorLicenseContractAddress","inputs":[]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"version","inputs":[]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x608060405234801561001057600080fd5b50613ee2806100206000396000f3fe6080604052600436106102485760003560e01c80636744be5d11610138578063b88d4fde116100b0578063d615797211610077578063d615797214610754578063dcc67de914610774578063e34128e414610794578063e985e9c5146107b5578063f52d779f146107fe578063f7d004231461083857005b8063b88d4fde146106a0578063bfb231d2146106c0578063c0c53b8b146106f3578063c6a319fa14610713578063c87b56dd1461073457005b80638c2a993e116100ff5780638c2a993e146105f557806395d89b411461061557806396786ed41461062a5780639b1075c01461064a578063a22cb46514610660578063a869f9931461068057005b80636744be5d1461056157806370a082311461058257806371ab618c146105a2578063747daec5146105c25780637fa56211146105e257005b80633407fc51116101cb57806354fd4d501161019257806354fd4d501461047b5780635686f69e146104995780636236921e146104b957806362848c0f146104ea5780636352211e1461052157806365d5a9d01461054157005b80633407fc51146103c957806342842e0e146103e957806342966c681461040957806345bdac10146104295780634f6ccce71461045b57005b806318160ddd1161020f57806318160ddd1461033f57806323b872dd146103545780632dcc8c66146103745780632e1a09b3146103895780632f745c59146103a957005b806301ffc9a714610251578063036e7da11461028657806306fdde03146102c5578063081812fc146102e7578063095ea7b31461031f57005b3661024f57005b005b34801561025d57600080fd5b5061027161026c36600461357c565b610858565b60405190151581526020015b60405180910390f35b34801561029257600080fd5b506102b76102a1366004613599565b6000908152610102602052604090206003015490565b60405190815260200161027d565b3480156102d157600080fd5b506102da610883565b60405161027d919061360a565b3480156102f357600080fd5b50610307610302366004613599565b610915565b6040516001600160a01b03909116815260200161027d565b34801561032b57600080fd5b5061024f61033a366004613632565b6109af565b34801561034b57600080fd5b506099546102b7565b34801561036057600080fd5b5061024f61036f36600461365e565b610ac5565b34801561038057600080fd5b506102da610af6565b34801561039557600080fd5b5061024f6103a436600461369f565b610b85565b3480156103b557600080fd5b506102b76103c4366004613632565b610e4f565b3480156103d557600080fd5b5060fe54610307906001600160a01b031681565b3480156103f557600080fd5b5061024f61040436600461365e565b610ee5565b34801561041557600080fd5b5061024f610424366004613599565b610f00565b34801561043557600080fd5b50610449610444366004613599565b610f61565b60405160ff909116815260200161027d565b34801561046757600080fd5b506102b7610476366004613599565b610f88565b34801561048757600080fd5b50604051621e8873815260200161027d565b3480156104a557600080fd5b5060ff54610307906001600160a01b031681565b3480156104c557600080fd5b506102b76104d4366004613599565b6000908152610102602052604090206001015490565b3480156104f657600080fd5b50610307610505366004613599565b600090815261010260205260409020546001600160a01b031690565b34801561052d57600080fd5b5061030761053c366004613599565b61101b565b34801561054d57600080fd5b5061024f61055c366004613703565b611092565b34801561056d57600080fd5b5061010354610307906001600160a01b031681565b34801561058e57600080fd5b506102b761059d36600461369f565b6110d1565b3480156105ae57600080fd5b5061024f6105bd366004613599565b611158565b3480156105ce57600080fd5b5061024f6105dd3660046137be565b6114a7565b61024f6105f03660046138be565b6116f9565b34801561060157600080fd5b5061024f610610366004613632565b611cf1565b34801561062157600080fd5b506102da611dc4565b34801561063657600080fd5b5061024f61064536600461393c565b611dd3565b34801561065657600080fd5b506102b760fd5481565b34801561066c57600080fd5b5061024f61067b366004613976565b611e1d565b34801561068c57600080fd5b5061024f61069b3660046139af565b611e28565b3480156106ac57600080fd5b5061024f6106bb366004613a23565b612041565b3480156106cc57600080fd5b506106e06106db366004613599565b612079565b60405161027d9796959493929190613ab9565b3480156106ff57600080fd5b5061024f61070e366004613b2d565b61215a565b34801561071f57600080fd5b5061010154610307906001600160a01b031681565b34801561074057600080fd5b506102da61074f366004613599565b612297565b34801561076057600080fd5b5061044961076f366004613599565b612392565b34801561078057600080fd5b5061024f61078f366004613599565b6123b9565b3480156107a057600080fd5b5061010054610307906001600160a01b031681565b3480156107c157600080fd5b506102716107d0366004613b78565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561080a57600080fd5b50610307610819366004613599565b600090815261010260205260409020600601546001600160a01b031690565b34801561084457600080fd5b5061024f61085336600461369f565b61247e565b60006001600160e01b0319821663780e9d6360e01b148061087d575061087d826126e5565b92915050565b60606065805461089290613ba6565b80601f01602080910402602001604051908101604052809291908181526020018280546108be90613ba6565b801561090b5780601f106108e05761010080835404028352916020019161090b565b820191906000526020600020905b8154815290600101906020018083116108ee57829003601f168201915b5050505050905090565b6000818152606760205260408120546001600160a01b03166109935760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b60006109ba8261101b565b9050806001600160a01b0316836001600160a01b03161415610a285760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161098a565b336001600160a01b0382161480610a445750610a4481336107d0565b610ab65760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161098a565b610ac08383612735565b505050565b610acf33826127a3565b610aeb5760405162461bcd60e51b815260040161098a90613be1565b610ac083838361289a565b6101048054610b0490613ba6565b80601f0160208091040260200160405190810160405280929190818152602001828054610b3090613ba6565b8015610b7d5780601f10610b5257610100808354040283529160200191610b7d565b820191906000526020600020905b815481529060010190602001808311610b6057829003601f168201915b505050505081565b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b158015610bd357600080fd5b505afa158015610be7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0b9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b158015610c4857600080fd5b505afa158015610c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c809190613c4b565b80610d815750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b158015610cd457600080fd5b505afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b158015610d4957600080fd5b505afa158015610d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d819190613c4b565b610e2c57610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190613c32565b6040516316b4d34b60e31b81526001600160a01b039092166004830152602482015260440161098a565b61010380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e5a836110d1565b8210610ebc5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161098a565b506001600160a01b03919091166000908152609760209081526040808320938352929052205490565b610ac083838360405180602001604052806000815250612041565b33610f0a8261101b565b6001600160a01b031614610f555733610f228261101b565b60405163f604c2ef60e01b81526001600160a01b039283166004820152911660248201526044810182905260640161098a565b610f5e81612a45565b50565b6000818152610102602052604081206004015460ff16600281111561087d5761087d613aa3565b6000610f9360995490565b8210610ff65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161098a565b6099828154811061100957611009613c68565b90600052602060002001549050919050565b6000818152606760205260408120546001600160a01b03168061087d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161098a565b60005b8151811015610ac0576110c1838383815181106110b4576110b4613c68565b60200260200101516109af565b6110ca81613c94565b9050611095565b60006001600160a01b03821661113c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161098a565b506001600160a01b031660009081526068602052604090205490565b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156111a657600080fd5b505afa1580156111ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111de9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561121b57600080fd5b505afa15801561122f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112539190613c4b565b806113545750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156112a757600080fd5b505afa1580156112bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112df9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561131c57600080fd5b505afa158015611330573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113549190613c4b565b61139d57610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b610103546000906001600160a01b0316636352211e6113cc846000908152610102602052604090206001015490565b6040518263ffffffff1660e01b81526004016113ea91815260200190565b60206040518083038186803b15801561140257600080fd5b505afa158015611416573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143a9190613caf565b6000838152610102602090815260409182902060060180546001600160a01b0319166001600160a01b0385169081179091558251868152918201529192507f5fef8fff1086dfd966ad87b9c21e8140e31a09d4ec26acea2565f696d6d58978910160405180910390a15050565b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156114f557600080fd5b505afa158015611509573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152d9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561156a57600080fd5b505afa15801561157e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a29190613c4b565b806116a35750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156115f657600080fd5b505afa15801561160a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162e9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561166b57600080fd5b505afa15801561167f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a39190613c4b565b6116ec57610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b610ac06101048383613459565b61010160009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561174857600080fd5b505afa15801561175c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117809190613c4b565b1561179e5760405163b5c05c3160e01b815260040160405180910390fd5b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156117ec57600080fd5b505afa158015611800573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118249190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561186157600080fd5b505afa158015611875573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118999190613c4b565b8061199a5750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156118ed57600080fd5b505afa158015611901573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119259190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561196257600080fd5b505afa158015611976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199a9190613c4b565b6119e357610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b823414611a0c57604051635928816d60e11b81523460048201526024810184905260440161098a565b610101546040805163220ce7e760e21b815290516000926001600160a01b0316916388339f9c916004808301926020929190829003018186803b158015611a5257600080fd5b505afa158015611a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8a9190613caf565b90506000816001600160a01b03168560405160006040518083038185875af1925050503d8060008114611ad9576040519150601f19603f3d011682016040523d82523d6000602084013e611ade565b606091505b5050905080611b1857604051634eb3d3e160e11b81523060048201526001600160a01b03831660248201526044810186905260640161098a565b600060fd60008154611b2990613c94565b9182905550610103546040516331a9108f60e11b8152600481018c90529192506000916001600160a01b0390911690636352211e9060240160206040518083038186803b158015611b7957600080fd5b505afa158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb19190613caf565b9050611bbd8583612aec565b60008281526101026020526040902080546001600160a01b0319166001600160a01b03871617905560ff88166004811115611bfa57611bfa613aa3565b600083815261010260205260409020600201805460ff19166001836004811115611c2657611c26613aa3565b0217905550600082815261010260209081526040909120600181018c90556006810180546001600160a01b0319166001600160a01b0385161790558751611c75926005909201918901906134dd565b50600082815261010260209081526040918290206003018b9055815160ff8b1681529081018990526001600160a01b0383811682840152606082018d9052915184928816917f696d324a13be6af938c8cc2b09b3efd358159b398c7a04b9da02b7caee377257919081900360800190a350505050505050505050565b61010154604051633db50c8560e11b81523360048201526001600160a01b0390911690637b6a190a9060240160206040518083038186803b158015611d3557600080fd5b505afa158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d9190613c4b565b611db6576101015460408051635adfeef560e11b8152905133926001600160a01b03169163b5bfddea916004808301926020929190829003018186803b158015610dca57600080fd5b611dc08282612b06565b5050565b60606066805461089290613ba6565b8060ff166002811115611de857611de8613aa3565b600083815261010260205260409020600401805460ff19166001836002811115611e1457611e14613aa3565b02179055505050565b611dc0338383612c54565b60fe546001600160a01b03163314801590611e4e575060ff546001600160a01b03163314155b15611e6e5760405163e250604360e01b815233600482015260240161098a565b600060fd60008154611e7f90613c94565b9182905550610103546040516331a9108f60e11b8152600481018890529192506000916001600160a01b0390911690636352211e9060240160206040518083038186803b158015611ecf57600080fd5b505afa158015611ee3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f079190613caf565b9050611f138783612aec565b60008281526101026020526040902080546001600160a01b0319166001600160a01b03891617905560ff84166004811115611f5057611f50613aa3565b600083815261010260205260409020600201805460ff19166001836004811115611f7c57611f7c613aa3565b0217905550600082815261010260209081526040909120600181018890556006810180546001600160a01b0319166001600160a01b0385161790558451611fcb926005909201918601906134dd565b5060008281526101026020908152604091829020600301879055815160ff871681526001600160a01b03848116928201929092529182018890528391908916907f0916c07271eb54ee68eb9c4d3a156a965a6b981d04e63cec012d81c0c8562ce49060600160405180910390a350505050505050565b61204b33836127a3565b6120675760405162461bcd60e51b815260040161098a90613be1565b61207384848484612d23565b50505050565b610102602052600090815260409020805460018201546002830154600384015460048501546005860180546001600160a01b0390961696949560ff94851695939490921692916120c890613ba6565b80601f01602080910402602001604051908101604052809291908181526020018280546120f490613ba6565b80156121415780601f1061211657610100808354040283529160200191612141565b820191906000526020600020905b81548152906001019060200180831161212457829003601f168201915b505050600690930154919250506001600160a01b031687565b600054610100900460ff1680612173575060005460ff16155b61218f5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff161580156121b1576000805461ffff19166101011790555b6121f66040518060400160405280600981526020016847616d65204974656d60b81b81525060405180604001604052806002815260200161474960f01b815250612d56565b6122416040518060400160405280601081526020016f11d85b59525d195b50dbdb9d1c9858dd60821b815250604051806040016040528060018152602001603160f81b815250612ddd565b60ff80546001600160a01b038087166001600160a01b03199283161790925561010180548684169083161790556101038054928516929091169190911790558015612073576000805461ff001916905550505050565b600081815261010260205260408120600501805460609291906122b990613ba6565b80601f01602080910402602001604051908101604052809291908181526020018280546122e590613ba6565b80156123325780601f1061230757610100808354040283529160200191612332565b820191906000526020600020905b81548152906001019060200180831161231557829003601f168201915b50505050509050600081511161236057604051806060016040528060348152602001613e796034913961238b565b8061236a84612e3e565b60405160200161237b929190613d1a565b6040516020818303038152906040525b9392505050565b6000818152610102602052604081206002015460ff16600481111561087d5761087d613aa3565b61010154604051633db50c8560e11b81523360048201526001600160a01b0390911690637b6a190a9060240160206040518083038186803b1580156123fd57600080fd5b505afa158015612411573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124359190613c4b565b610f55576101015460408051635adfeef560e11b8152905133926001600160a01b03169163b5bfddea916004808301926020929190829003018186803b158015610dca57600080fd5b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156124cc57600080fd5b505afa1580156124e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125049190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561254157600080fd5b505afa158015612555573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125799190613c4b565b8061267a5750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156125cd57600080fd5b505afa1580156125e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126059190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561264257600080fd5b505afa158015612656573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267a9190613c4b565b6126c357610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b60fe80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982166380ac58cd60e01b148061271657506001600160e01b03198216635b5e139f60e01b145b8061087d57506301ffc9a760e01b6001600160e01b031983161461087d565b600081815260696020526040902080546001600160a01b0319166001600160a01b038416908117909155819061276a8261101b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606760205260408120546001600160a01b031661281c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161098a565b60006128278361101b565b9050806001600160a01b0316846001600160a01b031614806128625750836001600160a01b031661285784610915565b6001600160a01b0316145b8061289257506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166128ad8261101b565b6001600160a01b0316146129155760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161098a565b6001600160a01b0382166129775760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161098a565b612982838383612f3c565b61298d600082612735565b6001600160a01b03831660009081526068602052604081208054600192906129b6908490613d49565b90915550506001600160a01b03821660009081526068602052604081208054600192906129e4908490613d60565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000612a508261101b565b9050612a5e81600084612f3c565b612a69600083612735565b6001600160a01b0381166000908152606860205260408120805460019290612a92908490613d49565b909155505060008281526067602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b611dc0828260405180602001604052806000815250612f47565b6001600160a01b038216612b5c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161098a565b6000818152606760205260409020546001600160a01b031615612bc15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161098a565b612bcd60008383612f3c565b6001600160a01b0382166000908152606860205260408120805460019290612bf6908490613d60565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b816001600160a01b0316836001600160a01b03161415612cb65760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161098a565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612d2e84848461289a565b612d3a84848484612f7a565b6120735760405162461bcd60e51b815260040161098a90613d78565b600054610100900460ff1680612d6f575060005460ff16155b612d8b5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff16158015612dad576000805461ffff19166101011790555b612db5613087565b612dbd613087565b612dc783836130f2565b8015610ac0576000805461ff0019169055505050565b600054610100900460ff1680612df6575060005460ff16155b612e125760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff16158015612e34576000805461ffff19166101011790555b612dc78383613187565b606081612e625750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e8c5780612e7681613c94565b9150612e859050600a83613de0565b9150612e66565b60008167ffffffffffffffff811115612ea757612ea76136bc565b6040519080825280601f01601f191660200182016040528015612ed1576020820181803683370190505b5090505b841561289257612ee6600183613d49565b9150612ef3600a86613df4565b612efe906030613d60565b60f81b818381518110612f1357612f13613c68565b60200101906001600160f81b031916908160001a905350612f35600a86613de0565b9450612ed5565b610ac0838383613211565b612f518383612b06565b612f5e6000848484612f7a565b610ac05760405162461bcd60e51b815260040161098a90613d78565b60006001600160a01b0384163b1561307c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612fbe903390899088908890600401613e08565b602060405180830381600087803b158015612fd857600080fd5b505af1925050508015613008575060408051601f3d908101601f1916820190925261300591810190613e45565b60015b613062573d808015613036576040519150601f19603f3d011682016040523d82523d6000602084013e61303b565b606091505b50805161305a5760405162461bcd60e51b815260040161098a90613d78565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612892565b506001949350505050565b600054610100900460ff16806130a0575060005460ff16155b6130bc5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff161580156130de576000805461ffff19166101011790555b8015610f5e576000805461ff001916905550565b600054610100900460ff168061310b575060005460ff16155b6131275760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff16158015613149576000805461ffff19166101011790555b825161315c9060659060208601906134dd565b5081516131709060669060208501906134dd565b508015610ac0576000805461ff0019169055505050565b600054610100900460ff16806131a0575060005460ff16155b6131bc5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff161580156131de576000805461ffff19166101011790555b825160208085019190912083519184019190912060c99190915560ca558015610ac0576000805461ff0019169055505050565b6001600160a01b03831661326c5761326781609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b61328f565b816001600160a01b0316836001600160a01b03161461328f5761328f83826132c9565b6001600160a01b0382166132a657610ac081613366565b826001600160a01b0316826001600160a01b031614610ac057610ac08282613415565b600060016132d6846110d1565b6132e09190613d49565b600083815260986020526040902054909150808214613333576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b60995460009061337890600190613d49565b6000838152609a6020526040812054609980549394509092849081106133a0576133a0613c68565b9060005260206000200154905080609983815481106133c1576133c1613c68565b6000918252602080832090910192909255828152609a909152604080822084905585825281205560998054806133f9576133f9613e62565b6001900381819060005260206000200160009055905550505050565b6000613420836110d1565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b82805461346590613ba6565b90600052602060002090601f01602090048101928261348757600085556134cd565b82601f106134a05782800160ff198235161785556134cd565b828001600101855582156134cd579182015b828111156134cd5782358255916020019190600101906134b2565b506134d9929150613551565b5090565b8280546134e990613ba6565b90600052602060002090601f01602090048101928261350b57600085556134cd565b82601f1061352457805160ff19168380011785556134cd565b828001600101855582156134cd579182015b828111156134cd578251825591602001919060010190613536565b5b808211156134d95760008155600101613552565b6001600160e01b031981168114610f5e57600080fd5b60006020828403121561358e57600080fd5b813561238b81613566565b6000602082840312156135ab57600080fd5b5035919050565b60005b838110156135cd5781810151838201526020016135b5565b838111156120735750506000910152565b600081518084526135f68160208601602086016135b2565b601f01601f19169290920160200192915050565b60208152600061238b60208301846135de565b6001600160a01b0381168114610f5e57600080fd5b6000806040838503121561364557600080fd5b82356136508161361d565b946020939093013593505050565b60008060006060848603121561367357600080fd5b833561367e8161361d565b9250602084013561368e8161361d565b929592945050506040919091013590565b6000602082840312156136b157600080fd5b813561238b8161361d565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156136fb576136fb6136bc565b604052919050565b6000806040838503121561371657600080fd5b82356137218161361d565b915060208381013567ffffffffffffffff8082111561373f57600080fd5b818601915086601f83011261375357600080fd5b813581811115613765576137656136bc565b8060051b91506137768483016136d2565b818152918301840191848101908984111561379057600080fd5b938501935b838510156137ae57843582529385019390850190613795565b8096505050505050509250929050565b600080602083850312156137d157600080fd5b823567ffffffffffffffff808211156137e957600080fd5b818501915085601f8301126137fd57600080fd5b81358181111561380c57600080fd5b86602082850101111561381e57600080fd5b60209290920196919550909350505050565b803560ff8116811461384157600080fd5b919050565b600067ffffffffffffffff831115613860576138606136bc565b613873601f8401601f19166020016136d2565b905082815283838301111561388757600080fd5b828260208301376000602084830101529392505050565b600082601f8301126138af57600080fd5b61238b83833560208501613846565b60008060008060008060c087890312156138d757600080fd5b86359550602087013594506138ee60408801613830565b935060608701359250608087013567ffffffffffffffff81111561391157600080fd5b61391d89828a0161389e565b92505060a087013561392e8161361d565b809150509295509295509295565b6000806040838503121561394f57600080fd5b8235915061395f60208401613830565b90509250929050565b8015158114610f5e57600080fd5b6000806040838503121561398957600080fd5b82356139948161361d565b915060208301356139a481613968565b809150509250929050565b600080600080600060a086880312156139c757600080fd5b85356139d28161361d565b945060208601359350604086013592506139ee60608701613830565b9150608086013567ffffffffffffffff811115613a0a57600080fd5b613a168882890161389e565b9150509295509295909350565b60008060008060808587031215613a3957600080fd5b8435613a448161361d565b93506020850135613a548161361d565b925060408501359150606085013567ffffffffffffffff811115613a7757600080fd5b8501601f81018713613a8857600080fd5b613a9787823560208401613846565b91505092959194509250565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b0388811682526020820188905260009060058810613ae057613ae0613aa3565b87604084015286606084015260038610613afc57613afc613aa3565b85608084015260e060a0840152613b1660e08401866135de565b915080841660c08401525098975050505050505050565b600080600060608486031215613b4257600080fd5b8335613b4d8161361d565b92506020840135613b5d8161361d565b91506040840135613b6d8161361d565b809150509250925092565b60008060408385031215613b8b57600080fd5b8235613b968161361d565b915060208301356139a48161361d565b600181811c90821680613bba57607f821691505b60208210811415613bdb57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600060208284031215613c4457600080fd5b5051919050565b600060208284031215613c5d57600080fd5b815161238b81613968565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415613ca857613ca8613c7e565b5060010190565b600060208284031215613cc157600080fd5b815161238b8161361d565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008351613d2c8184602088016135b2565b835190830190613d408183602088016135b2565b01949350505050565b600082821015613d5b57613d5b613c7e565b500390565b60008219821115613d7357613d73613c7e565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082613def57613def613dca565b500490565b600082613e0357613e03613dca565b500690565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613e3b908301846135de565b9695505050505050565b600060208284031215613e5757600080fd5b815161238b81613566565b634e487b7160e01b600052603160045260246000fdfe47616d654974656d436f6e74726163743a2054686572652069736e6074206d6574616461746120666f722074686973206974656da2646970667358221220f8e2cbf45f8fbd5efa250d68876cf23f81e4089c5ef41ecb5e85c922548a9a5164736f6c63430008090033
Deployed ByteCode
0x6080604052600436106102485760003560e01c80636744be5d11610138578063b88d4fde116100b0578063d615797211610077578063d615797214610754578063dcc67de914610774578063e34128e414610794578063e985e9c5146107b5578063f52d779f146107fe578063f7d004231461083857005b8063b88d4fde146106a0578063bfb231d2146106c0578063c0c53b8b146106f3578063c6a319fa14610713578063c87b56dd1461073457005b80638c2a993e116100ff5780638c2a993e146105f557806395d89b411461061557806396786ed41461062a5780639b1075c01461064a578063a22cb46514610660578063a869f9931461068057005b80636744be5d1461056157806370a082311461058257806371ab618c146105a2578063747daec5146105c25780637fa56211146105e257005b80633407fc51116101cb57806354fd4d501161019257806354fd4d501461047b5780635686f69e146104995780636236921e146104b957806362848c0f146104ea5780636352211e1461052157806365d5a9d01461054157005b80633407fc51146103c957806342842e0e146103e957806342966c681461040957806345bdac10146104295780634f6ccce71461045b57005b806318160ddd1161020f57806318160ddd1461033f57806323b872dd146103545780632dcc8c66146103745780632e1a09b3146103895780632f745c59146103a957005b806301ffc9a714610251578063036e7da11461028657806306fdde03146102c5578063081812fc146102e7578063095ea7b31461031f57005b3661024f57005b005b34801561025d57600080fd5b5061027161026c36600461357c565b610858565b60405190151581526020015b60405180910390f35b34801561029257600080fd5b506102b76102a1366004613599565b6000908152610102602052604090206003015490565b60405190815260200161027d565b3480156102d157600080fd5b506102da610883565b60405161027d919061360a565b3480156102f357600080fd5b50610307610302366004613599565b610915565b6040516001600160a01b03909116815260200161027d565b34801561032b57600080fd5b5061024f61033a366004613632565b6109af565b34801561034b57600080fd5b506099546102b7565b34801561036057600080fd5b5061024f61036f36600461365e565b610ac5565b34801561038057600080fd5b506102da610af6565b34801561039557600080fd5b5061024f6103a436600461369f565b610b85565b3480156103b557600080fd5b506102b76103c4366004613632565b610e4f565b3480156103d557600080fd5b5060fe54610307906001600160a01b031681565b3480156103f557600080fd5b5061024f61040436600461365e565b610ee5565b34801561041557600080fd5b5061024f610424366004613599565b610f00565b34801561043557600080fd5b50610449610444366004613599565b610f61565b60405160ff909116815260200161027d565b34801561046757600080fd5b506102b7610476366004613599565b610f88565b34801561048757600080fd5b50604051621e8873815260200161027d565b3480156104a557600080fd5b5060ff54610307906001600160a01b031681565b3480156104c557600080fd5b506102b76104d4366004613599565b6000908152610102602052604090206001015490565b3480156104f657600080fd5b50610307610505366004613599565b600090815261010260205260409020546001600160a01b031690565b34801561052d57600080fd5b5061030761053c366004613599565b61101b565b34801561054d57600080fd5b5061024f61055c366004613703565b611092565b34801561056d57600080fd5b5061010354610307906001600160a01b031681565b34801561058e57600080fd5b506102b761059d36600461369f565b6110d1565b3480156105ae57600080fd5b5061024f6105bd366004613599565b611158565b3480156105ce57600080fd5b5061024f6105dd3660046137be565b6114a7565b61024f6105f03660046138be565b6116f9565b34801561060157600080fd5b5061024f610610366004613632565b611cf1565b34801561062157600080fd5b506102da611dc4565b34801561063657600080fd5b5061024f61064536600461393c565b611dd3565b34801561065657600080fd5b506102b760fd5481565b34801561066c57600080fd5b5061024f61067b366004613976565b611e1d565b34801561068c57600080fd5b5061024f61069b3660046139af565b611e28565b3480156106ac57600080fd5b5061024f6106bb366004613a23565b612041565b3480156106cc57600080fd5b506106e06106db366004613599565b612079565b60405161027d9796959493929190613ab9565b3480156106ff57600080fd5b5061024f61070e366004613b2d565b61215a565b34801561071f57600080fd5b5061010154610307906001600160a01b031681565b34801561074057600080fd5b506102da61074f366004613599565b612297565b34801561076057600080fd5b5061044961076f366004613599565b612392565b34801561078057600080fd5b5061024f61078f366004613599565b6123b9565b3480156107a057600080fd5b5061010054610307906001600160a01b031681565b3480156107c157600080fd5b506102716107d0366004613b78565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561080a57600080fd5b50610307610819366004613599565b600090815261010260205260409020600601546001600160a01b031690565b34801561084457600080fd5b5061024f61085336600461369f565b61247e565b60006001600160e01b0319821663780e9d6360e01b148061087d575061087d826126e5565b92915050565b60606065805461089290613ba6565b80601f01602080910402602001604051908101604052809291908181526020018280546108be90613ba6565b801561090b5780601f106108e05761010080835404028352916020019161090b565b820191906000526020600020905b8154815290600101906020018083116108ee57829003601f168201915b5050505050905090565b6000818152606760205260408120546001600160a01b03166109935760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b60006109ba8261101b565b9050806001600160a01b0316836001600160a01b03161415610a285760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161098a565b336001600160a01b0382161480610a445750610a4481336107d0565b610ab65760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161098a565b610ac08383612735565b505050565b610acf33826127a3565b610aeb5760405162461bcd60e51b815260040161098a90613be1565b610ac083838361289a565b6101048054610b0490613ba6565b80601f0160208091040260200160405190810160405280929190818152602001828054610b3090613ba6565b8015610b7d5780601f10610b5257610100808354040283529160200191610b7d565b820191906000526020600020905b815481529060010190602001808311610b6057829003601f168201915b505050505081565b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b158015610bd357600080fd5b505afa158015610be7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0b9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b158015610c4857600080fd5b505afa158015610c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c809190613c4b565b80610d815750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b158015610cd457600080fd5b505afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b158015610d4957600080fd5b505afa158015610d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d819190613c4b565b610e2c57610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190613c32565b6040516316b4d34b60e31b81526001600160a01b039092166004830152602482015260440161098a565b61010380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e5a836110d1565b8210610ebc5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161098a565b506001600160a01b03919091166000908152609760209081526040808320938352929052205490565b610ac083838360405180602001604052806000815250612041565b33610f0a8261101b565b6001600160a01b031614610f555733610f228261101b565b60405163f604c2ef60e01b81526001600160a01b039283166004820152911660248201526044810182905260640161098a565b610f5e81612a45565b50565b6000818152610102602052604081206004015460ff16600281111561087d5761087d613aa3565b6000610f9360995490565b8210610ff65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161098a565b6099828154811061100957611009613c68565b90600052602060002001549050919050565b6000818152606760205260408120546001600160a01b03168061087d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161098a565b60005b8151811015610ac0576110c1838383815181106110b4576110b4613c68565b60200260200101516109af565b6110ca81613c94565b9050611095565b60006001600160a01b03821661113c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161098a565b506001600160a01b031660009081526068602052604090205490565b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156111a657600080fd5b505afa1580156111ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111de9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561121b57600080fd5b505afa15801561122f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112539190613c4b565b806113545750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156112a757600080fd5b505afa1580156112bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112df9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561131c57600080fd5b505afa158015611330573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113549190613c4b565b61139d57610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b610103546000906001600160a01b0316636352211e6113cc846000908152610102602052604090206001015490565b6040518263ffffffff1660e01b81526004016113ea91815260200190565b60206040518083038186803b15801561140257600080fd5b505afa158015611416573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143a9190613caf565b6000838152610102602090815260409182902060060180546001600160a01b0319166001600160a01b0385169081179091558251868152918201529192507f5fef8fff1086dfd966ad87b9c21e8140e31a09d4ec26acea2565f696d6d58978910160405180910390a15050565b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156114f557600080fd5b505afa158015611509573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152d9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561156a57600080fd5b505afa15801561157e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a29190613c4b565b806116a35750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156115f657600080fd5b505afa15801561160a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162e9190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561166b57600080fd5b505afa15801561167f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a39190613c4b565b6116ec57610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b610ac06101048383613459565b61010160009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561174857600080fd5b505afa15801561175c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117809190613c4b565b1561179e5760405163b5c05c3160e01b815260040160405180910390fd5b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156117ec57600080fd5b505afa158015611800573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118249190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561186157600080fd5b505afa158015611875573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118999190613c4b565b8061199a5750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156118ed57600080fd5b505afa158015611901573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119259190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561196257600080fd5b505afa158015611976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199a9190613c4b565b6119e357610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b823414611a0c57604051635928816d60e11b81523460048201526024810184905260440161098a565b610101546040805163220ce7e760e21b815290516000926001600160a01b0316916388339f9c916004808301926020929190829003018186803b158015611a5257600080fd5b505afa158015611a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8a9190613caf565b90506000816001600160a01b03168560405160006040518083038185875af1925050503d8060008114611ad9576040519150601f19603f3d011682016040523d82523d6000602084013e611ade565b606091505b5050905080611b1857604051634eb3d3e160e11b81523060048201526001600160a01b03831660248201526044810186905260640161098a565b600060fd60008154611b2990613c94565b9182905550610103546040516331a9108f60e11b8152600481018c90529192506000916001600160a01b0390911690636352211e9060240160206040518083038186803b158015611b7957600080fd5b505afa158015611b8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb19190613caf565b9050611bbd8583612aec565b60008281526101026020526040902080546001600160a01b0319166001600160a01b03871617905560ff88166004811115611bfa57611bfa613aa3565b600083815261010260205260409020600201805460ff19166001836004811115611c2657611c26613aa3565b0217905550600082815261010260209081526040909120600181018c90556006810180546001600160a01b0319166001600160a01b0385161790558751611c75926005909201918901906134dd565b50600082815261010260209081526040918290206003018b9055815160ff8b1681529081018990526001600160a01b0383811682840152606082018d9052915184928816917f696d324a13be6af938c8cc2b09b3efd358159b398c7a04b9da02b7caee377257919081900360800190a350505050505050505050565b61010154604051633db50c8560e11b81523360048201526001600160a01b0390911690637b6a190a9060240160206040518083038186803b158015611d3557600080fd5b505afa158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d9190613c4b565b611db6576101015460408051635adfeef560e11b8152905133926001600160a01b03169163b5bfddea916004808301926020929190829003018186803b158015610dca57600080fd5b611dc08282612b06565b5050565b60606066805461089290613ba6565b8060ff166002811115611de857611de8613aa3565b600083815261010260205260409020600401805460ff19166001836002811115611e1457611e14613aa3565b02179055505050565b611dc0338383612c54565b60fe546001600160a01b03163314801590611e4e575060ff546001600160a01b03163314155b15611e6e5760405163e250604360e01b815233600482015260240161098a565b600060fd60008154611e7f90613c94565b9182905550610103546040516331a9108f60e11b8152600481018890529192506000916001600160a01b0390911690636352211e9060240160206040518083038186803b158015611ecf57600080fd5b505afa158015611ee3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f079190613caf565b9050611f138783612aec565b60008281526101026020526040902080546001600160a01b0319166001600160a01b03891617905560ff84166004811115611f5057611f50613aa3565b600083815261010260205260409020600201805460ff19166001836004811115611f7c57611f7c613aa3565b0217905550600082815261010260209081526040909120600181018890556006810180546001600160a01b0319166001600160a01b0385161790558451611fcb926005909201918601906134dd565b5060008281526101026020908152604091829020600301879055815160ff871681526001600160a01b03848116928201929092529182018890528391908916907f0916c07271eb54ee68eb9c4d3a156a965a6b981d04e63cec012d81c0c8562ce49060600160405180910390a350505050505050565b61204b33836127a3565b6120675760405162461bcd60e51b815260040161098a90613be1565b61207384848484612d23565b50505050565b610102602052600090815260409020805460018201546002830154600384015460048501546005860180546001600160a01b0390961696949560ff94851695939490921692916120c890613ba6565b80601f01602080910402602001604051908101604052809291908181526020018280546120f490613ba6565b80156121415780601f1061211657610100808354040283529160200191612141565b820191906000526020600020905b81548152906001019060200180831161212457829003601f168201915b505050600690930154919250506001600160a01b031687565b600054610100900460ff1680612173575060005460ff16155b61218f5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff161580156121b1576000805461ffff19166101011790555b6121f66040518060400160405280600981526020016847616d65204974656d60b81b81525060405180604001604052806002815260200161474960f01b815250612d56565b6122416040518060400160405280601081526020016f11d85b59525d195b50dbdb9d1c9858dd60821b815250604051806040016040528060018152602001603160f81b815250612ddd565b60ff80546001600160a01b038087166001600160a01b03199283161790925561010180548684169083161790556101038054928516929091169190911790558015612073576000805461ff001916905550505050565b600081815261010260205260408120600501805460609291906122b990613ba6565b80601f01602080910402602001604051908101604052809291908181526020018280546122e590613ba6565b80156123325780601f1061230757610100808354040283529160200191612332565b820191906000526020600020905b81548152906001019060200180831161231557829003601f168201915b50505050509050600081511161236057604051806060016040528060348152602001613e796034913961238b565b8061236a84612e3e565b60405160200161237b929190613d1a565b6040516020818303038152906040525b9392505050565b6000818152610102602052604081206002015460ff16600481111561087d5761087d613aa3565b61010154604051633db50c8560e11b81523360048201526001600160a01b0390911690637b6a190a9060240160206040518083038186803b1580156123fd57600080fd5b505afa158015612411573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124359190613c4b565b610f55576101015460408051635adfeef560e11b8152905133926001600160a01b03169163b5bfddea916004808301926020929190829003018186803b158015610dca57600080fd5b610101546040805163a217fddf60e01b815290516001600160a01b03909216916391d1485491839163a217fddf91600480820192602092909190829003018186803b1580156124cc57600080fd5b505afa1580156124e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125049190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561254157600080fd5b505afa158015612555573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125799190613c4b565b8061267a5750610101546040805163a6b4321160e01b815290516001600160a01b03909216916391d1485491839163a6b4321191600480820192602092909190829003018186803b1580156125cd57600080fd5b505afa1580156125e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126059190613c32565b6040516001600160e01b031960e084901b168152600481019190915233602482015260440160206040518083038186803b15801561264257600080fd5b505afa158015612656573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267a9190613c4b565b6126c357610101546040805163a6b4321160e01b8152905133926001600160a01b03169163a6b43211916004808301926020929190829003018186803b158015610dca57600080fd5b60fe80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982166380ac58cd60e01b148061271657506001600160e01b03198216635b5e139f60e01b145b8061087d57506301ffc9a760e01b6001600160e01b031983161461087d565b600081815260696020526040902080546001600160a01b0319166001600160a01b038416908117909155819061276a8261101b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606760205260408120546001600160a01b031661281c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161098a565b60006128278361101b565b9050806001600160a01b0316846001600160a01b031614806128625750836001600160a01b031661285784610915565b6001600160a01b0316145b8061289257506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166128ad8261101b565b6001600160a01b0316146129155760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161098a565b6001600160a01b0382166129775760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161098a565b612982838383612f3c565b61298d600082612735565b6001600160a01b03831660009081526068602052604081208054600192906129b6908490613d49565b90915550506001600160a01b03821660009081526068602052604081208054600192906129e4908490613d60565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000612a508261101b565b9050612a5e81600084612f3c565b612a69600083612735565b6001600160a01b0381166000908152606860205260408120805460019290612a92908490613d49565b909155505060008281526067602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b611dc0828260405180602001604052806000815250612f47565b6001600160a01b038216612b5c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161098a565b6000818152606760205260409020546001600160a01b031615612bc15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161098a565b612bcd60008383612f3c565b6001600160a01b0382166000908152606860205260408120805460019290612bf6908490613d60565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b816001600160a01b0316836001600160a01b03161415612cb65760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161098a565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612d2e84848461289a565b612d3a84848484612f7a565b6120735760405162461bcd60e51b815260040161098a90613d78565b600054610100900460ff1680612d6f575060005460ff16155b612d8b5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff16158015612dad576000805461ffff19166101011790555b612db5613087565b612dbd613087565b612dc783836130f2565b8015610ac0576000805461ff0019169055505050565b600054610100900460ff1680612df6575060005460ff16155b612e125760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff16158015612e34576000805461ffff19166101011790555b612dc78383613187565b606081612e625750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e8c5780612e7681613c94565b9150612e859050600a83613de0565b9150612e66565b60008167ffffffffffffffff811115612ea757612ea76136bc565b6040519080825280601f01601f191660200182016040528015612ed1576020820181803683370190505b5090505b841561289257612ee6600183613d49565b9150612ef3600a86613df4565b612efe906030613d60565b60f81b818381518110612f1357612f13613c68565b60200101906001600160f81b031916908160001a905350612f35600a86613de0565b9450612ed5565b610ac0838383613211565b612f518383612b06565b612f5e6000848484612f7a565b610ac05760405162461bcd60e51b815260040161098a90613d78565b60006001600160a01b0384163b1561307c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612fbe903390899088908890600401613e08565b602060405180830381600087803b158015612fd857600080fd5b505af1925050508015613008575060408051601f3d908101601f1916820190925261300591810190613e45565b60015b613062573d808015613036576040519150601f19603f3d011682016040523d82523d6000602084013e61303b565b606091505b50805161305a5760405162461bcd60e51b815260040161098a90613d78565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612892565b506001949350505050565b600054610100900460ff16806130a0575060005460ff16155b6130bc5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff161580156130de576000805461ffff19166101011790555b8015610f5e576000805461ff001916905550565b600054610100900460ff168061310b575060005460ff16155b6131275760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff16158015613149576000805461ffff19166101011790555b825161315c9060659060208601906134dd565b5081516131709060669060208501906134dd565b508015610ac0576000805461ff0019169055505050565b600054610100900460ff16806131a0575060005460ff16155b6131bc5760405162461bcd60e51b815260040161098a90613ccc565b600054610100900460ff161580156131de576000805461ffff19166101011790555b825160208085019190912083519184019190912060c99190915560ca558015610ac0576000805461ff0019169055505050565b6001600160a01b03831661326c5761326781609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b61328f565b816001600160a01b0316836001600160a01b03161461328f5761328f83826132c9565b6001600160a01b0382166132a657610ac081613366565b826001600160a01b0316826001600160a01b031614610ac057610ac08282613415565b600060016132d6846110d1565b6132e09190613d49565b600083815260986020526040902054909150808214613333576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b60995460009061337890600190613d49565b6000838152609a6020526040812054609980549394509092849081106133a0576133a0613c68565b9060005260206000200154905080609983815481106133c1576133c1613c68565b6000918252602080832090910192909255828152609a909152604080822084905585825281205560998054806133f9576133f9613e62565b6001900381819060005260206000200160009055905550505050565b6000613420836110d1565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b82805461346590613ba6565b90600052602060002090601f01602090048101928261348757600085556134cd565b82601f106134a05782800160ff198235161785556134cd565b828001600101855582156134cd579182015b828111156134cd5782358255916020019190600101906134b2565b506134d9929150613551565b5090565b8280546134e990613ba6565b90600052602060002090601f01602090048101928261350b57600085556134cd565b82601f1061352457805160ff19168380011785556134cd565b828001600101855582156134cd579182015b828111156134cd578251825591602001919060010190613536565b5b808211156134d95760008155600101613552565b6001600160e01b031981168114610f5e57600080fd5b60006020828403121561358e57600080fd5b813561238b81613566565b6000602082840312156135ab57600080fd5b5035919050565b60005b838110156135cd5781810151838201526020016135b5565b838111156120735750506000910152565b600081518084526135f68160208601602086016135b2565b601f01601f19169290920160200192915050565b60208152600061238b60208301846135de565b6001600160a01b0381168114610f5e57600080fd5b6000806040838503121561364557600080fd5b82356136508161361d565b946020939093013593505050565b60008060006060848603121561367357600080fd5b833561367e8161361d565b9250602084013561368e8161361d565b929592945050506040919091013590565b6000602082840312156136b157600080fd5b813561238b8161361d565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156136fb576136fb6136bc565b604052919050565b6000806040838503121561371657600080fd5b82356137218161361d565b915060208381013567ffffffffffffffff8082111561373f57600080fd5b818601915086601f83011261375357600080fd5b813581811115613765576137656136bc565b8060051b91506137768483016136d2565b818152918301840191848101908984111561379057600080fd5b938501935b838510156137ae57843582529385019390850190613795565b8096505050505050509250929050565b600080602083850312156137d157600080fd5b823567ffffffffffffffff808211156137e957600080fd5b818501915085601f8301126137fd57600080fd5b81358181111561380c57600080fd5b86602082850101111561381e57600080fd5b60209290920196919550909350505050565b803560ff8116811461384157600080fd5b919050565b600067ffffffffffffffff831115613860576138606136bc565b613873601f8401601f19166020016136d2565b905082815283838301111561388757600080fd5b828260208301376000602084830101529392505050565b600082601f8301126138af57600080fd5b61238b83833560208501613846565b60008060008060008060c087890312156138d757600080fd5b86359550602087013594506138ee60408801613830565b935060608701359250608087013567ffffffffffffffff81111561391157600080fd5b61391d89828a0161389e565b92505060a087013561392e8161361d565b809150509295509295509295565b6000806040838503121561394f57600080fd5b8235915061395f60208401613830565b90509250929050565b8015158114610f5e57600080fd5b6000806040838503121561398957600080fd5b82356139948161361d565b915060208301356139a481613968565b809150509250929050565b600080600080600060a086880312156139c757600080fd5b85356139d28161361d565b945060208601359350604086013592506139ee60608701613830565b9150608086013567ffffffffffffffff811115613a0a57600080fd5b613a168882890161389e565b9150509295509295909350565b60008060008060808587031215613a3957600080fd5b8435613a448161361d565b93506020850135613a548161361d565b925060408501359150606085013567ffffffffffffffff811115613a7757600080fd5b8501601f81018713613a8857600080fd5b613a9787823560208401613846565b91505092959194509250565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b0388811682526020820188905260009060058810613ae057613ae0613aa3565b87604084015286606084015260038610613afc57613afc613aa3565b85608084015260e060a0840152613b1660e08401866135de565b915080841660c08401525098975050505050505050565b600080600060608486031215613b4257600080fd5b8335613b4d8161361d565b92506020840135613b5d8161361d565b91506040840135613b6d8161361d565b809150509250925092565b60008060408385031215613b8b57600080fd5b8235613b968161361d565b915060208301356139a48161361d565b600181811c90821680613bba57607f821691505b60208210811415613bdb57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600060208284031215613c4457600080fd5b5051919050565b600060208284031215613c5d57600080fd5b815161238b81613968565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415613ca857613ca8613c7e565b5060010190565b600060208284031215613cc157600080fd5b815161238b8161361d565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008351613d2c8184602088016135b2565b835190830190613d408183602088016135b2565b01949350505050565b600082821015613d5b57613d5b613c7e565b500390565b60008219821115613d7357613d73613c7e565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082613def57613def613dca565b500490565b600082613e0357613e03613dca565b500690565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613e3b908301846135de565b9695505050505050565b600060208284031215613e5757600080fd5b815161238b81613566565b634e487b7160e01b600052603160045260246000fdfe47616d654974656d436f6e74726163743a2054686572652069736e6074206d6574616461746120666f722074686973206974656da2646970667358221220f8e2cbf45f8fbd5efa250d68876cf23f81e4089c5ef41ecb5e85c922548a9a5164736f6c63430008090033