Address Details
contract

0x0cB76de990330b36B72C9B604A71D24eaA45Ebf4

Contract Name
Faucet
Creator
0x5128e3–22e4bb at 0x939dac–5f0011
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
28777426
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
Faucet




Optimization enabled
true
Compiler version
v0.8.19+commit.7dd6d404




Optimization runs
0
EVM Version
paris




Verified at
2023-12-21T22:57:53.555362Z

project:/contracts/fuseFaucet/Faucet.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 "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "../Interfaces.sol";
import "../utils/NameService.sol";

/**
 * @title FuseFaucet contract that can top up users wallets
 */
contract Faucet is Initializable, UUPSUpgradeable, AccessControlUpgradeable {
	bytes32 public constant RELAYER_ROLE = keccak256("relayer");

	event WalletTopped(
		address indexed account, //address topped
		uint256 amount,
		address whitelistedRoot, //if account is connected to a whitelisted account, this will be it
		address indexed relayerOrWhitelisted //the sender of the tx
	);

	uint256 public perDayRoughLimit;
	uint256 public gasTopping;
	uint256 public gasRefund;
	uint256 public startTime;
	uint256 public currentDay;

	NameService public nameService;

	mapping(uint256 => mapping(address => uint256)) public toppings;
	mapping(address => bool) public notFirstTime;

	struct Wallet {
		uint128 lastDayTopped;
		uint32 dailyToppingCount;
		uint128[7] lastWeekToppings;
	}

	mapping(address => Wallet) public wallets;
	uint32 public maxDailyToppings;
	uint64 public gasPrice;
	uint32 public maxPerWeekMultiplier;
	uint32 public maxSwapAmount_unused; // kept because of upgrades layout
	address public goodDollar_unused; //kept because of upgrades
	uint64 public maxDailyNewWallets;
	uint64 public dailyNewWalletsCount;
	uint32 public version;
	uint8 public minTopping; //percentage of topping amount, that user can request to top

	function initialize(
		NameService _ns,
		uint64 _gasPrice,
		address relayer,
		address owner
	) public initializer {
		__AccessControl_init_unchained();
		_setupRole(DEFAULT_ADMIN_ROLE, owner);
		if (relayer != address(0)) _setupRole(RELAYER_ROLE, relayer);
		gasPrice = _gasPrice;
		gasTopping = 1000000; //1m gwei
		perDayRoughLimit = 2 * gasTopping;
		maxDailyToppings = 3;
		startTime = block.timestamp;
		nameService = _ns;
		maxPerWeekMultiplier = 2;
		maxDailyNewWallets = 5000;
		minTopping = 15;
	}

	function _authorizeUpgrade(
		address newImplementation
	) internal override onlyRole(DEFAULT_ADMIN_ROLE) {}

	function getIdentity() public view returns (IIdentityV2) {
		return IIdentityV2(nameService.getAddress("IDENTITY"));
	}

	modifier reimburseGas() {
		uint256 _gasRefund = gasleft();
		_;
		_gasRefund = _gasRefund - gasleft() + 42000;
		payable(msg.sender).transfer(_gasRefund * gasPrice); //gas price assumed 1e9 = 1gwei
	}

	receive() external payable {}

	/*
	 * only whitelisted account or relayer can top non whitelisted accounts
	 * if target account is whitelisted anyone can top it
	 */
	modifier onlyAuthorized(address toTop) {
		require(
			getIdentity().getWhitelistedRoot(toTop) != address(0) ||
				hasRole(RELAYER_ROLE, msg.sender),
			"not authorized"
		);
		_;
	}

	modifier toppingLimit(address _user) {
		//switch wallet to the account we do the accounting for
		address whitelistedRoot = getIdentity().getWhitelistedRoot(_user);
		_user = whitelistedRoot == address(0) ? _user : payable(whitelistedRoot);

		uint256 prevDay = currentDay;

		setDay();
		if (currentDay != prevDay) dailyNewWalletsCount = 0;

		require(
			wallets[_user].lastDayTopped != uint128(currentDay) ||
				wallets[_user].dailyToppingCount < maxDailyToppings,
			"max daily toppings"
		);

		require(
			(notFirstTime[_user] == false &&
				dailyNewWalletsCount < maxDailyNewWallets) ||
				whitelistedRoot != address(0),
			"User not whitelisted or not first time"
		);

		//reset inactive days
		uint256 dayOfWeek = currentDay % 7;
		uint256 dayDiff = (currentDay - wallets[_user].lastDayTopped);
		dayDiff = dayDiff > 7 ? 7 : dayDiff;
		dayDiff = dayDiff > dayOfWeek ? dayOfWeek + 1 : dayDiff;
		for (uint256 day = dayOfWeek + 1 - dayDiff; day <= dayOfWeek; day++) {
			wallets[_user].lastWeekToppings[day] = 0;
		}

		uint128 weekTotal = 0;
		for (uint256 i = 0; i <= dayOfWeek; i++) {
			weekTotal += wallets[_user].lastWeekToppings[uint256(i)];
		}

		require(
			weekTotal < perDayRoughLimit * gasPrice * maxPerWeekMultiplier,
			"User wallet has been topped too many times this week"
		);
		_;
	}

	/* @dev Internal function that sets current day
	 */
	function setDay() internal {
		currentDay = (block.timestamp - startTime) / 1 days;
	}

	function canTop(address _user) external view returns (bool) {
		if (getToppingAmount() < address(_user).balance) return false;
		uint256 toTop = getToppingAmount() - address(_user).balance;
		if ((toTop * 100) / getToppingAmount() < minTopping) return false;

		address whitelistedRoot = getIdentity().getWhitelistedRoot(_user);
		_user = whitelistedRoot == address(0) ? _user : whitelistedRoot;

		uint256 _currentDay = (block.timestamp - startTime) / 1 days;
		bool can = (wallets[_user].lastDayTopped != uint128(_currentDay) ||
			wallets[_user].dailyToppingCount < 3) &&
			((notFirstTime[_user] == false &&
				dailyNewWalletsCount < maxDailyNewWallets) ||
				whitelistedRoot != address(0));

		uint128[7] memory lastWeekToppings = wallets[_user].lastWeekToppings;
		//reset inactive days
		uint256 dayOfWeek = _currentDay % 7;
		uint256 dayDiff = (_currentDay - wallets[_user].lastDayTopped);
		dayDiff = dayDiff > 7 ? 7 : dayDiff;
		dayDiff = dayDiff > dayOfWeek ? dayOfWeek + 1 : dayDiff;

		for (uint256 day = dayOfWeek + 1 - dayDiff; day <= dayOfWeek; day++) {
			lastWeekToppings[day] = 0;
		}

		uint128 weekTotal = 0;
		for (uint256 i = 0; i <= dayOfWeek; i++) {
			weekTotal += lastWeekToppings[uint256(i)];
		}
		can = can && weekTotal < perDayRoughLimit * gasPrice * maxPerWeekMultiplier;
		return can;
	}

	/* @dev Function to top given address with amount of G$ given in constructor
	 * can only be done by admin the amount of times specified in constructor per day
	 * @param _user The address to transfer to
	 */
	function topWallet(
		address payable _user
	) public reimburseGas toppingLimit(_user) onlyAuthorized(_user) {
		_topWallet(_user);
	}

	function _topWallet(address payable _wallet) internal {
		address payable target = _wallet;

		//switch wallet to the account we do the accounting for
		address whitelistedRoot = getIdentity().getWhitelistedRoot(_wallet);
		_wallet = whitelistedRoot == address(0)
			? _wallet
			: payable(whitelistedRoot);

		uint256 toTop = getToppingAmount() - address(_wallet).balance;
		require((toTop * 100) / getToppingAmount() >= minTopping, "low toTop");

		uint256 dayOfWeek = currentDay % 7;

		if (wallets[_wallet].lastDayTopped == uint128(currentDay))
			wallets[_wallet].dailyToppingCount += 1;
		else wallets[_wallet].dailyToppingCount = 1;
		wallets[_wallet].lastDayTopped = uint128(currentDay);
		wallets[_wallet].lastWeekToppings[dayOfWeek] += uint128(toTop);

		if (notFirstTime[_wallet] == false && whitelistedRoot == address(0)) {
			dailyNewWalletsCount++;
		}
		notFirstTime[_wallet] = true;

		target.transfer(toTop);
		emit WalletTopped(target, toTop, whitelistedRoot, msg.sender);
	}

	/**
		@notice only safe for small amounts, since we dont have slippage check
	 */
	function onTokenTransfer(
		address payable _from,
		uint256 amount,
		bytes calldata data
	) external returns (bool) {
		address uniswapLike = abi.decode(data, (address));
		Uniswap uniswap = Uniswap(uniswapLike);
		address[] memory path = new address[](2);
		path[0] = address(msg.sender);
		path[1] = uniswap.WETH();

		cERC20(msg.sender).approve(address(uniswapLike), type(uint256).max);
		uniswap.swapExactTokensForETH(amount, 0, path, _from, block.timestamp);
		return true;
	}

	function getToppingAmount() public view returns (uint256) {
		return gasTopping * gasPrice;
	}

	function setGasTopping(
		uint256 _gasUnits
	) public onlyRole(DEFAULT_ADMIN_ROLE) {
		gasTopping = _gasUnits;
		perDayRoughLimit = 2 * gasTopping;
	}

	function setGasPrice(uint64 _price) external onlyRole(DEFAULT_ADMIN_ROLE) {
		gasPrice = _price;
	}

	function setMinTopping(uint8 _minTop) external onlyRole(DEFAULT_ADMIN_ROLE) {
		minTopping = _minTop;
	}
}
        

