Address Details
contract
0x3df6Ea625866DF8d0A61408A122c484B98f3184C
- Contract Name
- IdentityV2
- Creator
- 0x5128e3–22e4bb at 0x187120–20e8a5
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 27762742
This contract has been partially verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- IdentityV2
- Optimization enabled
- true
- Compiler version
- v0.8.16+commit.07a7930e
- Optimization runs
- 0
- EVM Version
- london
- Verified at
- 2023-05-10T01:12:58.386222Z
project:/contracts/identity/IdentityV2.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol"; import "../utils/DAOUpgradeableContract.sol"; import "../utils/NameService.sol"; import "../Interfaces.sol"; // import "hardhat/console.sol"; /* @title Identity contract responsible for whitelisting * and keeping track of amount of whitelisted users */ contract IdentityV2 is DAOUpgradeableContract, AccessControlUpgradeable, PausableUpgradeable, EIP712Upgradeable { struct Identity { uint256 dateAuthenticated; uint256 dateAdded; string did; uint256 whitelistedOnChainId; uint8 status; //0 nothing, 1 whitelisted, 2 daocontract, 255 blacklisted } bytes32 public constant IDENTITY_ADMIN_ROLE = keccak256("identity_admin"); bytes32 public constant PAUSER_ROLE = keccak256("pause_admin"); string public constant TYPED_STRUCTURE = "ConnectIdentity(address whitelisted,address connected,uint256 deadline)"; uint256 public whitelistedCount; uint256 public whitelistedContracts; uint256 public authenticationPeriod; mapping(address => Identity) public identities; mapping(bytes32 => address) public didHashToAddress; mapping(address => address) public connectedAccounts; IIdentity public oldIdentity; event BlacklistAdded(address indexed account); event BlacklistRemoved(address indexed account); event WhitelistedAdded(address indexed account); event WhitelistedRemoved(address indexed account); event WhitelistedAuthenticated(address indexed account, uint256 timestamp); event ContractAdded(address indexed account); event ContractRemoved(address indexed account); function initialize( address _owner, IIdentity _oldIdentity ) public initializer { __AccessControl_init_unchained(); __Pausable_init_unchained(); __EIP712_init_unchained("Identity", "1.0.0"); authenticationPeriod = 365 * 3; _setupRole(DEFAULT_ADMIN_ROLE, avatar); _setupRole(DEFAULT_ADMIN_ROLE, _owner); _setupRole(PAUSER_ROLE, avatar); _setupRole(PAUSER_ROLE, _owner); _setupRole(IDENTITY_ADMIN_ROLE, _owner); _setupRole(IDENTITY_ADMIN_ROLE, avatar); oldIdentity = _oldIdentity; } /** * @dev used to initialize after deployment once nameservice is available */ function initDAO(address _ns) external onlyRole(DEFAULT_ADMIN_ROLE) { require(address(nameService) == address(0), "already initialized"); setDAO(INameService(_ns)); _setupRole(DEFAULT_ADMIN_ROLE, avatar); _setupRole(PAUSER_ROLE, avatar); _setupRole(IDENTITY_ADMIN_ROLE, avatar); } modifier onlyWhitelisted() { require(isWhitelisted(msg.sender), "not whitelisted"); _; } /** * @dev Sets a new value for authenticationPeriod. * Can only be called by Identity Administrators. * @param period new value for authenticationPeriod */ function setAuthenticationPeriod(uint256 period) external whenNotPaused { _onlyAvatar(); authenticationPeriod = period; } /** * @dev Sets the authentication date of `account` * to the current time. * Can only be called by Identity Administrators. * @param account address to change its auth date */ function authenticate(address account) public { return authenticateWithTimestamp(account, block.timestamp); } /** * @dev Sets the authentication date of `account` * to the current time. * Can only be called by Identity Administrators. * @param account address to change its auth date * @param timestamp the authentication timestamp */ function authenticateWithTimestamp( address account, uint256 timestamp ) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { require(identities[account].status == 1, "not whitelisted"); identities[account].dateAuthenticated = timestamp; emit WhitelistedAuthenticated(account, timestamp); } /** * @dev Adds an address as whitelisted. * Can only be called by Identity Administrators. * @param account address to add as whitelisted */ function addWhitelisted( address account ) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { _addWhitelisted(account, _chainId()); } /** @dev Adds an address as whitelisted under a specific ID @param account The address to add @param did the ID to add account under */ function addWhitelistedWithDIDAndChain( address account, string memory did, uint256 orgChain, uint256 dateAuthenticated ) external onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { _addWhitelistedWithDID(account, did, orgChain); //in case we are whitelisting on a new chain an already whitelisted account, we need to make sure it expires at the same time if (dateAuthenticated > 0) { identities[account].dateAuthenticated = dateAuthenticated; } } /** * @dev Adds an address as whitelisted under a specific ID * @param account The address to add * @param did the ID to add account under */ function addWhitelistedWithDID( address account, string memory did ) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { _addWhitelistedWithDID(account, did, _chainId()); } /** * @dev Removes an address as whitelisted. * Can only be called by Identity Administrators. * @param account address to remove as whitelisted */ function removeWhitelisted( address account ) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { _removeWhitelisted(account); } /** * @dev Renounces message sender from whitelisted */ function renounceWhitelisted() external whenNotPaused onlyWhitelisted { _removeWhitelisted(msg.sender); } /** * @dev Returns true if given address has been added to whitelist * @param account the address to check * @return a bool indicating weather the address is present in whitelist */ function isWhitelisted(address account) public view returns (bool) { uint256 daysSinceAuthentication = (block.timestamp - identities[account].dateAuthenticated) / 1 days; if ( (daysSinceAuthentication <= authenticationPeriod) && identities[account].status == 1 ) return true; if (address(oldIdentity) != address(0)) { try oldIdentity.isWhitelisted(account) returns (bool res) { return res; } catch { return false; } } return false; } /** * @dev Function that gives the date the given user was added * @param account The address to check * @return The date the address was added */ function lastAuthenticated(address account) external view returns (uint256) { if (identities[account].dateAuthenticated > 0) return identities[account].dateAuthenticated; if (address(oldIdentity) != address(0)) { try oldIdentity.lastAuthenticated(account) returns (uint256 _lastAuth) { return _lastAuth; } catch { return 0; } } return 0; } /** * @dev Adds an address to blacklist. * Can only be called by Identity Administrators. * @param account address to add as blacklisted */ function addBlacklisted( address account ) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { identities[account].status = 255; emit BlacklistAdded(account); } /** * @dev Removes an address from blacklist * Can only be called by Identity Administrators. * @param account address to remove as blacklisted */ function removeBlacklisted( address account ) external onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { if ( address(oldIdentity) != address(0) && oldIdentity.isBlacklisted(account) ) oldIdentity.removeBlacklisted(account); identities[account].status = 0; emit BlacklistRemoved(account); } /** * @dev Function to add a Contract to list of contracts * @param account The address to add */ function addContract( address account ) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { require(isContract(account), "Given address is not a contract"); _addWhitelisted(account, _chainId()); identities[account].status = 2; //this must come after _addWhitelisted emit ContractAdded(account); } /** * @dev Function to remove a Contract from list of contracts * @param account The address to add */ function removeContract( address account ) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused { if ( address(oldIdentity) != address(0) && oldIdentity.isDAOContract(account) ) { oldIdentity.removeContract(account); } _removeWhitelisted(account); emit ContractRemoved(account); } /** * @dev Function to check if given contract is on list of contracts. * @param account to check * @return a bool indicating if address is on list of contracts */ function isDAOContract(address account) external view returns (bool) { if (identities[account].status == 2) return true; if (address(oldIdentity) != address(0)) { try oldIdentity.isDAOContract(account) returns (bool res) { return res; } catch { return false; } } return false; } /** * @dev Internal function to add to whitelisted * @param account the address to add */ function _addWhitelisted(address account, uint256 orgChain) internal { require(identities[account].status == 0, "already has status"); whitelistedCount += 1; identities[account].status = 1; identities[account].dateAdded = block.timestamp; identities[account].dateAuthenticated = block.timestamp; identities[account].whitelistedOnChainId = orgChain; connectedAccounts[account] = address(0); if (isContract(account)) { whitelistedContracts += 1; } emit WhitelistedAdded(account); } /** * @dev Internal whitelisting with did function. * @param account the address to add * @param did the id to register account under */ function _addWhitelistedWithDID( address account, string memory did, uint256 orgChain ) internal { bytes32 pHash = keccak256(bytes(did)); require(didHashToAddress[pHash] == address(0), "DID already registered"); identities[account].did = did; didHashToAddress[pHash] = account; _addWhitelisted(account, orgChain); } /** * @dev Internal function to remove from whitelisted * @param account the address to add */ function _removeWhitelisted(address account) internal { if (identities[account].status == 1 || identities[account].status == 2) { whitelistedCount -= 1; if (isContract(account) && whitelistedContracts > 0) { whitelistedContracts -= 1; } string memory did = identities[account].did; bytes32 pHash = keccak256(bytes(did)); delete identities[account]; delete didHashToAddress[pHash]; emit WhitelistedRemoved(account); } if ( address(oldIdentity) != address(0) && oldIdentity.isWhitelisted(account) ) { oldIdentity.removeWhitelisted(account); } } /// @notice helper function to get current chain id /// @return chainId id function _chainId() internal view returns (uint256 chainId) { assembly { chainId := chainid() } } /** * @dev Returns true if given address has been added to the blacklist * @param account the address to check * @return a bool indicating weather the address is present in the blacklist */ function isBlacklisted(address account) public view returns (bool) { if (identities[account].status == 255) return true; if (address(oldIdentity) != address(0)) { try oldIdentity.isBlacklisted(account) returns (bool res) { return res; } catch { return false; } } return false; } /** * @dev Function to see if given address is a contract * @return true if address is a contract */ function isContract(address _addr) internal view returns (bool) { uint256 length; assembly { length := extcodesize(_addr) } return length > 0; } /** @dev allows user to connect more accounts to his identity. msg.sender needs to be whitelisted @param account the account to connect to msg.sender @param signature the eip712 signed typed data by _account see TYPED_STRUCTURE @param blockDeadline the expiration block of the signature as specified in the typed data */ function connectAccount( address account, bytes memory signature, uint256 blockDeadline ) external onlyWhitelisted { require( blockDeadline > 0 && blockDeadline >= block.number, "invalid deadline" ); require( !isWhitelisted(account) && !isBlacklisted(account), "invalid account" ); require(connectedAccounts[account] == address(0x0), "already connected"); bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( keccak256(bytes(TYPED_STRUCTURE)), msg.sender, account, blockDeadline ) ) ); //signature ensures the whitelisted (msg.sender) has submited a signature by connected account //that connects both accounts require( SignatureCheckerUpgradeable.isValidSignatureNow( account, digest, signature ), "invalid signature" ); connectedAccounts[account] = msg.sender; } /** @dev disconnect a connected account from identity. can be performed either by identity or the connected account @param connected the account to disconnect */ function disconnectAccount(address connected) external { require( connectedAccounts[connected] == msg.sender || msg.sender == connected, "unauthorized" ); delete connectedAccounts[connected]; } /** @dev returns the identity in case account is connected or is the identity itself otherwise returns the empty address @param account address to get its identity @return whitelisted the identity or address 0 if _account not connected or not identity **/ function getWhitelistedRoot( address account ) external view returns (address whitelisted) { if (isWhitelisted(account)) return account; if (isWhitelisted(connectedAccounts[account])) return connectedAccounts[account]; return address(0x0); } function pause(bool toPause) external onlyRole(PAUSER_ROLE) { if (toPause) _pause(); else _unpause(); } /** @dev modify account did can be called by account owner or identity admin @param account the account to modify @param did the did to set */ function setDID(address account, string calldata did) external { require( msg.sender == account || hasRole(IDENTITY_ADMIN_ROLE, msg.sender), "not authorized" ); _setDID(account, did); } function _setDID(address account, string memory did) internal { require(isWhitelisted(account), "not whitelisted"); require(bytes(did).length > 0, "did empty"); bytes32 pHash = keccak256(bytes(did)); require(didHashToAddress[pHash] == address(0), "DID already registered"); if (address(oldIdentity) != address(0)) { address oldDIDOwner; try oldIdentity.didHashToAddress(pHash) returns (address _didOwner) { oldDIDOwner = _didOwner; } catch {} //if owner not the same and doesnt have a new did set then revert require( oldDIDOwner == address(0) || oldDIDOwner == account || bytes(identities[oldDIDOwner].did).length > 0, "DID already registered oldIdentity" ); } bytes32 oldHash = keccak256(bytes(identities[account].did)); delete didHashToAddress[oldHash]; identities[account].did = did; didHashToAddress[pHash] = account; } /** @dev for backward compatability with V1 @param account to get DID for @return did of the account */ function addrToDID( address account ) external view returns (string memory did) { did = identities[account].did; bytes32 pHash = keccak256(bytes(did)); //if did was set in this contract return it, otherwise check oldidentity if (didHashToAddress[pHash] == account) return did; if (address(oldIdentity) != address(0)) { try oldIdentity.addrToDID(account) returns (string memory _did) { return _did; } catch { return ""; } } return ""; } function getWhitelistedOnChainId( address account ) external view returns (uint256 chainId) { chainId = identities[account].whitelistedOnChainId; return chainId > 0 ? chainId : _chainId(); } /** * backward compatability with IdentityV1 that GoodDollar token checks if the identity contract is registered */ function isRegistered() external pure returns (bool) { return true; } }
/_openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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); _; } /** * @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 `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(account), " 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. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @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; }
/_openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface 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; }
/_openzeppelin/contracts-upgradeable/interfaces/IERC1271Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271Upgradeable { /** * @dev Should return whether the signature provided is valid for the provided data * @param hash Hash of the data to be signed * @param signature Signature byte array associated with _data */ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
/_openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol
// 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 IERC1822ProxiableUpgradeable { /** * @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); }
/_openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.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 ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // 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 StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.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) { _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 (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(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 StorageSlotUpgradeable.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"); StorageSlotUpgradeable.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 StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.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) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @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; }
/_openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol
// 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 IBeaconUpgradeable { /** * @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); }
/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; 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. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * 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 prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
/_openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * 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. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @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; }
/_openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @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; }
/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
/_openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// 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; }
/_openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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 StorageSlotUpgradeable { 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) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
/_openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
/_openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
/_openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.0; import "./ECDSAUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ * * @custom:storage-size 52 */ abstract contract EIP712Upgradeable is Initializable { /* solhint-disable var-name-mixedcase */ bytes32 private _HASHED_NAME; bytes32 private _HASHED_VERSION; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash()); } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712VersionHash() internal virtual view returns (bytes32) { return _HASHED_VERSION; } /** * @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; }
/_openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/SignatureChecker.sol) pragma solidity ^0.8.0; import "./ECDSAUpgradeable.sol"; import "../AddressUpgradeable.sol"; import "../../interfaces/IERC1271Upgradeable.sol"; /** * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like * Argent and Gnosis Safe. * * _Available since v4.1._ */ library SignatureCheckerUpgradeable { /** * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. * * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ function isValidSignatureNow( address signer, bytes32 hash, bytes memory signature ) internal view returns (bool) { (address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature); if (error == ECDSAUpgradeable.RecoverError.NoError && recovered == signer) { return true; } (bool success, bytes memory result) = signer.staticcall( abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature) ); return (success && result.length == 32 && abi.decode(result, (bytes32)) == bytes32(IERC1271Upgradeable.isValidSignature.selector)); } }
/_openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol
// 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; }
/_openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface 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); }
/_openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
/project_/contracts/DAOStackInterfaces.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface Avatar { function nativeToken() external view returns (address); function nativeReputation() external view returns (address); function owner() external view returns (address); } interface Controller { event RegisterScheme(address indexed _sender, address indexed _scheme); event UnregisterScheme(address indexed _sender, address indexed _scheme); function genericCall( address _contract, bytes calldata _data, address _avatar, uint256 _value ) external returns (bool, bytes memory); function avatar() external view returns (address); function unregisterScheme(address _scheme, address _avatar) external returns (bool); function unregisterSelf(address _avatar) external returns (bool); function registerScheme( address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar ) external returns (bool); function isSchemeRegistered(address _scheme, address _avatar) external view returns (bool); function getSchemePermissions(address _scheme, address _avatar) external view returns (bytes4); function addGlobalConstraint( address _constraint, bytes32 _paramHash, address _avatar ) external returns (bool); function mintTokens( uint256 _amount, address _beneficiary, address _avatar ) external returns (bool); function externalTokenTransfer( address _token, address _recipient, uint256 _amount, address _avatar ) external returns (bool); function sendEther( uint256 _amountInWei, address payable _to, address _avatar ) external returns (bool); } interface GlobalConstraintInterface { enum CallPhase { Pre, Post, PreAndPost } function pre( address _scheme, bytes32 _params, bytes32 _method ) external returns (bool); /** * @dev when return if this globalConstraints is pre, post or both. * @return CallPhase enum indication Pre, Post or PreAndPost. */ function when() external returns (CallPhase); } interface ReputationInterface { function balanceOf(address _user) external view returns (uint256); function balanceOfAt(address _user, uint256 _blockNumber) external view returns (uint256); function getVotes(address _user) external view returns (uint256); function getVotesAt( address _user, bool _global, uint256 _blockNumber ) external view returns (uint256); function totalSupply() external view returns (uint256); function totalSupplyAt(uint256 _blockNumber) external view returns (uint256); function delegateOf(address _user) external returns (address); } interface SchemeRegistrar { function proposeScheme( Avatar _avatar, address _scheme, bytes32 _parametersHash, bytes4 _permissions, string memory _descriptionHash ) external returns (bytes32); event NewSchemeProposal( address indexed _avatar, bytes32 indexed _proposalId, address indexed _intVoteInterface, address _scheme, bytes32 _parametersHash, bytes4 _permissions, string _descriptionHash ); } interface IntVoteInterface { event NewProposal( bytes32 indexed _proposalId, address indexed _organization, uint256 _numOfChoices, address _proposer, bytes32 _paramsHash ); event ExecuteProposal( bytes32 indexed _proposalId, address indexed _organization, uint256 _decision, uint256 _totalReputation ); event VoteProposal( bytes32 indexed _proposalId, address indexed _organization, address indexed _voter, uint256 _vote, uint256 _reputation ); event CancelProposal( bytes32 indexed _proposalId, address indexed _organization ); event CancelVoting( bytes32 indexed _proposalId, address indexed _organization, address indexed _voter ); /** * @dev register a new proposal with the given parameters. Every proposal has a unique ID which is being * generated by calculating keccak256 of a incremented counter. * @param _numOfChoices number of voting choices * @param _proposalParameters defines the parameters of the voting machine used for this proposal * @param _proposer address * @param _organization address - if this address is zero the msg.sender will be used as the organization address. * @return proposal's id. */ function propose( uint256 _numOfChoices, bytes32 _proposalParameters, address _proposer, address _organization ) external returns (bytes32); function vote( bytes32 _proposalId, uint256 _vote, uint256 _rep, address _voter ) external returns (bool); function cancelVote(bytes32 _proposalId) external; function getNumberOfChoices(bytes32 _proposalId) external view returns (uint256); function isVotable(bytes32 _proposalId) external view returns (bool); /** * @dev voteStatus returns the reputation voted for a proposal for a specific voting choice. * @param _proposalId the ID of the proposal * @param _choice the index in the * @return voted reputation for the given choice */ function voteStatus(bytes32 _proposalId, uint256 _choice) external view returns (uint256); /** * @dev isAbstainAllow returns if the voting machine allow abstain (0) * @return bool true or false */ function isAbstainAllow() external pure returns (bool); /** * @dev getAllowedRangeOfChoices returns the allowed range of choices for a voting machine. * @return min - minimum number of choices max - maximum number of choices */ function getAllowedRangeOfChoices() external pure returns (uint256 min, uint256 max); }
/project_/contracts/Interfaces.sol
// SPDX-License-Identifier: MIT import { DataTypes } from "./utils/DataTypes.sol"; pragma solidity >=0.8.0; pragma experimental ABIEncoderV2; interface ERC20 { function balanceOf(address addr) external view returns (uint256); function transfer(address to, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function decimals() external view returns (uint8); function mint(address to, uint256 mintAmount) external returns (uint256); function burn(uint256 amount) external; function totalSupply() external view returns (uint256); function allowance( address owner, address spender ) external view returns (uint256); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); function name() external view returns (string memory); function symbol() external view returns (string memory); event Transfer(address indexed from, address indexed to, uint256 amount); event Transfer( address indexed from, address indexed to, uint256 amount, bytes data ); } interface cERC20 is ERC20 { function mint(uint256 mintAmount) external returns (uint256); function redeemUnderlying(uint256 mintAmount) external returns (uint256); function redeem(uint256 mintAmount) external returns (uint256); function exchangeRateCurrent() external returns (uint256); function exchangeRateStored() external view returns (uint256); function underlying() external returns (address); } interface IGoodDollar is ERC20 { // view functions function feeRecipient() external view returns (address); function getFees( uint256 value, address sender, address recipient ) external view returns (uint256 fee, bool senderPays); function cap() external view returns (uint256); function isPauser(address _pauser) external view returns (bool); function getFees(uint256 value) external view returns (uint256, bool); function isMinter(address minter) external view returns (bool); function formula() external view returns (address); function identity() external view returns (address); function owner() external view returns (address); // state changing functions function setFeeRecipient(address _feeRecipient) external; function setFormula(address _formula) external; function transferOwnership(address _owner) external; function addPauser(address _pauser) external; function pause() external; function unpause() external; function burn(uint256 amount) external; function burnFrom(address account, uint256 amount) external; function renounceMinter() external; function addMinter(address minter) external; function transferAndCall( address to, uint256 value, bytes calldata data ) external returns (bool); function setIdentity(address identity) external; } interface IERC2917 is ERC20 { /// @dev This emit when interests amount per block is changed by the owner of the contract. /// It emits with the old interests amount and the new interests amount. event InterestRatePerBlockChanged(uint256 oldValue, uint256 newValue); /// @dev This emit when a users' productivity has changed /// It emits with the user's address and the the value after the change. event ProductivityIncreased(address indexed user, uint256 value); /// @dev This emit when a users' productivity has changed /// It emits with the user's address and the the value after the change. event ProductivityDecreased(address indexed user, uint256 value); /// @dev Return the current contract's interests rate per block. /// @return The amount of interests currently producing per each block. function interestsPerBlock() external view returns (uint256); /// @notice Change the current contract's interests rate. /// @dev Note the best practice will be restrict the gross product provider's contract address to call this. /// @return The true/fase to notice that the value has successfully changed or not, when it succeed, it will emite the InterestRatePerBlockChanged event. function changeInterestRatePerBlock(uint256 value) external returns (bool); /// @notice It will get the productivity of given user. /// @dev it will return 0 if user has no productivity proved in the contract. /// @return user's productivity and overall productivity. function getProductivity( address user ) external view returns (uint256, uint256); /// @notice increase a user's productivity. /// @dev Note the best practice will be restrict the callee to prove of productivity's contract address. /// @return true to confirm that the productivity added success. function increaseProductivity( address user, uint256 value ) external returns (bool); /// @notice decrease a user's productivity. /// @dev Note the best practice will be restrict the callee to prove of productivity's contract address. /// @return true to confirm that the productivity removed success. function decreaseProductivity( address user, uint256 value ) external returns (bool); /// @notice take() will return the interests that callee will get at current block height. /// @dev it will always calculated by block.number, so it will change when block height changes. /// @return amount of the interests that user are able to mint() at current block height. function take() external view returns (uint256); /// @notice similar to take(), but with the block height joined to calculate return. /// @dev for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests. /// @return amount of interests and the block height. function takeWithBlock() external view returns (uint256, uint256); /// @notice mint the avaiable interests to callee. /// @dev once it mint, the amount of interests will transfer to callee's address. /// @return the amount of interests minted. function mint() external returns (uint256); } interface Staking { struct Staker { // The staked DAI amount uint256 stakedDAI; // The latest block number which the // staker has staked tokens uint256 lastStake; } function stakeDAI(uint256 amount) external; function withdrawStake() external; function stakers(address staker) external view returns (Staker memory); } interface Uniswap { function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function WETH() external pure returns (address); function factory() external pure returns (address); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountOut( uint256 amountI, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountsOut( uint256 amountIn, address[] memory path ) external pure returns (uint256[] memory amounts); } interface UniswapFactory { function getPair( address tokenA, address tokenB ) external view returns (address); } interface UniswapPair { function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function kLast() external view returns (uint256); function token0() external view returns (address); function token1() external view returns (address); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); } interface Reserve { function buy( address _buyWith, uint256 _tokenAmount, uint256 _minReturn ) external returns (uint256); } interface IIdentity { function isWhitelisted(address user) external view returns (bool); function addWhitelistedWithDID(address account, string memory did) external; function removeWhitelisted(address account) external; function addBlacklisted(address account) external; function removeBlacklisted(address account) external; function isBlacklisted(address user) external view returns (bool); function addIdentityAdmin(address account) external returns (bool); function setAvatar(address _avatar) external; function isIdentityAdmin(address account) external view returns (bool); function owner() external view returns (address); function removeContract(address account) external; function isDAOContract(address account) external view returns (bool); function addrToDID(address account) external view returns (string memory); function didHashToAddress(bytes32 hash) external view returns (address); function lastAuthenticated(address account) external view returns (uint256); event WhitelistedAdded(address user); } interface IIdentityV2 is IIdentity { function addWhitelistedWithDIDAndChain( address account, string memory did, uint256 orgChainId, uint256 dateAuthenticated ) external; function getWhitelistedRoot( address account ) external view returns (address root); } interface IUBIScheme { function currentDay() external view returns (uint256); function periodStart() external view returns (uint256); function hasClaimed(address claimer) external view returns (bool); } interface IFirstClaimPool { function awardUser(address user) external returns (uint256); function claimAmount() external view returns (uint256); function end() external; } interface ProxyAdmin { function getProxyImplementation( address proxy ) external view returns (address); function getProxyAdmin(address proxy) external view returns (address); function upgrade(address proxy, address implementation) external; function owner() external view returns (address); function transferOwnership(address newOwner) external; function upgradeAndCall( address proxy, address implementation, bytes memory data ) external; } /** * @dev Interface for chainlink oracles to obtain price datas */ interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // 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 latestAnswer() external view returns (int256); } /** @dev interface for AAVE lending Pool */ interface ILendingPool { /** * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens. * - E.g. User deposits 100 USDC and gets in return 100 aUSDC * @param asset The address of the underlying asset to deposit * @param amount The amount to be deposited * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user * wants to receive them on his own wallet, or a different address if the beneficiary of aTokens * is a different wallet * @param referralCode Code used to register the integrator originating the operation, for potential rewards. * 0 if the action is executed directly by the user, without any middle-man **/ function deposit( address asset, uint256 amount, address onBehalfOf, uint16 referralCode ) external; /** * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC * @param asset The address of the underlying asset to withdraw * @param amount The underlying amount to be withdrawn * - Send the value type(uint256).max in order to withdraw the whole aToken balance * @param to Address that will receive the underlying, same as msg.sender if the user * wants to receive it on his own wallet, or a different address if the beneficiary is a * different wallet * @return The final amount withdrawn **/ function withdraw( address asset, uint256 amount, address to ) external returns (uint256); /** * @dev Returns the state and configuration of the reserve * @param asset The address of the underlying asset of the reserve * @return The state of the reserve **/ function getReserveData( address asset ) external view returns (DataTypes.ReserveData memory); } interface IDonationStaking { function stakeDonations() external payable; } interface INameService { function getAddress(string memory _name) external view returns (address); } interface IAaveIncentivesController { /** * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards * @param amount Amount of rewards to claim * @param to Address that will be receiving the rewards * @return Rewards claimed **/ function claimRewards( address[] calldata assets, uint256 amount, address to ) external returns (uint256); /** * @dev Returns the total of rewards of an user, already accrued + not yet accrued * @param user The address of the user * @return The rewards **/ function getRewardsBalance( address[] calldata assets, address user ) external view returns (uint256); } interface IGoodStaking { function collectUBIInterest( address recipient ) external returns (uint256, uint256, uint256); function iToken() external view returns (address); function currentGains( bool _returnTokenBalanceInUSD, bool _returnTokenGainsInUSD ) external view returns (uint256, uint256, uint256, uint256, uint256); function getRewardEarned(address user) external view returns (uint256); function getGasCostForInterestTransfer() external view returns (uint256); function rewardsMinted( address user, uint256 rewardsPerBlock, uint256 blockStart, uint256 blockEnd ) external returns (uint256); } interface IHasRouter { function getRouter() external view returns (Uniswap); } interface IAdminWallet { function addAdmins(address payable[] memory _admins) external; function removeAdmins(address[] memory _admins) external; function owner() external view returns (address); function transferOwnership(address _owner) external; } interface IMultichainRouter { // Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to` function anySwapOut( address token, address to, uint256 amount, uint256 toChainID ) external; // Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to` function anySwapOutUnderlying( address token, address to, uint256 amount, uint256 toChainID ) external; }
/project_/contracts/utils/DAOContract.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "../DAOStackInterfaces.sol"; import "../Interfaces.sol"; /** @title Simple contract that keeps DAO contracts registery */ contract DAOContract { Controller public dao; address public avatar; INameService public nameService; function _onlyAvatar() internal view { require( address(dao.avatar()) == msg.sender, "only avatar can call this method" ); } function setDAO(INameService _ns) internal { nameService = _ns; updateAvatar(); } function updateAvatar() public { dao = Controller(nameService.getAddress("CONTROLLER")); avatar = dao.avatar(); } function nativeToken() public view returns (IGoodDollar) { return IGoodDollar(nameService.getAddress("GOODDOLLAR")); } uint256[50] private gap; }
/project_/contracts/utils/DAOUpgradeableContract.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./DAOContract.sol"; /** @title Simple contract that adds upgradability to DAOContract */ contract DAOUpgradeableContract is Initializable, UUPSUpgradeable, DAOContract { function _authorizeUpgrade(address) internal virtual override { _onlyAvatar(); } }
/project_/contracts/utils/DataTypes.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; library DataTypes { // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties. struct ReserveData { //stores the reserve configuration ReserveConfigurationMap configuration; //the liquidity index. Expressed in ray uint128 liquidityIndex; //variable borrow index. Expressed in ray uint128 variableBorrowIndex; //the current supply rate. Expressed in ray uint128 currentLiquidityRate; //the current variable borrow rate. Expressed in ray uint128 currentVariableBorrowRate; //the current stable borrow rate. Expressed in ray uint128 currentStableBorrowRate; uint40 lastUpdateTimestamp; //tokens addresses address aTokenAddress; address stableDebtTokenAddress; address variableDebtTokenAddress; //address of the interest rate strategy address interestRateStrategyAddress; //the id of the reserve. Represents the position in the list of the active reserves uint8 id; } struct ReserveConfigurationMap { //bit 0-15: LTV //bit 16-31: Liq. threshold //bit 32-47: Liq. bonus //bit 48-55: Decimals //bit 56: Reserve is active //bit 57: reserve is frozen //bit 58: borrowing is enabled //bit 59: stable rate borrowing enabled //bit 60-63: reserved //bit 64-79: reserve factor uint256 data; } enum InterestRateMode { NONE, STABLE, VARIABLE } }
/project_/contracts/utils/NameService.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "../DAOStackInterfaces.sol"; /** @title Simple name to address resolver */ contract NameService is Initializable, UUPSUpgradeable { mapping(bytes32 => address) public addresses; Controller public dao; event AddressChanged(string name ,address addr); function initialize( Controller _dao, bytes32[] memory _nameHashes, address[] memory _addresses ) public virtual initializer { dao = _dao; for (uint256 i = 0; i < _nameHashes.length; i++) { addresses[_nameHashes[i]] = _addresses[i]; } addresses[keccak256(bytes("CONTROLLER"))] = address(_dao); addresses[keccak256(bytes("AVATAR"))] = address(_dao.avatar()); } function _authorizeUpgrade(address) internal override { _onlyAvatar(); } function _onlyAvatar() internal view { require( address(dao.avatar()) == msg.sender, "only avatar can call this method" ); } function setAddress(string memory name, address addr) external { _onlyAvatar(); addresses[keccak256(bytes(name))] = addr; emit AddressChanged(name, addr); } function setAddresses(bytes32[] calldata hash, address[] calldata addrs) external { _onlyAvatar(); for (uint256 i = 0; i < hash.length; i++) { addresses[hash[i]] = addrs[i]; } } function getAddress(string memory name) external view returns (address) { return addresses[keccak256(bytes(name))]; } }
Contract ABI
[{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BlacklistAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BlacklistRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ContractAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ContractRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"WhitelistedAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"WhitelistedAuthenticated","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WhitelistedRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"IDENTITY_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"PAUSER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"TYPED_STRUCTURE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addBlacklisted","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addContract","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addWhitelisted","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addWhitelistedWithDID","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"string","name":"did","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addWhitelistedWithDIDAndChain","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"string","name":"did","internalType":"string"},{"type":"uint256","name":"orgChain","internalType":"uint256"},{"type":"uint256","name":"dateAuthenticated","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"did","internalType":"string"}],"name":"addrToDID","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"authenticate","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"authenticateWithTimestamp","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"authenticationPeriod","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"avatar","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"connectAccount","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"uint256","name":"blockDeadline","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"connectedAccounts","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract Controller"}],"name":"dao","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"didHashToAddress","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disconnectAccount","inputs":[{"type":"address","name":"connected","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"chainId","internalType":"uint256"}],"name":"getWhitelistedOnChainId","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"whitelisted","internalType":"address"}],"name":"getWhitelistedRoot","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"dateAuthenticated","internalType":"uint256"},{"type":"uint256","name":"dateAdded","internalType":"uint256"},{"type":"string","name":"did","internalType":"string"},{"type":"uint256","name":"whitelistedOnChainId","internalType":"uint256"},{"type":"uint8","name":"status","internalType":"uint8"}],"name":"identities","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initDAO","inputs":[{"type":"address","name":"_ns","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_owner","internalType":"address"},{"type":"address","name":"_oldIdentity","internalType":"contract IIdentity"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isBlacklisted","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isDAOContract","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isRegistered","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isWhitelisted","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastAuthenticated","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract INameService"}],"name":"nameService","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IGoodDollar"}],"name":"nativeToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IIdentity"}],"name":"oldIdentity","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[{"type":"bool","name":"toPause","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeBlacklisted","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeContract","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeWhitelisted","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceWhitelisted","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAuthenticationPeriod","inputs":[{"type":"uint256","name":"period","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDID","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"string","name":"did","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateAvatar","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"whitelistedContracts","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"whitelistedCount","inputs":[]}]
Contract Creation Code
0x60a06040523060805234801561001457600080fd5b50608051613e5361004c60003960008181610d6c01528181610dac015281816111fd0152818161123d01526112b50152613e536000f3fe60806040526004361061024f5760003560e01c806301ffc9a71461025457806302329a291461028957806308e0d29d146102ab57806310154bad146102cb578063188efc16146102eb5780631aaff63c1461030b5780631b0270991461033b5780631b3c90a81461035b5780632236684414610370578063248a9ca314610384578063291d9549146103a45780632b14dda8146103c45780632cec5330146103e45780632d0e9b46146104065780632f2ff15d1461043357806331b376e21461045357806336568abe1461046a5780633659cfe61461048a57806337a1a987146104aa5780633af32abf146104ca5780633e6326fc146104ea5780634125f0f21461050a5780634162169f1461052b578063485cc9551461054b5780634f1ef2861461056b57806352d1902d1461057e57806354f9f7a3146105935780635aef7de6146105b35780635c975abb146105d35780635f539d69146105ec578063613200401461060c57806367c759371461064357806391d148541461067a57806393ce7f001461069a57806396a1ef79146106ba578063a061922d146106da578063a217fddf146106fa578063b2a1de221461070f578063b30f7e7f14610726578063c375c2ef1461073d578063c6a276c21461075d578063c73cc4ae1461077d578063d32628161461079d578063d547741f146107bd578063d6cd9473146107dd578063e1758bd8146107f2578063e1e360ba14610807578063e63ab1e914610827578063e737031a14610849578063f653b81e14610869578063fe575a871461089a578063fff930d4146108ba575b600080fd5b34801561026057600080fd5b5061027461026f366004613406565b6108da565b60405190151581526020015b60405180910390f35b34801561029557600080fd5b506102a96102a436600461343e565b610911565b005b3480156102b757600080fd5b506102a96102c6366004613470565b610943565b3480156102d757600080fd5b506102a96102e6366004613470565b610950565b3480156102f757600080fd5b506102a9610306366004613470565b61097a565b34801561031757600080fd5b5061032d600080516020613d3083398151915281565b604051908152602001610280565b34801561034757600080fd5b506102a9610356366004613550565b6109eb565b34801561036757600080fd5b506102a9610a1b565b34801561037c57600080fd5b506001610274565b34801561039057600080fd5b5061032d61039f36600461359f565b610b42565b3480156103b057600080fd5b506102a96103bf366004613470565b610b57565b3480156103d057600080fd5b506102a96103df366004613470565b610b80565b3480156103f057600080fd5b506103f9610c4a565b6040516102809190613608565b34801561041257600080fd5b50610426610421366004613470565b610c66565b604051610280919061361b565b34801561043f57600080fd5b506102a961044e36600461362f565b610ccc565b34801561045f57600080fd5b5061032d6101985481565b34801561047657600080fd5b506102a961048536600461362f565b610ce8565b34801561049657600080fd5b506102a96104a5366004613470565b610d62565b3480156104b657600080fd5b506102a96104c5366004613470565b610e27565b3480156104d657600080fd5b506102746104e5366004613470565b610ebb565b3480156104f657600080fd5b50606754610426906001600160a01b031681565b34801561051657600080fd5b5061019c54610426906001600160a01b031681565b34801561053757600080fd5b50606554610426906001600160a01b031681565b34801561055757600080fd5b506102a961056636600461365f565b610fcb565b6102a9610579366004613550565b6111f3565b34801561058a57600080fd5b5061032d6112a8565b34801561059f57600080fd5b506103f96105ae366004613470565b611356565b3480156105bf57600080fd5b50606654610426906001600160a01b031681565b3480156105df57600080fd5b506101305460ff16610274565b3480156105f857600080fd5b506102a9610607366004613470565b6114ea565b34801561061857600080fd5b50610426610627366004613470565b61019b602052600090815260409020546001600160a01b031681565b34801561064f57600080fd5b5061042661065e36600461359f565b61019a602052600090815260409020546001600160a01b031681565b34801561068657600080fd5b5061027461069536600461362f565b6115b3565b3480156106a657600080fd5b506102a96106b536600461368d565b6115de565b3480156106c657600080fd5b506102a96106d53660046136e5565b6117ed565b3480156106e657600080fd5b5061032d6106f5366004613470565b6118a7565b34801561070657600080fd5b5061032d600081565b34801561071b57600080fd5b5061032d6101965481565b34801561073257600080fd5b5061032d6101975481565b34801561074957600080fd5b506102a9610758366004613470565b6118d4565b34801561076957600080fd5b506102a9610778366004613470565b611a26565b34801561078957600080fd5b50610274610798366004613470565b611b85565b3480156107a957600080fd5b506102a96107b8366004613711565b611c3c565b3480156107c957600080fd5b506102a96107d836600461362f565b611ce3565b3480156107e957600080fd5b506102a9611cff565b3480156107fe57600080fd5b50610426611d37565b34801561081357600080fd5b5061032d610822366004613470565b611dc4565b34801561083357600080fd5b5061032d600080516020613d7083398151915281565b34801561085557600080fd5b506102a9610864366004613795565b611e79565b34801561087557600080fd5b50610889610884366004613470565b611ece565b6040516102809594939291906137f4565b3480156108a657600080fd5b506102746108b5366004613470565b611f8a565b3480156108c657600080fd5b506102a96108d536600461359f565b611ffd565b60006001600160e01b03198216637965db0b60e01b148061090b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020613d7083398151915261092981612013565b811561093b5761093761201d565b5050565b610937612072565b61094d81426117ed565b50565b600080516020613d3083398151915261096881612013565b6109706120ac565b61093782466120f3565b600080516020613d3083398151915261099281612013565b61099a6120ac565b6001600160a01b03821660008181526101996020526040808220600401805460ff191660ff179055517f44d5fe68b00f68950fb9c1ff0a61ef7f747b1a36359a7e3a7f3324db4b8789679190a25050565b600080516020613d30833981519152610a0381612013565b610a0b6120ac565b610a16838346612222565b505050565b60675460405163bf40fac160e01b815260206004820152600a60248201526921a7a72a2927a62622a960b11b60448201526001600160a01b039091169063bf40fac190606401602060405180830381865afa158015610a7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa2919061382e565b606580546001600160a01b0319166001600160a01b0392909216918217905560408051632d77bef360e11b81529051635aef7de6916004808201926020929091908290030181865afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b20919061382e565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260fe602052604090206001015490565b600080516020613d30833981519152610b6f81612013565b610b776120ac565b610937826122c3565b6000610b8b81612013565b6067546001600160a01b031615610bdf5760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064015b60405180910390fd5b610be882612598565b606654610c00906000906001600160a01b03166125bb565b606654610c2590600080516020613d70833981519152906001600160a01b03166125bb565b60665461093790600080516020613d30833981519152906001600160a01b03166125bb565b604051806080016040528060478152602001613db06047913981565b6000610c7182610ebb565b15610c7a575090565b6001600160a01b03808316600090815261019b6020526040902054610c9f9116610ebb565b15610cc457506001600160a01b03908116600090815261019b60205260409020541690565b506000919050565b610cd582610b42565b610cde81612013565b610a1683836125c1565b6001600160a01b0381163314610d585760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bd6565b6109378282612647565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610daa5760405162461bcd60e51b8152600401610bd69061384b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610ddc6126ae565b6001600160a01b031614610e025760405162461bcd60e51b8152600401610bd690613885565b610e0b816126ca565b6040805160008082526020820190925261094d918391906126d2565b6001600160a01b03818116600090815261019b602052604090205416331480610e585750336001600160a01b038216145b610e935760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b6044820152606401610bd6565b6001600160a01b0316600090815261019b6020526040902080546001600160a01b0319169055565b6001600160a01b0381166000908152610199602052604081205481906201518090610ee690426138d5565b610ef091906138e8565b9050610198548111158015610f2457506001600160a01b0383166000908152610199602052604090206004015460ff166001145b15610f325750600192915050565b61019c546001600160a01b031615610fc25761019c54604051633af32abf60e01b81526001600160a01b0390911690633af32abf90610f7590869060040161361b565b602060405180830381865afa925050508015610fae575060408051601f3d908101601f19168201909252610fab9181019061390a565b60015b610fbb5750600092915050565b9392505050565b50600092915050565b600054610100900460ff1615808015610feb5750600054600160ff909116105b8061100c5750610ffa3061283d565b15801561100c575060005460ff166001145b61106f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bd6565b6000805460ff191660011790558015611092576000805461ff0019166101001790555b61109a61284c565b6110a2612873565b6110e9604051806040016040528060088152602001674964656e7469747960c01b815250604051806040016040528060058152602001640312e302e360dc1b8152506128a7565b61044761019855606654611108906000906001600160a01b03166125bb565b6111136000846125bb565b60665461113890600080516020613d70833981519152906001600160a01b03166125bb565b611150600080516020613d70833981519152846125bb565b611168600080516020613d30833981519152846125bb565b60665461118d90600080516020613d30833981519152906001600160a01b03166125bb565b61019c80546001600160a01b0319166001600160a01b0384161790558015610a16576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361123b5760405162461bcd60e51b8152600401610bd69061384b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661126d6126ae565b6001600160a01b0316146112935760405162461bcd60e51b8152600401610bd690613885565b61129c826126ca565b610937828260016126d2565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146113435760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610bd6565b50600080516020613d9083398151915290565b6001600160a01b03811660009081526101996020526040902060020180546060919061138190613927565b80601f01602080910402602001604051908101604052809291908181526020018280546113ad90613927565b80156113fa5780601f106113cf576101008083540402835291602001916113fa565b820191906000526020600020905b8154815290600101906020018083116113dd57829003601f168201915b50508351602080860191909120600081815261019a909252604090912054949550936001600160a01b0380881691160392506114399150505750919050565b61019c546001600160a01b0316156114d45761019c546040516354f9f7a360e01b81526001600160a01b03909116906354f9f7a39061147c90869060040161361b565b600060405180830381865afa9250505080156114ba57506040513d6000823e601f3d908101601f191682016040526114b79190810190613961565b60015b610fbb575050604080516020810190915260008152919050565b5050604080516020810190915260008152919050565b600080516020613d3083398151915261150281612013565b61150a6120ac565b813b6115585760405162461bcd60e51b815260206004820152601f60248201527f476976656e2061646472657373206973206e6f74206120636f6e7472616374006044820152606401610bd6565b61156282466120f3565b6001600160a01b03821660008181526101996020526040808220600401805460ff19166002179055517f89c66952b48f3e96bf1d8ba1b63189520fd988a6979b8b740bd5c5d8dc53e2059190a25050565b600091825260fe602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6115e733610ebb565b6116035760405162461bcd60e51b8152600401610bd6906139ce565b6000811180156116135750438110155b6116525760405162461bcd60e51b815260206004820152601060248201526f696e76616c696420646561646c696e6560801b6044820152606401610bd6565b61165b83610ebb565b15801561166e575061166c83611f8a565b155b6116ac5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081858d8dbdd5b9d608a1b6044820152606401610bd6565b6001600160a01b03838116600090815261019b602052604090205416156117095760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4818dbdb9b9958dd1959607a1b6044820152606401610bd6565b6000611773604051806080016040528060478152602001613db0604791398051602091820120604080519283019190915233908201526001600160a01b03861660608201526080810184905260a001604051602081830303815290604052805190602001206128ea565b9050611780848285612938565b6117c05760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606401610bd6565b5050506001600160a01b0316600090815261019b6020526040902080546001600160a01b03191633179055565b600080516020613d3083398151915261180581612013565b61180d6120ac565b6001600160a01b0383166000908152610199602052604090206004015460ff1660011461184c5760405162461bcd60e51b8152600401610bd6906139ce565b6001600160a01b0383166000818152610199602052604090819020849055517fb2a82fce6d8c7a633efe9579f77b4edb96bfdf171a49bfc2ce666dc543a1f5009061189a9085815260200190565b60405180910390a2505050565b6001600160a01b03811660009081526101996020526040902060030154806118cf574661090b565b919050565b600080516020613d308339815191526118ec81612013565b6118f46120ac565b61019c546001600160a01b03161580159061197c575061019c5460405163639e625760e11b81526001600160a01b039091169063c73cc4ae9061193b90859060040161361b565b602060405180830381865afa158015611958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197c919061390a565b156119e55761019c5460405163c375c2ef60e01b81526001600160a01b039091169063c375c2ef906119b290859060040161361b565b600060405180830381600087803b1580156119cc57600080fd5b505af11580156119e0573d6000803e3d6000fd5b505050505b6119ee826122c3565b6040516001600160a01b038316907f8d30d41865a0b811b9545d879520d2dde9f4cc49e4241f486ad9752bc904b56590600090a25050565b600080516020613d30833981519152611a3e81612013565b611a466120ac565b61019c546001600160a01b031615801590611ace575061019c5460405163fe575a8760e01b81526001600160a01b039091169063fe575a8790611a8d90859060040161361b565b602060405180830381865afa158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace919061390a565b15611b375761019c546040516363513b6160e11b81526001600160a01b039091169063c6a276c290611b0490859060040161361b565b600060405180830381600087803b158015611b1e57600080fd5b505af1158015611b32573d6000803e3d6000fd5b505050505b6001600160a01b03821660008181526101996020526040808220600401805460ff19169055517f1747ca720b1a174a464b6513ace29b1d3190b5f632b9f34147017c81425bfde89190a25050565b6001600160a01b0381166000908152610199602052604081206004015460ff16600203611bb457506001919050565b61019c546001600160a01b031615610cc45761019c5460405163639e625760e11b81526001600160a01b039091169063c73cc4ae90611bf790859060040161361b565b602060405180830381865afa925050508015611c30575060408051601f3d908101601f19168201909252611c2d9181019061390a565b60015b61090b57506000919050565b336001600160a01b0384161480611c665750611c66600080516020613d30833981519152336115b3565b611ca35760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610bd6565b610a168383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612a7a92505050565b611cec82610b42565b611cf581612013565b610a168383612647565b611d076120ac565b611d1033610ebb565b611d2c5760405162461bcd60e51b8152600401610bd6906139ce565b611d35336122c3565b565b60675460405163bf40fac160e01b815260206004820152600a60248201526923a7a7a22227a62620a960b11b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa158015611d9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbf919061382e565b905090565b6001600160a01b0381166000908152610199602052604081205415611e0057506001600160a01b03166000908152610199602052604090205490565b61019c546001600160a01b031615610cc45761019c546040516370f1b05d60e11b81526001600160a01b039091169063e1e360ba90611e4390859060040161361b565b602060405180830381865afa925050508015611c30575060408051601f3d908101601f19168201909252611c2d918101906139f7565b600080516020613d30833981519152611e9181612013565b611e996120ac565b611ea4858585612222565b8115611ec7576001600160a01b0385166000908152610199602052604090208290555b5050505050565b6101996020526000908152604090208054600182015460028301805492939192611ef790613927565b80601f0160208091040260200160405190810160405280929190818152602001828054611f2390613927565b8015611f705780601f10611f4557610100808354040283529160200191611f70565b820191906000526020600020905b815481529060010190602001808311611f5357829003601f168201915b50505050600383015460049093015491929160ff16905085565b6001600160a01b0381166000908152610199602052604081206004015460ff9081169003611fba57506001919050565b61019c546001600160a01b031615610cc45761019c5460405163fe575a8760e01b81526001600160a01b039091169063fe575a8790611bf790859060040161361b565b6120056120ac565b61200d612cfa565b61019855565b61094d8133612dbd565b6120256120ac565b610130805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861205b3390565b604051612068919061361b565b60405180910390a1565b61207a612e16565b610130805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361205b565b6101305460ff1615611d355760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bd6565b6001600160a01b0382166000908152610199602052604090206004015460ff16156121555760405162461bcd60e51b8152602060048201526012602482015271616c7265616479206861732073746174757360701b6044820152606401610bd6565b600161019660008282546121699190613a10565b90915550506001600160a01b03821660009081526101996020908152604080832060048101805460ff1916600190811790915542908201819055815560030184905561019b909152902080546001600160a01b03191690556121cb823b151590565b156121ea57600161019760008282546121e49190613a10565b90915550505b6040516001600160a01b038316907fee1504a83b6d4a361f4c1dc78ab59bfa30d6a3b6612c403e86bb01ef2984295f90600090a25050565b8151602080840191909120600081815261019a9092526040909120546001600160a01b0316156122645760405162461bcd60e51b8152600401610bd690613a23565b6001600160a01b03841660009081526101996020526040902060020161228a8482613aa1565b50600081815261019a6020526040902080546001600160a01b0319166001600160a01b0386161790556122bd84836120f3565b50505050565b6001600160a01b0381166000908152610199602052604090206004015460ff166001148061231057506001600160a01b0381166000908152610199602052604090206004015460ff166002145b156124ac576001610196600082825461232991906138d5565b9091555050803b151580156123415750600061019754115b15612360576001610197600082825461235a91906138d5565b90915550505b6001600160a01b038116600090815261019960205260408120600201805461238790613927565b80601f01602080910402602001604051908101604052809291908181526020018280546123b390613927565b80156124005780601f106123d557610100808354040283529160200191612400565b820191906000526020600020905b8154815290600101906020018083116123e357829003601f168201915b505083516020808601919091206001600160a01b038816600090815261019990925260408220828155600181018390559596509493509150612447905060028301826133b8565b506000600382018190556004909101805460ff1916905581815261019a602052604080822080546001600160a01b0319169055516001600160a01b038516917f270d9b30cf5b0793bbfd54c9d5b94aeb49462b8148399000265144a8722da6b691a250505b61019c546001600160a01b031615801590612534575061019c54604051633af32abf60e01b81526001600160a01b0390911690633af32abf906124f390849060040161361b565b602060405180830381865afa158015612510573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612534919061390a565b1561094d5761019c5460405163291d954960e01b81526001600160a01b039091169063291d95499061256a90849060040161361b565b600060405180830381600087803b15801561258457600080fd5b505af1158015611ec7573d6000803e3d6000fd5b606780546001600160a01b0319166001600160a01b03831617905561094d610a1b565b61093782825b6125cb82826115b3565b61093757600082815260fe602090815260408083206001600160a01b03851684529091529020805460ff191660011790556126033390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61265182826115b3565b1561093757600082815260fe602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020613d90833981519152546001600160a01b031690565b61094d612cfa565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561270557610a1683612e60565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561275f575060408051601f3d908101601f1916820190925261275c918101906139f7565b60015b6127c25760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610bd6565b600080516020613d9083398151915281146128315760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610bd6565b50610a16838383612efa565b6001600160a01b03163b151590565b600054610100900460ff16611d355760405162461bcd60e51b8152600401610bd690613b60565b600054610100900460ff1661289a5760405162461bcd60e51b8152600401610bd690613b60565b610130805460ff19169055565b600054610100900460ff166128ce5760405162461bcd60e51b8152600401610bd690613b60565b8151602092830120815191909201206101629190915561016355565b600061090b6128f7612f1f565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006129478585612f9c565b9092509050600081600481111561296057612960613bab565b14801561297e5750856001600160a01b0316826001600160a01b0316145b1561298e57600192505050610fbb565b600080876001600160a01b0316631626ba7e60e01b88886040516024016129b6929190613bc1565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516129f49190613be2565b600060405180830381855afa9150503d8060008114612a2f576040519150601f19603f3d011682016040523d82523d6000602084013e612a34565b606091505b5091509150818015612a47575080516020145b8015612a6e57508051630b135d3f60e11b90612a6c90830160209081019084016139f7565b145b98975050505050505050565b612a8382610ebb565b612a9f5760405162461bcd60e51b8152600401610bd6906139ce565b6000815111612adc5760405162461bcd60e51b815260206004820152600960248201526864696420656d70747960b81b6044820152606401610bd6565b8051602080830191909120600081815261019a9092526040909120546001600160a01b031615612b1e5760405162461bcd60e51b8152600401610bd690613a23565b61019c546001600160a01b031615612c505761019c546040516367c7593760e01b8152600481018390526000916001600160a01b0316906367c7593790602401602060405180830381865afa925050508015612b97575060408051601f3d908101601f19168201909252612b949181019061382e565b60015b15612b9f5790505b6001600160a01b0381161580612bc65750836001600160a01b0316816001600160a01b0316145b80612bf757506001600160a01b0381166000908152610199602052604081206002018054612bf390613927565b9050115b612c4e5760405162461bcd60e51b815260206004820152602260248201527f44494420616c72656164792072656769737465726564206f6c644964656e7469604482015261747960f01b6064820152608401610bd6565b505b6001600160a01b038316600090815261019960205260408082209051612c799160020190613bfe565b6040805191829003909120600081815261019a602090815283822080546001600160a01b03191690556001600160a01b0388168252610199905291909120909150600201612cc78482613aa1565b5050600090815261019a6020526040902080546001600160a01b0319166001600160a01b03939093169290921790915550565b60655460408051632d77bef360e11b8152905133926001600160a01b031691635aef7de69160048083019260209291908290030181865afa158015612d43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d67919061382e565b6001600160a01b031614611d355760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79206176617461722063616e2063616c6c2074686973206d6574686f646044820152606401610bd6565b612dc782826115b3565b61093757612dd481612fe1565b612ddf836020612ff3565b604051602001612df0929190613c74565b60408051601f198184030181529082905262461bcd60e51b8252610bd691600401613608565b6101305460ff16611d355760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bd6565b612e698161283d565b612ecb5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610bd6565b600080516020613d9083398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612f038361318e565b600082511180612f105750805b15610a16576122bd83836131ce565b6000611dbf7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612f4f6101625490565b610163546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000808251604103612fd25760208301516040840151606085015160001a612fc6878285856132c0565b94509450505050612fda565b506000905060025b9250929050565b606061090b6001600160a01b03831660145b60606000613002836002613ce3565b61300d906002613a10565b6001600160401b038111156130245761302461348d565b6040519080825280601f01601f19166020018201604052801561304e576020820181803683370190505b509050600360fc1b8160008151811061306957613069613d02565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061309857613098613d02565b60200101906001600160f81b031916908160001a90535060006130bc846002613ce3565b6130c7906001613a10565b90505b600181111561313f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106130fb576130fb613d02565b1a60f81b82828151811061311157613111613d02565b60200101906001600160f81b031916908160001a90535060049490941c9361313881613d18565b90506130ca565b508315610fbb5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bd6565b61319781612e60565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606131d98361283d565b6132345760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610bd6565b600080846001600160a01b03168460405161324f9190613be2565b600060405180830381855af49150503d806000811461328a576040519150601f19603f3d011682016040523d82523d6000602084013e61328f565b606091505b50915091506132b78282604051806060016040528060278152602001613df76027913961337a565b95945050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156132ed5750600090506003613371565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613341573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661336a57600060019250925050613371565b9150600090505b94509492505050565b60608315613389575081610fbb565b610fbb838381511561339e5781518083602001fd5b8060405162461bcd60e51b8152600401610bd69190613608565b5080546133c490613927565b6000825580601f106133d4575050565b601f01602090049060005260206000209081019061094d91905b8082111561340257600081556001016133ee565b5090565b60006020828403121561341857600080fd5b81356001600160e01b031981168114610fbb57600080fd5b801515811461094d57600080fd5b60006020828403121561345057600080fd5b8135610fbb81613430565b6001600160a01b038116811461094d57600080fd5b60006020828403121561348257600080fd5b8135610fbb8161345b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156134cb576134cb61348d565b604052919050565b60006001600160401b038211156134ec576134ec61348d565b50601f01601f191660200190565b600082601f83011261350b57600080fd5b813561351e613519826134d3565b6134a3565b81815284602083860101111561353357600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561356357600080fd5b823561356e8161345b565b915060208301356001600160401b0381111561358957600080fd5b613595858286016134fa565b9150509250929050565b6000602082840312156135b157600080fd5b5035919050565b60005b838110156135d35781810151838201526020016135bb565b50506000910152565b600081518084526135f48160208601602086016135b8565b601f01601f19169290920160200192915050565b602081526000610fbb60208301846135dc565b6001600160a01b0391909116815260200190565b6000806040838503121561364257600080fd5b8235915060208301356136548161345b565b809150509250929050565b6000806040838503121561367257600080fd5b823561367d8161345b565b915060208301356136548161345b565b6000806000606084860312156136a257600080fd5b83356136ad8161345b565b925060208401356001600160401b038111156136c857600080fd5b6136d4868287016134fa565b925050604084013590509250925092565b600080604083850312156136f857600080fd5b82356137038161345b565b946020939093013593505050565b60008060006040848603121561372657600080fd5b83356137318161345b565b925060208401356001600160401b038082111561374d57600080fd5b818601915086601f83011261376157600080fd5b81358181111561377057600080fd5b87602082850101111561378257600080fd5b6020830194508093505050509250925092565b600080600080608085870312156137ab57600080fd5b84356137b68161345b565b935060208501356001600160401b038111156137d157600080fd5b6137dd878288016134fa565b949794965050505060408301359260600135919050565b85815284602082015260a06040820152600061381360a08301866135dc565b905083606083015260ff831660808301529695505050505050565b60006020828403121561384057600080fd5b8151610fbb8161345b565b6020808252602c90820152600080516020613d5083398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020613d5083398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561090b5761090b6138bf565b60008261390557634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561391c57600080fd5b8151610fbb81613430565b600181811c9082168061393b57607f821691505b60208210810361395b57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561397357600080fd5b81516001600160401b0381111561398957600080fd5b8201601f8101841361399a57600080fd5b80516139a8613519826134d3565b8181528560208385010111156139bd57600080fd5b6132b78260208301602086016135b8565b6020808252600f908201526e1b9bdd081dda1a5d195b1a5cdd1959608a1b604082015260600190565b600060208284031215613a0957600080fd5b5051919050565b8082018082111561090b5761090b6138bf565b60208082526016908201527511125108185b1c9958591e481c9959da5cdd195c995960521b604082015260600190565b601f821115610a1657600081815260208120601f850160051c81016020861015613a7a5750805b601f850160051c820191505b81811015613a9957828155600101613a86565b505050505050565b81516001600160401b03811115613aba57613aba61348d565b613ace81613ac88454613927565b84613a53565b602080601f831160018114613b035760008415613aeb5750858301515b600019600386901b1c1916600185901b178555613a99565b600085815260208120601f198616915b82811015613b3257888601518255948401946001909101908401613b13565b5085821015613b505787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b828152604060208201526000613bda60408301846135dc565b949350505050565b60008251613bf48184602087016135b8565b9190910192915050565b6000808354613c0c81613927565b60018281168015613c245760018114613c3957613c68565b60ff1984168752821515830287019450613c68565b8760005260208060002060005b85811015613c5f5781548a820152908401908201613c46565b50505082870194505b50929695505050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613ca68160178501602088016135b8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613cd78160288401602088016135b8565b01602801949350505050565b6000816000190483118215151615613cfd57613cfd6138bf565b500290565b634e487b7160e01b600052603260045260246000fd5b600081613d2757613d276138bf565b50600019019056fe091941537c453917ef5b0c67f46f29060aca926ebd752fe441d5625e85c3a57646756e6374696f6e206d7573742062652063616c6c6564207468726f756768200b0f1f48172a2124d5545a38711e7e9d2e7a6c0b46b85cf1c1788e7a11ba5bf2360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc436f6e6e6563744964656e7469747928616464726573732077686974656c69737465642c6164647265737320636f6e6e65637465642c75696e7432353620646561646c696e6529416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220240c3c6ac8bef1c1a31265012b08d701618077b06e017cc86e7aeaee9cfe316c64736f6c63430008100033
Deployed ByteCode
0x60806040526004361061024f5760003560e01c806301ffc9a71461025457806302329a291461028957806308e0d29d146102ab57806310154bad146102cb578063188efc16146102eb5780631aaff63c1461030b5780631b0270991461033b5780631b3c90a81461035b5780632236684414610370578063248a9ca314610384578063291d9549146103a45780632b14dda8146103c45780632cec5330146103e45780632d0e9b46146104065780632f2ff15d1461043357806331b376e21461045357806336568abe1461046a5780633659cfe61461048a57806337a1a987146104aa5780633af32abf146104ca5780633e6326fc146104ea5780634125f0f21461050a5780634162169f1461052b578063485cc9551461054b5780634f1ef2861461056b57806352d1902d1461057e57806354f9f7a3146105935780635aef7de6146105b35780635c975abb146105d35780635f539d69146105ec578063613200401461060c57806367c759371461064357806391d148541461067a57806393ce7f001461069a57806396a1ef79146106ba578063a061922d146106da578063a217fddf146106fa578063b2a1de221461070f578063b30f7e7f14610726578063c375c2ef1461073d578063c6a276c21461075d578063c73cc4ae1461077d578063d32628161461079d578063d547741f146107bd578063d6cd9473146107dd578063e1758bd8146107f2578063e1e360ba14610807578063e63ab1e914610827578063e737031a14610849578063f653b81e14610869578063fe575a871461089a578063fff930d4146108ba575b600080fd5b34801561026057600080fd5b5061027461026f366004613406565b6108da565b60405190151581526020015b60405180910390f35b34801561029557600080fd5b506102a96102a436600461343e565b610911565b005b3480156102b757600080fd5b506102a96102c6366004613470565b610943565b3480156102d757600080fd5b506102a96102e6366004613470565b610950565b3480156102f757600080fd5b506102a9610306366004613470565b61097a565b34801561031757600080fd5b5061032d600080516020613d3083398151915281565b604051908152602001610280565b34801561034757600080fd5b506102a9610356366004613550565b6109eb565b34801561036757600080fd5b506102a9610a1b565b34801561037c57600080fd5b506001610274565b34801561039057600080fd5b5061032d61039f36600461359f565b610b42565b3480156103b057600080fd5b506102a96103bf366004613470565b610b57565b3480156103d057600080fd5b506102a96103df366004613470565b610b80565b3480156103f057600080fd5b506103f9610c4a565b6040516102809190613608565b34801561041257600080fd5b50610426610421366004613470565b610c66565b604051610280919061361b565b34801561043f57600080fd5b506102a961044e36600461362f565b610ccc565b34801561045f57600080fd5b5061032d6101985481565b34801561047657600080fd5b506102a961048536600461362f565b610ce8565b34801561049657600080fd5b506102a96104a5366004613470565b610d62565b3480156104b657600080fd5b506102a96104c5366004613470565b610e27565b3480156104d657600080fd5b506102746104e5366004613470565b610ebb565b3480156104f657600080fd5b50606754610426906001600160a01b031681565b34801561051657600080fd5b5061019c54610426906001600160a01b031681565b34801561053757600080fd5b50606554610426906001600160a01b031681565b34801561055757600080fd5b506102a961056636600461365f565b610fcb565b6102a9610579366004613550565b6111f3565b34801561058a57600080fd5b5061032d6112a8565b34801561059f57600080fd5b506103f96105ae366004613470565b611356565b3480156105bf57600080fd5b50606654610426906001600160a01b031681565b3480156105df57600080fd5b506101305460ff16610274565b3480156105f857600080fd5b506102a9610607366004613470565b6114ea565b34801561061857600080fd5b50610426610627366004613470565b61019b602052600090815260409020546001600160a01b031681565b34801561064f57600080fd5b5061042661065e36600461359f565b61019a602052600090815260409020546001600160a01b031681565b34801561068657600080fd5b5061027461069536600461362f565b6115b3565b3480156106a657600080fd5b506102a96106b536600461368d565b6115de565b3480156106c657600080fd5b506102a96106d53660046136e5565b6117ed565b3480156106e657600080fd5b5061032d6106f5366004613470565b6118a7565b34801561070657600080fd5b5061032d600081565b34801561071b57600080fd5b5061032d6101965481565b34801561073257600080fd5b5061032d6101975481565b34801561074957600080fd5b506102a9610758366004613470565b6118d4565b34801561076957600080fd5b506102a9610778366004613470565b611a26565b34801561078957600080fd5b50610274610798366004613470565b611b85565b3480156107a957600080fd5b506102a96107b8366004613711565b611c3c565b3480156107c957600080fd5b506102a96107d836600461362f565b611ce3565b3480156107e957600080fd5b506102a9611cff565b3480156107fe57600080fd5b50610426611d37565b34801561081357600080fd5b5061032d610822366004613470565b611dc4565b34801561083357600080fd5b5061032d600080516020613d7083398151915281565b34801561085557600080fd5b506102a9610864366004613795565b611e79565b34801561087557600080fd5b50610889610884366004613470565b611ece565b6040516102809594939291906137f4565b3480156108a657600080fd5b506102746108b5366004613470565b611f8a565b3480156108c657600080fd5b506102a96108d536600461359f565b611ffd565b60006001600160e01b03198216637965db0b60e01b148061090b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020613d7083398151915261092981612013565b811561093b5761093761201d565b5050565b610937612072565b61094d81426117ed565b50565b600080516020613d3083398151915261096881612013565b6109706120ac565b61093782466120f3565b600080516020613d3083398151915261099281612013565b61099a6120ac565b6001600160a01b03821660008181526101996020526040808220600401805460ff191660ff179055517f44d5fe68b00f68950fb9c1ff0a61ef7f747b1a36359a7e3a7f3324db4b8789679190a25050565b600080516020613d30833981519152610a0381612013565b610a0b6120ac565b610a16838346612222565b505050565b60675460405163bf40fac160e01b815260206004820152600a60248201526921a7a72a2927a62622a960b11b60448201526001600160a01b039091169063bf40fac190606401602060405180830381865afa158015610a7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa2919061382e565b606580546001600160a01b0319166001600160a01b0392909216918217905560408051632d77bef360e11b81529051635aef7de6916004808201926020929091908290030181865afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b20919061382e565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260fe602052604090206001015490565b600080516020613d30833981519152610b6f81612013565b610b776120ac565b610937826122c3565b6000610b8b81612013565b6067546001600160a01b031615610bdf5760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064015b60405180910390fd5b610be882612598565b606654610c00906000906001600160a01b03166125bb565b606654610c2590600080516020613d70833981519152906001600160a01b03166125bb565b60665461093790600080516020613d30833981519152906001600160a01b03166125bb565b604051806080016040528060478152602001613db06047913981565b6000610c7182610ebb565b15610c7a575090565b6001600160a01b03808316600090815261019b6020526040902054610c9f9116610ebb565b15610cc457506001600160a01b03908116600090815261019b60205260409020541690565b506000919050565b610cd582610b42565b610cde81612013565b610a1683836125c1565b6001600160a01b0381163314610d585760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bd6565b6109378282612647565b6001600160a01b037f0000000000000000000000003df6ea625866df8d0a61408a122c484b98f3184c163003610daa5760405162461bcd60e51b8152600401610bd69061384b565b7f0000000000000000000000003df6ea625866df8d0a61408a122c484b98f3184c6001600160a01b0316610ddc6126ae565b6001600160a01b031614610e025760405162461bcd60e51b8152600401610bd690613885565b610e0b816126ca565b6040805160008082526020820190925261094d918391906126d2565b6001600160a01b03818116600090815261019b602052604090205416331480610e585750336001600160a01b038216145b610e935760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b6044820152606401610bd6565b6001600160a01b0316600090815261019b6020526040902080546001600160a01b0319169055565b6001600160a01b0381166000908152610199602052604081205481906201518090610ee690426138d5565b610ef091906138e8565b9050610198548111158015610f2457506001600160a01b0383166000908152610199602052604090206004015460ff166001145b15610f325750600192915050565b61019c546001600160a01b031615610fc25761019c54604051633af32abf60e01b81526001600160a01b0390911690633af32abf90610f7590869060040161361b565b602060405180830381865afa925050508015610fae575060408051601f3d908101601f19168201909252610fab9181019061390a565b60015b610fbb5750600092915050565b9392505050565b50600092915050565b600054610100900460ff1615808015610feb5750600054600160ff909116105b8061100c5750610ffa3061283d565b15801561100c575060005460ff166001145b61106f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bd6565b6000805460ff191660011790558015611092576000805461ff0019166101001790555b61109a61284c565b6110a2612873565b6110e9604051806040016040528060088152602001674964656e7469747960c01b815250604051806040016040528060058152602001640312e302e360dc1b8152506128a7565b61044761019855606654611108906000906001600160a01b03166125bb565b6111136000846125bb565b60665461113890600080516020613d70833981519152906001600160a01b03166125bb565b611150600080516020613d70833981519152846125bb565b611168600080516020613d30833981519152846125bb565b60665461118d90600080516020613d30833981519152906001600160a01b03166125bb565b61019c80546001600160a01b0319166001600160a01b0384161790558015610a16576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b037f0000000000000000000000003df6ea625866df8d0a61408a122c484b98f3184c16300361123b5760405162461bcd60e51b8152600401610bd69061384b565b7f0000000000000000000000003df6ea625866df8d0a61408a122c484b98f3184c6001600160a01b031661126d6126ae565b6001600160a01b0316146112935760405162461bcd60e51b8152600401610bd690613885565b61129c826126ca565b610937828260016126d2565b6000306001600160a01b037f0000000000000000000000003df6ea625866df8d0a61408a122c484b98f3184c16146113435760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610bd6565b50600080516020613d9083398151915290565b6001600160a01b03811660009081526101996020526040902060020180546060919061138190613927565b80601f01602080910402602001604051908101604052809291908181526020018280546113ad90613927565b80156113fa5780601f106113cf576101008083540402835291602001916113fa565b820191906000526020600020905b8154815290600101906020018083116113dd57829003601f168201915b50508351602080860191909120600081815261019a909252604090912054949550936001600160a01b0380881691160392506114399150505750919050565b61019c546001600160a01b0316156114d45761019c546040516354f9f7a360e01b81526001600160a01b03909116906354f9f7a39061147c90869060040161361b565b600060405180830381865afa9250505080156114ba57506040513d6000823e601f3d908101601f191682016040526114b79190810190613961565b60015b610fbb575050604080516020810190915260008152919050565b5050604080516020810190915260008152919050565b600080516020613d3083398151915261150281612013565b61150a6120ac565b813b6115585760405162461bcd60e51b815260206004820152601f60248201527f476976656e2061646472657373206973206e6f74206120636f6e7472616374006044820152606401610bd6565b61156282466120f3565b6001600160a01b03821660008181526101996020526040808220600401805460ff19166002179055517f89c66952b48f3e96bf1d8ba1b63189520fd988a6979b8b740bd5c5d8dc53e2059190a25050565b600091825260fe602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6115e733610ebb565b6116035760405162461bcd60e51b8152600401610bd6906139ce565b6000811180156116135750438110155b6116525760405162461bcd60e51b815260206004820152601060248201526f696e76616c696420646561646c696e6560801b6044820152606401610bd6565b61165b83610ebb565b15801561166e575061166c83611f8a565b155b6116ac5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081858d8dbdd5b9d608a1b6044820152606401610bd6565b6001600160a01b03838116600090815261019b602052604090205416156117095760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4818dbdb9b9958dd1959607a1b6044820152606401610bd6565b6000611773604051806080016040528060478152602001613db0604791398051602091820120604080519283019190915233908201526001600160a01b03861660608201526080810184905260a001604051602081830303815290604052805190602001206128ea565b9050611780848285612938565b6117c05760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606401610bd6565b5050506001600160a01b0316600090815261019b6020526040902080546001600160a01b03191633179055565b600080516020613d3083398151915261180581612013565b61180d6120ac565b6001600160a01b0383166000908152610199602052604090206004015460ff1660011461184c5760405162461bcd60e51b8152600401610bd6906139ce565b6001600160a01b0383166000818152610199602052604090819020849055517fb2a82fce6d8c7a633efe9579f77b4edb96bfdf171a49bfc2ce666dc543a1f5009061189a9085815260200190565b60405180910390a2505050565b6001600160a01b03811660009081526101996020526040902060030154806118cf574661090b565b919050565b600080516020613d308339815191526118ec81612013565b6118f46120ac565b61019c546001600160a01b03161580159061197c575061019c5460405163639e625760e11b81526001600160a01b039091169063c73cc4ae9061193b90859060040161361b565b602060405180830381865afa158015611958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197c919061390a565b156119e55761019c5460405163c375c2ef60e01b81526001600160a01b039091169063c375c2ef906119b290859060040161361b565b600060405180830381600087803b1580156119cc57600080fd5b505af11580156119e0573d6000803e3d6000fd5b505050505b6119ee826122c3565b6040516001600160a01b038316907f8d30d41865a0b811b9545d879520d2dde9f4cc49e4241f486ad9752bc904b56590600090a25050565b600080516020613d30833981519152611a3e81612013565b611a466120ac565b61019c546001600160a01b031615801590611ace575061019c5460405163fe575a8760e01b81526001600160a01b039091169063fe575a8790611a8d90859060040161361b565b602060405180830381865afa158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace919061390a565b15611b375761019c546040516363513b6160e11b81526001600160a01b039091169063c6a276c290611b0490859060040161361b565b600060405180830381600087803b158015611b1e57600080fd5b505af1158015611b32573d6000803e3d6000fd5b505050505b6001600160a01b03821660008181526101996020526040808220600401805460ff19169055517f1747ca720b1a174a464b6513ace29b1d3190b5f632b9f34147017c81425bfde89190a25050565b6001600160a01b0381166000908152610199602052604081206004015460ff16600203611bb457506001919050565b61019c546001600160a01b031615610cc45761019c5460405163639e625760e11b81526001600160a01b039091169063c73cc4ae90611bf790859060040161361b565b602060405180830381865afa925050508015611c30575060408051601f3d908101601f19168201909252611c2d9181019061390a565b60015b61090b57506000919050565b336001600160a01b0384161480611c665750611c66600080516020613d30833981519152336115b3565b611ca35760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610bd6565b610a168383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612a7a92505050565b611cec82610b42565b611cf581612013565b610a168383612647565b611d076120ac565b611d1033610ebb565b611d2c5760405162461bcd60e51b8152600401610bd6906139ce565b611d35336122c3565b565b60675460405163bf40fac160e01b815260206004820152600a60248201526923a7a7a22227a62620a960b11b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa158015611d9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbf919061382e565b905090565b6001600160a01b0381166000908152610199602052604081205415611e0057506001600160a01b03166000908152610199602052604090205490565b61019c546001600160a01b031615610cc45761019c546040516370f1b05d60e11b81526001600160a01b039091169063e1e360ba90611e4390859060040161361b565b602060405180830381865afa925050508015611c30575060408051601f3d908101601f19168201909252611c2d918101906139f7565b600080516020613d30833981519152611e9181612013565b611e996120ac565b611ea4858585612222565b8115611ec7576001600160a01b0385166000908152610199602052604090208290555b5050505050565b6101996020526000908152604090208054600182015460028301805492939192611ef790613927565b80601f0160208091040260200160405190810160405280929190818152602001828054611f2390613927565b8015611f705780601f10611f4557610100808354040283529160200191611f70565b820191906000526020600020905b815481529060010190602001808311611f5357829003601f168201915b50505050600383015460049093015491929160ff16905085565b6001600160a01b0381166000908152610199602052604081206004015460ff9081169003611fba57506001919050565b61019c546001600160a01b031615610cc45761019c5460405163fe575a8760e01b81526001600160a01b039091169063fe575a8790611bf790859060040161361b565b6120056120ac565b61200d612cfa565b61019855565b61094d8133612dbd565b6120256120ac565b610130805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861205b3390565b604051612068919061361b565b60405180910390a1565b61207a612e16565b610130805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361205b565b6101305460ff1615611d355760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bd6565b6001600160a01b0382166000908152610199602052604090206004015460ff16156121555760405162461bcd60e51b8152602060048201526012602482015271616c7265616479206861732073746174757360701b6044820152606401610bd6565b600161019660008282546121699190613a10565b90915550506001600160a01b03821660009081526101996020908152604080832060048101805460ff1916600190811790915542908201819055815560030184905561019b909152902080546001600160a01b03191690556121cb823b151590565b156121ea57600161019760008282546121e49190613a10565b90915550505b6040516001600160a01b038316907fee1504a83b6d4a361f4c1dc78ab59bfa30d6a3b6612c403e86bb01ef2984295f90600090a25050565b8151602080840191909120600081815261019a9092526040909120546001600160a01b0316156122645760405162461bcd60e51b8152600401610bd690613a23565b6001600160a01b03841660009081526101996020526040902060020161228a8482613aa1565b50600081815261019a6020526040902080546001600160a01b0319166001600160a01b0386161790556122bd84836120f3565b50505050565b6001600160a01b0381166000908152610199602052604090206004015460ff166001148061231057506001600160a01b0381166000908152610199602052604090206004015460ff166002145b156124ac576001610196600082825461232991906138d5565b9091555050803b151580156123415750600061019754115b15612360576001610197600082825461235a91906138d5565b90915550505b6001600160a01b038116600090815261019960205260408120600201805461238790613927565b80601f01602080910402602001604051908101604052809291908181526020018280546123b390613927565b80156124005780601f106123d557610100808354040283529160200191612400565b820191906000526020600020905b8154815290600101906020018083116123e357829003601f168201915b505083516020808601919091206001600160a01b038816600090815261019990925260408220828155600181018390559596509493509150612447905060028301826133b8565b506000600382018190556004909101805460ff1916905581815261019a602052604080822080546001600160a01b0319169055516001600160a01b038516917f270d9b30cf5b0793bbfd54c9d5b94aeb49462b8148399000265144a8722da6b691a250505b61019c546001600160a01b031615801590612534575061019c54604051633af32abf60e01b81526001600160a01b0390911690633af32abf906124f390849060040161361b565b602060405180830381865afa158015612510573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612534919061390a565b1561094d5761019c5460405163291d954960e01b81526001600160a01b039091169063291d95499061256a90849060040161361b565b600060405180830381600087803b15801561258457600080fd5b505af1158015611ec7573d6000803e3d6000fd5b606780546001600160a01b0319166001600160a01b03831617905561094d610a1b565b61093782825b6125cb82826115b3565b61093757600082815260fe602090815260408083206001600160a01b03851684529091529020805460ff191660011790556126033390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61265182826115b3565b1561093757600082815260fe602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020613d90833981519152546001600160a01b031690565b61094d612cfa565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561270557610a1683612e60565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561275f575060408051601f3d908101601f1916820190925261275c918101906139f7565b60015b6127c25760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610bd6565b600080516020613d9083398151915281146128315760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610bd6565b50610a16838383612efa565b6001600160a01b03163b151590565b600054610100900460ff16611d355760405162461bcd60e51b8152600401610bd690613b60565b600054610100900460ff1661289a5760405162461bcd60e51b8152600401610bd690613b60565b610130805460ff19169055565b600054610100900460ff166128ce5760405162461bcd60e51b8152600401610bd690613b60565b8151602092830120815191909201206101629190915561016355565b600061090b6128f7612f1f565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006129478585612f9c565b9092509050600081600481111561296057612960613bab565b14801561297e5750856001600160a01b0316826001600160a01b0316145b1561298e57600192505050610fbb565b600080876001600160a01b0316631626ba7e60e01b88886040516024016129b6929190613bc1565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516129f49190613be2565b600060405180830381855afa9150503d8060008114612a2f576040519150601f19603f3d011682016040523d82523d6000602084013e612a34565b606091505b5091509150818015612a47575080516020145b8015612a6e57508051630b135d3f60e11b90612a6c90830160209081019084016139f7565b145b98975050505050505050565b612a8382610ebb565b612a9f5760405162461bcd60e51b8152600401610bd6906139ce565b6000815111612adc5760405162461bcd60e51b815260206004820152600960248201526864696420656d70747960b81b6044820152606401610bd6565b8051602080830191909120600081815261019a9092526040909120546001600160a01b031615612b1e5760405162461bcd60e51b8152600401610bd690613a23565b61019c546001600160a01b031615612c505761019c546040516367c7593760e01b8152600481018390526000916001600160a01b0316906367c7593790602401602060405180830381865afa925050508015612b97575060408051601f3d908101601f19168201909252612b949181019061382e565b60015b15612b9f5790505b6001600160a01b0381161580612bc65750836001600160a01b0316816001600160a01b0316145b80612bf757506001600160a01b0381166000908152610199602052604081206002018054612bf390613927565b9050115b612c4e5760405162461bcd60e51b815260206004820152602260248201527f44494420616c72656164792072656769737465726564206f6c644964656e7469604482015261747960f01b6064820152608401610bd6565b505b6001600160a01b038316600090815261019960205260408082209051612c799160020190613bfe565b6040805191829003909120600081815261019a602090815283822080546001600160a01b03191690556001600160a01b0388168252610199905291909120909150600201612cc78482613aa1565b5050600090815261019a6020526040902080546001600160a01b0319166001600160a01b03939093169290921790915550565b60655460408051632d77bef360e11b8152905133926001600160a01b031691635aef7de69160048083019260209291908290030181865afa158015612d43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d67919061382e565b6001600160a01b031614611d355760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79206176617461722063616e2063616c6c2074686973206d6574686f646044820152606401610bd6565b612dc782826115b3565b61093757612dd481612fe1565b612ddf836020612ff3565b604051602001612df0929190613c74565b60408051601f198184030181529082905262461bcd60e51b8252610bd691600401613608565b6101305460ff16611d355760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bd6565b612e698161283d565b612ecb5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610bd6565b600080516020613d9083398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612f038361318e565b600082511180612f105750805b15610a16576122bd83836131ce565b6000611dbf7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612f4f6101625490565b610163546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000808251604103612fd25760208301516040840151606085015160001a612fc6878285856132c0565b94509450505050612fda565b506000905060025b9250929050565b606061090b6001600160a01b03831660145b60606000613002836002613ce3565b61300d906002613a10565b6001600160401b038111156130245761302461348d565b6040519080825280601f01601f19166020018201604052801561304e576020820181803683370190505b509050600360fc1b8160008151811061306957613069613d02565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061309857613098613d02565b60200101906001600160f81b031916908160001a90535060006130bc846002613ce3565b6130c7906001613a10565b90505b600181111561313f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106130fb576130fb613d02565b1a60f81b82828151811061311157613111613d02565b60200101906001600160f81b031916908160001a90535060049490941c9361313881613d18565b90506130ca565b508315610fbb5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bd6565b61319781612e60565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606131d98361283d565b6132345760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610bd6565b600080846001600160a01b03168460405161324f9190613be2565b600060405180830381855af49150503d806000811461328a576040519150601f19603f3d011682016040523d82523d6000602084013e61328f565b606091505b50915091506132b78282604051806060016040528060278152602001613df76027913961337a565b95945050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156132ed5750600090506003613371565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613341573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661336a57600060019250925050613371565b9150600090505b94509492505050565b60608315613389575081610fbb565b610fbb838381511561339e5781518083602001fd5b8060405162461bcd60e51b8152600401610bd69190613608565b5080546133c490613927565b6000825580601f106133d4575050565b601f01602090049060005260206000209081019061094d91905b8082111561340257600081556001016133ee565b5090565b60006020828403121561341857600080fd5b81356001600160e01b031981168114610fbb57600080fd5b801515811461094d57600080fd5b60006020828403121561345057600080fd5b8135610fbb81613430565b6001600160a01b038116811461094d57600080fd5b60006020828403121561348257600080fd5b8135610fbb8161345b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156134cb576134cb61348d565b604052919050565b60006001600160401b038211156134ec576134ec61348d565b50601f01601f191660200190565b600082601f83011261350b57600080fd5b813561351e613519826134d3565b6134a3565b81815284602083860101111561353357600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561356357600080fd5b823561356e8161345b565b915060208301356001600160401b0381111561358957600080fd5b613595858286016134fa565b9150509250929050565b6000602082840312156135b157600080fd5b5035919050565b60005b838110156135d35781810151838201526020016135bb565b50506000910152565b600081518084526135f48160208601602086016135b8565b601f01601f19169290920160200192915050565b602081526000610fbb60208301846135dc565b6001600160a01b0391909116815260200190565b6000806040838503121561364257600080fd5b8235915060208301356136548161345b565b809150509250929050565b6000806040838503121561367257600080fd5b823561367d8161345b565b915060208301356136548161345b565b6000806000606084860312156136a257600080fd5b83356136ad8161345b565b925060208401356001600160401b038111156136c857600080fd5b6136d4868287016134fa565b925050604084013590509250925092565b600080604083850312156136f857600080fd5b82356137038161345b565b946020939093013593505050565b60008060006040848603121561372657600080fd5b83356137318161345b565b925060208401356001600160401b038082111561374d57600080fd5b818601915086601f83011261376157600080fd5b81358181111561377057600080fd5b87602082850101111561378257600080fd5b6020830194508093505050509250925092565b600080600080608085870312156137ab57600080fd5b84356137b68161345b565b935060208501356001600160401b038111156137d157600080fd5b6137dd878288016134fa565b949794965050505060408301359260600135919050565b85815284602082015260a06040820152600061381360a08301866135dc565b905083606083015260ff831660808301529695505050505050565b60006020828403121561384057600080fd5b8151610fbb8161345b565b6020808252602c90820152600080516020613d5083398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020613d5083398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561090b5761090b6138bf565b60008261390557634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561391c57600080fd5b8151610fbb81613430565b600181811c9082168061393b57607f821691505b60208210810361395b57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561397357600080fd5b81516001600160401b0381111561398957600080fd5b8201601f8101841361399a57600080fd5b80516139a8613519826134d3565b8181528560208385010111156139bd57600080fd5b6132b78260208301602086016135b8565b6020808252600f908201526e1b9bdd081dda1a5d195b1a5cdd1959608a1b604082015260600190565b600060208284031215613a0957600080fd5b5051919050565b8082018082111561090b5761090b6138bf565b60208082526016908201527511125108185b1c9958591e481c9959da5cdd195c995960521b604082015260600190565b601f821115610a1657600081815260208120601f850160051c81016020861015613a7a5750805b601f850160051c820191505b81811015613a9957828155600101613a86565b505050505050565b81516001600160401b03811115613aba57613aba61348d565b613ace81613ac88454613927565b84613a53565b602080601f831160018114613b035760008415613aeb5750858301515b600019600386901b1c1916600185901b178555613a99565b600085815260208120601f198616915b82811015613b3257888601518255948401946001909101908401613b13565b5085821015613b505787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b828152604060208201526000613bda60408301846135dc565b949350505050565b60008251613bf48184602087016135b8565b9190910192915050565b6000808354613c0c81613927565b60018281168015613c245760018114613c3957613c68565b60ff1984168752821515830287019450613c68565b8760005260208060002060005b85811015613c5f5781548a820152908401908201613c46565b50505082870194505b50929695505050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613ca68160178501602088016135b8565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613cd78160288401602088016135b8565b01602801949350505050565b6000816000190483118215151615613cfd57613cfd6138bf565b500290565b634e487b7160e01b600052603260045260246000fd5b600081613d2757613d276138bf565b50600019019056fe091941537c453917ef5b0c67f46f29060aca926ebd752fe441d5625e85c3a57646756e6374696f6e206d7573742062652063616c6c6564207468726f756768200b0f1f48172a2124d5545a38711e7e9d2e7a6c0b46b85cf1c1788e7a11ba5bf2360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc436f6e6e6563744964656e7469747928616464726573732077686974656c69737465642c6164647265737320636f6e6e65637465642c75696e7432353620646561646c696e6529416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220240c3c6ac8bef1c1a31265012b08d701618077b06e017cc86e7aeaee9cfe316c64736f6c63430008100033