Address Details
contract

0xF01a6816902eC89D8adb9cbD85f4b995756bcF4A

Contract Name
LearnAndEarnImplementation
Creator
0xa34737–43edab at 0x074db5–007688
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
19666029
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
LearnAndEarnImplementation




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
200
EVM Version
istanbul




Verified at
2023-01-16T11:00:38.298108Z

contracts/learnAndEarn/LearnAndEarnImplementation.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./interfaces/ILearnAndEarn.sol";
import "./interfaces/LearnAndEarnStorageV1.sol";

contract LearnAndEarnImplementation is
    Initializable,
    PausableUpgradeable,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable,
    LearnAndEarnStorageV1
{
    using SafeERC20Upgradeable for IERC20;
    using EnumerableSet for EnumerableSet.UintSet;
    using ECDSA for bytes32;

    /**
     * @notice Triggered when a level has been funded
     *
     * @param levelId           Id of the level
     * @param sender            Address of the sender
     * @param amount            Amount of the fund
     */
    event LevelFunded(uint256 indexed levelId, address indexed sender, uint256 amount);

    /**
     * @notice Triggered when a level state has been changed
     *
     * @param levelId           Id of the level
     * @param state             New state of the level
     */
    event LevelStateChanged(uint256 indexed levelId, LevelState indexed state);

    /**
     * @notice Triggered when a reward has been claimed
     *
     * @param beneficiary    address of the beneficiary to be rewarded
     * @param levelId       the id of the level
     */
    event RewardClaimed(address indexed beneficiary, uint256 indexed levelId);

    /**
     * @notice Enforces sender to be a valid community
     */
    modifier onlyOwnerOrImpactMarketCouncil() {
        require(
            msg.sender == owner() || msg.sender == address(communityAdmin.impactMarketCouncil()),
            "LearnAndEarn: caller is not the owner nor ImpactMarketCouncil"
        );
        _;
    }

    /**
     * @notice Used to initialize a new CommunityAdmin contract
     *
     * @param _signerWalletAddress    Address of the backend wallet
     */
    function initialize(address _signerWalletAddress, ICommunityAdmin _communityAdmin)
        external
        initializer
    {
        __Ownable_init();
        __ReentrancyGuard_init();
        __Pausable_init_unchained();

        signerWalletAddress = _signerWalletAddress;
        communityAdmin = _communityAdmin;
    }

    /**
     * @notice Returns the current implementation version
     */
    function getVersion() external pure override returns (uint256) {
        return 1;
    }

    /**
     * @notice Returns the id of a level from levelList
     *
     * @param _index index of the level
     * @return id of the level
     */
    function levelListAt(uint256 _index) external view override returns (uint256) {
        return _levelList.at(_index);
    }

    /**
     * @notice Returns the number of levels
     *
     * @return uint256 number of levels
     */
    function levelListLength() external view override returns (uint256) {
        return _levelList.length();
    }

    /**
     * @notice Returns the reward amount claimed by a beneficiary for a level
     *
     * @param _levelId id of the level
     * @param _beneficiary address of the beneficiary
     * @return reward amount claimed by the beneficiary for a level
     */
    function levelClaims(uint256 _levelId, address _beneficiary)
        external
        view
        override
        returns (uint256)
    {
        return levels[_levelId].claims[_beneficiary];
    }

    /**
     * @dev Pauses the contract
     */
    function pause() public onlyOwnerOrImpactMarketCouncil {
        _pause();
    }

    /**
     * @dev Unpauses the contract
     */
    function unpause() public onlyOwnerOrImpactMarketCouncil {
        _unpause();
    }

    /** Updates the address of the backend wallet
     *
     * @param _newSignerWalletAddress address of the new backend wallet
     */
    function updateSignerWalletAddress(address _newSignerWalletAddress)
        external
        override
        onlyOwnerOrImpactMarketCouncil
    {
        signerWalletAddress = _newSignerWalletAddress;
    }

    /**
     * @notice Updates the CommunityAdmin contract address
     *
     * @param _newCommunityAdmin address of the new CommunityAdmin contract
     */
    function updateCommunityAdmin(ICommunityAdmin _newCommunityAdmin) external override onlyOwner {
        communityAdmin = _newCommunityAdmin;
    }

    /**
     * @notice Adds a new level
     *
     * @param _levelId    the id of the level
     * @param _token      the token used for reward
     */
    function addLevel(uint256 _levelId, IERC20 _token)
        external
        override
        onlyOwnerOrImpactMarketCouncil
    {
        require(
            levels[_levelId].state == LevelState.Invalid,
            "LearnAndLearn::addLevel: Invalid level id"
        );

        levels[_levelId].state = LevelState.Valid;
        levels[_levelId].token = _token;

        _levelList.add(_levelId);

        emit LevelStateChanged(_levelId, LevelState.Valid);
    }

    /**
     * @notice Pauses a level
     *
     * @param _levelId id of the level
     */
    function pauseLevel(uint256 _levelId) external override onlyOwnerOrImpactMarketCouncil {
        Level storage _level = levels[_levelId];

        require(_level.state == LevelState.Valid, "LearnAndEarn::pauseLevel: Invalid level id");

        _level.state = LevelState.Paused;

        emit LevelStateChanged(_levelId, LevelState.Paused);
    }

    /**
     * @notice Unpauses a level
     *
     * @param _levelId id of the level
     */
    function unpauseLevel(uint256 _levelId) external override onlyOwnerOrImpactMarketCouncil {
        Level storage _level = levels[_levelId];

        require(_level.state == LevelState.Paused, "LearnAndEarn::unpauseLevel: Invalid level id");

        _level.state = LevelState.Valid;

        emit LevelStateChanged(_levelId, LevelState.Valid);
    }

    /**
     * @notice Cancels a level
     *
     * @param _levelId id of the level
     * @param _fundRecipient the address of the recipient who will receive the funds allocated for this level
     */
    function cancelLevel(uint256 _levelId, address _fundRecipient)
        external
        override
        onlyOwnerOrImpactMarketCouncil
    {
        Level storage _level = levels[_levelId];

        require(
            _level.state == LevelState.Valid || _level.state == LevelState.Paused,
            "LearnAndEarn::cancelLevel: Invalid level id"
        );

        _level.state = LevelState.Canceled;
        uint256 _levelBalance = _level.balance;
        _level.balance = 0;

        _level.token.safeTransfer(_fundRecipient, _levelBalance);

        emit LevelStateChanged(_levelId, LevelState.Canceled);
    }

    /**
     * @notice Funds a level
     *
     * @param _levelId   the id of the level
     * @param _amount the amount to be funded
     */
    function fundLevel(uint256 _levelId, uint256 _amount) external override {
        Level storage _level = levels[_levelId];

        require(
            _level.state == LevelState.Valid || _level.state == LevelState.Paused,
            "LearnAndEarn::fundLevel: Invalid level id"
        );

        _level.token.safeTransferFrom(msg.sender, address(this), _amount);

        _level.balance += _amount;

        emit LevelFunded(_levelId, msg.sender, _amount);
    }

    /**
     * @notice Allows beneficiaries to claim the reward for a list of levels using a signature
     *
     * @param _beneficiary     address of the beneficiary to be rewarded
     * @param _levelIds        the ids of the levels
     * @param _rewardAmounts   the amounts of the tokens to be send to the beneficiary as reward for each level
     * @param _signatures      the signatures from the backend
     */
    function claimRewardForLevels(
        address _beneficiary,
        uint256[] calldata _levelIds,
        uint256[] calldata _rewardAmounts,
        bytes[] calldata _signatures
    ) external override {
        Level storage _level;

        require(
            _levelIds.length == _rewardAmounts.length && _levelIds.length == _signatures.length,
            "LearnAndEarn::claimRewardForLevels: Invalid data"
        );

        uint256 _index;
        bytes32 _messageHash;

        for (_index = 0; _index < _levelIds.length; _index++) {
            _level = levels[_levelIds[_index]];

            require(
                _level.state == LevelState.Valid,
                "LearnAndEarn::claimRewardForLevels: Invalid level id"
            );

            //if the beneficiary has already claimed the reward for this level,
            // or if the rewardAmount is 0, skip this level
            if (_level.claims[_beneficiary] > 0 || _rewardAmounts[_index] == 0) {
                continue;
            }

            _messageHash = keccak256(
                abi.encode(_beneficiary, _levelIds[_index], _rewardAmounts[_index])
            );

            require(
                signerWalletAddress ==
                    _messageHash.toEthSignedMessageHash().recover(_signatures[_index]),
                "LearnAndEarn::claimRewardForLevels: Invalid signature"
            );

            _level.claims[_beneficiary] = _rewardAmounts[_index];

            require(
                _level.balance >= _rewardAmounts[_index],
                "LearnAndEarn::claimRewardForLevels: Level doesn't have enough funds"
            );

            _level.token.safeTransfer(_beneficiary, _rewardAmounts[_index]);
            _level.balance -= _rewardAmounts[_index];

            emit RewardClaimed(_beneficiary, _levelIds[_index]);
        }
    }
}
        