/_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/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/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/introspection/ERC165Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
          

/_openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}
          

/project_/contracts/DAOStackInterfaces.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface Avatar {
	function nativeToken() external view returns (address);

	function nativeReputation() external view returns (address);

	function owner() external view returns (address);
}

interface Controller {
	event RegisterScheme(address indexed _sender, address indexed _scheme);
	event UnregisterScheme(address indexed _sender, address indexed _scheme);

	function genericCall(
		address _contract,
		bytes calldata _data,
		address _avatar,
		uint256 _value
	) external returns (bool, bytes memory);

	function avatar() external view returns (address);

	function unregisterScheme(address _scheme, address _avatar)
		external
		returns (bool);

	function unregisterSelf(address _avatar) external returns (bool);

	function registerScheme(
		address _scheme,
		bytes32 _paramsHash,
		bytes4 _permissions,
		address _avatar
	) external returns (bool);

	function isSchemeRegistered(address _scheme, address _avatar)
		external
		view
		returns (bool);

	function getSchemePermissions(address _scheme, address _avatar)
		external
		view
		returns (bytes4);

	function addGlobalConstraint(
		address _constraint,
		bytes32 _paramHash,
		address _avatar
	) external returns (bool);

	function mintTokens(
		uint256 _amount,
		address _beneficiary,
		address _avatar
	) external returns (bool);

	function externalTokenTransfer(
		address _token,
		address _recipient,
		uint256 _amount,
		address _avatar
	) external returns (bool);

	function sendEther(
		uint256 _amountInWei,
		address payable _to,
		address _avatar
	) external returns (bool);
}

interface GlobalConstraintInterface {
	enum CallPhase {
		Pre,
		Post,
		PreAndPost
	}

	function pre(
		address _scheme,
		bytes32 _params,
		bytes32 _method
	) external returns (bool);

	/**
	 * @dev when return if this globalConstraints is pre, post or both.
	 * @return CallPhase enum indication  Pre, Post or PreAndPost.
	 */
	function when() external returns (CallPhase);
}

interface ReputationInterface {
	function balanceOf(address _user) external view returns (uint256);

	function balanceOfAt(address _user, uint256 _blockNumber)
		external
		view
		returns (uint256);

	function getVotes(address _user) external view returns (uint256);

	function getVotesAt(
		address _user,
		bool _global,
		uint256 _blockNumber
	) external view returns (uint256);

	function totalSupply() external view returns (uint256);

	function totalSupplyAt(uint256 _blockNumber)
		external
		view
		returns (uint256);

	function delegateOf(address _user) external returns (address);
}

interface SchemeRegistrar {
	function proposeScheme(
		Avatar _avatar,
		address _scheme,
		bytes32 _parametersHash,
		bytes4 _permissions,
		string memory _descriptionHash
	) external returns (bytes32);

	event NewSchemeProposal(
		address indexed _avatar,
		bytes32 indexed _proposalId,
		address indexed _intVoteInterface,
		address _scheme,
		bytes32 _parametersHash,
		bytes4 _permissions,
		string _descriptionHash
	);
}

interface IntVoteInterface {
	event NewProposal(
		bytes32 indexed _proposalId,
		address indexed _organization,
		uint256 _numOfChoices,
		address _proposer,
		bytes32 _paramsHash
	);

	event ExecuteProposal(
		bytes32 indexed _proposalId,
		address indexed _organization,
		uint256 _decision,
		uint256 _totalReputation
	);

	event VoteProposal(
		bytes32 indexed _proposalId,
		address indexed _organization,
		address indexed _voter,
		uint256 _vote,
		uint256 _reputation
	);

	event CancelProposal(
		bytes32 indexed _proposalId,
		address indexed _organization
	);
	event CancelVoting(
		bytes32 indexed _proposalId,
		address indexed _organization,
		address indexed _voter
	);

	/**
	 * @dev register a new proposal with the given parameters. Every proposal has a unique ID which is being
	 * generated by calculating keccak256 of a incremented counter.
	 * @param _numOfChoices number of voting choices
	 * @param _proposalParameters defines the parameters of the voting machine used for this proposal
	 * @param _proposer address
	 * @param _organization address - if this address is zero the msg.sender will be used as the organization address.
	 * @return proposal's id.
	 */
	function propose(
		uint256 _numOfChoices,
		bytes32 _proposalParameters,
		address _proposer,
		address _organization
	) external returns (bytes32);

	function vote(
		bytes32 _proposalId,
		uint256 _vote,
		uint256 _rep,
		address _voter
	) external returns (bool);

	function cancelVote(bytes32 _proposalId) external;

	function getNumberOfChoices(bytes32 _proposalId)
		external
		view
		returns (uint256);

	function isVotable(bytes32 _proposalId) external view returns (bool);

	/**
	 * @dev voteStatus returns the reputation voted for a proposal for a specific voting choice.
	 * @param _proposalId the ID of the proposal
	 * @param _choice the index in the
	 * @return voted reputation for the given choice
	 */
	function voteStatus(bytes32 _proposalId, uint256 _choice)
		external
		view
		returns (uint256);

	/**
	 * @dev isAbstainAllow returns if the voting machine allow abstain (0)
	 * @return bool true or false
	 */
	function isAbstainAllow() external pure returns (bool);

	/**
     * @dev getAllowedRangeOfChoices returns the allowed range of choices for a voting machine.
     * @return min - minimum number of choices
               max - maximum number of choices
     */
	function getAllowedRangeOfChoices()
		external
		pure
		returns (uint256 min, uint256 max);
}
          

/project_/contracts/Interfaces.sol

// SPDX-License-Identifier: MIT
import { DataTypes } from "./utils/DataTypes.sol";
pragma solidity >=0.8.0;

pragma experimental ABIEncoderV2;

interface ERC20 {
	function balanceOf(address addr) external view returns (uint256);

	function transfer(address to, uint256 amount) external returns (bool);

	function approve(address spender, uint256 amount) external returns (bool);

	function decimals() external view returns (uint8);

	function mint(address to, uint256 mintAmount) external returns (uint256);

	function burn(uint256 amount) external;

	function totalSupply() external view returns (uint256);

	function allowance(
		address owner,
		address spender
	) external view returns (uint256);

	function transferFrom(
		address sender,
		address recipient,
		uint256 amount
	) external returns (bool);

	function name() external view returns (string memory);

	function symbol() external view returns (string memory);

	event Transfer(address indexed from, address indexed to, uint256 amount);
	event Transfer(
		address indexed from,
		address indexed to,
		uint256 amount,
		bytes data
	);
}

interface cERC20 is ERC20 {
	function mint(uint256 mintAmount) external returns (uint256);

	function redeemUnderlying(uint256 mintAmount) external returns (uint256);

	function redeem(uint256 mintAmount) external returns (uint256);

	function exchangeRateCurrent() external returns (uint256);

	function exchangeRateStored() external view returns (uint256);

	function underlying() external returns (address);
}

interface IGoodDollar is ERC20 {
	// view functions
	function feeRecipient() external view returns (address);

	function getFees(
		uint256 value,
		address sender,
		address recipient
	) external view returns (uint256 fee, bool senderPays);

	function cap() external view returns (uint256);

	function isPauser(address _pauser) external view returns (bool);

	function getFees(uint256 value) external view returns (uint256, bool);

	function isMinter(address minter) external view returns (bool);

	function formula() external view returns (address);

