More Info
Private Name Tags
ContractCreator
Sponsored
Latest 25 from a total of 2,005 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set State | 90193284 | 16 days ago | IN | 0 FTM | 0.00027758 | ||||
Set State | 90193257 | 16 days ago | IN | 0 FTM | 0.00027772 | ||||
Set State | 90193229 | 16 days ago | IN | 0 FTM | 0.00027772 | ||||
Set State | 90193134 | 16 days ago | IN | 0 FTM | 0.00040712 | ||||
Set State | 90193117 | 16 days ago | IN | 0 FTM | 0.00040711 | ||||
Set State | 90193100 | 16 days ago | IN | 0 FTM | 0.00040716 | ||||
Add Node | 89542331 | 24 days ago | IN | 0 FTM | 0.00595532 | ||||
Add Node | 89542331 | 24 days ago | IN | 0 FTM | 0.00595532 | ||||
Add Node | 89542331 | 24 days ago | IN | 0 FTM | 0.00595532 | ||||
Set State | 81660209 | 110 days ago | IN | 0 FTM | 0.00017749 | ||||
Set State | 81660201 | 110 days ago | IN | 0 FTM | 0.00017751 | ||||
Set State | 81660192 | 110 days ago | IN | 0 FTM | 0.00017754 | ||||
Set State | 81660187 | 110 days ago | IN | 0 FTM | 0.00017761 | ||||
Set State | 81660176 | 110 days ago | IN | 0 FTM | 0.00017767 | ||||
Set State | 81660168 | 110 days ago | IN | 0 FTM | 0.00017771 | ||||
Set State | 81660162 | 110 days ago | IN | 0 FTM | 0.0001779 | ||||
Set State | 81660148 | 110 days ago | IN | 0 FTM | 0.00017796 | ||||
Set State | 80292836 | 136 days ago | IN | 0 FTM | 0.00064538 | ||||
Set State | 80292830 | 136 days ago | IN | 0 FTM | 0.0006806 | ||||
Set State | 80292825 | 136 days ago | IN | 0 FTM | 0.00079639 | ||||
Set State | 80292812 | 136 days ago | IN | 0 FTM | 0.00058362 | ||||
Set State | 80292806 | 136 days ago | IN | 0 FTM | 0.00058365 | ||||
Set State | 80292801 | 136 days ago | IN | 0 FTM | 0.0005838 | ||||
Set State | 80292790 | 136 days ago | IN | 0 FTM | 0.00058392 | ||||
Set State | 80292781 | 136 days ago | IN | 0 FTM | 0.00058397 |
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
61052866 | 504 days ago | Contract Creation | 0 FTM |
Loading...
Loading
Contract Name:
NodeRegistryV2
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED // Copyright (c) Eywa.Fi, 2021-2023 - all rights reserved pragma solidity ^0.8.17; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; contract NodeRegistryV2 is AccessControlEnumerable { using SafeERC20 for IERC20; enum State { Registered, Ready, Disabled, Removed, Deleted, Penalized } enum Mode { Witness, Validator } struct Node { /// @dev absolute sequential number, starting from 1 uint64 nodeId; /// @dev node owner address address owner; /// @dev node signer\worker address address signer; /// @dev protocol version number that this node supports uint64 version; /// @dev libp2p host ID string hostId; /// @dev BLS public key bytes blsPubKey; /// @dev owner's collateral uint256 collateral; /// @dev node state State state; /// @dev node mode Mode mode; } uint256 public constant MIN_COLLATERAL = 1 ether; /// @dev operator role id bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); /// @dev utility POA token address public EPOA; /// @dev next available node id uint256 public nextNodeId; /// @dev nodes array Node[] public nodes; /// @dev nodes by owner, one owner -> many nodes mapping(address => uint256[]) private _nodesByOwner; /// @dev signer -> owner mapping(address => address) private _ownerBySigner; event NodeAdded( uint256 nodeId, address owner, address signer, uint64 version, string hostId, bytes blsPubKey, uint256 collateral, State state, Mode mode ); event NodeVersionUpdated(uint256 nodeId, uint64 version); event NodeSignerUpdated(uint256 nodeId, address signer); event NodeStateChanged(uint256 nodeId, State state); event NodeRemoved(uint256 nodeId); event UtilityTokenSet(address token); constructor() { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /** * @dev Returns nodes. */ function getNodes() external view returns (Node[] memory) { return nodes; } /** * @dev Returns node info by owner. * * @param owner node owner. */ function getNodes(address owner) external view returns (Node[] memory) { return _getNodes(owner); } /** * @dev Can be used to get node by index, using nodes(index). * @return nodes count. */ function getNodesCount() external view returns (uint256) { return nodes.length; } /** * @dev Returns node info by signer. * * @param signer node signer. */ function getNode(address signer) external view returns (Node memory node) { address owner = _ownerBySigner[signer]; Node[] memory nodes_ = _getNodes(owner); for (uint256 i = 0; i < nodes_.length; ++i) { if (nodes_[i].signer == signer) { node = nodes_[i]; break; } } } /** * @dev Set utility token for which new node can be added. * * @param token token address. */ function setUtilityToken(address token) external onlyRole(DEFAULT_ADMIN_ROLE) { require(token != address(0), "NodeRegistry: zero address"); EPOA = token; emit UtilityTokenSet(EPOA); } /** * @dev Adds new node. * * @param node Node struct. Collateral, nodeId and state field will be ignored; * @param deadline permit deadline; * @param v signature; * @param r hashed data; * @param v hashed data. */ function addNode( Node memory node, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { address owner = node.owner; require(owner == msg.sender, "NodeRegistry: not owner"); require(node.signer != address(0), "NodeRegistry: signer not set"); require(bytes(node.hostId).length != 0, "NodeRegistry: zero host key"); uint256 nodeBalance = IERC20(EPOA).balanceOf(owner); require(nodeBalance >= MIN_COLLATERAL, "NodeRegistry: not enough funds"); // Check if signer is not used in other nodes require(_ownerBySigner[node.signer] == address(0), "NodeRegistry: signer already used"); _ownerBySigner[node.signer] = owner; nextNodeId++; node.collateral = nodeBalance; _nodesByOwner[owner].push(nextNodeId); node.nodeId = uint64(nextNodeId); node.state = State.Registered; nodes.push(node); emit NodeAdded( node.nodeId, owner, node.signer, node.version, node.hostId, node.blsPubKey, node.collateral, node.state, node.mode ); if (deadline > block.timestamp) { IERC20Permit(EPOA).permit(owner, address(this), nodeBalance, deadline, v, r, s); } IERC20(EPOA).safeTransferFrom(owner, address(this), nodeBalance); } /** * @dev Deactivates node. * * @notice To get collateral back call twice: on first call node will be marked as removed. * Then, after approve, make the second call to get collateral. * * @param id node id. */ function removeNode(uint64 id) external { require(id > 0 && id <= nextNodeId, "NodeRegistry: wrong id"); uint256 index = id - 1; require(nodes[index].owner == msg.sender, "NodeRegistry: not owner"); if (nodes[index].state == State.Registered || nodes[index].state == State.Ready || nodes[index].state == State.Disabled) { nodes[index].state = State.Removed; emit NodeStateChanged(id, nodes[index].state); } else if (nodes[index].state == State.Deleted) { uint256 collateral = nodes[index].collateral; nodes[index].collateral = 0; emit NodeRemoved(id); ERC20Burnable(EPOA).burn(collateral); } else { revert("NodeRegistry: forbidden state"); } } /** * @dev Set new state. * * @notice Contract owner have to set Deleted to make collateral releasable (only from Removed state). * Node owner may set state to Ready again (only from Removed state). * * @param id node id; * @param state new state. */ function setState(uint64 id, State state) external { require(id > 0 && id <= nextNodeId, "NodeRegistry: wrong id"); uint256 index = id - 1; require(nodes[index].state != state, "NodeRegistry: state already set"); string memory forbiddenState = "NodeRegistry: forbidden state"; if (nodes[index].mode == Mode.Validator) { if (hasRole(OPERATOR_ROLE, msg.sender)) { // all states accepted // TODO states check disabled in PoA // if (nodes[index].state == State.Registered) { // revert(forbiddenState); // } else if (nodes[index].state == State.Ready) { // require(state == State.Penalized, forbiddenState); // } else if (nodes[index].state == State.Disabled) { // require(state == State.Penalized, forbiddenState); // } else if (nodes[index].state == State.Removed) { // require(state == State.Deleted || state == State.Penalized, forbiddenState); // } else if (nodes[index].state == State.Deleted) { // if (nodes[index].collateral == 0) { // revert(forbiddenState); // } // require(state == State.Ready || state == State.Disabled, forbiddenState); // } else if (nodes[index].state == State.Penalized) { // require(state == State.Ready || state == State.Disabled, forbiddenState); // } } else { require(nodes[index].owner == msg.sender, "NodeRegistry: not owner"); if (nodes[index].state == State.Registered) { require(state == State.Ready || state == State.Disabled, forbiddenState); } else if (nodes[index].state == State.Ready) { require(state == State.Disabled || state == State.Removed, forbiddenState); } else if (nodes[index].state == State.Disabled) { require(state == State.Ready || state == State.Removed, forbiddenState); } else if (nodes[index].state == State.Removed) { require(state == State.Ready || state == State.Disabled, forbiddenState); } else if (nodes[index].state == State.Deleted) { revert(forbiddenState); } else { revert(forbiddenState); } } } else { // node.mode == Mode.Witness if (hasRole(OPERATOR_ROLE, msg.sender)) { require(state == State.Ready || state == State.Disabled || state == State.Penalized, forbiddenState); } else { require(nodes[index].owner == msg.sender, "NodeRegistry: not owner"); if (nodes[index].state == State.Registered) { require(state == State.Ready || state == State.Disabled, forbiddenState); } else if (nodes[index].state == State.Ready) { require(state == State.Disabled, forbiddenState); } else if (nodes[index].state == State.Disabled) { require(state == State.Ready, forbiddenState); } else { revert(forbiddenState); } } } nodes[index].state = state; emit NodeStateChanged(id, state); } /** * @dev Updates node signer. * * @param signer new signer. */ function updateNodeSigner(uint64 id, address signer) external { require(id > 0 && id <= nextNodeId, "NodeRegistry: wrong id"); require(signer != address(0), "NodeRegistry: zero address"); uint256 index = id - 1; Node storage node = nodes[index]; require(node.owner == msg.sender, "NodeRegistry: not owner"); require(node.signer != signer, "NodeRegistry: signer already assigned"); require(_ownerBySigner[signer] == address(0), "NodeRegistry: signer already used"); _ownerBySigner[node.signer] = address(0); _ownerBySigner[signer] = node.owner; node.signer = signer; emit NodeSignerUpdated(id, signer); } /** * @dev Updates node version. * * @param version new node version. */ function updateNodeVersion(uint64 id, uint64 version) external { require(id > 0 && id <= nextNodeId, "NodeRegistry: wrong id"); uint256 index = id - 1; Node storage node = nodes[index]; require(node.signer == msg.sender, "NodeRegistry: not owner"); node.version = version; emit NodeVersionUpdated(node.nodeId, version); } function _getNodes(address owner) private view returns (Node[] memory) { uint256[] memory ownedIds = _nodesByOwner[owner]; Node[] memory nodes_ = new Node[](ownedIds.length); for (uint256 i = 0; i < ownedIds.length; i++) { nodes_[i] = nodes[ownedIds[i] - 1]; } return nodes_; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens 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 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @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 EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* 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]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nodeId","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"signer","type":"address"},{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"},{"indexed":false,"internalType":"string","name":"hostId","type":"string"},{"indexed":false,"internalType":"bytes","name":"blsPubKey","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"collateral","type":"uint256"},{"indexed":false,"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"},{"indexed":false,"internalType":"enum NodeRegistryV2.Mode","name":"mode","type":"uint8"}],"name":"NodeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nodeId","type":"uint256"}],"name":"NodeRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nodeId","type":"uint256"},{"indexed":false,"internalType":"address","name":"signer","type":"address"}],"name":"NodeSignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nodeId","type":"uint256"},{"indexed":false,"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"}],"name":"NodeStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nodeId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"NodeVersionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"UtilityTokenSet","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EPOA","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_COLLATERAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"nodeId","type":"uint64"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"version","type":"uint64"},{"internalType":"string","name":"hostId","type":"string"},{"internalType":"bytes","name":"blsPubKey","type":"bytes"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"},{"internalType":"enum NodeRegistryV2.Mode","name":"mode","type":"uint8"}],"internalType":"struct NodeRegistryV2.Node","name":"node","type":"tuple"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"addNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"getNode","outputs":[{"components":[{"internalType":"uint64","name":"nodeId","type":"uint64"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"version","type":"uint64"},{"internalType":"string","name":"hostId","type":"string"},{"internalType":"bytes","name":"blsPubKey","type":"bytes"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"},{"internalType":"enum NodeRegistryV2.Mode","name":"mode","type":"uint8"}],"internalType":"struct NodeRegistryV2.Node","name":"node","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getNodes","outputs":[{"components":[{"internalType":"uint64","name":"nodeId","type":"uint64"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"version","type":"uint64"},{"internalType":"string","name":"hostId","type":"string"},{"internalType":"bytes","name":"blsPubKey","type":"bytes"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"},{"internalType":"enum NodeRegistryV2.Mode","name":"mode","type":"uint8"}],"internalType":"struct NodeRegistryV2.Node[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNodes","outputs":[{"components":[{"internalType":"uint64","name":"nodeId","type":"uint64"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"version","type":"uint64"},{"internalType":"string","name":"hostId","type":"string"},{"internalType":"bytes","name":"blsPubKey","type":"bytes"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"},{"internalType":"enum NodeRegistryV2.Mode","name":"mode","type":"uint8"}],"internalType":"struct NodeRegistryV2.Node[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNodesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextNodeId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nodes","outputs":[{"internalType":"uint64","name":"nodeId","type":"uint64"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"version","type":"uint64"},{"internalType":"string","name":"hostId","type":"string"},{"internalType":"bytes","name":"blsPubKey","type":"bytes"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"},{"internalType":"enum NodeRegistryV2.Mode","name":"mode","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"removeNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"enum NodeRegistryV2.State","name":"state","type":"uint8"}],"name":"setState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"setUtilityToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"address","name":"signer","type":"address"}],"name":"updateNodeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint64","name":"version","type":"uint64"}],"name":"updateNodeVersion","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001f60003362000025565b6200017b565b6200003c82826200006860201b62001c681760201c565b60008281526001602090815260409091206200006391839062001cec62000109821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000105576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000c43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000120836001600160a01b03841662000129565b90505b92915050565b6000818152600183016020526040812054620001725750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000123565b50600062000123565b6131b0806200018b6000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806391d14854116100c3578063d547741f1161007c578063d547741f1461030f578063e29581aa14610322578063e84434611461032a578063edc3f4401461033d578063f5b541a614610350578063fa7796481461037757600080fd5b806391d148541461029b57806398b932d3146102ae5780639d209048146102c1578063a217fddf146102e1578063aedf6d51146102e9578063ca15c873146102fc57600080fd5b806336568abe1161011557806336568abe1461020f578063486af96a1461022257806361ea72081461024257806371383bb01461024a5780639010d07c146102755780639013ae081461028857600080fd5b806301ffc9a71461015d5780631c53c2801461018557806320eca391146101ad578063248a9ca3146101c45780632ed40181146101e75780632f2ff15d146101fc575b600080fd5b61017061016b3660046127c2565b610386565b60405190151581526020015b60405180910390f35b6101986101933660046127ec565b6103b1565b60405161017c9998979695949392919061288f565b6101b660035481565b60405190815260200161017c565b6101b66101d23660046127ec565b60009081526020819052604090206001015490565b6101fa6101f5366004612a46565b610541565b005b6101fa61020a366004612b78565b610a44565b6101fa61021d366004612b78565b610a6e565b610235610230366004612ba4565b610aec565b60405161017c9190612c90565b6004546101b6565b60025461025d906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b61025d610283366004612cf2565b610af7565b6101fa610296366004612ba4565b610b16565b6101706102a9366004612b78565b610bcd565b6101fa6102bc366004612d14565b610bf6565b6102d46102cf366004612ba4565b610e41565b60405161017c9190612d3e565b6101b6600081565b6101fa6102f7366004612d51565b610eed565b6101b661030a3660046127ec565b611286565b6101fa61031d366004612b78565b61129d565b6102356112c2565b6101fa610338366004612d6c565b61150b565b6101fa61034b366004612d96565b611622565b6101b67f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b6101b6670de0b6b3a764000081565b60006001600160e01b03198216635a05180f60e01b14806103ab57506103ab82611d01565b92915050565b600481815481106103c157600080fd5b60009182526020909120600690910201805460018201546002830180546001600160401b0380851696506001600160a01b03600160401b90950485169594841694600160a01b9094041692919061041790612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461044390612dc0565b80156104905780601f1061046557610100808354040283529160200191610490565b820191906000526020600020905b81548152906001019060200180831161047357829003601f168201915b5050505050908060030180546104a590612dc0565b80601f01602080910402602001604051908101604052809291908181526020018280546104d190612dc0565b801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b50505050600483015460059093015491929160ff80821692506101009091041689565b60208501516001600160a01b03811633146105775760405162461bcd60e51b815260040161056e90612dfa565b60405180910390fd5b60408601516001600160a01b03166105d15760405162461bcd60e51b815260206004820152601c60248201527f4e6f646552656769737472793a207369676e6572206e6f742073657400000000604482015260640161056e565b8560800151516000036106265760405162461bcd60e51b815260206004820152601b60248201527f4e6f646552656769737472793a207a65726f20686f7374206b65790000000000604482015260640161056e565b6002546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa158015610671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106959190612e31565b9050670de0b6b3a76400008110156106ef5760405162461bcd60e51b815260206004820152601e60248201527f4e6f646552656769737472793a206e6f7420656e6f7567682066756e64730000604482015260640161056e565b6040808801516001600160a01b03908116600090815260066020529190912054161561072d5760405162461bcd60e51b815260040161056e90612e4a565b6040878101516001600160a01b039081166000908152600660205291822080546001600160a01b031916918516919091179055600380549161076e83612ea1565b909155505060c087018190526001600160a01b0382166000908152600560209081526040822060038054825460018101845592855292842090910191909155546001600160401b0316885260e088018190525060048054600181018255600091909152875160069091027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b8101805460208b01516001600160a01b03908116600160401b026001600160e01b03199283166001600160401b039687161717835560408c01517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c8501805460608f0151909716600160a01b02969093169116179390931790925560808901518992917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d01906108a99082612f08565b5060a082015160038201906108be9082612f08565b5060c0820151816004015560e08201518160050160006101000a81548160ff021916908360058111156108f3576108f3612855565b0217905550610100828101516005830180549192909161ff0019169083600181111561092157610921612855565b021790555050507ff71748d7a7883a7925040e671cbb4e275127a6c78af51c9a367b0dcedf7f41be87600001518389604001518a606001518b608001518c60a001518d60c001518e60e001518f61010001516040516109889998979695949392919061288f565b60405180910390a142861115610a235760025460405163d505accf60e01b81526001600160a01b038481166004830152306024830152604482018490526064820189905260ff8816608483015260a4820187905260c482018690529091169063d505accf9060e401600060405180830381600087803b158015610a0a57600080fd5b505af1158015610a1e573d6000803e3d6000fd5b505050505b600254610a3b906001600160a01b0316833084611d36565b50505050505050565b600082815260208190526040902060010154610a5f81611d96565b610a698383611da3565b505050565b6001600160a01b0381163314610ade5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161056e565b610ae88282611dc5565b5050565b60606103ab82611de7565b6000828152600160205260408120610b0f9083612127565b9392505050565b6000610b2181611d96565b6001600160a01b038216610b775760405162461bcd60e51b815260206004820152601a60248201527f4e6f646552656769737472793a207a65726f2061646472657373000000000000604482015260640161056e565b600280546001600160a01b0319166001600160a01b0384169081179091556040519081527f61b3b3859569cecb601513cda243516790683fdd32e445a73da99153c0741b41906020015b60405180910390a15050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000826001600160401b0316118015610c1a5750600354826001600160401b031611155b610c365760405162461bcd60e51b815260040161056e90612fc7565b6001600160a01b038116610c8c5760405162461bcd60e51b815260206004820152601a60248201527f4e6f646552656769737472793a207a65726f2061646472657373000000000000604482015260640161056e565b6000610c99600184612ff7565b6001600160401b03169050600060048281548110610cb957610cb9613017565b600091825260209091206006909102018054909150600160401b90046001600160a01b03163314610cfc5760405162461bcd60e51b815260040161056e90612dfa565b60018101546001600160a01b03808516911603610d695760405162461bcd60e51b815260206004820152602560248201527f4e6f646552656769737472793a207369676e657220616c7265616479206173736044820152641a59db995960da1b606482015260840161056e565b6001600160a01b038381166000908152600660205260409020541615610da15760405162461bcd60e51b815260040161056e90612e4a565b6001810180546001600160a01b03908116600090815260066020908152604080832080546001600160a01b031990811690915586548986168086529483902080548316600160401b909204909616179094558454909316821790935581516001600160401b0388168152928301527f9f9aa627547ec8356afa4008c0733afb6bdfa2cc539875ab4b33e00e938337d691015b60405180910390a150505050565b610e49612778565b6001600160a01b0380831660009081526006602052604081205490911690610e7082611de7565b905060005b8151811015610ee557846001600160a01b0316828281518110610e9a57610e9a613017565b6020026020010151604001516001600160a01b031603610ed557818181518110610ec657610ec6613017565b60200260200101519350610ee5565b610ede81612ea1565b9050610e75565b505050919050565b6000816001600160401b0316118015610f115750600354816001600160401b031611155b610f2d5760405162461bcd60e51b815260040161056e90612fc7565b6000610f3a600183612ff7565b6001600160401b03169050336001600160a01b031660048281548110610f6257610f62613017565b6000918252602090912060069091020154600160401b90046001600160a01b031614610fa05760405162461bcd60e51b815260040161056e90612dfa565b600060048281548110610fb557610fb5613017565b60009182526020909120600560069092020181015460ff1690811115610fdd57610fdd612855565b14806110235750600160048281548110610ff957610ff9613017565b60009182526020909120600560069092020181015460ff169081111561102157611021612855565b145b80611068575060026004828154811061103e5761103e613017565b60009182526020909120600560069092020181015460ff169081111561106657611066612855565b145b156111135760036004828154811061108257611082613017565b906000526020600020906006020160050160006101000a81548160ff021916908360058111156110b4576110b4612855565b02179055507f2c28c6eda30f92a351b768450af748980aa0b14096deb684d8a46f276471f2c182600483815481106110ee576110ee613017565b6000918252602090912060056006909202010154604051610bc1929160ff169061302d565b600480828154811061112757611127613017565b60009182526020909120600560069092020181015460ff169081111561114f5761114f612855565b0361123e5760006004828154811061116957611169613017565b906000526020600020906006020160040154905060006004838154811061119257611192613017565b6000918252602091829020600460069092020101919091556040516001600160401b03851681527f2b61f53058df44855c08a7304979066cb409f86a3dca910e2275b9e85635d1f9910160405180910390a1600254604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561122a57600080fd5b505af1158015610a3b573d6000803e3d6000fd5b60405162461bcd60e51b815260206004820152601d60248201527f4e6f646552656769737472793a20666f7262696464656e207374617465000000604482015260640161056e565b60008181526001602052604081206103ab90612133565b6000828152602081905260409020600101546112b881611d96565b610a698383611dc5565b60606004805480602002602001604051908101604052809291908181526020016000905b8282101561150257600084815260209081902060408051610120810182526006860290920180546001600160401b038082168552600160401b9091046001600160a01b0390811695850195909552600182015494851692840192909252600160a01b90930416606082015260028201805491929160808401919061136990612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461139590612dc0565b80156113e25780601f106113b7576101008083540402835291602001916113e2565b820191906000526020600020905b8154815290600101906020018083116113c557829003601f168201915b505050505081526020016003820180546113fb90612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461142790612dc0565b80156114745780601f1061144957610100808354040283529160200191611474565b820191906000526020600020905b81548152906001019060200180831161145757829003601f168201915b50505091835250506004820154602082015260058083015460409092019160ff16908111156114a5576114a5612855565b60058111156114b6576114b6612855565b81526020016005820160019054906101000a900460ff1660018111156114de576114de612855565b60018111156114ef576114ef612855565b81525050815260200190600101906112e6565b50505050905090565b6000826001600160401b031611801561152f5750600354826001600160401b031611155b61154b5760405162461bcd60e51b815260040161056e90612fc7565b6000611558600184612ff7565b6001600160401b0316905060006004828154811061157857611578613017565b600091825260209091206001600690920201908101549091506001600160a01b031633146115b85760405162461bcd60e51b815260040161056e90612dfa565b60018101805467ffffffffffffffff60a01b1916600160a01b6001600160401b038681169182029290921790925582546040805191909216815260208101929092527f06e4d7f4a62032aeab80a82e6f2d62f6599cbd181dd98bc708f012ac77fd3e639101610e33565b6000826001600160401b03161180156116465750600354826001600160401b031611155b6116625760405162461bcd60e51b815260040161056e90612fc7565b600061166f600184612ff7565b6001600160401b0316905081600581111561168c5761168c612855565b6004828154811061169f5761169f613017565b60009182526020909120600560069092020181015460ff16908111156116c7576116c7612855565b036117145760405162461bcd60e51b815260206004820152601f60248201527f4e6f646552656769737472793a20737461746520616c72656164792073657400604482015260640161056e565b60408051808201909152601d81527f4e6f646552656769737472793a20666f7262696464656e207374617465000000602082015260016004838154811061175d5761175d613017565b906000526020600020906006020160050160019054906101000a900460ff16600181111561178d5761178d612855565b03611a21576117bc7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92933610bcd565b611bec57336001600160a01b0316600483815481106117dd576117dd613017565b6000918252602090912060069091020154600160401b90046001600160a01b03161461181b5760405162461bcd60e51b815260040161056e90612dfa565b60006004838154811061183057611830613017565b60009182526020909120600560069092020181015460ff169081111561185857611858612855565b036118b55760015b83600581111561187257611872612855565b1480611890575060025b83600581111561188e5761188e612855565b145b81906118af5760405162461bcd60e51b815260040161056e919061304a565b50611bec565b6001600483815481106118ca576118ca613017565b60009182526020909120600560069092020181015460ff16908111156118f2576118f2612855565b0361191a5760025b83600581111561190c5761190c612855565b14806118905750600361187c565b60026004838154811061192f5761192f613017565b60009182526020909120600560069092020181015460ff169081111561195757611957612855565b036119635760016118fa565b60036004838154811061197857611978613017565b60009182526020909120600560069092020181015460ff16908111156119a0576119a0612855565b036119ac576001611860565b60048083815481106119c0576119c0613017565b60009182526020909120600560069092020181015460ff16908111156119e8576119e8612855565b03611a07578060405162461bcd60e51b815260040161056e919061304a565b8060405162461bcd60e51b815260040161056e919061304a565b611a4b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92933610bcd565b15611a9b576001836005811115611a6457611a64612855565b1480611a8157506002836005811115611a7f57611a7f612855565b145b806118905750600583600581111561188e5761188e612855565b336001600160a01b031660048381548110611ab857611ab8613017565b6000918252602090912060069091020154600160401b90046001600160a01b031614611af65760405162461bcd60e51b815260040161056e90612dfa565b600060048381548110611b0b57611b0b613017565b60009182526020909120600560069092020181015460ff1690811115611b3357611b33612855565b03611b5a576001836005811115611b4c57611b4c612855565b14806118905750600261187c565b600160048381548110611b6f57611b6f613017565b60009182526020909120600560069092020181015460ff1690811115611b9757611b97612855565b03611ba357600261187c565b600260048381548110611bb857611bb8613017565b60009182526020909120600560069092020181015460ff1690811115611be057611be0612855565b03611a0757600161187c565b8260048381548110611c0057611c00613017565b906000526020600020906006020160050160006101000a81548160ff02191690836005811115611c3257611c32612855565b02179055507f2c28c6eda30f92a351b768450af748980aa0b14096deb684d8a46f276471f2c18484604051610e3392919061302d565b611c728282610bcd565b610ae8576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611ca83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610b0f836001600160a01b03841661213d565b60006001600160e01b03198216637965db0b60e01b14806103ab57506301ffc9a760e01b6001600160e01b03198316146103ab565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611d9090859061218c565b50505050565b611da0813361225e565b50565b611dad8282611c68565b6000828152600160205260409020610a699082611cec565b611dcf82826122b7565b6000828152600160205260409020610a69908261231c565b6001600160a01b0381166000908152600560209081526040808320805482518185028101850190935280835260609493830182828015611e4657602002820191906000526020600020905b815481526020019060010190808311611e32575b50505050509050600081516001600160401b03811115611e6857611e68612919565b604051908082528060200260200182016040528015611ea157816020015b611e8e612778565b815260200190600190039081611e865790505b50905060005b825181101561211f5760046001848381518110611ec657611ec6613017565b6020026020010151611ed8919061305d565b81548110611ee857611ee8613017565b60009182526020918290206040805161012081018252600690930290910180546001600160401b0380821685526001600160a01b03600160401b909204821695850195909552600182015490811692840192909252600160a01b9091049092166060820152600282018054919291608084019190611f6590612dc0565b80601f0160208091040260200160405190810160405280929190818152602001828054611f9190612dc0565b8015611fde5780601f10611fb357610100808354040283529160200191611fde565b820191906000526020600020905b815481529060010190602001808311611fc157829003601f168201915b50505050508152602001600382018054611ff790612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461202390612dc0565b80156120705780601f1061204557610100808354040283529160200191612070565b820191906000526020600020905b81548152906001019060200180831161205357829003601f168201915b50505091835250506004820154602082015260058083015460409092019160ff16908111156120a1576120a1612855565b60058111156120b2576120b2612855565b81526020016005820160019054906101000a900460ff1660018111156120da576120da612855565b60018111156120eb576120eb612855565b8152505082828151811061210157612101613017565b6020026020010181905250808061211790612ea1565b915050611ea7565b509392505050565b6000610b0f8383612331565b60006103ab825490565b6000818152600183016020526040812054612184575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103ab565b5060006103ab565b60006121e1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661235b9092919063ffffffff16565b805190915015610a6957808060200190518101906121ff9190613070565b610a695760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161056e565b6122688282610bcd565b610ae85761227581612372565b612280836020612384565b604051602001612291929190613092565b60408051601f198184030181529082905262461bcd60e51b825261056e9160040161304a565b6122c18282610bcd565b15610ae8576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610b0f836001600160a01b03841661251f565b600082600001828154811061234857612348613017565b9060005260206000200154905092915050565b606061236a8484600085612619565b949350505050565b60606103ab6001600160a01b03831660145b60606000612393836002613107565b61239e90600261311e565b6001600160401b038111156123b5576123b5612919565b6040519080825280601f01601f1916602001820160405280156123df576020820181803683370190505b509050600360fc1b816000815181106123fa576123fa613017565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061242957612429613017565b60200101906001600160f81b031916908160001a905350600061244d846002613107565b61245890600161311e565b90505b60018111156124d0576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061248c5761248c613017565b1a60f81b8282815181106124a2576124a2613017565b60200101906001600160f81b031916908160001a90535060049490941c936124c981613131565b905061245b565b508315610b0f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161056e565b6000818152600183016020526040812054801561260857600061254360018361305d565b85549091506000906125579060019061305d565b90508181146125bc57600086600001828154811061257757612577613017565b906000526020600020015490508087600001848154811061259a5761259a613017565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806125cd576125cd613148565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103ab565b60009150506103ab565b5092915050565b60608247101561267a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161056e565b600080866001600160a01b03168587604051612696919061315e565b60006040518083038185875af1925050503d80600081146126d3576040519150601f19603f3d011682016040523d82523d6000602084013e6126d8565b606091505b50915091506126e9878383876126f4565b979650505050505050565b6060831561276357825160000361275c576001600160a01b0385163b61275c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161056e565b508161236a565b61236a8383815115611a075781518083602001fd5b604080516101208101825260008082526020820181905291810182905260608082018390526080820181905260a082015260c081018290529060e082019081526020016000905290565b6000602082840312156127d457600080fd5b81356001600160e01b031981168114610b0f57600080fd5b6000602082840312156127fe57600080fd5b5035919050565b60005b83811015612820578181015183820152602001612808565b50506000910152565b60008151808452612841816020860160208601612805565b601f01601f19169290920160200192915050565b634e487b7160e01b600052602160045260246000fd5b6006811061287b5761287b612855565b9052565b6002811061287b5761287b612855565b6001600160401b038a811682526001600160a01b038a811660208401528916604083015287166060820152610120608082018190526000906128d383820189612829565b905082810360a08401526128e78188612829565b9150508460c08301526128fd60e083018561286b565b61290b61010083018461287f565b9a9950505050505050505050565b634e487b7160e01b600052604160045260246000fd5b60405161012081016001600160401b038111828210171561295257612952612919565b60405290565b80356001600160401b038116811461296f57600080fd5b919050565b80356001600160a01b038116811461296f57600080fd5b600082601f83011261299c57600080fd5b81356001600160401b03808211156129b6576129b6612919565b604051601f8301601f19908116603f011681019082821181831017156129de576129de612919565b816040528381528660208588010111156129f757600080fd5b836020870160208301376000602085830101528094505050505092915050565b80356006811061296f57600080fd5b80356002811061296f57600080fd5b803560ff8116811461296f57600080fd5b600080600080600060a08688031215612a5e57600080fd5b85356001600160401b0380821115612a7557600080fd5b90870190610120828a031215612a8a57600080fd5b612a9261292f565b612a9b83612958565b8152612aa960208401612974565b6020820152612aba60408401612974565b6040820152612acb60608401612958565b6060820152608083013582811115612ae257600080fd5b612aee8b82860161298b565b60808301525060a083013582811115612b0657600080fd5b612b128b82860161298b565b60a08301525060c083013560c0820152612b2e60e08401612a17565b60e08201526101009150612b43828401612a26565b8282015280975050505060208601359350612b6060408701612a35565b94979396509394606081013594506080013592915050565b60008060408385031215612b8b57600080fd5b82359150612b9b60208401612974565b90509250929050565b600060208284031215612bb657600080fd5b610b0f82612974565b80516001600160401b0316825260006101206020830151612beb60208601826001600160a01b03169052565b506040830151612c0660408601826001600160a01b03169052565b506060830151612c2160608601826001600160401b03169052565b506080830151816080860152612c3982860182612829565b91505060a083015184820360a0860152612c538282612829565b91505060c083015160c085015260e0830151612c7260e086018261286b565b5061010080840151612c868287018261287f565b5090949350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612ce557603f19888603018452612cd3858351612bbf565b94509285019290850190600101612cb7565b5092979650505050505050565b60008060408385031215612d0557600080fd5b50508035926020909101359150565b60008060408385031215612d2757600080fd5b612d3083612958565b9150612b9b60208401612974565b602081526000610b0f6020830184612bbf565b600060208284031215612d6357600080fd5b610b0f82612958565b60008060408385031215612d7f57600080fd5b612d8883612958565b9150612b9b60208401612958565b60008060408385031215612da957600080fd5b612db283612958565b9150612b9b60208401612a17565b600181811c90821680612dd457607f821691505b602082108103612df457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526017908201527f4e6f646552656769737472793a206e6f74206f776e6572000000000000000000604082015260600190565b600060208284031215612e4357600080fd5b5051919050565b60208082526021908201527f4e6f646552656769737472793a207369676e657220616c7265616479207573656040820152601960fa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600060018201612eb357612eb3612e8b565b5060010190565b601f821115610a6957600081815260208120601f850160051c81016020861015612ee15750805b601f850160051c820191505b81811015612f0057828155600101612eed565b505050505050565b81516001600160401b03811115612f2157612f21612919565b612f3581612f2f8454612dc0565b84612eba565b602080601f831160018114612f6a5760008415612f525750858301515b600019600386901b1c1916600185901b178555612f00565b600085815260208120601f198616915b82811015612f9957888601518255948401946001909101908401612f7a565b5085821015612fb75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b602080825260169082015275139bd919549959da5cdd1c9e4e881ddc9bdb99c81a5960521b604082015260600190565b6001600160401b0382811682821603908082111561261257612612612e8b565b634e487b7160e01b600052603260045260246000fd5b6001600160401b038316815260408101610b0f602083018461286b565b602081526000610b0f6020830184612829565b818103818111156103ab576103ab612e8b565b60006020828403121561308257600080fd5b81518015158114610b0f57600080fd5b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516130ca816017850160208801612805565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516130fb816028840160208801612805565b01602801949350505050565b80820281158282048414176103ab576103ab612e8b565b808201808211156103ab576103ab612e8b565b60008161314057613140612e8b565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251613170818460208701612805565b919091019291505056fea264697066735822122065ef91b1ea367b0c33c45d65516bb6c8264e4488b1f8d4f24bffb73327a3240164736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806391d14854116100c3578063d547741f1161007c578063d547741f1461030f578063e29581aa14610322578063e84434611461032a578063edc3f4401461033d578063f5b541a614610350578063fa7796481461037757600080fd5b806391d148541461029b57806398b932d3146102ae5780639d209048146102c1578063a217fddf146102e1578063aedf6d51146102e9578063ca15c873146102fc57600080fd5b806336568abe1161011557806336568abe1461020f578063486af96a1461022257806361ea72081461024257806371383bb01461024a5780639010d07c146102755780639013ae081461028857600080fd5b806301ffc9a71461015d5780631c53c2801461018557806320eca391146101ad578063248a9ca3146101c45780632ed40181146101e75780632f2ff15d146101fc575b600080fd5b61017061016b3660046127c2565b610386565b60405190151581526020015b60405180910390f35b6101986101933660046127ec565b6103b1565b60405161017c9998979695949392919061288f565b6101b660035481565b60405190815260200161017c565b6101b66101d23660046127ec565b60009081526020819052604090206001015490565b6101fa6101f5366004612a46565b610541565b005b6101fa61020a366004612b78565b610a44565b6101fa61021d366004612b78565b610a6e565b610235610230366004612ba4565b610aec565b60405161017c9190612c90565b6004546101b6565b60025461025d906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b61025d610283366004612cf2565b610af7565b6101fa610296366004612ba4565b610b16565b6101706102a9366004612b78565b610bcd565b6101fa6102bc366004612d14565b610bf6565b6102d46102cf366004612ba4565b610e41565b60405161017c9190612d3e565b6101b6600081565b6101fa6102f7366004612d51565b610eed565b6101b661030a3660046127ec565b611286565b6101fa61031d366004612b78565b61129d565b6102356112c2565b6101fa610338366004612d6c565b61150b565b6101fa61034b366004612d96565b611622565b6101b67f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b6101b6670de0b6b3a764000081565b60006001600160e01b03198216635a05180f60e01b14806103ab57506103ab82611d01565b92915050565b600481815481106103c157600080fd5b60009182526020909120600690910201805460018201546002830180546001600160401b0380851696506001600160a01b03600160401b90950485169594841694600160a01b9094041692919061041790612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461044390612dc0565b80156104905780601f1061046557610100808354040283529160200191610490565b820191906000526020600020905b81548152906001019060200180831161047357829003601f168201915b5050505050908060030180546104a590612dc0565b80601f01602080910402602001604051908101604052809291908181526020018280546104d190612dc0565b801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b50505050600483015460059093015491929160ff80821692506101009091041689565b60208501516001600160a01b03811633146105775760405162461bcd60e51b815260040161056e90612dfa565b60405180910390fd5b60408601516001600160a01b03166105d15760405162461bcd60e51b815260206004820152601c60248201527f4e6f646552656769737472793a207369676e6572206e6f742073657400000000604482015260640161056e565b8560800151516000036106265760405162461bcd60e51b815260206004820152601b60248201527f4e6f646552656769737472793a207a65726f20686f7374206b65790000000000604482015260640161056e565b6002546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa158015610671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106959190612e31565b9050670de0b6b3a76400008110156106ef5760405162461bcd60e51b815260206004820152601e60248201527f4e6f646552656769737472793a206e6f7420656e6f7567682066756e64730000604482015260640161056e565b6040808801516001600160a01b03908116600090815260066020529190912054161561072d5760405162461bcd60e51b815260040161056e90612e4a565b6040878101516001600160a01b039081166000908152600660205291822080546001600160a01b031916918516919091179055600380549161076e83612ea1565b909155505060c087018190526001600160a01b0382166000908152600560209081526040822060038054825460018101845592855292842090910191909155546001600160401b0316885260e088018190525060048054600181018255600091909152875160069091027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b8101805460208b01516001600160a01b03908116600160401b026001600160e01b03199283166001600160401b039687161717835560408c01517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c8501805460608f0151909716600160a01b02969093169116179390931790925560808901518992917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d01906108a99082612f08565b5060a082015160038201906108be9082612f08565b5060c0820151816004015560e08201518160050160006101000a81548160ff021916908360058111156108f3576108f3612855565b0217905550610100828101516005830180549192909161ff0019169083600181111561092157610921612855565b021790555050507ff71748d7a7883a7925040e671cbb4e275127a6c78af51c9a367b0dcedf7f41be87600001518389604001518a606001518b608001518c60a001518d60c001518e60e001518f61010001516040516109889998979695949392919061288f565b60405180910390a142861115610a235760025460405163d505accf60e01b81526001600160a01b038481166004830152306024830152604482018490526064820189905260ff8816608483015260a4820187905260c482018690529091169063d505accf9060e401600060405180830381600087803b158015610a0a57600080fd5b505af1158015610a1e573d6000803e3d6000fd5b505050505b600254610a3b906001600160a01b0316833084611d36565b50505050505050565b600082815260208190526040902060010154610a5f81611d96565b610a698383611da3565b505050565b6001600160a01b0381163314610ade5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161056e565b610ae88282611dc5565b5050565b60606103ab82611de7565b6000828152600160205260408120610b0f9083612127565b9392505050565b6000610b2181611d96565b6001600160a01b038216610b775760405162461bcd60e51b815260206004820152601a60248201527f4e6f646552656769737472793a207a65726f2061646472657373000000000000604482015260640161056e565b600280546001600160a01b0319166001600160a01b0384169081179091556040519081527f61b3b3859569cecb601513cda243516790683fdd32e445a73da99153c0741b41906020015b60405180910390a15050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000826001600160401b0316118015610c1a5750600354826001600160401b031611155b610c365760405162461bcd60e51b815260040161056e90612fc7565b6001600160a01b038116610c8c5760405162461bcd60e51b815260206004820152601a60248201527f4e6f646552656769737472793a207a65726f2061646472657373000000000000604482015260640161056e565b6000610c99600184612ff7565b6001600160401b03169050600060048281548110610cb957610cb9613017565b600091825260209091206006909102018054909150600160401b90046001600160a01b03163314610cfc5760405162461bcd60e51b815260040161056e90612dfa565b60018101546001600160a01b03808516911603610d695760405162461bcd60e51b815260206004820152602560248201527f4e6f646552656769737472793a207369676e657220616c7265616479206173736044820152641a59db995960da1b606482015260840161056e565b6001600160a01b038381166000908152600660205260409020541615610da15760405162461bcd60e51b815260040161056e90612e4a565b6001810180546001600160a01b03908116600090815260066020908152604080832080546001600160a01b031990811690915586548986168086529483902080548316600160401b909204909616179094558454909316821790935581516001600160401b0388168152928301527f9f9aa627547ec8356afa4008c0733afb6bdfa2cc539875ab4b33e00e938337d691015b60405180910390a150505050565b610e49612778565b6001600160a01b0380831660009081526006602052604081205490911690610e7082611de7565b905060005b8151811015610ee557846001600160a01b0316828281518110610e9a57610e9a613017565b6020026020010151604001516001600160a01b031603610ed557818181518110610ec657610ec6613017565b60200260200101519350610ee5565b610ede81612ea1565b9050610e75565b505050919050565b6000816001600160401b0316118015610f115750600354816001600160401b031611155b610f2d5760405162461bcd60e51b815260040161056e90612fc7565b6000610f3a600183612ff7565b6001600160401b03169050336001600160a01b031660048281548110610f6257610f62613017565b6000918252602090912060069091020154600160401b90046001600160a01b031614610fa05760405162461bcd60e51b815260040161056e90612dfa565b600060048281548110610fb557610fb5613017565b60009182526020909120600560069092020181015460ff1690811115610fdd57610fdd612855565b14806110235750600160048281548110610ff957610ff9613017565b60009182526020909120600560069092020181015460ff169081111561102157611021612855565b145b80611068575060026004828154811061103e5761103e613017565b60009182526020909120600560069092020181015460ff169081111561106657611066612855565b145b156111135760036004828154811061108257611082613017565b906000526020600020906006020160050160006101000a81548160ff021916908360058111156110b4576110b4612855565b02179055507f2c28c6eda30f92a351b768450af748980aa0b14096deb684d8a46f276471f2c182600483815481106110ee576110ee613017565b6000918252602090912060056006909202010154604051610bc1929160ff169061302d565b600480828154811061112757611127613017565b60009182526020909120600560069092020181015460ff169081111561114f5761114f612855565b0361123e5760006004828154811061116957611169613017565b906000526020600020906006020160040154905060006004838154811061119257611192613017565b6000918252602091829020600460069092020101919091556040516001600160401b03851681527f2b61f53058df44855c08a7304979066cb409f86a3dca910e2275b9e85635d1f9910160405180910390a1600254604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561122a57600080fd5b505af1158015610a3b573d6000803e3d6000fd5b60405162461bcd60e51b815260206004820152601d60248201527f4e6f646552656769737472793a20666f7262696464656e207374617465000000604482015260640161056e565b60008181526001602052604081206103ab90612133565b6000828152602081905260409020600101546112b881611d96565b610a698383611dc5565b60606004805480602002602001604051908101604052809291908181526020016000905b8282101561150257600084815260209081902060408051610120810182526006860290920180546001600160401b038082168552600160401b9091046001600160a01b0390811695850195909552600182015494851692840192909252600160a01b90930416606082015260028201805491929160808401919061136990612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461139590612dc0565b80156113e25780601f106113b7576101008083540402835291602001916113e2565b820191906000526020600020905b8154815290600101906020018083116113c557829003601f168201915b505050505081526020016003820180546113fb90612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461142790612dc0565b80156114745780601f1061144957610100808354040283529160200191611474565b820191906000526020600020905b81548152906001019060200180831161145757829003601f168201915b50505091835250506004820154602082015260058083015460409092019160ff16908111156114a5576114a5612855565b60058111156114b6576114b6612855565b81526020016005820160019054906101000a900460ff1660018111156114de576114de612855565b60018111156114ef576114ef612855565b81525050815260200190600101906112e6565b50505050905090565b6000826001600160401b031611801561152f5750600354826001600160401b031611155b61154b5760405162461bcd60e51b815260040161056e90612fc7565b6000611558600184612ff7565b6001600160401b0316905060006004828154811061157857611578613017565b600091825260209091206001600690920201908101549091506001600160a01b031633146115b85760405162461bcd60e51b815260040161056e90612dfa565b60018101805467ffffffffffffffff60a01b1916600160a01b6001600160401b038681169182029290921790925582546040805191909216815260208101929092527f06e4d7f4a62032aeab80a82e6f2d62f6599cbd181dd98bc708f012ac77fd3e639101610e33565b6000826001600160401b03161180156116465750600354826001600160401b031611155b6116625760405162461bcd60e51b815260040161056e90612fc7565b600061166f600184612ff7565b6001600160401b0316905081600581111561168c5761168c612855565b6004828154811061169f5761169f613017565b60009182526020909120600560069092020181015460ff16908111156116c7576116c7612855565b036117145760405162461bcd60e51b815260206004820152601f60248201527f4e6f646552656769737472793a20737461746520616c72656164792073657400604482015260640161056e565b60408051808201909152601d81527f4e6f646552656769737472793a20666f7262696464656e207374617465000000602082015260016004838154811061175d5761175d613017565b906000526020600020906006020160050160019054906101000a900460ff16600181111561178d5761178d612855565b03611a21576117bc7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92933610bcd565b611bec57336001600160a01b0316600483815481106117dd576117dd613017565b6000918252602090912060069091020154600160401b90046001600160a01b03161461181b5760405162461bcd60e51b815260040161056e90612dfa565b60006004838154811061183057611830613017565b60009182526020909120600560069092020181015460ff169081111561185857611858612855565b036118b55760015b83600581111561187257611872612855565b1480611890575060025b83600581111561188e5761188e612855565b145b81906118af5760405162461bcd60e51b815260040161056e919061304a565b50611bec565b6001600483815481106118ca576118ca613017565b60009182526020909120600560069092020181015460ff16908111156118f2576118f2612855565b0361191a5760025b83600581111561190c5761190c612855565b14806118905750600361187c565b60026004838154811061192f5761192f613017565b60009182526020909120600560069092020181015460ff169081111561195757611957612855565b036119635760016118fa565b60036004838154811061197857611978613017565b60009182526020909120600560069092020181015460ff16908111156119a0576119a0612855565b036119ac576001611860565b60048083815481106119c0576119c0613017565b60009182526020909120600560069092020181015460ff16908111156119e8576119e8612855565b03611a07578060405162461bcd60e51b815260040161056e919061304a565b8060405162461bcd60e51b815260040161056e919061304a565b611a4b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92933610bcd565b15611a9b576001836005811115611a6457611a64612855565b1480611a8157506002836005811115611a7f57611a7f612855565b145b806118905750600583600581111561188e5761188e612855565b336001600160a01b031660048381548110611ab857611ab8613017565b6000918252602090912060069091020154600160401b90046001600160a01b031614611af65760405162461bcd60e51b815260040161056e90612dfa565b600060048381548110611b0b57611b0b613017565b60009182526020909120600560069092020181015460ff1690811115611b3357611b33612855565b03611b5a576001836005811115611b4c57611b4c612855565b14806118905750600261187c565b600160048381548110611b6f57611b6f613017565b60009182526020909120600560069092020181015460ff1690811115611b9757611b97612855565b03611ba357600261187c565b600260048381548110611bb857611bb8613017565b60009182526020909120600560069092020181015460ff1690811115611be057611be0612855565b03611a0757600161187c565b8260048381548110611c0057611c00613017565b906000526020600020906006020160050160006101000a81548160ff02191690836005811115611c3257611c32612855565b02179055507f2c28c6eda30f92a351b768450af748980aa0b14096deb684d8a46f276471f2c18484604051610e3392919061302d565b611c728282610bcd565b610ae8576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611ca83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610b0f836001600160a01b03841661213d565b60006001600160e01b03198216637965db0b60e01b14806103ab57506301ffc9a760e01b6001600160e01b03198316146103ab565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611d9090859061218c565b50505050565b611da0813361225e565b50565b611dad8282611c68565b6000828152600160205260409020610a699082611cec565b611dcf82826122b7565b6000828152600160205260409020610a69908261231c565b6001600160a01b0381166000908152600560209081526040808320805482518185028101850190935280835260609493830182828015611e4657602002820191906000526020600020905b815481526020019060010190808311611e32575b50505050509050600081516001600160401b03811115611e6857611e68612919565b604051908082528060200260200182016040528015611ea157816020015b611e8e612778565b815260200190600190039081611e865790505b50905060005b825181101561211f5760046001848381518110611ec657611ec6613017565b6020026020010151611ed8919061305d565b81548110611ee857611ee8613017565b60009182526020918290206040805161012081018252600690930290910180546001600160401b0380821685526001600160a01b03600160401b909204821695850195909552600182015490811692840192909252600160a01b9091049092166060820152600282018054919291608084019190611f6590612dc0565b80601f0160208091040260200160405190810160405280929190818152602001828054611f9190612dc0565b8015611fde5780601f10611fb357610100808354040283529160200191611fde565b820191906000526020600020905b815481529060010190602001808311611fc157829003601f168201915b50505050508152602001600382018054611ff790612dc0565b80601f016020809104026020016040519081016040528092919081815260200182805461202390612dc0565b80156120705780601f1061204557610100808354040283529160200191612070565b820191906000526020600020905b81548152906001019060200180831161205357829003601f168201915b50505091835250506004820154602082015260058083015460409092019160ff16908111156120a1576120a1612855565b60058111156120b2576120b2612855565b81526020016005820160019054906101000a900460ff1660018111156120da576120da612855565b60018111156120eb576120eb612855565b8152505082828151811061210157612101613017565b6020026020010181905250808061211790612ea1565b915050611ea7565b509392505050565b6000610b0f8383612331565b60006103ab825490565b6000818152600183016020526040812054612184575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103ab565b5060006103ab565b60006121e1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661235b9092919063ffffffff16565b805190915015610a6957808060200190518101906121ff9190613070565b610a695760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161056e565b6122688282610bcd565b610ae85761227581612372565b612280836020612384565b604051602001612291929190613092565b60408051601f198184030181529082905262461bcd60e51b825261056e9160040161304a565b6122c18282610bcd565b15610ae8576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610b0f836001600160a01b03841661251f565b600082600001828154811061234857612348613017565b9060005260206000200154905092915050565b606061236a8484600085612619565b949350505050565b60606103ab6001600160a01b03831660145b60606000612393836002613107565b61239e90600261311e565b6001600160401b038111156123b5576123b5612919565b6040519080825280601f01601f1916602001820160405280156123df576020820181803683370190505b509050600360fc1b816000815181106123fa576123fa613017565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061242957612429613017565b60200101906001600160f81b031916908160001a905350600061244d846002613107565b61245890600161311e565b90505b60018111156124d0576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061248c5761248c613017565b1a60f81b8282815181106124a2576124a2613017565b60200101906001600160f81b031916908160001a90535060049490941c936124c981613131565b905061245b565b508315610b0f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161056e565b6000818152600183016020526040812054801561260857600061254360018361305d565b85549091506000906125579060019061305d565b90508181146125bc57600086600001828154811061257757612577613017565b906000526020600020015490508087600001848154811061259a5761259a613017565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806125cd576125cd613148565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103ab565b60009150506103ab565b5092915050565b60608247101561267a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161056e565b600080866001600160a01b03168587604051612696919061315e565b60006040518083038185875af1925050503d80600081146126d3576040519150601f19603f3d011682016040523d82523d6000602084013e6126d8565b606091505b50915091506126e9878383876126f4565b979650505050505050565b6060831561276357825160000361275c576001600160a01b0385163b61275c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161056e565b508161236a565b61236a8383815115611a075781518083602001fd5b604080516101208101825260008082526020820181905291810182905260608082018390526080820181905260a082015260c081018290529060e082019081526020016000905290565b6000602082840312156127d457600080fd5b81356001600160e01b031981168114610b0f57600080fd5b6000602082840312156127fe57600080fd5b5035919050565b60005b83811015612820578181015183820152602001612808565b50506000910152565b60008151808452612841816020860160208601612805565b601f01601f19169290920160200192915050565b634e487b7160e01b600052602160045260246000fd5b6006811061287b5761287b612855565b9052565b6002811061287b5761287b612855565b6001600160401b038a811682526001600160a01b038a811660208401528916604083015287166060820152610120608082018190526000906128d383820189612829565b905082810360a08401526128e78188612829565b9150508460c08301526128fd60e083018561286b565b61290b61010083018461287f565b9a9950505050505050505050565b634e487b7160e01b600052604160045260246000fd5b60405161012081016001600160401b038111828210171561295257612952612919565b60405290565b80356001600160401b038116811461296f57600080fd5b919050565b80356001600160a01b038116811461296f57600080fd5b600082601f83011261299c57600080fd5b81356001600160401b03808211156129b6576129b6612919565b604051601f8301601f19908116603f011681019082821181831017156129de576129de612919565b816040528381528660208588010111156129f757600080fd5b836020870160208301376000602085830101528094505050505092915050565b80356006811061296f57600080fd5b80356002811061296f57600080fd5b803560ff8116811461296f57600080fd5b600080600080600060a08688031215612a5e57600080fd5b85356001600160401b0380821115612a7557600080fd5b90870190610120828a031215612a8a57600080fd5b612a9261292f565b612a9b83612958565b8152612aa960208401612974565b6020820152612aba60408401612974565b6040820152612acb60608401612958565b6060820152608083013582811115612ae257600080fd5b612aee8b82860161298b565b60808301525060a083013582811115612b0657600080fd5b612b128b82860161298b565b60a08301525060c083013560c0820152612b2e60e08401612a17565b60e08201526101009150612b43828401612a26565b8282015280975050505060208601359350612b6060408701612a35565b94979396509394606081013594506080013592915050565b60008060408385031215612b8b57600080fd5b82359150612b9b60208401612974565b90509250929050565b600060208284031215612bb657600080fd5b610b0f82612974565b80516001600160401b0316825260006101206020830151612beb60208601826001600160a01b03169052565b506040830151612c0660408601826001600160a01b03169052565b506060830151612c2160608601826001600160401b03169052565b506080830151816080860152612c3982860182612829565b91505060a083015184820360a0860152612c538282612829565b91505060c083015160c085015260e0830151612c7260e086018261286b565b5061010080840151612c868287018261287f565b5090949350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612ce557603f19888603018452612cd3858351612bbf565b94509285019290850190600101612cb7565b5092979650505050505050565b60008060408385031215612d0557600080fd5b50508035926020909101359150565b60008060408385031215612d2757600080fd5b612d3083612958565b9150612b9b60208401612974565b602081526000610b0f6020830184612bbf565b600060208284031215612d6357600080fd5b610b0f82612958565b60008060408385031215612d7f57600080fd5b612d8883612958565b9150612b9b60208401612958565b60008060408385031215612da957600080fd5b612db283612958565b9150612b9b60208401612a17565b600181811c90821680612dd457607f821691505b602082108103612df457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526017908201527f4e6f646552656769737472793a206e6f74206f776e6572000000000000000000604082015260600190565b600060208284031215612e4357600080fd5b5051919050565b60208082526021908201527f4e6f646552656769737472793a207369676e657220616c7265616479207573656040820152601960fa1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600060018201612eb357612eb3612e8b565b5060010190565b601f821115610a6957600081815260208120601f850160051c81016020861015612ee15750805b601f850160051c820191505b81811015612f0057828155600101612eed565b505050505050565b81516001600160401b03811115612f2157612f21612919565b612f3581612f2f8454612dc0565b84612eba565b602080601f831160018114612f6a5760008415612f525750858301515b600019600386901b1c1916600185901b178555612f00565b600085815260208120601f198616915b82811015612f9957888601518255948401946001909101908401612f7a565b5085821015612fb75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b602080825260169082015275139bd919549959da5cdd1c9e4e881ddc9bdb99c81a5960521b604082015260600190565b6001600160401b0382811682821603908082111561261257612612612e8b565b634e487b7160e01b600052603260045260246000fd5b6001600160401b038316815260408101610b0f602083018461286b565b602081526000610b0f6020830184612829565b818103818111156103ab576103ab612e8b565b60006020828403121561308257600080fd5b81518015158114610b0f57600080fd5b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516130ca816017850160208801612805565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516130fb816028840160208801612805565b01602801949350505050565b80820281158282048414176103ab576103ab612e8b565b808201808211156103ab576103ab612e8b565b60008161314057613140612e8b565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251613170818460208701612805565b919091019291505056fea264697066735822122065ef91b1ea367b0c33c45d65516bb6c8264e4488b1f8d4f24bffb73327a3240164736f6c63430008110033
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.