/_openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
          

/_openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)

pragma solidity ^0.8.0;

import "../Proxy.sol";
import "./ERC1967Upgrade.sol";

/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
 * implementation behind the proxy.
 */
contract ERC1967Proxy is Proxy, ERC1967Upgrade {
    /**
     * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
     *
     * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
     * function call, and allows initializating the storage of the proxy like a Solidity constructor.
     */
    constructor(address _logic, bytes memory _data) payable {
        assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
        _upgradeToAndCall(_logic, _data, false);
    }

    /**
     * @dev Returns the current implementation address.
     */
    function _implementation() internal view virtual override returns (address impl) {
        return ERC1967Upgrade._getImplementation();
    }
}
          

/_openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeacon.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967Upgrade {
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallSecure(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        address oldImplementation = _getImplementation();

        // Initial upgrade and setup call
        _setImplementation(newImplementation);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }

        // Perform rollback test if not already in progress
        StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            Address.functionDelegateCall(
                newImplementation,
                abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
            );
            rollbackTesting.value = false;
            // Check rollback was effective
            require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
            // Finally reset to the new implementation and log the upgrade
            _upgradeTo(newImplementation);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            Address.isContract(IBeacon(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        }
    }
}
          

/_openzeppelin/contracts/proxy/Proxy.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/Proxy.sol)

pragma solidity ^0.8.0;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /**
     * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
     * and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _beforeFallback();
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external payable virtual {
        _fallback();
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
     * is empty.
     */
    receive() external payable virtual {
        _fallback();
    }

    /**
     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
     * call, or as part of the Solidity `fallback` or `receive` functions.
     *
     * If overriden should call `super._beforeFallback()`.
     */
    function _beforeFallback() internal virtual {}
}
          

/_openzeppelin/contracts/proxy/beacon/IBeacon.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 IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}
          

/_openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)

pragma solidity ^0.8.0;

import "./TransparentUpgradeableProxy.sol";
import "../../access/Ownable.sol";

/**
 * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an
 * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.
 */
contract ProxyAdmin is Ownable {
    /**
     * @dev Returns the current implementation of `proxy`.
     *
     * Requirements:
     *
     * - This contract must be the admin of `proxy`.
     */
    function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
        // We need to manually run the static call since the getter cannot be flagged as view
        // bytes4(keccak256("implementation()")) == 0x5c60da1b
        (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b");
        require(success);
        return abi.decode(returndata, (address));
    }

    /**
     * @dev Returns the current admin of `proxy`.
     *
     * Requirements:
     *
     * - This contract must be the admin of `proxy`.
     */
    function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
        // We need to manually run the static call since the getter cannot be flagged as view
        // bytes4(keccak256("admin()")) == 0xf851a440
        (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440");
        require(success);
        return abi.decode(returndata, (address));
    }

    /**
     * @dev Changes the admin of `proxy` to `newAdmin`.
     *
     * Requirements:
     *
     * - This contract must be the current admin of `proxy`.
     */
    function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {
        proxy.changeAdmin(newAdmin);
    }

    /**
     * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.
     *
     * Requirements:
     *
     * - This contract must be the admin of `proxy`.
     */
    function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {
        proxy.upgradeTo(implementation);
    }

    /**
     * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See
     * {TransparentUpgradeableProxy-upgradeToAndCall}.
     *
     * Requirements:
     *
     * - This contract must be the admin of `proxy`.
     */
    function upgradeAndCall(
        TransparentUpgradeableProxy proxy,
        address implementation,
        bytes memory data
    ) public payable virtual onlyOwner {
        proxy.upgradeToAndCall{value: msg.value}(implementation, data);
    }
}
          

/_openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)

pragma solidity ^0.8.0;

import "../ERC1967/ERC1967Proxy.sol";

/**
 * @dev This contract implements a proxy that is upgradeable by an admin.
 *
 * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
 * clashing], which can potentially be used in an attack, this contract uses the
 * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
 * things that go hand in hand:
 *
 * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
 * that call matches one of the admin functions exposed by the proxy itself.
 * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
 * implementation. If the admin tries to call a function on the implementation it will fail with an error that says
 * "admin cannot fallback to proxy target".
 *
 * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
 * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
 * to sudden errors when trying to call a function from the proxy implementation.
 *
 * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
 * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
 */
contract TransparentUpgradeableProxy is ERC1967Proxy {
    /**
     * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
     * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.
     */
    constructor(
        address _logic,
        address admin_,
        bytes memory _data
    ) payable ERC1967Proxy(_logic, _data) {
        assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
        _changeAdmin(admin_);
    }

    /**
     * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
     */
    modifier ifAdmin() {
        if (msg.sender == _getAdmin()) {
            _;
        } else {
            _fallback();
        }
    }

    /**
     * @dev Returns the current admin.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function admin() external ifAdmin returns (address admin_) {
        admin_ = _getAdmin();
    }

    /**
     * @dev Returns the current implementation.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
     */
    function implementation() external ifAdmin returns (address implementation_) {
        implementation_ = _implementation();
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
     */
    function changeAdmin(address newAdmin) external virtual ifAdmin {
        _changeAdmin(newAdmin);
    }

    /**
     * @dev Upgrade the implementation of the proxy.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
     */
    function upgradeTo(address newImplementation) external ifAdmin {
        _upgradeToAndCall(newImplementation, bytes(""), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
     * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
     * proxied contract.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
     */
    function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
        _upgradeToAndCall(newImplementation, data, true);
    }

    /**
     * @dev Returns the current admin.
     */
    function _admin() internal view virtual returns (address) {
        return _getAdmin();
    }

    /**
     * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
     */
    function _beforeFallback() internal virtual override {
        require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
        super._beforeFallback();
    }
}
          

/_openzeppelin/contracts/utils/Address.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

/_openzeppelin/contracts/utils/Context.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
          

/_openzeppelin/contracts/utils/StorageSlot.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}
          

/_openzeppelin/contracts/utils/Strings.sol

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

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}
          

/_openzeppelin/contracts/utils/cryptography/ECDSA.sol

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

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}
          

/_openzeppelin/contracts/utils/structs/EnumerableSet.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}
          

/_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/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
    uint256[49] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

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

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}
          

/_openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
    uint256[49] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
    uint256[49] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

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

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

/_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 {
        __Context_init_unchained();
    }

    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;
    }
    uint256[50] private __gap;
}
          