	function identity() external view returns (address);

	function owner() external view returns (address);

	// state changing functions
	function setFeeRecipient(address _feeRecipient) external;

	function setFormula(address _formula) external;

	function transferOwnership(address _owner) external;

	function addPauser(address _pauser) external;

	function pause() external;

	function unpause() external;

	function burn(uint256 amount) external;

	function burnFrom(address account, uint256 amount) external;

	function renounceMinter() external;

	function addMinter(address minter) external;

	function transferAndCall(
		address to,
		uint256 value,
		bytes calldata data
	) external returns (bool);

	function setIdentity(address identity) external;
}

interface IERC2917 is ERC20 {
	/// @dev This emit when interests amount per block is changed by the owner of the contract.
	/// It emits with the old interests amount and the new interests amount.
	event InterestRatePerBlockChanged(uint256 oldValue, uint256 newValue);

	/// @dev This emit when a users' productivity has changed
	/// It emits with the user's address and the the value after the change.
	event ProductivityIncreased(address indexed user, uint256 value);

	/// @dev This emit when a users' productivity has changed
	/// It emits with the user's address and the the value after the change.
	event ProductivityDecreased(address indexed user, uint256 value);

	/// @dev Return the current contract's interests rate per block.
	/// @return The amount of interests currently producing per each block.
	function interestsPerBlock() external view returns (uint256);

	/// @notice Change the current contract's interests rate.
	/// @dev Note the best practice will be restrict the gross product provider's contract address to call this.
	/// @return The true/fase to notice that the value has successfully changed or not, when it succeed, it will emite the InterestRatePerBlockChanged event.
	function changeInterestRatePerBlock(uint256 value) external returns (bool);

	/// @notice It will get the productivity of given user.
	/// @dev it will return 0 if user has no productivity proved in the contract.
	/// @return user's productivity and overall productivity.
	function getProductivity(
		address user
	) external view returns (uint256, uint256);

	/// @notice increase a user's productivity.
	/// @dev Note the best practice will be restrict the callee to prove of productivity's contract address.
	/// @return true to confirm that the productivity added success.
	function increaseProductivity(
		address user,
		uint256 value
	) external returns (bool);

	/// @notice decrease a user's productivity.
	/// @dev Note the best practice will be restrict the callee to prove of productivity's contract address.
	/// @return true to confirm that the productivity removed success.
	function decreaseProductivity(
		address user,
		uint256 value
	) external returns (bool);

	/// @notice take() will return the interests that callee will get at current block height.
	/// @dev it will always calculated by block.number, so it will change when block height changes.
	/// @return amount of the interests that user are able to mint() at current block height.
	function take() external view returns (uint256);

	/// @notice similar to take(), but with the block height joined to calculate return.
	/// @dev for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests.
	/// @return amount of interests and the block height.
	function takeWithBlock() external view returns (uint256, uint256);

	/// @notice mint the avaiable interests to callee.
	/// @dev once it mint, the amount of interests will transfer to callee's address.
	/// @return the amount of interests minted.
	function mint() external returns (uint256);
}

interface Staking {
	struct Staker {
		// The staked DAI amount
		uint256 stakedDAI;
		// The latest block number which the
		// staker has staked tokens
		uint256 lastStake;
	}

	function stakeDAI(uint256 amount) external;

	function withdrawStake() external;

	function stakers(address staker) external view returns (Staker memory);
}

interface Uniswap {
	function swapExactETHForTokens(
		uint256 amountOutMin,
		address[] calldata path,
		address to,
		uint256 deadline
	) external payable returns (uint256[] memory amounts);

	function swapExactTokensForETH(
		uint256 amountIn,
		uint256 amountOutMin,
		address[] calldata path,
		address to,
		uint256 deadline
	) external returns (uint256[] memory amounts);

	function swapExactTokensForTokens(
		uint256 amountIn,
		uint256 amountOutMin,
		address[] calldata path,
		address to,
		uint256 deadline
	) external returns (uint256[] memory amounts);

	function WETH() external pure returns (address);

	function factory() external pure returns (address);

	function quote(
		uint256 amountA,
		uint256 reserveA,
		uint256 reserveB
	) external pure returns (uint256 amountB);

	function getAmountIn(
		uint256 amountOut,
		uint256 reserveIn,
		uint256 reserveOut
	) external pure returns (uint256 amountIn);

	function getAmountOut(
		uint256 amountI,
		uint256 reserveIn,
		uint256 reserveOut
	) external pure returns (uint256 amountOut);

	function getAmountsOut(
		uint256 amountIn,
		address[] memory path
	) external pure returns (uint256[] memory amounts);
}

interface UniswapFactory {
	function getPair(
		address tokenA,
		address tokenB
	) external view returns (address);
}

interface UniswapPair {
	function getReserves()
		external
		view
		returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

	function kLast() external view returns (uint256);

	function token0() external view returns (address);

	function token1() external view returns (address);

	function totalSupply() external view returns (uint256);

	function balanceOf(address owner) external view returns (uint256);
}

interface Reserve {
	function buy(
		address _buyWith,
		uint256 _tokenAmount,
		uint256 _minReturn
	) external returns (uint256);
}

interface IIdentity {
	function isWhitelisted(address user) external view returns (bool);

	function addWhitelistedWithDID(address account, string memory did) external;

	function removeWhitelisted(address account) external;

	function addBlacklisted(address account) external;

	function removeBlacklisted(address account) external;

	function isBlacklisted(address user) external view returns (bool);

	function addIdentityAdmin(address account) external returns (bool);

	function setAvatar(address _avatar) external;

	function isIdentityAdmin(address account) external view returns (bool);

	function owner() external view returns (address);

	function removeContract(address account) external;

	function isDAOContract(address account) external view returns (bool);

	function addrToDID(address account) external view returns (string memory);

	function didHashToAddress(bytes32 hash) external view returns (address);

	function lastAuthenticated(address account) external view returns (uint256);

	event WhitelistedAdded(address user);
}

interface IIdentityV2 is IIdentity {
	function addWhitelistedWithDIDAndChain(
		address account,
		string memory did,
		uint256 orgChainId,
		uint256 dateAuthenticated
	) external;

	function getWhitelistedRoot(
		address account
	) external view returns (address root);
}

interface IUBIScheme {
	function currentDay() external view returns (uint256);

	function periodStart() external view returns (uint256);

	function hasClaimed(address claimer) external view returns (bool);
}

interface IFirstClaimPool {
	function awardUser(address user) external returns (uint256);

	function claimAmount() external view returns (uint256);

	function end() external;
}

interface ProxyAdmin {
	function getProxyImplementation(
		address proxy
	) external view returns (address);

	function getProxyAdmin(address proxy) external view returns (address);

	function upgrade(address proxy, address implementation) external;

	function owner() external view returns (address);

	function transferOwnership(address newOwner) external;

	function upgradeAndCall(
		address proxy,
		address implementation,
		bytes memory data
	) external;
}

/**
 * @dev Interface for chainlink oracles to obtain price datas
 */
interface AggregatorV3Interface {
	function decimals() external view returns (uint8);

	function description() external view returns (string memory);

	function version() external view returns (uint256);

	// getRoundData and latestRoundData should both raise "No data present"
	// if they do not have data to report, instead of returning unset values
	// which could be misinterpreted as actual reported values.
	function getRoundData(
		uint80 _roundId
	)
		external
		view
		returns (
			uint80 roundId,
			int256 answer,
			uint256 startedAt,
			uint256 updatedAt,
			uint80 answeredInRound
		);

	function latestAnswer() external view returns (int256);
}

/**
	@dev interface for AAVE lending Pool
 */
interface ILendingPool {
	/**
	 * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
	 * - E.g. User deposits 100 USDC and gets in return 100 aUSDC
	 * @param asset The address of the underlying asset to deposit
	 * @param amount The amount to be deposited
	 * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
	 *   wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
	 *   is a different wallet
	 * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
	 *   0 if the action is executed directly by the user, without any middle-man
	 **/
	function deposit(
		address asset,
		uint256 amount,
		address onBehalfOf,
		uint16 referralCode
	) external;

	/**
	 * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
	 * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
	 * @param asset The address of the underlying asset to withdraw
	 * @param amount The underlying amount to be withdrawn
	 *   - Send the value type(uint256).max in order to withdraw the whole aToken balance
	 * @param to Address that will receive the underlying, same as msg.sender if the user
	 *   wants to receive it on his own wallet, or a different address if the beneficiary is a
	 *   different wallet
	 * @return The final amount withdrawn
	 **/
	function withdraw(
		address asset,
		uint256 amount,
		address to
	) external returns (uint256);

