Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 3 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
10008721 | 38 hrs ago | Contract Creation | 0 S | |||
10008721 | 38 hrs ago | Contract Creation | 0 S | |||
10008721 | 38 hrs ago | Contract Creation | 0 S |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
BackedOracleFactory
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2023 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ pragma solidity 0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/governance/TimelockController.sol"; import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "./BackedOracle.sol"; import "./BackedOracleForwarder.sol"; /** * @dev * TransparentUpgradeableProxy contract, renamed as BackedOracleProxy. */ contract BackedOracleProxy is TransparentUpgradeableProxy { constructor( address _logic, address _admin, bytes memory _data ) payable TransparentUpgradeableProxy(_logic, _admin, _data) {} } contract BackedOracleFactory is Ownable { ProxyAdmin public proxyAdmin; TimelockController public timelockController; BackedOracle public implementation; event NewOracle(address indexed newOracle); event NewOracleForwarder(address indexed newOracleForwarder); event NewImplementation(address indexed newImplementation); /** * @param admin- The address of the account that will be set as owner of the deployed ProxyAdmin and will have the * timelock admin role for the timelock contract */ constructor(address admin, address[] memory timelockWorkers) { require( admin != address(0), "Factory: address should not be 0" ); implementation = new BackedOracle(); proxyAdmin = new ProxyAdmin(); timelockController = new TimelockController( 7 days, timelockWorkers, timelockWorkers ); proxyAdmin.transferOwnership(address(timelockController)); timelockController.grantRole(timelockController.TIMELOCK_ADMIN_ROLE(), admin); } function deployOracle( uint8 decimals, string memory description, address oracleUpdater ) external onlyOwner returns (address) { bytes32 salt = keccak256(abi.encodePacked(description)); BackedOracleProxy proxy = new BackedOracleProxy{salt: salt}( address(implementation), address(proxyAdmin), abi.encodeWithSelector( BackedOracle(address(0)).initialize.selector, decimals, description, address(timelockController), oracleUpdater ) ); emit NewOracle(address(proxy)); BackedOracleForwarder forwarder = new BackedOracleForwarder{salt: salt}( address(proxy), address(timelockController) ); emit NewOracleForwarder(address(forwarder)); return address(forwarder); } /** * @dev Update the implementation for future deployments * * Emits a { NewImplementation } event * * @param newImplementation - the address of the new implementation */ function updateImplementation( address newImplementation ) external onlyOwner { require( newImplementation != address(0), "Factory: address should not be 0" ); implementation = BackedOracle(newImplementation); emit NewImplementation(newImplementation); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view 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. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// 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 IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [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 functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// 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 IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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, _msgSender()); _; } /** * @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 `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(uint160(account), 20), " 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. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// 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/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (governance/TimelockController.sol) pragma solidity ^0.8.0; import "../access/AccessControl.sol"; /** * @dev Contract module which acts as a timelocked controller. When set as the * owner of an `Ownable` smart contract, it enforces a timelock on all * `onlyOwner` maintenance operations. This gives time for users of the * controlled contract to exit before a potentially dangerous maintenance * operation is applied. * * By default, this contract is self administered, meaning administration tasks * have to go through the timelock process. The proposer (resp executor) role * is in charge of proposing (resp executing) operations. A common use case is * to position this {TimelockController} as the owner of a smart contract, with * a multisig or a DAO as the sole proposer. * * _Available since v3.3._ */ contract TimelockController is AccessControl { bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256("TIMELOCK_ADMIN_ROLE"); bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE"); bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE"); uint256 internal constant _DONE_TIMESTAMP = uint256(1); mapping(bytes32 => uint256) private _timestamps; uint256 private _minDelay; /** * @dev Emitted when a call is scheduled as part of operation `id`. */ event CallScheduled( bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data, bytes32 predecessor, uint256 delay ); /** * @dev Emitted when a call is performed as part of operation `id`. */ event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data); /** * @dev Emitted when operation `id` is cancelled. */ event Cancelled(bytes32 indexed id); /** * @dev Emitted when the minimum delay for future operations is modified. */ event MinDelayChange(uint256 oldDuration, uint256 newDuration); /** * @dev Initializes the contract with a given `minDelay`. */ constructor( uint256 minDelay, address[] memory proposers, address[] memory executors ) { _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE); _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE); _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE); // deployer + self administration _setupRole(TIMELOCK_ADMIN_ROLE, _msgSender()); _setupRole(TIMELOCK_ADMIN_ROLE, address(this)); // register proposers for (uint256 i = 0; i < proposers.length; ++i) { _setupRole(PROPOSER_ROLE, proposers[i]); } // register executors for (uint256 i = 0; i < executors.length; ++i) { _setupRole(EXECUTOR_ROLE, executors[i]); } _minDelay = minDelay; emit MinDelayChange(0, minDelay); } /** * @dev Modifier to make a function callable only by a certain role. In * addition to checking the sender's role, `address(0)` 's role is also * considered. Granting a role to `address(0)` is equivalent to enabling * this role for everyone. */ modifier onlyRoleOrOpenRole(bytes32 role) { if (!hasRole(role, address(0))) { _checkRole(role, _msgSender()); } _; } /** * @dev Contract might receive/hold ETH as part of the maintenance process. */ receive() external payable {} /** * @dev Returns whether an id correspond to a registered operation. This * includes both Pending, Ready and Done operations. */ function isOperation(bytes32 id) public view virtual returns (bool pending) { return getTimestamp(id) > 0; } /** * @dev Returns whether an operation is pending or not. */ function isOperationPending(bytes32 id) public view virtual returns (bool pending) { return getTimestamp(id) > _DONE_TIMESTAMP; } /** * @dev Returns whether an operation is ready or not. */ function isOperationReady(bytes32 id) public view virtual returns (bool ready) { uint256 timestamp = getTimestamp(id); return timestamp > _DONE_TIMESTAMP && timestamp <= block.timestamp; } /** * @dev Returns whether an operation is done or not. */ function isOperationDone(bytes32 id) public view virtual returns (bool done) { return getTimestamp(id) == _DONE_TIMESTAMP; } /** * @dev Returns the timestamp at with an operation becomes ready (0 for * unset operations, 1 for done operations). */ function getTimestamp(bytes32 id) public view virtual returns (uint256 timestamp) { return _timestamps[id]; } /** * @dev Returns the minimum delay for an operation to become valid. * * This value can be changed by executing an operation that calls `updateDelay`. */ function getMinDelay() public view virtual returns (uint256 duration) { return _minDelay; } /** * @dev Returns the identifier of an operation containing a single * transaction. */ function hashOperation( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt ) public pure virtual returns (bytes32 hash) { return keccak256(abi.encode(target, value, data, predecessor, salt)); } /** * @dev Returns the identifier of an operation containing a batch of * transactions. */ function hashOperationBatch( address[] calldata targets, uint256[] calldata values, bytes[] calldata datas, bytes32 predecessor, bytes32 salt ) public pure virtual returns (bytes32 hash) { return keccak256(abi.encode(targets, values, datas, predecessor, salt)); } /** * @dev Schedule an operation containing a single transaction. * * Emits a {CallScheduled} event. * * Requirements: * * - the caller must have the 'proposer' role. */ function schedule( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt, uint256 delay ) public virtual onlyRole(PROPOSER_ROLE) { bytes32 id = hashOperation(target, value, data, predecessor, salt); _schedule(id, delay); emit CallScheduled(id, 0, target, value, data, predecessor, delay); } /** * @dev Schedule an operation containing a batch of transactions. * * Emits one {CallScheduled} event per transaction in the batch. * * Requirements: * * - the caller must have the 'proposer' role. */ function scheduleBatch( address[] calldata targets, uint256[] calldata values, bytes[] calldata datas, bytes32 predecessor, bytes32 salt, uint256 delay ) public virtual onlyRole(PROPOSER_ROLE) { require(targets.length == values.length, "TimelockController: length mismatch"); require(targets.length == datas.length, "TimelockController: length mismatch"); bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt); _schedule(id, delay); for (uint256 i = 0; i < targets.length; ++i) { emit CallScheduled(id, i, targets[i], values[i], datas[i], predecessor, delay); } } /** * @dev Schedule an operation that is to becomes valid after a given delay. */ function _schedule(bytes32 id, uint256 delay) private { require(!isOperation(id), "TimelockController: operation already scheduled"); require(delay >= getMinDelay(), "TimelockController: insufficient delay"); _timestamps[id] = block.timestamp + delay; } /** * @dev Cancel an operation. * * Requirements: * * - the caller must have the 'proposer' role. */ function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) { require(isOperationPending(id), "TimelockController: operation cannot be cancelled"); delete _timestamps[id]; emit Cancelled(id); } /** * @dev Execute an (ready) operation containing a single transaction. * * Emits a {CallExecuted} event. * * Requirements: * * - the caller must have the 'executor' role. */ function execute( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) { bytes32 id = hashOperation(target, value, data, predecessor, salt); _beforeCall(id, predecessor); _call(id, 0, target, value, data); _afterCall(id); } /** * @dev Execute an (ready) operation containing a batch of transactions. * * Emits one {CallExecuted} event per transaction in the batch. * * Requirements: * * - the caller must have the 'executor' role. */ function executeBatch( address[] calldata targets, uint256[] calldata values, bytes[] calldata datas, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) { require(targets.length == values.length, "TimelockController: length mismatch"); require(targets.length == datas.length, "TimelockController: length mismatch"); bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt); _beforeCall(id, predecessor); for (uint256 i = 0; i < targets.length; ++i) { _call(id, i, targets[i], values[i], datas[i]); } _afterCall(id); } /** * @dev Checks before execution of an operation's calls. */ function _beforeCall(bytes32 id, bytes32 predecessor) private view { require(isOperationReady(id), "TimelockController: operation is not ready"); require(predecessor == bytes32(0) || isOperationDone(predecessor), "TimelockController: missing dependency"); } /** * @dev Checks after execution of an operation's calls. */ function _afterCall(bytes32 id) private { require(isOperationReady(id), "TimelockController: operation is not ready"); _timestamps[id] = _DONE_TIMESTAMP; } /** * @dev Execute an operation's call. * * Emits a {CallExecuted} event. */ function _call( bytes32 id, uint256 index, address target, uint256 value, bytes calldata data ) private { (bool success, ) = target.call{value: value}(data); require(success, "TimelockController: underlying transaction reverted"); emit CallExecuted(id, index, target, value, data); } /** * @dev Changes the minimum timelock duration for future operations. * * Emits a {MinDelayChange} event. * * Requirements: * * - the caller must be the timelock itself. This can only be achieved by scheduling and later executing * an operation where the timelock is the target and the data is the ABI-encoded call to this function. */ function updateDelay(uint256 newDelay) external virtual { require(msg.sender == address(this), "TimelockController: caller must be timelock"); emit MinDelayChange(_minDelay, newDelay); _minDelay = newDelay; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol) pragma solidity ^0.8.0; import "../Proxy.sol"; import "./ERC1967Upgrade.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. */ contract ERC1967Proxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializating the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _upgradeToAndCall(_logic, _data, false); } /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol) pragma solidity ^0.8.0; import "./TransparentUpgradeableProxy.sol"; import "../../access/Ownable.sol"; /** * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}. */ contract ProxyAdmin is Ownable { /** * @dev Returns the current implementation of `proxy`. * * Requirements: * * - This contract must be the admin of `proxy`. */ function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("implementation()")) == 0x5c60da1b (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b"); require(success); return abi.decode(returndata, (address)); } /** * @dev Returns the current admin of `proxy`. * * Requirements: * * - This contract must be the admin of `proxy`. */ function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("admin()")) == 0xf851a440 (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440"); require(success); return abi.decode(returndata, (address)); } /** * @dev Changes the admin of `proxy` to `newAdmin`. * * Requirements: * * - This contract must be the current admin of `proxy`. */ function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner { proxy.changeAdmin(newAdmin); } /** * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. * * Requirements: * * - This contract must be the admin of `proxy`. */ function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner { proxy.upgradeTo(implementation); } /** * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See * {TransparentUpgradeableProxy-upgradeToAndCall}. * * Requirements: * * - This contract must be the admin of `proxy`. */ function upgradeAndCall( TransparentUpgradeableProxy proxy, address implementation, bytes memory data ) public payable virtual onlyOwner { proxy.upgradeToAndCall{value: msg.value}(implementation, data); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol) pragma solidity ^0.8.0; import "../ERC1967/ERC1967Proxy.sol"; /** * @dev This contract implements a proxy that is upgradeable by an admin. * * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector * clashing], which can potentially be used in an attack, this contract uses the * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two * things that go hand in hand: * * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if * that call matches one of the admin functions exposed by the proxy itself. * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the * implementation. If the admin tries to call a function on the implementation it will fail with an error that says * "admin cannot fallback to proxy target". * * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due * to sudden errors when trying to call a function from the proxy implementation. * * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is ERC1967Proxy { /** * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. */ constructor( address _logic, address admin_, bytes memory _data ) payable ERC1967Proxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _changeAdmin(admin_); } /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. */ modifier ifAdmin() { if (msg.sender == _getAdmin()) { _; } else { _fallback(); } } /** * @dev Returns the current admin. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function admin() external ifAdmin returns (address admin_) { admin_ = _getAdmin(); } /** * @dev Returns the current implementation. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function implementation() external ifAdmin returns (address implementation_) { implementation_ = _implementation(); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. * * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. */ function changeAdmin(address newAdmin) external virtual ifAdmin { _changeAdmin(newAdmin); } /** * @dev Upgrade the implementation of the proxy. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeToAndCall(newImplementation, bytes(""), false); } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeToAndCall(newImplementation, data, true); } /** * @dev Returns the current admin. */ function _admin() internal view virtual returns (address) { return _getAdmin(); } /** * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. */ function _beforeFallback() internal virtual override { require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target"); super._beforeFallback(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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 functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// 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/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 v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2023 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ pragma solidity 0.8.9; import "./BackedOracleInterface.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract BackedOracle is AccessControlUpgradeable, AggregatorV2V3Interface { uint8 public constant VERSION = 1; uint8 public constant MAX_PERCENT_DIFFERENCE = 10; uint32 public constant MAX_TIMESTAMP_AGE = 5 minutes; uint32 public constant MIN_UPDATE_INTERVAL = 1 hours; bytes32 public constant UPDATER_ROLE = keccak256("UPDATER_ROLE"); struct RoundData { int192 answer; uint32 timestamp; } uint8 private _decimals; string private _description; mapping(uint256 => RoundData) private _roundData; uint80 private _latestRoundNumber; constructor() { initialize(0, "Backed Oracle Implementation", address(0), address(0)); } function initialize( uint8 __decimals, string memory __description, address __admin, address __updater ) public initializer { _decimals = __decimals; _description = __description; _grantRole(DEFAULT_ADMIN_ROLE, __admin); _grantRole(UPDATER_ROLE, __updater); } function version() external view override returns (uint256) { return VERSION; } function decimals() external view override returns (uint8) { return _decimals; } function description() external view override returns (string memory) { return _description; } function latestAnswer() external view override returns (int256) { require(_latestRoundNumber != 0, "No data present"); return _roundData[_latestRoundNumber].answer; } function latestTimestamp() external view override returns (uint256) { require(_latestRoundNumber != 0, "No data present"); return _roundData[_latestRoundNumber].timestamp; } function latestRound() external view override returns (uint256) { require(_latestRoundNumber != 0, "No data present"); return _latestRoundNumber; } function latestRoundData() external view override returns (uint80, int256, uint256, uint256, uint80) { require(_latestRoundNumber != 0, "No data present"); return ( uint80(_latestRoundNumber), _roundData[_latestRoundNumber].answer, _roundData[_latestRoundNumber].timestamp, _roundData[_latestRoundNumber].timestamp, uint80(_latestRoundNumber) ); } function getAnswer( uint256 roundId ) external view override returns (int256) { require(roundId <= _latestRoundNumber, "No data present"); return _roundData[roundId].answer; } function getTimestamp( uint256 roundId ) external view override returns (uint256) { require(roundId <= _latestRoundNumber, "No data present"); return _roundData[roundId].timestamp; } function getRoundData( uint80 roundId ) external view override returns (uint80, int256, uint256, uint256, uint80) { require(roundId <= _latestRoundNumber, "No data present"); return ( roundId, _roundData[roundId].answer, _roundData[roundId].timestamp, _roundData[roundId].timestamp, roundId ); } function updateAnswer( int192 newAnswer, uint32 newTimestamp ) external onlyRole(UPDATER_ROLE) { int256 latestAnswer = _roundData[_latestRoundNumber].answer; uint256 latestTimestamp = _roundData[_latestRoundNumber].timestamp; // Timestamp is actual timestamp require( newTimestamp < block.timestamp, "Timestamp cannot be in the future" ); // Check that the timestamp is not too old require( block.timestamp - newTimestamp <= MAX_TIMESTAMP_AGE, "Timestamp is too old" ); // The timestamp is more than the last timestamp require( newTimestamp > latestTimestamp, "Timestamp is older than the last update" ); // The last update happened more than MIN_UPDATE_INTERVAL ago require( newTimestamp - latestTimestamp > MIN_UPDATE_INTERVAL, "Timestamp cannot be updated too often" ); // Limit the value to at most MAX_PERCENT_DIFFERENCE% different from the last value if (latestAnswer > 0) { int192 allowedDeviation = int192( (latestAnswer * int8(MAX_PERCENT_DIFFERENCE)) / 100 ); if (newAnswer > latestAnswer + allowedDeviation) { newAnswer = int192(latestAnswer + allowedDeviation); } else if (newAnswer < latestAnswer - allowedDeviation) { newAnswer = int192(latestAnswer - allowedDeviation); } } uint80 newRound = _latestRoundNumber + 1; _latestRoundNumber = newRound; _roundData[newRound] = RoundData(newAnswer, newTimestamp); emit AnswerUpdated(newAnswer, newRound, newTimestamp); emit NewRound(newRound, msg.sender, newTimestamp); } }
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2023 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ pragma solidity 0.8.9; import "./BackedOracleInterface.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract BackedOracleForwarder is Ownable, AggregatorV2V3Interface { AggregatorV2V3Interface public _upstreamOracle; constructor(address __upstreamOracle, address __owner) { _upstreamOracle = AggregatorV2V3Interface(__upstreamOracle); _transferOwnership(__owner); } function version() external view returns (uint256) { return _upstreamOracle.version(); } function decimals() external view returns (uint8) { return _upstreamOracle.decimals(); } function description() external view returns (string memory) { return _upstreamOracle.description(); } function latestAnswer() external view returns (int256) { return _upstreamOracle.latestAnswer(); } function latestTimestamp() external view returns (uint256) { return _upstreamOracle.latestTimestamp(); } function latestRound() external view returns (uint256) { return _upstreamOracle.latestRound(); } function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) { return _upstreamOracle.latestRoundData(); } function getAnswer(uint256 roundId) external view returns (int256) { return _upstreamOracle.getAnswer(roundId); } function getTimestamp(uint256 roundId) external view returns (uint256) { return _upstreamOracle.getTimestamp(roundId); } function getRoundData( uint80 roundId ) external view returns (uint80, int256, uint256, uint256, uint80) { return _upstreamOracle.getRoundData(roundId); } function setUpstreamOracle(address __upstreamOracle) external onlyOwner { _upstreamOracle = AggregatorV2V3Interface(__upstreamOracle); } }
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2023 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ pragma solidity 0.8.9; interface AggregatorInterface { function latestAnswer() external view returns (int256); function latestTimestamp() external view returns (uint256); function latestRound() external view returns (uint256); function getAnswer(uint256 roundId) external view returns (int256); function getTimestamp(uint256 roundId) external view returns (uint256); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); } interface AggregatorV3Interface { function version() external view returns (uint256); function decimals() external view returns (uint8); function description() external view returns (string memory); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); } interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface { }
{ "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":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address[]","name":"timelockWorkers","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newImplementation","type":"address"}],"name":"NewImplementation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newOracle","type":"address"}],"name":"NewOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newOracleForwarder","type":"address"}],"name":"NewOracleForwarder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"string","name":"description","type":"string"},{"internalType":"address","name":"oracleUpdater","type":"address"}],"name":"deployOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"contract BackedOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyAdmin","outputs":[{"internalType":"contract ProxyAdmin","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelockController","outputs":[{"internalType":"contract TimelockController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"updateImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040516200664838038062006648833981016040819052620000349162000390565b6200003f33620002e3565b6001600160a01b0382166200009a5760405162461bcd60e51b815260206004820181905260248201527f466163746f72793a20616464726573732073686f756c64206e6f742062652030604482015260640160405180910390fd5b604051620000a89062000333565b604051809103906000f080158015620000c5573d6000803e3d6000fd5b50600380546001600160a01b0319166001600160a01b0392909216919091179055604051620000f49062000341565b604051809103906000f08015801562000111573d6000803e3d6000fd5b50600160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555062093a8081826040516200014c906200034f565b6200015a93929190620004bf565b604051809103906000f08015801562000177573d6000803e3d6000fd5b50600280546001600160a01b0319166001600160a01b0392831690811790915560015460405163f2fde38b60e01b815260048101929092529091169063f2fde38b90602401600060405180830381600087803b158015620001d757600080fd5b505af1158015620001ec573d6000803e3d6000fd5b50506002546040805163034f3dbf60e21b815290516001600160a01b039092169350632f2ff15d92508391630d3cf6fc91600480820192602092909190829003018186803b1580156200023e57600080fd5b505afa15801562000253573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002799190620004f8565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b0385166024820152604401600060405180830381600087803b158015620002c257600080fd5b505af1158015620002d7573d6000803e3d6000fd5b50505050505062000512565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61185a806200283083390190565b6107a1806200408a83390190565b611e1d806200482b83390190565b80516001600160a01b03811681146200037557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215620003a457600080fd5b620003af836200035d565b602084810151919350906001600160401b0380821115620003cf57600080fd5b818601915086601f830112620003e457600080fd5b815181811115620003f957620003f96200037a565b8060051b604051601f19603f830116810181811085821117156200042157620004216200037a565b6040529182528482019250838101850191898311156200044057600080fd5b938501935b82851015620004695762000459856200035d565b8452938501939285019262000445565b8096505050505050509250929050565b600081518084526020808501945080840160005b83811015620004b45781516001600160a01b0316875295820195908201906001016200048d565b509495945050505050565b838152606060208201526000620004da606083018562000479565b8281036040840152620004ee818562000479565b9695505050505050565b6000602082840312156200050b57600080fd5b5051919050565b61230e80620005226000396000f3fe60806040523480156200001157600080fd5b5060043610620000935760003560e01c8063715018a61162000062578063715018a6146200010c5780638da5cb5b1462000116578063f2fde38b1462000128578063f3388e75146200013f57600080fd5b8063025b22bc14620000985780631ff2631214620000b15780633e47158c14620000e45780635c60da1b14620000f8575b600080fd5b620000af620000a936600462000570565b62000153565b005b620000c8620000c2366004620005ab565b6200022b565b6040516001600160a01b03909116815260200160405180910390f35b600154620000c8906001600160a01b031681565b600354620000c8906001600160a01b031681565b620000af6200040a565b6000546001600160a01b0316620000c8565b620000af6200013936600462000570565b62000445565b600254620000c8906001600160a01b031681565b6000546001600160a01b03163314620001895760405162461bcd60e51b8152600401620001809062000692565b60405180910390fd5b6001600160a01b038116620001e15760405162461bcd60e51b815260206004820181905260248201527f466163746f72793a20616464726573732073686f756c64206e6f742062652030604482015260640162000180565b600380546001600160a01b0319166001600160a01b0383169081179091556040517f6b70829fcbe4891157f7a7496f9870927de3c8237adbe9cd39bae09b7382c40990600090a250565b600080546001600160a01b03163314620002595760405162461bcd60e51b8152600401620001809062000692565b6000836040516020016200026e9190620006fa565b60408051601f1981840301815290829052805160209091012060035460015460025492945060009385936001600160a01b03938416939283169263f4a2906760e01b92620002c8928d928d929116908c9060240162000746565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051620003079062000537565b620003159392919062000785565b8190604051809103906000f590508015801562000336573d6000803e3d6000fd5b506040519091506001600160a01b038216907fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e90600090a2600254604051600091849184916001600160a01b031690620003909062000545565b6001600160a01b039283168152911660208201526040018190604051809103906000f5905080158015620003c8573d6000803e3d6000fd5b506040519091506001600160a01b038216907f0123400de0e774068ff25080d380ed1e8ad70cfea3c0d28d9ff41f1701ce638d90600090a29695505050505050565b6000546001600160a01b03163314620004375760405162461bcd60e51b8152600401620001809062000692565b620004436000620004e7565b565b6000546001600160a01b03163314620004725760405162461bcd60e51b8152600401620001809062000692565b6001600160a01b038116620004d95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000180565b620004e481620004e7565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f6c80620007bd83390190565b610bb0806200172983390190565b80356001600160a01b03811681146200056b57600080fd5b919050565b6000602082840312156200058357600080fd5b6200058e8262000553565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620005c157600080fd5b833560ff81168114620005d357600080fd5b9250602084013567ffffffffffffffff80821115620005f157600080fd5b818601915086601f8301126200060657600080fd5b8135818111156200061b576200061b62000595565b604051601f8201601f19908116603f0116810190838211818310171562000646576200064662000595565b816040528281528960208487010111156200066057600080fd5b826020860160208301376000602084830101528096505050505050620006896040850162000553565b90509250925092565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60005b83811015620006e4578181015183820152602001620006ca565b83811115620006f4576000848401525b50505050565b600082516200070e818460208701620006c7565b9190910192915050565b6000815180845262000732816020860160208601620006c7565b601f01601f19169290920160200192915050565b60ff8516815260806020820152600062000764608083018662000718565b6001600160a01b039485166040840152929093166060909101529392505050565b6001600160a01b03848116825283166020820152606060408201819052600090620007b39083018462000718565b9594505050505056fe608060405260405162000f6c38038062000f6c83398101604081905262000026916200051f565b82828282816200005860017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005ff565b60008051602062000f258339815191521462000078576200007862000625565b6200008682826000620000ed565b50620000b6905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005ff565b60008051602062000f0583398151915214620000d657620000d662000625565b620000e1826200012a565b5050505050506200068e565b620000f88362000185565b600082511180620001065750805b156200012557620001238383620001c760201b620002601760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f62000155620001f6565b604080516001600160a01b03928316815291841660208301520160405180910390a162000182816200022f565b50565b6200019081620002e4565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001ef838360405180606001604052806027815260200162000f456027913962000387565b9392505050565b60006200022060008051602062000f0583398151915260001b6200046d60201b620002081760201c565b546001600160a01b0316919050565b6001600160a01b0381166200029a5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002c360008051602062000f0583398151915260001b6200046d60201b620002081760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002fa816200047060201b6200028c1760201c565b6200035e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840162000291565b80620002c360008051602062000f2583398151915260001b6200046d60201b620002081760201c565b60606001600160a01b0384163b620003f15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000291565b600080856001600160a01b0316856040516200040e91906200063b565b600060405180830381855af49150503d80600081146200044b576040519150601f19603f3d011682016040523d82523d6000602084013e62000450565b606091505b509092509050620004638282866200047f565b9695505050505050565b90565b6001600160a01b03163b151590565b6060831562000490575081620001ef565b825115620004a15782518084602001fd5b8160405162461bcd60e51b815260040162000291919062000659565b80516001600160a01b0381168114620004d557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200050d578181015183820152602001620004f3565b83811115620001235750506000910152565b6000806000606084860312156200053557600080fd5b6200054084620004bd565b92506200055060208501620004bd565b60408501519092506001600160401b03808211156200056e57600080fd5b818601915086601f8301126200058357600080fd5b815181811115620005985762000598620004da565b604051601f8201601f19908116603f01168101908382118183101715620005c357620005c3620004da565b81604052828152896020848701011115620005dd57600080fd5b620005f0836020830160208801620004f0565b80955050505050509250925092565b6000828210156200062057634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b600082516200064f818460208701620004f0565b9190910192915050565b60208152600082518060208401526200067a816040850160208701620004f0565b601f01601f19169190910160400192915050565b610867806200069e6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106f1565b610118565b61005b61009336600461070c565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106f1565b61020b565b3480156100f557600080fd5b506100ad610235565b61010661029b565b61011661011161033a565b610344565b565b610120610368565b6001600160a01b0316336001600160a01b03161415610157576101548160405180602001604052806000815250600061039b565b50565b6101546100fe565b610167610368565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506001925061039b915050565b505050565b6101c36100fe565b60006101da610368565b6001600160a01b0316336001600160a01b03161415610200576101fb61033a565b905090565b6102086100fe565b90565b610213610368565b6001600160a01b0316336001600160a01b0316141561015757610154816103c6565b600061023f610368565b6001600160a01b0316336001600160a01b03161415610200576101fb610368565b6060610285838360405180606001604052806027815260200161080b6027913961041a565b9392505050565b6001600160a01b03163b151590565b6102a3610368565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb6104f7565b3660008037600080366000845af43d6000803e808015610363573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b6103a48361051f565b6000825111806103b15750805b156101c3576103c08383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103ef610368565b604080516001600160a01b03928316815291841660208301520160405180910390a16101548161055f565b60606001600160a01b0384163b6104825760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610331565b600080856001600160a01b03168560405161049d91906107bb565b600060405180830381855af49150503d80600081146104d8576040519150601f19603f3d011682016040523d82523d6000602084013e6104dd565b606091505b50915091506104ed828286610608565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61038c565b61052881610641565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105c45760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610331565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60608315610617575081610285565b8251156106275782518084602001fd5b8160405162461bcd60e51b815260040161033191906107d7565b6001600160a01b0381163b6106ae5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610331565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105e7565b80356001600160a01b03811681146106ec57600080fd5b919050565b60006020828403121561070357600080fd5b610285826106d5565b60008060006040848603121561072157600080fd5b61072a846106d5565b9250602084013567ffffffffffffffff8082111561074757600080fd5b818601915086601f83011261075b57600080fd5b81358181111561076a57600080fd5b87602082850101111561077c57600080fd5b6020830194508093505050509250925092565b60005b838110156107aa578181015183820152602001610792565b838111156103c05750506000910152565b600082516107cd81846020870161078f565b9190910192915050565b60208152600082518060208401526107f681604085016020870161078f565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212200cb2063c3085e28e5862d77d64be738217c6ce3d218f00ed0b50a063f3592d7064736f6c63430008090033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b50604051610bb0380380610bb083398101604081905261002f916100cf565b61003833610063565b600180546001600160a01b0319166001600160a01b03841617905561005c81610063565b5050610102565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100ca57600080fd5b919050565b600080604083850312156100e257600080fd5b6100eb836100b3565b91506100f9602084016100b3565b90509250929050565b610a9f806101116000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638ac8f3dd11610097578063b5ab58dc11610066578063b5ab58dc146101ff578063b633620c14610212578063f2fde38b14610225578063feaf968c1461023857600080fd5b80638ac8f3dd146101665780638da5cb5b146101915780639a6fc8f5146101a2578063afc4be81146101ec57600080fd5b8063668a0f02116100d3578063668a0f0214610137578063715018a61461013f5780637284e416146101495780638205bf6a1461015e57600080fd5b8063313ce567146100fa57806350d25bcd1461011957806354fd4d501461012f575b600080fd5b610102610240565b60405160ff90911681526020015b60405180910390f35b6101216102c2565b604051908152602001610110565b61012161033f565b610121610384565b6101476103c9565b005b610151610408565b604051610110919061082c565b610121610489565b600154610179906001600160a01b031681565b6040516001600160a01b039091168152602001610110565b6000546001600160a01b0316610179565b6101b56101b0366004610877565b6104ce565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a001610110565b6101476101fa36600461089b565b610570565b61012161020d3660046108c4565b6105bc565b6101216102203660046108c4565b610640565b61014761023336600461089b565b610672565b6101b561070d565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b15801561028557600080fd5b505afa158015610299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102bd91906108dd565b905090565b600154604080516350d25bcd60e01b815290516000926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b15801561030757600080fd5b505afa15801561031b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102bd9190610900565b6001546040805163054fd4d560e41b815290516000926001600160a01b0316916354fd4d50916004808301926020929190829003018186803b15801561030757600080fd5b60015460408051633345078160e11b815290516000926001600160a01b03169163668a0f02916004808301926020929190829003018186803b15801561030757600080fd5b6000546001600160a01b031633146103fc5760405162461bcd60e51b81526004016103f390610919565b60405180910390fd5b61040660006107ac565b565b60015460408051633942720b60e11b815290516060926001600160a01b031691637284e416916004808301926000929190829003018186803b15801561044d57600080fd5b505afa158015610461573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102bd9190810190610964565b60015460408051634102dfb560e11b815290516000926001600160a01b031691638205bf6a916004808301926020929190829003018186803b15801561030757600080fd5b600154604051639a6fc8f560e01b815269ffffffffffffffffffff8316600482015260009182918291829182916001600160a01b031690639a6fc8f59060240160a06040518083038186803b15801561052657600080fd5b505afa15801561053a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055e9190610a11565b939a9299509097509550909350915050565b6000546001600160a01b0316331461059a5760405162461bcd60e51b81526004016103f390610919565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600154604051632d6ad63760e21b8152600481018390526000916001600160a01b03169063b5ab58dc906024015b60206040518083038186803b15801561060257600080fd5b505afa158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a9190610900565b92915050565b600154604051632d8cd88360e21b8152600481018390526000916001600160a01b03169063b633620c906024016105ea565b6000546001600160a01b0316331461069c5760405162461bcd60e51b81526004016103f390610919565b6001600160a01b0381166107015760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f3565b61070a816107ac565b50565b6000806000806000600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561076357600080fd5b505afa158015610777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079b9190610a11565b945094509450945094509091929394565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005b838110156108175781810151838201526020016107ff565b83811115610826576000848401525b50505050565b602081526000825180602084015261084b8160408501602087016107fc565b601f01601f19169190910160400192915050565b69ffffffffffffffffffff8116811461070a57600080fd5b60006020828403121561088957600080fd5b81356108948161085f565b9392505050565b6000602082840312156108ad57600080fd5b81356001600160a01b038116811461089457600080fd5b6000602082840312156108d657600080fd5b5035919050565b6000602082840312156108ef57600080fd5b815160ff8116811461089457600080fd5b60006020828403121561091257600080fd5b5051919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561097657600080fd5b815167ffffffffffffffff8082111561098e57600080fd5b818401915084601f8301126109a257600080fd5b8151818111156109b4576109b461094e565b604051601f8201601f19908116603f011681019083821181831017156109dc576109dc61094e565b816040528281528760208487010111156109f557600080fd5b610a068360208301602088016107fc565b979650505050505050565b600080600080600060a08688031215610a2957600080fd5b8551610a348161085f565b809550506020860151935060408601519250606086015191506080860151610a5b8161085f565b80915050929550929590935056fea26469706673582212201a1e027eceff9f6cfb8283984a0536a90817e44c20341f6087c6e7e64a65faaa64736f6c63430008090033a264697066735822122033687964694528f3f8617c65fa765b89ff5de6ce34504551e8db25cae845233364736f6c6343000809003360806040523480156200001157600080fd5b506200005d60006040518060400160405280601c81526020017f4261636b6564204f7261636c6520496d706c656d656e746174696f6e000000008152506000806200006360201b60201c565b62000342565b600054610100900460ff16620000805760005460ff16156200008a565b6200008a6200018d565b620000f25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff1615801562000115576000805461ffff19166101011790555b6097805460ff191660ff87161790558351620001399060989060208701906200025f565b5062000147600084620001ab565b620001737f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab83620001ab565b801562000186576000805461ff00191690555b5050505050565b6000620001a5306200025060201b62000c001760201c565b15905090565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166200024c5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200020b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6001600160a01b03163b151590565b8280546200026d9062000305565b90600052602060002090601f016020900481019282620002915760008555620002dc565b82601f10620002ac57805160ff1916838001178555620002dc565b82800160010185558215620002dc579182015b82811115620002dc578251825591602001919060010190620002bf565b50620002ea929150620002ee565b5090565b5b80821115620002ea5760008155600101620002ef565b600181811c908216806200031a57607f821691505b602082108114156200033c57634e487b7160e01b600052602260045260246000fd5b50919050565b61150880620003526000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c80638205bf6a116100c3578063b633620c1161007c578063b633620c14610300578063bd3be27c14610313578063d547741f1461031c578063f4a290671461032f578063feaf968c14610342578063ffa1ad741461034a57600080fd5b80638205bf6a1461027b5780638a991dd11461028357806391d148541461028b5780639a6fc8f51461029e578063a217fddf146102e5578063b5ab58dc146102ed57600080fd5b806347e633801161011557806347e633801461020a57806350d25bcd1461023157806354fd4d5014610239578063668a0f02146102405780637284e4161461024857806376670d7a1461025d57600080fd5b806301ffc9a71461015d578063248a9ca3146101855780632f2ff15d146101b6578063309676e9146101cb578063313ce567146101de57806336568abe146101f7575b600080fd5b61017061016b366004610f9c565b610352565b60405190151581526020015b60405180910390f35b6101a8610193366004610fc6565b60009081526065602052604090206001015490565b60405190815260200161017c565b6101c96101c4366004610ffb565b610389565b005b6101c96101d9366004611027565b6103b4565b60975460ff165b60405160ff909116815260200161017c565b6101c9610205366004610ffb565b610735565b6101a87f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab81565b6101a86107b3565b60016101a8565b6101a8610800565b61025061083b565b60405161017c919061109f565b61026661012c81565b60405163ffffffff909116815260200161017c565b6101a86108cd565b6101e5600a81565b610170610299366004610ffb565b610924565b6102b16102ac3660046110d2565b61094f565b604080516001600160501b03968716815260208101959095528401929092526060830152909116608082015260a00161017c565b6101a8600081565b6101a86102fb366004610fc6565b6109c3565b6101a861030e366004610fc6565b610a07565b610266610e1081565b6101c961032a366004610ffb565b610a55565b6101c961033d366004611111565b610a7b565b6102b1610b90565b6101e5600181565b60006001600160e01b03198216637965db0b60e01b148061038357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152606560205260409020600101546103a58133610c0f565b6103af8383610c73565b505050565b7f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab6103df8133610c0f565b609a546001600160501b0316600090815260996020526040902054601781900b9063ffffffff600160c01b90910481169042908516106104705760405162461bcd60e51b815260206004820152602160248201527f54696d657374616d702063616e6e6f7420626520696e207468652066757475726044820152606560f81b60648201526084015b60405180910390fd5b61012c61048363ffffffff861642611212565b11156104c85760405162461bcd60e51b8152602060048201526014602482015273151a5b595cdd185b5c081a5cc81d1bdbc81bdb1960621b6044820152606401610467565b808463ffffffff161161052d5760405162461bcd60e51b815260206004820152602760248201527f54696d657374616d70206973206f6c646572207468616e20746865206c6173746044820152662075706461746560c81b6064820152608401610467565b610e106105408263ffffffff8716611212565b1161059b5760405162461bcd60e51b815260206004820152602560248201527f54696d657374616d702063616e6e6f74206265207570646174656420746f6f2060448201526437b33a32b760d91b6064820152608401610467565b600082131561061757600060646105b3600a85611229565b6105bd91906112ae565b90506105cd601782900b846112ea565b8660170b13156105ec576105e5601782900b846112ea565b9550610615565b6105fa601782900b8461132b565b8660170b121561061557610612601782900b8461132b565b95505b505b609a54600090610631906001600160501b0316600161136a565b609a805469ffffffffffffffffffff19166001600160501b03831690811790915560408051808201825260178a900b80825263ffffffff8a811660208085018281526000888152609983528790209551865491516001600160c01b039091166001600160e01b031990921691909117600160c01b91909416029290921790935592519182529394509192917f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f910160405180910390a360405163ffffffff8616815233906001600160501b038316907f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac602719060200160405180910390a3505050505050565b6001600160a01b03811633146107a55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610467565b6107af8282610cf9565b5050565b609a546000906001600160501b03166107de5760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b031660009081526099602052604090205460170b90565b609a546000906001600160501b031661082b5760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b031690565b60606098805461084a906113be565b80601f0160208091040260200160405190810160405280929190818152602001828054610876906113be565b80156108c35780601f10610898576101008083540402835291602001916108c3565b820191906000526020600020905b8154815290600101906020018083116108a657829003601f168201915b5050505050905090565b609a546000906001600160501b03166108f85760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b0316600090815260996020526040902054600160c01b900463ffffffff1690565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b609a5460009081908190819081906001600160501b0390811690871611156109895760405162461bcd60e51b815260040161046790611395565b505050506001600160501b0382166000908152609960205260409020549192601783900b92600160c01b900463ffffffff16915081908490565b609a546000906001600160501b03168211156109f15760405162461bcd60e51b815260040161046790611395565b5060009081526099602052604090205460170b90565b609a546000906001600160501b0316821115610a355760405162461bcd60e51b815260040161046790611395565b50600090815260996020526040902054600160c01b900463ffffffff1690565b600082815260656020526040902060010154610a718133610c0f565b6103af8383610cf9565b600054610100900460ff16610a965760005460ff1615610a9a565b303b155b610afd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610467565b600054610100900460ff16158015610b1f576000805461ffff19166101011790555b6097805460ff191660ff87161790558351610b41906098906020870190610f03565b50610b4d600084610c73565b610b777f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab83610c73565b8015610b89576000805461ff00191690555b5050505050565b609a5460009081908190819081906001600160501b0316610bc35760405162461bcd60e51b815260040161046790611395565b5050609a546001600160501b03166000818152609960205260409020549094601782900b9450600160c01b90910463ffffffff1692508291508490565b6001600160a01b03163b151590565b610c198282610924565b6107af57610c31816001600160a01b03166014610d60565b610c3c836020610d60565b604051602001610c4d9291906113f9565b60408051601f198184030181529082905262461bcd60e51b82526104679160040161109f565b610c7d8282610924565b6107af5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610cb53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610d038282610924565b156107af5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000610d6f83600261146e565b610d7a90600261148d565b67ffffffffffffffff811115610d9257610d926110fb565b6040519080825280601f01601f191660200182016040528015610dbc576020820181803683370190505b509050600360fc1b81600081518110610dd757610dd76114a5565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e0657610e066114a5565b60200101906001600160f81b031916908160001a9053506000610e2a84600261146e565b610e3590600161148d565b90505b6001811115610ead576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610e6957610e696114a5565b1a60f81b828281518110610e7f57610e7f6114a5565b60200101906001600160f81b031916908160001a90535060049490941c93610ea6816114bb565b9050610e38565b508315610efc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610467565b9392505050565b828054610f0f906113be565b90600052602060002090601f016020900481019282610f315760008555610f77565b82601f10610f4a57805160ff1916838001178555610f77565b82800160010185558215610f77579182015b82811115610f77578251825591602001919060010190610f5c565b50610f83929150610f87565b5090565b5b80821115610f835760008155600101610f88565b600060208284031215610fae57600080fd5b81356001600160e01b031981168114610efc57600080fd5b600060208284031215610fd857600080fd5b5035919050565b80356001600160a01b0381168114610ff657600080fd5b919050565b6000806040838503121561100e57600080fd5b8235915061101e60208401610fdf565b90509250929050565b6000806040838503121561103a57600080fd5b82358060170b811461104b57600080fd5b9150602083013563ffffffff8116811461106457600080fd5b809150509250929050565b60005b8381101561108a578181015183820152602001611072565b83811115611099576000848401525b50505050565b60208152600082518060208401526110be81604085016020870161106f565b601f01601f19169190910160400192915050565b6000602082840312156110e457600080fd5b81356001600160501b0381168114610efc57600080fd5b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561112757600080fd5b843560ff8116811461113857600080fd5b9350602085013567ffffffffffffffff8082111561115557600080fd5b818701915087601f83011261116957600080fd5b81358181111561117b5761117b6110fb565b604051601f8201601f19908116603f011681019083821181831017156111a3576111a36110fb565b816040528281528a60208487010111156111bc57600080fd5b8260208601602083013760006020848301015280975050505050506111e360408601610fdf565b91506111f160608601610fdf565b905092959194509250565b634e487b7160e01b600052601160045260246000fd5b600082821015611224576112246111fc565b500390565b60006001600160ff1b038184138284138082168684048611161561124f5761124f6111fc565b600160ff1b600087128281168783058912161561126e5761126e6111fc565b6000871292508782058712848416161561128a5761128a6111fc565b878505871281841616156112a0576112a06111fc565b505050929093029392505050565b6000826112cb57634e487b7160e01b600052601260045260246000fd5b600160ff1b8214600019841416156112e5576112e56111fc565b500590565b600080821280156001600160ff1b038490038513161561130c5761130c6111fc565b600160ff1b8390038412811615611325576113256111fc565b50500190565b60008083128015600160ff1b850184121615611349576113496111fc565b6001600160ff1b0384018313811615611364576113646111fc565b50500390565b60006001600160501b0380831681851680830382111561138c5761138c6111fc565b01949350505050565b6020808252600f908201526e139bc819185d18481c1c995cd95b9d608a1b604082015260600190565b600181811c908216806113d257607f821691505b602082108114156113f357634e487b7160e01b600052602260045260246000fd5b50919050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161143181601785016020880161106f565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161146281602884016020880161106f565b01602801949350505050565b6000816000190483118215151615611488576114886111fc565b500290565b600082198211156114a0576114a06111fc565b500190565b634e487b7160e01b600052603260045260246000fd5b6000816114ca576114ca6111fc565b50600019019056fea264697066735822122097ec7a5e085f219cbb2920290b7e3a8ba7b459b91549b1695d05deca48cf939164736f6c63430008090033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6107238061007e6000396000f3fe60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461011157806399a88ec414610124578063f2fde38b14610144578063f3b7dead1461016457600080fd5b8063204e1c7a14610080578063715018a6146100bc5780637eff275e146100d35780638da5cb5b146100f3575b600080fd5b34801561008c57600080fd5b506100a061009b3660046104ed565b610184565b6040516001600160a01b03909116815260200160405180910390f35b3480156100c857600080fd5b506100d1610215565b005b3480156100df57600080fd5b506100d16100ee366004610511565b610254565b3480156100ff57600080fd5b506000546001600160a01b03166100a0565b6100d161011f366004610560565b6102de565b34801561013057600080fd5b506100d161013f366004610511565b61036f565b34801561015057600080fd5b506100d161015f3660046104ed565b6103c7565b34801561017057600080fd5b506100a061017f3660046104ed565b610462565b6000806000836001600160a01b03166040516101aa90635c60da1b60e01b815260040190565b600060405180830381855afa9150503d80600081146101e5576040519150601f19603f3d011682016040523d82523d6000602084013e6101ea565b606091505b5091509150816101f957600080fd5b8080602001905181019061020d9190610636565b949350505050565b6000546001600160a01b031633146102485760405162461bcd60e51b815260040161023f90610653565b60405180910390fd5b6102526000610488565b565b6000546001600160a01b0316331461027e5760405162461bcd60e51b815260040161023f90610653565b6040516308f2839760e41b81526001600160a01b038281166004830152831690638f283970906024015b600060405180830381600087803b1580156102c257600080fd5b505af11580156102d6573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031633146103085760405162461bcd60e51b815260040161023f90610653565b60405163278f794360e11b81526001600160a01b03841690634f1ef2869034906103389086908690600401610688565b6000604051808303818588803b15801561035157600080fd5b505af1158015610365573d6000803e3d6000fd5b5050505050505050565b6000546001600160a01b031633146103995760405162461bcd60e51b815260040161023f90610653565b604051631b2ce7f360e11b81526001600160a01b038281166004830152831690633659cfe6906024016102a8565b6000546001600160a01b031633146103f15760405162461bcd60e51b815260040161023f90610653565b6001600160a01b0381166104565760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161023f565b61045f81610488565b50565b6000806000836001600160a01b03166040516101aa906303e1469160e61b815260040190565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461045f57600080fd5b6000602082840312156104ff57600080fd5b813561050a816104d8565b9392505050565b6000806040838503121561052457600080fd5b823561052f816104d8565b9150602083013561053f816104d8565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561057557600080fd5b8335610580816104d8565b92506020840135610590816104d8565b9150604084013567ffffffffffffffff808211156105ad57600080fd5b818601915086601f8301126105c157600080fd5b8135818111156105d3576105d361054a565b604051601f8201601f19908116603f011681019083821181831017156105fb576105fb61054a565b8160405282815289602084870101111561061457600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561064857600080fd5b815161050a816104d8565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60018060a01b038316815260006020604081840152835180604085015260005b818110156106c4578581018301518582016060015282016106a8565b818111156106d6576000606083870101525b50601f01601f19169290920160600194935050505056fea264697066735822122090b138f5aeb02fb09108702407cf58542246376449bd78b1ba261e63d44383d864736f6c6343000809003360806040523480156200001157600080fd5b5060405162001e1d38038062001e1d8339810160408190526200003491620003a4565b6200004f60008051602062001dbd83398151915280620001c9565b6200007960008051602062001ddd83398151915260008051602062001dbd833981519152620001c9565b620000a360008051602062001dfd83398151915260008051602062001dbd833981519152620001c9565b620000be60008051602062001dbd8339815191523362000214565b620000d960008051602062001dbd8339815191523062000214565b60005b825181101562000136576200012360008051602062001ddd8339815191528483815181106200010f576200010f62000418565b60200260200101516200021460201b60201c565b6200012e816200042e565b9050620000dc565b5060005b815181101562000180576200016d60008051602062001dfd8339815191528383815181106200010f576200010f62000418565b62000178816200042e565b90506200013a565b5060028390556040805160008152602081018590527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a150505062000458565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b62000220828262000224565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000220576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002803390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002f257600080fd5b919050565b600082601f8301126200030957600080fd5b815160206001600160401b0380831115620003285762000328620002c4565b8260051b604051601f19603f83011681018181108482111715620003505762000350620002c4565b6040529384528581018301938381019250878511156200036f57600080fd5b83870191505b8482101562000399576200038982620002da565b8352918301919083019062000375565b979650505050505050565b600080600060608486031215620003ba57600080fd5b835160208501519093506001600160401b0380821115620003da57600080fd5b620003e887838801620002f7565b93506040860151915080821115620003ff57600080fd5b506200040e86828701620002f7565b9150509250925092565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200045157634e487b7160e01b600052601160045260246000fd5b5060010190565b61195580620004686000396000f3fe60806040526004361061014f5760003560e01c806364d62353116100b6578063b1c5f4271161006f578063b1c5f427146103f3578063c4d252f514610413578063d45c443514610433578063d547741f14610460578063e38335e514610480578063f27a0c921461049357600080fd5b806364d623531461033c5780638065657f1461035c5780638f2a0bb01461037c5780638f61f4f51461039c57806391d14854146103be578063a217fddf146103de57600080fd5b8063248a9ca311610108578063248a9ca31461025b5780632ab0f5291461028b5780632f2ff15d146102bc57806331d50750146102dc57806336568abe146102fc578063584b153e1461031c57600080fd5b806301d5062a1461015b57806301ffc9a71461017d57806307bd0265146101b25780630d3cf6fc146101f4578063134008d31461022857806313bc9f201461023b57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017b6101763660046111b5565b6104a8565b005b34801561018957600080fd5b5061019d61019836600461122a565b61052c565b60405190151581526020015b60405180910390f35b3480156101be57600080fd5b506101e67fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b6040519081526020016101a9565b34801561020057600080fd5b506101e67f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b61017b610236366004611254565b610563565b34801561024757600080fd5b5061019d6102563660046112c0565b6105db565b34801561026757600080fd5b506101e66102763660046112c0565b60009081526020819052604090206001015490565b34801561029757600080fd5b5061019d6102a63660046112c0565b6000908152600160208190526040909120541490565b3480156102c857600080fd5b5061017b6102d73660046112d9565b610601565b3480156102e857600080fd5b5061019d6102f73660046112c0565b61062c565b34801561030857600080fd5b5061017b6103173660046112d9565b610645565b34801561032857600080fd5b5061019d6103373660046112c0565b6106c8565b34801561034857600080fd5b5061017b6103573660046112c0565b6106de565b34801561036857600080fd5b506101e6610377366004611254565b610782565b34801561038857600080fd5b5061017b61039736600461134a565b6107c1565b3480156103a857600080fd5b506101e660008051602061190083398151915281565b3480156103ca57600080fd5b5061019d6103d93660046112d9565b610902565b3480156103ea57600080fd5b506101e6600081565b3480156103ff57600080fd5b506101e661040e3660046113fc565b61092b565b34801561041f57600080fd5b5061017b61042e3660046112c0565b610970565b34801561043f57600080fd5b506101e661044e3660046112c0565b60009081526001602052604090205490565b34801561046c57600080fd5b5061017b61047b3660046112d9565b610a34565b61017b61048e3660046113fc565b610a5a565b34801561049f57600080fd5b506002546101e6565b6000805160206119008339815191526104c18133610b8f565b60006104d1898989898989610782565b90506104dd8184610bf3565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610519969594939291906114ce565b60405180910390a3505050505050505050565b60006001600160e01b03198216637965db0b60e01b148061055d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6361058f816000610902565b61059d5761059d8133610b8f565b60006105ad888888888888610782565b90506105b98185610ce2565b6105c88160008a8a8a8a610d7e565b6105d181610e92565b5050505050505050565b6000818152600160205260408120546001811180156105fa5750428111155b9392505050565b60008281526020819052604090206001015461061d8133610b8f565b6106278383610ecb565b505050565b60008181526001602052604081205481905b1192915050565b6001600160a01b03811633146106ba5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106c48282610f4f565b5050565b600081815260016020819052604082205461063e565b3330146107415760405162461bcd60e51b815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201526a62652074696d656c6f636b60a81b60648201526084016106b1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b600086868686868660405160200161079f969594939291906114ce565b6040516020818303038152906040528051906020012090509695505050505050565b6000805160206119008339815191526107da8133610b8f565b8887146107f95760405162461bcd60e51b81526004016106b19061150b565b8885146108185760405162461bcd60e51b81526004016106b19061150b565b600061082a8b8b8b8b8b8b8b8b61092b565b90506108368184610bf3565b60005b8a8110156108f45780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e858181106108765761087661154e565b905060200201602081019061088b9190611564565b8d8d8681811061089d5761089d61154e565b905060200201358c8c878181106108b6576108b661154e565b90506020028101906108c8919061157f565b8c8b6040516108dc969594939291906114ce565b60405180910390a36108ed816115dc565b9050610839565b505050505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000888888888888888860405160200161094c98979695949392919061168c565b60405160208183030381529060405280519060200120905098975050505050505050565b6000805160206119008339815191526109898133610b8f565b610992826106c8565b6109f85760405162461bcd60e51b815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e2063616044820152701b9b9bdd0818994818d85b98d95b1b1959607a1b60648201526084016106b1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610a508133610b8f565b6106278383610f4f565b7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63610a86816000610902565b610a9457610a948133610b8f565b878614610ab35760405162461bcd60e51b81526004016106b19061150b565b878414610ad25760405162461bcd60e51b81526004016106b19061150b565b6000610ae48a8a8a8a8a8a8a8a61092b565b9050610af08185610ce2565b60005b89811015610b7957610b6982828d8d85818110610b1257610b1261154e565b9050602002016020810190610b279190611564565b8c8c86818110610b3957610b3961154e565b905060200201358b8b87818110610b5257610b5261154e565b9050602002810190610b64919061157f565b610d7e565b610b72816115dc565b9050610af3565b50610b8381610e92565b50505050505050505050565b610b998282610902565b6106c457610bb1816001600160a01b03166014610fb4565b610bbc836020610fb4565b604051602001610bcd929190611767565b60408051601f198184030181529082905262461bcd60e51b82526106b1916004016117dc565b610bfc8261062c565b15610c615760405162461bcd60e51b815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201526e1c9958591e481cd8da19591d5b1959608a1b60648201526084016106b1565b600254811015610cc25760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e746044820152652064656c617960d01b60648201526084016106b1565b610ccc814261180f565b6000928352600160205260409092209190915550565b610ceb826105db565b610d075760405162461bcd60e51b81526004016106b190611827565b801580610d235750600081815260016020819052604090912054145b6106c45760405162461bcd60e51b815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e6720646570656044820152656e64656e637960d01b60648201526084016106b1565b6000846001600160a01b0316848484604051610d9b929190611871565b60006040518083038185875af1925050503d8060008114610dd8576040519150601f19603f3d011682016040523d82523d6000602084013e610ddd565b606091505b5050905080610e4a5760405162461bcd60e51b815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e6720746044820152721c985b9cd858dd1a5bdb881c995d995c9d1959606a1b60648201526084016106b1565b85877fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b5887878787604051610e819493929190611881565b60405180910390a350505050505050565b610e9b816105db565b610eb75760405162461bcd60e51b81526004016106b190611827565b600090815260016020819052604090912055565b610ed58282610902565b6106c4576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610f0b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610f598282610902565b156106c4576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000610fc38360026118b3565b610fce90600261180f565b67ffffffffffffffff811115610fe657610fe66118d2565b6040519080825280601f01601f191660200182016040528015611010576020820181803683370190505b509050600360fc1b8160008151811061102b5761102b61154e565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061105a5761105a61154e565b60200101906001600160f81b031916908160001a905350600061107e8460026118b3565b61108990600161180f565b90505b6001811115611101576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110bd576110bd61154e565b1a60f81b8282815181106110d3576110d361154e565b60200101906001600160f81b031916908160001a90535060049490941c936110fa816118e8565b905061108c565b5083156105fa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106b1565b80356001600160a01b038116811461116757600080fd5b919050565b60008083601f84011261117e57600080fd5b50813567ffffffffffffffff81111561119657600080fd5b6020830191508360208285010111156111ae57600080fd5b9250929050565b600080600080600080600060c0888a0312156111d057600080fd5b6111d988611150565b965060208801359550604088013567ffffffffffffffff8111156111fc57600080fd5b6112088a828b0161116c565b989b979a50986060810135976080820135975060a09091013595509350505050565b60006020828403121561123c57600080fd5b81356001600160e01b0319811681146105fa57600080fd5b60008060008060008060a0878903121561126d57600080fd5b61127687611150565b955060208701359450604087013567ffffffffffffffff81111561129957600080fd5b6112a589828a0161116c565b979a9699509760608101359660809091013595509350505050565b6000602082840312156112d257600080fd5b5035919050565b600080604083850312156112ec57600080fd5b823591506112fc60208401611150565b90509250929050565b60008083601f84011261131757600080fd5b50813567ffffffffffffffff81111561132f57600080fd5b6020830191508360208260051b85010111156111ae57600080fd5b600080600080600080600080600060c08a8c03121561136857600080fd5b893567ffffffffffffffff8082111561138057600080fd5b61138c8d838e01611305565b909b50995060208c01359150808211156113a557600080fd5b6113b18d838e01611305565b909950975060408c01359150808211156113ca57600080fd5b506113d78c828d01611305565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561141857600080fd5b883567ffffffffffffffff8082111561143057600080fd5b61143c8c838d01611305565b909a50985060208b013591508082111561145557600080fd5b6114618c838d01611305565b909850965060408b013591508082111561147a57600080fd5b506114878b828c01611305565b999c989b509699959896976060870135966080013595509350505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038716815285602082015260a0604082015260006114f660a0830186886114a5565b60608301949094525060800152949350505050565b60208082526023908201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d616040820152620e8c6d60eb1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561157657600080fd5b6105fa82611150565b6000808335601e1984360301811261159657600080fd5b83018035915067ffffffffffffffff8211156115b157600080fd5b6020019150368190038213156111ae57600080fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156115f0576115f06115c6565b5060010190565b60008383855260208086019550808560051b8301018460005b8781101561167f57848303601f19018952813536889003601e1901811261163657600080fd5b8701803567ffffffffffffffff81111561164f57600080fd5b80360389131561165e57600080fd5b61166b85828885016114a5565b9a86019a9450505090830190600101611610565b5090979650505050505050565b60a0808252810188905260008960c08301825b8b8110156116cd576001600160a01b036116b884611150565b1682526020928301929091019060010161169f565b5083810360208501528881526001600160fb1b038911156116ed57600080fd5b8860051b9150818a60208301378181019150506020810160008152602084830301604085015261171e81888a6115f7565b6060850196909652505050608001529695505050505050565b60005b8381101561175257818101518382015260200161173a565b83811115611761576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161179f816017850160208801611737565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516117d0816028840160208801611737565b01602801949350505050565b60208152600082518060208401526117fb816040850160208701611737565b601f01601f19169190910160400192915050565b60008219821115611822576118226115c6565b500190565b6020808252602a908201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e206973604082015269206e6f7420726561647960b01b606082015260800190565b8183823760009101908152919050565b60018060a01b03851681528360208201526060604082015260006118a96060830184866114a5565b9695505050505050565b60008160001904831182151516156118cd576118cd6115c6565b500290565b634e487b7160e01b600052604160045260246000fd5b6000816118f7576118f76115c6565b50600019019056feb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1a2646970667358221220d1b7c508b5ad9142231e2b7295d7cf451a7cf8f6440a63d040f8b3487a853ce564736f6c634300080900335f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5b09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1d8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e630000000000000000000000005f7a4c11bde4f218f0025ef444c369d838ffa2ad000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005f7a4c11bde4f218f0025ef444c369d838ffa2ad
Deployed Bytecode
0x60806040523480156200001157600080fd5b5060043610620000935760003560e01c8063715018a61162000062578063715018a6146200010c5780638da5cb5b1462000116578063f2fde38b1462000128578063f3388e75146200013f57600080fd5b8063025b22bc14620000985780631ff2631214620000b15780633e47158c14620000e45780635c60da1b14620000f8575b600080fd5b620000af620000a936600462000570565b62000153565b005b620000c8620000c2366004620005ab565b6200022b565b6040516001600160a01b03909116815260200160405180910390f35b600154620000c8906001600160a01b031681565b600354620000c8906001600160a01b031681565b620000af6200040a565b6000546001600160a01b0316620000c8565b620000af6200013936600462000570565b62000445565b600254620000c8906001600160a01b031681565b6000546001600160a01b03163314620001895760405162461bcd60e51b8152600401620001809062000692565b60405180910390fd5b6001600160a01b038116620001e15760405162461bcd60e51b815260206004820181905260248201527f466163746f72793a20616464726573732073686f756c64206e6f742062652030604482015260640162000180565b600380546001600160a01b0319166001600160a01b0383169081179091556040517f6b70829fcbe4891157f7a7496f9870927de3c8237adbe9cd39bae09b7382c40990600090a250565b600080546001600160a01b03163314620002595760405162461bcd60e51b8152600401620001809062000692565b6000836040516020016200026e9190620006fa565b60408051601f1981840301815290829052805160209091012060035460015460025492945060009385936001600160a01b03938416939283169263f4a2906760e01b92620002c8928d928d929116908c9060240162000746565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051620003079062000537565b620003159392919062000785565b8190604051809103906000f590508015801562000336573d6000803e3d6000fd5b506040519091506001600160a01b038216907fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e90600090a2600254604051600091849184916001600160a01b031690620003909062000545565b6001600160a01b039283168152911660208201526040018190604051809103906000f5905080158015620003c8573d6000803e3d6000fd5b506040519091506001600160a01b038216907f0123400de0e774068ff25080d380ed1e8ad70cfea3c0d28d9ff41f1701ce638d90600090a29695505050505050565b6000546001600160a01b03163314620004375760405162461bcd60e51b8152600401620001809062000692565b620004436000620004e7565b565b6000546001600160a01b03163314620004725760405162461bcd60e51b8152600401620001809062000692565b6001600160a01b038116620004d95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000180565b620004e481620004e7565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f6c80620007bd83390190565b610bb0806200172983390190565b80356001600160a01b03811681146200056b57600080fd5b919050565b6000602082840312156200058357600080fd5b6200058e8262000553565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620005c157600080fd5b833560ff81168114620005d357600080fd5b9250602084013567ffffffffffffffff80821115620005f157600080fd5b818601915086601f8301126200060657600080fd5b8135818111156200061b576200061b62000595565b604051601f8201601f19908116603f0116810190838211818310171562000646576200064662000595565b816040528281528960208487010111156200066057600080fd5b826020860160208301376000602084830101528096505050505050620006896040850162000553565b90509250925092565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60005b83811015620006e4578181015183820152602001620006ca565b83811115620006f4576000848401525b50505050565b600082516200070e818460208701620006c7565b9190910192915050565b6000815180845262000732816020860160208601620006c7565b601f01601f19169290920160200192915050565b60ff8516815260806020820152600062000764608083018662000718565b6001600160a01b039485166040840152929093166060909101529392505050565b6001600160a01b03848116825283166020820152606060408201819052600090620007b39083018462000718565b9594505050505056fe608060405260405162000f6c38038062000f6c83398101604081905262000026916200051f565b82828282816200005860017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005ff565b60008051602062000f258339815191521462000078576200007862000625565b6200008682826000620000ed565b50620000b6905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005ff565b60008051602062000f0583398151915214620000d657620000d662000625565b620000e1826200012a565b5050505050506200068e565b620000f88362000185565b600082511180620001065750805b156200012557620001238383620001c760201b620002601760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f62000155620001f6565b604080516001600160a01b03928316815291841660208301520160405180910390a162000182816200022f565b50565b6200019081620002e4565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001ef838360405180606001604052806027815260200162000f456027913962000387565b9392505050565b60006200022060008051602062000f0583398151915260001b6200046d60201b620002081760201c565b546001600160a01b0316919050565b6001600160a01b0381166200029a5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002c360008051602062000f0583398151915260001b6200046d60201b620002081760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002fa816200047060201b6200028c1760201c565b6200035e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840162000291565b80620002c360008051602062000f2583398151915260001b6200046d60201b620002081760201c565b60606001600160a01b0384163b620003f15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000291565b600080856001600160a01b0316856040516200040e91906200063b565b600060405180830381855af49150503d80600081146200044b576040519150601f19603f3d011682016040523d82523d6000602084013e62000450565b606091505b509092509050620004638282866200047f565b9695505050505050565b90565b6001600160a01b03163b151590565b6060831562000490575081620001ef565b825115620004a15782518084602001fd5b8160405162461bcd60e51b815260040162000291919062000659565b80516001600160a01b0381168114620004d557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200050d578181015183820152602001620004f3565b83811115620001235750506000910152565b6000806000606084860312156200053557600080fd5b6200054084620004bd565b92506200055060208501620004bd565b60408501519092506001600160401b03808211156200056e57600080fd5b818601915086601f8301126200058357600080fd5b815181811115620005985762000598620004da565b604051601f8201601f19908116603f01168101908382118183101715620005c357620005c3620004da565b81604052828152896020848701011115620005dd57600080fd5b620005f0836020830160208801620004f0565b80955050505050509250925092565b6000828210156200062057634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b600082516200064f818460208701620004f0565b9190910192915050565b60208152600082518060208401526200067a816040850160208701620004f0565b601f01601f19169190910160400192915050565b610867806200069e6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106f1565b610118565b61005b61009336600461070c565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106f1565b61020b565b3480156100f557600080fd5b506100ad610235565b61010661029b565b61011661011161033a565b610344565b565b610120610368565b6001600160a01b0316336001600160a01b03161415610157576101548160405180602001604052806000815250600061039b565b50565b6101546100fe565b610167610368565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506001925061039b915050565b505050565b6101c36100fe565b60006101da610368565b6001600160a01b0316336001600160a01b03161415610200576101fb61033a565b905090565b6102086100fe565b90565b610213610368565b6001600160a01b0316336001600160a01b0316141561015757610154816103c6565b600061023f610368565b6001600160a01b0316336001600160a01b03161415610200576101fb610368565b6060610285838360405180606001604052806027815260200161080b6027913961041a565b9392505050565b6001600160a01b03163b151590565b6102a3610368565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb6104f7565b3660008037600080366000845af43d6000803e808015610363573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b6103a48361051f565b6000825111806103b15750805b156101c3576103c08383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103ef610368565b604080516001600160a01b03928316815291841660208301520160405180910390a16101548161055f565b60606001600160a01b0384163b6104825760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610331565b600080856001600160a01b03168560405161049d91906107bb565b600060405180830381855af49150503d80600081146104d8576040519150601f19603f3d011682016040523d82523d6000602084013e6104dd565b606091505b50915091506104ed828286610608565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61038c565b61052881610641565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105c45760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610331565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60608315610617575081610285565b8251156106275782518084602001fd5b8160405162461bcd60e51b815260040161033191906107d7565b6001600160a01b0381163b6106ae5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610331565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105e7565b80356001600160a01b03811681146106ec57600080fd5b919050565b60006020828403121561070357600080fd5b610285826106d5565b60008060006040848603121561072157600080fd5b61072a846106d5565b9250602084013567ffffffffffffffff8082111561074757600080fd5b818601915086601f83011261075b57600080fd5b81358181111561076a57600080fd5b87602082850101111561077c57600080fd5b6020830194508093505050509250925092565b60005b838110156107aa578181015183820152602001610792565b838111156103c05750506000910152565b600082516107cd81846020870161078f565b9190910192915050565b60208152600082518060208401526107f681604085016020870161078f565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212200cb2063c3085e28e5862d77d64be738217c6ce3d218f00ed0b50a063f3592d7064736f6c63430008090033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b50604051610bb0380380610bb083398101604081905261002f916100cf565b61003833610063565b600180546001600160a01b0319166001600160a01b03841617905561005c81610063565b5050610102565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100ca57600080fd5b919050565b600080604083850312156100e257600080fd5b6100eb836100b3565b91506100f9602084016100b3565b90509250929050565b610a9f806101116000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638ac8f3dd11610097578063b5ab58dc11610066578063b5ab58dc146101ff578063b633620c14610212578063f2fde38b14610225578063feaf968c1461023857600080fd5b80638ac8f3dd146101665780638da5cb5b146101915780639a6fc8f5146101a2578063afc4be81146101ec57600080fd5b8063668a0f02116100d3578063668a0f0214610137578063715018a61461013f5780637284e416146101495780638205bf6a1461015e57600080fd5b8063313ce567146100fa57806350d25bcd1461011957806354fd4d501461012f575b600080fd5b610102610240565b60405160ff90911681526020015b60405180910390f35b6101216102c2565b604051908152602001610110565b61012161033f565b610121610384565b6101476103c9565b005b610151610408565b604051610110919061082c565b610121610489565b600154610179906001600160a01b031681565b6040516001600160a01b039091168152602001610110565b6000546001600160a01b0316610179565b6101b56101b0366004610877565b6104ce565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a001610110565b6101476101fa36600461089b565b610570565b61012161020d3660046108c4565b6105bc565b6101216102203660046108c4565b610640565b61014761023336600461089b565b610672565b6101b561070d565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b15801561028557600080fd5b505afa158015610299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102bd91906108dd565b905090565b600154604080516350d25bcd60e01b815290516000926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b15801561030757600080fd5b505afa15801561031b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102bd9190610900565b6001546040805163054fd4d560e41b815290516000926001600160a01b0316916354fd4d50916004808301926020929190829003018186803b15801561030757600080fd5b60015460408051633345078160e11b815290516000926001600160a01b03169163668a0f02916004808301926020929190829003018186803b15801561030757600080fd5b6000546001600160a01b031633146103fc5760405162461bcd60e51b81526004016103f390610919565b60405180910390fd5b61040660006107ac565b565b60015460408051633942720b60e11b815290516060926001600160a01b031691637284e416916004808301926000929190829003018186803b15801561044d57600080fd5b505afa158015610461573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102bd9190810190610964565b60015460408051634102dfb560e11b815290516000926001600160a01b031691638205bf6a916004808301926020929190829003018186803b15801561030757600080fd5b600154604051639a6fc8f560e01b815269ffffffffffffffffffff8316600482015260009182918291829182916001600160a01b031690639a6fc8f59060240160a06040518083038186803b15801561052657600080fd5b505afa15801561053a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055e9190610a11565b939a9299509097509550909350915050565b6000546001600160a01b0316331461059a5760405162461bcd60e51b81526004016103f390610919565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600154604051632d6ad63760e21b8152600481018390526000916001600160a01b03169063b5ab58dc906024015b60206040518083038186803b15801561060257600080fd5b505afa158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a9190610900565b92915050565b600154604051632d8cd88360e21b8152600481018390526000916001600160a01b03169063b633620c906024016105ea565b6000546001600160a01b0316331461069c5760405162461bcd60e51b81526004016103f390610919565b6001600160a01b0381166107015760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f3565b61070a816107ac565b50565b6000806000806000600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561076357600080fd5b505afa158015610777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079b9190610a11565b945094509450945094509091929394565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005b838110156108175781810151838201526020016107ff565b83811115610826576000848401525b50505050565b602081526000825180602084015261084b8160408501602087016107fc565b601f01601f19169190910160400192915050565b69ffffffffffffffffffff8116811461070a57600080fd5b60006020828403121561088957600080fd5b81356108948161085f565b9392505050565b6000602082840312156108ad57600080fd5b81356001600160a01b038116811461089457600080fd5b6000602082840312156108d657600080fd5b5035919050565b6000602082840312156108ef57600080fd5b815160ff8116811461089457600080fd5b60006020828403121561091257600080fd5b5051919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561097657600080fd5b815167ffffffffffffffff8082111561098e57600080fd5b818401915084601f8301126109a257600080fd5b8151818111156109b4576109b461094e565b604051601f8201601f19908116603f011681019083821181831017156109dc576109dc61094e565b816040528281528760208487010111156109f557600080fd5b610a068360208301602088016107fc565b979650505050505050565b600080600080600060a08688031215610a2957600080fd5b8551610a348161085f565b809550506020860151935060408601519250606086015191506080860151610a5b8161085f565b80915050929550929590935056fea26469706673582212201a1e027eceff9f6cfb8283984a0536a90817e44c20341f6087c6e7e64a65faaa64736f6c63430008090033a264697066735822122033687964694528f3f8617c65fa765b89ff5de6ce34504551e8db25cae845233364736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005f7a4c11bde4f218f0025ef444c369d838ffa2ad000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005f7a4c11bde4f218f0025ef444c369d838ffa2ad
-----Decoded View---------------
Arg [0] : admin (address): 0x5F7A4c11bde4f218f0025Ef444c369d838ffa2aD
Arg [1] : timelockWorkers (address[]): 0x5F7A4c11bde4f218f0025Ef444c369d838ffa2aD
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000005f7a4c11bde4f218f0025ef444c369d838ffa2ad
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [3] : 0000000000000000000000005f7a4c11bde4f218f0025ef444c369d838ffa2ad
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.