/contracts/ambassadors/interfaces/IAmbassadors.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

interface IAmbassadors {
    function getVersion() external pure returns(uint256);
    function isAmbassador(address _ambassador) external view returns (bool);
    function isAmbassadorOf(address _ambassador, address _community) external view returns (bool);
    function isEntityOf(address _ambassador, address _entityAddress) external view returns (bool);
    function isAmbassadorAt(address _ambassador, address _entityAddress) external view returns (bool);

    function addEntity(address _entity) external;
    function removeEntity(address _entity) external;
    function replaceEntityAccount(address _entity, address _newEntity) external;
    function addAmbassador(address _ambassador) external;
    function removeAmbassador(address _ambassador) external;
    function replaceAmbassadorAccount(address _ambassador, address _newAmbassador) external;
    function replaceAmbassador(address _oldAmbassador, address _newAmbassador) external;
    function transferAmbassador(address _ambassador, address _toEntity, bool _keepCommunities) external;
    function transferCommunityToAmbassador(address _to, address _community) external;
    function setCommunityToAmbassador(address _ambassador, address _community) external;
    function removeCommunity(address _community) external;
}
          

/contracts/community/interfaces/ICommunity.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol";
import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./ICommunityAdmin.sol";

interface ICommunity {
    enum BeneficiaryState {
        NONE, //the beneficiary hasn't been added yet
        Valid,
        Locked,
        Removed,
        AddressChanged,
        Copied  //the beneficiary has been moved in a copy community
    }

    struct Beneficiary {
        BeneficiaryState state;  //beneficiary state
        uint256 claims;          //total number of claims
        uint256 claimedAmount;   //total amount of tokens received
                                 //(based on token ratios when there are more than one token)
        uint256 lastClaim;       //block number of the last claim
        mapping(address => uint256) claimedAmounts;
    }

    struct TokenUpdates {
        address tokenAddress;    //address of the token
        uint256 ratio;           //ratio between maxClaim and previous token maxClaim
        uint256 startBlock;      //the number of the block from which the this token was "active"
    }

    function initialize(
        address _tokenAddress,
        address[] memory _managers,
        uint256 _claimAmount,
        uint256 _maxClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval,
        uint256 _minTranche,
        uint256 _maxTranche,
        uint256 _maxBeneficiaries,
        ICommunity _previousCommunity
    ) external;
    function getVersion() external pure returns(uint256);
    function previousCommunity() external view returns(ICommunity);
    function copyOf() external view returns(ICommunity);
    function copies() external view returns(address[] memory);
    function originalClaimAmount() external view returns(uint256);
    function claimAmount() external view returns(uint256);
    function baseInterval() external view returns(uint256);
    function incrementInterval() external view returns(uint256);
    function maxClaim() external view returns(uint256);
    function maxTotalClaim() external view returns(uint256);
    function validBeneficiaryCount() external view returns(uint);
    function maxBeneficiaries() external view returns(uint);
    function treasuryFunds() external view returns(uint);
    function privateFunds() external view returns(uint);
    function communityAdmin() external view returns(ICommunityAdmin);
    function cUSD() external view  returns(IERC20);
    function token() external view  returns(IERC20);
    function tokenList() external view returns(address[] memory);
    function locked() external view returns(bool);
    function beneficiaries(address _beneficiaryAddress) external view returns(
        BeneficiaryState state,
        uint256 claims,
        uint256 claimedAmount,
        uint256 lastClaim
    );
    function beneficiaryClaimedAmounts(address _beneficiaryAddress) external view
        returns (uint256[] memory claimedAmounts);
    function decreaseStep() external view returns(uint);
    function beneficiaryListAt(uint256 _index) external view returns (address);
    function impactMarketAddress() external pure returns (address);
    function beneficiaryListLength() external view returns (uint256);
    function minTranche() external view returns(uint256);
    function maxTranche() external view returns(uint256);
    function lastFundRequest() external view returns(uint256);
    function tokenUpdates(uint256 _index) external view returns (
        address tokenAddress,
        uint256 ratio,
        uint256 startBlock
    );
    function tokenUpdatesLength() external view returns (uint256);
    function isSelfFunding() external view returns (bool);
    function setBeneficiaryState(address _beneficiaryAddress, BeneficiaryState _state) external;
    function updateCommunityAdmin(ICommunityAdmin _communityAdmin) external;
    function updatePreviousCommunity(ICommunity _newPreviousCommunity) external;
    function updateBeneficiaryParams(
        uint256 _claimAmount,
        uint256 _maxClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval
    ) external;
    function updateCommunityParams(
        uint256 _minTranche,
        uint256 _maxTranche
    ) external;
    function updateMaxBeneficiaries(uint256 _newMaxBeneficiaries) external;
    function updateToken(
        IERC20 _newToken,
        address[] calldata _exchangePath,
        uint256 _claimAmount,
        uint256 _maxClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval
    ) external;
    function donate(address _sender, uint256 _amount) external;
    function addTreasuryFunds(uint256 _amount) external;
    function transfer(IERC20 _token, address _to, uint256 _amount) external;
    function addManager(address _managerAddress) external;
    function removeManager(address _managerAddress) external;
    function addBeneficiary(address _beneficiaryAddress) external;
    function addBeneficiaries(address[] memory _beneficiaryAddresses) external;
    function addBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external;
    function copyBeneficiaries(address[] memory _beneficiaryAddresses) external;
    function lockBeneficiary(address _beneficiaryAddress) external;
    function lockBeneficiaries(address[] memory _beneficiaryAddresses) external;
    function lockBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external;
    function unlockBeneficiary(address _beneficiaryAddress) external;
    function unlockBeneficiaries(address[] memory _beneficiaryAddresses) external;
    function unlockBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external;
    function removeBeneficiary(address _beneficiaryAddress) external;
    function removeBeneficiaries(address[] memory _beneficiaryAddresses) external;
    function removeBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external;
    function changeBeneficiaryAddressByManager(address _oldBeneficiaryAddress, address _newBeneficiaryAddress) external;
    function changeBeneficiaryAddress(address _newBeneficiaryAddress) external;
    function claim() external;
    function lastInterval(address _beneficiaryAddress) external view returns (uint256);
    function claimCooldown(address _beneficiaryAddress) external view returns (uint256);
    function lock() external;
    function unlock() external;
    function requestFunds() external;
    function beneficiaryJoinFromMigrated(address _beneficiaryAddress) external;
    function getInitialMaxClaim() external view returns (uint256);
    function addCopy(ICommunity _copy) external;
    function copyCommunityDetails(ICommunity _originalCommunity) external;
}
          

/contracts/community/interfaces/ICommunityAdmin.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./ICommunity.sol";
import "../../treasury/interfaces/ITreasury.sol";
import "../../governor/impactMarketCouncil/interfaces/IImpactMarketCouncil.sol";
import "../../ambassadors/interfaces/IAmbassadors.sol";

interface ICommunityAdmin {
    enum CommunityState {
        NONE,
        Valid,
        Removed,
        Migrated
    }