	/**
	 * @dev Returns the state and configuration of the reserve
	 * @param asset The address of the underlying asset of the reserve
	 * @return The state of the reserve
	 **/
	function getReserveData(
		address asset
	) external view returns (DataTypes.ReserveData memory);
}

interface IDonationStaking {
	function stakeDonations() external payable;
}

interface INameService {
	function getAddress(string memory _name) external view returns (address);
}

interface IAaveIncentivesController {
	/**
	 * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
	 * @param amount Amount of rewards to claim
	 * @param to Address that will be receiving the rewards
	 * @return Rewards claimed
	 **/
	function claimRewards(
		address[] calldata assets,
		uint256 amount,
		address to
	) external returns (uint256);

	/**
	 * @dev Returns the total of rewards of an user, already accrued + not yet accrued
	 * @param user The address of the user
	 * @return The rewards
	 **/
	function getRewardsBalance(
		address[] calldata assets,
		address user
	) external view returns (uint256);
}

interface IGoodStaking {
	function collectUBIInterest(
		address recipient
	) external returns (uint256, uint256, uint256);

	function iToken() external view returns (address);

	function currentGains(
		bool _returnTokenBalanceInUSD,
		bool _returnTokenGainsInUSD
	) external view returns (uint256, uint256, uint256, uint256, uint256);

	function getRewardEarned(address user) external view returns (uint256);

	function getGasCostForInterestTransfer() external view returns (uint256);

	function rewardsMinted(
		address user,
		uint256 rewardsPerBlock,
		uint256 blockStart,
		uint256 blockEnd
	) external returns (uint256);
}

interface IHasRouter {
	function getRouter() external view returns (Uniswap);
}

interface IAdminWallet {
	function addAdmins(address payable[] memory _admins) external;

	function removeAdmins(address[] memory _admins) external;

	function owner() external view returns (address);

	function transferOwnership(address _owner) external;
}

interface IMultichainRouter {
	// Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to`
	function anySwapOut(
		address token,
		address to,
		uint256 amount,
		uint256 toChainID
	) external;

	// Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to`
	function anySwapOutUnderlying(
		address token,
		address to,
		uint256 amount,
		uint256 toChainID
	) external;
}
          

/project_/contracts/utils/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))];
	}
}
          

Compiler Settings

