Address Details
contract

0xBfd0B66fB07a38081Cf6A0A4113aAfcbEA8Ba11a

Contract Name
CommunityImplementation
Creator
0xa34737–43edab at 0x107021–163acf
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
22837334
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
CommunityImplementation




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




Optimization runs
200
EVM Version
istanbul




Verified at
2023-05-26T17:53:26.253480Z

contracts/community/CommunityImplementation.sol

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

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.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/ICommunity.sol";
import "./interfaces/ICommunityAdmin.sol";
import "./interfaces/CommunityStorageV4.sol";

/**
 * @notice Welcome to the Community contract. For each community
 * there will be one proxy contract deployed by CommunityAdmin.
 * The implementation of the proxy is this contract. This enable
 * us to save tokens on the contract itself, and avoid the problems
 * of having everything in one single contract.
 *Each community has it's own members and and managers.
 */
contract CommunityImplementation is
    Initializable,
    AccessControlUpgradeable,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable,
    CommunityStorageV4
{
    using SafeERC20Upgradeable for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;
    using ECDSA for bytes32;

    bytes32 private constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
    uint256 private constant DEFAULT_AMOUNT = 1e16;
    uint256 private constant MAX_TOKEN_LIST_LENGTH = 10;

    /**
     * @notice Triggered when a manager has been added
     *
     * @param manager           Address of the manager that triggered the event
     *                          or address of the CommunityAdmin if it's first manager
     * @param account           Address of the manager that has been added
     */
    event ManagerAdded(address indexed manager, address indexed account);

    /**
     * @notice Triggered when a manager has been removed
     *
     * @param manager           Address of the manager that triggered the event
     * @param account           Address of the manager that has been removed
     */
    event ManagerRemoved(address indexed manager, address indexed account);

    /**
     * @notice Triggered when a beneficiary has been added
     *
     * @param manager           Address of the manager that triggered the event
     * @param beneficiary       Address of the beneficiary that has been added
     */
    event BeneficiaryAdded(address indexed manager, address indexed beneficiary);

    /**
     * @notice Triggered when a beneficiary has been copied
     *
     * @param manager           Address of the manager that triggered the event
     * @param beneficiary       Address of the beneficiary that has been added
     */
    event BeneficiaryCopied(address indexed manager, address indexed beneficiary);

    /**
     * @notice Triggered when a beneficiary has been locked
     *
     * @param manager           Address of the manager that triggered the event
     * @param beneficiary       Address of the beneficiary that has been locked
     */
    event BeneficiaryLocked(address indexed manager, address indexed beneficiary);

    /**
     * @notice Triggered when a beneficiary has been unlocked
     *
     * @param manager           Address of the manager that triggered the event
     * @param beneficiary       Address of the beneficiary that has been unlocked
     */
    event BeneficiaryUnlocked(address indexed manager, address indexed beneficiary);

    /**
     * @notice Triggered when a beneficiary has been removed
     *
     * @param manager           Address of the manager that triggered the event
     * @param beneficiary       Address of the beneficiary that has been removed
     */
    event BeneficiaryRemoved(address indexed manager, address indexed beneficiary);

    /**
     * @notice Triggered when a beneficiary has claimed
     *
     * @param beneficiary       Address of the beneficiary that has claimed
     * @param amount            Amount of the claim
     */
    event BeneficiaryClaim(address indexed beneficiary, uint256 amount);

    /**
     * @notice Triggered when a community has been locked
     *
     * @param manager           Address of the manager that triggered the event
     */
    event CommunityLocked(address indexed manager);

    /**
     * @notice Triggered when a community has been unlocked
     *
     * @param manager           Address of the manager that triggered the event
     */
    event CommunityUnlocked(address indexed manager);

    /**
     * @notice Triggered when a manager has requested funds for community
     *
     * @param manager           Address of the manager that triggered the event
     */
    event FundsRequested(address indexed manager);

    /**
     * @notice Triggered when someone has donated token
     *
     * @param donor             Address of the donor
     * @param amount            Amount of the donation
     */
    event Donate(address indexed donor, uint256 amount);

    /**
     * @notice Triggered when a beneficiary from previous community has joined in the current community
     *
     * @param beneficiary       Address of the beneficiary
     */
    event BeneficiaryJoined(address indexed beneficiary);

    /**
     * @notice Triggered when two beneficiaries has been merged
     *
     * @param beneficiary1       Address of the first beneficiary
     * @param beneficiary2       Address of the second beneficiary
     */
    event BeneficiaryAddressChanged(address indexed beneficiary1, address indexed beneficiary2);

    /**
     * @notice Triggered when beneficiary params has been updated
     *
     * @param oldOriginalClaimAmount    Old originalClaimAmount value
     * @param oldMaxTotalClaim          Old maxTotalClaim value
     * @param oldDecreaseStep           Old decreaseStep value
     * @param oldBaseInterval           Old baseInterval value
     * @param oldIncrementInterval      Old incrementInterval value
     * @param newOriginalClaimAmount    New originalClaimAmount value
     * @param newMaxTotalClaim          New maxTotalClaim value
     * @param newDecreaseStep           New decreaseStep value
     * @param newBaseInterval           New baseInterval value
     * @param newIncrementInterval      New incrementInterval value
     *
     * For further information regarding each parameter, see
     * *Community* smart contract initialize method.
     */
    event BeneficiaryParamsUpdated(
        uint256 oldOriginalClaimAmount,
        uint256 oldMaxTotalClaim,
        uint256 oldDecreaseStep,
        uint256 oldBaseInterval,
        uint256 oldIncrementInterval,
        uint256 newOriginalClaimAmount,
        uint256 newMaxTotalClaim,
        uint256 newDecreaseStep,
        uint256 newBaseInterval,
        uint256 newIncrementInterval
    );

    /**
     * @notice Triggered when community params has been updated
     *
     * @param oldMinTranche        Old minTranche value
     * @param oldMaxTranche        Old maxTranche value
     * @param newMinTranche        New minTranche value
     * @param newMaxTranche        New maxTranche value
     *
     * For further information regarding each parameter, see
     * *Community* smart contract initialize method.
     */
    event CommunityParamsUpdated(
        uint256 oldMinTranche,
        uint256 oldMaxTranche,
        uint256 newMinTranche,
        uint256 newMaxTranche
    );

    /**
     * @notice Triggered when communityAdmin has been updated
     *
     * @param oldCommunityAdmin   Old communityAdmin address
     * @param newCommunityAdmin   New communityAdmin address
     */
    event CommunityAdminUpdated(
        address indexed oldCommunityAdmin,
        address indexed newCommunityAdmin
    );

    /**
     * @notice Triggered when previousCommunity has been updated
     *
     * @param oldPreviousCommunity   Old previousCommunity address
     * @param newPreviousCommunity   New previousCommunity address
     */
    event PreviousCommunityUpdated(
        address indexed oldPreviousCommunity,
        address indexed newPreviousCommunity
    );

    /**
     * @notice Triggered when maxBeneficiaries has been updated
     *
     * @param oldMaxBeneficiaries   Old maxBeneficiaries value
     * @param newMaxBeneficiaries   New maxBeneficiaries value
     */
    event MaxBeneficiariesUpdated(uint256 oldMaxBeneficiaries, uint256 newMaxBeneficiaries);

    /**
     * @notice Triggered when token address has been updated
     *
     * @param oldTokenAddress   Old token address
     * @param newTokenAddress   New token address
     */
    event TokenUpdated(address indexed oldTokenAddress, address indexed newTokenAddress);

    /**
     * @notice Triggered when an amount of an ERC20 has been transferred from this contract to an address
     *
     * @param token               ERC20 token address
     * @param to                  Address of the receiver
     * @param amount              Amount of the transaction
     */
    event TransferERC20(address indexed token, address indexed to, uint256 amount);

    /**
     * @notice Triggered when claimAmount has been changed
     *
     * @param oldClaimAmount   Old claimAmount value
     * @param newClaimAmount   New claimAmount value
     */
    event ClaimAmountUpdated(uint256 oldClaimAmount, uint256 newClaimAmount);

    /**
     * @notice Enforces sender to be a valid beneficiary
     */
    modifier onlyValidBeneficiary() {
        require(
            _beneficiaries[msg.sender].state == BeneficiaryState.Valid,
            "Community: NOT_VALID_BENEFICIARY"
        );
        _;
    }

    /**
     * @notice Enforces sender to have manager role
     */
    modifier onlyManagers() {
        require(hasRole(MANAGER_ROLE, msg.sender), "Community: NOT_MANAGER");
        _;
    }

    /**
     * @notice Enforces sender to be the community ambassador or entity ambassador responsible
     */
    modifier onlyAmbassadorOrEntity() {
        require(
            communityAdmin.isAmbassadorOrEntityOfCommunity(address(this), msg.sender),
            "Community: NOT_AMBASSADOR_OR_ENTITY"
        );
        _;
    }

    /**
     * @notice Enforces sender to be the owner or community ambassador or entity ambassador responsible
     */
    modifier onlyOwnerOrAmbassadorOrEntity() {
        require(
            msg.sender == owner() ||
                communityAdmin.isAmbassadorOrEntityOfCommunity(address(this), msg.sender),
            "Community: NOT_OWNER_OR_AMBASSADOR_OR_ENTITY"
        );
        _;
    }

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

    /**
     * @notice Enforces sender to be a valid beneficiary
     */
    modifier onlyCommunityCopy() {
        require(_copies.contains(msg.sender), "Community: Invalid community copy");
        _;
    }

    /**
     * @notice Used to initialize a new Community contract
     *
     * @param _tokenAddress        Address of the token used by the community
     * @param _managers            Community's initial managers
     *                             Will be able to add others
     * @param _originalClaimAmount      Maximum base amount to be claim by the beneficiary
     * @param _maxTotalClaim       Limit that a beneficiary can claim in total
     * @param _decreaseStep        Value decreased from maxTotalClaim each time a beneficiary is added
     * @param _baseInterval        Base interval to start claiming
     * @param _incrementInterval   Increment interval used in each claim
     * @param _minTranche          Minimum amount that the community will receive when requesting funds
     * @param _maxTranche          Maximum amount that the community will receive when requesting funds
     * @param _maxBeneficiaries    Maximum valid beneficiaries number
     * @param _previousCommunity   Previous smart contract address of community
     */
    function initialize(
        address _tokenAddress,
        address[] memory _managers,
        uint256 _originalClaimAmount,
        uint256 _maxTotalClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval,
        uint256 _minTranche,
        uint256 _maxTranche,
        uint256 _maxBeneficiaries,
        ICommunity _previousCommunity
    ) external override initializer {
        require(
            _baseInterval > _incrementInterval,
            "Community::initialize: baseInterval must be greater than incrementInterval"
        );

        require(
            _maxTotalClaim >= _originalClaimAmount,
            "Community::initialize: originalClaimAmount to big"
        );

        require(
            _minTranche <= _maxTranche,
            "Community::initialize: minTranche should not be greater than maxTranche"
        );

        communityAdmin = ICommunityAdmin(msg.sender);

        __AccessControl_init();
        __Ownable_init();
        __ReentrancyGuard_init();

        _token = IERC20(_tokenAddress);
        originalClaimAmount = _originalClaimAmount;
        claimAmount = _originalClaimAmount;
        baseInterval = _baseInterval;
        incrementInterval = _incrementInterval;
        maxTotalClaim = _maxTotalClaim;
        minTranche = _minTranche;
        maxTranche = _maxTranche;
        previousCommunity = _previousCommunity;
        decreaseStep = _decreaseStep;
        maxBeneficiaries = _maxBeneficiaries;
        locked = false;

        transferOwnership(msg.sender);

        // MANAGER_ROLE is the admin for the MANAGER_ROLE
        // so every manager is able to add or remove other managers
        _setRoleAdmin(MANAGER_ROLE, MANAGER_ROLE);

        _setupRole(MANAGER_ROLE, msg.sender);
        emit ManagerAdded(msg.sender, msg.sender);

        uint256 _i;
        uint256 _numberOfManagers = _managers.length;
        for (; _i < _numberOfManagers; _i++) {
            _addManager(_managers[_i]);
        }
    }

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

    /**
     * @notice Returns the cUSD contract address
     * todo: to be removed, use token() instead
     */
    function cUSD() public view override returns (IERC20) {
        return address(_token) != address(0) ? _token : communityAdmin.cUSD();
    }

    /**
     * @notice Returns the address of the token used by this community
     */
    function token() public view override returns (IERC20) {
        return address(_token) != address(0) ? _token : communityAdmin.cUSD();
    }

    /**
     * @notice Returns the length of the beneficiaryList
     */
    function beneficiaryListLength() external view override returns (uint256) {
        return beneficiaryList.length();
    }

    /**
     * @notice Returns an address from the beneficiaryList
     *
     * @param index_ index value
     * @return address of the beneficiary
     */
    function beneficiaryListAt(uint256 index_) external view override returns (address) {
        return beneficiaryList.at(index_);
    }

    /**
     * @notice Returns the 0 address
     * only used for backwards compatibility
     */
    function impactMarketAddress() public pure override returns (address) {
        return address(0);
    }

    /**
     * @notice Returns the data of a beneficiary
     *
     * @param _beneficiaryAddress    address of the beneficiary
     * @return state                 the status of the beneficiary
     * @return claims                how many times the beneficiary has claimed
     * @return claimedAmount         the amount he has claimed
     * @return lastClaim             block number of the last claim
     */
    function beneficiaries(address _beneficiaryAddress)
        external
        view
        override
        returns (
            BeneficiaryState state,
            uint256 claims,
            uint256 claimedAmount,
            uint256 lastClaim
        )
    {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        return (
            _beneficiary.state,
            _beneficiary.claims,
            _calculateBeneficiaryClaimedAmount(_beneficiary, block.number),
            _beneficiary.lastClaim
        );
    }

    /**
     * @notice Returns the beneficiary's claimed amounts for each token
     *
     * @param _beneficiaryAddress    address of the beneficiary
     * @return claimedAmounts        a uint256 array with all claimed amounts in the same order as tokenList array
     */
    function beneficiaryClaimedAmounts(address _beneficiaryAddress)
        external
        view
        override
        returns (uint256[] memory claimedAmounts)
    {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        uint256[] memory _claimedAmounts = new uint256[](_tokenList.length());
        uint256 _length = _tokenList.length();

        for (uint256 _index = 0; _index < _length; _index++) {
            _claimedAmounts[_index] = _beneficiary.claimedAmounts[_tokenList.at(_index)];
        }

        if (_claimedAmounts.length == 0) {
            _claimedAmounts = new uint256[](1);
            _claimedAmounts[0] = _beneficiary.claimedAmount;
        }

        return _claimedAmounts;
    }

    /**
     * @notice Returns the length of the tokenList
     */
    function tokenUpdatesLength() external view override returns (uint256) {
        return tokenUpdates.length;
    }

    //    function tokenList() external view override returns (address[] memory) {
    //        uint256 _length = _tokenList.length();
    //        address[] memory _tokenListArray = new address[](_length);
    //
    //        for (uint256 _index = 0; _index < _length; _index++) {
    //            _tokenListArray[_index] = _tokenList.at(_index);
    //        }
    //
    //        if (_tokenListArray.length == 0) {
    //            _tokenListArray = new address[](1);
    //            _tokenListArray[0] = address(token());
    //        }
    //
    //        return _tokenListArray;
    //    }

    function tokenList() external view override returns (address[] memory) {
        if (_tokenList.length() == 0) {
            address[] memory _tokenListArray = new address[](1);
            _tokenListArray[0] = address(token());
            return _tokenListArray;
        }

        return _tokenList.values();
    }

    /**
     * @notice Returns the list with all communities copies
     */
    function copies() external view override returns (address[] memory) {
        return _copies.values();
    }

    /**
     * @notice Returns the amount that can be claimed by a beneficiary in total
     * todo: remove it after the frontend is updated to the new function: maxTotalClaim()
     */
    function maxClaim() external view override returns (uint256) {
        return maxTotalClaim;
    }

    function isSelfFunding() public view override returns (bool) {
        return maxTranche == 0;
    }

    /** Updates the address of the communityAdmin
     *
     * @param _newCommunityAdmin address of the new communityAdmin
     */
    function updateCommunityAdmin(ICommunityAdmin _newCommunityAdmin) external override onlyOwner {
        emit CommunityAdminUpdated(address(communityAdmin), address(_newCommunityAdmin));
        communityAdmin = _newCommunityAdmin;

        _addManager(address(communityAdmin));
    }

    /** Updates the address of the previousCommunity
     *
     * @param _newPreviousCommunity address of the new previousCommunity
     */
    function updatePreviousCommunity(ICommunity _newPreviousCommunity) external override onlyOwner {
        emit PreviousCommunityUpdated(address(previousCommunity), address(_newPreviousCommunity));
        previousCommunity = _newPreviousCommunity;
    }

    /** Updates beneficiary params
     *
     * @param _originalClaimAmount maximum base amount to be claim by the beneficiary
     * @param _maxTotalClaim limit that a beneficiary can claim  in total
     * @param _decreaseStep value decreased from maxTotalClaim each time a is beneficiary added
     * @param _baseInterval base interval to start claiming
     * @param _incrementInterval increment interval used in each claim
     *
     * @notice be aware that max claim will not be the same with the value you've provided
     *             maxTotalClaim = _maxTotalClaim - validBeneficiaryCount * _decreaseStep
     */
    function updateBeneficiaryParams(
        uint256 _originalClaimAmount,
        uint256 _maxTotalClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval
    ) public override onlyOwner {
        require(
            _baseInterval > _incrementInterval,
            "Community::updateBeneficiaryParams: baseInterval must be greater than incrementInterval"
        );
        require(
            _maxTotalClaim >= _originalClaimAmount + validBeneficiaryCount * _decreaseStep,
            "Community::updateBeneficiaryParams: originalClaimAmount too big"
        );

        emit BeneficiaryParamsUpdated(
            originalClaimAmount,
            maxTotalClaim,
            decreaseStep,
            baseInterval,
            incrementInterval,
            _originalClaimAmount,
            _maxTotalClaim,
            _decreaseStep,
            _baseInterval,
            _incrementInterval
        );

        originalClaimAmount = _originalClaimAmount;
        maxTotalClaim = _maxTotalClaim - validBeneficiaryCount * _decreaseStep;
        decreaseStep = _decreaseStep;
        baseInterval = _baseInterval;
        incrementInterval = _incrementInterval;

        _updateClaimAmount();
    }

    /** @notice Updates params of a community
     *
     * @param _minTranche minimum amount that the community will receive when requesting funds
     * @param _maxTranche maximum amount that the community will receive when requesting funds
     */
    function updateCommunityParams(uint256 _minTranche, uint256 _maxTranche)
        external
        override
        onlyOwner
    {
        require(
            _minTranche <= _maxTranche,
            "Community::updateCommunityParams: minTranche should not be greater than maxTranche"
        );

        emit CommunityParamsUpdated(minTranche, maxTranche, _minTranche, _maxTranche);

        minTranche = _minTranche;
        maxTranche = _maxTranche;
    }

    /** @notice Updates maxBeneficiaries
     *
     * @param _newMaxBeneficiaries new _maxBeneficiaries value
     */
    function updateMaxBeneficiaries(uint256 _newMaxBeneficiaries)
        external
        override
        onlyOwnerOrAmbassadorOrEntity
    {
        emit MaxBeneficiariesUpdated(maxBeneficiaries, _newMaxBeneficiaries);
        maxBeneficiaries = _newMaxBeneficiaries;
    }

    /** @notice Updates token address
     *   !!!!!! you must be careful about _maxTotalClaim value. This value determines all beneficiaries claimedAmounts
     */
    function updateToken(
        IERC20 _newToken,
        bytes calldata _exchangePath,
        uint256 _originalClaimAmount,
        uint256 _maxTotalClaim,
        uint256 _decreaseStep,
        uint256 _baseInterval,
        uint256 _incrementInterval
    ) external override onlyOwner {
        ITreasury _treasury = communityAdmin.treasury();

        require(
            tokenUpdates.length < MAX_TOKEN_LIST_LENGTH,
            "Community::updateToken: Token list length too big"
        );

        require(
            _newToken != token(),
            "Community::updateToken: New token cannot be the same as the current token"
        );

        require(
            _newToken == communityAdmin.cUSD() || _treasury.isToken(address(_newToken)),
            "Community::updateToken: Invalid token"
        );

        //for communities deployed before this functionality, we need to add the current token before changing it
        if (tokenUpdates.length == 0) {
            tokenUpdates.push(TokenUpdates(address(token()), 1e18, 0));
            _tokenList.add(address(token()));
        }

        uint256 _conversionRatio = (1e18 * _maxTotalClaim) / getInitialMaxTotalClaim();

        tokenUpdates.push(TokenUpdates(address(_newToken), _conversionRatio, block.number));
        _tokenList.add(address(_newToken));

        uint256 _balance = token().balanceOf(address(this));

        if (_balance > 0) {
            IUniswapRouter02 _uniswapRouter = _treasury.lpSwap().uniswapRouter();

            token().approve(address(_uniswapRouter), _balance);

            IUniswapRouter02.ExactInputParams memory params = IUniswapRouter02.ExactInputParams({
                path: _exchangePath,
                recipient: address(this),
                amountIn: _balance,
                amountOutMinimum: 0
            });

            // Executes the swap.
            uint256 amountOut = _uniswapRouter.exactInput(params);
        }

        emit TokenUpdated(address(_token), address(_newToken));
        _token = _newToken;

        updateBeneficiaryParams(
            _originalClaimAmount,
            _maxTotalClaim,
            _decreaseStep,
            _baseInterval,
            _incrementInterval
        );
    }

    /**
     * @notice Adds a new copy of this community
     *
     * @param _copy  address of the 'child' community
     */
    function addCopy(ICommunity _copy) external override onlyOwner {
        _copies.add(address(_copy));
    }

    /**
     * @notice Copies the original community details that haven't been copied in the initialize method
     *  !!used only by communityAdmin.copyCommunity method
     *
     * @param _originalCommunity  address of the 'parent' community
     */
    function copyCommunityDetails(ICommunity _originalCommunity) external override onlyOwner {
        copyOf = _originalCommunity;

        uint256 _index;

        //copy tokens
        uint256 _tokenUpdatesLength = copyOf.tokenUpdatesLength();

        uint256 _initialCommunityCopyTokensLength = tokenUpdates.length;
        for (_index = 0; _index < _initialCommunityCopyTokensLength; _index++) {
            tokenUpdates.pop();
        }

        address _tokenAddress;
        uint256 _ratio;
        uint256 _startBlock;
        for (_index = 0; _index < _tokenUpdatesLength; _index++) {
            (_tokenAddress, _ratio, _startBlock) = copyOf.tokenUpdates(_index);
            tokenUpdates.push(TokenUpdates(_tokenAddress, _ratio, _startBlock));
        }

        //        copy tokenList
        uint256 _initialCommunityCopyTokenListLength = _tokenList.length();

        while (_initialCommunityCopyTokenListLength > 0) {
            _tokenList.remove(_tokenList.at(0));
            --_initialCommunityCopyTokenListLength;
        }

        address[] memory _tokenListToCopy = copyOf.tokenList();
        uint256 _tokenListLength = _tokenListToCopy.length;

        for (_index = 0; _index < _tokenListLength; _index++) {
            _tokenList.add(_tokenListToCopy[_index]);
        }
    }

    /**
     * @notice Adds a new manager
     *
     * @param _account address of the manager to be added
     */
    function addManager(address _account) public override onlyAmbassadorOrEntity {
        _addManager(_account);
    }

    /**
     * @notice Remove an existing manager
     *
     * @param _account address of the manager to be removed
     */
    function removeManager(address _account) external override onlyAmbassadorOrEntity {
        require(
            hasRole(MANAGER_ROLE, _account),
            "Community::removeManager: This account doesn't have manager role"
        );
        require(
            _account != address(communityAdmin),
            "Community::removeManager: You are not allow to remove communityAdmin"
        );
        super._revokeRole(MANAGER_ROLE, _account);
        emit ManagerRemoved(msg.sender, _account);
    }

    /**
     * @notice Enforces managers to use addManager method
     */
    function grantRole(bytes32, address) public pure override {
        require(false, "Community::grantRole: You are not allow to use this method");
    }

    /**
     * @notice Enforces managers to use removeManager method
     */
    function revokeRole(bytes32, address) public pure override {
        require(false, "Community::revokeRole: You are not allow to use this method");
    }

    /**
     * @notice Adds a new beneficiary
     *
     * @param _beneficiaryAddress address of the beneficiary to be added
     */
    function addBeneficiary(address _beneficiaryAddress)
        external
        override
        whenNotLocked
        onlyManagers
        nonReentrant
    {
        _addBeneficiary(_beneficiaryAddress);

        emit BeneficiaryAdded(msg.sender, _beneficiaryAddress);
    }

    /**
     * @notice Adds new beneficiaries
     *
     * @param _beneficiaryAddresses addresses of the beneficiaries to be added
     */
    function addBeneficiaries(address[] memory _beneficiaryAddresses)
        external
        override
        whenNotLocked
        onlyManagers
        nonReentrant
    {
        _addBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Adds new beneficiaries using a manager signature
     *
     * @param _beneficiaryAddresses addresses of the beneficiaries to be added
     * @param _expirationTimestamp  timestamp when the signature will expire/expired
     * @param _signature            the signature of a manager
     */
    function addBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external override whenNotLocked nonReentrant {
        _checkManagerSignature(_expirationTimestamp, _signature);

        _addBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Copies beneficiaries from the original community
     *
     * @param _beneficiaryAddresses addresses of the beneficiaries to be copied
     */
    function copyBeneficiaries(address[] memory _beneficiaryAddresses)
        external
        override
        whenNotLocked
        onlyManagers
        nonReentrant
    {
        require(
            address(copyOf) != address(0),
            "Community::copyBeneficiaries: Invalid parent community"
        );
        _copyBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Sets a beneficiary's state
     *
     * @param _beneficiaryAddress address of the beneficiary
     * @param _state  beneficiary's state
     */
    function setBeneficiaryState(address _beneficiaryAddress, BeneficiaryState _state)
        external
        override
        whenNotLocked
        onlyCommunityCopy
        nonReentrant
    {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        _changeBeneficiaryState(_beneficiary, _state);
    }

    /**
     * @notice Locks a valid beneficiary
     *
     * @param _beneficiaryAddress address of the beneficiary to be locked
     */
    function lockBeneficiary(address _beneficiaryAddress)
        external
        override
        whenNotLocked
        onlyManagers
    {
        _lockBeneficiary(_beneficiaryAddress);
    }

    /**
     * @notice Locks a list of beneficiaries
     *
     * @param _beneficiaryAddresses       addresses of the beneficiaries to be locked
     */
    function lockBeneficiaries(address[] memory _beneficiaryAddresses)
        external
        override
        whenNotLocked
        onlyManagers
    {
        _lockBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Locks a list of beneficiaries using a manager signature
     *
     * @param _beneficiaryAddresses addresses of the beneficiaries to be locked
     * @param _expirationTimestamp  timestamp when the signature will expire/expired
     * @param _signature            the signature of a manager
     */
    function lockBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external override whenNotLocked {
        _checkManagerSignature(_expirationTimestamp, _signature);
        _lockBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice  Unlocks a locked beneficiary
     *
     * @param _beneficiaryAddress address of the beneficiary to be unlocked
     */
    function unlockBeneficiary(address _beneficiaryAddress)
        external
        override
        whenNotLocked
        onlyManagers
    {
        _unlockBeneficiary(_beneficiaryAddress);
    }

    /**
     * @notice Unlocks a list of beneficiaries
     *
     * @param _beneficiaryAddresses       addresses of the beneficiaries to be unlocked
     */
    function unlockBeneficiaries(address[] memory _beneficiaryAddresses)
        external
        override
        whenNotLocked
        onlyManagers
    {
        _unlockBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Unlocks a list of beneficiaries using a manager signature
     *
     * @param _beneficiaryAddresses addresses of the beneficiaries to be unlocked
     * @param _expirationTimestamp  timestamp when the signature will expire/expired
     * @param _signature            the signature of a manager
     */
    function unlockBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external override whenNotLocked {
        _checkManagerSignature(_expirationTimestamp, _signature);
        _unlockBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Remove an existing beneficiary
     *
     * @param _beneficiaryAddress address of the beneficiary to be removed
     */
    function removeBeneficiary(address _beneficiaryAddress) external override onlyManagers {
        _removeBeneficiary(_beneficiaryAddress);
    }

    /**
     * @notice Removes a list of beneficiaries
     *
     * @param _beneficiaryAddresses       addresses of the beneficiaries to be removed
     */
    function removeBeneficiaries(address[] memory _beneficiaryAddresses)
        external
        override
        onlyManagers
    {
        _removeBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Removes a list of beneficiaries using a manager signature
     *
     * @param _beneficiaryAddresses addresses of the beneficiaries to be removed
     * @param _expirationTimestamp  timestamp when the signature will expire/expired
     * @param _signature            the signature of a manager
     */
    function removeBeneficiariesUsingSignature(
        address[] memory _beneficiaryAddresses,
        uint256 _expirationTimestamp,
        bytes calldata _signature
    ) external override {
        _checkManagerSignature(_expirationTimestamp, _signature);
        _removeBeneficiaries(_beneficiaryAddresses);
    }

    /**
     * @notice Allows a beneficiary from the previousCommunity to join in this community
     */
    function beneficiaryJoinFromMigrated(address _beneficiaryAddress) external override {
        // no need to check if it's a beneficiary, as the state is copied
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        require(
            _beneficiary.state == BeneficiaryState.NONE,
            "Community::beneficiaryJoinFromMigrated: Beneficiary exists"
        );

        (
            BeneficiaryState _oldBeneficiaryState,
            uint256 _oldBeneficiaryClaims,
            uint256 _oldBeneficiaryClaimedAmount,
            uint256 _oldBeneficiaryLastClaim
        ) = previousCommunity.beneficiaries(_beneficiaryAddress);

        _changeBeneficiaryState(_beneficiary, _oldBeneficiaryState);
        _beneficiary.claims = _oldBeneficiaryClaims;
        _beneficiary.lastClaim = _oldBeneficiaryLastClaim;
        _beneficiary.claimedAmount = _oldBeneficiaryClaimedAmount;

        beneficiaryList.add(_beneficiaryAddress);

        emit BeneficiaryJoined(_beneficiaryAddress);
    }

    /**
     * @notice Changes the address of a beneficiary
     * this action adds claim details from both addresses
     *
     * @dev used by managers
     */
    function changeBeneficiaryAddressByManager(
        address _oldBeneficiaryAddress,
        address _newBeneficiaryAddress
    ) external override onlyManagers {
        _changeBeneficiaryAddress(_oldBeneficiaryAddress, _newBeneficiaryAddress);
    }

    /**
     * @notice Allows a beneficiary to use another address
     * this action adds claim details from both addresses
     *
     * @dev used by beneficiaries
     */
    function changeBeneficiaryAddress(address _newBeneficiaryAddress) external override {
        require(
            _beneficiaries[_newBeneficiaryAddress].state == BeneficiaryState.NONE,
            "Community::changeBeneficiaryAddress: Invalid beneficiary"
        );

        _changeBeneficiaryAddress(msg.sender, _newBeneficiaryAddress);
    }

    /**
     * @dev Transfers tokens to a valid beneficiary
     */
    function claim() external override whenNotLocked onlyValidBeneficiary nonReentrant {
        _requestFunds();

        Beneficiary storage _beneficiary = _beneficiaries[msg.sender];

        uint256 _totalClaimedAmount = _calculateBeneficiaryClaimedAmount(
            _beneficiary,
            block.number
        );

        require(claimCooldown(msg.sender) <= block.number, "Community::claim: NOT_YET");
        require(
            _totalClaimedAmount < maxTotalClaim,
            "Community::claim: Already claimed everything"
        );

        uint256 _claimAmount = claimAmount > 0 ? claimAmount : originalClaimAmount;

        uint256 _toClaim = _claimAmount <= maxTotalClaim - _totalClaimedAmount
            ? _claimAmount
            : maxTotalClaim - _totalClaimedAmount;

        //this is necessary for communities with version < 3
        //and for beneficiaries that haven't claimed after updating to v3
        if (tokenUpdates.length > 1 && _beneficiary.lastClaim < tokenUpdates[1].startBlock) {
            _beneficiary.claimedAmounts[tokenUpdates[0].tokenAddress] = _beneficiary.claimedAmount;
        }

        _beneficiary.claimedAmount = _totalClaimedAmount + _toClaim;
        _beneficiary.claims++;
        _beneficiary.lastClaim = block.number;

        if (tokenUpdates.length > 1) {
            _beneficiary.claimedAmounts[address(token())] += _toClaim;
        }

        IERC20Upgradeable(address(token())).safeTransfer(msg.sender, _toClaim);
        emit BeneficiaryClaim(msg.sender, _toClaim);
    }

    /**
     * @notice Returns the number of blocks that a beneficiary have to wait between claims
     *
     * @param _beneficiaryAddress address of the beneficiary
     * @return uint256 number of blocks for the lastInterval
     */
    function lastInterval(address _beneficiaryAddress) public view override returns (uint256) {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];
        if (_beneficiary.claims == 0) {
            return 0;
        }
        return baseInterval + (_beneficiary.claims - 1) * incrementInterval;
    }

    /**
     * @notice Returns the block number when a beneficiary can claim again
     *
     * @param _beneficiaryAddress address of the beneficiary
     * @return uint256 number of block when the beneficiary can claim
     */
    function claimCooldown(address _beneficiaryAddress) public view override returns (uint256) {
        return _beneficiaries[_beneficiaryAddress].lastClaim + lastInterval(_beneficiaryAddress);
    }

    /**
     * @notice Locks the community
     */
    function lock() external override onlyAmbassadorOrEntity {
        locked = true;
        emit CommunityLocked(msg.sender);
    }

    /**
     * @notice Unlocks the community
     */
    function unlock() external override onlyAmbassadorOrEntity {
        locked = false;
        emit CommunityUnlocked(msg.sender);
    }

    /**
     * @notice Requests treasury funds from the communityAdmin
     */
    function requestFunds() external override whenNotLocked onlyManagers {
        _requestFunds();
    }

    /**
     * @notice Transfers tokens from donor to this community
     * Used by donationToCommunity method from DonationMiner contract
     *
     * @param _sender address of the sender
     * @param _amount amount to be donated
     */
    function donate(address _sender, uint256 _amount) external override nonReentrant {
        IERC20Upgradeable(address(token())).safeTransferFrom(_sender, address(this), _amount);
        privateFunds += _amount;

        _updateClaimAmount();

        emit Donate(msg.sender, _amount);
    }

    /**
     * @notice Increases the treasuryFunds value
     * Used by communityAdmin after an amount of tokens are sent from the treasury
     *
     * @param _amount amount to be added to treasuryFunds
     */
    function addTreasuryFunds(uint256 _amount) external override onlyOwner {
        treasuryFunds += _amount;
    }

    /**
     * @notice Transfers an amount of an ERC20 from this contract to an address
     *
     * @param _token address of the ERC20 token
     * @param _to address of the receiver
     * @param _amount amount of the transaction
     */
    function transfer(
        IERC20 _token,
        address _to,
        uint256 _amount
    ) external override onlyOwner nonReentrant {
        IERC20Upgradeable(address(_token)).safeTransfer(_to, _amount);

        if (address(_token) == address(token())) {
            _updateClaimAmount();
        }

        emit TransferERC20(address(_token), _to, _amount);
    }

    /**
     * @notice Returns the initial maxTotalClaim
     * todo: do be deleted after updating all communities to v3
     */
    function getInitialMaxClaim() public view override returns (uint256) {
        return maxTotalClaim + validBeneficiaryCount * decreaseStep;
    }

    /**
     * @notice Returns the initial maxTotalClaim
     */
    function getInitialMaxTotalClaim() public view returns (uint256) {
        return maxTotalClaim + validBeneficiaryCount * decreaseStep;
    }

    /**
     * @notice Adds a new beneficiary
     *
     * @param _beneficiaryAddress address of the beneficiary to be added
     */
    function _addBeneficiary(address _beneficiaryAddress) internal {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        if (_beneficiary.state != BeneficiaryState.NONE) {
            return;
        }

        if (address(copyOf) != address(0)) {
            BeneficiaryState _originalState;
            (_originalState, , , ) = copyOf.beneficiaries(_beneficiaryAddress);
            require(
                _originalState == BeneficiaryState.NONE,
                "Community::addBeneficiary: Invalid beneficiary state"
            );
        }

        _changeBeneficiaryState(_beneficiary, BeneficiaryState.Valid);
        _beneficiary.lastClaim = block.number;

        beneficiaryList.add(_beneficiaryAddress);

        // send default amount when adding a new beneficiary
        IERC20Upgradeable(address(token())).safeTransfer(_beneficiaryAddress, DEFAULT_AMOUNT);
    }

    /**
     * @notice Adds new beneficiaries
     *
     * @param _beneficiaryAddresses addresses of beneficiaries to be added
     */
    function _addBeneficiaries(address[] memory _beneficiaryAddresses) internal {
        uint256 _index;
        uint256 _numberOfBeneficiaries = _beneficiaryAddresses.length;
        for (; _index < _numberOfBeneficiaries; _index++) {
            _addBeneficiary(_beneficiaryAddresses[_index]);
            emit BeneficiaryAdded(msg.sender, _beneficiaryAddresses[_index]);
        }
    }

    /**
     * @notice Copy a beneficiary
     *
     * @param _beneficiaryAddress address of the beneficiary to be copied
     */
    function _copyBeneficiary(address _beneficiaryAddress) internal {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        if (_beneficiary.state != BeneficiaryState.NONE) {
            return;
        }

        BeneficiaryState _originalState;
        uint256 _originalClaims;
        uint256 _originalClaimedAmount;
        uint256 _originalLastClaim;
        (_originalState, _originalClaims, _originalClaimedAmount, _originalLastClaim) = copyOf
            .beneficiaries(_beneficiaryAddress);

        require(
            _originalState != BeneficiaryState.Copied,
            "Community::copyBeneficiary: Beneficiary already copied"
        );

        _changeBeneficiaryState(_beneficiary, _originalState);
        _beneficiary.claims = _originalClaims;
        _beneficiary.claimedAmount = _originalClaimedAmount;
        _beneficiary.lastClaim = _originalLastClaim;

        uint256[] memory _originalClaimedAmounts = copyOf.beneficiaryClaimedAmounts(
            _beneficiaryAddress
        );
        address[] memory _originalTokens = copyOf.tokenList();
        uint256 _originalLength = _originalClaimedAmounts.length;

        for (uint256 _index = 0; _index < _originalLength; _index++) {
            if (_tokenList.contains(_originalTokens[_index])) {
                _beneficiary.claimedAmounts[_originalTokens[_index]] = _originalClaimedAmounts[
                    _index
                ];
            }
        }

        copyOf.setBeneficiaryState(_beneficiaryAddress, BeneficiaryState.Copied);

        beneficiaryList.add(_beneficiaryAddress);

        emit BeneficiaryCopied(msg.sender, _beneficiaryAddress);
    }

    /**
     * @notice Copies beneficiaries
     *
     * @param _beneficiaryAddresses addresses of beneficiaries to be copied
     */
    function _copyBeneficiaries(address[] memory _beneficiaryAddresses) internal {
        uint256 _index;
        uint256 _numberOfBeneficiaries = _beneficiaryAddresses.length;
        for (; _index < _numberOfBeneficiaries; _index++) {
            _copyBeneficiary(_beneficiaryAddresses[_index]);
        }
    }

    /**
     * @notice Locks beneficiary
     *
     * @param _beneficiaryAddress address of beneficiary to be locked
     */
    function _lockBeneficiary(address _beneficiaryAddress) internal {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        if (_beneficiary.state == BeneficiaryState.Valid) {
            _changeBeneficiaryState(_beneficiary, BeneficiaryState.Locked);
            emit BeneficiaryLocked(msg.sender, _beneficiaryAddress);
        }
    }

    /**
     * @notice Locks beneficiaries
     *
     * @param _beneficiaryAddresses addresses of beneficiaries to be locked
     */
    function _lockBeneficiaries(address[] memory _beneficiaryAddresses) internal {
        uint256 _index;
        uint256 _numberOfBeneficiaries = _beneficiaryAddresses.length;

        for (; _index < _numberOfBeneficiaries; _index++) {
            _lockBeneficiary(_beneficiaryAddresses[_index]);
        }
    }

    /**
     * @notice Unlocks beneficiary
     *
     * @param _beneficiaryAddress address of beneficiary to be unlocked
     */
    function _unlockBeneficiary(address _beneficiaryAddress) internal {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        if (_beneficiary.state == BeneficiaryState.Locked) {
            _changeBeneficiaryState(_beneficiary, BeneficiaryState.Valid);
            emit BeneficiaryUnlocked(msg.sender, _beneficiaryAddress);
        }
    }

    /**
     * @notice Unlocks beneficiaries
     *
     * @param _beneficiaryAddresses addresses of beneficiaries to be unlocked
     */
    function _unlockBeneficiaries(address[] memory _beneficiaryAddresses) internal {
        uint256 _index;
        uint256 _numberOfBeneficiaries = _beneficiaryAddresses.length;

        for (; _index < _numberOfBeneficiaries; _index++) {
            _unlockBeneficiary(_beneficiaryAddresses[_index]);
        }
    }

    /**
     * @notice Removes beneficiary
     *
     * @param _beneficiaryAddress address of beneficiary to be removed
     */
    function _removeBeneficiary(address _beneficiaryAddress) internal {
        Beneficiary storage _beneficiary = _beneficiaries[_beneficiaryAddress];

        if (
            _beneficiary.state == BeneficiaryState.Valid ||
            _beneficiary.state == BeneficiaryState.Locked
        ) {
            _changeBeneficiaryState(_beneficiary, BeneficiaryState.Removed);
            emit BeneficiaryRemoved(msg.sender, _beneficiaryAddress);
        }
    }

    /**
     * @notice Removes beneficiaries
     *
     * @param _beneficiaryAddresses addresses of beneficiaries to be removed
     */
    function _removeBeneficiaries(address[] memory _beneficiaryAddresses) internal {
        uint256 _index;
        uint256 _numberOfBeneficiaries = _beneficiaryAddresses.length;

        for (; _index < _numberOfBeneficiaries; _index++) {
            _removeBeneficiary(_beneficiaryAddresses[_index]);
        }
    }

    /**
     * @notice Changes the address of a beneficiary
     * this action adds claim details from both addresses
     */
    function _changeBeneficiaryAddress(
        address _oldBeneficiaryAddress,
        address _newBeneficiaryAddress
    ) internal {
        require(
            _oldBeneficiaryAddress != _newBeneficiaryAddress,
            "Community::changeBeneficiaryAddress: Beneficiaries must be different"
        );

        Beneficiary storage _oldBeneficiary = _beneficiaries[_oldBeneficiaryAddress];
        Beneficiary storage _newBeneficiary = _beneficiaries[_newBeneficiaryAddress];

        require(
            _oldBeneficiary.state != BeneficiaryState.AddressChanged &&
                _oldBeneficiary.state != BeneficiaryState.NONE,
            "Community::changeBeneficiaryAddress: Invalid beneficiary"
        );
        require(
            _newBeneficiary.state != BeneficiaryState.AddressChanged,
            "Community::changeBeneficiaryAddress: Invalid target beneficiary"
        );

        if (_newBeneficiary.state == BeneficiaryState.NONE) {
            _changeBeneficiaryState(_newBeneficiary, _oldBeneficiary.state);
        }

        _changeBeneficiaryState(_oldBeneficiary, BeneficiaryState.AddressChanged);

        _newBeneficiary.claims += _oldBeneficiary.claims;

        // we have to align both beneficiaries lastClaim and claimedAmount
        // we choose the bigger lastClaim as the alignment point
        if (_newBeneficiary.lastClaim > _oldBeneficiary.lastClaim) {
            // _newBeneficiary.claimedAmount was updated later than _oldBeneficiary.claimedAmount
            // we have to _calculateBeneficiaryClaimedAmount for _oldBeneficiary
            //      taking into account all token updates between  _oldBeneficiary.lasClaim and _newBeneficiary.lastClaim
            _newBeneficiary.claimedAmount += _calculateBeneficiaryClaimedAmount(
                _oldBeneficiary,
                _newBeneficiary.lastClaim
            );
        } else {
            // _oldBeneficiary.claimedAmount was updated later than _newBeneficiary.claimedAmount
            // we have to _calculateBeneficiaryClaimedAmount for _newBeneficiary
            //      taking into account all token updates between _newBeneficiary.lasClaim and _oldBeneficiary.lastClaim
            _newBeneficiary.claimedAmount =
                _oldBeneficiary.claimedAmount +
                _calculateBeneficiaryClaimedAmount(_newBeneficiary, _oldBeneficiary.lastClaim);
            _newBeneficiary.lastClaim = _oldBeneficiary.lastClaim;
        }

        uint256 _tokensLength = _tokenList.length();
        address _tokenAddress;
        for (uint256 _index = 0; _index < _tokensLength; _index++) {
            _tokenAddress = _tokenList.at(_index);
            _newBeneficiary.claimedAmounts[_tokenAddress] += _oldBeneficiary.claimedAmounts[
                _tokenAddress
            ];
        }

        emit BeneficiaryAddressChanged(_oldBeneficiaryAddress, _newBeneficiaryAddress);
    }

    /**
     * @notice Checks a manager signature
     *
     * @param _expirationTimestamp  timestamp when the signature will expire/expired
     * @param _signature            the signature of a manager
     */
    function _checkManagerSignature(uint256 _expirationTimestamp, bytes calldata _signature)
        internal
    {
        require(
            msg.sender == communityAdmin.authorizedWalletAddress(),
            "Community: Sender must be the backend wallet"
        );
        require(_expirationTimestamp >= block.timestamp, "Community: Signature too old");

        bytes32 _messageHash = keccak256(
            abi.encode(msg.sender, address(this), _expirationTimestamp)
        );

        address _signerAddress = _messageHash.toEthSignedMessageHash().recover(_signature);
        require(hasRole(MANAGER_ROLE, _signerAddress), "Community: Invalid signature");
    }

    /**
     * @notice Calculates the claimed amount of a beneficiary based on all currencies
     *
     * @param _beneficiary                 the beneficiary
     * @param _skipTokenUpdatesAfterBlock  the method will ignore all token updates made after this block
     *                                     used only by merge beneficiaries methods
     */
    function _calculateBeneficiaryClaimedAmount(
        Beneficiary storage _beneficiary,
        uint256 _skipTokenUpdatesAfterBlock
    ) internal view returns (uint256) {
        uint256 _tokenUpdatesLength = tokenUpdates.length;
        if (_tokenUpdatesLength < 2) {
            return _beneficiary.claimedAmount;
        }

        uint256 _computedClaimAmount = _beneficiary.claimedAmount;

        //if beneficiary didn't claim for a long time and the token has been changed,
        //we multiply the claimed amount with all token ratios that user haven't claimed
        for (
            uint256 _index = _tokenUpdatesLength - 1;
            tokenUpdates[_index].startBlock > _beneficiary.lastClaim;
            _index--
        ) {
            if (_skipTokenUpdatesAfterBlock < tokenUpdates[_index].startBlock) {
                continue;
            }
            _computedClaimAmount = (_computedClaimAmount * tokenUpdates[_index].ratio) / 1e18;
        }

        return _computedClaimAmount;
    }

    /**
     * @notice Adds a new manager
     *
     * @param _account address of the manager to be added
     */
    function _addManager(address _account) internal {
        if (!hasRole(MANAGER_ROLE, _account)) {
            super._grantRole(MANAGER_ROLE, _account);
            emit ManagerAdded(msg.sender, _account);
        }
    }

    function _updateClaimAmount() internal {
        uint256 _newClaimAmount;
        uint256 _minClaimAmountRatio = communityAdmin.minClaimAmountRatio();
        uint256 _minClaimAmountRatioPrecision = communityAdmin.minClaimAmountRatioPrecision();

        if (
            validBeneficiaryCount == 0 ||
            isSelfFunding() ||
            _minClaimAmountRatio <= _minClaimAmountRatioPrecision
        ) {
            _newClaimAmount = originalClaimAmount;
        } else {
            _newClaimAmount = token().balanceOf(address(this)) / validBeneficiaryCount;

            uint256 _minimumClaimAmount = (originalClaimAmount * _minClaimAmountRatioPrecision) /
                _minClaimAmountRatio;

            if (_newClaimAmount < _minimumClaimAmount) {
                _newClaimAmount = _minimumClaimAmount;
            } else if (_newClaimAmount > originalClaimAmount) {
                _newClaimAmount = originalClaimAmount;
            }
        }

        if (_newClaimAmount != claimAmount) {
            emit ClaimAmountUpdated(claimAmount, _newClaimAmount);
            claimAmount = _newClaimAmount;
            claimAmount = _newClaimAmount;
        }
    }

    /**
     * @notice Changes the state of a beneficiary
     *
     * @param _beneficiary address of the beneficiary
     * @param _newState new state
     */
    function _changeBeneficiaryState(Beneficiary storage _beneficiary, BeneficiaryState _newState)
        internal
    {
        if (_beneficiary.state == _newState) {
            return;
        }

        if (_newState == BeneficiaryState.Valid) {
            require(
                maxTotalClaim - decreaseStep >= originalClaimAmount,
                "Community::_changeBeneficiaryState: Max claim too low"
            );
            require(
                maxBeneficiaries == 0 || validBeneficiaryCount < maxBeneficiaries,
                "Community::_changeBeneficiaryState: This community has reached the maximum number of valid beneficiaries"
            );
            validBeneficiaryCount++;
            maxTotalClaim -= decreaseStep;
        } else if (_beneficiary.state == BeneficiaryState.Valid) {
            validBeneficiaryCount--;
            maxTotalClaim += decreaseStep;
        }

        _beneficiary.state = _newState;
    }

    function _requestFunds() internal {
        if (isSelfFunding()) {
            return;
        }

        uint256 _amount = communityAdmin.fundCommunity();

        if (_amount > 0) {
            lastFundRequest = block.number;

            _updateClaimAmount();

            emit FundsRequested(msg.sender);
        }
    }
}
        

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

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

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol

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

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}
          

/_openzeppelin/contracts-upgradeable/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/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;
}
          

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

/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/CommunityStorageV1.sol

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

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

/**
 * @title Storage for Community
 * @notice For future upgrades, do not change CommunityStorageV1. Create a new
 * contract which implements CommunityStorageV1 and following the naming convention
 * CommunityStorageVX.
 */
abstract contract CommunityStorageV1 is ICommunity {
    bool public override locked;
    uint256 public override originalClaimAmount; //the maximum amount that can be claimed by a beneficiary once
    uint256 public override baseInterval;
    uint256 public override incrementInterval;
    uint256 public override maxTotalClaim; //the total amount that can be claimed by a beneficiary over time
    uint256 public override validBeneficiaryCount;
    uint256 public override treasuryFunds;
    uint256 public override privateFunds;
    uint256 public override decreaseStep;
    uint256 public override minTranche;
    uint256 public override maxTranche;
    uint256 public override lastFundRequest;

    ICommunity public override previousCommunity;
    ICommunityAdmin public override communityAdmin;

    mapping(address => Beneficiary) internal _beneficiaries;
    EnumerableSet.AddressSet internal beneficiaryList;
}
          

/contracts/community/interfaces/CommunityStorageV2.sol

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

import "./CommunityStorageV1.sol";

/**
 * @title Storage for Community
 * @notice For future upgrades, do not change CommunityStorageV2. Create a new
 * contract which implements CommunityStorageV2 and following the naming convention
 * CommunityStorageVX.
 */
abstract contract CommunityStorageV2 is CommunityStorageV1 {
    IERC20 public _token;
    uint256 public override maxBeneficiaries;
}
          

/contracts/community/interfaces/CommunityStorageV3.sol

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

import "./CommunityStorageV2.sol";

/**
 * @title Storage for Community
 * @notice For future upgrades, do not change CommunityStorageV3. Create a new
 * contract which implements CommunityStorageV3 and following the naming convention
 * CommunityStorageVX.
 */
abstract contract CommunityStorageV3 is CommunityStorageV2 {
    TokenUpdates[] public override tokenUpdates;
    EnumerableSet.AddressSet internal _tokenList;
    uint256 public override claimAmount;
}
          

/contracts/community/interfaces/CommunityStorageV4.sol

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

import "./CommunityStorageV3.sol";

/**
 * @title Storage for Community
 * @notice For future upgrades, do not change CommunityStorageV4. Create a new
 * contract which implements CommunityStorageV4 and following the naming convention
 * CommunityStorageVX.
 */
abstract contract CommunityStorageV4 is CommunityStorageV3 {
    ICommunity public override copyOf;
    EnumerableSet.AddressSet internal _copies;
}
          

/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 beneficiaryListLength() external view returns (uint256);
    function impactMarketAddress() external pure returns (address);
    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,
        bytes 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,
        bytes 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/donationMiner/interfaces/IDonationMiner.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 "../../community/interfaces/ICommunity.sol";
import "../../treasury/interfaces/ITreasury.sol";
import "../../staking/interfaces/IStaking.sol";

interface IDonationMiner {
    struct RewardPeriod {
        //reward tokens created per block
        uint256 rewardPerBlock;
        //reward tokens from previous periods + reward tokens from this reward period
        uint256 rewardAmount;
        //block number at which reward period starts
        uint256 startBlock;
        //block number at which reward period ends
        uint256 endBlock;
        //total of donations for this rewardPeriod
        uint256 donationsAmount;
        //amounts donated by every donor in this rewardPeriod
        mapping(address => uint256) donorAmounts;
        uint256 againstPeriods;
        //total stake amount at the end of this rewardPeriod
        uint256 stakesAmount;
        //ratio between 1 cUSD donated and 1 PACT staked
        uint256 stakingDonationRatio;
        //true if user has staked/unstaked in this reward period
        mapping(address => bool) hasSetStakeAmount;
        //stake amount of a user at the end of this reward period;
        //if a user doesn't stake/unstake in a reward period,
        //              this value will remain 0 (and hasSetStakeAmount will be false)
        //if hasNewStakeAmount is false it means the donorStakeAmount
        //              is the same as the last reward period where hasSetStakeAmount is true
        mapping(address => uint256) donorStakeAmounts;
    }

    struct Donor {
        uint256 lastClaim;  //last reward period index for which the donor has claimed the reward; used until v2
        uint256 rewardPeriodsCount; //total number of reward periods in which the donor donated
        mapping(uint256 => uint256) rewardPeriods; //list of all reward period ids in which the donor donated
        uint256 lastClaimPeriod; //last reward period id for which the donor has claimed the reward
    }

    struct Donation {
        address donor;  //address of the donner
        address target;  //address of the receiver (community or treasury)
        uint256 rewardPeriod;  //number of the reward period in which the donation was made
        uint256 blockNumber;  //number of the block in which the donation was executed
        uint256 amount;  //the convertedAmount value
        IERC20 token;  //address of the token
        uint256 initialAmount;  //number of tokens donated
    }

    function getVersion() external pure returns(uint256);
    function cUSD() external view returns (IERC20);
    function PACT() external view returns (IERC20);
    function treasury() external view returns (ITreasury);
    function staking() external view returns (IStaking);
    function rewardPeriodSize() external view returns (uint256);
    function decayNumerator() external view returns (uint256);
    function decayDenominator() external view returns (uint256);
    function stakingDonationRatio() external view returns (uint256);
    function communityDonationRatio() external view returns (uint256);
    function rewardPeriodCount() external view returns (uint256);
    function donationCount() external view returns (uint256);
    function rewardPeriods(uint256 _period) external view returns (
        uint256 rewardPerBlock,
        uint256 rewardAmount,
        uint256 startBlock,
        uint256 endBlock,
        uint256 donationsAmount,
        uint256 againstPeriods,
        uint256 stakesAmount,
        uint256 stakingDonationRatio

);
    function rewardPeriodDonorAmount(uint256 _period, address _donor) external view returns (uint256);
    function rewardPeriodDonorStakeAmounts(uint256 _period, address _donor) external view returns (uint256);
    function donors(address _donor) external view returns (
        uint256 rewardPeriodsCount,
        uint256 lastClaim,
        uint256 lastClaimPeriod
    );
    function donorRewardPeriod(address _donor, uint256 _rewardPeriodIndex) external view returns (uint256);
    function donations(uint256 _index) external view returns (
        address donor,
        address target,
        uint256 rewardPeriod,
        uint256 blockNumber,
        uint256 amount,
        IERC20 token,
        uint256 initialAmount
    );
    function claimDelay() external view returns (uint256);
    function againstPeriods() external view returns (uint256);
    function updateRewardPeriodParams(
        uint256 _newRewardPeriodSize,
        uint256 _newDecayNumerator,
        uint256 _newDecayDenominator
    ) external;
    function updateClaimDelay(uint256 _newClaimDelay) external;
    function updateStakingDonationRatio(uint256 _newStakingDonationRatio) external;
    function updateCommunityDonationRatio(uint256 _newCommunityDonationRatio) external;
    function updateAgainstPeriods(uint256 _newAgainstPeriods) external;
    function updateTreasury(ITreasury _newTreasury) external;
    function updateStaking(IStaking _newStaking) external;
    function donate(IERC20 _token, uint256 _amount, address _delegateAddress) external;
    function donateToCommunity(ICommunity _community, IERC20 _token, uint256 _amount, address _delegateAddress) external;
    function claimRewards() external;
    function claimRewardsPartial(uint256 _lastPeriodNumber) external;
    function stakeRewards() external;
    function stakeRewardsPartial(uint256 _lastPeriodNumber) external;
    function calculateClaimableRewards(address _donor) external returns (uint256);
    function calculateClaimableRewardsByPeriodNumber(address _donor, uint256 _lastPeriodNumber) external returns (uint256);
    function estimateClaimableReward(address _donor) external view returns (uint256);
    function estimateClaimableRewardAdvance(address _donor) external view returns (uint256);
    function estimateClaimableRewardByStaking(address _donor) external view returns (uint256);
    function apr(address _stakeholderAddress) external view returns (uint256);
    function generalApr() external view returns (uint256);
    function lastPeriodsDonations(address _donor) external view returns (uint256 donorAmount, uint256 totalAmount);
    function transfer(IERC20 _token, address _to, uint256 _amount) external;
    function setStakingAmounts(address _holderAddress, uint256 _holderStakeAmount, uint256 _totalStakesAmount) external;
    function currentRewardPeriodNumber() external view returns (uint256);

}
          

/contracts/externalInterfaces/openzeppelin/IMintableERC20.sol

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

interface IMintableERC20 {
    function mint(address _account, uint96 _amount) external;

    function burn(address _account, uint96 _amount) external;

    function totalSupply() external view returns (uint256);

    function balanceOf(address _account) external view returns (uint256);

    function transfer(address _recipient, uint256 _amount) external returns (bool);

    function allowance(address _owner, address _spender) external view returns (uint256);

    function approve(address _spender, uint256 _amount) external returns (bool);

    function transferFrom(
        address _sender,
        address _recipient,
        uint256 _amount
    ) external returns (bool);
}
          

/contracts/externalInterfaces/uniswapV3/INonfungiblePositionManager.sol

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.4;
pragma abicoder v2;

/// @title Non-fungible token for positions
/// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred
/// and authorized.
interface INonfungiblePositionManager
{
    /// @notice Emitted when liquidity is increased for a position NFT
    /// @dev Also emitted when a token is minted
    /// @param tokenId The ID of the token for which liquidity was increased
    /// @param liquidity The amount by which liquidity for the NFT position was increased
    /// @param amount0 The amount of token0 that was paid for the increase in liquidity
    /// @param amount1 The amount of token1 that was paid for the increase in liquidity
    event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
    /// @notice Emitted when liquidity is decreased for a position NFT
    /// @param tokenId The ID of the token for which liquidity was decreased
    /// @param liquidity The amount by which liquidity for the NFT position was decreased
    /// @param amount0 The amount of token0 that was accounted for the decrease in liquidity
    /// @param amount1 The amount of token1 that was accounted for the decrease in liquidity
    event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
    /// @notice Emitted when tokens are collected for a position NFT
    /// @dev The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior
    /// @param tokenId The ID of the token for which underlying tokens were collected
    /// @param recipient The address of the account that received the collected tokens
    /// @param amount0 The amount of token0 owed to the position that was collected
    /// @param amount1 The amount of token1 owed to the position that was collected
    event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1);

    /// @notice Returns the position information associated with a given token ID.
    /// @dev Throws if the token ID is not valid.
    /// @param tokenId The ID of the token that represents the position
    /// @return nonce The nonce for permits
    /// @return operator The address that is approved for spending
    /// @return token0 The address of the token0 for a specific pool
    /// @return token1 The address of the token1 for a specific pool
    /// @return fee The fee associated with the pool
    /// @return tickLower The lower end of the tick range for the position
    /// @return tickUpper The higher end of the tick range for the position
    /// @return liquidity The liquidity of the position
    /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position
    /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position
    /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation
    /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation
    function positions(uint256 tokenId)
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            uint24 fee,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    /// @notice Creates a new position wrapped in a NFT
    /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized
    /// a method does not exist, i.e. the pool is assumed to be initialized.
    /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata
    /// @return tokenId The ID of the token that represents the minted position
    /// @return liquidity The amount of liquidity for this position
    /// @return amount0 The amount of token0
    /// @return amount1 The amount of token1
    function mint(MintParams calldata params)
        external
        payable
        returns (
            uint256 tokenId,
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );

    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`
    /// @param params tokenId The ID of the token for which liquidity is being increased,
    /// amount0Desired The desired amount of token0 to be spent,
    /// amount1Desired The desired amount of token1 to be spent,
    /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check,
    /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return liquidity The new liquidity amount as a result of the increase
    /// @return amount0 The amount of token0 to acheive resulting liquidity
    /// @return amount1 The amount of token1 to acheive resulting liquidity
    function increaseLiquidity(IncreaseLiquidityParams calldata params)
        external
        payable
        returns (
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );

    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Decreases the amount of liquidity in a position and accounts it to the position
    /// @param params tokenId The ID of the token for which liquidity is being decreased,
    /// amount The amount by which liquidity will be decreased,
    /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,
    /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return amount0 The amount of token0 accounted to the position's tokens owed
    /// @return amount1 The amount of token1 accounted to the position's tokens owed
    function decreaseLiquidity(DecreaseLiquidityParams calldata params)
        external
        payable
        returns (uint256 amount0, uint256 amount1);

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient
    /// @param params tokenId The ID of the NFT for which tokens are being collected,
    /// recipient The account that should receive the tokens,
    /// amount0Max The maximum amount of token0 to collect,
    /// amount1Max The maximum amount of token1 to collect
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);

    /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens
    /// must be collected first.
    /// @param tokenId The ID of the token that is being burned
    function burn(uint256 tokenId) external payable;

    function ownerOf(uint256 tokenId) external view returns(address);
}
          

/contracts/externalInterfaces/uniswapV3/IQuoter.sol

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.4;
pragma abicoder v2;

/// @title Quoter Interface
/// @notice Supports quoting the calculated amounts from exact input or exact output swaps
/// @dev These functions are not marked view because they rely on calling non-view functions and reverting
/// to compute the result. They are also not gas efficient and should not be called on-chain.
interface IQuoter {
    /// @notice Returns the amount out received for a given exact input swap without executing the swap
    /// @param path The path of the swap, i.e. each token pair and the pool fee
    /// @param amountIn The amount of the first token to swap
    /// @return amountOut The amount of the last token that would be received
    function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);

    /// @notice Returns the amount out received for a given exact input but for a swap of a single pool
    /// @param tokenIn The token being swapped in
    /// @param tokenOut The token being swapped out
    /// @param fee The fee of the token pool to consider for the pair
    /// @param amountIn The desired input amount
    /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
    /// @return amountOut The amount of `tokenOut` that would be received
    function quoteExactInputSingle(
        address tokenIn,
        address tokenOut,
        uint24 fee,
        uint256 amountIn,
        uint160 sqrtPriceLimitX96
    ) external returns (uint256 amountOut);

    /// @notice Returns the amount in required for a given exact output swap without executing the swap
    /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order
    /// @param amountOut The amount of the last token to receive
    /// @return amountIn The amount of first token required to be paid
    function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);

    /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool
    /// @param tokenIn The token being swapped in
    /// @param tokenOut The token being swapped out
    /// @param fee The fee of the token pool to consider for the pair
    /// @param amountOut The desired output amount
    /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
    /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`
    function quoteExactOutputSingle(
        address tokenIn,
        address tokenOut,
        uint24 fee,
        uint256 amountOut,
        uint160 sqrtPriceLimitX96
    ) external returns (uint256 amountIn);
}
          

/contracts/externalInterfaces/uniswapV3/IUniswapRouter02.sol

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

/// @title Router token swapping functionality
interface IUniswapRouter02 {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
    /// and swap the entire amount, enabling contracts to send tokens before calling this function.
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
    /// and swap the entire amount, enabling contracts to send tokens before calling this function.
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
}
          

/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/staking/interfaces/IStaking.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 "../../donationMiner/interfaces/IDonationMiner.sol";
import "../../externalInterfaces/openzeppelin/IMintableERC20.sol";

interface IStaking {
    struct Unstake {
        uint256 amount;         //amount unstaked
        uint256 cooldownBlock;  //first block number that will allow holder to claim this unstake
    }

    struct Holder {
        uint256 amount;          // amount of PACT that are staked by holder
        uint256 nextUnstakeId;   //
        Unstake[] unstakes;      //list of all unstakes amount
    }

    function getVersion() external pure returns(uint256);
    function updateCooldown(uint256 _newCooldown) external;
    function PACT() external view returns (IERC20);
    function SPACT() external view returns (IMintableERC20);
    function donationMiner() external view returns (IDonationMiner);
    function cooldown() external view returns(uint256);
    function currentTotalAmount() external view returns(uint256);
    function stakeholderAmount(address _holderAddress) external view returns(uint256);
    function stakeholder(address _holderAddress) external view returns (uint256 amount, uint256 nextUnstakeId, uint256 unstakeListLength, uint256 unstakedAmount);
    function stakeholderUnstakeAt(address _holderAddress, uint256 _unstakeIndex) external view returns (Unstake memory);
    function stakeholdersListAt(uint256 _index) external view returns (address);
    function stakeholdersListLength() external view returns (uint256);

    function stake(address _holder, uint256 _amount) external;
    function unstake(uint256 _amount) external;
    function claim() external;
    function claimPartial(uint256 _lastUnstakeId) external;
    function claimAmount(address _holderAddress) external view returns (uint256);
}
          

/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 "../../treasuryLpSwap/interfaces/ITreasuryLpSwap.sol";
import "../../donationMiner/interfaces/IDonationMiner.sol";

interface ITreasury {
    enum LpStrategy {     //strategy to use for splitting the LP fees between treasury and buyback
        NONE,             //all funds remains into treasury
        MainCoin,         //for UBI coins (like cUSD): UBI coin fees are kept in treasury, PACT fees are used for buyback
        SecondaryCoin     //for non UBI coins (like cEUR): half of the fees are swapped to PACT and used for buyback,
                          // half of the fees are swapped to cUSD and kept in treasury
                          // (PACT fees are used for buyback)
    }

    struct Token {
        uint256 rate;                          //rate of the token in CUSD
        LpStrategy lpStrategy;                 //strategy to use for splitting the LP fees between treasury and buyback
        uint256 lpPercentage;                  //percentage of the funds to be used for LP
        uint256 lpMinLimit;                    //minimum amount of funds that need to be in the treasury (and not to be used for LP)
        uint256 uniswapNFTPositionManagerId;   //id of the NFT position manager
        bytes exchangePathToCUSD;              //uniswap path to exchange the token to CUSD
        bytes exchangePathToPACT;              //uniswap path to exchange the token to PACT
    }

    function getVersion() external pure returns(uint256);
    function communityAdmin() external view returns(ICommunityAdmin);
    function lpSwap() external view returns(ITreasuryLpSwap);
    function PACT() external view returns (IERC20);
    function donationMiner() external view returns (IDonationMiner);
    function updateCommunityAdmin(ICommunityAdmin _communityAdmin) external;
    function updateLpSwap(ITreasuryLpSwap _lpSwap) external;
    function updatePACT(IERC20 _newPACT) external;
    function updateDonationMiner(IDonationMiner _newDonationMiner) 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,
        LpStrategy lpStrategy,
        uint256 lpPercentage,
        uint256 lpMinLimit,
        uint256 uniswapNFTPositionManagerId,
        bytes calldata exchangePathToCUSD,
        bytes calldata exchangePathToPACT
    );
    function setToken(
        address _tokenAddress,
        uint256 _rate,
        LpStrategy _lpStrategy,
        uint256 _lpPercentage,
        uint256 _lpMinLimit,
        uint256 _uniswapNFTPositionManagerId,
        bytes memory _exchangePathToCUSD,
        bytes memory _exchangePathToPACT
    ) external;
    function removeToken(address _tokenAddress) external;
    function getConvertedAmount(address _tokenAddress, uint256 _amount) external returns (uint256);
    function convertAmount(
        address _tokenAddress,
        uint256 _amountIn,
        uint256 _amountOutMin,
        bytes memory _exchangePath
    ) external;
    function useFundsForLP() external;
    function collectFees(uint256 _uniswapNFTPositionManagerId) external;
}
          

/contracts/treasuryLpSwap/interfaces/ITreasuryLpSwap.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 "../../treasury/interfaces/ITreasury.sol";
import "../../externalInterfaces/uniswapV3/INonfungiblePositionManager.sol";
import "../../externalInterfaces/uniswapV3/IUniswapRouter02.sol";
import "../../externalInterfaces/uniswapV3/IQuoter.sol";

interface ITreasuryLpSwap {
    function getVersion() external pure returns(uint256);
    function treasury() external view returns(ITreasury);
    function uniswapRouter() external view returns(IUniswapRouter02);
    function uniswapQuoter() external view returns(IQuoter);
    function uniswapNFTPositionManager() external view returns(INonfungiblePositionManager);
    function updateTreasury(ITreasury _treasury) external;
    function updateUniswapRouter(IUniswapRouter02 _uniswapRouter) external;
    function updateUniswapQuoter(IQuoter _uniswapQuoter) external;
    function updateUniswapNFTPositionManager(INonfungiblePositionManager _newUniswapNFTPositionManager) external;
    function transfer(IERC20 _token, address _to, uint256 _amount) external;
    function convertAmount(
        address _tokenAddress,
        uint256 _amountIn,
        uint256 _amountOutMin,
        bytes memory _exchangePath
    ) external;
    function addToLp(IERC20 _token, uint256 _amount) external;
    function collectFees(uint256 _uniswapNFTPositionManagerId) external returns (uint256 amount0, uint256 amount1);
    function decreaseLiquidity(uint256 _uniswapNFTPositionManagerId, uint128 _liquidityAmount) external returns (uint256 amount0, uint256 amount1);
}
          

Contract ABI

[{"type":"event","name":"BeneficiaryAdded","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true},{"type":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BeneficiaryAddressChanged","inputs":[{"type":"address","name":"beneficiary1","internalType":"address","indexed":true},{"type":"address","name":"beneficiary2","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BeneficiaryClaim","inputs":[{"type":"address","name":"beneficiary","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"BeneficiaryCopied","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true},{"type":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BeneficiaryJoined","inputs":[{"type":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BeneficiaryLocked","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true},{"type":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BeneficiaryParamsUpdated","inputs":[{"type":"uint256","name":"oldOriginalClaimAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"oldMaxTotalClaim","internalType":"uint256","indexed":false},{"type":"uint256","name":"oldDecreaseStep","internalType":"uint256","indexed":false},{"type":"uint256","name":"oldBaseInterval","internalType":"uint256","indexed":false},{"type":"uint256","name":"oldIncrementInterval","internalType":"uint256","indexed":false},{"type":"uint256","name":"newOriginalClaimAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"newMaxTotalClaim","internalType":"uint256","indexed":false},{"type":"uint256","name":"newDecreaseStep","internalType":"uint256","indexed":false},{"type":"uint256","name":"newBaseInterval","internalType":"uint256","indexed":false},{"type":"uint256","name":"newIncrementInterval","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"BeneficiaryRemoved","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true},{"type":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BeneficiaryUnlocked","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true},{"type":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ClaimAmountUpdated","inputs":[{"type":"uint256","name":"oldClaimAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"newClaimAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CommunityAdminUpdated","inputs":[{"type":"address","name":"oldCommunityAdmin","internalType":"address","indexed":true},{"type":"address","name":"newCommunityAdmin","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"CommunityLocked","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"CommunityParamsUpdated","inputs":[{"type":"uint256","name":"oldMinTranche","internalType":"uint256","indexed":false},{"type":"uint256","name":"oldMaxTranche","internalType":"uint256","indexed":false},{"type":"uint256","name":"newMinTranche","internalType":"uint256","indexed":false},{"type":"uint256","name":"newMaxTranche","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CommunityUnlocked","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Donate","inputs":[{"type":"address","name":"donor","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FundsRequested","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ManagerAdded","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ManagerRemoved","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"MaxBeneficiariesUpdated","inputs":[{"type":"uint256","name":"oldMaxBeneficiaries","internalType":"uint256","indexed":false},{"type":"uint256","name":"newMaxBeneficiaries","internalType":"uint256","indexed":false}],"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":"PreviousCommunityUpdated","inputs":[{"type":"address","name":"oldPreviousCommunity","internalType":"address","indexed":true},{"type":"address","name":"newPreviousCommunity","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TokenUpdated","inputs":[{"type":"address","name":"oldTokenAddress","internalType":"address","indexed":true},{"type":"address","name":"newTokenAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TransferERC20","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20Upgradeable"}],"name":"_token","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addBeneficiaries","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addBeneficiariesUsingSignature","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"},{"type":"uint256","name":"_expirationTimestamp","internalType":"uint256"},{"type":"bytes","name":"_signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addBeneficiary","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addCopy","inputs":[{"type":"address","name":"_copy","internalType":"contract ICommunity"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addManager","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addTreasuryFunds","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"baseInterval","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"state","internalType":"enum ICommunity.BeneficiaryState"},{"type":"uint256","name":"claims","internalType":"uint256"},{"type":"uint256","name":"claimedAmount","internalType":"uint256"},{"type":"uint256","name":"lastClaim","internalType":"uint256"}],"name":"beneficiaries","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"claimedAmounts","internalType":"uint256[]"}],"name":"beneficiaryClaimedAmounts","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"beneficiaryJoinFromMigrated","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"beneficiaryListAt","inputs":[{"type":"uint256","name":"index_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"beneficiaryListLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20Upgradeable"}],"name":"cUSD","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeBeneficiaryAddress","inputs":[{"type":"address","name":"_newBeneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeBeneficiaryAddressByManager","inputs":[{"type":"address","name":"_oldBeneficiaryAddress","internalType":"address"},{"type":"address","name":"_newBeneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimCooldown","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ICommunityAdmin"}],"name":"communityAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"copies","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"copyBeneficiaries","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"copyCommunityDetails","inputs":[{"type":"address","name":"_originalCommunity","internalType":"contract ICommunity"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ICommunity"}],"name":"copyOf","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"decreaseStep","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"donate","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getInitialMaxClaim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getInitialMaxTotalClaim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersion","inputs":[]},{"type":"function","stateMutability":"pure","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"impactMarketAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"incrementInterval","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"},{"type":"address[]","name":"_managers","internalType":"address[]"},{"type":"uint256","name":"_originalClaimAmount","internalType":"uint256"},{"type":"uint256","name":"_maxTotalClaim","internalType":"uint256"},{"type":"uint256","name":"_decreaseStep","internalType":"uint256"},{"type":"uint256","name":"_baseInterval","internalType":"uint256"},{"type":"uint256","name":"_incrementInterval","internalType":"uint256"},{"type":"uint256","name":"_minTranche","internalType":"uint256"},{"type":"uint256","name":"_maxTranche","internalType":"uint256"},{"type":"uint256","name":"_maxBeneficiaries","internalType":"uint256"},{"type":"address","name":"_previousCommunity","internalType":"contract ICommunity"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSelfFunding","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastFundRequest","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastInterval","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lock","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lockBeneficiaries","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lockBeneficiariesUsingSignature","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"},{"type":"uint256","name":"_expirationTimestamp","internalType":"uint256"},{"type":"bytes","name":"_signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lockBeneficiary","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"locked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxBeneficiaries","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxClaim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxTotalClaim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxTranche","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minTranche","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"originalClaimAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ICommunity"}],"name":"previousCommunity","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"privateFunds","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeBeneficiaries","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeBeneficiariesUsingSignature","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"},{"type":"uint256","name":"_expirationTimestamp","internalType":"uint256"},{"type":"bytes","name":"_signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeBeneficiary","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeManager","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"requestFunds","inputs":[]},{"type":"function","stateMutability":"pure","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBeneficiaryState","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"},{"type":"uint8","name":"_state","internalType":"enum ICommunity.BeneficiaryState"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20Upgradeable"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"tokenList","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"ratio","internalType":"uint256"},{"type":"uint256","name":"startBlock","internalType":"uint256"}],"name":"tokenUpdates","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenUpdatesLength","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transfer","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20Upgradeable"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"treasuryFunds","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlock","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlockBeneficiaries","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlockBeneficiariesUsingSignature","inputs":[{"type":"address[]","name":"_beneficiaryAddresses","internalType":"address[]"},{"type":"uint256","name":"_expirationTimestamp","internalType":"uint256"},{"type":"bytes","name":"_signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlockBeneficiary","inputs":[{"type":"address","name":"_beneficiaryAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateBeneficiaryParams","inputs":[{"type":"uint256","name":"_originalClaimAmount","internalType":"uint256"},{"type":"uint256","name":"_maxTotalClaim","internalType":"uint256"},{"type":"uint256","name":"_decreaseStep","internalType":"uint256"},{"type":"uint256","name":"_baseInterval","internalType":"uint256"},{"type":"uint256","name":"_incrementInterval","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCommunityAdmin","inputs":[{"type":"address","name":"_newCommunityAdmin","internalType":"contract ICommunityAdmin"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCommunityParams","inputs":[{"type":"uint256","name":"_minTranche","internalType":"uint256"},{"type":"uint256","name":"_maxTranche","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateMaxBeneficiaries","inputs":[{"type":"uint256","name":"_newMaxBeneficiaries","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePreviousCommunity","inputs":[{"type":"address","name":"_newPreviousCommunity","internalType":"contract ICommunity"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateToken","inputs":[{"type":"address","name":"_newToken","internalType":"contract IERC20Upgradeable"},{"type":"bytes","name":"_exchangePath","internalType":"bytes"},{"type":"uint256","name":"_originalClaimAmount","internalType":"uint256"},{"type":"uint256","name":"_maxTotalClaim","internalType":"uint256"},{"type":"uint256","name":"_decreaseStep","internalType":"uint256"},{"type":"uint256","name":"_baseInterval","internalType":"uint256"},{"type":"uint256","name":"_incrementInterval","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"validBeneficiaryCount","inputs":[]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5061658a80620000216000396000f3fe608060405234801561001057600080fd5b506004361061048b5760003560e01c80638da5cb5b11610262578063c51fab3c11610151578063e25c25f3116100ce578063f2fde38b11610092578063f2fde38b146109ac578063f36e2609146109bf578063f83d08ba146109c7578063f92b6c01146109cf578063fb7b0a0c146109d8578063fc0c546a1461055557600080fd5b8063e25c25f314610957578063e69d849d1461096a578063eb0376b11461097d578063ecd0c0c314610985578063eeda3c4c1461099957600080fd5b8063d33d4ec611610115578063d33d4ec614610915578063d4938db314610928578063d547741f14610930578063d6dbd97214610943578063dd4414bb1461094d57600080fd5b8063c51fab3c146108c5578063c76a890c146108cf578063cf309012146108e2578063d04c41b6146108ef578063d10f51071461090257600080fd5b8063a57e08ca116101df578063b809ee82116101a3578063b809ee8214610871578063bbd17ead14610884578063beabacc814610898578063c041fdc5146108ab578063c0e27b6b146108b257600080fd5b8063a57e08ca14610828578063a69df4b51461083b578063a8f3e06314610843578063ac18de4314610856578063b026ba571461086957600080fd5b80639e2c58ca116102265780639e2c58ca146107e5578063a0f93a17146107fa578063a217fddf14610804578063a38540ee1461080c578063a3c6e4111461081557600080fd5b80638da5cb5b1461079157806391d14854146107a257806394e13748146107b55780639c01a401146107c85780639cecf572146107d257600080fd5b8063431a801a1161037e5780635c7054c0116102fb578063785393db116102bf578063785393db1461074e57806378ba280f146106a25780637e2959dc14610761578063830953ab1461077457806389554f171461077e57600080fd5b80635c7054c0146106ec5780635fac917a146106ff5780636290a579146107135780636b31f2ad14610726578063715018a61461074657600080fd5b806357c363271161034257806357c36327146106a2578063590411da146106aa5780635926651d146106bd57806359633a1c146106d0578063597be18b146106e357600080fd5b8063431a801a146106325780634e71d92d1461063c57806351d84c9e1461064457806354c5689e14610657578063572b9e7b1461068f57600080fd5b8063248a9ca31161040c578063300c12fe116103d0578063300c12fe146105db578063305ff654146105e557806336568abe146105f857806337e556dd1461060b5780633a578a0c1461061e57600080fd5b8063248a9ca3146105755780632b271117146105985780632d06177a146105a25780632f2ff15d146105b55780632fd79103146105c857600080fd5b80630e5b7c53116104535780630e5b7c531461051357806312d0e65a1461051c57806315f7c7201461052f5780631912cdb4146105425780631fccf6721461055557600080fd5b8063015677391461049057806301ffc9a7146104bc57806309c338c3146104df5780630b4e7817146104f75780630d8e6e2c1461050c575b600080fd5b6104a361049e366004615b16565b6109e1565b6040516104b39493929190616189565b60405180910390f35b6104cf6104ca366004615ee6565b610a2c565b60405190151581526020016104b3565b6104e96101065481565b6040519081526020016104b3565b61050a610505366004615b86565b610a63565b005b60046104e9565b6104e960fd5481565b61050a61052a366004615b16565b610df5565b61050a61053d366004615b16565b610e5b565b61050a610550366004616022565b610e95565b61055d610fad565b6040516001600160a01b0390911681526020016104b3565b6104e9610583366004615eaa565b60009081526065602052604090206001015490565b6104e96101055481565b61050a6105b0366004615b16565b61105e565b61050a6105c3366004615ec2565b611105565b61050a6105d6366004616043565b611173565b61010554156104cf565b61050a6105f3366004615eaa565b611387565b61050a610606366004615ec2565b6114c1565b61050a610619366004615d96565b61153b565b6101075461055d906001600160a01b031681565b6104e96101005481565b61050a611555565b61050a610652366004615b4e565b6118d0565b61066a610665366004615eaa565b61190e565b604080516001600160a01b0390941684526020840192909252908201526060016104b3565b61050a61069d366004615c39565b61194c565b6104e9611a26565b61050a6106b8366004615cc7565b611a47565b61050a6106cb366004615b16565b611ad7565b61050a6106de366004615b16565b611b9d565b6104e960fe5481565b61050a6106fa366004615cc7565b611bda565b6101085461055d906001600160a01b031681565b61050a610721366004615f4e565b611cda565b610739610734366004615b16565b6124e1565b6040516104b39190616151565b61050a612646565b61055d61075c366004615eaa565b61267c565b61050a61076f366004615b16565b61268a565b6104e96101115481565b61050a61078c366004615cc7565b612712565b6097546001600160a01b031661055d565b6104cf6107b0366004615ec2565b612772565b61050a6107c3366004615d96565b61279d565b6104e96101015481565b6104e96107e0366004615b16565b6127d4565b6107ed612806565b6040516104b39190616104565b6104e961010d5481565b6104e9600081565b6104e960ff5481565b61050a610823366004615d96565b61288a565b61050a610836366004615b16565b6128c1565b61050a612a67565b6104e9610851366004615b16565b612b3c565b61050a610864366004615b16565b612b99565b61050a612da7565b61050a61087f366004615eaa565b612e06565b6101125461055d906001600160a01b031681565b61050a6108a6366004615f0e565b612e4b565b600061055d565b61050a6108c0366004615b16565b612f31565b6104e96101035481565b61050a6108dd366004615cc7565b612f91565b60fb546104cf9060ff1681565b61050a6108fd366004615cc7565b612fce565b61050a610910366004615b16565b61302e565b61050a610923366004615b16565b61308e565b60ff546104e9565b61050a61093e366004615ec2565b61311b565b6104e96101025481565b6104e96101045481565b61050a610965366004615d96565b613189565b61050a610978366004615c66565b6131f3565b6104e9613299565b61010c5461055d906001600160a01b031681565b61050a6109a7366004615b16565b6132a6565b61050a6109ba366004615b16565b613670565b6107ed613708565b61050a613715565b61010e546104e9565b6104e960fc5481565b6001600160a01b0381166000908152610109602052604081208054600182015483928392839260ff90911690610a1783436137ed565b83600301549450945094509450509193509193565b60006001600160e01b03198216637965db0b60e01b1480610a5d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600054610100900460ff16610a7e5760005460ff1615610a82565b303b155b610aea5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b600054610100900460ff16158015610b0c576000805461ffff19166101011790555b858711610b945760405162461bcd60e51b815260206004820152604a60248201527f436f6d6d756e6974793a3a696e697469616c697a653a2062617365496e74657260448201527f76616c206d7573742062652067726561746572207468616e20696e6372656d656064820152691b9d125b9d195c9d985b60b21b608482015260a401610ae1565b89891015610bfe5760405162461bcd60e51b815260206004820152603160248201527f436f6d6d756e6974793a3a696e697469616c697a653a206f726967696e616c436044820152706c61696d416d6f756e7420746f2062696760781b6064820152608401610ae1565b83851115610c845760405162461bcd60e51b815260206004820152604760248201527f436f6d6d756e6974793a3a696e697469616c697a653a206d696e5472616e636860448201527f652073686f756c64206e6f742062652067726561746572207468616e206d61786064820152665472616e63686560c81b608482015260a401610ae1565b61010880546001600160a01b03191633179055610c9f61390d565b610ca761394c565b610caf613983565b61010c80546001600160a01b03808f166001600160a01b03199283161790925560fc8c90556101118c905560fd89905560fe88905560ff8b905561010487905561010586905561010780549285169290911691909117905561010388905561010d83905560fb805460ff19169055610d2633613670565b610d3e600080516020616535833981519152806139b2565b610d56600080516020616535833981519152336139fd565b604051339081907f05a4006f300442cf8b7fdb885f5ee958812020bffb5c5a8e655fde64e5f987ed90600090a38a516000905b80821015610dd357610dc18d8381518110610db457634e487b7160e01b600052603260045260246000fd5b6020026020010151613a07565b81610dcb816164cb565b925050610d89565b50508015610de7576000805461ff00191690555b505050505050505050505050565b6001600160a01b0381166000908152610109602052604081205460ff166005811115610e3157634e487b7160e01b600052602160045260246000fd5b14610e4e5760405162461bcd60e51b8152600401610ae19061631a565b610e583382613a74565b50565b6097546001600160a01b03163314610e855760405162461bcd60e51b8152600401610ae190616233565b610e9161011382613dcb565b5050565b6097546001600160a01b03163314610ebf5760405162461bcd60e51b8152600401610ae190616233565b80821115610f505760405162461bcd60e51b815260206004820152605260248201527f436f6d6d756e6974793a3a757064617465436f6d6d756e697479506172616d7360448201527f3a206d696e5472616e6368652073686f756c64206e6f742062652067726561746064820152716572207468616e206d61785472616e63686560701b608482015260a401610ae1565b61010454610105546040805192835260208301919091528101839052606081018290527fcd922a6f0ad842d84e08eb5df24c029b63c60167fb37cff24adf95c4832e32589060800160405180910390a16101049190915561010555565b61010c546000906001600160a01b031661104d5761010860009054906101000a90046001600160a01b03166001600160a01b0316631fccf6726040518163ffffffff1660e01b815260040160206040518083038186803b15801561101057600080fd5b505afa158015611024573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110489190615b32565b905090565b5061010c546001600160a01b031690565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b1580156110a857600080fd5b505afa1580156110bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e09190615e8a565b6110fc5760405162461bcd60e51b8152600401610ae1906161f0565b610e5881613a07565b60405162461bcd60e51b815260206004820152603a60248201527f436f6d6d756e6974793a3a6772616e74526f6c653a20596f7520617265206e6f60448201527f7420616c6c6f7720746f207573652074686973206d6574686f640000000000006064820152608401610ae1565b6097546001600160a01b0316331461119d5760405162461bcd60e51b8152600401610ae190616233565b8082116112385760405162461bcd60e51b815260206004820152605760248201527f436f6d6d756e6974793a3a75706461746542656e65666963696172795061726160448201527f6d733a2062617365496e74657276616c206d757374206265206772656174657260648201527f207468616e20696e6372656d656e74496e74657276616c000000000000000000608482015260a401610ae1565b82610100546112479190616452565b611251908661641a565b8410156112c65760405162461bcd60e51b815260206004820152603f60248201527f436f6d6d756e6974793a3a75706461746542656e65666963696172795061726160448201527f6d733a206f726967696e616c436c61696d416d6f756e7420746f6f20626967006064820152608401610ae1565b60fc5460ff546101035460fd5460fe54604080519586526020860194909452848401929092526060840152608083015260a0820187905260c0820186905260e0820185905261010082018490526101208201839052517fa19f450cd68c70f728b0c4b75befd202ea5ebb1ae78b6aca47365934b5008750918190036101400190a160fc8590556101005461135b908490616452565b6113659085616471565b60ff5561010383905560fd82905560fe819055611380613de0565b5050505050565b6097546001600160a01b031633148061141d575061010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b1580156113e557600080fd5b505afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141d9190615e8a565b61147e5760405162461bcd60e51b815260206004820152602c60248201527f436f6d6d756e6974793a204e4f545f4f574e45525f4f525f414d42415353414460448201526b4f525f4f525f454e5449545960a01b6064820152608401610ae1565b61010d5460408051918252602082018390527f6672b7064fe522fa09a8078f6d967272e0a379beb2270817417c9f023251b657910160405180910390a161010d55565b6001600160a01b03811633146115315760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ae1565b610e918282614047565b6115468383836140ae565b61154f846142e4565b50505050565b60fb5460ff16156115785760405162461bcd60e51b8152600401610ae1906161c5565b6001336000908152610109602052604090205460ff1660058111156115ad57634e487b7160e01b600052602160045260246000fd5b146115fa5760405162461bcd60e51b815260206004820181905260248201527f436f6d6d756e6974793a204e4f545f56414c49445f42454e45464943494152596044820152606401610ae1565b600260c954141561161d5760405162461bcd60e51b8152600401610ae1906162e3565b600260c95561162a614334565b336000908152610109602052604081209061164582436137ed565b905043611651336127d4565b111561169f5760405162461bcd60e51b815260206004820152601960248201527f436f6d6d756e6974793a3a636c61696d3a204e4f545f594554000000000000006044820152606401610ae1565b60ff5481106117055760405162461bcd60e51b815260206004820152602c60248201527f436f6d6d756e6974793a3a636c61696d3a20416c726561647920636c61696d6560448201526b642065766572797468696e6760a01b6064820152608401610ae1565b60008061011154116117195760fc5461171e565b610111545b905060008260ff546117309190616471565b82111561174a578260ff546117459190616471565b61174c565b815b61010e549091506001108015611799575061010e60018154811061178057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600201548460030154105b156117f757836002015484600401600061010e6000815481106117cc57634e487b7160e01b600052603260045260246000fd5b600091825260208083206003909202909101546001600160a01b031683528201929092526040019020555b611801818461641a565b6002850155600184018054906000611818836164cb565b909155505043600385015561010e5460011015611873578084600401600061183e610fad565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461186d919061641a565b90915550505b6118903382611880610fad565b6001600160a01b03169190614400565b60405181815233907fd54e03b214b3e8c17e98044f98554b6f1b18dd2a3163a2619afea7e9b2a6eb979060200160405180910390a25050600160c9555050565b6118e860008051602061653583398151915233612772565b6119045760405162461bcd60e51b8152600401610ae190616268565b610e918282613a74565b61010e818154811061191f57600080fd5b60009182526020909120600390910201805460018201546002909201546001600160a01b03909116925083565b60fb5460ff161561196f5760405162461bcd60e51b8152600401610ae1906161c5565b61197b61011333614463565b6119d15760405162461bcd60e51b815260206004820152602160248201527f436f6d6d756e6974793a20496e76616c696420636f6d6d756e69747920636f706044820152607960f81b6064820152608401610ae1565b600260c95414156119f45760405162461bcd60e51b8152600401610ae1906162e3565b600260c9556001600160a01b038216600090815261010960205260409020611a1c8183614485565b5050600160c95550565b60006101035461010054611a3a9190616452565b60ff54611048919061641a565b60fb5460ff1615611a6a5760405162461bcd60e51b8152600401610ae1906161c5565b611a8260008051602061653583398151915233612772565b611a9e5760405162461bcd60e51b8152600401610ae190616268565b600260c9541415611ac15760405162461bcd60e51b8152600401610ae1906162e3565b600260c955611acf81614701565b50600160c955565b60fb5460ff1615611afa5760405162461bcd60e51b8152600401610ae1906161c5565b611b1260008051602061653583398151915233612772565b611b2e5760405162461bcd60e51b8152600401610ae190616268565b600260c9541415611b515760405162461bcd60e51b8152600401610ae1906162e3565b600260c955611b5f816147b8565b6040516001600160a01b0382169033907fbb39c36a7502b7256e1a687254146a9a2ea7b146c77cb9e40eb0e2b8793781e190600090a350600160c955565b611bb560008051602061653583398151915233612772565b611bd15760405162461bcd60e51b8152600401610ae190616268565b610e588161495d565b60fb5460ff1615611bfd5760405162461bcd60e51b8152600401610ae1906161c5565b611c1560008051602061653583398151915233612772565b611c315760405162461bcd60e51b8152600401610ae190616268565b600260c9541415611c545760405162461bcd60e51b8152600401610ae1906162e3565b600260c955610112546001600160a01b0316611cd15760405162461bcd60e51b815260206004820152603660248201527f436f6d6d756e6974793a3a636f707942656e656669636961726965733a20496e60448201527576616c696420706172656e7420636f6d6d756e69747960501b6064820152608401610ae1565b611acf81614a15565b6097546001600160a01b03163314611d045760405162461bcd60e51b8152600401610ae190616233565b61010854604080516361d027b360e01b815290516000926001600160a01b0316916361d027b3916004808301926020929190829003018186803b158015611d4a57600080fd5b505afa158015611d5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d829190615b32565b61010e54909150600a11611df25760405162461bcd60e51b815260206004820152603160248201527f436f6d6d756e6974793a3a757064617465546f6b656e3a20546f6b656e206c696044820152707374206c656e67746820746f6f2062696760781b6064820152608401610ae1565b611dfa610fad565b6001600160a01b0316896001600160a01b03161415611e935760405162461bcd60e51b815260206004820152604960248201527f436f6d6d756e6974793a3a757064617465546f6b656e3a204e657720746f6b6560448201527f6e2063616e6e6f74206265207468652073616d6520617320746865206375727260648201526832b73a103a37b5b2b760b91b608482015260a401610ae1565b61010860009054906101000a90046001600160a01b03166001600160a01b0316631fccf6726040518163ffffffff1660e01b815260040160206040518083038186803b158015611ee257600080fd5b505afa158015611ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1a9190615b32565b6001600160a01b0316896001600160a01b03161480611fad57506040516319f3736160e01b81526001600160a01b038a811660048301528216906319f373619060240160206040518083038186803b158015611f7557600080fd5b505afa158015611f89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fad9190615e8a565b6120075760405162461bcd60e51b815260206004820152602560248201527f436f6d6d756e6974793a3a757064617465546f6b656e3a20496e76616c6964206044820152643a37b5b2b760d91b6064820152608401610ae1565b61010e546120a15761010e6040518060600160405280612025610fad565b6001600160a01b039081168252670de0b6b3a76400006020808401919091526000604093840181905285546001808201885596825290829020855160039092020180546001600160a01b0319169190931617825583015193810193909355015160029091015561209f612096610fad565b61010f90613dcb565b505b60006120ab611a26565b6120bd87670de0b6b3a7640000616452565b6120c79190616432565b604080516060810182526001600160a01b038d81168252602082018481524393830193845261010e805460018101825560009190915292517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f4805600390940293840180546001600160a01b0319169190931617909155517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480682015590517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480790910155905061219661010f8b613dcb565b5060006121a1610fad565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b1580156121e257600080fd5b505afa1580156121f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221a919061600a565b90508015612470576000836001600160a01b03166338a2e3e26040518163ffffffff1660e01b815260040160206040518083038186803b15801561225d57600080fd5b505afa158015612271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122959190615b32565b6001600160a01b031663735de9f76040518163ffffffff1660e01b815260040160206040518083038186803b1580156122cd57600080fd5b505afa1580156122e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123059190615b32565b905061230f610fad565b60405163095ea7b360e01b81526001600160a01b03838116600483015260248201859052919091169063095ea7b390604401602060405180830381600087803b15801561235b57600080fd5b505af115801561236f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123939190615e8a565b506040805160a06020601f8e018190040282018101909252608081018c81526000928291908f908f9081908501838280828437600092018290525093855250503060208401525060408083018790526060909201819052905163b858183f60e01b8152919250906001600160a01b0384169063b858183f90612419908590600401616377565b602060405180830381600087803b15801561243357600080fd5b505af1158015612447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061246b919061600a565b505050505b61010c546040516001600160a01b03808e169216907f0b1186973f810894b87ab0bfbee422fddcaad21b46dc705a561451bbb6bac11790600090a361010c80546001600160a01b0319166001600160a01b038d161790556124d48888888888611173565b5050505050505050505050565b6001600160a01b03811660009081526101096020526040812060609161250861010f614a65565b67ffffffffffffffff81111561252e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612557578160200160208202803683370190505b509050600061256761010f614a65565b905060005b818110156125e45760048401600061258661010f84614a6f565b6001600160a01b03166001600160a01b03168152602001908152602001600020548382815181106125c757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806125dc816164cb565b91505061256c565b50815161263e57604080516001808252818301909252906020808301908036833701905050915082600201548260008151811061263157634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b509392505050565b6097546001600160a01b031633146126705760405162461bcd60e51b8152600401610ae190616233565b61267a6000614a7b565b565b6000610a5d61010a83614a6f565b6097546001600160a01b031633146126b45760405162461bcd60e51b8152600401610ae190616233565b610107546040516001600160a01b038084169216907f0d6a84e94da4b619dd0d993b5689ec82db4b1095da99ee0f3e7bb046c647e6ad90600090a361010780546001600160a01b0319166001600160a01b0392909216919091179055565b60fb5460ff16156127355760405162461bcd60e51b8152600401610ae1906161c5565b61274d60008051602061653583398151915233612772565b6127695760405162461bcd60e51b8152600401610ae190616268565b610e5881614acd565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60fb5460ff16156127c05760405162461bcd60e51b8152600401610ae1906161c5565b6127cb8383836140ae565b61154f84614b1d565b60006127df82612b3c565b6001600160a01b03831660009081526101096020526040902060030154610a5d919061641a565b606061281361010f614a65565b61287f5760408051600180825281830190925260009160208083019080368337019050509050612841610fad565b8160008151811061286257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152919050565b61104861010f614b6d565b60fb5460ff16156128ad5760405162461bcd60e51b8152600401610ae1906161c5565b6128b88383836140ae565b61154f84614acd565b6001600160a01b03811660009081526101096020526040812090815460ff1660058111156128ff57634e487b7160e01b600052602160045260246000fd5b146129725760405162461bcd60e51b815260206004820152603a60248201527f436f6d6d756e6974793a3a62656e65666963696172794a6f696e46726f6d4d6960448201527f6772617465643a2042656e6566696369617279206578697374730000000000006064820152608401610ae1565b61010754604051630156773960e01b81526001600160a01b038481166004830152600092839283928392169063015677399060240160806040518083038186803b1580156129bf57600080fd5b505afa1580156129d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129f79190615fcc565b9350935093509350612a098585614485565b600185018390556003850181905560028501829055612a2a61010a87613dcb565b506040516001600160a01b038716907f505fe088fef0d1fb451ccfed842b55a86af1ee6208502f4bc3327dcb9032082990600090a2505050505050565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b158015612ab157600080fd5b505afa158015612ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae99190615e8a565b612b055760405162461bcd60e51b8152600401610ae1906161f0565b60fb805460ff1916905560405133907f4e50048c25972c85ad169c2302967f1e633e8dc6108d6aca51a90d2a59d4934d90600090a2565b6001600160a01b0381166000908152610109602052604081206001810154612b675750600092915050565b60fe5460018260010154612b7b9190616471565b612b859190616452565b60fd54612b92919061641a565b9392505050565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b158015612be357600080fd5b505afa158015612bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1b9190615e8a565b612c375760405162461bcd60e51b8152600401610ae1906161f0565b612c4f60008051602061653583398151915282612772565b612cc3576040805162461bcd60e51b81526020600482015260248101919091527f436f6d6d756e6974793a3a72656d6f76654d616e616765723a2054686973206160448201527f63636f756e7420646f65736e27742068617665206d616e6167657220726f6c656064820152608401610ae1565b610108546001600160a01b0382811691161415612d565760405162461bcd60e51b8152602060048201526044602482018190527f436f6d6d756e6974793a3a72656d6f76654d616e616765723a20596f75206172908201527f65206e6f7420616c6c6f7720746f2072656d6f766520636f6d6d756e697479416064820152633236b4b760e11b608482015260a401610ae1565b612d6e60008051602061653583398151915282614047565b6040516001600160a01b0382169033907f3e902a6ee93dd5b2d48bd1009c7701a481be512b1ef73dbed2f95ea44c59ea8890600090a350565b60fb5460ff1615612dca5760405162461bcd60e51b8152600401610ae1906161c5565b612de260008051602061653583398151915233612772565b612dfe5760405162461bcd60e51b8152600401610ae190616268565b61267a614334565b6097546001600160a01b03163314612e305760405162461bcd60e51b8152600401610ae190616233565b806101016000828254612e43919061641a565b909155505050565b6097546001600160a01b03163314612e755760405162461bcd60e51b8152600401610ae190616233565b600260c9541415612e985760405162461bcd60e51b8152600401610ae1906162e3565b600260c955612eb16001600160a01b0384168383614400565b612eb9610fad565b6001600160a01b0316836001600160a01b03161415612eda57612eda613de0565b816001600160a01b0316836001600160a01b03167f9b035625e569d1d2bf54830a290aefba7ab11610ba8490871dc62b86b63a895683604051612f1f91815260200190565b60405180910390a35050600160c95550565b60fb5460ff1615612f545760405162461bcd60e51b8152600401610ae1906161c5565b612f6c60008051602061653583398151915233612772565b612f885760405162461bcd60e51b8152600401610ae190616268565b610e5881614b7a565b612fa960008051602061653583398151915233612772565b612fc55760405162461bcd60e51b8152600401610ae190616268565b610e58816142e4565b60fb5460ff1615612ff15760405162461bcd60e51b8152600401610ae1906161c5565b61300960008051602061653583398151915233612772565b6130255760405162461bcd60e51b8152600401610ae190616268565b610e5881614b1d565b60fb5460ff16156130515760405162461bcd60e51b8152600401610ae1906161c5565b61306960008051602061653583398151915233612772565b6130855760405162461bcd60e51b8152600401610ae190616268565b610e5881614c04565b6097546001600160a01b031633146130b85760405162461bcd60e51b8152600401610ae190616233565b610108546040516001600160a01b038084169216907fdd8d3b7b0badfc5d636d48e71e28015b4b8554b64d2cffba6f0a90bf7693ec0090600090a361010880546001600160a01b0319166001600160a01b038316908117909155610e5890613a07565b60405162461bcd60e51b815260206004820152603b60248201527f436f6d6d756e6974793a3a7265766f6b65526f6c653a20596f7520617265206e60448201527f6f7420616c6c6f7720746f207573652074686973206d6574686f6400000000006064820152608401610ae1565b60fb5460ff16156131ac5760405162461bcd60e51b8152600401610ae1906161c5565b600260c95414156131cf5760405162461bcd60e51b8152600401610ae1906162e3565b600260c9556131df8383836140ae565b6131e884614701565b5050600160c9555050565b600260c95414156132165760405162461bcd60e51b8152600401610ae1906162e3565b600260c95561323a823083613229610fad565b6001600160a01b0316929190614c8e565b80610102600082825461324d919061641a565b9091555061325b9050613de0565b60405181815233907f0553260a2e46b0577270d8992db02d30856ca880144c72d6e9503760946aef139060200160405180910390a25050600160c955565b600061104861010a614a65565b6097546001600160a01b031633146132d05760405162461bcd60e51b8152600401610ae190616233565b61011280546001600160a01b0319166001600160a01b0383169081179091556040805163f92b6c0160e01b815290516000928392909163f92b6c0191600480820192602092909190829003018186803b15801561332c57600080fd5b505afa158015613340573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613364919061600a565b61010e54600093509091505b808310156133da5761010e80548061339857634e487b7160e01b600052603160045260246000fd5b60008281526020812060036000199093019283020180546001600160a01b031916815560018101829055600201559055826133d2816164cb565b935050613370565b60008060008095505b848610156135425761011254604051632a62b44f60e11b8152600481018890526001600160a01b03909116906354c5689e9060240160606040518083038186803b15801561343057600080fd5b505afa158015613444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134689190615c91565b604080516060810182526001600160a01b0385811682526020820185815292820184815261010e805460018101825560009190915292517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f4805600390940293840180546001600160a01b031916919093161790915591517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480682015590517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480790910155919450925090508561353a816164cb565b9650506133e3565b600061354f61010f614a65565b90505b80156135825761357161356861010f6000614a6f565b61010f90614cc6565b5061357b816164b4565b9050613552565b6101125460408051634f162c6560e11b815290516000926001600160a01b031691639e2c58ca9160048083019286929190829003018186803b1580156135c757600080fd5b505afa1580156135db573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136039190810190615cfa565b8051600099509091505b8089101561366457613651828a8151811061363857634e487b7160e01b600052603260045260246000fd5b602002602001015161010f613dcb90919063ffffffff16565b508861365c816164cb565b99505061360d565b50505050505050505050565b6097546001600160a01b0316331461369a5760405162461bcd60e51b8152600401610ae190616233565b6001600160a01b0381166136ff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ae1565b610e5881614a7b565b6060611048610113614b6d565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b15801561375f57600080fd5b505afa158015613773573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137979190615e8a565b6137b35760405162461bcd60e51b8152600401610ae1906161f0565b60fb805460ff1916600117905560405133907fe1e6bc10311f2f958d6cd2d0ab7308c32089aa1acb8ab11a2ccb60028e332bd090600090a2565b61010e5460009060028110156138095750506002820154610a5d565b6002840154600061381b600184616471565b90505b856003015461010e828154811061384557634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016002015411156139045761010e818154811061387f57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016002015485101561389d576138f2565b670de0b6b3a764000061010e82815481106138c857634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160010154836138e59190616452565b6138ef9190616432565b91505b806138fc816164b4565b91505061381e565b50949350505050565b600054610100900460ff166139345760405162461bcd60e51b8152600401610ae190616298565b61393c614cdb565b613944614cdb565b61267a614cdb565b600054610100900460ff166139735760405162461bcd60e51b8152600401610ae190616298565b61397b614cdb565b61267a614d02565b600054610100900460ff166139aa5760405162461bcd60e51b8152600401610ae190616298565b61267a614d32565b600082815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b610e918282614d60565b613a1f60008051602061653583398151915282612772565b610e5857613a3b60008051602061653583398151915282614d60565b6040516001600160a01b0382169033907f05a4006f300442cf8b7fdb885f5ee958812020bffb5c5a8e655fde64e5f987ed90600090a350565b806001600160a01b0316826001600160a01b03161415613b0a5760405162461bcd60e51b8152602060048201526044602482018190527f436f6d6d756e6974793a3a6368616e676542656e656669636961727941646472908201527f6573733a2042656e65666963696172696573206d7573742062652064696666656064820152631c995b9d60e21b608482015260a401610ae1565b6001600160a01b0380831660009081526101096020526040808220928416825290206004825460ff166005811115613b5257634e487b7160e01b600052602160045260246000fd5b14158015613b8457506000825460ff166005811115613b8157634e487b7160e01b600052602160045260246000fd5b14155b613ba05760405162461bcd60e51b8152600401610ae19061631a565b6004815460ff166005811115613bc657634e487b7160e01b600052602160045260246000fd5b1415613c3a5760405162461bcd60e51b815260206004820152603f60248201527f436f6d6d756e6974793a3a6368616e676542656e65666963696172794164647260448201527f6573733a20496e76616c6964207461726765742062656e6566696369617279006064820152608401610ae1565b6000815460ff166005811115613c6057634e487b7160e01b600052602160045260246000fd5b1415613c76578154613c7690829060ff16614485565b613c81826004614485565b8160010154816001016000828254613c99919061641a565b9091555050600380830154908201541115613cda57613cbc8282600301546137ed565b816002016000828254613ccf919061641a565b90915550613d079050565b613ce88183600301546137ed565b8260020154613cf7919061641a565b6002820155600380830154908201555b6000613d1461010f614a65565b90506000805b82811015613d8257613d2e61010f82614a6f565b6001600160a01b038116600090815260048088016020908152604080842054928901909152822080549395509092909190613d6a90849061641a565b90915550819050613d7a816164cb565b915050613d1a565b50846001600160a01b0316866001600160a01b03167fb53b7057ddbff0cd9111b0a1a501a9cc1a9c315eb3396cb0d47917908325999a60405160405180910390a3505050505050565b6000612b92836001600160a01b038416614de6565b60008061010860009054906101000a90046001600160a01b03166001600160a01b0316636b68b2ef6040518163ffffffff1660e01b815260040160206040518083038186803b158015613e3257600080fd5b505afa158015613e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e6a919061600a565b9050600061010860009054906101000a90046001600160a01b03166001600160a01b031663afae65be6040518163ffffffff1660e01b815260040160206040518083038186803b158015613ebd57600080fd5b505afa158015613ed1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ef5919061600a565b90506101005460001480613f0a575061010554155b80613f155750808211155b15613f245760fc549250613ff4565b61010054613f30610fad565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b158015613f7157600080fd5b505afa158015613f85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fa9919061600a565b613fb39190616432565b92506000828260fc54613fc69190616452565b613fd09190616432565b905080841015613fe257809350613ff2565b60fc54841115613ff25760fc5493505b505b610111548314614042576101115460408051918252602082018590527fc22e16deec6f587d0a1aad7275c1621e6c24431fea14dd71e8f3243e9fbc5ca3910160405180910390a16101118390555b505050565b6140518282612772565b15610e915760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61010860009054906101000a90046001600160a01b03166001600160a01b031663af2d77f86040518163ffffffff1660e01b815260040160206040518083038186803b1580156140fd57600080fd5b505afa158015614111573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141359190615b32565b6001600160a01b0316336001600160a01b0316146141aa5760405162461bcd60e51b815260206004820152602c60248201527f436f6d6d756e6974793a2053656e646572206d7573742062652074686520626160448201526b18dad95b99081dd85b1b195d60a21b6064820152608401610ae1565b428310156141fa5760405162461bcd60e51b815260206004820152601c60248201527f436f6d6d756e6974793a205369676e617475726520746f6f206f6c64000000006044820152606401610ae1565b60408051336020820152309181019190915260608101849052600090608001604051602081830303815290604052805190602001209050600061427e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506142789250869150614e359050565b90614e88565b905061429860008051602061653583398151915282612772565b6113805760405162461bcd60e51b815260206004820152601c60248201527f436f6d6d756e6974793a20496e76616c6964207369676e6174757265000000006044820152606401610ae1565b80516000905b808210156140425761432283838151811061431557634e487b7160e01b600052603260045260246000fd5b602002602001015161495d565b8161432c816164cb565b9250506142ea565b6101055461433e57565b610108546040805163174a71d760e01b815290516000926001600160a01b03169163174a71d791600480830192602092919082900301818787803b15801561438557600080fd5b505af1158015614399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143bd919061600a565b90508015610e585743610106556143d2613de0565b60405133907f16a8b794d4e2ed6ffef50d78af3d4372ce4bfe8a399bfc23f59b7832ee47539090600090a250565b6040516001600160a01b03831660248201526044810182905261404290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614ea4565b6001600160a01b03811660009081526001830160205260408120541515612b92565b8060058111156144a557634e487b7160e01b600052602160045260246000fd5b825460ff1660058111156144c957634e487b7160e01b600052602160045260246000fd5b14156144d3575050565b60018160058111156144f557634e487b7160e01b600052602160045260246000fd5b141561466f5760fc546101035460ff5461450f9190616471565b101561457b5760405162461bcd60e51b815260206004820152603560248201527f436f6d6d756e6974793a3a5f6368616e676542656e656669636961727953746160448201527474653a204d617820636c61696d20746f6f206c6f7760581b6064820152608401610ae1565b61010d541580614590575061010d5461010054105b6146395760405162461bcd60e51b815260206004820152606860248201527f436f6d6d756e6974793a3a5f6368616e676542656e656669636961727953746160448201527f74653a205468697320636f6d6d756e697479206861732072656163686564207460648201527f6865206d6178696d756d206e756d626572206f662076616c69642062656e6566608482015267696369617269657360c01b60a482015260c401610ae1565b610100805490600061464a836164cb565b91905055506101035460ff60008282546146649190616471565b909155506146cc9050565b6001825460ff16600581111561469557634e487b7160e01b600052602160045260246000fd5b14156146cc5761010080549060006146ac836164b4565b91905055506101035460ff60008282546146c6919061641a565b90915550505b81548190839060ff191660018360058111156146f857634e487b7160e01b600052602160045260246000fd5b02179055505050565b80516000905b808210156140425761473f83838151811061473257634e487b7160e01b600052603260045260246000fd5b60200260200101516147b8565b82828151811061475f57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316336001600160a01b03167fbb39c36a7502b7256e1a687254146a9a2ea7b146c77cb9e40eb0e2b8793781e160405160405180910390a3816147b0816164cb565b925050614707565b6001600160a01b03811660009081526101096020526040812090815460ff1660058111156147f657634e487b7160e01b600052602160045260246000fd5b146147ff575050565b610112546001600160a01b03161561492b5761011254604051630156773960e01b81526001600160a01b038481166004830152600092169063015677399060240160806040518083038186803b15801561485857600080fd5b505afa15801561486c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148909190615fcc565b509192506000915061489f9050565b8160058111156148bf57634e487b7160e01b600052602160045260246000fd5b146149295760405162461bcd60e51b815260206004820152603460248201527f436f6d6d756e6974793a3a61646442656e65666963696172793a20496e76616c60448201527369642062656e656669636961727920737461746560601b6064820152608401610ae1565b505b614936816001614485565b43600382015561494861010a83613dcb565b50610e9182662386f26fc10000611880610fad565b6001600160a01b0381166000908152610109602052604090206001815460ff16600581111561499c57634e487b7160e01b600052602160045260246000fd5b14806149cb57506002815460ff1660058111156149c957634e487b7160e01b600052602160045260246000fd5b145b15610e91576149db816003614485565b6040516001600160a01b0383169033907f1a6590bd0cabbfcc7c86bef99e1034054e179905cfcc294598fcd426c092244290600090a35050565b80516000905b8082101561404257614a53838381518110614a4657634e487b7160e01b600052603260045260246000fd5b6020026020010151614f76565b81614a5d816164cb565b925050614a1b565b6000610a5d825490565b6000612b9283836153a8565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516000905b8082101561404257614b0b838381518110614afe57634e487b7160e01b600052603260045260246000fd5b6020026020010151614b7a565b81614b15816164cb565b925050614ad3565b80516000905b8082101561404257614b5b838381518110614b4e57634e487b7160e01b600052603260045260246000fd5b6020026020010151614c04565b81614b65816164cb565b925050614b23565b60606000612b92836153e0565b6001600160a01b0381166000908152610109602052604090206001815460ff166005811115614bb957634e487b7160e01b600052602160045260246000fd5b1415610e9157614bca816002614485565b6040516001600160a01b0383169033907f2b9ef93c7856b47a1b624fa3fcc4b651d388dd6d16327f3ad22b05f3da8b0f1590600090a35050565b6001600160a01b0381166000908152610109602052604090206002815460ff166005811115614c4357634e487b7160e01b600052602160045260246000fd5b1415610e9157614c54816001614485565b6040516001600160a01b0383169033907fa589fb4f2925123e7a030dd6bbe76be46a03f8ce0ea53a78dbb3383c7797db2c90600090a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261154f9085906323b872dd60e01b9060840161442c565b6000612b92836001600160a01b03841661543c565b600054610100900460ff1661267a5760405162461bcd60e51b8152600401610ae190616298565b600054610100900460ff16614d295760405162461bcd60e51b8152600401610ae190616298565b61267a33614a7b565b600054610100900460ff16614d595760405162461bcd60e51b8152600401610ae190616298565b600160c955565b614d6a8282612772565b610e915760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055614da23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054614e2d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a5d565b506000610a5d565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000614e978585615559565b9150915061263e816155c9565b6000614ef9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166157ca9092919063ffffffff16565b8051909150156140425780806020019051810190614f179190615e8a565b6140425760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ae1565b6001600160a01b03811660009081526101096020526040812090815460ff166005811115614fb457634e487b7160e01b600052602160045260246000fd5b14614fbd575050565b61011254604051630156773960e01b81526001600160a01b038481166004830152600092839283928392169063015677399060240160806040518083038186803b15801561500a57600080fd5b505afa15801561501e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150429190615fcc565b92965090945092509050600584600581111561506e57634e487b7160e01b600052602160045260246000fd5b14156150db5760405162461bcd60e51b815260206004820152603660248201527f436f6d6d756e6974793a3a636f707942656e65666963696172793a2042656e65604482015275199a58da585c9e48185b1c9958591e4818dbdc1a595960521b6064820152608401610ae1565b6150e58585614485565b60018501839055600285018290556003850181905561011254604051636b31f2ad60e01b81526001600160a01b0388811660048301526000921690636b31f2ad9060240160006040518083038186803b15801561514157600080fd5b505afa158015615155573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261517d9190810190615e03565b9050600061011260009054906101000a90046001600160a01b03166001600160a01b0316639e2c58ca6040518163ffffffff1660e01b815260040160006040518083038186803b1580156151d057600080fd5b505afa1580156151e4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261520c9190810190615cfa565b825190915060005b818110156152ea5761525883828151811061523f57634e487b7160e01b600052603260045260246000fd5b602002602001015161010f61446390919063ffffffff16565b156152d85783818151811061527d57634e487b7160e01b600052603260045260246000fd5b60200260200101518960040160008584815181106152ab57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055505b806152e2816164cb565b915050615214565b506101125460405163572b9e7b60e01b81526001600160a01b039091169063572b9e7b9061531f908c906005906004016160e7565b600060405180830381600087803b15801561533957600080fd5b505af115801561534d573d6000803e3d6000fd5b505050506153668961010a613dcb90919063ffffffff16565b506040516001600160a01b038a169033907f7b385acd6ce016fe5a2ca902550e21b2c49056139ce3e7517e4c63ecd535b71490600090a3505050505050505050565b60008260000182815481106153cd57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60608160000180548060200260200160405190810160405280929190818152602001828054801561543057602002820191906000526020600020905b81548152602001906001019080831161541c575b50505050509050919050565b6000818152600183016020526040812054801561554f576000615460600183616471565b855490915060009061547490600190616471565b90508181146154f55760008660000182815481106154a257634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050808760000184815481106154d357634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061551457634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a5d565b6000915050610a5d565b6000808251604114156155905760208301516040840151606085015160001a615584878285856157e1565b945094505050506155c2565b8251604014156155ba57602083015160408401516155af8683836158ce565b9350935050506155c2565b506000905060025b9250929050565b60008160048111156155eb57634e487b7160e01b600052602160045260246000fd5b14156155f45750565b600181600481111561561657634e487b7160e01b600052602160045260246000fd5b14156156645760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610ae1565b600281600481111561568657634e487b7160e01b600052602160045260246000fd5b14156156d45760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ae1565b60038160048111156156f657634e487b7160e01b600052602160045260246000fd5b141561574f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ae1565b600481600481111561577157634e487b7160e01b600052602160045260246000fd5b1415610e585760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610ae1565b60606157d984846000856158fd565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561581857506000905060036158c5565b8460ff16601b1415801561583057508460ff16601c14155b1561584157506000905060046158c5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015615895573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166158be576000600192509250506158c5565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b016158ef878288856157e1565b935093505050935093915050565b60608247101561595e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ae1565b843b6159ac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ae1565b600080866001600160a01b031685876040516159c891906160cb565b60006040518083038185875af1925050503d8060008114615a05576040519150601f19603f3d011682016040523d82523d6000602084013e615a0a565b606091505b5091509150615a1a828286615a25565b979650505050505050565b60608315615a34575081612b92565b825115615a445782518084602001fd5b8160405162461bcd60e51b8152600401610ae191906161b2565b600082601f830112615a6e578081fd5b81356020615a83615a7e836163f6565b6163c5565b80838252828201915082860187848660051b8901011115615aa2578586fd5b855b85811015615ac9578135615ab781616512565b84529284019290840190600101615aa4565b5090979650505050505050565b60008083601f840112615ae7578182fd5b50813567ffffffffffffffff811115615afe578182fd5b6020830191508360208285010111156155c257600080fd5b600060208284031215615b27578081fd5b8135612b9281616512565b600060208284031215615b43578081fd5b8151612b9281616512565b60008060408385031215615b60578081fd5b8235615b6b81616512565b91506020830135615b7b81616512565b809150509250929050565b60008060008060008060008060008060006101608c8e031215615ba7578687fd5b8b35615bb281616512565b9a5060208c013567ffffffffffffffff811115615bcd578788fd5b615bd98e828f01615a5e565b9a505060408c0135985060608c0135975060808c0135965060a08c0135955060c08c0135945060e08c013593506101008c013592506101208c013591506101408c0135615c2581616512565b809150509295989b509295989b9093969950565b60008060408385031215615c4b578182fd5b8235615c5681616512565b91506020830135615b7b81616527565b60008060408385031215615c78578182fd5b8235615c8381616512565b946020939093013593505050565b600080600060608486031215615ca5578081fd5b8351615cb081616512565b602085015160409095015190969495509392505050565b600060208284031215615cd8578081fd5b813567ffffffffffffffff811115615cee578182fd5b6157d984828501615a5e565b60006020808385031215615d0c578182fd5b825167ffffffffffffffff811115615d22578283fd5b8301601f81018513615d32578283fd5b8051615d40615a7e826163f6565b80828252848201915084840188868560051b8701011115615d5f578687fd5b8694505b83851015615d8a578051615d7681616512565b835260019490940193918501918501615d63565b50979650505050505050565b60008060008060608587031215615dab578182fd5b843567ffffffffffffffff80821115615dc2578384fd5b615dce88838901615a5e565b9550602087013594506040870135915080821115615dea578384fd5b50615df787828801615ad6565b95989497509550505050565b60006020808385031215615e15578182fd5b825167ffffffffffffffff811115615e2b578283fd5b8301601f81018513615e3b578283fd5b8051615e49615a7e826163f6565b80828252848201915084840188868560051b8701011115615e68578687fd5b8694505b83851015615d8a578051835260019490940193918501918501615e6c565b600060208284031215615e9b578081fd5b81518015158114612b92578182fd5b600060208284031215615ebb578081fd5b5035919050565b60008060408385031215615ed4578182fd5b823591506020830135615b7b81616512565b600060208284031215615ef7578081fd5b81356001600160e01b031981168114612b92578182fd5b600080600060608486031215615f22578081fd5b8335615f2d81616512565b92506020840135615f3d81616512565b929592945050506040919091013590565b60008060008060008060008060e0898b031215615f69578182fd5b8835615f7481616512565b9750602089013567ffffffffffffffff811115615f8f578283fd5b615f9b8b828c01615ad6565b999c909b509899604081013599606082013599506080820135985060a0820135975060c09091013595509350505050565b60008060008060808587031215615fe1578182fd5b8451615fec81616527565b60208601516040870151606090970151919890975090945092505050565b60006020828403121561601b578081fd5b5051919050565b60008060408385031215616034578182fd5b50508035926020909101359150565b600080600080600060a0868803121561605a578283fd5b505083359560208501359550604085013594606081013594506080013592509050565b60008151808452616095816020860160208601616488565b601f01601f19169290920160200192915050565b600681106160c757634e487b7160e01b600052602160045260246000fd5b9052565b600082516160dd818460208701616488565b9190910192915050565b6001600160a01b038316815260408101612b9260208301846160a9565b6020808252825182820181905260009190848201906040850190845b818110156161455783516001600160a01b031683529284019291840191600101616120565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156161455783518352928401929184019160010161616d565b6080810161619782876160a9565b84602083015283604083015282606083015295945050505050565b602081526000612b92602083018461607d565b60208082526011908201527010dbdb5b5d5b9a5d1e4e881b1bd8dad959607a1b604082015260600190565b60208082526023908201527f436f6d6d756e6974793a204e4f545f414d4241535341444f525f4f525f454e5460408201526249545960e81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526016908201527521b7b6b6bab734ba3c9d102727aa2fa6a0a720a3a2a960511b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526038908201527f436f6d6d756e6974793a3a6368616e676542656e65666963696172794164647260408201527f6573733a20496e76616c69642062656e65666963696172790000000000000000606082015260800190565b60208152600082516080602084015261639360a084018261607d565b905060018060a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b604051601f8201601f1916810167ffffffffffffffff811182821017156163ee576163ee6164fc565b604052919050565b600067ffffffffffffffff821115616410576164106164fc565b5060051b60200190565b6000821982111561642d5761642d6164e6565b500190565b60008261644d57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561646c5761646c6164e6565b500290565b600082821015616483576164836164e6565b500390565b60005b838110156164a357818101518382015260200161648b565b8381111561154f5750506000910152565b6000816164c3576164c36164e6565b506000190190565b60006000198214156164df576164df6164e6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e5857600080fd5b60068110610e5857600080fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220ccd087a0670dfd7aa186e7553292c6c5bfe7cb168c3948d7551c1b08b3efe81e64736f6c63430008040033

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061048b5760003560e01c80638da5cb5b11610262578063c51fab3c11610151578063e25c25f3116100ce578063f2fde38b11610092578063f2fde38b146109ac578063f36e2609146109bf578063f83d08ba146109c7578063f92b6c01146109cf578063fb7b0a0c146109d8578063fc0c546a1461055557600080fd5b8063e25c25f314610957578063e69d849d1461096a578063eb0376b11461097d578063ecd0c0c314610985578063eeda3c4c1461099957600080fd5b8063d33d4ec611610115578063d33d4ec614610915578063d4938db314610928578063d547741f14610930578063d6dbd97214610943578063dd4414bb1461094d57600080fd5b8063c51fab3c146108c5578063c76a890c146108cf578063cf309012146108e2578063d04c41b6146108ef578063d10f51071461090257600080fd5b8063a57e08ca116101df578063b809ee82116101a3578063b809ee8214610871578063bbd17ead14610884578063beabacc814610898578063c041fdc5146108ab578063c0e27b6b146108b257600080fd5b8063a57e08ca14610828578063a69df4b51461083b578063a8f3e06314610843578063ac18de4314610856578063b026ba571461086957600080fd5b80639e2c58ca116102265780639e2c58ca146107e5578063a0f93a17146107fa578063a217fddf14610804578063a38540ee1461080c578063a3c6e4111461081557600080fd5b80638da5cb5b1461079157806391d14854146107a257806394e13748146107b55780639c01a401146107c85780639cecf572146107d257600080fd5b8063431a801a1161037e5780635c7054c0116102fb578063785393db116102bf578063785393db1461074e57806378ba280f146106a25780637e2959dc14610761578063830953ab1461077457806389554f171461077e57600080fd5b80635c7054c0146106ec5780635fac917a146106ff5780636290a579146107135780636b31f2ad14610726578063715018a61461074657600080fd5b806357c363271161034257806357c36327146106a2578063590411da146106aa5780635926651d146106bd57806359633a1c146106d0578063597be18b146106e357600080fd5b8063431a801a146106325780634e71d92d1461063c57806351d84c9e1461064457806354c5689e14610657578063572b9e7b1461068f57600080fd5b8063248a9ca31161040c578063300c12fe116103d0578063300c12fe146105db578063305ff654146105e557806336568abe146105f857806337e556dd1461060b5780633a578a0c1461061e57600080fd5b8063248a9ca3146105755780632b271117146105985780632d06177a146105a25780632f2ff15d146105b55780632fd79103146105c857600080fd5b80630e5b7c53116104535780630e5b7c531461051357806312d0e65a1461051c57806315f7c7201461052f5780631912cdb4146105425780631fccf6721461055557600080fd5b8063015677391461049057806301ffc9a7146104bc57806309c338c3146104df5780630b4e7817146104f75780630d8e6e2c1461050c575b600080fd5b6104a361049e366004615b16565b6109e1565b6040516104b39493929190616189565b60405180910390f35b6104cf6104ca366004615ee6565b610a2c565b60405190151581526020016104b3565b6104e96101065481565b6040519081526020016104b3565b61050a610505366004615b86565b610a63565b005b60046104e9565b6104e960fd5481565b61050a61052a366004615b16565b610df5565b61050a61053d366004615b16565b610e5b565b61050a610550366004616022565b610e95565b61055d610fad565b6040516001600160a01b0390911681526020016104b3565b6104e9610583366004615eaa565b60009081526065602052604090206001015490565b6104e96101055481565b61050a6105b0366004615b16565b61105e565b61050a6105c3366004615ec2565b611105565b61050a6105d6366004616043565b611173565b61010554156104cf565b61050a6105f3366004615eaa565b611387565b61050a610606366004615ec2565b6114c1565b61050a610619366004615d96565b61153b565b6101075461055d906001600160a01b031681565b6104e96101005481565b61050a611555565b61050a610652366004615b4e565b6118d0565b61066a610665366004615eaa565b61190e565b604080516001600160a01b0390941684526020840192909252908201526060016104b3565b61050a61069d366004615c39565b61194c565b6104e9611a26565b61050a6106b8366004615cc7565b611a47565b61050a6106cb366004615b16565b611ad7565b61050a6106de366004615b16565b611b9d565b6104e960fe5481565b61050a6106fa366004615cc7565b611bda565b6101085461055d906001600160a01b031681565b61050a610721366004615f4e565b611cda565b610739610734366004615b16565b6124e1565b6040516104b39190616151565b61050a612646565b61055d61075c366004615eaa565b61267c565b61050a61076f366004615b16565b61268a565b6104e96101115481565b61050a61078c366004615cc7565b612712565b6097546001600160a01b031661055d565b6104cf6107b0366004615ec2565b612772565b61050a6107c3366004615d96565b61279d565b6104e96101015481565b6104e96107e0366004615b16565b6127d4565b6107ed612806565b6040516104b39190616104565b6104e961010d5481565b6104e9600081565b6104e960ff5481565b61050a610823366004615d96565b61288a565b61050a610836366004615b16565b6128c1565b61050a612a67565b6104e9610851366004615b16565b612b3c565b61050a610864366004615b16565b612b99565b61050a612da7565b61050a61087f366004615eaa565b612e06565b6101125461055d906001600160a01b031681565b61050a6108a6366004615f0e565b612e4b565b600061055d565b61050a6108c0366004615b16565b612f31565b6104e96101035481565b61050a6108dd366004615cc7565b612f91565b60fb546104cf9060ff1681565b61050a6108fd366004615cc7565b612fce565b61050a610910366004615b16565b61302e565b61050a610923366004615b16565b61308e565b60ff546104e9565b61050a61093e366004615ec2565b61311b565b6104e96101025481565b6104e96101045481565b61050a610965366004615d96565b613189565b61050a610978366004615c66565b6131f3565b6104e9613299565b61010c5461055d906001600160a01b031681565b61050a6109a7366004615b16565b6132a6565b61050a6109ba366004615b16565b613670565b6107ed613708565b61050a613715565b61010e546104e9565b6104e960fc5481565b6001600160a01b0381166000908152610109602052604081208054600182015483928392839260ff90911690610a1783436137ed565b83600301549450945094509450509193509193565b60006001600160e01b03198216637965db0b60e01b1480610a5d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600054610100900460ff16610a7e5760005460ff1615610a82565b303b155b610aea5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b600054610100900460ff16158015610b0c576000805461ffff19166101011790555b858711610b945760405162461bcd60e51b815260206004820152604a60248201527f436f6d6d756e6974793a3a696e697469616c697a653a2062617365496e74657260448201527f76616c206d7573742062652067726561746572207468616e20696e6372656d656064820152691b9d125b9d195c9d985b60b21b608482015260a401610ae1565b89891015610bfe5760405162461bcd60e51b815260206004820152603160248201527f436f6d6d756e6974793a3a696e697469616c697a653a206f726967696e616c436044820152706c61696d416d6f756e7420746f2062696760781b6064820152608401610ae1565b83851115610c845760405162461bcd60e51b815260206004820152604760248201527f436f6d6d756e6974793a3a696e697469616c697a653a206d696e5472616e636860448201527f652073686f756c64206e6f742062652067726561746572207468616e206d61786064820152665472616e63686560c81b608482015260a401610ae1565b61010880546001600160a01b03191633179055610c9f61390d565b610ca761394c565b610caf613983565b61010c80546001600160a01b03808f166001600160a01b03199283161790925560fc8c90556101118c905560fd89905560fe88905560ff8b905561010487905561010586905561010780549285169290911691909117905561010388905561010d83905560fb805460ff19169055610d2633613670565b610d3e600080516020616535833981519152806139b2565b610d56600080516020616535833981519152336139fd565b604051339081907f05a4006f300442cf8b7fdb885f5ee958812020bffb5c5a8e655fde64e5f987ed90600090a38a516000905b80821015610dd357610dc18d8381518110610db457634e487b7160e01b600052603260045260246000fd5b6020026020010151613a07565b81610dcb816164cb565b925050610d89565b50508015610de7576000805461ff00191690555b505050505050505050505050565b6001600160a01b0381166000908152610109602052604081205460ff166005811115610e3157634e487b7160e01b600052602160045260246000fd5b14610e4e5760405162461bcd60e51b8152600401610ae19061631a565b610e583382613a74565b50565b6097546001600160a01b03163314610e855760405162461bcd60e51b8152600401610ae190616233565b610e9161011382613dcb565b5050565b6097546001600160a01b03163314610ebf5760405162461bcd60e51b8152600401610ae190616233565b80821115610f505760405162461bcd60e51b815260206004820152605260248201527f436f6d6d756e6974793a3a757064617465436f6d6d756e697479506172616d7360448201527f3a206d696e5472616e6368652073686f756c64206e6f742062652067726561746064820152716572207468616e206d61785472616e63686560701b608482015260a401610ae1565b61010454610105546040805192835260208301919091528101839052606081018290527fcd922a6f0ad842d84e08eb5df24c029b63c60167fb37cff24adf95c4832e32589060800160405180910390a16101049190915561010555565b61010c546000906001600160a01b031661104d5761010860009054906101000a90046001600160a01b03166001600160a01b0316631fccf6726040518163ffffffff1660e01b815260040160206040518083038186803b15801561101057600080fd5b505afa158015611024573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110489190615b32565b905090565b5061010c546001600160a01b031690565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b1580156110a857600080fd5b505afa1580156110bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e09190615e8a565b6110fc5760405162461bcd60e51b8152600401610ae1906161f0565b610e5881613a07565b60405162461bcd60e51b815260206004820152603a60248201527f436f6d6d756e6974793a3a6772616e74526f6c653a20596f7520617265206e6f60448201527f7420616c6c6f7720746f207573652074686973206d6574686f640000000000006064820152608401610ae1565b6097546001600160a01b0316331461119d5760405162461bcd60e51b8152600401610ae190616233565b8082116112385760405162461bcd60e51b815260206004820152605760248201527f436f6d6d756e6974793a3a75706461746542656e65666963696172795061726160448201527f6d733a2062617365496e74657276616c206d757374206265206772656174657260648201527f207468616e20696e6372656d656e74496e74657276616c000000000000000000608482015260a401610ae1565b82610100546112479190616452565b611251908661641a565b8410156112c65760405162461bcd60e51b815260206004820152603f60248201527f436f6d6d756e6974793a3a75706461746542656e65666963696172795061726160448201527f6d733a206f726967696e616c436c61696d416d6f756e7420746f6f20626967006064820152608401610ae1565b60fc5460ff546101035460fd5460fe54604080519586526020860194909452848401929092526060840152608083015260a0820187905260c0820186905260e0820185905261010082018490526101208201839052517fa19f450cd68c70f728b0c4b75befd202ea5ebb1ae78b6aca47365934b5008750918190036101400190a160fc8590556101005461135b908490616452565b6113659085616471565b60ff5561010383905560fd82905560fe819055611380613de0565b5050505050565b6097546001600160a01b031633148061141d575061010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b1580156113e557600080fd5b505afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141d9190615e8a565b61147e5760405162461bcd60e51b815260206004820152602c60248201527f436f6d6d756e6974793a204e4f545f4f574e45525f4f525f414d42415353414460448201526b4f525f4f525f454e5449545960a01b6064820152608401610ae1565b61010d5460408051918252602082018390527f6672b7064fe522fa09a8078f6d967272e0a379beb2270817417c9f023251b657910160405180910390a161010d55565b6001600160a01b03811633146115315760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ae1565b610e918282614047565b6115468383836140ae565b61154f846142e4565b50505050565b60fb5460ff16156115785760405162461bcd60e51b8152600401610ae1906161c5565b6001336000908152610109602052604090205460ff1660058111156115ad57634e487b7160e01b600052602160045260246000fd5b146115fa5760405162461bcd60e51b815260206004820181905260248201527f436f6d6d756e6974793a204e4f545f56414c49445f42454e45464943494152596044820152606401610ae1565b600260c954141561161d5760405162461bcd60e51b8152600401610ae1906162e3565b600260c95561162a614334565b336000908152610109602052604081209061164582436137ed565b905043611651336127d4565b111561169f5760405162461bcd60e51b815260206004820152601960248201527f436f6d6d756e6974793a3a636c61696d3a204e4f545f594554000000000000006044820152606401610ae1565b60ff5481106117055760405162461bcd60e51b815260206004820152602c60248201527f436f6d6d756e6974793a3a636c61696d3a20416c726561647920636c61696d6560448201526b642065766572797468696e6760a01b6064820152608401610ae1565b60008061011154116117195760fc5461171e565b610111545b905060008260ff546117309190616471565b82111561174a578260ff546117459190616471565b61174c565b815b61010e549091506001108015611799575061010e60018154811061178057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600201548460030154105b156117f757836002015484600401600061010e6000815481106117cc57634e487b7160e01b600052603260045260246000fd5b600091825260208083206003909202909101546001600160a01b031683528201929092526040019020555b611801818461641a565b6002850155600184018054906000611818836164cb565b909155505043600385015561010e5460011015611873578084600401600061183e610fad565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461186d919061641a565b90915550505b6118903382611880610fad565b6001600160a01b03169190614400565b60405181815233907fd54e03b214b3e8c17e98044f98554b6f1b18dd2a3163a2619afea7e9b2a6eb979060200160405180910390a25050600160c9555050565b6118e860008051602061653583398151915233612772565b6119045760405162461bcd60e51b8152600401610ae190616268565b610e918282613a74565b61010e818154811061191f57600080fd5b60009182526020909120600390910201805460018201546002909201546001600160a01b03909116925083565b60fb5460ff161561196f5760405162461bcd60e51b8152600401610ae1906161c5565b61197b61011333614463565b6119d15760405162461bcd60e51b815260206004820152602160248201527f436f6d6d756e6974793a20496e76616c696420636f6d6d756e69747920636f706044820152607960f81b6064820152608401610ae1565b600260c95414156119f45760405162461bcd60e51b8152600401610ae1906162e3565b600260c9556001600160a01b038216600090815261010960205260409020611a1c8183614485565b5050600160c95550565b60006101035461010054611a3a9190616452565b60ff54611048919061641a565b60fb5460ff1615611a6a5760405162461bcd60e51b8152600401610ae1906161c5565b611a8260008051602061653583398151915233612772565b611a9e5760405162461bcd60e51b8152600401610ae190616268565b600260c9541415611ac15760405162461bcd60e51b8152600401610ae1906162e3565b600260c955611acf81614701565b50600160c955565b60fb5460ff1615611afa5760405162461bcd60e51b8152600401610ae1906161c5565b611b1260008051602061653583398151915233612772565b611b2e5760405162461bcd60e51b8152600401610ae190616268565b600260c9541415611b515760405162461bcd60e51b8152600401610ae1906162e3565b600260c955611b5f816147b8565b6040516001600160a01b0382169033907fbb39c36a7502b7256e1a687254146a9a2ea7b146c77cb9e40eb0e2b8793781e190600090a350600160c955565b611bb560008051602061653583398151915233612772565b611bd15760405162461bcd60e51b8152600401610ae190616268565b610e588161495d565b60fb5460ff1615611bfd5760405162461bcd60e51b8152600401610ae1906161c5565b611c1560008051602061653583398151915233612772565b611c315760405162461bcd60e51b8152600401610ae190616268565b600260c9541415611c545760405162461bcd60e51b8152600401610ae1906162e3565b600260c955610112546001600160a01b0316611cd15760405162461bcd60e51b815260206004820152603660248201527f436f6d6d756e6974793a3a636f707942656e656669636961726965733a20496e60448201527576616c696420706172656e7420636f6d6d756e69747960501b6064820152608401610ae1565b611acf81614a15565b6097546001600160a01b03163314611d045760405162461bcd60e51b8152600401610ae190616233565b61010854604080516361d027b360e01b815290516000926001600160a01b0316916361d027b3916004808301926020929190829003018186803b158015611d4a57600080fd5b505afa158015611d5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d829190615b32565b61010e54909150600a11611df25760405162461bcd60e51b815260206004820152603160248201527f436f6d6d756e6974793a3a757064617465546f6b656e3a20546f6b656e206c696044820152707374206c656e67746820746f6f2062696760781b6064820152608401610ae1565b611dfa610fad565b6001600160a01b0316896001600160a01b03161415611e935760405162461bcd60e51b815260206004820152604960248201527f436f6d6d756e6974793a3a757064617465546f6b656e3a204e657720746f6b6560448201527f6e2063616e6e6f74206265207468652073616d6520617320746865206375727260648201526832b73a103a37b5b2b760b91b608482015260a401610ae1565b61010860009054906101000a90046001600160a01b03166001600160a01b0316631fccf6726040518163ffffffff1660e01b815260040160206040518083038186803b158015611ee257600080fd5b505afa158015611ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1a9190615b32565b6001600160a01b0316896001600160a01b03161480611fad57506040516319f3736160e01b81526001600160a01b038a811660048301528216906319f373619060240160206040518083038186803b158015611f7557600080fd5b505afa158015611f89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fad9190615e8a565b6120075760405162461bcd60e51b815260206004820152602560248201527f436f6d6d756e6974793a3a757064617465546f6b656e3a20496e76616c6964206044820152643a37b5b2b760d91b6064820152608401610ae1565b61010e546120a15761010e6040518060600160405280612025610fad565b6001600160a01b039081168252670de0b6b3a76400006020808401919091526000604093840181905285546001808201885596825290829020855160039092020180546001600160a01b0319169190931617825583015193810193909355015160029091015561209f612096610fad565b61010f90613dcb565b505b60006120ab611a26565b6120bd87670de0b6b3a7640000616452565b6120c79190616432565b604080516060810182526001600160a01b038d81168252602082018481524393830193845261010e805460018101825560009190915292517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f4805600390940293840180546001600160a01b0319169190931617909155517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480682015590517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480790910155905061219661010f8b613dcb565b5060006121a1610fad565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b1580156121e257600080fd5b505afa1580156121f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221a919061600a565b90508015612470576000836001600160a01b03166338a2e3e26040518163ffffffff1660e01b815260040160206040518083038186803b15801561225d57600080fd5b505afa158015612271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122959190615b32565b6001600160a01b031663735de9f76040518163ffffffff1660e01b815260040160206040518083038186803b1580156122cd57600080fd5b505afa1580156122e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123059190615b32565b905061230f610fad565b60405163095ea7b360e01b81526001600160a01b03838116600483015260248201859052919091169063095ea7b390604401602060405180830381600087803b15801561235b57600080fd5b505af115801561236f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123939190615e8a565b506040805160a06020601f8e018190040282018101909252608081018c81526000928291908f908f9081908501838280828437600092018290525093855250503060208401525060408083018790526060909201819052905163b858183f60e01b8152919250906001600160a01b0384169063b858183f90612419908590600401616377565b602060405180830381600087803b15801561243357600080fd5b505af1158015612447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061246b919061600a565b505050505b61010c546040516001600160a01b03808e169216907f0b1186973f810894b87ab0bfbee422fddcaad21b46dc705a561451bbb6bac11790600090a361010c80546001600160a01b0319166001600160a01b038d161790556124d48888888888611173565b5050505050505050505050565b6001600160a01b03811660009081526101096020526040812060609161250861010f614a65565b67ffffffffffffffff81111561252e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612557578160200160208202803683370190505b509050600061256761010f614a65565b905060005b818110156125e45760048401600061258661010f84614a6f565b6001600160a01b03166001600160a01b03168152602001908152602001600020548382815181106125c757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806125dc816164cb565b91505061256c565b50815161263e57604080516001808252818301909252906020808301908036833701905050915082600201548260008151811061263157634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b509392505050565b6097546001600160a01b031633146126705760405162461bcd60e51b8152600401610ae190616233565b61267a6000614a7b565b565b6000610a5d61010a83614a6f565b6097546001600160a01b031633146126b45760405162461bcd60e51b8152600401610ae190616233565b610107546040516001600160a01b038084169216907f0d6a84e94da4b619dd0d993b5689ec82db4b1095da99ee0f3e7bb046c647e6ad90600090a361010780546001600160a01b0319166001600160a01b0392909216919091179055565b60fb5460ff16156127355760405162461bcd60e51b8152600401610ae1906161c5565b61274d60008051602061653583398151915233612772565b6127695760405162461bcd60e51b8152600401610ae190616268565b610e5881614acd565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60fb5460ff16156127c05760405162461bcd60e51b8152600401610ae1906161c5565b6127cb8383836140ae565b61154f84614b1d565b60006127df82612b3c565b6001600160a01b03831660009081526101096020526040902060030154610a5d919061641a565b606061281361010f614a65565b61287f5760408051600180825281830190925260009160208083019080368337019050509050612841610fad565b8160008151811061286257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152919050565b61104861010f614b6d565b60fb5460ff16156128ad5760405162461bcd60e51b8152600401610ae1906161c5565b6128b88383836140ae565b61154f84614acd565b6001600160a01b03811660009081526101096020526040812090815460ff1660058111156128ff57634e487b7160e01b600052602160045260246000fd5b146129725760405162461bcd60e51b815260206004820152603a60248201527f436f6d6d756e6974793a3a62656e65666963696172794a6f696e46726f6d4d6960448201527f6772617465643a2042656e6566696369617279206578697374730000000000006064820152608401610ae1565b61010754604051630156773960e01b81526001600160a01b038481166004830152600092839283928392169063015677399060240160806040518083038186803b1580156129bf57600080fd5b505afa1580156129d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129f79190615fcc565b9350935093509350612a098585614485565b600185018390556003850181905560028501829055612a2a61010a87613dcb565b506040516001600160a01b038716907f505fe088fef0d1fb451ccfed842b55a86af1ee6208502f4bc3327dcb9032082990600090a2505050505050565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b158015612ab157600080fd5b505afa158015612ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae99190615e8a565b612b055760405162461bcd60e51b8152600401610ae1906161f0565b60fb805460ff1916905560405133907f4e50048c25972c85ad169c2302967f1e633e8dc6108d6aca51a90d2a59d4934d90600090a2565b6001600160a01b0381166000908152610109602052604081206001810154612b675750600092915050565b60fe5460018260010154612b7b9190616471565b612b859190616452565b60fd54612b92919061641a565b9392505050565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b158015612be357600080fd5b505afa158015612bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1b9190615e8a565b612c375760405162461bcd60e51b8152600401610ae1906161f0565b612c4f60008051602061653583398151915282612772565b612cc3576040805162461bcd60e51b81526020600482015260248101919091527f436f6d6d756e6974793a3a72656d6f76654d616e616765723a2054686973206160448201527f63636f756e7420646f65736e27742068617665206d616e6167657220726f6c656064820152608401610ae1565b610108546001600160a01b0382811691161415612d565760405162461bcd60e51b8152602060048201526044602482018190527f436f6d6d756e6974793a3a72656d6f76654d616e616765723a20596f75206172908201527f65206e6f7420616c6c6f7720746f2072656d6f766520636f6d6d756e697479416064820152633236b4b760e11b608482015260a401610ae1565b612d6e60008051602061653583398151915282614047565b6040516001600160a01b0382169033907f3e902a6ee93dd5b2d48bd1009c7701a481be512b1ef73dbed2f95ea44c59ea8890600090a350565b60fb5460ff1615612dca5760405162461bcd60e51b8152600401610ae1906161c5565b612de260008051602061653583398151915233612772565b612dfe5760405162461bcd60e51b8152600401610ae190616268565b61267a614334565b6097546001600160a01b03163314612e305760405162461bcd60e51b8152600401610ae190616233565b806101016000828254612e43919061641a565b909155505050565b6097546001600160a01b03163314612e755760405162461bcd60e51b8152600401610ae190616233565b600260c9541415612e985760405162461bcd60e51b8152600401610ae1906162e3565b600260c955612eb16001600160a01b0384168383614400565b612eb9610fad565b6001600160a01b0316836001600160a01b03161415612eda57612eda613de0565b816001600160a01b0316836001600160a01b03167f9b035625e569d1d2bf54830a290aefba7ab11610ba8490871dc62b86b63a895683604051612f1f91815260200190565b60405180910390a35050600160c95550565b60fb5460ff1615612f545760405162461bcd60e51b8152600401610ae1906161c5565b612f6c60008051602061653583398151915233612772565b612f885760405162461bcd60e51b8152600401610ae190616268565b610e5881614b7a565b612fa960008051602061653583398151915233612772565b612fc55760405162461bcd60e51b8152600401610ae190616268565b610e58816142e4565b60fb5460ff1615612ff15760405162461bcd60e51b8152600401610ae1906161c5565b61300960008051602061653583398151915233612772565b6130255760405162461bcd60e51b8152600401610ae190616268565b610e5881614b1d565b60fb5460ff16156130515760405162461bcd60e51b8152600401610ae1906161c5565b61306960008051602061653583398151915233612772565b6130855760405162461bcd60e51b8152600401610ae190616268565b610e5881614c04565b6097546001600160a01b031633146130b85760405162461bcd60e51b8152600401610ae190616233565b610108546040516001600160a01b038084169216907fdd8d3b7b0badfc5d636d48e71e28015b4b8554b64d2cffba6f0a90bf7693ec0090600090a361010880546001600160a01b0319166001600160a01b038316908117909155610e5890613a07565b60405162461bcd60e51b815260206004820152603b60248201527f436f6d6d756e6974793a3a7265766f6b65526f6c653a20596f7520617265206e60448201527f6f7420616c6c6f7720746f207573652074686973206d6574686f6400000000006064820152608401610ae1565b60fb5460ff16156131ac5760405162461bcd60e51b8152600401610ae1906161c5565b600260c95414156131cf5760405162461bcd60e51b8152600401610ae1906162e3565b600260c9556131df8383836140ae565b6131e884614701565b5050600160c9555050565b600260c95414156132165760405162461bcd60e51b8152600401610ae1906162e3565b600260c95561323a823083613229610fad565b6001600160a01b0316929190614c8e565b80610102600082825461324d919061641a565b9091555061325b9050613de0565b60405181815233907f0553260a2e46b0577270d8992db02d30856ca880144c72d6e9503760946aef139060200160405180910390a25050600160c955565b600061104861010a614a65565b6097546001600160a01b031633146132d05760405162461bcd60e51b8152600401610ae190616233565b61011280546001600160a01b0319166001600160a01b0383169081179091556040805163f92b6c0160e01b815290516000928392909163f92b6c0191600480820192602092909190829003018186803b15801561332c57600080fd5b505afa158015613340573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613364919061600a565b61010e54600093509091505b808310156133da5761010e80548061339857634e487b7160e01b600052603160045260246000fd5b60008281526020812060036000199093019283020180546001600160a01b031916815560018101829055600201559055826133d2816164cb565b935050613370565b60008060008095505b848610156135425761011254604051632a62b44f60e11b8152600481018890526001600160a01b03909116906354c5689e9060240160606040518083038186803b15801561343057600080fd5b505afa158015613444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134689190615c91565b604080516060810182526001600160a01b0385811682526020820185815292820184815261010e805460018101825560009190915292517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f4805600390940293840180546001600160a01b031916919093161790915591517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480682015590517f44731785622d53a842eeb261a70df6f2b61b9624656157b6168597f0656f480790910155919450925090508561353a816164cb565b9650506133e3565b600061354f61010f614a65565b90505b80156135825761357161356861010f6000614a6f565b61010f90614cc6565b5061357b816164b4565b9050613552565b6101125460408051634f162c6560e11b815290516000926001600160a01b031691639e2c58ca9160048083019286929190829003018186803b1580156135c757600080fd5b505afa1580156135db573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136039190810190615cfa565b8051600099509091505b8089101561366457613651828a8151811061363857634e487b7160e01b600052603260045260246000fd5b602002602001015161010f613dcb90919063ffffffff16565b508861365c816164cb565b99505061360d565b50505050505050505050565b6097546001600160a01b0316331461369a5760405162461bcd60e51b8152600401610ae190616233565b6001600160a01b0381166136ff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ae1565b610e5881614a7b565b6060611048610113614b6d565b61010854604051636b0de23f60e01b81523060048201523360248201526001600160a01b0390911690636b0de23f9060440160206040518083038186803b15801561375f57600080fd5b505afa158015613773573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137979190615e8a565b6137b35760405162461bcd60e51b8152600401610ae1906161f0565b60fb805460ff1916600117905560405133907fe1e6bc10311f2f958d6cd2d0ab7308c32089aa1acb8ab11a2ccb60028e332bd090600090a2565b61010e5460009060028110156138095750506002820154610a5d565b6002840154600061381b600184616471565b90505b856003015461010e828154811061384557634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016002015411156139045761010e818154811061387f57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016002015485101561389d576138f2565b670de0b6b3a764000061010e82815481106138c857634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160010154836138e59190616452565b6138ef9190616432565b91505b806138fc816164b4565b91505061381e565b50949350505050565b600054610100900460ff166139345760405162461bcd60e51b8152600401610ae190616298565b61393c614cdb565b613944614cdb565b61267a614cdb565b600054610100900460ff166139735760405162461bcd60e51b8152600401610ae190616298565b61397b614cdb565b61267a614d02565b600054610100900460ff166139aa5760405162461bcd60e51b8152600401610ae190616298565b61267a614d32565b600082815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b610e918282614d60565b613a1f60008051602061653583398151915282612772565b610e5857613a3b60008051602061653583398151915282614d60565b6040516001600160a01b0382169033907f05a4006f300442cf8b7fdb885f5ee958812020bffb5c5a8e655fde64e5f987ed90600090a350565b806001600160a01b0316826001600160a01b03161415613b0a5760405162461bcd60e51b8152602060048201526044602482018190527f436f6d6d756e6974793a3a6368616e676542656e656669636961727941646472908201527f6573733a2042656e65666963696172696573206d7573742062652064696666656064820152631c995b9d60e21b608482015260a401610ae1565b6001600160a01b0380831660009081526101096020526040808220928416825290206004825460ff166005811115613b5257634e487b7160e01b600052602160045260246000fd5b14158015613b8457506000825460ff166005811115613b8157634e487b7160e01b600052602160045260246000fd5b14155b613ba05760405162461bcd60e51b8152600401610ae19061631a565b6004815460ff166005811115613bc657634e487b7160e01b600052602160045260246000fd5b1415613c3a5760405162461bcd60e51b815260206004820152603f60248201527f436f6d6d756e6974793a3a6368616e676542656e65666963696172794164647260448201527f6573733a20496e76616c6964207461726765742062656e6566696369617279006064820152608401610ae1565b6000815460ff166005811115613c6057634e487b7160e01b600052602160045260246000fd5b1415613c76578154613c7690829060ff16614485565b613c81826004614485565b8160010154816001016000828254613c99919061641a565b9091555050600380830154908201541115613cda57613cbc8282600301546137ed565b816002016000828254613ccf919061641a565b90915550613d079050565b613ce88183600301546137ed565b8260020154613cf7919061641a565b6002820155600380830154908201555b6000613d1461010f614a65565b90506000805b82811015613d8257613d2e61010f82614a6f565b6001600160a01b038116600090815260048088016020908152604080842054928901909152822080549395509092909190613d6a90849061641a565b90915550819050613d7a816164cb565b915050613d1a565b50846001600160a01b0316866001600160a01b03167fb53b7057ddbff0cd9111b0a1a501a9cc1a9c315eb3396cb0d47917908325999a60405160405180910390a3505050505050565b6000612b92836001600160a01b038416614de6565b60008061010860009054906101000a90046001600160a01b03166001600160a01b0316636b68b2ef6040518163ffffffff1660e01b815260040160206040518083038186803b158015613e3257600080fd5b505afa158015613e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e6a919061600a565b9050600061010860009054906101000a90046001600160a01b03166001600160a01b031663afae65be6040518163ffffffff1660e01b815260040160206040518083038186803b158015613ebd57600080fd5b505afa158015613ed1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ef5919061600a565b90506101005460001480613f0a575061010554155b80613f155750808211155b15613f245760fc549250613ff4565b61010054613f30610fad565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b158015613f7157600080fd5b505afa158015613f85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fa9919061600a565b613fb39190616432565b92506000828260fc54613fc69190616452565b613fd09190616432565b905080841015613fe257809350613ff2565b60fc54841115613ff25760fc5493505b505b610111548314614042576101115460408051918252602082018590527fc22e16deec6f587d0a1aad7275c1621e6c24431fea14dd71e8f3243e9fbc5ca3910160405180910390a16101118390555b505050565b6140518282612772565b15610e915760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61010860009054906101000a90046001600160a01b03166001600160a01b031663af2d77f86040518163ffffffff1660e01b815260040160206040518083038186803b1580156140fd57600080fd5b505afa158015614111573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141359190615b32565b6001600160a01b0316336001600160a01b0316146141aa5760405162461bcd60e51b815260206004820152602c60248201527f436f6d6d756e6974793a2053656e646572206d7573742062652074686520626160448201526b18dad95b99081dd85b1b195d60a21b6064820152608401610ae1565b428310156141fa5760405162461bcd60e51b815260206004820152601c60248201527f436f6d6d756e6974793a205369676e617475726520746f6f206f6c64000000006044820152606401610ae1565b60408051336020820152309181019190915260608101849052600090608001604051602081830303815290604052805190602001209050600061427e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506142789250869150614e359050565b90614e88565b905061429860008051602061653583398151915282612772565b6113805760405162461bcd60e51b815260206004820152601c60248201527f436f6d6d756e6974793a20496e76616c6964207369676e6174757265000000006044820152606401610ae1565b80516000905b808210156140425761432283838151811061431557634e487b7160e01b600052603260045260246000fd5b602002602001015161495d565b8161432c816164cb565b9250506142ea565b6101055461433e57565b610108546040805163174a71d760e01b815290516000926001600160a01b03169163174a71d791600480830192602092919082900301818787803b15801561438557600080fd5b505af1158015614399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143bd919061600a565b90508015610e585743610106556143d2613de0565b60405133907f16a8b794d4e2ed6ffef50d78af3d4372ce4bfe8a399bfc23f59b7832ee47539090600090a250565b6040516001600160a01b03831660248201526044810182905261404290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614ea4565b6001600160a01b03811660009081526001830160205260408120541515612b92565b8060058111156144a557634e487b7160e01b600052602160045260246000fd5b825460ff1660058111156144c957634e487b7160e01b600052602160045260246000fd5b14156144d3575050565b60018160058111156144f557634e487b7160e01b600052602160045260246000fd5b141561466f5760fc546101035460ff5461450f9190616471565b101561457b5760405162461bcd60e51b815260206004820152603560248201527f436f6d6d756e6974793a3a5f6368616e676542656e656669636961727953746160448201527474653a204d617820636c61696d20746f6f206c6f7760581b6064820152608401610ae1565b61010d541580614590575061010d5461010054105b6146395760405162461bcd60e51b815260206004820152606860248201527f436f6d6d756e6974793a3a5f6368616e676542656e656669636961727953746160448201527f74653a205468697320636f6d6d756e697479206861732072656163686564207460648201527f6865206d6178696d756d206e756d626572206f662076616c69642062656e6566608482015267696369617269657360c01b60a482015260c401610ae1565b610100805490600061464a836164cb565b91905055506101035460ff60008282546146649190616471565b909155506146cc9050565b6001825460ff16600581111561469557634e487b7160e01b600052602160045260246000fd5b14156146cc5761010080549060006146ac836164b4565b91905055506101035460ff60008282546146c6919061641a565b90915550505b81548190839060ff191660018360058111156146f857634e487b7160e01b600052602160045260246000fd5b02179055505050565b80516000905b808210156140425761473f83838151811061473257634e487b7160e01b600052603260045260246000fd5b60200260200101516147b8565b82828151811061475f57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316336001600160a01b03167fbb39c36a7502b7256e1a687254146a9a2ea7b146c77cb9e40eb0e2b8793781e160405160405180910390a3816147b0816164cb565b925050614707565b6001600160a01b03811660009081526101096020526040812090815460ff1660058111156147f657634e487b7160e01b600052602160045260246000fd5b146147ff575050565b610112546001600160a01b03161561492b5761011254604051630156773960e01b81526001600160a01b038481166004830152600092169063015677399060240160806040518083038186803b15801561485857600080fd5b505afa15801561486c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148909190615fcc565b509192506000915061489f9050565b8160058111156148bf57634e487b7160e01b600052602160045260246000fd5b146149295760405162461bcd60e51b815260206004820152603460248201527f436f6d6d756e6974793a3a61646442656e65666963696172793a20496e76616c60448201527369642062656e656669636961727920737461746560601b6064820152608401610ae1565b505b614936816001614485565b43600382015561494861010a83613dcb565b50610e9182662386f26fc10000611880610fad565b6001600160a01b0381166000908152610109602052604090206001815460ff16600581111561499c57634e487b7160e01b600052602160045260246000fd5b14806149cb57506002815460ff1660058111156149c957634e487b7160e01b600052602160045260246000fd5b145b15610e91576149db816003614485565b6040516001600160a01b0383169033907f1a6590bd0cabbfcc7c86bef99e1034054e179905cfcc294598fcd426c092244290600090a35050565b80516000905b8082101561404257614a53838381518110614a4657634e487b7160e01b600052603260045260246000fd5b6020026020010151614f76565b81614a5d816164cb565b925050614a1b565b6000610a5d825490565b6000612b9283836153a8565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516000905b8082101561404257614b0b838381518110614afe57634e487b7160e01b600052603260045260246000fd5b6020026020010151614b7a565b81614b15816164cb565b925050614ad3565b80516000905b8082101561404257614b5b838381518110614b4e57634e487b7160e01b600052603260045260246000fd5b6020026020010151614c04565b81614b65816164cb565b925050614b23565b60606000612b92836153e0565b6001600160a01b0381166000908152610109602052604090206001815460ff166005811115614bb957634e487b7160e01b600052602160045260246000fd5b1415610e9157614bca816002614485565b6040516001600160a01b0383169033907f2b9ef93c7856b47a1b624fa3fcc4b651d388dd6d16327f3ad22b05f3da8b0f1590600090a35050565b6001600160a01b0381166000908152610109602052604090206002815460ff166005811115614c4357634e487b7160e01b600052602160045260246000fd5b1415610e9157614c54816001614485565b6040516001600160a01b0383169033907fa589fb4f2925123e7a030dd6bbe76be46a03f8ce0ea53a78dbb3383c7797db2c90600090a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261154f9085906323b872dd60e01b9060840161442c565b6000612b92836001600160a01b03841661543c565b600054610100900460ff1661267a5760405162461bcd60e51b8152600401610ae190616298565b600054610100900460ff16614d295760405162461bcd60e51b8152600401610ae190616298565b61267a33614a7b565b600054610100900460ff16614d595760405162461bcd60e51b8152600401610ae190616298565b600160c955565b614d6a8282612772565b610e915760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055614da23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054614e2d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a5d565b506000610a5d565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000614e978585615559565b9150915061263e816155c9565b6000614ef9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166157ca9092919063ffffffff16565b8051909150156140425780806020019051810190614f179190615e8a565b6140425760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ae1565b6001600160a01b03811660009081526101096020526040812090815460ff166005811115614fb457634e487b7160e01b600052602160045260246000fd5b14614fbd575050565b61011254604051630156773960e01b81526001600160a01b038481166004830152600092839283928392169063015677399060240160806040518083038186803b15801561500a57600080fd5b505afa15801561501e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150429190615fcc565b92965090945092509050600584600581111561506e57634e487b7160e01b600052602160045260246000fd5b14156150db5760405162461bcd60e51b815260206004820152603660248201527f436f6d6d756e6974793a3a636f707942656e65666963696172793a2042656e65604482015275199a58da585c9e48185b1c9958591e4818dbdc1a595960521b6064820152608401610ae1565b6150e58585614485565b60018501839055600285018290556003850181905561011254604051636b31f2ad60e01b81526001600160a01b0388811660048301526000921690636b31f2ad9060240160006040518083038186803b15801561514157600080fd5b505afa158015615155573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261517d9190810190615e03565b9050600061011260009054906101000a90046001600160a01b03166001600160a01b0316639e2c58ca6040518163ffffffff1660e01b815260040160006040518083038186803b1580156151d057600080fd5b505afa1580156151e4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261520c9190810190615cfa565b825190915060005b818110156152ea5761525883828151811061523f57634e487b7160e01b600052603260045260246000fd5b602002602001015161010f61446390919063ffffffff16565b156152d85783818151811061527d57634e487b7160e01b600052603260045260246000fd5b60200260200101518960040160008584815181106152ab57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055505b806152e2816164cb565b915050615214565b506101125460405163572b9e7b60e01b81526001600160a01b039091169063572b9e7b9061531f908c906005906004016160e7565b600060405180830381600087803b15801561533957600080fd5b505af115801561534d573d6000803e3d6000fd5b505050506153668961010a613dcb90919063ffffffff16565b506040516001600160a01b038a169033907f7b385acd6ce016fe5a2ca902550e21b2c49056139ce3e7517e4c63ecd535b71490600090a3505050505050505050565b60008260000182815481106153cd57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60608160000180548060200260200160405190810160405280929190818152602001828054801561543057602002820191906000526020600020905b81548152602001906001019080831161541c575b50505050509050919050565b6000818152600183016020526040812054801561554f576000615460600183616471565b855490915060009061547490600190616471565b90508181146154f55760008660000182815481106154a257634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050808760000184815481106154d357634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061551457634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a5d565b6000915050610a5d565b6000808251604114156155905760208301516040840151606085015160001a615584878285856157e1565b945094505050506155c2565b8251604014156155ba57602083015160408401516155af8683836158ce565b9350935050506155c2565b506000905060025b9250929050565b60008160048111156155eb57634e487b7160e01b600052602160045260246000fd5b14156155f45750565b600181600481111561561657634e487b7160e01b600052602160045260246000fd5b14156156645760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610ae1565b600281600481111561568657634e487b7160e01b600052602160045260246000fd5b14156156d45760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ae1565b60038160048111156156f657634e487b7160e01b600052602160045260246000fd5b141561574f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ae1565b600481600481111561577157634e487b7160e01b600052602160045260246000fd5b1415610e585760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610ae1565b60606157d984846000856158fd565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561581857506000905060036158c5565b8460ff16601b1415801561583057508460ff16601c14155b1561584157506000905060046158c5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015615895573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166158be576000600192509250506158c5565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b016158ef878288856157e1565b935093505050935093915050565b60608247101561595e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ae1565b843b6159ac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ae1565b600080866001600160a01b031685876040516159c891906160cb565b60006040518083038185875af1925050503d8060008114615a05576040519150601f19603f3d011682016040523d82523d6000602084013e615a0a565b606091505b5091509150615a1a828286615a25565b979650505050505050565b60608315615a34575081612b92565b825115615a445782518084602001fd5b8160405162461bcd60e51b8152600401610ae191906161b2565b600082601f830112615a6e578081fd5b81356020615a83615a7e836163f6565b6163c5565b80838252828201915082860187848660051b8901011115615aa2578586fd5b855b85811015615ac9578135615ab781616512565b84529284019290840190600101615aa4565b5090979650505050505050565b60008083601f840112615ae7578182fd5b50813567ffffffffffffffff811115615afe578182fd5b6020830191508360208285010111156155c257600080fd5b600060208284031215615b27578081fd5b8135612b9281616512565b600060208284031215615b43578081fd5b8151612b9281616512565b60008060408385031215615b60578081fd5b8235615b6b81616512565b91506020830135615b7b81616512565b809150509250929050565b60008060008060008060008060008060006101608c8e031215615ba7578687fd5b8b35615bb281616512565b9a5060208c013567ffffffffffffffff811115615bcd578788fd5b615bd98e828f01615a5e565b9a505060408c0135985060608c0135975060808c0135965060a08c0135955060c08c0135945060e08c013593506101008c013592506101208c013591506101408c0135615c2581616512565b809150509295989b509295989b9093969950565b60008060408385031215615c4b578182fd5b8235615c5681616512565b91506020830135615b7b81616527565b60008060408385031215615c78578182fd5b8235615c8381616512565b946020939093013593505050565b600080600060608486031215615ca5578081fd5b8351615cb081616512565b602085015160409095015190969495509392505050565b600060208284031215615cd8578081fd5b813567ffffffffffffffff811115615cee578182fd5b6157d984828501615a5e565b60006020808385031215615d0c578182fd5b825167ffffffffffffffff811115615d22578283fd5b8301601f81018513615d32578283fd5b8051615d40615a7e826163f6565b80828252848201915084840188868560051b8701011115615d5f578687fd5b8694505b83851015615d8a578051615d7681616512565b835260019490940193918501918501615d63565b50979650505050505050565b60008060008060608587031215615dab578182fd5b843567ffffffffffffffff80821115615dc2578384fd5b615dce88838901615a5e565b9550602087013594506040870135915080821115615dea578384fd5b50615df787828801615ad6565b95989497509550505050565b60006020808385031215615e15578182fd5b825167ffffffffffffffff811115615e2b578283fd5b8301601f81018513615e3b578283fd5b8051615e49615a7e826163f6565b80828252848201915084840188868560051b8701011115615e68578687fd5b8694505b83851015615d8a578051835260019490940193918501918501615e6c565b600060208284031215615e9b578081fd5b81518015158114612b92578182fd5b600060208284031215615ebb578081fd5b5035919050565b60008060408385031215615ed4578182fd5b823591506020830135615b7b81616512565b600060208284031215615ef7578081fd5b81356001600160e01b031981168114612b92578182fd5b600080600060608486031215615f22578081fd5b8335615f2d81616512565b92506020840135615f3d81616512565b929592945050506040919091013590565b60008060008060008060008060e0898b031215615f69578182fd5b8835615f7481616512565b9750602089013567ffffffffffffffff811115615f8f578283fd5b615f9b8b828c01615ad6565b999c909b509899604081013599606082013599506080820135985060a0820135975060c09091013595509350505050565b60008060008060808587031215615fe1578182fd5b8451615fec81616527565b60208601516040870151606090970151919890975090945092505050565b60006020828403121561601b578081fd5b5051919050565b60008060408385031215616034578182fd5b50508035926020909101359150565b600080600080600060a0868803121561605a578283fd5b505083359560208501359550604085013594606081013594506080013592509050565b60008151808452616095816020860160208601616488565b601f01601f19169290920160200192915050565b600681106160c757634e487b7160e01b600052602160045260246000fd5b9052565b600082516160dd818460208701616488565b9190910192915050565b6001600160a01b038316815260408101612b9260208301846160a9565b6020808252825182820181905260009190848201906040850190845b818110156161455783516001600160a01b031683529284019291840191600101616120565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156161455783518352928401929184019160010161616d565b6080810161619782876160a9565b84602083015283604083015282606083015295945050505050565b602081526000612b92602083018461607d565b60208082526011908201527010dbdb5b5d5b9a5d1e4e881b1bd8dad959607a1b604082015260600190565b60208082526023908201527f436f6d6d756e6974793a204e4f545f414d4241535341444f525f4f525f454e5460408201526249545960e81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526016908201527521b7b6b6bab734ba3c9d102727aa2fa6a0a720a3a2a960511b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526038908201527f436f6d6d756e6974793a3a6368616e676542656e65666963696172794164647260408201527f6573733a20496e76616c69642062656e65666963696172790000000000000000606082015260800190565b60208152600082516080602084015261639360a084018261607d565b905060018060a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b604051601f8201601f1916810167ffffffffffffffff811182821017156163ee576163ee6164fc565b604052919050565b600067ffffffffffffffff821115616410576164106164fc565b5060051b60200190565b6000821982111561642d5761642d6164e6565b500190565b60008261644d57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561646c5761646c6164e6565b500290565b600082821015616483576164836164e6565b500390565b60005b838110156164a357818101518382015260200161648b565b8381111561154f5750506000910152565b6000816164c3576164c36164e6565b506000190190565b60006000198214156164df576164df6164e6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e5857600080fd5b60068110610e5857600080fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220ccd087a0670dfd7aa186e7553292c6c5bfe7cb168c3948d7551c1b08b3efe81e64736f6c63430008040033