Address Details
contract

0x284A775F971C58c93cC5EE2a09a5f3496af9B11D

Contract Name
IdentityV2
Creator
0x5128e3–22e4bb at 0x1e024d–eea90b
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
18314662
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-02-19T10:57:47.639006Z

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
		onlyRole(IDENTITY_ADMIN_ROLE)
		whenNotPaused
	{
		require(identities[account].status == 1, "not whitelisted");
		identities[account].dateAuthenticated = block.timestamp;
		emit WhitelistedAuthenticated(account, block.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) {
		return identities[account].dateAuthenticated;
	}

	/**
	 * @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.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.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.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);

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

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":"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

Verify & Publish
0x60a06040523060805234801561001457600080fd5b50608051613be261004c60003960008181610e0401528181610e4401528181611298015281816112d801526113500152613be26000f3fe6080604052600436106102445760003560e01c806301ffc9a71461024957806302329a291461027e57806308e0d29d146102a057806310154bad146102c0578063188efc16146102e05780631aaff63c146103005780631b027099146103305780631b3c90a8146103505780632236684414610365578063248a9ca314610379578063291d9549146103995780632b14dda8146103b95780632cec5330146103d95780632d0e9b46146103fb5780632f2ff15d1461042857806331b376e21461044857806336568abe1461045f5780633659cfe61461047f57806337a1a9871461049f5780633af32abf146104bf5780633e6326fc146104df5780634125f0f2146104ff5780634162169f14610520578063485cc955146105405780634f1ef2861461056057806352d1902d1461057357806354f9f7a3146105885780635aef7de6146105a85780635c975abb146105c85780635f539d69146105e1578063613200401461060157806367c759371461063857806391d148541461066f57806393ce7f001461068f578063a061922d146106af578063a217fddf146106cf578063b2a1de22146106e4578063b30f7e7f146106fb578063c375c2ef14610712578063c6a276c214610732578063c73cc4ae14610752578063d326281614610772578063d547741f14610792578063d6cd9473146107b2578063e1758bd8146107c7578063e1e360ba146107dc578063e63ab1e914610813578063e737031a14610835578063f653b81e14610855578063fe575a8714610886578063fff930d4146108a6575b600080fd5b34801561025557600080fd5b506102696102643660046131c1565b6108c6565b60405190151581526020015b60405180910390f35b34801561028a57600080fd5b5061029e6102993660046131f9565b6108fd565b005b3480156102ac57600080fd5b5061029e6102bb36600461322b565b61092f565b3480156102cc57600080fd5b5061029e6102db36600461322b565b6109ed565b3480156102ec57600080fd5b5061029e6102fb36600461322b565b610a17565b34801561030c57600080fd5b50610322600080516020613abf83398151915281565b604051908152602001610275565b34801561033c57600080fd5b5061029e61034b36600461330b565b610a88565b34801561035c57600080fd5b5061029e610ab8565b34801561037157600080fd5b506001610269565b34801561038557600080fd5b5061032261039436600461335a565b610bdf565b3480156103a557600080fd5b5061029e6103b436600461322b565b610bf4565b3480156103c557600080fd5b5061029e6103d436600461322b565b610c1d565b3480156103e557600080fd5b506103ee610ce2565b60405161027591906133c3565b34801561040757600080fd5b5061041b61041636600461322b565b610cfe565b60405161027591906133d6565b34801561043457600080fd5b5061029e6104433660046133ea565b610d64565b34801561045457600080fd5b506103226101985481565b34801561046b57600080fd5b5061029e61047a3660046133ea565b610d80565b34801561048b57600080fd5b5061029e61049a36600461322b565b610dfa565b3480156104ab57600080fd5b5061029e6104ba36600461322b565b610ec2565b3480156104cb57600080fd5b506102696104da36600461322b565b610f56565b3480156104eb57600080fd5b5060675461041b906001600160a01b031681565b34801561050b57600080fd5b5061019c5461041b906001600160a01b031681565b34801561052c57600080fd5b5060655461041b906001600160a01b031681565b34801561054c57600080fd5b5061029e61055b36600461341a565b611066565b61029e61056e36600461330b565b61128e565b34801561057f57600080fd5b50610322611343565b34801561059457600080fd5b506103ee6105a336600461322b565b6113f1565b3480156105b457600080fd5b5060665461041b906001600160a01b031681565b3480156105d457600080fd5b506101305460ff16610269565b3480156105ed57600080fd5b5061029e6105fc36600461322b565b611585565b34801561060d57600080fd5b5061041b61061c36600461322b565b61019b602052600090815260409020546001600160a01b031681565b34801561064457600080fd5b5061041b61065336600461335a565b61019a602052600090815260409020546001600160a01b031681565b34801561067b57600080fd5b5061026961068a3660046133ea565b61164e565b34801561069b57600080fd5b5061029e6106aa366004613448565b611679565b3480156106bb57600080fd5b506103226106ca36600461322b565b611888565b3480156106db57600080fd5b50610322600081565b3480156106f057600080fd5b506103226101965481565b34801561070757600080fd5b506103226101975481565b34801561071e57600080fd5b5061029e61072d36600461322b565b6118b5565b34801561073e57600080fd5b5061029e61074d36600461322b565b61198c565b34801561075e57600080fd5b5061026961076d36600461322b565b611a70565b34801561077e57600080fd5b5061029e61078d3660046134a0565b611b27565b34801561079e57600080fd5b5061029e6107ad3660046133ea565b611bce565b3480156107be57600080fd5b5061029e611bea565b3480156107d357600080fd5b5061041b611c22565b3480156107e857600080fd5b506103226107f736600461322b565b6001600160a01b03166000908152610199602052604090205490565b34801561081f57600080fd5b50610322600080516020613aff83398151915281565b34801561084157600080fd5b5061029e610850366004613524565b611caf565b34801561086157600080fd5b5061087561087036600461322b565b611d04565b604051610275959493929190613583565b34801561089257600080fd5b506102696108a136600461322b565b611dc0565b3480156108b257600080fd5b5061029e6108c136600461335a565b611e33565b60006001600160e01b03198216637965db0b60e01b14806108f757506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020613aff83398151915261091581611e49565b811561092757610923611e53565b5050565b610923611ea8565b600080516020613abf83398151915261094781611e49565b61094f611ee2565b6001600160a01b0382166000908152610199602052604090206004015460ff166001146109975760405162461bcd60e51b815260040161098e906135bd565b60405180910390fd5b6001600160a01b03821660008181526101996020908152604091829020429081905591519182527fb2a82fce6d8c7a633efe9579f77b4edb96bfdf171a49bfc2ce666dc543a1f500910160405180910390a25050565b600080516020613abf833981519152610a0581611e49565b610a0d611ee2565b6109238246611f29565b600080516020613abf833981519152610a2f81611e49565b610a37611ee2565b6001600160a01b03821660008181526101996020526040808220600401805460ff191660ff179055517f44d5fe68b00f68950fb9c1ff0a61ef7f747b1a36359a7e3a7f3324db4b8789679190a25050565b600080516020613abf833981519152610aa081611e49565b610aa8611ee2565b610ab3838346612058565b505050565b60675460405163bf40fac160e01b815260206004820152600a60248201526921a7a72a2927a62622a960b11b60448201526001600160a01b039091169063bf40fac190606401602060405180830381865afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f91906135e6565b606580546001600160a01b0319166001600160a01b0392909216918217905560408051632d77bef360e11b81529051635aef7de6916004808201926020929091908290030181865afa158015610b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbd91906135e6565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260fe602052604090206001015490565b600080516020613abf833981519152610c0c81611e49565b610c14611ee2565b610923826120f9565b6000610c2881611e49565b6067546001600160a01b031615610c775760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015260640161098e565b610c8082612353565b606654610c98906000906001600160a01b0316612376565b606654610cbd90600080516020613aff833981519152906001600160a01b0316612376565b60665461092390600080516020613abf833981519152906001600160a01b0316612376565b604051806080016040528060478152602001613b3f6047913981565b6000610d0982610f56565b15610d12575090565b6001600160a01b03808316600090815261019b6020526040902054610d379116610f56565b15610d5c57506001600160a01b03908116600090815261019b60205260409020541690565b506000919050565b610d6d82610bdf565b610d7681611e49565b610ab3838361237c565b6001600160a01b0381163314610df05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161098e565b6109238282612402565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610e425760405162461bcd60e51b815260040161098e90613603565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610e74612469565b6001600160a01b031614610e9a5760405162461bcd60e51b815260040161098e9061363d565b610ea381612485565b60408051600080825260208201909252610ebf9183919061248d565b50565b6001600160a01b03818116600090815261019b602052604090205416331480610ef35750336001600160a01b038216145b610f2e5760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b604482015260640161098e565b6001600160a01b0316600090815261019b6020526040902080546001600160a01b0319169055565b6001600160a01b0381166000908152610199602052604081205481906201518090610f81904261368d565b610f8b91906136a0565b9050610198548111158015610fbf57506001600160a01b0383166000908152610199602052604090206004015460ff166001145b15610fcd5750600192915050565b61019c546001600160a01b03161561105d5761019c54604051633af32abf60e01b81526001600160a01b0390911690633af32abf906110109086906004016133d6565b602060405180830381865afa925050508015611049575060408051601f3d908101601f19168201909252611046918101906136c2565b60015b6110565750600092915050565b9392505050565b50600092915050565b600054610100900460ff16158080156110865750600054600160ff909116105b806110a75750611095306125f8565b1580156110a7575060005460ff166001145b61110a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098e565b6000805460ff19166001179055801561112d576000805461ff0019166101001790555b611135612607565b61113d61262e565b611184604051806040016040528060088152602001674964656e7469747960c01b815250604051806040016040528060058152602001640312e302e360dc1b815250612662565b610447610198556066546111a3906000906001600160a01b0316612376565b6111ae600084612376565b6066546111d390600080516020613aff833981519152906001600160a01b0316612376565b6111eb600080516020613aff83398151915284612376565b611203600080516020613abf83398151915284612376565b60665461122890600080516020613abf833981519152906001600160a01b0316612376565b61019c80546001600160a01b0319166001600160a01b0384161790558015610ab3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112d65760405162461bcd60e51b815260040161098e90613603565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611308612469565b6001600160a01b03161461132e5760405162461bcd60e51b815260040161098e9061363d565b61133782612485565b6109238282600161248d565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146113de5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b606482015260840161098e565b50600080516020613b1f83398151915290565b6001600160a01b03811660009081526101996020526040902060020180546060919061141c906136df565b80601f0160208091040260200160405190810160405280929190818152602001828054611448906136df565b80156114955780601f1061146a57610100808354040283529160200191611495565b820191906000526020600020905b81548152906001019060200180831161147857829003601f168201915b50508351602080860191909120600081815261019a909252604090912054949550936001600160a01b0380881691160392506114d49150505750919050565b61019c546001600160a01b03161561156f5761019c546040516354f9f7a360e01b81526001600160a01b03909116906354f9f7a3906115179086906004016133d6565b600060405180830381865afa92505050801561155557506040513d6000823e601f3d908101601f191682016040526115529190810190613719565b60015b611056575050604080516020810190915260008152919050565b5050604080516020810190915260008152919050565b600080516020613abf83398151915261159d81611e49565b6115a5611ee2565b813b6115f35760405162461bcd60e51b815260206004820152601f60248201527f476976656e2061646472657373206973206e6f74206120636f6e747261637400604482015260640161098e565b6115fd8246611f29565b6001600160a01b03821660008181526101996020526040808220600401805460ff19166002179055517f89c66952b48f3e96bf1d8ba1b63189520fd988a6979b8b740bd5c5d8dc53e2059190a25050565b600091825260fe602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61168233610f56565b61169e5760405162461bcd60e51b815260040161098e906135bd565b6000811180156116ae5750438110155b6116ed5760405162461bcd60e51b815260206004820152601060248201526f696e76616c696420646561646c696e6560801b604482015260640161098e565b6116f683610f56565b158015611709575061170783611dc0565b155b6117475760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081858d8dbdd5b9d608a1b604482015260640161098e565b6001600160a01b03838116600090815261019b602052604090205416156117a45760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4818dbdb9b9958dd1959607a1b604482015260640161098e565b600061180e604051806080016040528060478152602001613b3f604791398051602091820120604080519283019190915233908201526001600160a01b03861660608201526080810184905260a001604051602081830303815290604052805190602001206126a5565b905061181b8482856126f3565b61185b5760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b604482015260640161098e565b5050506001600160a01b0316600090815261019b6020526040902080546001600160a01b03191633179055565b6001600160a01b03811660009081526101996020526040902060030154806118b057466108f7565b919050565b600080516020613abf8339815191526118cd81611e49565b6118d5611ee2565b61019c546001600160a01b03161561194b5761019c5460405163c375c2ef60e01b81526001600160a01b039091169063c375c2ef906119189085906004016133d6565b600060405180830381600087803b15801561193257600080fd5b505af1158015611946573d6000803e3d6000fd5b505050505b611954826120f9565b6040516001600160a01b038316907f8d30d41865a0b811b9545d879520d2dde9f4cc49e4241f486ad9752bc904b56590600090a25050565b600080516020613abf8339815191526119a481611e49565b6119ac611ee2565b61019c546001600160a01b031615611a225761019c546040516363513b6160e11b81526001600160a01b039091169063c6a276c2906119ef9085906004016133d6565b600060405180830381600087803b158015611a0957600080fd5b505af1158015611a1d573d6000803e3d6000fd5b505050505b6001600160a01b03821660008181526101996020526040808220600401805460ff19169055517f1747ca720b1a174a464b6513ace29b1d3190b5f632b9f34147017c81425bfde89190a25050565b6001600160a01b0381166000908152610199602052604081206004015460ff16600203611a9f57506001919050565b61019c546001600160a01b031615610d5c5761019c5460405163639e625760e11b81526001600160a01b039091169063c73cc4ae90611ae29085906004016133d6565b602060405180830381865afa925050508015611b1b575060408051601f3d908101601f19168201909252611b18918101906136c2565b60015b6108f757506000919050565b336001600160a01b0384161480611b515750611b51600080516020613abf8339815191523361164e565b611b8e5760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015260640161098e565b610ab38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061283592505050565b611bd782610bdf565b611be081611e49565b610ab38383612402565b611bf2611ee2565b611bfb33610f56565b611c175760405162461bcd60e51b815260040161098e906135bd565b611c20336120f9565b565b60675460405163bf40fac160e01b815260206004820152600a60248201526923a7a7a22227a62620a960b11b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906135e6565b905090565b600080516020613abf833981519152611cc781611e49565b611ccf611ee2565b611cda858585612058565b8115611cfd576001600160a01b0385166000908152610199602052604090208290555b5050505050565b6101996020526000908152604090208054600182015460028301805492939192611d2d906136df565b80601f0160208091040260200160405190810160405280929190818152602001828054611d59906136df565b8015611da65780601f10611d7b57610100808354040283529160200191611da6565b820191906000526020600020905b815481529060010190602001808311611d8957829003601f168201915b50505050600383015460049093015491929160ff16905085565b6001600160a01b0381166000908152610199602052604081206004015460ff9081169003611df057506001919050565b61019c546001600160a01b031615610d5c5761019c5460405163fe575a8760e01b81526001600160a01b039091169063fe575a8790611ae29085906004016133d6565b611e3b611ee2565b611e43612ab5565b61019855565b610ebf8133612b78565b611e5b611ee2565b610130805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e913390565b604051611e9e91906133d6565b60405180910390a1565b611eb0612bd1565b610130805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611e91565b6101305460ff1615611c205760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161098e565b6001600160a01b0382166000908152610199602052604090206004015460ff1615611f8b5760405162461bcd60e51b8152602060048201526012602482015271616c7265616479206861732073746174757360701b604482015260640161098e565b60016101966000828254611f9f9190613786565b90915550506001600160a01b03821660009081526101996020908152604080832060048101805460ff1916600190811790915542908201819055815560030184905561019b909152902080546001600160a01b0319169055612001823b151590565b15612020576001610197600082825461201a9190613786565b90915550505b6040516001600160a01b038316907fee1504a83b6d4a361f4c1dc78ab59bfa30d6a3b6612c403e86bb01ef2984295f90600090a25050565b8151602080840191909120600081815261019a9092526040909120546001600160a01b03161561209a5760405162461bcd60e51b815260040161098e90613799565b6001600160a01b0384166000908152610199602052604090206002016120c08482613817565b50600081815261019a6020526040902080546001600160a01b0319166001600160a01b0386161790556120f38483611f29565b50505050565b6001600160a01b0381166000908152610199602052604090206004015460ff166001148061214657506001600160a01b0381166000908152610199602052604090206004015460ff166002145b156122e2576001610196600082825461215f919061368d565b9091555050803b151580156121775750600061019754115b156121965760016101976000828254612190919061368d565b90915550505b6001600160a01b03811660009081526101996020526040812060020180546121bd906136df565b80601f01602080910402602001604051908101604052809291908181526020018280546121e9906136df565b80156122365780601f1061220b57610100808354040283529160200191612236565b820191906000526020600020905b81548152906001019060200180831161221957829003601f168201915b505083516020808601919091206001600160a01b03881660009081526101999092526040822082815560018101839055959650949350915061227d90506002830182613173565b506000600382018190556004909101805460ff1916905581815261019a602052604080822080546001600160a01b0319169055516001600160a01b038516917f270d9b30cf5b0793bbfd54c9d5b94aeb49462b8148399000265144a8722da6b691a250505b61019c546001600160a01b031615610ebf5761019c5460405163291d954960e01b81526001600160a01b039091169063291d9549906123259084906004016133d6565b600060405180830381600087803b15801561233f57600080fd5b505af1158015611cfd573d6000803e3d6000fd5b606780546001600160a01b0319166001600160a01b038316179055610ebf610ab8565b61092382825b612386828261164e565b61092357600082815260fe602090815260408083206001600160a01b03851684529091529020805460ff191660011790556123be3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61240c828261164e565b1561092357600082815260fe602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020613b1f833981519152546001600160a01b031690565b610ebf612ab5565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156124c057610ab383612c1b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561251a575060408051601f3d908101601f19168201909252612517918101906138d6565b60015b61257d5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161098e565b600080516020613b1f83398151915281146125ec5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161098e565b50610ab3838383612cb5565b6001600160a01b03163b151590565b600054610100900460ff16611c205760405162461bcd60e51b815260040161098e906138ef565b600054610100900460ff166126555760405162461bcd60e51b815260040161098e906138ef565b610130805460ff19169055565b600054610100900460ff166126895760405162461bcd60e51b815260040161098e906138ef565b8151602092830120815191909201206101629190915561016355565b60006108f76126b2612cda565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006127028585612d57565b9092509050600081600481111561271b5761271b61393a565b1480156127395750856001600160a01b0316826001600160a01b0316145b1561274957600192505050611056565b600080876001600160a01b0316631626ba7e60e01b8888604051602401612771929190613950565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516127af9190613971565b600060405180830381855afa9150503d80600081146127ea576040519150601f19603f3d011682016040523d82523d6000602084013e6127ef565b606091505b5091509150818015612802575080516020145b801561282957508051630b135d3f60e11b9061282790830160209081019084016138d6565b145b98975050505050505050565b61283e82610f56565b61285a5760405162461bcd60e51b815260040161098e906135bd565b60008151116128975760405162461bcd60e51b815260206004820152600960248201526864696420656d70747960b81b604482015260640161098e565b8051602080830191909120600081815261019a9092526040909120546001600160a01b0316156128d95760405162461bcd60e51b815260040161098e90613799565b61019c546001600160a01b031615612a0b5761019c546040516367c7593760e01b8152600481018390526000916001600160a01b0316906367c7593790602401602060405180830381865afa925050508015612952575060408051601f3d908101601f1916820190925261294f918101906135e6565b60015b1561295a5790505b6001600160a01b03811615806129815750836001600160a01b0316816001600160a01b0316145b806129b257506001600160a01b03811660009081526101996020526040812060020180546129ae906136df565b9050115b612a095760405162461bcd60e51b815260206004820152602260248201527f44494420616c72656164792072656769737465726564206f6c644964656e7469604482015261747960f01b606482015260840161098e565b505b6001600160a01b038316600090815261019960205260408082209051612a34916002019061398d565b6040805191829003909120600081815261019a602090815283822080546001600160a01b03191690556001600160a01b0388168252610199905291909120909150600201612a828482613817565b5050600090815261019a6020526040902080546001600160a01b0319166001600160a01b03939093169290921790915550565b60655460408051632d77bef360e11b8152905133926001600160a01b031691635aef7de69160048083019260209291908290030181865afa158015612afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2291906135e6565b6001600160a01b031614611c205760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79206176617461722063616e2063616c6c2074686973206d6574686f64604482015260640161098e565b612b82828261164e565b61092357612b8f81612d9c565b612b9a836020612dae565b604051602001612bab929190613a03565b60408051601f198184030181529082905262461bcd60e51b825261098e916004016133c3565b6101305460ff16611c205760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161098e565b612c24816125f8565b612c865760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161098e565b600080516020613b1f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612cbe83612f49565b600082511180612ccb5750805b15610ab3576120f38383612f89565b6000611caa7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612d0a6101625490565b610163546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000808251604103612d8d5760208301516040840151606085015160001a612d818782858561307b565b94509450505050612d95565b506000905060025b9250929050565b60606108f76001600160a01b03831660145b60606000612dbd836002613a72565b612dc8906002613786565b6001600160401b03811115612ddf57612ddf613248565b6040519080825280601f01601f191660200182016040528015612e09576020820181803683370190505b509050600360fc1b81600081518110612e2457612e24613a91565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612e5357612e53613a91565b60200101906001600160f81b031916908160001a9053506000612e77846002613a72565b612e82906001613786565b90505b6001811115612efa576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612eb657612eb6613a91565b1a60f81b828281518110612ecc57612ecc613a91565b60200101906001600160f81b031916908160001a90535060049490941c93612ef381613aa7565b9050612e85565b5083156110565760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161098e565b612f5281612c1b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060612f94836125f8565b612fef5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161098e565b600080846001600160a01b03168460405161300a9190613971565b600060405180830381855af49150503d8060008114613045576040519150601f19603f3d011682016040523d82523d6000602084013e61304a565b606091505b50915091506130728282604051806060016040528060278152602001613b8660279139613135565b95945050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156130a8575060009050600361312c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156130fc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166131255760006001925092505061312c565b9150600090505b94509492505050565b60608315613144575081611056565b61105683838151156131595781518083602001fd5b8060405162461bcd60e51b815260040161098e91906133c3565b50805461317f906136df565b6000825580601f1061318f575050565b601f016020900490600052602060002090810190610ebf91905b808211156131bd57600081556001016131a9565b5090565b6000602082840312156131d357600080fd5b81356001600160e01b03198116811461105657600080fd5b8015158114610ebf57600080fd5b60006020828403121561320b57600080fd5b8135611056816131eb565b6001600160a01b0381168114610ebf57600080fd5b60006020828403121561323d57600080fd5b813561105681613216565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561328657613286613248565b604052919050565b60006001600160401b038211156132a7576132a7613248565b50601f01601f191660200190565b600082601f8301126132c657600080fd5b81356132d96132d48261328e565b61325e565b8181528460208386010111156132ee57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561331e57600080fd5b823561332981613216565b915060208301356001600160401b0381111561334457600080fd5b613350858286016132b5565b9150509250929050565b60006020828403121561336c57600080fd5b5035919050565b60005b8381101561338e578181015183820152602001613376565b50506000910152565b600081518084526133af816020860160208601613373565b601f01601f19169290920160200192915050565b6020815260006110566020830184613397565b6001600160a01b0391909116815260200190565b600080604083850312156133fd57600080fd5b82359150602083013561340f81613216565b809150509250929050565b6000806040838503121561342d57600080fd5b823561343881613216565b9150602083013561340f81613216565b60008060006060848603121561345d57600080fd5b833561346881613216565b925060208401356001600160401b0381111561348357600080fd5b61348f868287016132b5565b925050604084013590509250925092565b6000806000604084860312156134b557600080fd5b83356134c081613216565b925060208401356001600160401b03808211156134dc57600080fd5b818601915086601f8301126134f057600080fd5b8135818111156134ff57600080fd5b87602082850101111561351157600080fd5b6020830194508093505050509250925092565b6000806000806080858703121561353a57600080fd5b843561354581613216565b935060208501356001600160401b0381111561356057600080fd5b61356c878288016132b5565b949794965050505060408301359260600135919050565b85815284602082015260a0604082015260006135a260a0830186613397565b905083606083015260ff831660808301529695505050505050565b6020808252600f908201526e1b9bdd081dda1a5d195b1a5cdd1959608a1b604082015260600190565b6000602082840312156135f857600080fd5b815161105681613216565b6020808252602c90820152600080516020613adf83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020613adf83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b818103818111156108f7576108f7613677565b6000826136bd57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156136d457600080fd5b8151611056816131eb565b600181811c908216806136f357607f821691505b60208210810361371357634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561372b57600080fd5b81516001600160401b0381111561374157600080fd5b8201601f8101841361375257600080fd5b80516137606132d48261328e565b81815285602083850101111561377557600080fd5b613072826020830160208601613373565b808201808211156108f7576108f7613677565b60208082526016908201527511125108185b1c9958591e481c9959da5cdd195c995960521b604082015260600190565b601f821115610ab357600081815260208120601f850160051c810160208610156137f05750805b601f850160051c820191505b8181101561380f578281556001016137fc565b505050505050565b81516001600160401b0381111561383057613830613248565b6138448161383e84546136df565b846137c9565b602080601f83116001811461387957600084156138615750858301515b600019600386901b1c1916600185901b17855561380f565b600085815260208120601f198616915b828110156138a857888601518255948401946001909101908401613889565b50858210156138c65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156138e857600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b8281526040602082015260006139696040830184613397565b949350505050565b60008251613983818460208701613373565b9190910192915050565b600080835461399b816136df565b600182811680156139b357600181146139c8576139f7565b60ff19841687528215158302870194506139f7565b8760005260208060002060005b858110156139ee5781548a8201529084019082016139d5565b50505082870194505b50929695505050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613a35816017850160208801613373565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613a66816028840160208801613373565b01602801949350505050565b6000816000190483118215151615613a8c57613a8c613677565b500290565b634e487b7160e01b600052603260045260246000fd5b600081613ab657613ab6613677565b50600019019056fe091941537c453917ef5b0c67f46f29060aca926ebd752fe441d5625e85c3a57646756e6374696f6e206d7573742062652063616c6c6564207468726f756768200b0f1f48172a2124d5545a38711e7e9d2e7a6c0b46b85cf1c1788e7a11ba5bf2360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc436f6e6e6563744964656e7469747928616464726573732077686974656c69737465642c6164647265737320636f6e6e65637465642c75696e7432353620646561646c696e6529416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d6561f0047f20000f85b1879398091adc0de028126bc09e8b4602ea84bbbedef64736f6c63430008100033

Deployed ByteCode

0x6080604052600436106102445760003560e01c806301ffc9a71461024957806302329a291461027e57806308e0d29d146102a057806310154bad146102c0578063188efc16146102e05780631aaff63c146103005780631b027099146103305780631b3c90a8146103505780632236684414610365578063248a9ca314610379578063291d9549146103995780632b14dda8146103b95780632cec5330146103d95780632d0e9b46146103fb5780632f2ff15d1461042857806331b376e21461044857806336568abe1461045f5780633659cfe61461047f57806337a1a9871461049f5780633af32abf146104bf5780633e6326fc146104df5780634125f0f2146104ff5780634162169f14610520578063485cc955146105405780634f1ef2861461056057806352d1902d1461057357806354f9f7a3146105885780635aef7de6146105a85780635c975abb146105c85780635f539d69146105e1578063613200401461060157806367c759371461063857806391d148541461066f57806393ce7f001461068f578063a061922d146106af578063a217fddf146106cf578063b2a1de22146106e4578063b30f7e7f146106fb578063c375c2ef14610712578063c6a276c214610732578063c73cc4ae14610752578063d326281614610772578063d547741f14610792578063d6cd9473146107b2578063e1758bd8146107c7578063e1e360ba146107dc578063e63ab1e914610813578063e737031a14610835578063f653b81e14610855578063fe575a8714610886578063fff930d4146108a6575b600080fd5b34801561025557600080fd5b506102696102643660046131c1565b6108c6565b60405190151581526020015b60405180910390f35b34801561028a57600080fd5b5061029e6102993660046131f9565b6108fd565b005b3480156102ac57600080fd5b5061029e6102bb36600461322b565b61092f565b3480156102cc57600080fd5b5061029e6102db36600461322b565b6109ed565b3480156102ec57600080fd5b5061029e6102fb36600461322b565b610a17565b34801561030c57600080fd5b50610322600080516020613abf83398151915281565b604051908152602001610275565b34801561033c57600080fd5b5061029e61034b36600461330b565b610a88565b34801561035c57600080fd5b5061029e610ab8565b34801561037157600080fd5b506001610269565b34801561038557600080fd5b5061032261039436600461335a565b610bdf565b3480156103a557600080fd5b5061029e6103b436600461322b565b610bf4565b3480156103c557600080fd5b5061029e6103d436600461322b565b610c1d565b3480156103e557600080fd5b506103ee610ce2565b60405161027591906133c3565b34801561040757600080fd5b5061041b61041636600461322b565b610cfe565b60405161027591906133d6565b34801561043457600080fd5b5061029e6104433660046133ea565b610d64565b34801561045457600080fd5b506103226101985481565b34801561046b57600080fd5b5061029e61047a3660046133ea565b610d80565b34801561048b57600080fd5b5061029e61049a36600461322b565b610dfa565b3480156104ab57600080fd5b5061029e6104ba36600461322b565b610ec2565b3480156104cb57600080fd5b506102696104da36600461322b565b610f56565b3480156104eb57600080fd5b5060675461041b906001600160a01b031681565b34801561050b57600080fd5b5061019c5461041b906001600160a01b031681565b34801561052c57600080fd5b5060655461041b906001600160a01b031681565b34801561054c57600080fd5b5061029e61055b36600461341a565b611066565b61029e61056e36600461330b565b61128e565b34801561057f57600080fd5b50610322611343565b34801561059457600080fd5b506103ee6105a336600461322b565b6113f1565b3480156105b457600080fd5b5060665461041b906001600160a01b031681565b3480156105d457600080fd5b506101305460ff16610269565b3480156105ed57600080fd5b5061029e6105fc36600461322b565b611585565b34801561060d57600080fd5b5061041b61061c36600461322b565b61019b602052600090815260409020546001600160a01b031681565b34801561064457600080fd5b5061041b61065336600461335a565b61019a602052600090815260409020546001600160a01b031681565b34801561067b57600080fd5b5061026961068a3660046133ea565b61164e565b34801561069b57600080fd5b5061029e6106aa366004613448565b611679565b3480156106bb57600080fd5b506103226106ca36600461322b565b611888565b3480156106db57600080fd5b50610322600081565b3480156106f057600080fd5b506103226101965481565b34801561070757600080fd5b506103226101975481565b34801561071e57600080fd5b5061029e61072d36600461322b565b6118b5565b34801561073e57600080fd5b5061029e61074d36600461322b565b61198c565b34801561075e57600080fd5b5061026961076d36600461322b565b611a70565b34801561077e57600080fd5b5061029e61078d3660046134a0565b611b27565b34801561079e57600080fd5b5061029e6107ad3660046133ea565b611bce565b3480156107be57600080fd5b5061029e611bea565b3480156107d357600080fd5b5061041b611c22565b3480156107e857600080fd5b506103226107f736600461322b565b6001600160a01b03166000908152610199602052604090205490565b34801561081f57600080fd5b50610322600080516020613aff83398151915281565b34801561084157600080fd5b5061029e610850366004613524565b611caf565b34801561086157600080fd5b5061087561087036600461322b565b611d04565b604051610275959493929190613583565b34801561089257600080fd5b506102696108a136600461322b565b611dc0565b3480156108b257600080fd5b5061029e6108c136600461335a565b611e33565b60006001600160e01b03198216637965db0b60e01b14806108f757506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020613aff83398151915261091581611e49565b811561092757610923611e53565b5050565b610923611ea8565b600080516020613abf83398151915261094781611e49565b61094f611ee2565b6001600160a01b0382166000908152610199602052604090206004015460ff166001146109975760405162461bcd60e51b815260040161098e906135bd565b60405180910390fd5b6001600160a01b03821660008181526101996020908152604091829020429081905591519182527fb2a82fce6d8c7a633efe9579f77b4edb96bfdf171a49bfc2ce666dc543a1f500910160405180910390a25050565b600080516020613abf833981519152610a0581611e49565b610a0d611ee2565b6109238246611f29565b600080516020613abf833981519152610a2f81611e49565b610a37611ee2565b6001600160a01b03821660008181526101996020526040808220600401805460ff191660ff179055517f44d5fe68b00f68950fb9c1ff0a61ef7f747b1a36359a7e3a7f3324db4b8789679190a25050565b600080516020613abf833981519152610aa081611e49565b610aa8611ee2565b610ab3838346612058565b505050565b60675460405163bf40fac160e01b815260206004820152600a60248201526921a7a72a2927a62622a960b11b60448201526001600160a01b039091169063bf40fac190606401602060405180830381865afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f91906135e6565b606580546001600160a01b0319166001600160a01b0392909216918217905560408051632d77bef360e11b81529051635aef7de6916004808201926020929091908290030181865afa158015610b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbd91906135e6565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260fe602052604090206001015490565b600080516020613abf833981519152610c0c81611e49565b610c14611ee2565b610923826120f9565b6000610c2881611e49565b6067546001600160a01b031615610c775760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015260640161098e565b610c8082612353565b606654610c98906000906001600160a01b0316612376565b606654610cbd90600080516020613aff833981519152906001600160a01b0316612376565b60665461092390600080516020613abf833981519152906001600160a01b0316612376565b604051806080016040528060478152602001613b3f6047913981565b6000610d0982610f56565b15610d12575090565b6001600160a01b03808316600090815261019b6020526040902054610d379116610f56565b15610d5c57506001600160a01b03908116600090815261019b60205260409020541690565b506000919050565b610d6d82610bdf565b610d7681611e49565b610ab3838361237c565b6001600160a01b0381163314610df05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161098e565b6109238282612402565b6001600160a01b037f000000000000000000000000284a775f971c58c93cc5ee2a09a5f3496af9b11d163003610e425760405162461bcd60e51b815260040161098e90613603565b7f000000000000000000000000284a775f971c58c93cc5ee2a09a5f3496af9b11d6001600160a01b0316610e74612469565b6001600160a01b031614610e9a5760405162461bcd60e51b815260040161098e9061363d565b610ea381612485565b60408051600080825260208201909252610ebf9183919061248d565b50565b6001600160a01b03818116600090815261019b602052604090205416331480610ef35750336001600160a01b038216145b610f2e5760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b604482015260640161098e565b6001600160a01b0316600090815261019b6020526040902080546001600160a01b0319169055565b6001600160a01b0381166000908152610199602052604081205481906201518090610f81904261368d565b610f8b91906136a0565b9050610198548111158015610fbf57506001600160a01b0383166000908152610199602052604090206004015460ff166001145b15610fcd5750600192915050565b61019c546001600160a01b03161561105d5761019c54604051633af32abf60e01b81526001600160a01b0390911690633af32abf906110109086906004016133d6565b602060405180830381865afa925050508015611049575060408051601f3d908101601f19168201909252611046918101906136c2565b60015b6110565750600092915050565b9392505050565b50600092915050565b600054610100900460ff16158080156110865750600054600160ff909116105b806110a75750611095306125f8565b1580156110a7575060005460ff166001145b61110a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098e565b6000805460ff19166001179055801561112d576000805461ff0019166101001790555b611135612607565b61113d61262e565b611184604051806040016040528060088152602001674964656e7469747960c01b815250604051806040016040528060058152602001640312e302e360dc1b815250612662565b610447610198556066546111a3906000906001600160a01b0316612376565b6111ae600084612376565b6066546111d390600080516020613aff833981519152906001600160a01b0316612376565b6111eb600080516020613aff83398151915284612376565b611203600080516020613abf83398151915284612376565b60665461122890600080516020613abf833981519152906001600160a01b0316612376565b61019c80546001600160a01b0319166001600160a01b0384161790558015610ab3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6001600160a01b037f000000000000000000000000284a775f971c58c93cc5ee2a09a5f3496af9b11d1630036112d65760405162461bcd60e51b815260040161098e90613603565b7f000000000000000000000000284a775f971c58c93cc5ee2a09a5f3496af9b11d6001600160a01b0316611308612469565b6001600160a01b03161461132e5760405162461bcd60e51b815260040161098e9061363d565b61133782612485565b6109238282600161248d565b6000306001600160a01b037f000000000000000000000000284a775f971c58c93cc5ee2a09a5f3496af9b11d16146113de5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b606482015260840161098e565b50600080516020613b1f83398151915290565b6001600160a01b03811660009081526101996020526040902060020180546060919061141c906136df565b80601f0160208091040260200160405190810160405280929190818152602001828054611448906136df565b80156114955780601f1061146a57610100808354040283529160200191611495565b820191906000526020600020905b81548152906001019060200180831161147857829003601f168201915b50508351602080860191909120600081815261019a909252604090912054949550936001600160a01b0380881691160392506114d49150505750919050565b61019c546001600160a01b03161561156f5761019c546040516354f9f7a360e01b81526001600160a01b03909116906354f9f7a3906115179086906004016133d6565b600060405180830381865afa92505050801561155557506040513d6000823e601f3d908101601f191682016040526115529190810190613719565b60015b611056575050604080516020810190915260008152919050565b5050604080516020810190915260008152919050565b600080516020613abf83398151915261159d81611e49565b6115a5611ee2565b813b6115f35760405162461bcd60e51b815260206004820152601f60248201527f476976656e2061646472657373206973206e6f74206120636f6e747261637400604482015260640161098e565b6115fd8246611f29565b6001600160a01b03821660008181526101996020526040808220600401805460ff19166002179055517f89c66952b48f3e96bf1d8ba1b63189520fd988a6979b8b740bd5c5d8dc53e2059190a25050565b600091825260fe602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61168233610f56565b61169e5760405162461bcd60e51b815260040161098e906135bd565b6000811180156116ae5750438110155b6116ed5760405162461bcd60e51b815260206004820152601060248201526f696e76616c696420646561646c696e6560801b604482015260640161098e565b6116f683610f56565b158015611709575061170783611dc0565b155b6117475760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081858d8dbdd5b9d608a1b604482015260640161098e565b6001600160a01b03838116600090815261019b602052604090205416156117a45760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4818dbdb9b9958dd1959607a1b604482015260640161098e565b600061180e604051806080016040528060478152602001613b3f604791398051602091820120604080519283019190915233908201526001600160a01b03861660608201526080810184905260a001604051602081830303815290604052805190602001206126a5565b905061181b8482856126f3565b61185b5760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b604482015260640161098e565b5050506001600160a01b0316600090815261019b6020526040902080546001600160a01b03191633179055565b6001600160a01b03811660009081526101996020526040902060030154806118b057466108f7565b919050565b600080516020613abf8339815191526118cd81611e49565b6118d5611ee2565b61019c546001600160a01b03161561194b5761019c5460405163c375c2ef60e01b81526001600160a01b039091169063c375c2ef906119189085906004016133d6565b600060405180830381600087803b15801561193257600080fd5b505af1158015611946573d6000803e3d6000fd5b505050505b611954826120f9565b6040516001600160a01b038316907f8d30d41865a0b811b9545d879520d2dde9f4cc49e4241f486ad9752bc904b56590600090a25050565b600080516020613abf8339815191526119a481611e49565b6119ac611ee2565b61019c546001600160a01b031615611a225761019c546040516363513b6160e11b81526001600160a01b039091169063c6a276c2906119ef9085906004016133d6565b600060405180830381600087803b158015611a0957600080fd5b505af1158015611a1d573d6000803e3d6000fd5b505050505b6001600160a01b03821660008181526101996020526040808220600401805460ff19169055517f1747ca720b1a174a464b6513ace29b1d3190b5f632b9f34147017c81425bfde89190a25050565b6001600160a01b0381166000908152610199602052604081206004015460ff16600203611a9f57506001919050565b61019c546001600160a01b031615610d5c5761019c5460405163639e625760e11b81526001600160a01b039091169063c73cc4ae90611ae29085906004016133d6565b602060405180830381865afa925050508015611b1b575060408051601f3d908101601f19168201909252611b18918101906136c2565b60015b6108f757506000919050565b336001600160a01b0384161480611b515750611b51600080516020613abf8339815191523361164e565b611b8e5760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015260640161098e565b610ab38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061283592505050565b611bd782610bdf565b611be081611e49565b610ab38383612402565b611bf2611ee2565b611bfb33610f56565b611c175760405162461bcd60e51b815260040161098e906135bd565b611c20336120f9565b565b60675460405163bf40fac160e01b815260206004820152600a60248201526923a7a7a22227a62620a960b11b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906135e6565b905090565b600080516020613abf833981519152611cc781611e49565b611ccf611ee2565b611cda858585612058565b8115611cfd576001600160a01b0385166000908152610199602052604090208290555b5050505050565b6101996020526000908152604090208054600182015460028301805492939192611d2d906136df565b80601f0160208091040260200160405190810160405280929190818152602001828054611d59906136df565b8015611da65780601f10611d7b57610100808354040283529160200191611da6565b820191906000526020600020905b815481529060010190602001808311611d8957829003601f168201915b50505050600383015460049093015491929160ff16905085565b6001600160a01b0381166000908152610199602052604081206004015460ff9081169003611df057506001919050565b61019c546001600160a01b031615610d5c5761019c5460405163fe575a8760e01b81526001600160a01b039091169063fe575a8790611ae29085906004016133d6565b611e3b611ee2565b611e43612ab5565b61019855565b610ebf8133612b78565b611e5b611ee2565b610130805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e913390565b604051611e9e91906133d6565b60405180910390a1565b611eb0612bd1565b610130805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611e91565b6101305460ff1615611c205760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161098e565b6001600160a01b0382166000908152610199602052604090206004015460ff1615611f8b5760405162461bcd60e51b8152602060048201526012602482015271616c7265616479206861732073746174757360701b604482015260640161098e565b60016101966000828254611f9f9190613786565b90915550506001600160a01b03821660009081526101996020908152604080832060048101805460ff1916600190811790915542908201819055815560030184905561019b909152902080546001600160a01b0319169055612001823b151590565b15612020576001610197600082825461201a9190613786565b90915550505b6040516001600160a01b038316907fee1504a83b6d4a361f4c1dc78ab59bfa30d6a3b6612c403e86bb01ef2984295f90600090a25050565b8151602080840191909120600081815261019a9092526040909120546001600160a01b03161561209a5760405162461bcd60e51b815260040161098e90613799565b6001600160a01b0384166000908152610199602052604090206002016120c08482613817565b50600081815261019a6020526040902080546001600160a01b0319166001600160a01b0386161790556120f38483611f29565b50505050565b6001600160a01b0381166000908152610199602052604090206004015460ff166001148061214657506001600160a01b0381166000908152610199602052604090206004015460ff166002145b156122e2576001610196600082825461215f919061368d565b9091555050803b151580156121775750600061019754115b156121965760016101976000828254612190919061368d565b90915550505b6001600160a01b03811660009081526101996020526040812060020180546121bd906136df565b80601f01602080910402602001604051908101604052809291908181526020018280546121e9906136df565b80156122365780601f1061220b57610100808354040283529160200191612236565b820191906000526020600020905b81548152906001019060200180831161221957829003601f168201915b505083516020808601919091206001600160a01b03881660009081526101999092526040822082815560018101839055959650949350915061227d90506002830182613173565b506000600382018190556004909101805460ff1916905581815261019a602052604080822080546001600160a01b0319169055516001600160a01b038516917f270d9b30cf5b0793bbfd54c9d5b94aeb49462b8148399000265144a8722da6b691a250505b61019c546001600160a01b031615610ebf5761019c5460405163291d954960e01b81526001600160a01b039091169063291d9549906123259084906004016133d6565b600060405180830381600087803b15801561233f57600080fd5b505af1158015611cfd573d6000803e3d6000fd5b606780546001600160a01b0319166001600160a01b038316179055610ebf610ab8565b61092382825b612386828261164e565b61092357600082815260fe602090815260408083206001600160a01b03851684529091529020805460ff191660011790556123be3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61240c828261164e565b1561092357600082815260fe602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020613b1f833981519152546001600160a01b031690565b610ebf612ab5565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156124c057610ab383612c1b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561251a575060408051601f3d908101601f19168201909252612517918101906138d6565b60015b61257d5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161098e565b600080516020613b1f83398151915281146125ec5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161098e565b50610ab3838383612cb5565b6001600160a01b03163b151590565b600054610100900460ff16611c205760405162461bcd60e51b815260040161098e906138ef565b600054610100900460ff166126555760405162461bcd60e51b815260040161098e906138ef565b610130805460ff19169055565b600054610100900460ff166126895760405162461bcd60e51b815260040161098e906138ef565b8151602092830120815191909201206101629190915561016355565b60006108f76126b2612cda565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006127028585612d57565b9092509050600081600481111561271b5761271b61393a565b1480156127395750856001600160a01b0316826001600160a01b0316145b1561274957600192505050611056565b600080876001600160a01b0316631626ba7e60e01b8888604051602401612771929190613950565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516127af9190613971565b600060405180830381855afa9150503d80600081146127ea576040519150601f19603f3d011682016040523d82523d6000602084013e6127ef565b606091505b5091509150818015612802575080516020145b801561282957508051630b135d3f60e11b9061282790830160209081019084016138d6565b145b98975050505050505050565b61283e82610f56565b61285a5760405162461bcd60e51b815260040161098e906135bd565b60008151116128975760405162461bcd60e51b815260206004820152600960248201526864696420656d70747960b81b604482015260640161098e565b8051602080830191909120600081815261019a9092526040909120546001600160a01b0316156128d95760405162461bcd60e51b815260040161098e90613799565b61019c546001600160a01b031615612a0b5761019c546040516367c7593760e01b8152600481018390526000916001600160a01b0316906367c7593790602401602060405180830381865afa925050508015612952575060408051601f3d908101601f1916820190925261294f918101906135e6565b60015b1561295a5790505b6001600160a01b03811615806129815750836001600160a01b0316816001600160a01b0316145b806129b257506001600160a01b03811660009081526101996020526040812060020180546129ae906136df565b9050115b612a095760405162461bcd60e51b815260206004820152602260248201527f44494420616c72656164792072656769737465726564206f6c644964656e7469604482015261747960f01b606482015260840161098e565b505b6001600160a01b038316600090815261019960205260408082209051612a34916002019061398d565b6040805191829003909120600081815261019a602090815283822080546001600160a01b03191690556001600160a01b0388168252610199905291909120909150600201612a828482613817565b5050600090815261019a6020526040902080546001600160a01b0319166001600160a01b03939093169290921790915550565b60655460408051632d77bef360e11b8152905133926001600160a01b031691635aef7de69160048083019260209291908290030181865afa158015612afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2291906135e6565b6001600160a01b031614611c205760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79206176617461722063616e2063616c6c2074686973206d6574686f64604482015260640161098e565b612b82828261164e565b61092357612b8f81612d9c565b612b9a836020612dae565b604051602001612bab929190613a03565b60408051601f198184030181529082905262461bcd60e51b825261098e916004016133c3565b6101305460ff16611c205760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161098e565b612c24816125f8565b612c865760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161098e565b600080516020613b1f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612cbe83612f49565b600082511180612ccb5750805b15610ab3576120f38383612f89565b6000611caa7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612d0a6101625490565b610163546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000808251604103612d8d5760208301516040840151606085015160001a612d818782858561307b565b94509450505050612d95565b506000905060025b9250929050565b60606108f76001600160a01b03831660145b60606000612dbd836002613a72565b612dc8906002613786565b6001600160401b03811115612ddf57612ddf613248565b6040519080825280601f01601f191660200182016040528015612e09576020820181803683370190505b509050600360fc1b81600081518110612e2457612e24613a91565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612e5357612e53613a91565b60200101906001600160f81b031916908160001a9053506000612e77846002613a72565b612e82906001613786565b90505b6001811115612efa576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612eb657612eb6613a91565b1a60f81b828281518110612ecc57612ecc613a91565b60200101906001600160f81b031916908160001a90535060049490941c93612ef381613aa7565b9050612e85565b5083156110565760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161098e565b612f5281612c1b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060612f94836125f8565b612fef5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161098e565b600080846001600160a01b03168460405161300a9190613971565b600060405180830381855af49150503d8060008114613045576040519150601f19603f3d011682016040523d82523d6000602084013e61304a565b606091505b50915091506130728282604051806060016040528060278152602001613b8660279139613135565b95945050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156130a8575060009050600361312c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156130fc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166131255760006001925092505061312c565b9150600090505b94509492505050565b60608315613144575081611056565b61105683838151156131595781518083602001fd5b8060405162461bcd60e51b815260040161098e91906133c3565b50805461317f906136df565b6000825580601f1061318f575050565b601f016020900490600052602060002090810190610ebf91905b808211156131bd57600081556001016131a9565b5090565b6000602082840312156131d357600080fd5b81356001600160e01b03198116811461105657600080fd5b8015158114610ebf57600080fd5b60006020828403121561320b57600080fd5b8135611056816131eb565b6001600160a01b0381168114610ebf57600080fd5b60006020828403121561323d57600080fd5b813561105681613216565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561328657613286613248565b604052919050565b60006001600160401b038211156132a7576132a7613248565b50601f01601f191660200190565b600082601f8301126132c657600080fd5b81356132d96132d48261328e565b61325e565b8181528460208386010111156132ee57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561331e57600080fd5b823561332981613216565b915060208301356001600160401b0381111561334457600080fd5b613350858286016132b5565b9150509250929050565b60006020828403121561336c57600080fd5b5035919050565b60005b8381101561338e578181015183820152602001613376565b50506000910152565b600081518084526133af816020860160208601613373565b601f01601f19169290920160200192915050565b6020815260006110566020830184613397565b6001600160a01b0391909116815260200190565b600080604083850312156133fd57600080fd5b82359150602083013561340f81613216565b809150509250929050565b6000806040838503121561342d57600080fd5b823561343881613216565b9150602083013561340f81613216565b60008060006060848603121561345d57600080fd5b833561346881613216565b925060208401356001600160401b0381111561348357600080fd5b61348f868287016132b5565b925050604084013590509250925092565b6000806000604084860312156134b557600080fd5b83356134c081613216565b925060208401356001600160401b03808211156134dc57600080fd5b818601915086601f8301126134f057600080fd5b8135818111156134ff57600080fd5b87602082850101111561351157600080fd5b6020830194508093505050509250925092565b6000806000806080858703121561353a57600080fd5b843561354581613216565b935060208501356001600160401b0381111561356057600080fd5b61356c878288016132b5565b949794965050505060408301359260600135919050565b85815284602082015260a0604082015260006135a260a0830186613397565b905083606083015260ff831660808301529695505050505050565b6020808252600f908201526e1b9bdd081dda1a5d195b1a5cdd1959608a1b604082015260600190565b6000602082840312156135f857600080fd5b815161105681613216565b6020808252602c90820152600080516020613adf83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020613adf83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b818103818111156108f7576108f7613677565b6000826136bd57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156136d457600080fd5b8151611056816131eb565b600181811c908216806136f357607f821691505b60208210810361371357634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561372b57600080fd5b81516001600160401b0381111561374157600080fd5b8201601f8101841361375257600080fd5b80516137606132d48261328e565b81815285602083850101111561377557600080fd5b613072826020830160208601613373565b808201808211156108f7576108f7613677565b60208082526016908201527511125108185b1c9958591e481c9959da5cdd195c995960521b604082015260600190565b601f821115610ab357600081815260208120601f850160051c810160208610156137f05750805b601f850160051c820191505b8181101561380f578281556001016137fc565b505050505050565b81516001600160401b0381111561383057613830613248565b6138448161383e84546136df565b846137c9565b602080601f83116001811461387957600084156138615750858301515b600019600386901b1c1916600185901b17855561380f565b600085815260208120601f198616915b828110156138a857888601518255948401946001909101908401613889565b50858210156138c65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156138e857600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b8281526040602082015260006139696040830184613397565b949350505050565b60008251613983818460208701613373565b9190910192915050565b600080835461399b816136df565b600182811680156139b357600181146139c8576139f7565b60ff19841687528215158302870194506139f7565b8760005260208060002060005b858110156139ee5781548a8201529084019082016139d5565b50505082870194505b50929695505050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613a35816017850160208801613373565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613a66816028840160208801613373565b01602801949350505050565b6000816000190483118215151615613a8c57613a8c613677565b500290565b634e487b7160e01b600052603260045260246000fd5b600081613ab657613ab6613677565b50600019019056fe091941537c453917ef5b0c67f46f29060aca926ebd752fe441d5625e85c3a57646756e6374696f6e206d7573742062652063616c6c6564207468726f756768200b0f1f48172a2124d5545a38711e7e9d2e7a6c0b46b85cf1c1788e7a11ba5bf2360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc436f6e6e6563744964656e7469747928616464726573732077686974656c69737465642c6164647265737320636f6e6e65637465642c75696e7432353620646561646c696e6529416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d6561f0047f20000f85b1879398091adc0de028126bc09e8b4602ea84bbbedef64736f6c63430008100033