    function getVersion() external pure returns(uint256);
    function cUSD() external view returns(IERC20);
    function treasury() external view returns(ITreasury);
    function impactMarketCouncil() external view returns(IImpactMarketCouncil);
    function ambassadors() external view returns(IAmbassadors);
    function communityMiddleProxy() external view returns(address);
    function authorizedWalletAddress() external view returns(address);
    function minClaimAmountRatio() external view returns(uint256);
    function minClaimAmountRatioPrecision() external view returns(uint256);
    function communities(address _community) external view returns(CommunityState);
    function communityImplementation() external view returns(ICommunity);
    function communityProxyAdmin() external view returns(ProxyAdmin);
    function communityListAt(uint256 _index) external view returns (address);
    function communityListLength() external view returns (uint256);
    function treasurySafetyPercentage() external view returns (uint256);
    function treasuryMinBalance() external view returns (uint256);
    function isAmbassadorOrEntityOfCommunity(address _community, address _ambassadorOrEntity) external view returns (bool);
    function updateTreasury(ITreasury _newTreasury) external;
    function updateImpactMarketCouncil(IImpactMarketCouncil _newImpactMarketCouncil) external;
    function updateAmbassadors(IAmbassadors _newAmbassadors) external;
    function updateCommunityMiddleProxy(address _communityMiddleProxy) external;
    function updateCommunityImplementation(ICommunity _communityImplementation_) external;
    function updateAuthorizedWalletAddress(address _newSignerAddress) external;
    function updateMinClaimAmountRatio(uint256 _newMinClaimAmountRatio) external;
    function updateTreasurySafetyPercentage(uint256 _newTreasurySafetyPercentage) external;
    function updateTreasuryMinBalance(uint256 _newTreasuryMinBalance) external;
    function setCommunityToAmbassador(address _ambassador, ICommunity _communityAddress) external;
    function updateBeneficiaryParams(
        ICommunity _community,
        uint256 _claimAmount,
        uint256 _maxClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval,
        uint256 _maxBeneficiaries
    ) external;
    function updateCommunityParams(
        ICommunity _community,
        uint256 _minTranche,
        uint256 _maxTranche
    ) external;
    function updateProxyImplementation(address _communityMiddleProxy, address _newLogic) external;
    function updateCommunityToken(
        ICommunity _community,
        IERC20 _newToken,
        address[] memory _exchangePath,
        uint256 _claimAmount,
        uint256 _maxClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval
    ) external;
    function addCommunity(
        address _tokenAddress,
        address[] memory _managers,
        address _ambassador,
        uint256 _claimAmount,
        uint256 _maxClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval,
        uint256 _minTranche,
        uint256 _maxTranche,
        uint256 _maxBeneficiaries
    ) external;
    function migrateCommunity(
        address[] memory _managers,
        ICommunity _previousCommunity
    ) external;
    function splitCommunity(
        ICommunity _community,
        uint256 _numberOfCopies,
        address _ambassador,
        address[] memory _managers
    ) external;
    function removeCommunity(ICommunity _community) external;
    function fundCommunity() external returns(uint256);
    function calculateCommunityTrancheAmount(ICommunity _community) external view returns (uint256);
    function transfer(IERC20 _token, address _to, uint256 _amount) external;
    function transferFromCommunity(
        ICommunity _community,
        IERC20 _token,
        address _to,
        uint256 _amount
    ) external;
    function getCommunityProxyImplementation(address _communityProxyAddress) external view returns(address);
}
          

/contracts/governor/impactMarketCouncil/interfaces/IImpactMarketCouncil.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";

interface IImpactMarketCouncil {
    struct Proposal {
        // Unique id for looking up a proposal
        uint256 id;
        // Creator of the proposal
        address proposer;
        // The block at which voting ends: votes must be cast prior to this block
        uint256 endBlock;
        // Current number of votes in favor of this proposal
        uint256 forVotes;
        // Current number of votes in opposition to this proposal
        uint256 againstVotes;
        // Current number of votes for abstaining for this proposal
        uint256 abstainVotes;
        // Flag marking whether the proposal has been canceled
        bool canceled;
        // Flag marking whether the proposal has been executed
        bool executed;
    }

    /// @notice Ballot receipt record for a voter
    struct Receipt {
        // Whether or not a vote has been cast
        bool hasVoted;
        // Whether or not the voter supports the proposal or abstains
        uint8 support;
        // The number of votes the voter had, which were cast
        uint96 votes;
    }

    /// @notice Possible states that a proposal may be in
    enum ProposalState {
        Pending,
        Active,
        Canceled,
        Expired,
        Succeeded,
        Executed
    }
}
          

/contracts/learnAndEarn/interfaces/ILearnAndEarn.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

import "../../community/interfaces/ICommunityAdmin.sol";

interface ILearnAndEarn {
    enum LevelState {
        Invalid,
        Valid,
        Paused,
        Canceled
    }

    struct Level {
        IERC20 token;
        uint256 balance;
        LevelState state;
        mapping(address => uint256) claims;    // the reward amount claimed by beneficiaries for this level
    }

    function getVersion() external pure returns (uint256);
    function signerWalletAddress() external view returns(address);
    function communityAdmin() external view returns(ICommunityAdmin);
    function levelListLength() external view returns (uint256);
    function levelListAt(uint256 _index) external view returns (uint256);
    function levels(uint256 _levelId)
        external view returns ( IERC20 token, uint256 balance, LevelState state);
    function levelClaims(
        uint256 _levelId,
        address _beneficiary
    ) external view returns (uint256);
    function updateSignerWalletAddress(address _newSignerAddress) external;
    function updateCommunityAdmin(ICommunityAdmin _communityAdmin) external;
    function addLevel(uint256 _levelId, IERC20 _token) external;
    function fundLevel(uint256 _levelId, uint256 _amount) external;
    function pauseLevel(uint256 _levelId) external;
    function unpauseLevel(uint256 _levelId) external;
    function cancelLevel(uint256 _levelId, address _fundRecipient) external;
    function claimRewardForLevels(
        address _beneficiary,
        uint256[] calldata _levelIds,
        uint256[] calldata _rewardAmounts,
        bytes[] calldata _signatures
    ) external;
}
          

/contracts/learnAndEarn/interfaces/LearnAndEarnStorageV1.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./ILearnAndEarn.sol";

/**
 * @title Storage for LearnAndEarn
 * @notice For future upgrades, do not change LearnAndEarnStorageV1. Create a new
 * contract which implements LearnAndEarnStorageV1 and following the naming convention
 * LearnAndEarnStorageVX.
 */
abstract contract LearnAndEarnStorageV1 is ILearnAndEarn {
    address public override signerWalletAddress;
    ICommunityAdmin public override communityAdmin;
    EnumerableSet.UintSet internal _levelList;
    mapping(uint256 => Level) public override levels;
}
          

/contracts/treasury/interfaces/ITreasury.sol

//SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../../community/interfaces/ICommunityAdmin.sol";
import "./IUniswapV2Router.sol";

interface ITreasury {
    struct Token {
        uint256 rate;
        address[] exchangePath;
    }

    function getVersion() external pure returns(uint256);
    function communityAdmin() external view returns(ICommunityAdmin);
    function uniswapRouter() external view returns(IUniswapV2Router);
    function updateCommunityAdmin(ICommunityAdmin _communityAdmin) external;
    function updateUniswapRouter(IUniswapV2Router _uniswapRouter) external;
    function transfer(IERC20 _token, address _to, uint256 _amount) external;
    function isToken(address _tokenAddress) external view returns (bool);
    function tokenListLength() external view returns (uint256);
    function tokenListAt(uint256 _index) external view returns (address);
    function tokens(address _tokenAddress) external view returns (uint256 rate, address[] memory exchangePath);
    function setToken(address _tokenAddress, uint256 _rate, address[] calldata _exchangePath) external;
    function removeToken(address _tokenAddress) external;
    function getConvertedAmount(address _tokenAddress, uint256 _amount) external view returns (uint256);
    function convertAmount(
        address _tokenAddress,
        uint256 _amountIn,
        uint256 _amountOutMin,
        address[] memory _exchangePath,
        uint256 _deadline
    ) external;
}
          

/contracts/treasury/interfaces/IUniswapV2Router.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

interface IUniswapV2Router {
    function factory() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;

    function pairFor(address tokenA, address tokenB) external view returns (address);
}
          

Contract ABI