{"remappings":[],"optimizer":{"runs":0,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"paris","compilationTarget":{"project:/contracts/fuseFaucet/Faucet.sol":"Faucet"}}
              

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":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","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":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"WalletTopped","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"address","name":"whitelistedRoot","internalType":"address","indexed":false},{"type":"address","name":"relayerOrWhitelisted","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":"RELAYER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"canTop","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentDay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"dailyNewWalletsCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"gasPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"gasRefund","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"gasTopping","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IIdentityV2"}],"name":"getIdentity","inputs":[]},{"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":"","internalType":"uint256"}],"name":"getToppingAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"goodDollar_unused","inputs":[]},{"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":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_ns","internalType":"contract NameService"},{"type":"uint64","name":"_gasPrice","internalType":"uint64"},{"type":"address","name":"relayer","internalType":"address"},{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"maxDailyNewWallets","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"maxDailyToppings","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"maxPerWeekMultiplier","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"maxSwapAmount_unused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"minTopping","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract NameService"}],"name":"nameService","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"notFirstTime","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"onTokenTransfer","inputs":[{"type":"address","name":"_from","internalType":"address payable"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"perDayRoughLimit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"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":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setGasPrice","inputs":[{"type":"uint64","name":"_price","internalType":"uint64"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setGasTopping","inputs":[{"type":"uint256","name":"_gasUnits","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinTopping","inputs":[{"type":"uint8","name":"_minTop","internalType":"uint8"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startTime","inputs":[]},{"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":"topWallet","inputs":[{"type":"address","name":"_user","internalType":"address payable"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"toppings","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"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":"uint32","name":"","internalType":"uint32"}],"name":"version","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"lastDayTopped","internalType":"uint128"},{"type":"uint32","name":"dailyToppingCount","internalType":"uint32"}],"name":"wallets","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

Verify & Publish
0x60a06040523060805234801561001457600080fd5b50608051612bc161004c600039600081816108470152818161088701528181610f2a01528181610f6a0152610fe20152612bc16000f3fe6080604052600436106101b95760003560e01c806301ffc9a7146101c557806315126799146101fa5780631ece9b121461021d578063248a9ca31461024b5780632f2ff15d1461026b5780632f5a3d151461028d57806336568abe146102a35780633659cfe6146102c357806336afc6fa146102e35780633771dcf8146102f85780633e6326fc146103185780634f1ef2861461033957806352d1902d1461034c57806354fd4d50146103615780635b61e2c11461039b5780635bc758e2146103db5780635c9302c9146103f15780636294c311146104075780636bdd72421461042757806370c635911461044757806378e97925146104675780637befab101461047d57806389b08f11146104a257806391d148541461050c578063926d7d7f1461052c57806393a08de41461054e578063969172c91461056c578063a217fddf14610591578063a4c0ed36146105a6578063aa31e459146105c6578063aaab4c1d146105f7578063c573cb401461062b578063c5da10331461064c578063c8eb754914610685578063d547741f146106a5578063e97eefd2146106c5578063f84b40f5146106e5578063fe173b97146106fb57600080fd5b366101c057005b600080fd5b3480156101d157600080fd5b506101e56101e0366004612415565b610723565b60405190151581526020015b60405180910390f35b34801561020657600080fd5b5061020f61075a565b6040519081526020016101f1565b34801561022957600080fd5b506101055461023e906001600160a01b031681565b6040516101f1919061243f565b34801561025757600080fd5b5061020f610266366004612453565b610784565b34801561027757600080fd5b5061028b610286366004612481565b610799565b005b34801561029957600080fd5b5061020f60fc5481565b3480156102af57600080fd5b5061028b6102be366004612481565b6107ba565b3480156102cf57600080fd5b5061028b6102de3660046124b1565b61083d565b3480156102ef57600080fd5b5061023e610905565b34801561030457600080fd5b5061028b6103133660046124b1565b61098c565b34801561032457600080fd5b506101005461023e906001600160a01b031681565b61028b610347366004612514565b610f20565b34801561035857600080fd5b5061020f610fd5565b34801561036d57600080fd5b506101065461038690600160401b900463ffffffff1681565b60405163ffffffff90911681526020016101f1565b3480156103a757600080fd5b50610105546103c390600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101f1565b3480156103e757600080fd5b5061020f60fd5481565b3480156103fd57600080fd5b5061020f60ff5481565b34801561041357600080fd5b5061028b6104223660046125d7565b611083565b34801561043357600080fd5b5061028b610442366004612631565b61127c565b34801561045357600080fd5b5061028b610462366004612453565b6112b5565b34801561047357600080fd5b5061020f60fe5481565b34801561048957600080fd5b506101045461038690600160601b900463ffffffff1681565b3480156104ae57600080fd5b506104e86104bd3660046124b1565b610103602052600090815260409020546001600160801b03811690600160801b900463ffffffff1682565b604080516001600160801b03909316835263ffffffff9091166020830152016101f1565b34801561051857600080fd5b506101e5610527366004612481565b6112d7565b34801561053857600080fd5b5061020f600080516020612b4583398151915281565b34801561055a57600080fd5b50610104546103869063ffffffff1681565b34801561057857600080fd5b506101045461038690600160801b900463ffffffff1681565b34801561059d57600080fd5b5061020f600081565b3480156105b257600080fd5b506101e56105c136600461264c565b611302565b3480156105d257600080fd5b506101e56105e13660046124b1565b6101026020526000908152604090205460ff1681565b34801561060357600080fd5b506101065461061990600160601b900460ff1681565b60405160ff90911681526020016101f1565b34801561063757600080fd5b50610106546103c3906001600160401b031681565b34801561065857600080fd5b5061020f610667366004612481565b61010160209081526000928352604080842090915290825290205481565b34801561069157600080fd5b5061028b6106a03660046126d4565b6114ed565b3480156106b157600080fd5b5061028b6106c0366004612481565b61151a565b3480156106d157600080fd5b506101e56106e03660046124b1565b611536565b3480156106f157600080fd5b5061020f60fb5481565b34801561070757600080fd5b50610104546103c390600160201b90046001600160401b031681565b60006001600160e01b03198216637965db0b60e01b148061075457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6101045460fc5460009161077f91600160201b9091046001600160401b03169061270d565b905090565b600090815260c9602052604090206001015490565b6107a282610784565b6107ab81611906565b6107b58383611910565b505050565b6001600160a01b038116331461082f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108398282611996565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036108855760405162461bcd60e51b815260040161082690612724565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108b76119fd565b6001600160a01b0316146108dd5760405162461bcd60e51b81526004016108269061275e565b6108e681611a19565b6040805160008082526020820190925261090291839190611a24565b50565b6101005460405163bf40fac160e01b81526020600482015260086024820152674944454e5449545960c01b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077f9190612798565b60005a905081600061099c610905565b6001600160a01b0316632d0e9b46836040518263ffffffff1660e01b81526004016109c7919061243f565b602060405180830381865afa1580156109e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a089190612798565b90506001600160a01b03811615610a1f5780610a21565b815b60ff54909250610a2f611b8f565b8060ff5414610a4a5761010680546001600160401b03191690555b60ff546001600160a01b038416600090815261010360205260409020546001600160801b039081169116141580610aaf5750610104546001600160a01b0384166000908152610103602052604090205463ffffffff918216600160801b909104909116105b610af05760405162461bcd60e51b81526020600482015260126024820152716d6178206461696c7920746f7070696e677360701b6044820152606401610826565b6001600160a01b0383166000908152610102602052604090205460ff16158015610b33575061010554610106546001600160401b03600160a01b90920482169116105b80610b4657506001600160a01b03821615155b610ba15760405162461bcd60e51b815260206004820152602660248201527f55736572206e6f742077686974656c6973746564206f72206e6f742066697273604482015265742074696d6560d01b6064820152608401610826565b6000600760ff54610bb291906127cb565b6001600160a01b0385166000908152610103602052604081205460ff549293509091610be7916001600160801b0316906127df565b905060078111610bf75780610bfa565b60075b9050818111610c095780610c14565b610c148260016127f2565b9050600081610c248460016127f2565b610c2e91906127df565b90505b828111610ca7576001600160a01b0386166000908152610103602052604081206001018260078110610c6557610c65612805565b600291828204019190066010026101000a8154816001600160801b0302191690836001600160801b031602179055508080610c9f9061281b565b915050610c31565b506000805b838111610d1e576001600160a01b0387166000908152610103602052604090206001018160078110610ce057610ce0612805565b600291828204019190066010029054906101000a90046001600160801b031682610d0a9190612834565b915080610d168161281b565b915050610cac565b506101045460fb54600160601b820463ffffffff1691610d4f91600160201b9091046001600160401b03169061270d565b610d59919061270d565b816001600160801b031610610dcd5760405162461bcd60e51b815260206004820152603460248201527f557365722077616c6c657420686173206265656e20746f7070656420746f6f206044820152736d616e792074696d65732074686973207765656b60601b6064820152608401610826565b876000610dd8610905565b6001600160a01b0316632d0e9b46836040518263ffffffff1660e01b8152600401610e03919061243f565b602060405180830381865afa158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e449190612798565b6001600160a01b0316141580610e6d5750610e6d600080516020612b45833981519152336112d7565b610eaa5760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610826565b610eb389611bb0565b505050505050505a610ec590826127df565b610ed19061a4106127f2565b6101045490915033906108fc90610ef890600160201b90046001600160401b03168461270d565b6040518115909202916000818181858888f193505050501580156107b5573d6000803e3d6000fd5b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610f685760405162461bcd60e51b815260040161082690612724565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610f9a6119fd565b6001600160a01b031614610fc05760405162461bcd60e51b81526004016108269061275e565b610fc982611a19565b61083982826001611a24565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146110705760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610826565b50600080516020612b2583398151915290565b600054610100900460ff16158080156110a35750600054600160ff909116105b806110c457506110b230611f4d565b1580156110c4575060005460ff166001145b6111275760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610826565b6000805460ff19166001179055801561114a576000805461ff0019166101001790555b611152611f5c565b61115d600083611fc9565b6001600160a01b0383161561118457611184600080516020612b4583398151915284611fc9565b6101048054600160201b600160601b031916600160201b6001600160401b03871602179055620f424060fc8190556111bd90600261270d565b60fb5561010480544260fe5561010080546001600160a01b0319166001600160a01b03891617905563ffffffff63ffffffff60601b0119166003600160611b011790556101058054600160a01b600160e01b03191661027160a31b179055610106805460ff60601b1916600f60601b1790558015611275576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600061128781611906565b5061010480546001600160401b03909216600160201b02600160201b600160601b0319909216919091179055565b60006112c081611906565b60fc8290556112d082600261270d565b60fb555050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080611311838501856124b1565b6040805160028082526060820183529293508392600092602083019080368337019050509050338160008151811061134b5761134b612805565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cd9190612798565b816001815181106113e0576113e0612805565b6001600160a01b03928316602091820292909201015260405163095ea7b360e01b815290841660048201526000196024820152339063095ea7b3906044016020604051808303816000875af115801561143d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611461919061285b565b506040516318cbafe560e01b81526001600160a01b038316906318cbafe590611497908a9060009086908e90429060040161287d565b6000604051808303816000875af11580156114b6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114de91908101906128ee565b50600198975050505050505050565b60006114f881611906565b50610106805460ff909216600160601b0260ff60601b19909216919091179055565b61152382610784565b61152c81611906565b6107b58383611996565b6000816001600160a01b03163161154b61075a565b101561155957506000919050565b6000826001600160a01b03163161156e61075a565b61157891906127df565b61010654909150600160601b900460ff1661159161075a565b61159c83606461270d565b6115a69190612993565b10156115b55750600092915050565b60006115bf610905565b6001600160a01b0316632d0e9b46856040518263ffffffff1660e01b81526004016115ea919061243f565b602060405180830381865afa158015611607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162b9190612798565b90506001600160a01b038116156116425780611644565b835b935060006201518060fe544261165a91906127df565b6116649190612993565b6001600160a01b03861660009081526101036020526040812054919250906001600160801b0380841691161415806116c357506001600160a01b038616600090815261010360205260409020546003600160801b90910463ffffffff16105b801561172057506001600160a01b0386166000908152610102602052604090205460ff1615801561170d575061010554610106546001600160401b03600160a01b90920482169116105b8061172057506001600160a01b03831615155b6001600160a01b03871660009081526101036020526040808220815160e0810192839052939450919291600101906007908285855b82829054906101000a90046001600160801b03166001600160801b031681526020019060100190602082600f010492830192600103820291508084116117555790505050505050905060006007846117ad91906127cb565b6001600160a01b03891660009081526101036020526040812054919250906117de906001600160801b0316866127df565b9050600781116117ee57806117f1565b60075b9050818111611800578061180b565b61180b8260016127f2565b905060008161181b8460016127f2565b61182591906127df565b90505b82811161186857600084826007811061184357611843612805565b6001600160801b039092166020929092020152806118608161281b565b915050611828565b506000805b8381116118a95784816007811061188657611886612805565b60200201516118959083612834565b9150806118a18161281b565b91505061186d565b508480156118f857506101045460fb54600160601b820463ffffffff16916118e291600160201b9091046001600160401b03169061270d565b6118ec919061270d565b816001600160801b0316105b9a9950505050505050505050565b6109028133611fd3565b61191a82826112d7565b61083957600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff191660011790556119523390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6119a082826112d7565b1561083957600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020612b25833981519152546001600160a01b031690565b600061083981611906565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611a57576107b58361202c565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611ab1575060408051601f3d908101601f19168201909252611aae918101906129a7565b60015b611b145760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610826565b600080516020612b258339815191528114611b835760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610826565b506107b58383836120c6565b6201518060fe5442611ba191906127df565b611bab9190612993565b60ff55565b806000611bbb610905565b6001600160a01b0316632d0e9b46846040518263ffffffff1660e01b8152600401611be6919061243f565b602060405180830381865afa158015611c03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c279190612798565b90506001600160a01b03811615611c3e5780611c40565b825b92506000836001600160a01b031631611c5761075a565b611c6191906127df565b61010654909150600160601b900460ff16611c7a61075a565b611c8583606461270d565b611c8f9190612993565b1015611cc95760405162461bcd60e51b815260206004820152600960248201526806c6f7720746f546f760bc1b6044820152606401610826565b6000600760ff54611cda91906127cb565b60ff546001600160a01b038716600090815261010360205260409020549192506001600160801b03908116911603611d69576001600160a01b038516600090815261010360205260409020805460019190601090611d46908490600160801b900463ffffffff166129c0565b92506101000a81548163ffffffff021916908363ffffffff160217905550611d97565b6001600160a01b038516600090815261010360205260409020805463ffffffff60801b1916600160801b1790555b60ff546001600160a01b03861660009081526101036020526040902080546001600160801b0319166001600160801b0390921691909117815582906001018260078110611de657611de6612805565b600291828204019190066010028282829054906101000a90046001600160801b0316611e129190612834565b82546001600160801b039182166101009390930a9283029190920219909116179055506001600160a01b0385166000908152610102602052604090205460ff16158015611e6657506001600160a01b038316155b15611eab5761010680546001600160401b0316906000611e85836129dd565b91906101000a8154816001600160401b0302191690836001600160401b03160217905550505b6001600160a01b0380861660009081526101026020526040808220805460ff19166001179055519186169184156108fc0291859190818181858888f19350505050158015611efd573d6000803e3d6000fd5b50604080518381526001600160a01b0385811660208301523392908716917f7872034fbcc87890e73d66eac55389e0ffdba157b89a73bd2011157ebac1d66e910160405180910390a35050505050565b6001600160a01b03163b151590565b600054610100900460ff16611fc75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610826565b565b6108398282611910565b611fdd82826112d7565b61083957611fea816120f1565b611ff5836020612103565b604051602001612006929190612a2f565b60408051601f198184030181529082905262461bcd60e51b825261082691600401612a9e565b61203581611f4d565b6120975760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610826565b600080516020612b2583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6120cf836122a5565b6000825111806120dc5750805b156107b5576120eb83836122e5565b50505050565b60606107546001600160a01b03831660145b6060600061211283600261270d565b61211d9060026127f2565b6001600160401b03811115612134576121346124ce565b6040519080825280601f01601f19166020018201604052801561215e576020820181803683370190505b509050600360fc1b8160008151811061217957612179612805565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106121a8576121a8612805565b60200101906001600160f81b031916908160001a90535060006121cc84600261270d565b6121d79060016127f2565b90505b600181111561224f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061220b5761220b612805565b1a60f81b82828151811061222157612221612805565b60200101906001600160f81b031916908160001a90535060049490941c9361224881612ad1565b90506121da565b50831561229e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610826565b9392505050565b6122ae8161202c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606122f083611f4d565b61234b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610826565b600080846001600160a01b0316846040516123669190612ae8565b600060405180830381855af49150503d80600081146123a1576040519150601f19603f3d011682016040523d82523d6000602084013e6123a6565b606091505b50915091506123ce8282604051806060016040528060278152602001612b65602791396123d7565b95945050505050565b606083156123e657508161229e565b61229e83838151156123fb5781518083602001fd5b8060405162461bcd60e51b81526004016108269190612a9e565b60006020828403121561242757600080fd5b81356001600160e01b03198116811461229e57600080fd5b6001600160a01b0391909116815260200190565b60006020828403121561246557600080fd5b5035919050565b6001600160a01b038116811461090257600080fd5b6000806040838503121561249457600080fd5b8235915060208301356124a68161246c565b809150509250929050565b6000602082840312156124c357600080fd5b813561229e8161246c565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561250c5761250c6124ce565b604052919050565b6000806040838503121561252757600080fd5b82356125328161246c565b91506020838101356001600160401b038082111561254f57600080fd5b818601915086601f83011261256357600080fd5b813581811115612575576125756124ce565b612587601f8201601f191685016124e4565b9150808252878482850101111561259d57600080fd5b80848401858401376000848284010152508093505050509250929050565b80356001600160401b03811681146125d257600080fd5b919050565b600080600080608085870312156125ed57600080fd5b84356125f88161246c565b9350612606602086016125bb565b925060408501356126168161246c565b915060608501356126268161246c565b939692955090935050565b60006020828403121561264357600080fd5b61229e826125bb565b6000806000806060858703121561266257600080fd5b843561266d8161246c565b93506020850135925060408501356001600160401b038082111561269057600080fd5b818701915087601f8301126126a457600080fd5b8135818111156126b357600080fd5b8860208285010111156126c557600080fd5b95989497505060200194505050565b6000602082840312156126e657600080fd5b813560ff8116811461229e57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610754576107546126f7565b6020808252602c90820152600080516020612b0583398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020612b0583398151915260408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156127aa57600080fd5b815161229e8161246c565b634e487b7160e01b600052601260045260246000fd5b6000826127da576127da6127b5565b500690565b81810381811115610754576107546126f7565b80820180821115610754576107546126f7565b634e487b7160e01b600052603260045260246000fd5b60006001820161282d5761282d6126f7565b5060010190565b6001600160801b03818116838216019080821115612854576128546126f7565b5092915050565b60006020828403121561286d57600080fd5b8151801515811461229e57600080fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156128cd5784516001600160a01b0316835293830193918301916001016128a8565b50506001600160a01b03969096166060850152505050608001529392505050565b6000602080838503121561290157600080fd5b82516001600160401b038082111561291857600080fd5b818501915085601f83011261292c57600080fd5b81518181111561293e5761293e6124ce565b8060051b915061294f8483016124e4565b818152918301840191848101908884111561296957600080fd5b938501935b838510156129875784518252938501939085019061296e565b98975050505050505050565b6000826129a2576129a26127b5565b500490565b6000602082840312156129b957600080fd5b5051919050565b63ffffffff818116838216019080821115612854576128546126f7565b60006001600160401b038281166002600160401b03198101612a0157612a016126f7565b6001019392505050565b60005b83811015612a26578181015183820152602001612a0e565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351612a61816017850160208801612a0b565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612a92816028840160208801612a0b565b01602801949350505050565b6020815260008251806020840152612abd816040850160208701612a0b565b601f01601f19169190910160400192915050565b600081612ae057612ae06126f7565b506000190190565b60008251612afa818460208701612a0b565b919091019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc802cf867c2da464d4ff0ebc4dfcccdfbd65d75a8bc1c273fb02e80bf3446b516416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212207c2c27f3ebac89e1d2ff130b56a2f847b2b7d07ff8c1dfa7e3cd9f51f8ef97be64736f6c63430008130033

Deployed ByteCode

0x6080604052600436106101b95760003560e01c806301ffc9a7146101c557806315126799146101fa5780631ece9b121461021d578063248a9ca31461024b5780632f2ff15d1461026b5780632f5a3d151461028d57806336568abe146102a35780633659cfe6146102c357806336afc6fa146102e35780633771dcf8146102f85780633e6326fc146103185780634f1ef2861461033957806352d1902d1461034c57806354fd4d50146103615780635b61e2c11461039b5780635bc758e2146103db5780635c9302c9146103f15780636294c311146104075780636bdd72421461042757806370c635911461044757806378e97925146104675780637befab101461047d57806389b08f11146104a257806391d148541461050c578063926d7d7f1461052c57806393a08de41461054e578063969172c91461056c578063a217fddf14610591578063a4c0ed36146105a6578063aa31e459146105c6578063aaab4c1d146105f7578063c573cb401461062b578063c5da10331461064c578063c8eb754914610685578063d547741f146106a5578063e97eefd2146106c5578063f84b40f5146106e5578063fe173b97146106fb57600080fd5b366101c057005b600080fd5b3480156101d157600080fd5b506101e56101e0366004612415565b610723565b60405190151581526020015b60405180910390f35b34801561020657600080fd5b5061020f61075a565b6040519081526020016101f1565b34801561022957600080fd5b506101055461023e906001600160a01b031681565b6040516101f1919061243f565b34801561025757600080fd5b5061020f610266366004612453565b610784565b34801561027757600080fd5b5061028b610286366004612481565b610799565b005b34801561029957600080fd5b5061020f60fc5481565b3480156102af57600080fd5b5061028b6102be366004612481565b6107ba565b3480156102cf57600080fd5b5061028b6102de3660046124b1565b61083d565b3480156102ef57600080fd5b5061023e610905565b34801561030457600080fd5b5061028b6103133660046124b1565b61098c565b34801561032457600080fd5b506101005461023e906001600160a01b031681565b61028b610347366004612514565b610f20565b34801561035857600080fd5b5061020f610fd5565b34801561036d57600080fd5b506101065461038690600160401b900463ffffffff1681565b60405163ffffffff90911681526020016101f1565b3480156103a757600080fd5b50610105546103c390600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101f1565b3480156103e757600080fd5b5061020f60fd5481565b3480156103fd57600080fd5b5061020f60ff5481565b34801561041357600080fd5b5061028b6104223660046125d7565b611083565b34801561043357600080fd5b5061028b610442366004612631565b61127c565b34801561045357600080fd5b5061028b610462366004612453565b6112b5565b34801561047357600080fd5b5061020f60fe5481565b34801561048957600080fd5b506101045461038690600160601b900463ffffffff1681565b3480156104ae57600080fd5b506104e86104bd3660046124b1565b610103602052600090815260409020546001600160801b03811690600160801b900463ffffffff1682565b604080516001600160801b03909316835263ffffffff9091166020830152016101f1565b34801561051857600080fd5b506101e5610527366004612481565b6112d7565b34801561053857600080fd5b5061020f600080516020612b4583398151915281565b34801561055a57600080fd5b50610104546103869063ffffffff1681565b34801561057857600080fd5b506101045461038690600160801b900463ffffffff1681565b34801561059d57600080fd5b5061020f600081565b3480156105b257600080fd5b506101e56105c136600461264c565b611302565b3480156105d257600080fd5b506101e56105e13660046124b1565b6101026020526000908152604090205460ff1681565b34801561060357600080fd5b506101065461061990600160601b900460ff1681565b60405160ff90911681526020016101f1565b34801561063757600080fd5b50610106546103c3906001600160401b031681565b34801561065857600080fd5b5061020f610667366004612481565b61010160209081526000928352604080842090915290825290205481565b34801561069157600080fd5b5061028b6106a03660046126d4565b6114ed565b3480156106b157600080fd5b5061028b6106c0366004612481565b61151a565b3480156106d157600080fd5b506101e56106e03660046124b1565b611536565b3480156106f157600080fd5b5061020f60fb5481565b34801561070757600080fd5b50610104546103c390600160201b90046001600160401b031681565b60006001600160e01b03198216637965db0b60e01b148061075457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6101045460fc5460009161077f91600160201b9091046001600160401b03169061270d565b905090565b600090815260c9602052604090206001015490565b6107a282610784565b6107ab81611906565b6107b58383611910565b505050565b6001600160a01b038116331461082f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108398282611996565b5050565b6001600160a01b037f0000000000000000000000000cb76de990330b36b72c9b604a71d24eaa45ebf41630036108855760405162461bcd60e51b815260040161082690612724565b7f0000000000000000000000000cb76de990330b36b72c9b604a71d24eaa45ebf46001600160a01b03166108b76119fd565b6001600160a01b0316146108dd5760405162461bcd60e51b81526004016108269061275e565b6108e681611a19565b6040805160008082526020820190925261090291839190611a24565b50565b6101005460405163bf40fac160e01b81526020600482015260086024820152674944454e5449545960c01b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077f9190612798565b60005a905081600061099c610905565b6001600160a01b0316632d0e9b46836040518263ffffffff1660e01b81526004016109c7919061243f565b602060405180830381865afa1580156109e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a089190612798565b90506001600160a01b03811615610a1f5780610a21565b815b60ff54909250610a2f611b8f565b8060ff5414610a4a5761010680546001600160401b03191690555b60ff546001600160a01b038416600090815261010360205260409020546001600160801b039081169116141580610aaf5750610104546001600160a01b0384166000908152610103602052604090205463ffffffff918216600160801b909104909116105b610af05760405162461bcd60e51b81526020600482015260126024820152716d6178206461696c7920746f7070696e677360701b6044820152606401610826565b6001600160a01b0383166000908152610102602052604090205460ff16158015610b33575061010554610106546001600160401b03600160a01b90920482169116105b80610b4657506001600160a01b03821615155b610ba15760405162461bcd60e51b815260206004820152602660248201527f55736572206e6f742077686974656c6973746564206f72206e6f742066697273604482015265742074696d6560d01b6064820152608401610826565b6000600760ff54610bb291906127cb565b6001600160a01b0385166000908152610103602052604081205460ff549293509091610be7916001600160801b0316906127df565b905060078111610bf75780610bfa565b60075b9050818111610c095780610c14565b610c148260016127f2565b9050600081610c248460016127f2565b610c2e91906127df565b90505b828111610ca7576001600160a01b0386166000908152610103602052604081206001018260078110610c6557610c65612805565b600291828204019190066010026101000a8154816001600160801b0302191690836001600160801b031602179055508080610c9f9061281b565b915050610c31565b506000805b838111610d1e576001600160a01b0387166000908152610103602052604090206001018160078110610ce057610ce0612805565b600291828204019190066010029054906101000a90046001600160801b031682610d0a9190612834565b915080610d168161281b565b915050610cac565b506101045460fb54600160601b820463ffffffff1691610d4f91600160201b9091046001600160401b03169061270d565b610d59919061270d565b816001600160801b031610610dcd5760405162461bcd60e51b815260206004820152603460248201527f557365722077616c6c657420686173206265656e20746f7070656420746f6f206044820152736d616e792074696d65732074686973207765656b60601b6064820152608401610826565b876000610dd8610905565b6001600160a01b0316632d0e9b46836040518263ffffffff1660e01b8152600401610e03919061243f565b602060405180830381865afa158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e449190612798565b6001600160a01b0316141580610e6d5750610e6d600080516020612b45833981519152336112d7565b610eaa5760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152606401610826565b610eb389611bb0565b505050505050505a610ec590826127df565b610ed19061a4106127f2565b6101045490915033906108fc90610ef890600160201b90046001600160401b03168461270d565b6040518115909202916000818181858888f193505050501580156107b5573d6000803e3d6000fd5b6001600160a01b037f0000000000000000000000000cb76de990330b36b72c9b604a71d24eaa45ebf4163003610f685760405162461bcd60e51b815260040161082690612724565b7f0000000000000000000000000cb76de990330b36b72c9b604a71d24eaa45ebf46001600160a01b0316610f9a6119fd565b6001600160a01b031614610fc05760405162461bcd60e51b81526004016108269061275e565b610fc982611a19565b61083982826001611a24565b6000306001600160a01b037f0000000000000000000000000cb76de990330b36b72c9b604a71d24eaa45ebf416146110705760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610826565b50600080516020612b2583398151915290565b600054610100900460ff16158080156110a35750600054600160ff909116105b806110c457506110b230611f4d565b1580156110c4575060005460ff166001145b6111275760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610826565b6000805460ff19166001179055801561114a576000805461ff0019166101001790555b611152611f5c565b61115d600083611fc9565b6001600160a01b0383161561118457611184600080516020612b4583398151915284611fc9565b6101048054600160201b600160601b031916600160201b6001600160401b03871602179055620f424060fc8190556111bd90600261270d565b60fb5561010480544260fe5561010080546001600160a01b0319166001600160a01b03891617905563ffffffff63ffffffff60601b0119166003600160611b011790556101058054600160a01b600160e01b03191661027160a31b179055610106805460ff60601b1916600f60601b1790558015611275576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600061128781611906565b5061010480546001600160401b03909216600160201b02600160201b600160601b0319909216919091179055565b60006112c081611906565b60fc8290556112d082600261270d565b60fb555050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080611311838501856124b1565b6040805160028082526060820183529293508392600092602083019080368337019050509050338160008151811061134b5761134b612805565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cd9190612798565b816001815181106113e0576113e0612805565b6001600160a01b03928316602091820292909201015260405163095ea7b360e01b815290841660048201526000196024820152339063095ea7b3906044016020604051808303816000875af115801561143d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611461919061285b565b506040516318cbafe560e01b81526001600160a01b038316906318cbafe590611497908a9060009086908e90429060040161287d565b6000604051808303816000875af11580156114b6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114de91908101906128ee565b50600198975050505050505050565b60006114f881611906565b50610106805460ff909216600160601b0260ff60601b19909216919091179055565b61152382610784565b61152c81611906565b6107b58383611996565b6000816001600160a01b03163161154b61075a565b101561155957506000919050565b6000826001600160a01b03163161156e61075a565b61157891906127df565b61010654909150600160601b900460ff1661159161075a565b61159c83606461270d565b6115a69190612993565b10156115b55750600092915050565b60006115bf610905565b6001600160a01b0316632d0e9b46856040518263ffffffff1660e01b81526004016115ea919061243f565b602060405180830381865afa158015611607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162b9190612798565b90506001600160a01b038116156116425780611644565b835b935060006201518060fe544261165a91906127df565b6116649190612993565b6001600160a01b03861660009081526101036020526040812054919250906001600160801b0380841691161415806116c357506001600160a01b038616600090815261010360205260409020546003600160801b90910463ffffffff16105b801561172057506001600160a01b0386166000908152610102602052604090205460ff1615801561170d575061010554610106546001600160401b03600160a01b90920482169116105b8061172057506001600160a01b03831615155b6001600160a01b03871660009081526101036020526040808220815160e0810192839052939450919291600101906007908285855b82829054906101000a90046001600160801b03166001600160801b031681526020019060100190602082600f010492830192600103820291508084116117555790505050505050905060006007846117ad91906127cb565b6001600160a01b03891660009081526101036020526040812054919250906117de906001600160801b0316866127df565b9050600781116117ee57806117f1565b60075b9050818111611800578061180b565b61180b8260016127f2565b905060008161181b8460016127f2565b61182591906127df565b90505b82811161186857600084826007811061184357611843612805565b6001600160801b039092166020929092020152806118608161281b565b915050611828565b506000805b8381116118a95784816007811061188657611886612805565b60200201516118959083612834565b9150806118a18161281b565b91505061186d565b508480156118f857506101045460fb54600160601b820463ffffffff16916118e291600160201b9091046001600160401b03169061270d565b6118ec919061270d565b816001600160801b0316105b9a9950505050505050505050565b6109028133611fd3565b61191a82826112d7565b61083957600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff191660011790556119523390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6119a082826112d7565b1561083957600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020612b25833981519152546001600160a01b031690565b600061083981611906565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611a57576107b58361202c565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611ab1575060408051601f3d908101601f19168201909252611aae918101906129a7565b60015b611b145760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610826565b600080516020612b258339815191528114611b835760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610826565b506107b58383836120c6565b6201518060fe5442611ba191906127df565b611bab9190612993565b60ff55565b806000611bbb610905565b6001600160a01b0316632d0e9b46846040518263ffffffff1660e01b8152600401611be6919061243f565b602060405180830381865afa158015611c03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c279190612798565b90506001600160a01b03811615611c3e5780611c40565b825b92506000836001600160a01b031631611c5761075a565b611c6191906127df565b61010654909150600160601b900460ff16611c7a61075a565b611c8583606461270d565b611c8f9190612993565b1015611cc95760405162461bcd60e51b815260206004820152600960248201526806c6f7720746f546f760bc1b6044820152606401610826565b6000600760ff54611cda91906127cb565b60ff546001600160a01b038716600090815261010360205260409020549192506001600160801b03908116911603611d69576001600160a01b038516600090815261010360205260409020805460019190601090611d46908490600160801b900463ffffffff166129c0565b92506101000a81548163ffffffff021916908363ffffffff160217905550611d97565b6001600160a01b038516600090815261010360205260409020805463ffffffff60801b1916600160801b1790555b60ff546001600160a01b03861660009081526101036020526040902080546001600160801b0319166001600160801b0390921691909117815582906001018260078110611de657611de6612805565b600291828204019190066010028282829054906101000a90046001600160801b0316611e129190612834565b82546001600160801b039182166101009390930a9283029190920219909116179055506001600160a01b0385166000908152610102602052604090205460ff16158015611e6657506001600160a01b038316155b15611eab5761010680546001600160401b0316906000611e85836129dd565b91906101000a8154816001600160401b0302191690836001600160401b03160217905550505b6001600160a01b0380861660009081526101026020526040808220805460ff19166001179055519186169184156108fc0291859190818181858888f19350505050158015611efd573d6000803e3d6000fd5b50604080518381526001600160a01b0385811660208301523392908716917f7872034fbcc87890e73d66eac55389e0ffdba157b89a73bd2011157ebac1d66e910160405180910390a35050505050565b6001600160a01b03163b151590565b600054610100900460ff16611fc75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610826565b565b6108398282611910565b611fdd82826112d7565b61083957611fea816120f1565b611ff5836020612103565b604051602001612006929190612a2f565b60408051601f198184030181529082905262461bcd60e51b825261082691600401612a9e565b61203581611f4d565b6120975760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610826565b600080516020612b2583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6120cf836122a5565b6000825111806120dc5750805b156107b5576120eb83836122e5565b50505050565b60606107546001600160a01b03831660145b6060600061211283600261270d565b61211d9060026127f2565b6001600160401b03811115612134576121346124ce565b6040519080825280601f01601f19166020018201604052801561215e576020820181803683370190505b509050600360fc1b8160008151811061217957612179612805565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106121a8576121a8612805565b60200101906001600160f81b031916908160001a90535060006121cc84600261270d565b6121d79060016127f2565b90505b600181111561224f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061220b5761220b612805565b1a60f81b82828151811061222157612221612805565b60200101906001600160f81b031916908160001a90535060049490941c9361224881612ad1565b90506121da565b50831561229e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610826565b9392505050565b6122ae8161202c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606122f083611f4d565b61234b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610826565b600080846001600160a01b0316846040516123669190612ae8565b600060405180830381855af49150503d80600081146123a1576040519150601f19603f3d011682016040523d82523d6000602084013e6123a6565b606091505b50915091506123ce8282604051806060016040528060278152602001612b65602791396123d7565b95945050505050565b606083156123e657508161229e565b61229e83838151156123fb5781518083602001fd5b8060405162461bcd60e51b81526004016108269190612a9e565b60006020828403121561242757600080fd5b81356001600160e01b03198116811461229e57600080fd5b6001600160a01b0391909116815260200190565b60006020828403121561246557600080fd5b5035919050565b6001600160a01b038116811461090257600080fd5b6000806040838503121561249457600080fd5b8235915060208301356124a68161246c565b809150509250929050565b6000602082840312156124c357600080fd5b813561229e8161246c565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561250c5761250c6124ce565b604052919050565b6000806040838503121561252757600080fd5b82356125328161246c565b91506020838101356001600160401b038082111561254f57600080fd5b818601915086601f83011261256357600080fd5b813581811115612575576125756124ce565b612587601f8201601f191685016124e4565b9150808252878482850101111561259d57600080fd5b80848401858401376000848284010152508093505050509250929050565b80356001600160401b03811681146125d257600080fd5b919050565b600080600080608085870312156125ed57600080fd5b84356125f88161246c565b9350612606602086016125bb565b925060408501356126168161246c565b915060608501356126268161246c565b939692955090935050565b60006020828403121561264357600080fd5b61229e826125bb565b6000806000806060858703121561266257600080fd5b843561266d8161246c565b93506020850135925060408501356001600160401b038082111561269057600080fd5b818701915087601f8301126126a457600080fd5b8135818111156126b357600080fd5b8860208285010111156126c557600080fd5b95989497505060200194505050565b6000602082840312156126e657600080fd5b813560ff8116811461229e57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610754576107546126f7565b6020808252602c90820152600080516020612b0583398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020612b0583398151915260408201526b6163746976652070726f787960a01b606082015260800190565b6000602082840312156127aa57600080fd5b815161229e8161246c565b634e487b7160e01b600052601260045260246000fd5b6000826127da576127da6127b5565b500690565b81810381811115610754576107546126f7565b80820180821115610754576107546126f7565b634e487b7160e01b600052603260045260246000fd5b60006001820161282d5761282d6126f7565b5060010190565b6001600160801b03818116838216019080821115612854576128546126f7565b5092915050565b60006020828403121561286d57600080fd5b8151801515811461229e57600080fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156128cd5784516001600160a01b0316835293830193918301916001016128a8565b50506001600160a01b03969096166060850152505050608001529392505050565b6000602080838503121561290157600080fd5b82516001600160401b038082111561291857600080fd5b818501915085601f83011261292c57600080fd5b81518181111561293e5761293e6124ce565b8060051b915061294f8483016124e4565b818152918301840191848101908884111561296957600080fd5b938501935b838510156129875784518252938501939085019061296e565b98975050505050505050565b6000826129a2576129a26127b5565b500490565b6000602082840312156129b957600080fd5b5051919050565b63ffffffff818116838216019080821115612854576128546126f7565b60006001600160401b038281166002600160401b03198101612a0157612a016126f7565b6001019392505050565b60005b83811015612a26578181015183820152602001612a0e565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351612a61816017850160208801612a0b565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612a92816028840160208801612a0b565b01602801949350505050565b6020815260008251806020840152612abd816040850160208701612a0b565b601f01601f19169190910160400192915050565b600081612ae057612ae06126f7565b506000190190565b60008251612afa818460208701612a0b565b919091019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc802cf867c2da464d4ff0ebc4dfcccdfbd65d75a8bc1c273fb02e80bf3446b516416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212207c2c27f3ebac89e1d2ff130b56a2f847b2b7d07ff8c1dfa7e3cd9f51f8ef97be64736f6c63430008130033