[{"type":"event","name":"LevelFunded","inputs":[{"type":"uint256","name":"levelId","internalType":"uint256","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LevelStateChanged","inputs":[{"type":"uint256","name":"levelId","internalType":"uint256","indexed":true},{"type":"uint8","name":"state","internalType":"enum ILearnAndEarn.LevelState","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RewardClaimed","inputs":[{"type":"address","name":"beneficiary","internalType":"address","indexed":true},{"type":"uint256","name":"levelId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addLevel","inputs":[{"type":"uint256","name":"_levelId","internalType":"uint256"},{"type":"address","name":"_token","internalType":"contract IERC20Upgradeable"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelLevel","inputs":[{"type":"uint256","name":"_levelId","internalType":"uint256"},{"type":"address","name":"_fundRecipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimRewardForLevels","inputs":[{"type":"address","name":"_beneficiary","internalType":"address"},{"type":"uint256[]","name":"_levelIds","internalType":"uint256[]"},{"type":"uint256[]","name":"_rewardAmounts","internalType":"uint256[]"},{"type":"bytes[]","name":"_signatures","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ICommunityAdmin"}],"name":"communityAdmin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"fundLevel","inputs":[{"type":"uint256","name":"_levelId","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersion","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_signerWalletAddress","internalType":"address"},{"type":"address","name":"_communityAdmin","internalType":"contract ICommunityAdmin"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"levelClaims","inputs":[{"type":"uint256","name":"_levelId","internalType":"uint256"},{"type":"address","name":"_beneficiary","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"levelListAt","inputs":[{"type":"uint256","name":"_index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"levelListLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"token","internalType":"contract IERC20Upgradeable"},{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint8","name":"state","internalType":"enum ILearnAndEarn.LevelState"}],"name":"levels","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pauseLevel","inputs":[{"type":"uint256","name":"_levelId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"signerWalletAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpauseLevel","inputs":[{"type":"uint256","name":"_levelId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCommunityAdmin","inputs":[{"type":"address","name":"_newCommunityAdmin","internalType":"contract ICommunityAdmin"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSignerWalletAddress","inputs":[{"type":"address","name":"_newSignerWalletAddress","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5061239b806100206000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063715018a6116100b8578063af2bc4381161007c578063af2bc43814610269578063b2596a671461027c578063b53fe8a5146102c7578063d33d4ec6146102da578063ec6f0245146102ed578063f2fde38b1461030057600080fd5b8063715018a6146102225780638456cb591461022a578063886b7767146102325780638da5cb5b146102455780639f2b30cf1461025657600080fd5b80633833a5fd1161010a5780633833a5fd146101a05780633f4ba83a146101b3578063485cc955146101bb5780635c975abb146101ce5780635fac917a146101e45780636a896a651461020f57600080fd5b80630b4a76a6146101475780630d8e6e2c1461015c5780630dca76671461017257806318a1d32f1461017a5780632effa6b51461018d575b600080fd5b61015a6101553660046120cf565b610313565b005b60015b6040519081526020015b60405180910390f35b61015f61044a565b61015a6101883660046120ab565b61045b565b61015a61019b366004612093565b610651565b61015a6101ae366004612093565b6107f2565b61015a61096c565b61015a6101c936600461201f565b610a41565b60335460ff166040519015158152602001610169565b60ca546101f7906001600160a01b031681565b6040516001600160a01b039091168152602001610169565b61015a61021d3660046120ab565b610b44565b61015a610ced565b61015a610d21565b61015f6102403660046120ab565b610df4565b6065546001600160a01b03166101f7565b60c9546101f7906001600160a01b031681565b61015a610277366004611f5a565b610e21565b6102b861028a366004612093565b60cd602052600090815260409020805460018201546002909201546001600160a01b03909116919060ff1683565b6040516101699392919061210c565b61015a6102d5366004611f76565b610f0e565b61015a6102e8366004611f5a565b611406565b61015f6102fb366004612093565b611452565b61015a61030e366004611f5a565b61145f565b600082815260cd602052604090206001600282015460ff16600381111561034a57634e487b7160e01b600052602160045260246000fd5b148061037b575060028082015460ff16600381111561037957634e487b7160e01b600052602160045260246000fd5b145b6103de5760405162461bcd60e51b815260206004820152602960248201527f4c6561726e416e644561726e3a3a66756e644c6576656c3a20496e76616c6964604482015268081b195d995b081a5960ba1b60648201526084015b60405180910390fd5b80546103f5906001600160a01b03163330856114fa565b8181600101600082825461040991906122a4565b9091555050604051828152339084907f2696a4597f56434a70ba48071ab5cd017c463335fae57a7dfa522bf0344266c19060200160405180910390a3505050565b600061045660cb61156b565b905090565b6065546001600160a01b031633148061050a575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156104bd57600080fd5b505afa1580156104d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f59190612077565b6001600160a01b0316336001600160a01b0316145b6105265760405162461bcd60e51b81526004016103d590612182565b600082815260cd602052604090206001600282015460ff16600381111561055d57634e487b7160e01b600052602160045260246000fd5b148061058e575060028082015460ff16600381111561058c57634e487b7160e01b600052602160045260246000fd5b145b6105ee5760405162461bcd60e51b815260206004820152602b60248201527f4c6561726e416e644561726e3a3a63616e63656c4c6576656c3a20496e76616c60448201526a1a59081b195d995b081a5960aa1b60648201526084016103d5565b60028101805460ff191660031790556001810180546000909155815461061e906001600160a01b03168483611575565b600360405185907fd0f7851c679986391b7a6be75abf87357c7efad81350b7a10a256a22e729292f90600090a350505050565b6065546001600160a01b0316331480610700575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156106b357600080fd5b505afa1580156106c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106eb9190612077565b6001600160a01b0316336001600160a01b0316145b61071c5760405162461bcd60e51b81526004016103d590612182565b600081815260cd602052604090206001600282015460ff16600381111561075357634e487b7160e01b600052602160045260246000fd5b146107b35760405162461bcd60e51b815260206004820152602a60248201527f4c6561726e416e644561726e3a3a70617573654c6576656c3a20496e76616c6960448201526919081b195d995b081a5960b21b60648201526084016103d5565b6002818101805460ff1916821790555b60405183907fd0f7851c679986391b7a6be75abf87357c7efad81350b7a10a256a22e729292f90600090a35050565b6065546001600160a01b03163314806108a1575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b15801561085457600080fd5b505afa158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c9190612077565b6001600160a01b0316336001600160a01b0316145b6108bd5760405162461bcd60e51b81526004016103d590612182565b600081815260cd6020526040902060028082015460ff1660038111156108f357634e487b7160e01b600052602160045260246000fd5b146109555760405162461bcd60e51b815260206004820152602c60248201527f4c6561726e416e644561726e3a3a756e70617573654c6576656c3a20496e766160448201526b1b1a59081b195d995b081a5960a21b60648201526084016103d5565b60028101805460ff191660019081179091556107c3565b6065546001600160a01b0316331480610a1b575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190612077565b6001600160a01b0316336001600160a01b0316145b610a375760405162461bcd60e51b81526004016103d590612182565b610a3f6115a5565b565b600054610100900460ff16610a5c5760005460ff1615610a60565b303b155b610ac35760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103d5565b600054610100900460ff16158015610ae5576000805461ffff19166101011790555b610aed611638565b610af561166f565b610afd61169e565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610b3f576000805461ff00191690555b505050565b6065546001600160a01b0316331480610bf3575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610ba657600080fd5b505afa158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde9190612077565b6001600160a01b0316336001600160a01b0316145b610c0f5760405162461bcd60e51b81526004016103d590612182565b600082815260cd602052604081206002015460ff166003811115610c4357634e487b7160e01b600052602160045260246000fd5b14610ca25760405162461bcd60e51b815260206004820152602960248201527f4c6561726e416e644c6561726e3a3a6164644c6576656c3a20496e76616c6964604482015268081b195d995b081a5960ba1b60648201526084016103d5565b600082815260cd6020526040902060028101805460ff1916600117905580546001600160a01b0383166001600160a01b0319909116179055610ce560cb836116d1565b5060016107c3565b6065546001600160a01b03163314610d175760405162461bcd60e51b81526004016103d5906121df565b610a3f60006116e4565b6065546001600160a01b0316331480610dd0575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8357600080fd5b505afa158015610d97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbb9190612077565b6001600160a01b0316336001600160a01b0316145b610dec5760405162461bcd60e51b81526004016103d590612182565b610a3f611736565b600082815260cd602090815260408083206001600160a01b03851684526003019091529020545b92915050565b6065546001600160a01b0316331480610ed0575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8357600080fd5b505afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb9190612077565b6001600160a01b0316336001600160a01b0316145b610eec5760405162461bcd60e51b81526004016103d590612182565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b60008584148015610f1e57508582145b610f715760405162461bcd60e51b8152602060048201526030602482015260008051602061234683398151915260448201526f6c733a20496e76616c6964206461746160801b60648201526084016103d5565b6000805b878210156113fa5760cd60008a8a85818110610fa157634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020925060016003811115610fd957634e487b7160e01b600052602160045260246000fd5b600284015460ff16600381111561100057634e487b7160e01b600052602160045260246000fd5b146110585760405162461bcd60e51b815260206004820152603460248201526000805160206123468339815191526044820152731b1cce88125b9d985b1a59081b195d995b081a5960621b60648201526084016103d5565b6001600160a01b038a1660009081526003840160205260409020541515806110a6575086868381811061109b57634e487b7160e01b600052603260045260246000fd5b905060200201356000145b156110b0576113e8565b898989848181106110d157634e487b7160e01b600052603260045260246000fd5b905060200201358888858181106110f857634e487b7160e01b600052603260045260246000fd5b9050602002013560405160200161112d939291906001600160a01b039390931683526020830191909152604082015260600190565b6040516020818303038152906040528051906020012090506111c085858481811061116857634e487b7160e01b600052603260045260246000fd5b905060200281019061117a919061225f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111ba92508591506117b19050565b90611804565b60c9546001600160a01b039081169116146112295760405162461bcd60e51b815260206004820152603560248201526000805160206123468339815191526044820152746c733a20496e76616c6964207369676e617475726560581b60648201526084016103d5565b86868381811061124957634e487b7160e01b600052603260045260246000fd5b6001600160a01b038d1660009081526003870160209081526040909120910292909201359091555086868381811061129157634e487b7160e01b600052603260045260246000fd5b905060200201358360010154101561130b5760405162461bcd60e51b8152602060048201526043602482015260008051602061234683398151915260448201527f6c733a204c6576656c20646f65736e2774206861766520656e6f7567682066756064820152626e647360e81b608482015260a4016103d5565b61134a8a88888581811061132f57634e487b7160e01b600052603260045260246000fd5b87546001600160a01b03169392602090910201359050611575565b86868381811061136a57634e487b7160e01b600052603260045260246000fd5b9050602002013583600101600082825461138491906122bc565b9091555089905088838181106113aa57634e487b7160e01b600052603260045260246000fd5b905060200201358a6001600160a01b03167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f724160405160405180910390a35b816113f2816122ff565b925050610f75565b50505050505050505050565b6065546001600160a01b031633146114305760405162461bcd60e51b81526004016103d5906121df565b60ca80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e1b60cb83611828565b6065546001600160a01b031633146114895760405162461bcd60e51b81526004016103d5906121df565b6001600160a01b0381166114ee5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103d5565b6114f7816116e4565b50565b6040516001600160a01b03808516602483015283166044820152606481018290526115659085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611834565b50505050565b6000610e1b825490565b6040516001600160a01b038316602482015260448101829052610b3f90849063a9059cbb60e01b9060640161152e565b60335460ff166115ee5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103d5565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600054610100900460ff1661165f5760405162461bcd60e51b81526004016103d590612214565b611667611906565b610a3f61192d565b600054610100900460ff166116965760405162461bcd60e51b81526004016103d590612214565b610a3f61195d565b600054610100900460ff166116c55760405162461bcd60e51b81526004016103d590612214565b6033805460ff19169055565b60006116dd838361198b565b9392505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60335460ff161561177c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103d5565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861161b3390565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b600080600061181385856119da565b9150915061182081611a4a565b509392505050565b60006116dd8383611c4b565b6000611889826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c839092919063ffffffff16565b805190915015610b3f57808060200190518101906118a79190612057565b610b3f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103d5565b600054610100900460ff16610a3f5760405162461bcd60e51b81526004016103d590612214565b600054610100900460ff166119545760405162461bcd60e51b81526004016103d590612214565b610a3f336116e4565b600054610100900460ff166119845760405162461bcd60e51b81526004016103d590612214565b6001609755565b60008181526001830160205260408120546119d257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e1b565b506000610e1b565b600080825160411415611a115760208301516040840151606085015160001a611a0587828585611c9a565b94509450505050611a43565b825160401415611a3b5760208301516040840151611a30868383611d87565b935093505050611a43565b506000905060025b9250929050565b6000816004811115611a6c57634e487b7160e01b600052602160045260246000fd5b1415611a755750565b6001816004811115611a9757634e487b7160e01b600052602160045260246000fd5b1415611ae55760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103d5565b6002816004811115611b0757634e487b7160e01b600052602160045260246000fd5b1415611b555760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103d5565b6003816004811115611b7757634e487b7160e01b600052602160045260246000fd5b1415611bd05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016103d5565b6004816004811115611bf257634e487b7160e01b600052602160045260246000fd5b14156114f75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016103d5565b6000826000018281548110611c7057634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6060611c928484600085611db6565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611cd15750600090506003611d7e565b8460ff16601b14158015611ce957508460ff16601c14155b15611cfa5750600090506004611d7e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d4e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d7757600060019250925050611d7e565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01611da887828885611c9a565b935093505050935093915050565b606082471015611e175760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103d5565b843b611e655760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103d5565b600080866001600160a01b03168587604051611e8191906120f0565b60006040518083038185875af1925050503d8060008114611ebe576040519150601f19603f3d011682016040523d82523d6000602084013e611ec3565b606091505b5091509150611ed3828286611ede565b979650505050505050565b60608315611eed5750816116dd565b825115611efd5782518084602001fd5b8160405162461bcd60e51b81526004016103d5919061214f565b60008083601f840112611f28578182fd5b50813567ffffffffffffffff811115611f3f578182fd5b6020830191508360208260051b8501011115611a4357600080fd5b600060208284031215611f6b578081fd5b81356116dd81612330565b60008060008060008060006080888a031215611f90578283fd5b8735611f9b81612330565b9650602088013567ffffffffffffffff80821115611fb7578485fd5b611fc38b838c01611f17565b909850965060408a0135915080821115611fdb578485fd5b611fe78b838c01611f17565b909650945060608a0135915080821115611fff578384fd5b5061200c8a828b01611f17565b989b979a50959850939692959293505050565b60008060408385031215612031578182fd5b823561203c81612330565b9150602083013561204c81612330565b809150509250929050565b600060208284031215612068578081fd5b815180151581146116dd578182fd5b600060208284031215612088578081fd5b81516116dd81612330565b6000602082840312156120a4578081fd5b5035919050565b600080604083850312156120bd578182fd5b82359150602083013561204c81612330565b600080604083850312156120e1578182fd5b50508035926020909101359150565b600082516121028184602087016122d3565b9190910192915050565b6001600160a01b038416815260208101839052606081016004831061214157634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b602081526000825180602084015261216e8160408501602087016122d3565b601f01601f19169190910160400192915050565b6020808252603d908201527f4c6561726e416e644561726e3a2063616c6c6572206973206e6f74207468652060408201527f6f776e6572206e6f7220496d706163744d61726b6574436f756e63696c000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000808335601e19843603018112612275578283fd5b83018035915067ffffffffffffffff82111561228f578283fd5b602001915036819003821315611a4357600080fd5b600082198211156122b7576122b761231a565b500190565b6000828210156122ce576122ce61231a565b500390565b60005b838110156122ee5781810151838201526020016122d6565b838111156115655750506000910152565b60006000198214156123135761231361231a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146114f757600080fdfe4c6561726e416e644561726e3a3a636c61696d526577617264466f724c657665a2646970667358221220e739afbf77093860404901247595cee442a5e71e9bf8459fae9d0f1c93d1451364736f6c63430008040033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063715018a6116100b8578063af2bc4381161007c578063af2bc43814610269578063b2596a671461027c578063b53fe8a5146102c7578063d33d4ec6146102da578063ec6f0245146102ed578063f2fde38b1461030057600080fd5b8063715018a6146102225780638456cb591461022a578063886b7767146102325780638da5cb5b146102455780639f2b30cf1461025657600080fd5b80633833a5fd1161010a5780633833a5fd146101a05780633f4ba83a146101b3578063485cc955146101bb5780635c975abb146101ce5780635fac917a146101e45780636a896a651461020f57600080fd5b80630b4a76a6146101475780630d8e6e2c1461015c5780630dca76671461017257806318a1d32f1461017a5780632effa6b51461018d575b600080fd5b61015a6101553660046120cf565b610313565b005b60015b6040519081526020015b60405180910390f35b61015f61044a565b61015a6101883660046120ab565b61045b565b61015a61019b366004612093565b610651565b61015a6101ae366004612093565b6107f2565b61015a61096c565b61015a6101c936600461201f565b610a41565b60335460ff166040519015158152602001610169565b60ca546101f7906001600160a01b031681565b6040516001600160a01b039091168152602001610169565b61015a61021d3660046120ab565b610b44565b61015a610ced565b61015a610d21565b61015f6102403660046120ab565b610df4565b6065546001600160a01b03166101f7565b60c9546101f7906001600160a01b031681565b61015a610277366004611f5a565b610e21565b6102b861028a366004612093565b60cd602052600090815260409020805460018201546002909201546001600160a01b03909116919060ff1683565b6040516101699392919061210c565b61015a6102d5366004611f76565b610f0e565b61015a6102e8366004611f5a565b611406565b61015f6102fb366004612093565b611452565b61015a61030e366004611f5a565b61145f565b600082815260cd602052604090206001600282015460ff16600381111561034a57634e487b7160e01b600052602160045260246000fd5b148061037b575060028082015460ff16600381111561037957634e487b7160e01b600052602160045260246000fd5b145b6103de5760405162461bcd60e51b815260206004820152602960248201527f4c6561726e416e644561726e3a3a66756e644c6576656c3a20496e76616c6964604482015268081b195d995b081a5960ba1b60648201526084015b60405180910390fd5b80546103f5906001600160a01b03163330856114fa565b8181600101600082825461040991906122a4565b9091555050604051828152339084907f2696a4597f56434a70ba48071ab5cd017c463335fae57a7dfa522bf0344266c19060200160405180910390a3505050565b600061045660cb61156b565b905090565b6065546001600160a01b031633148061050a575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156104bd57600080fd5b505afa1580156104d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f59190612077565b6001600160a01b0316336001600160a01b0316145b6105265760405162461bcd60e51b81526004016103d590612182565b600082815260cd602052604090206001600282015460ff16600381111561055d57634e487b7160e01b600052602160045260246000fd5b148061058e575060028082015460ff16600381111561058c57634e487b7160e01b600052602160045260246000fd5b145b6105ee5760405162461bcd60e51b815260206004820152602b60248201527f4c6561726e416e644561726e3a3a63616e63656c4c6576656c3a20496e76616c60448201526a1a59081b195d995b081a5960aa1b60648201526084016103d5565b60028101805460ff191660031790556001810180546000909155815461061e906001600160a01b03168483611575565b600360405185907fd0f7851c679986391b7a6be75abf87357c7efad81350b7a10a256a22e729292f90600090a350505050565b6065546001600160a01b0316331480610700575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156106b357600080fd5b505afa1580156106c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106eb9190612077565b6001600160a01b0316336001600160a01b0316145b61071c5760405162461bcd60e51b81526004016103d590612182565b600081815260cd602052604090206001600282015460ff16600381111561075357634e487b7160e01b600052602160045260246000fd5b146107b35760405162461bcd60e51b815260206004820152602a60248201527f4c6561726e416e644561726e3a3a70617573654c6576656c3a20496e76616c6960448201526919081b195d995b081a5960b21b60648201526084016103d5565b6002818101805460ff1916821790555b60405183907fd0f7851c679986391b7a6be75abf87357c7efad81350b7a10a256a22e729292f90600090a35050565b6065546001600160a01b03163314806108a1575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b15801561085457600080fd5b505afa158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c9190612077565b6001600160a01b0316336001600160a01b0316145b6108bd5760405162461bcd60e51b81526004016103d590612182565b600081815260cd6020526040902060028082015460ff1660038111156108f357634e487b7160e01b600052602160045260246000fd5b146109555760405162461bcd60e51b815260206004820152602c60248201527f4c6561726e416e644561726e3a3a756e70617573654c6576656c3a20496e766160448201526b1b1a59081b195d995b081a5960a21b60648201526084016103d5565b60028101805460ff191660019081179091556107c3565b6065546001600160a01b0316331480610a1b575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190612077565b6001600160a01b0316336001600160a01b0316145b610a375760405162461bcd60e51b81526004016103d590612182565b610a3f6115a5565b565b600054610100900460ff16610a5c5760005460ff1615610a60565b303b155b610ac35760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103d5565b600054610100900460ff16158015610ae5576000805461ffff19166101011790555b610aed611638565b610af561166f565b610afd61169e565b60c980546001600160a01b038086166001600160a01b03199283161790925560ca8054928516929091169190911790558015610b3f576000805461ff00191690555b505050565b6065546001600160a01b0316331480610bf3575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610ba657600080fd5b505afa158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde9190612077565b6001600160a01b0316336001600160a01b0316145b610c0f5760405162461bcd60e51b81526004016103d590612182565b600082815260cd602052604081206002015460ff166003811115610c4357634e487b7160e01b600052602160045260246000fd5b14610ca25760405162461bcd60e51b815260206004820152602960248201527f4c6561726e416e644c6561726e3a3a6164644c6576656c3a20496e76616c6964604482015268081b195d995b081a5960ba1b60648201526084016103d5565b600082815260cd6020526040902060028101805460ff1916600117905580546001600160a01b0383166001600160a01b0319909116179055610ce560cb836116d1565b5060016107c3565b6065546001600160a01b03163314610d175760405162461bcd60e51b81526004016103d5906121df565b610a3f60006116e4565b6065546001600160a01b0316331480610dd0575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8357600080fd5b505afa158015610d97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbb9190612077565b6001600160a01b0316336001600160a01b0316145b610dec5760405162461bcd60e51b81526004016103d590612182565b610a3f611736565b600082815260cd602090815260408083206001600160a01b03851684526003019091529020545b92915050565b6065546001600160a01b0316331480610ed0575060ca60009054906101000a90046001600160a01b03166001600160a01b031663502791b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8357600080fd5b505afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb9190612077565b6001600160a01b0316336001600160a01b0316145b610eec5760405162461bcd60e51b81526004016103d590612182565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b60008584148015610f1e57508582145b610f715760405162461bcd60e51b8152602060048201526030602482015260008051602061234683398151915260448201526f6c733a20496e76616c6964206461746160801b60648201526084016103d5565b6000805b878210156113fa5760cd60008a8a85818110610fa157634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020925060016003811115610fd957634e487b7160e01b600052602160045260246000fd5b600284015460ff16600381111561100057634e487b7160e01b600052602160045260246000fd5b146110585760405162461bcd60e51b815260206004820152603460248201526000805160206123468339815191526044820152731b1cce88125b9d985b1a59081b195d995b081a5960621b60648201526084016103d5565b6001600160a01b038a1660009081526003840160205260409020541515806110a6575086868381811061109b57634e487b7160e01b600052603260045260246000fd5b905060200201356000145b156110b0576113e8565b898989848181106110d157634e487b7160e01b600052603260045260246000fd5b905060200201358888858181106110f857634e487b7160e01b600052603260045260246000fd5b9050602002013560405160200161112d939291906001600160a01b039390931683526020830191909152604082015260600190565b6040516020818303038152906040528051906020012090506111c085858481811061116857634e487b7160e01b600052603260045260246000fd5b905060200281019061117a919061225f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111ba92508591506117b19050565b90611804565b60c9546001600160a01b039081169116146112295760405162461bcd60e51b815260206004820152603560248201526000805160206123468339815191526044820152746c733a20496e76616c6964207369676e617475726560581b60648201526084016103d5565b86868381811061124957634e487b7160e01b600052603260045260246000fd5b6001600160a01b038d1660009081526003870160209081526040909120910292909201359091555086868381811061129157634e487b7160e01b600052603260045260246000fd5b905060200201358360010154101561130b5760405162461bcd60e51b8152602060048201526043602482015260008051602061234683398151915260448201527f6c733a204c6576656c20646f65736e2774206861766520656e6f7567682066756064820152626e647360e81b608482015260a4016103d5565b61134a8a88888581811061132f57634e487b7160e01b600052603260045260246000fd5b87546001600160a01b03169392602090910201359050611575565b86868381811061136a57634e487b7160e01b600052603260045260246000fd5b9050602002013583600101600082825461138491906122bc565b9091555089905088838181106113aa57634e487b7160e01b600052603260045260246000fd5b905060200201358a6001600160a01b03167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f724160405160405180910390a35b816113f2816122ff565b925050610f75565b50505050505050505050565b6065546001600160a01b031633146114305760405162461bcd60e51b81526004016103d5906121df565b60ca80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e1b60cb83611828565b6065546001600160a01b031633146114895760405162461bcd60e51b81526004016103d5906121df565b6001600160a01b0381166114ee5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103d5565b6114f7816116e4565b50565b6040516001600160a01b03808516602483015283166044820152606481018290526115659085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611834565b50505050565b6000610e1b825490565b6040516001600160a01b038316602482015260448101829052610b3f90849063a9059cbb60e01b9060640161152e565b60335460ff166115ee5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103d5565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600054610100900460ff1661165f5760405162461bcd60e51b81526004016103d590612214565b611667611906565b610a3f61192d565b600054610100900460ff166116965760405162461bcd60e51b81526004016103d590612214565b610a3f61195d565b600054610100900460ff166116c55760405162461bcd60e51b81526004016103d590612214565b6033805460ff19169055565b60006116dd838361198b565b9392505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60335460ff161561177c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103d5565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861161b3390565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b600080600061181385856119da565b9150915061182081611a4a565b509392505050565b60006116dd8383611c4b565b6000611889826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c839092919063ffffffff16565b805190915015610b3f57808060200190518101906118a79190612057565b610b3f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103d5565b600054610100900460ff16610a3f5760405162461bcd60e51b81526004016103d590612214565b600054610100900460ff166119545760405162461bcd60e51b81526004016103d590612214565b610a3f336116e4565b600054610100900460ff166119845760405162461bcd60e51b81526004016103d590612214565b6001609755565b60008181526001830160205260408120546119d257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e1b565b506000610e1b565b600080825160411415611a115760208301516040840151606085015160001a611a0587828585611c9a565b94509450505050611a43565b825160401415611a3b5760208301516040840151611a30868383611d87565b935093505050611a43565b506000905060025b9250929050565b6000816004811115611a6c57634e487b7160e01b600052602160045260246000fd5b1415611a755750565b6001816004811115611a9757634e487b7160e01b600052602160045260246000fd5b1415611ae55760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103d5565b6002816004811115611b0757634e487b7160e01b600052602160045260246000fd5b1415611b555760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103d5565b6003816004811115611b7757634e487b7160e01b600052602160045260246000fd5b1415611bd05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016103d5565b6004816004811115611bf257634e487b7160e01b600052602160045260246000fd5b14156114f75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016103d5565b6000826000018281548110611c7057634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6060611c928484600085611db6565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611cd15750600090506003611d7e565b8460ff16601b14158015611ce957508460ff16601c14155b15611cfa5750600090506004611d7e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d4e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d7757600060019250925050611d7e565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01611da887828885611c9a565b935093505050935093915050565b606082471015611e175760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103d5565b843b611e655760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103d5565b600080866001600160a01b03168587604051611e8191906120f0565b60006040518083038185875af1925050503d8060008114611ebe576040519150601f19603f3d011682016040523d82523d6000602084013e611ec3565b606091505b5091509150611ed3828286611ede565b979650505050505050565b60608315611eed5750816116dd565b825115611efd5782518084602001fd5b8160405162461bcd60e51b81526004016103d5919061214f565b60008083601f840112611f28578182fd5b50813567ffffffffffffffff811115611f3f578182fd5b6020830191508360208260051b8501011115611a4357600080fd5b600060208284031215611f6b578081fd5b81356116dd81612330565b60008060008060008060006080888a031215611f90578283fd5b8735611f9b81612330565b9650602088013567ffffffffffffffff80821115611fb7578485fd5b611fc38b838c01611f17565b909850965060408a0135915080821115611fdb578485fd5b611fe78b838c01611f17565b909650945060608a0135915080821115611fff578384fd5b5061200c8a828b01611f17565b989b979a50959850939692959293505050565b60008060408385031215612031578182fd5b823561203c81612330565b9150602083013561204c81612330565b809150509250929050565b600060208284031215612068578081fd5b815180151581146116dd578182fd5b600060208284031215612088578081fd5b81516116dd81612330565b6000602082840312156120a4578081fd5b5035919050565b600080604083850312156120bd578182fd5b82359150602083013561204c81612330565b600080604083850312156120e1578182fd5b50508035926020909101359150565b600082516121028184602087016122d3565b9190910192915050565b6001600160a01b038416815260208101839052606081016004831061214157634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b602081526000825180602084015261216e8160408501602087016122d3565b601f01601f19169190910160400192915050565b6020808252603d908201527f4c6561726e416e644561726e3a2063616c6c6572206973206e6f74207468652060408201527f6f776e6572206e6f7220496d706163744d61726b6574436f756e63696c000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000808335601e19843603018112612275578283fd5b83018035915067ffffffffffffffff82111561228f578283fd5b602001915036819003821315611a4357600080fd5b600082198211156122b7576122b761231a565b500190565b6000828210156122ce576122ce61231a565b500390565b60005b838110156122ee5781810151838201526020016122d6565b838111156115655750506000910152565b60006000198214156123135761231361231a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146114f757600080fdfe4c6561726e416e644561726e3a3a636c61696d526577617264466f724c657665a2646970667358221220e739afbf77093860404901247595cee442a5e71e9bf8459fae9d0f1c93d1451364736f6c63430008040033