Address Details
contract

0x9E89B5A2433Bc35d2E0E4848417A242dbD47929F

Contract Name
Manager
Creator
0x5bc1c4–68a788 at 0x87b3c7–fef559
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
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
15097805
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
Manager




Optimization enabled
false
Compiler version
v0.8.11+commit.d7f03943




EVM Version
istanbul




Verified at
2022-09-30T11:36:24.713446Z

contracts/Manager.sol

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

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

import "./common/UsingRegistryUpgradeable.sol";
import "./common/UUPSOwnableUpgradeable.sol";
import "./interfaces/IAccount.sol";
import "./interfaces/IStakedCelo.sol";

/**
 * @title Manages the StakedCelo system, by controlling the minting and burning
 * of stCELO and implementing strategies for voting and unvoting of deposited or
 * withdrawn CELO.
 */
contract Manager is UUPSOwnableUpgradeable, UsingRegistryUpgradeable {
    using EnumerableSet for EnumerableSet.AddressSet;

    /**
     * @notice Holds a group's address and votes.
     * @param group The address of the group.
     * @param votes The votes assigned to the group.
     */
    struct GroupWithVotes {
        address group;
        uint256 votes;
    }

    /**
     * @notice An instance of the StakedCelo contract this Manager manages.
     */
    IStakedCelo internal stakedCelo;

    /**
     * @notice An instance of the Account contract this Manager manages.
     */
    IAccount internal account;

    /**
     * @notice The set of currently active groups that will be voted for with
     * new deposits.
     */
    EnumerableSet.AddressSet private activeGroups;

    /**
     * @notice The set of deprecated groups. These are groups that should no
     * longer receive new votes from deposits, but still need to be kept track
     * of because the Account contract is still voting for them.
     */
    EnumerableSet.AddressSet private deprecatedGroups;

    /**
     * @notice Emitted when a new group is activated for voting.
     * @param group The group's address.
     */
    event GroupActivated(address indexed group);
    /**
     * @notice Emitted when a group is deprecated.
     * @param group The group's address.
     */
    event GroupDeprecated(address indexed group);
    /**
     * @notice Emitted when a deprecated group is no longer being voted for and
     * the contract forgets about it entirely.
     * @param group The group's address.
     */
    event GroupRemoved(address indexed group);

    /**
     * @notice Used when attempting to activate a group that is already active.
     * @param group The group's address.
     */
    error GroupAlreadyAdded(address group);

    /**
     * @notice Used when attempting to deprecate a group that is not active.
     * @param group The group's address.
     */
    error GroupNotActive(address group);

    /**
     * @notice Used when an attempt to add an active group to the EnumerableSet
     * fails.
     * @param group The group's address.
     */
    error FailedToAddActiveGroup(address group);

    /**
     * @notice Used when an attempt to add a deprecated group to the
     * EnumerableSet fails.
     * @param group The group's address.
     */
    error FailedToAddDeprecatedGroup(address group);

    /**
     * @notice Used when an attempt to remove a deprecated group from the
     * EnumerableSet fails.
     * @param group The group's address.
     */
    error FailedToRemoveDeprecatedGroup(address group);

    /**
     * @notice Used when attempting to activate a group when the maximum number
     * of groups voted (as allowed by the Election contract) is already being
     * voted for.
     */
    error MaxGroupsVotedForReached();

    /**
     * @notice Used when attempting to deposit when there are not active groups
     * to vote for.
     */
    error NoActiveGroups();

    /**
     * @notice Used when attempting to deposit when the total deposit amount
     * would tip each active group over the voting limit as defined in
     * Election.sol.
     */
    error NoVotableGroups();

    /**
     * @notice Used when attempting to withdraw but there are no groups being
     * voted for.
     */
    error NoGroups();

    /**
     * @notice Used when attempting to withdraw 0 value.
     */
    error ZeroWithdrawal();

    /**
     * @notice Empty constructor for proxy implementation, `initializer` modifer ensures the
     * implementation gets initialized.
     */
    // solhint-disable-next-line no-empty-blocks
    constructor() initializer {}

    /**
     * @notice Initialize the contract with registry and owner.
     * @param _registry The address of the Celo registry.
     * @param _owner The address of the contract owner.
     */
    function initialize(address _registry, address _owner) external initializer {
        _transferOwnership(_owner);
        __UsingRegistry_init(_registry);
    }

    /**
     * @notice Set this contract's dependencies in the StakedCelo system.
     * @dev Manager, Account and StakedCelo all reference each other
     * so we need a way of setting these after all contracts are
     * deployed and initialized.
     * @param _stakedCelo the address of the StakedCelo contract.
     * @param _account The address of the Account contract.
     */
    function setDependencies(address _stakedCelo, address _account) external onlyOwner {
        stakedCelo = IStakedCelo(_stakedCelo);
        account = IAccount(_account);
    }

    /**
     * @notice Marks a group as votable.
     * @param group The address of the group to add to the set of votable
     * groups.
     * @dev Fails if the maximum number of groups are already being voted for by
     * the Account smart contract (as per the `maxNumGroupsVotedFor` in the
     * Election contract).
     */
    function activateGroup(address group) external onlyOwner {
        if (activeGroups.contains(group)) {
            revert GroupAlreadyAdded(group);
        }

        if (deprecatedGroups.contains(group)) {
            if (!deprecatedGroups.remove(group)) {
                revert FailedToRemoveDeprecatedGroup(group);
            }
        }

        if (
            activeGroups.length() + deprecatedGroups.length() >=
            getElection().maxNumGroupsVotedFor()
        ) {
            revert MaxGroupsVotedForReached();
        }

        if (!activeGroups.add(group)) {
            revert FailedToAddActiveGroup(group);
        }
        emit GroupActivated(group);
    }

    /**
     * @notice Returns the array of active groups.
     * @return The array of active groups.
     */
    function getGroups() external view returns (address[] memory) {
        return activeGroups.values();
    }

    /**
     * @notice Marks a group as deprecated.
     * @param group The group to deprecate.
     * @dev A deprecated group will remain in the `deprecatedGroups` array as
     * long as it is still being voted for by the Account contract. Deprecated
     * groups will be the first to have their votes withdrawn.
     */
    function deprecateGroup(address group) external onlyOwner {
        if (!activeGroups.remove(group)) {
            revert GroupNotActive(group);
        }

        emit GroupDeprecated(group);

        if (account.getCeloForGroup(group) > 0) {
            if (!deprecatedGroups.add(group)) {
                revert FailedToAddDeprecatedGroup(group);
            }
        } else {
            emit GroupRemoved(group);
        }
    }

    /**
     * @notice Returns the list of deprecated groups.
     * @return The list of deprecated groups.
     */
    function getDeprecatedGroups() external view returns (address[] memory) {
        return deprecatedGroups.values();
    }

    /**
     * @notice Used to deposit CELO into the StakedCelo system. The user will
     * receive an amount of stCELO proportional to their contribution. The CELO
     * will be scheduled to be voted for with the Account contract.
     */
    function deposit() external payable {
        if (activeGroups.length() == 0) {
            revert NoActiveGroups();
        }

        stakedCelo.mint(msg.sender, toStakedCelo(msg.value));

        distributeVotes(msg.value);
    }

    /**
     * @notice Used to withdraw CELO from the system, in exchange for burning
     * stCELO.
     * @param stakedCeloAmount The amount of stCELO to burn.
     * @dev Calculates the CELO amount based on the ratio of outstanding stCELO
     * and the total amount of CELO owned and used for voting by Account. See
     * `toCelo`.
     * @dev The funds need to be withdrawn using calls to `Account.withdraw` and
     * `Account.finishPendingWithdrawal`.
     */
    function withdraw(uint256 stakedCeloAmount) external {
        if (activeGroups.length() + deprecatedGroups.length() == 0) {
            revert NoGroups();
        }

        distributeWithdrawals(toCelo(stakedCeloAmount), msg.sender);

        stakedCelo.burn(msg.sender, stakedCeloAmount);
    }

    /**
     * @notice Computes the amount of stCELO that should be minted for a given
     * amount of CELO deposited.
     * @param celoAmount The amount of CELO deposited.
     * @return The amount of stCELO that should be minted.
     */
    function toStakedCelo(uint256 celoAmount) public view returns (uint256) {
        uint256 stCeloSupply = stakedCelo.totalSupply();
        uint256 celoBalance = account.getTotalCelo();

        if (stCeloSupply == 0 || celoBalance == 0) {
            return celoAmount;
        }

        return (celoAmount * stCeloSupply) / celoBalance;
    }

    /**
     * @notice Computes the amount of CELO that should be withdrawn for a given
     * amount of stCELO burned.
     * @param stCeloAmount The amount of stCELO burned.
     * @return The amount of CELO that should be withdrawn.
     */
    function toCelo(uint256 stCeloAmount) public view returns (uint256) {
        uint256 stCeloSupply = stakedCelo.totalSupply();
        uint256 celoBalance = account.getTotalCelo();

        if (stCeloSupply == 0 || celoBalance == 0) {
            return stCeloAmount;
        }

        return (stCeloAmount * celoBalance) / stCeloSupply;
    }

    /**
     * @notice Distributes votes by computing the number of votes each active
     * group should receive, then calling out to `Account.scheduleVotes`.
     * @param votes The amount of votes to distribute.
     * @dev The vote distribution strategy is to try and have each validator
     * group to be receiving the same amount of votes from the system. If a
     * group already has more votes than the average of the total available
     * votes it will not be voted for, and instead we'll try to evenly
     * distribute between the remaining groups.
     * @dev Election.sol sets a dynamic limit on the number of votes receivable
     * by a group, based on the group's size, the total amount of Locked
     * CELO, and the total number of electable validators. We don't want to
     * schedule votes for a group when the amount would exceed this threshold.
     * `getVotableGroups` below selects those groups that could receive the
     * entire `votes` amount, and filters out the rest. This is a heuristic:
     * when distributing votes evenly, the group might receive less than
     * `votes`, and the total amount could end up being under the limit.
     * However, doing an exact computation would be both complex and cost a lot
     * of additional gas, hence the heuristic. If indeed all groups are close to
     * their voting limit, causing a larger deposit to revert with
     * NoVotableGroups, despite there still being some room for deposits, this
     * can be worked around by sending a few smaller deposits.
     */
    function distributeVotes(uint256 votes) internal {
        /*
         * "Votable" groups are those that will currently fit under the voting
         * limit in Election.sol even if voted for with the entire `votes`
         * amount. Note that some might still not end up getting voted for given
         * the distribution logic below.
         */
        address[] memory votableGroups = getVotableGroups(votes);
        if (votableGroups.length == 0) {
            revert NoVotableGroups();
        }

        GroupWithVotes[] memory sortedGroups;
        uint256 availableVotes;
        (sortedGroups, availableVotes) = getSortedGroupsWithVotes(votableGroups);
        availableVotes += votes;

        uint256[] memory votesPerGroup = new uint256[](votableGroups.length);
        uint256 groupsVoted = votableGroups.length;
        uint256 targetVotes = availableVotes / groupsVoted;

        /*
         * This would normally be (i = votableGroups.length - 1; i >=0; i--),
         * but we can't i-- on the last iteration when i=0, since i is an
         * unsigned integer. So we iterate with the loop variable 1 greater than
         * expected, set index = i-1, and use index inside the loop.
         */
        for (uint256 i = votableGroups.length; i > 0; i--) {
            uint256 index = i - 1;
            if (sortedGroups[index].votes >= targetVotes) {
                groupsVoted--;
                availableVotes -= sortedGroups[index].votes;
                targetVotes = availableVotes / groupsVoted;
                votesPerGroup[index] = 0;
            } else {
                votesPerGroup[index] = targetVotes - sortedGroups[index].votes;

                if (availableVotes % groupsVoted > index) {
                    votesPerGroup[index]++;
                }
            }
        }

        address[] memory finalGroups = new address[](groupsVoted);
        uint256[] memory finalVotes = new uint256[](groupsVoted);

        for (uint256 i = 0; i < groupsVoted; i++) {
            finalGroups[i] = sortedGroups[i].group;
            finalVotes[i] = votesPerGroup[i];
        }

        account.scheduleVotes{value: votes}(finalGroups, finalVotes);
    }

    /**
     * @notice Distributes withdrawals by computing the number of votes that
     * should be withdrawn from each group, then calling out to
     * `Account.scheduleVotes`.
     * @param withdrawal The amount of votes to withdraw.
     * @param beneficiary The address that should end up receiving the withdrawn
     * CELO.
     * @dev The withdrawal distribution strategy is to:
     * 1. Withdraw as much as possible from any deprecated groups.
     * 2. If more votes still need to be withdrawn, try and have each validator
     * group end up receiving the same amount of votes from the system. If a
     * group already has less votes than the average of the total remaining
     * votes, it will not be withdrawn from, and instead we'll try to evenly
     * distribute between the remaining groups.
     */
    function distributeWithdrawals(uint256 withdrawal, address beneficiary) internal {
        if (withdrawal == 0) {
            revert ZeroWithdrawal();
        }

        address[] memory deprecatedGroupsWithdrawn;
        uint256[] memory deprecatedWithdrawalsPerGroup;
        uint256 numberDeprecatedGroupsWithdrawn;

        (
            deprecatedGroupsWithdrawn,
            deprecatedWithdrawalsPerGroup,
            numberDeprecatedGroupsWithdrawn,
            withdrawal
        ) = getDeprecatedGroupsWithdrawalDistribution(withdrawal);

        address[] memory groupsWithdrawn;
        uint256[] memory withdrawalsPerGroup;

        (groupsWithdrawn, withdrawalsPerGroup) = getActiveGroupWithdrawalDistribution(withdrawal);

        address[] memory finalGroups = new address[](
            groupsWithdrawn.length + numberDeprecatedGroupsWithdrawn
        );
        uint256[] memory finalVotes = new uint256[](
            groupsWithdrawn.length + numberDeprecatedGroupsWithdrawn
        );

        for (uint256 i = 0; i < numberDeprecatedGroupsWithdrawn; i++) {
            finalGroups[i] = deprecatedGroupsWithdrawn[i];
            finalVotes[i] = deprecatedWithdrawalsPerGroup[i];
        }

        for (uint256 i = 0; i < groupsWithdrawn.length; i++) {
            finalGroups[i + numberDeprecatedGroupsWithdrawn] = groupsWithdrawn[i];
            finalVotes[i + numberDeprecatedGroupsWithdrawn] = withdrawalsPerGroup[i];
        }

        account.scheduleWithdrawals(beneficiary, finalGroups, finalVotes);
    }

    /**
     * @notice Calculates how many votes should be withdrawn from each
     * deprecated group.
     * @param withdrawal The total amount of votes that needs to be withdrawn.
     * @return deprecatedGroupsWithdrawn The array of deprecated groups to be
     * withdrawn from.
     * @return deprecatedWithdrawalsPerGroup The amount of votes to withdraw
     * from the respective deprecated group in `deprecatedGroupsWithdrawn`.
     * @return numberDeprecatedGroupsWithdrawn The number of groups in
     * `deprecatedGroupsWithdrawn` that have a non zero withdrawal.
     * @return remainingWithdrawal The number of votes that still need to be
     * withdrawn after withdrawing from deprecated groups.
     * @dev Non zero entries of `deprecatedWithdrawalsPerGroup` will be exactly
     * a prefix of length `numberDeprecatedGroupsWithdrawn`.
     */
    function getDeprecatedGroupsWithdrawalDistribution(uint256 withdrawal)
        internal
        returns (
            address[] memory deprecatedGroupsWithdrawn,
            uint256[] memory deprecatedWithdrawalsPerGroup,
            uint256 numberDeprecatedGroupsWithdrawn,
            uint256 remainingWithdrawal
        )
    {
        remainingWithdrawal = withdrawal;
        uint256 numberDeprecatedGroups = deprecatedGroups.length();
        deprecatedGroupsWithdrawn = new address[](numberDeprecatedGroups);
        deprecatedWithdrawalsPerGroup = new uint256[](numberDeprecatedGroups);
        numberDeprecatedGroupsWithdrawn = 0;

        for (uint256 i = 0; i < numberDeprecatedGroups; i++) {
            numberDeprecatedGroupsWithdrawn++;
            deprecatedGroupsWithdrawn[i] = deprecatedGroups.at(i);
            uint256 currentVotes = account.getCeloForGroup(deprecatedGroupsWithdrawn[i]);
            deprecatedWithdrawalsPerGroup[i] = Math.min(remainingWithdrawal, currentVotes);
            remainingWithdrawal -= deprecatedWithdrawalsPerGroup[i];

            if (currentVotes == deprecatedWithdrawalsPerGroup[i]) {
                if (!deprecatedGroups.remove(deprecatedGroupsWithdrawn[i])) {
                    revert FailedToRemoveDeprecatedGroup(deprecatedGroupsWithdrawn[i]);
                }
                emit GroupRemoved(deprecatedGroupsWithdrawn[i]);
            }

            if (remainingWithdrawal == 0) {
                break;
            }
        }

        return (
            deprecatedGroupsWithdrawn,
            deprecatedWithdrawalsPerGroup,
            numberDeprecatedGroupsWithdrawn,
            remainingWithdrawal
        );
    }

    /**
     * @notice Calculates how votes should be withdrawn from each active group.
     * @param withdrawal The number of votes that need to be withdrawn.
     * @return The array of group addresses that should be withdrawn from.
     * @return The amount of votes to withdraw from the respective group in the
     * array of groups withdrawn from.
     */
    function getActiveGroupWithdrawalDistribution(uint256 withdrawal)
        internal
        view
        returns (address[] memory, uint256[] memory)
    {
        if (withdrawal == 0) {
            address[] memory noGroups = new address[](0);
            uint256[] memory noWithdrawals = new uint256[](0);
            return (noGroups, noWithdrawals);
        }

        uint256 numberGroups = activeGroups.length();
        GroupWithVotes[] memory sortedGroups;
        uint256 availableVotes;
        (sortedGroups, availableVotes) = getSortedGroupsWithVotes(activeGroups.values());
        availableVotes -= withdrawal;

        uint256 numberGroupsWithdrawn = numberGroups;
        uint256 targetVotes = availableVotes / numberGroupsWithdrawn;

        for (uint256 i = 0; i < numberGroups; i++) {
            if (sortedGroups[i].votes <= targetVotes) {
                numberGroupsWithdrawn--;
                availableVotes -= sortedGroups[i].votes;
                targetVotes = availableVotes / numberGroupsWithdrawn;
            } else {
                break;
            }
        }

        uint256[] memory withdrawalsPerGroup = new uint256[](numberGroupsWithdrawn);
        address[] memory groupsWithdrawn = new address[](numberGroupsWithdrawn);
        uint256 offset = numberGroups - numberGroupsWithdrawn;

        for (uint256 i = 0; i < numberGroupsWithdrawn; i++) {
            groupsWithdrawn[i] = sortedGroups[i + offset].group;
            withdrawalsPerGroup[i] = sortedGroups[i + offset].votes - targetVotes;
            if (availableVotes % numberGroupsWithdrawn > i) {
                withdrawalsPerGroup[i]--;
            }
        }

        return (groupsWithdrawn, withdrawalsPerGroup);
    }

    /**
     * @notice Returns a list of group addresses with their corresponding
     * current total votes, sorted by the number of votes, and the total number
     * of votes in the system.
     * @param groups The array of addresses of the groups to sort.
     * @return The array of GroupWithVotes structs, sorted by number of votes.
     * @return The total number of votes assigned to active groups.
     */
    function getSortedGroupsWithVotes(address[] memory groups)
        internal
        view
        returns (GroupWithVotes[] memory, uint256)
    {
        GroupWithVotes[] memory groupsWithVotes = new GroupWithVotes[](groups.length);
        uint256 totalVotes = 0;
        for (uint256 i = 0; i < groups.length; i++) {
            uint256 votes = account.getCeloForGroup(groups[i]);
            totalVotes += votes;
            groupsWithVotes[i] = GroupWithVotes(groups[i], votes);
        }

        sortGroupsWithVotes(groupsWithVotes);
        return (groupsWithVotes, totalVotes);
    }

    /**
     * @notice Returns the active groups that can receive the entire `votes`
     * amount based on their current receivable votes limit in Election.sol.
     * @param votes The number of votes that would potentially be added.
     * @return The list of votable active groups.
     */
    function getVotableGroups(uint256 votes) internal returns (address[] memory) {
        uint256 numberGroups = activeGroups.length();
        uint256 numberVotableGroups = 0;
        address[] memory votableGroups = new address[](numberGroups);

        for (uint256 i = 0; i < numberGroups; i++) {
            address group = activeGroups.at(i);
            uint256 scheduledVotes = account.scheduledVotesForGroup(group);
            if (getElection().canReceiveVotes(group, votes + scheduledVotes)) {
                votableGroups[numberVotableGroups] = group;
                numberVotableGroups++;
            }
        }

        address[] memory votableGroupsFinal = new address[](numberVotableGroups);
        for (uint256 i = 0; i < numberVotableGroups; i++) {
            votableGroupsFinal[i] = votableGroups[i];
        }

        return votableGroupsFinal;
    }

    /**
     * @notice Sorts an array of GroupWithVotes structs based on increasing
     * `votes` values.
     * @param groupsWithVotes The array to sort.
     * @dev This is an in-place insertion sort. In general in Solidity we should
     * be careful of algorithms on arrays, especially O(n^2) ones, but here
     * we're guaranteed to be working with a small array, its length is bounded
     * by the maximum number of groups that can be voted for in Elections.sol.
     */
    function sortGroupsWithVotes(GroupWithVotes[] memory groupsWithVotes) internal pure {
        for (uint256 i = 1; i < groupsWithVotes.length; i++) {
            uint256 j = i;
            while (j > 0 && groupsWithVotes[j].votes < groupsWithVotes[j - 1].votes) {
                (groupsWithVotes[j], groupsWithVotes[j - 1]) = (
                    groupsWithVotes[j - 1],
                    groupsWithVotes[j]
                );
                j--;
            }
        }
    }
}
        

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

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

pragma solidity ^0.8.0;

import "../ERC1967/ERC1967Upgrade.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is ERC1967Upgrade {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;
}
          

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

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

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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 proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * 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/utils/AddressUpgradeable.sol

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

/contracts/common/UUPSOwnableUpgradeable.sol

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

/**
 * @title A contract that links UUPSUUpgradeable with OwanbleUpgradeable to gate upgrades.
 */
abstract contract UUPSOwnableUpgradeable is UUPSUpgradeable, OwnableUpgradeable {
    /**
     * @notice Guard method for UUPS (Universal Upgradable Proxy Standard)
     * See: https://docs.openzeppelin.com/contracts/4.x/api/proxy#transparent-vs-uups
     * @dev This methods overrides the virtual one in UUPSUpgradeable and
     * adds the onlyOwner modifer.
     */
    // solhint-disable-next-line no-empty-blocks
    function _authorizeUpgrade(address) internal override onlyOwner {}
}
          

/contracts/common/UsingRegistryUpgradeable.sol

//SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "../interfaces/IAccounts.sol";
import "../interfaces/IElection.sol";
import "../interfaces/IGoldToken.sol";
import "../interfaces/ILockedGold.sol";
import "../interfaces/IRegistry.sol";

/**
 * @title A helper for getting Celo core contracts from the Registry.
 */
abstract contract UsingRegistryUpgradeable is Initializable {
    /**
     * @notice Initializes the UsingRegistryUpgradable contract in an upgradable scenario
     * @param _registry The address of the Registry. For convenience, if the zero address is
     * provided, the registry is set to the canonical Registry address, i.e. 0x0...ce10. This
     * parameter should only be a non-zero address when testing.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __UsingRegistry_init(address _registry) internal onlyInitializing {
        if (_registry == address(0)) {
            registry = IRegistry(CANONICAL_REGISTRY);
        } else {
            registry = IRegistry(_registry);
        }
    }

    /// @notice The canonical address of the Registry.
    address internal constant CANONICAL_REGISTRY = 0x000000000000000000000000000000000000ce10;

    /// @notice The registry ID for the Accounts contract.
    bytes32 private constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts"));

    /// @notice The registry ID for the Election contract.
    bytes32 private constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election"));

    /// @notice The registry ID for the GoldToken contract.
    bytes32 private constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken"));

    /// @notice The registry ID for the LockedGold contract.
    bytes32 private constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));

    /// @notice The Registry.
    IRegistry public registry;

    /**
     * @notice Gets the Accounts contract from the Registry.
     * @return The Accounts contract from the Registry.
     */
    function getAccounts() internal view returns (IAccounts) {
        return IAccounts(registry.getAddressForOrDie(ACCOUNTS_REGISTRY_ID));
    }

    /**
     * @notice Gets the Election contract from the Registry.
     * @return The Election contract from the Registry.
     */
    function getElection() internal view returns (IElection) {
        return IElection(registry.getAddressForOrDie(ELECTION_REGISTRY_ID));
    }

    /**
     * @notice Gets the GoldToken contract from the Registry.
     * @return The GoldToken contract from the Registry.
     */
    function getGoldToken() internal view returns (IGoldToken) {
        return IGoldToken(registry.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID));
    }

    /**
     * @notice Gets the LockedGold contract from the Registry.
     * @return The LockedGold contract from the Registry.
     */
    function getLockedGold() internal view returns (ILockedGold) {
        return ILockedGold(registry.getAddressForOrDie(LOCKED_GOLD_REGISTRY_ID));
    }
}
          

/contracts/interfaces/IAccount.sol

//SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

interface IAccount {
    function getTotalCelo() external view returns (uint256);

    function getCeloForGroup(address) external view returns (uint256);

    function scheduleVotes(address[] calldata group, uint256[] calldata votes) external payable;

    function scheduledVotesForGroup(address group) external returns (uint256);

    function scheduleWithdrawals(
        address beneficiary,
        address[] calldata group,
        uint256[] calldata withdrawals
    ) external;
}
          

/contracts/interfaces/IAccounts.sol

//SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

interface IAccounts {
    function isAccount(address) external view returns (bool);

    function voteSignerToAccount(address) external view returns (address);

    function validatorSignerToAccount(address) external view returns (address);

    function attestationSignerToAccount(address) external view returns (address);

    function signerToAccount(address) external view returns (address);

    function getAttestationSigner(address) external view returns (address);

    function getValidatorSigner(address) external view returns (address);

    function getVoteSigner(address) external view returns (address);

    function hasAuthorizedVoteSigner(address) external view returns (bool);

    function hasAuthorizedValidatorSigner(address) external view returns (bool);

    function hasAuthorizedAttestationSigner(address) external view returns (bool);

    function setAccountDataEncryptionKey(bytes calldata) external;

    function setMetadataURL(string calldata) external;

    function setName(string calldata) external;

    function setWalletAddress(
        address,
        uint8,
        bytes32,
        bytes32
    ) external;

    function setAccount(
        string calldata,
        bytes calldata,
        address,
        uint8,
        bytes32,
        bytes32
    ) external;

    function getDataEncryptionKey(address) external view returns (bytes memory);

    function getWalletAddress(address) external view returns (address);

    function getMetadataURL(address) external view returns (string memory);

    function batchGetMetadataURL(address[] calldata)
        external
        view
        returns (uint256[] memory, bytes memory);

    function getName(address) external view returns (string memory);

    function authorizeVoteSigner(
        address,
        uint8,
        bytes32,
        bytes32
    ) external;

    function authorizeValidatorSigner(
        address,
        uint8,
        bytes32,
        bytes32
    ) external;

    function authorizeValidatorSignerWithPublicKey(
        address,
        uint8,
        bytes32,
        bytes32,
        bytes calldata
    ) external;

    function authorizeValidatorSignerWithKeys(
        address,
        uint8,
        bytes32,
        bytes32,
        bytes calldata,
        bytes calldata,
        bytes calldata
    ) external;

    function authorizeAttestationSigner(
        address,
        uint8,
        bytes32,
        bytes32
    ) external;

    function createAccount() external returns (bool);
}
          

/contracts/interfaces/IElection.sol

//SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

interface IElection {
    function electValidatorSigners() external view returns (address[] memory);

    function electNValidatorSigners(uint256, uint256) external view returns (address[] memory);

    function vote(
        address,
        uint256,
        address,
        address
    ) external returns (bool);

    function activate(address) external returns (bool);

    function activateForAccount(address, address) external returns (bool);

    function revokeActive(
        address,
        uint256,
        address,
        address,
        uint256
    ) external returns (bool);

    function revokeAllActive(
        address,
        address,
        address,
        uint256
    ) external returns (bool);

    function revokePending(
        address,
        uint256,
        address,
        address,
        uint256
    ) external returns (bool);

    function markGroupIneligible(address) external;

    function markGroupEligible(
        address,
        address,
        address
    ) external;

    function forceDecrementVotes(
        address,
        uint256,
        address[] calldata,
        address[] calldata,
        uint256[] calldata
    ) external returns (uint256);

    // view functions
    function getElectableValidators() external view returns (uint256, uint256);

    function getElectabilityThreshold() external view returns (uint256);

    function getNumVotesReceivable(address) external view returns (uint256);

    function getTotalVotes() external view returns (uint256);

    function getActiveVotes() external view returns (uint256);

    function getTotalVotesByAccount(address) external view returns (uint256);

    function getPendingVotesForGroupByAccount(address, address) external view returns (uint256);

    function getActiveVotesForGroupByAccount(address, address) external view returns (uint256);

    function getTotalVotesForGroupByAccount(address, address) external view returns (uint256);

    function getActiveVoteUnitsForGroupByAccount(address, address) external view returns (uint256);

    function getTotalVotesForGroup(address) external view returns (uint256);

    function getActiveVotesForGroup(address) external view returns (uint256);

    function getPendingVotesForGroup(address) external view returns (uint256);

    function getGroupEligibility(address) external view returns (bool);

    function getGroupEpochRewards(
        address,
        uint256,
        uint256[] calldata
    ) external view returns (uint256);

    function getGroupsVotedForByAccount(address) external view returns (address[] memory);

    function getEligibleValidatorGroups() external view returns (address[] memory);

    function getTotalVotesForEligibleValidatorGroups()
        external
        view
        returns (address[] memory, uint256[] memory);

    function getCurrentValidatorSigners() external view returns (address[] memory);

    function canReceiveVotes(address, uint256) external view returns (bool);

    function hasActivatablePendingVotes(address, address) external view returns (bool);

    // only owner
    function setElectableValidators(uint256, uint256) external returns (bool);

    function setMaxNumGroupsVotedFor(uint256) external returns (bool);

    function setElectabilityThreshold(uint256) external returns (bool);

    // only VM
    function distributeEpochRewards(
        address,
        uint256,
        address,
        address
    ) external;

    function maxNumGroupsVotedFor() external view returns (uint256);
}
          

/contracts/interfaces/IGoldToken.sol

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

interface IGoldToken {
    function transfer(address to, uint256 value) external returns (bool);

    function transferWithComment(
        address to,
        uint256 value,
        string calldata comment
    ) external returns (bool);

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

    function increaseAllowance(address spender, uint256 value) external returns (bool);

    function decreaseAllowance(address spender, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

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

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

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

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

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

/contracts/interfaces/ILockedGold.sol

//SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

interface ILockedGold {
    function unlockingPeriod() external view returns (uint256);

    function incrementNonvotingAccountBalance(address, uint256) external;

    function decrementNonvotingAccountBalance(address, uint256) external;

    function getAccountTotalLockedGold(address) external view returns (uint256);

    function getTotalLockedGold() external view returns (uint256);

    function getPendingWithdrawal(address, uint256) external view returns (uint256, uint256);

    function getPendingWithdrawals(address)
        external
        view
        returns (uint256[] memory, uint256[] memory);

    function getTotalPendingWithdrawals(address) external view returns (uint256);

    function lock() external payable;

    function unlock(uint256) external;

    function relock(uint256, uint256) external;

    function withdraw(uint256) external;

    function slash(
        address account,
        uint256 penalty,
        address reporter,
        uint256 reward,
        address[] calldata lessers,
        address[] calldata greaters,
        uint256[] calldata indices
    ) external;

    function isSlasher(address) external view returns (bool);
}
          

/contracts/interfaces/IRegistry.sol

//SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

interface IRegistry {
    function setAddressFor(string calldata, address) external;

    function getAddressForOrDie(bytes32) external view returns (address);

    function getAddressFor(bytes32) external view returns (address);

    function getAddressForStringOrDie(string calldata identifier) external view returns (address);

    function getAddressForString(string calldata identifier) external view returns (address);

    function isOneOf(bytes32[] calldata, address) external view returns (bool);
}
          

/contracts/interfaces/IStakedCelo.sol

//SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

interface IStakedCelo {
    function totalSupply() external view returns (uint256);

    function mint(address, uint256) external;

    function burn(address, uint256) external;

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

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

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"FailedToAddActiveGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"FailedToAddDeprecatedGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"FailedToRemoveDeprecatedGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"GroupAlreadyAdded","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"GroupNotActive","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"MaxGroupsVotedForReached","inputs":[]},{"type":"error","name":"NoActiveGroups","inputs":[]},{"type":"error","name":"NoGroups","inputs":[]},{"type":"error","name":"NoVotableGroups","inputs":[]},{"type":"error","name":"ZeroWithdrawal","inputs":[]},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"GroupActivated","inputs":[{"type":"address","name":"group","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"GroupDeprecated","inputs":[{"type":"address","name":"group","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"GroupRemoved","inputs":[{"type":"address","name":"group","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"activateGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"deposit","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deprecateGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getDeprecatedGroups","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getGroups","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_registry","internalType":"address"},{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDependencies","inputs":[{"type":"address","name":"_stakedCelo","internalType":"address"},{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"toCelo","inputs":[{"type":"uint256","name":"stCeloAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"toStakedCelo","inputs":[{"type":"uint256","name":"celoAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"stakedCeloAmount","internalType":"uint256"}]}]
              

Contract Creation Code

0x60a06040523073ffffffffffffffffffffffffffffffffffffffff1660809073ffffffffffffffffffffffffffffffffffffffff168152503480156200004457600080fd5b50600060019054906101000a900460ff166200006f5760008054906101000a900460ff161562000080565b6200007f6200013c60201b60201c565b5b620000c2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000b99062000204565b60405180910390fd5b60008060019054906101000a900460ff16159050801562000113576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b8015620001355760008060016101000a81548160ff0219169083151502179055505b5062000226565b600062000154306200015a60201b620013e21760201c565b15905090565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600082825260208201905092915050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000620001ec602e836200017d565b9150620001f9826200018e565b604082019050919050565b600060208201905081810360008301526200021f81620001dd565b9050919050565b6080516143fa620002576000396000818161083b015281816108ca01528181610abc0152610b4b01526143fa6000f3fe6080604052600436106100f35760003560e01c80637b1039991161008a578063c72b517611610059578063c72b5176146102f3578063d0e30db01461031e578063e87c28a714610328578063f2fde38b14610351576100f3565b80637b103999146102355780637b4c1b75146102605780638da5cb5b1461028b578063c494ec1e146102b6576100f3565b8063485cc955116100c6578063485cc955146101b05780634f1ef286146101d9578063715018a6146101f5578063756887301461020c576100f3565b806304de86e8146100f85780630567847f146101215780632e1a7d4d1461015e5780633659cfe614610187575b600080fd5b34801561010457600080fd5b5061011f600480360381019061011a9190613418565b61037a565b005b34801561012d57600080fd5b506101486004803603810190610143919061347b565b6105d3565b60405161015591906134b7565b60405180910390f35b34801561016a57600080fd5b506101856004803603810190610180919061347b565b61073d565b005b34801561019357600080fd5b506101ae60048036038101906101a99190613418565b610839565b005b3480156101bc57600080fd5b506101d760048036038101906101d291906134d2565b6109c2565b005b6101f360048036038101906101ee9190613658565b610aba565b005b34801561020157600080fd5b5061020a610bf7565b005b34801561021857600080fd5b50610233600480360381019061022e9190613418565b610c7f565b005b34801561024157600080fd5b5061024a610f26565b6040516102579190613713565b60405180910390f35b34801561026c57600080fd5b50610275610f4c565b60405161028291906137ec565b60405180910390f35b34801561029757600080fd5b506102a0610f5d565b6040516102ad919061381d565b60405180910390f35b3480156102c257600080fd5b506102dd60048036038101906102d8919061347b565b610f87565b6040516102ea91906134b7565b60405180910390f35b3480156102ff57600080fd5b506103086110f1565b60405161031591906137ec565b60405180910390f35b610326611102565b005b34801561033457600080fd5b5061034f600480360381019061034a91906134d2565b6111e8565b005b34801561035d57600080fd5b5061037860048036038101906103739190613418565b6112ea565b005b610382611405565b73ffffffffffffffffffffffffffffffffffffffff166103a0610f5d565b73ffffffffffffffffffffffffffffffffffffffff16146103f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ed90613895565b60405180910390fd5b61040a81606861140d90919063ffffffff16565b61044b57806040517f1adbb153000000000000000000000000000000000000000000000000000000008152600401610442919061381d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff167f9d43d19c4e20849e2330b455068517bf1ebb0ebf9f9ad171e6906743aa65318660405160405180910390a26000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663acd201d0836040518263ffffffff1660e01b81526004016104eb919061381d565b602060405180830381865afa158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c91906138ca565b111561058c5761054681606a61143d90919063ffffffff16565b61058757806040517f817469c100000000000000000000000000000000000000000000000000000000815260040161057e919061381d565b60405180910390fd5b6105d0565b8073ffffffffffffffffffffffffffffffffffffffff167fa78a88a551e130ce9732be17784bdff12f72ab4a2c833fb2dcb3ef0818956b0360405160405180910390a25b50565b600080606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610643573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066791906138ca565b90506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301d2b6ea6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fc91906138ca565b9050600082148061070d5750600081145b1561071c578392505050610738565b8181856107299190613926565b61073391906139af565b925050505b919050565b6000610749606a61146d565b610753606861146d565b61075d91906139e0565b1415610795576040517f377b56d200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107a76107a1826105d3565b33611482565b606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac33836040518363ffffffff1660e01b8152600401610804929190613a36565b600060405180830381600087803b15801561081e57600080fd5b505af1158015610832573d6000803e3d6000fd5b5050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614156108c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bf90613ad1565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166109076117d6565b73ffffffffffffffffffffffffffffffffffffffff161461095d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095490613b63565b60405180910390fd5b6109668161182d565b6109bf81600067ffffffffffffffff8111156109855761098461352d565b5b6040519080825280601f01601f1916602001820160405280156109b75781602001600182028036833780820191505090505b5060006118ac565b50565b600060019054906101000a900460ff166109ea5760008054906101000a900460ff16156109f3565b6109f2611a7d565b5b610a32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2990613bf5565b60405180910390fd5b60008060019054906101000a900460ff161590508015610a82576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b610a8b82611a8e565b610a9483611b54565b8015610ab55760008060016101000a81548160ff0219169083151502179055505b505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161415610b49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4090613ad1565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610b886117d6565b73ffffffffffffffffffffffffffffffffffffffff1614610bde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd590613b63565b60405180910390fd5b610be78261182d565b610bf3828260016118ac565b5050565b610bff611405565b73ffffffffffffffffffffffffffffffffffffffff16610c1d610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614610c73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6a90613895565b60405180910390fd5b610c7d6000611a8e565b565b610c87611405565b73ffffffffffffffffffffffffffffffffffffffff16610ca5610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614610cfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf290613895565b60405180910390fd5b610d0f816068611c6590919063ffffffff16565b15610d5157806040517fbd133eee000000000000000000000000000000000000000000000000000000008152600401610d48919061381d565b60405180910390fd5b610d6581606a611c6590919063ffffffff16565b15610dc057610d7e81606a61140d90919063ffffffff16565b610dbf57806040517fbe8534b7000000000000000000000000000000000000000000000000000000008152600401610db6919061381d565b60405180910390fd5b5b610dc8611c95565b73ffffffffffffffffffffffffffffffffffffffff1663ac839d696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3691906138ca565b610e40606a61146d565b610e4a606861146d565b610e5491906139e0565b10610e8b576040517fae906d4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e9f81606861143d90919063ffffffff16565b610ee057806040517f620f409a000000000000000000000000000000000000000000000000000000008152600401610ed7919061381d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff167f0503b4748a47435f2432d46ef300e0e2dc47baa0e5f04bb3bd8a355ee1e1dbe660405160405180910390a250565b606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060610f58606a611d5c565b905090565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101b91906138ca565b90506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301d2b6ea6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b091906138ca565b905060008214806110c15750600081145b156110d05783925050506110ec565b8082856110dd9190613926565b6110e791906139af565b925050505b919050565b60606110fd6068611d5c565b905090565b600061110e606861146d565b1415611146576040517f7818a60e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f193361118e34610f87565b6040518363ffffffff1660e01b81526004016111ab929190613a36565b600060405180830381600087803b1580156111c557600080fd5b505af11580156111d9573d6000803e3d6000fd5b505050506111e634611d7d565b565b6111f0611405565b73ffffffffffffffffffffffffffffffffffffffff1661120e610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614611264576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125b90613895565b60405180910390fd5b81606660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080606760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6112f2611405565b73ffffffffffffffffffffffffffffffffffffffff16611310610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614611366576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135d90613895565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113cd90613c87565b60405180910390fd5b6113df81611a8e565b50565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600033905090565b6000611435836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61219a565b905092915050565b6000611465836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6122ae565b905092915050565b600061147b8260000161231e565b9050919050565b60008214156114bd576040517fc60050c000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608060006114cb8561232f565b809850819450829550839650505050506060806114e78761269a565b809250819350505060008383516114fe91906139e0565b67ffffffffffffffff8111156115175761151661352d565b5b6040519080825280602002602001820160405280156115455781602001602082028036833780820191505090505b509050600084845161155791906139e0565b67ffffffffffffffff8111156115705761156f61352d565b5b60405190808252806020026020018201604052801561159e5781602001602082028036833780820191505090505b50905060005b85811015611661578781815181106115bf576115be613ca7565b5b60200260200101518382815181106115da576115d9613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505086818151811061162757611626613ca7565b5b602002602001015182828151811061164257611641613ca7565b5b602002602001018181525050808061165990613cd6565b9150506115a4565b5060005b84518110156117395784818151811061168157611680613ca7565b5b602002602001015183878361169691906139e0565b815181106116a7576116a6613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508381815181106116f4576116f3613ca7565b5b602002602001015182878361170991906139e0565b8151811061171a57611719613ca7565b5b602002602001018181525050808061173190613cd6565b915050611665565b50606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632f842a1a8984846040518463ffffffff1660e01b815260040161179993929190613ddd565b600060405180830381600087803b1580156117b357600080fd5b505af11580156117c7573d6000803e3d6000fd5b50505050505050505050505050565b60006118047f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b612a1a565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611835611405565b73ffffffffffffffffffffffffffffffffffffffff16611853610f5d565b73ffffffffffffffffffffffffffffffffffffffff16146118a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a090613895565b60405180910390fd5b50565b60006118b66117d6565b90506118c184612a24565b6000835111806118ce5750815b156118df576118dd8484612add565b505b600061190d7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914360001b612b0a565b90508060000160009054906101000a900460ff16611a765760018160000160006101000a81548160ff0219169083151502179055506119d98583604051602401611957919061381d565b6040516020818303038152906040527f3659cfe6000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612add565b5060008160000160006101000a81548160ff0219169083151502179055506119ff6117d6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6390613e94565b60405180910390fd5b611a7585612b14565b5b5050505050565b6000611a88306113e2565b15905090565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081603360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060019054906101000a900460ff16611ba3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9a90613f26565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c205761ce10606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c62565b80606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000611c8d836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612b63565b905092915050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed604051602001611ce490613f9d565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611d169190613fcb565b602060405180830381865afa158015611d33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d579190613ffb565b905090565b60606000611d6c83600001612b86565b905060608190508092505050919050565b6000611d8882612be2565b9050600081511415611dc6576040517fd978e43100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606000611dd383612eeb565b80925081935050508381611de791906139e0565b90506000835167ffffffffffffffff811115611e0657611e0561352d565b5b604051908082528060200260200182016040528015611e345781602001602082028036833780820191505090505b50905060008451905060008184611e4b91906139af565b90506000865190505b6000811115611f9f576000600182611e6c9190614028565b905082878281518110611e8257611e81613ca7565b5b60200260200101516020015110611f01578380611e9e9061405c565b945050868181518110611eb457611eb3613ca7565b5b60200260200101516020015186611ecb9190614028565b95508386611ed991906139af565b92506000858281518110611ef057611eef613ca7565b5b602002602001018181525050611f8b565b868181518110611f1457611f13613ca7565b5b60200260200101516020015183611f2b9190614028565b858281518110611f3e57611f3d613ca7565b5b602002602001018181525050808487611f579190614086565b1115611f8a57848181518110611f7057611f6f613ca7565b5b602002602001018051809190611f8590613cd6565b815250505b5b508080611f979061405c565b915050611e54565b5060008267ffffffffffffffff811115611fbc57611fbb61352d565b5b604051908082528060200260200182016040528015611fea5781602001602082028036833780820191505090505b50905060008367ffffffffffffffff8111156120095761200861352d565b5b6040519080825280602002602001820160405280156120375781602001602082028036833780820191505090505b50905060005b848110156120fe5787818151811061205857612057613ca7565b5b60200260200101516000015183828151811061207757612076613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508581815181106120c4576120c3613ca7565b5b60200260200101518282815181106120df576120de613ca7565b5b60200260200101818152505080806120f690613cd6565b91505061203d565b50606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301c21d598a84846040518463ffffffff1660e01b815260040161215d9291906140b7565b6000604051808303818588803b15801561217657600080fd5b505af115801561218a573d6000803e3d6000fd5b5050505050505050505050505050565b600080836001016000848152602001908152602001600020549050600081146122a25760006001826121cc9190614028565b90506000600186600001805490506121e49190614028565b905081811461225357600086600001828154811061220557612204613ca7565b5b906000526020600020015490508087600001848154811061222957612228613ca7565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480612267576122666140ee565b5b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506122a8565b60009150505b92915050565b60006122ba8383612b63565b612313578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612318565b600090505b92915050565b600081600001805490509050919050565b6060806000808490506000612344606a61146d565b90508067ffffffffffffffff8111156123605761235f61352d565b5b60405190808252806020026020018201604052801561238e5781602001602082028036833780820191505090505b5094508067ffffffffffffffff8111156123ab576123aa61352d565b5b6040519080825280602002602001820160405280156123d95781602001602082028036833780820191505090505b5093506000925060005b818110156126915783806123f690613cd6565b94505061240d81606a6130aa90919063ffffffff16565b8682815181106124205761241f613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663acd201d08884815181106124ad576124ac613ca7565b5b60200260200101516040518263ffffffff1660e01b81526004016124d1919061381d565b602060405180830381865afa1580156124ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251291906138ca565b905061251e84826130c4565b86838151811061253157612530613ca7565b5b6020026020010181815250508582815181106125505761254f613ca7565b5b6020026020010151846125639190614028565b935085828151811061257857612577613ca7565b5b602002602001015181141561266e576125b587838151811061259d5761259c613ca7565b5b6020026020010151606a61140d90919063ffffffff16565b612610578682815181106125cc576125cb613ca7565b5b60200260200101516040517fbe8534b7000000000000000000000000000000000000000000000000000000008152600401612607919061381d565b60405180910390fd5b86828151811061262357612622613ca7565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167fa78a88a551e130ce9732be17784bdff12f72ab4a2c833fb2dcb3ef0818956b0360405160405180910390a25b600084141561267d5750612691565b50808061268990613cd6565b9150506123e3565b50509193509193565b606080600083141561274d5760008067ffffffffffffffff8111156126c2576126c161352d565b5b6040519080825280602002602001820160405280156126f05781602001602082028036833780820191505090505b50905060008067ffffffffffffffff81111561270f5761270e61352d565b5b60405190808252806020026020018201604052801561273d5781602001602082028036833780820191505090505b5090508181935093505050612a15565b6000612759606861146d565b90506060600061277161276c6068611d5c565b612eeb565b809250819350505085816127859190614028565b905060008390506000818361279a91906139af565b905060005b8581101561283157818582815181106127bb576127ba613ca7565b5b602002602001015160200151116128195782806127d79061405c565b9350508481815181106127ed576127ec613ca7565b5b602002602001015160200151846128049190614028565b9350828461281291906139af565b915061281e565b612831565b808061282990613cd6565b91505061279f565b5060008267ffffffffffffffff81111561284e5761284d61352d565b5b60405190808252806020026020018201604052801561287c5781602001602082028036833780820191505090505b50905060008367ffffffffffffffff81111561289b5761289a61352d565b5b6040519080825280602002602001820160405280156128c95781602001602082028036833780820191505090505b509050600084886128da9190614028565b905060005b85811015612a05578782826128f491906139e0565b8151811061290557612904613ca7565b5b60200260200101516000015183828151811061292457612923613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508488838361296c91906139e0565b8151811061297d5761297c613ca7565b5b6020026020010151602001516129939190614028565b8482815181106129a6576129a5613ca7565b5b6020026020010181815250508086886129bf9190614086565b11156129f2578381815181106129d8576129d7613ca7565b5b6020026020010180518091906129ed9061405c565b815250505b80806129fd90613cd6565b9150506128df565b5081839950995050505050505050505b915091565b6000819050919050565b612a2d816130dd565b612a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a639061418f565b60405180910390fd5b80612a997f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b612a1a565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6060612b02838360405180606001604052806027815260200161439e602791396130f0565b905092915050565b6000819050919050565b612b1d81612a24565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b600080836001016000848152602001908152602001600020541415905092915050565b606081600001805480602002602001604051908101604052809291908181526020018280548015612bd657602002820191906000526020600020905b815481526020019060010190808311612bc2575b50505050509050919050565b60606000612bf0606861146d565b90506000808267ffffffffffffffff811115612c0f57612c0e61352d565b5b604051908082528060200260200182016040528015612c3d5781602001602082028036833780820191505090505b50905060005b83811015612e0a576000612c618260686130aa90919063ffffffff16565b90506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fd5c95e836040518263ffffffff1660e01b8152600401612cc0919061381d565b6020604051808303816000875af1158015612cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0391906138ca565b9050612d0d611c95565b73ffffffffffffffffffffffffffffffffffffffff1663e59ea3e883838b612d3591906139e0565b6040518363ffffffff1660e01b8152600401612d52929190613a36565b602060405180830381865afa158015612d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d9391906141e7565b15612df55781848681518110612dac57612dab613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508480612df190613cd6565b9550505b50508080612e0290613cd6565b915050612c43565b5060008267ffffffffffffffff811115612e2757612e2661352d565b5b604051908082528060200260200182016040528015612e555781602001602082028036833780820191505090505b50905060005b83811015612ede57828181518110612e7657612e75613ca7565b5b6020026020010151828281518110612e9157612e90613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080612ed690613cd6565b915050612e5b565b5080945050505050919050565b6060600080835167ffffffffffffffff811115612f0b57612f0a61352d565b5b604051908082528060200260200182016040528015612f4457816020015b612f31613376565b815260200190600190039081612f295790505b5090506000805b8551811015613093576000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663acd201d0888481518110612fa757612fa6613ca7565b5b60200260200101516040518263ffffffff1660e01b8152600401612fcb919061381d565b602060405180830381865afa158015612fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300c91906138ca565b9050808361301a91906139e0565b9250604051806040016040528088848151811061303a57613039613ca7565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018281525084838151811061307457613073613ca7565b5b602002602001018190525050808061308b90613cd6565b915050612f4b565b5061309d826131bd565b8181935093505050915091565b60006130b983600001836132e4565b60001c905092915050565b60008183106130d357816130d5565b825b905092915050565b600080823b905060008111915050919050565b60606130fb846130dd565b61313a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161313190614286565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516131629190614320565b600060405180830381855af49150503d806000811461319d576040519150601f19603f3d011682016040523d82523d6000602084013e6131a2565b606091505b50915091506131b282828661330f565b925050509392505050565b6000600190505b81518110156132e05760008190505b60008111801561322a5750826001826131ec9190614028565b815181106131fd576131fc613ca7565b5b60200260200101516020015183828151811061321c5761321b613ca7565b5b602002602001015160200151105b156132cc578260018261323d9190614028565b8151811061324e5761324d613ca7565b5b602002602001015183828151811061326957613268613ca7565b5b602002602001015184838151811061328457613283613ca7565b5b60200260200101856001856132999190614028565b815181106132aa576132a9613ca7565b5b60200260200101829052829052505080806132c49061405c565b9150506131d3565b5080806132d890613cd6565b9150506131c4565b5050565b60008260000182815481106132fc576132fb613ca7565b5b9060005260206000200154905092915050565b6060831561331f5782905061336f565b6000835111156133325782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613366919061437b565b60405180910390fd5b9392505050565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006133e5826133ba565b9050919050565b6133f5816133da565b811461340057600080fd5b50565b600081359050613412816133ec565b92915050565b60006020828403121561342e5761342d6133b0565b5b600061343c84828501613403565b91505092915050565b6000819050919050565b61345881613445565b811461346357600080fd5b50565b6000813590506134758161344f565b92915050565b600060208284031215613491576134906133b0565b5b600061349f84828501613466565b91505092915050565b6134b181613445565b82525050565b60006020820190506134cc60008301846134a8565b92915050565b600080604083850312156134e9576134e86133b0565b5b60006134f785828601613403565b925050602061350885828601613403565b9150509250929050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6135658261351c565b810181811067ffffffffffffffff821117156135845761358361352d565b5b80604052505050565b60006135976133a6565b90506135a3828261355c565b919050565b600067ffffffffffffffff8211156135c3576135c261352d565b5b6135cc8261351c565b9050602081019050919050565b82818337600083830152505050565b60006135fb6135f6846135a8565b61358d565b90508281526020810184848401111561361757613616613517565b5b6136228482856135d9565b509392505050565b600082601f83011261363f5761363e613512565b5b813561364f8482602086016135e8565b91505092915050565b6000806040838503121561366f5761366e6133b0565b5b600061367d85828601613403565b925050602083013567ffffffffffffffff81111561369e5761369d6133b5565b5b6136aa8582860161362a565b9150509250929050565b6000819050919050565b60006136d96136d46136cf846133ba565b6136b4565b6133ba565b9050919050565b60006136eb826136be565b9050919050565b60006136fd826136e0565b9050919050565b61370d816136f2565b82525050565b60006020820190506137286000830184613704565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613763816133da565b82525050565b6000613775838361375a565b60208301905092915050565b6000602082019050919050565b60006137998261372e565b6137a38185613739565b93506137ae8361374a565b8060005b838110156137df5781516137c68882613769565b97506137d183613781565b9250506001810190506137b2565b5085935050505092915050565b60006020820190508181036000830152613806818461378e565b905092915050565b613817816133da565b82525050565b6000602082019050613832600083018461380e565b92915050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061387f602083613838565b915061388a82613849565b602082019050919050565b600060208201905081810360008301526138ae81613872565b9050919050565b6000815190506138c48161344f565b92915050565b6000602082840312156138e0576138df6133b0565b5b60006138ee848285016138b5565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061393182613445565b915061393c83613445565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613975576139746138f7565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006139ba82613445565b91506139c583613445565b9250826139d5576139d4613980565b5b828204905092915050565b60006139eb82613445565b91506139f683613445565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a2b57613a2a6138f7565b5b828201905092915050565b6000604082019050613a4b600083018561380e565b613a5860208301846134a8565b9392505050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f64656c656761746563616c6c0000000000000000000000000000000000000000602082015250565b6000613abb602c83613838565b9150613ac682613a5f565b604082019050919050565b60006020820190508181036000830152613aea81613aae565b9050919050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f6163746976652070726f78790000000000000000000000000000000000000000602082015250565b6000613b4d602c83613838565b9150613b5882613af1565b604082019050919050565b60006020820190508181036000830152613b7c81613b40565b9050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000613bdf602e83613838565b9150613bea82613b83565b604082019050919050565b60006020820190508181036000830152613c0e81613bd2565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613c71602683613838565b9150613c7c82613c15565b604082019050919050565b60006020820190508181036000830152613ca081613c64565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000613ce182613445565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d1457613d136138f7565b5b600182019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613d5481613445565b82525050565b6000613d668383613d4b565b60208301905092915050565b6000602082019050919050565b6000613d8a82613d1f565b613d948185613d2a565b9350613d9f83613d3b565b8060005b83811015613dd0578151613db78882613d5a565b9750613dc283613d72565b925050600181019050613da3565b5085935050505092915050565b6000606082019050613df2600083018661380e565b8181036020830152613e04818561378e565b90508181036040830152613e188184613d7f565b9050949350505050565b7f45524331393637557067726164653a207570677261646520627265616b73206660008201527f7572746865722075706772616465730000000000000000000000000000000000602082015250565b6000613e7e602f83613838565b9150613e8982613e22565b604082019050919050565b60006020820190508181036000830152613ead81613e71565b9050919050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b6000613f10602b83613838565b9150613f1b82613eb4565b604082019050919050565b60006020820190508181036000830152613f3f81613f03565b9050919050565b600081905092915050565b7f456c656374696f6e000000000000000000000000000000000000000000000000600082015250565b6000613f87600883613f46565b9150613f9282613f51565b600882019050919050565b6000613fa882613f7a565b9150819050919050565b6000819050919050565b613fc581613fb2565b82525050565b6000602082019050613fe06000830184613fbc565b92915050565b600081519050613ff5816133ec565b92915050565b600060208284031215614011576140106133b0565b5b600061401f84828501613fe6565b91505092915050565b600061403382613445565b915061403e83613445565b925082821015614051576140506138f7565b5b828203905092915050565b600061406782613445565b9150600082141561407b5761407a6138f7565b5b600182039050919050565b600061409182613445565b915061409c83613445565b9250826140ac576140ab613980565b5b828206905092915050565b600060408201905081810360008301526140d1818561378e565b905081810360208301526140e58184613d7f565b90509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60008201527f6f74206120636f6e747261637400000000000000000000000000000000000000602082015250565b6000614179602d83613838565b91506141848261411d565b604082019050919050565b600060208201905081810360008301526141a88161416c565b9050919050565b60008115159050919050565b6141c4816141af565b81146141cf57600080fd5b50565b6000815190506141e1816141bb565b92915050565b6000602082840312156141fd576141fc6133b0565b5b600061420b848285016141d2565b91505092915050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b6000614270602683613838565b915061427b82614214565b604082019050919050565b6000602082019050818103600083015261429f81614263565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156142da5780820151818401526020810190506142bf565b838111156142e9576000848401525b50505050565b60006142fa826142a6565b61430481856142b1565b93506143148185602086016142bc565b80840191505092915050565b600061432c82846142ef565b915081905092915050565b600081519050919050565b600061434d82614337565b6143578185613838565b93506143678185602086016142bc565b6143708161351c565b840191505092915050565b600060208201905081810360008301526143958184614342565b90509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220091ef2319acaa9ad8cfdcb62797da14261fe0106a4a14924d32a8a420cff9efe64736f6c634300080b0033

Deployed ByteCode

0x6080604052600436106100f35760003560e01c80637b1039991161008a578063c72b517611610059578063c72b5176146102f3578063d0e30db01461031e578063e87c28a714610328578063f2fde38b14610351576100f3565b80637b103999146102355780637b4c1b75146102605780638da5cb5b1461028b578063c494ec1e146102b6576100f3565b8063485cc955116100c6578063485cc955146101b05780634f1ef286146101d9578063715018a6146101f5578063756887301461020c576100f3565b806304de86e8146100f85780630567847f146101215780632e1a7d4d1461015e5780633659cfe614610187575b600080fd5b34801561010457600080fd5b5061011f600480360381019061011a9190613418565b61037a565b005b34801561012d57600080fd5b506101486004803603810190610143919061347b565b6105d3565b60405161015591906134b7565b60405180910390f35b34801561016a57600080fd5b506101856004803603810190610180919061347b565b61073d565b005b34801561019357600080fd5b506101ae60048036038101906101a99190613418565b610839565b005b3480156101bc57600080fd5b506101d760048036038101906101d291906134d2565b6109c2565b005b6101f360048036038101906101ee9190613658565b610aba565b005b34801561020157600080fd5b5061020a610bf7565b005b34801561021857600080fd5b50610233600480360381019061022e9190613418565b610c7f565b005b34801561024157600080fd5b5061024a610f26565b6040516102579190613713565b60405180910390f35b34801561026c57600080fd5b50610275610f4c565b60405161028291906137ec565b60405180910390f35b34801561029757600080fd5b506102a0610f5d565b6040516102ad919061381d565b60405180910390f35b3480156102c257600080fd5b506102dd60048036038101906102d8919061347b565b610f87565b6040516102ea91906134b7565b60405180910390f35b3480156102ff57600080fd5b506103086110f1565b60405161031591906137ec565b60405180910390f35b610326611102565b005b34801561033457600080fd5b5061034f600480360381019061034a91906134d2565b6111e8565b005b34801561035d57600080fd5b5061037860048036038101906103739190613418565b6112ea565b005b610382611405565b73ffffffffffffffffffffffffffffffffffffffff166103a0610f5d565b73ffffffffffffffffffffffffffffffffffffffff16146103f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ed90613895565b60405180910390fd5b61040a81606861140d90919063ffffffff16565b61044b57806040517f1adbb153000000000000000000000000000000000000000000000000000000008152600401610442919061381d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff167f9d43d19c4e20849e2330b455068517bf1ebb0ebf9f9ad171e6906743aa65318660405160405180910390a26000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663acd201d0836040518263ffffffff1660e01b81526004016104eb919061381d565b602060405180830381865afa158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c91906138ca565b111561058c5761054681606a61143d90919063ffffffff16565b61058757806040517f817469c100000000000000000000000000000000000000000000000000000000815260040161057e919061381d565b60405180910390fd5b6105d0565b8073ffffffffffffffffffffffffffffffffffffffff167fa78a88a551e130ce9732be17784bdff12f72ab4a2c833fb2dcb3ef0818956b0360405160405180910390a25b50565b600080606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610643573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066791906138ca565b90506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301d2b6ea6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fc91906138ca565b9050600082148061070d5750600081145b1561071c578392505050610738565b8181856107299190613926565b61073391906139af565b925050505b919050565b6000610749606a61146d565b610753606861146d565b61075d91906139e0565b1415610795576040517f377b56d200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107a76107a1826105d3565b33611482565b606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac33836040518363ffffffff1660e01b8152600401610804929190613a36565b600060405180830381600087803b15801561081e57600080fd5b505af1158015610832573d6000803e3d6000fd5b5050505050565b7f0000000000000000000000009e89b5a2433bc35d2e0e4848417a242dbd47929f73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614156108c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bf90613ad1565b60405180910390fd5b7f0000000000000000000000009e89b5a2433bc35d2e0e4848417a242dbd47929f73ffffffffffffffffffffffffffffffffffffffff166109076117d6565b73ffffffffffffffffffffffffffffffffffffffff161461095d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095490613b63565b60405180910390fd5b6109668161182d565b6109bf81600067ffffffffffffffff8111156109855761098461352d565b5b6040519080825280601f01601f1916602001820160405280156109b75781602001600182028036833780820191505090505b5060006118ac565b50565b600060019054906101000a900460ff166109ea5760008054906101000a900460ff16156109f3565b6109f2611a7d565b5b610a32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2990613bf5565b60405180910390fd5b60008060019054906101000a900460ff161590508015610a82576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b610a8b82611a8e565b610a9483611b54565b8015610ab55760008060016101000a81548160ff0219169083151502179055505b505050565b7f0000000000000000000000009e89b5a2433bc35d2e0e4848417a242dbd47929f73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161415610b49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4090613ad1565b60405180910390fd5b7f0000000000000000000000009e89b5a2433bc35d2e0e4848417a242dbd47929f73ffffffffffffffffffffffffffffffffffffffff16610b886117d6565b73ffffffffffffffffffffffffffffffffffffffff1614610bde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd590613b63565b60405180910390fd5b610be78261182d565b610bf3828260016118ac565b5050565b610bff611405565b73ffffffffffffffffffffffffffffffffffffffff16610c1d610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614610c73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6a90613895565b60405180910390fd5b610c7d6000611a8e565b565b610c87611405565b73ffffffffffffffffffffffffffffffffffffffff16610ca5610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614610cfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf290613895565b60405180910390fd5b610d0f816068611c6590919063ffffffff16565b15610d5157806040517fbd133eee000000000000000000000000000000000000000000000000000000008152600401610d48919061381d565b60405180910390fd5b610d6581606a611c6590919063ffffffff16565b15610dc057610d7e81606a61140d90919063ffffffff16565b610dbf57806040517fbe8534b7000000000000000000000000000000000000000000000000000000008152600401610db6919061381d565b60405180910390fd5b5b610dc8611c95565b73ffffffffffffffffffffffffffffffffffffffff1663ac839d696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3691906138ca565b610e40606a61146d565b610e4a606861146d565b610e5491906139e0565b10610e8b576040517fae906d4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e9f81606861143d90919063ffffffff16565b610ee057806040517f620f409a000000000000000000000000000000000000000000000000000000008152600401610ed7919061381d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff167f0503b4748a47435f2432d46ef300e0e2dc47baa0e5f04bb3bd8a355ee1e1dbe660405160405180910390a250565b606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060610f58606a611d5c565b905090565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101b91906138ca565b90506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301d2b6ea6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b091906138ca565b905060008214806110c15750600081145b156110d05783925050506110ec565b8082856110dd9190613926565b6110e791906139af565b925050505b919050565b60606110fd6068611d5c565b905090565b600061110e606861146d565b1415611146576040517f7818a60e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f193361118e34610f87565b6040518363ffffffff1660e01b81526004016111ab929190613a36565b600060405180830381600087803b1580156111c557600080fd5b505af11580156111d9573d6000803e3d6000fd5b505050506111e634611d7d565b565b6111f0611405565b73ffffffffffffffffffffffffffffffffffffffff1661120e610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614611264576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125b90613895565b60405180910390fd5b81606660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080606760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6112f2611405565b73ffffffffffffffffffffffffffffffffffffffff16611310610f5d565b73ffffffffffffffffffffffffffffffffffffffff1614611366576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135d90613895565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113cd90613c87565b60405180910390fd5b6113df81611a8e565b50565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600033905090565b6000611435836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61219a565b905092915050565b6000611465836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6122ae565b905092915050565b600061147b8260000161231e565b9050919050565b60008214156114bd576040517fc60050c000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608060006114cb8561232f565b809850819450829550839650505050506060806114e78761269a565b809250819350505060008383516114fe91906139e0565b67ffffffffffffffff8111156115175761151661352d565b5b6040519080825280602002602001820160405280156115455781602001602082028036833780820191505090505b509050600084845161155791906139e0565b67ffffffffffffffff8111156115705761156f61352d565b5b60405190808252806020026020018201604052801561159e5781602001602082028036833780820191505090505b50905060005b85811015611661578781815181106115bf576115be613ca7565b5b60200260200101518382815181106115da576115d9613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505086818151811061162757611626613ca7565b5b602002602001015182828151811061164257611641613ca7565b5b602002602001018181525050808061165990613cd6565b9150506115a4565b5060005b84518110156117395784818151811061168157611680613ca7565b5b602002602001015183878361169691906139e0565b815181106116a7576116a6613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508381815181106116f4576116f3613ca7565b5b602002602001015182878361170991906139e0565b8151811061171a57611719613ca7565b5b602002602001018181525050808061173190613cd6565b915050611665565b50606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632f842a1a8984846040518463ffffffff1660e01b815260040161179993929190613ddd565b600060405180830381600087803b1580156117b357600080fd5b505af11580156117c7573d6000803e3d6000fd5b50505050505050505050505050565b60006118047f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b612a1a565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611835611405565b73ffffffffffffffffffffffffffffffffffffffff16611853610f5d565b73ffffffffffffffffffffffffffffffffffffffff16146118a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a090613895565b60405180910390fd5b50565b60006118b66117d6565b90506118c184612a24565b6000835111806118ce5750815b156118df576118dd8484612add565b505b600061190d7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914360001b612b0a565b90508060000160009054906101000a900460ff16611a765760018160000160006101000a81548160ff0219169083151502179055506119d98583604051602401611957919061381d565b6040516020818303038152906040527f3659cfe6000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612add565b5060008160000160006101000a81548160ff0219169083151502179055506119ff6117d6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6390613e94565b60405180910390fd5b611a7585612b14565b5b5050505050565b6000611a88306113e2565b15905090565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081603360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060019054906101000a900460ff16611ba3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9a90613f26565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c205761ce10606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c62565b80606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000611c8d836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612b63565b905092915050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed604051602001611ce490613f9d565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611d169190613fcb565b602060405180830381865afa158015611d33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d579190613ffb565b905090565b60606000611d6c83600001612b86565b905060608190508092505050919050565b6000611d8882612be2565b9050600081511415611dc6576040517fd978e43100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606000611dd383612eeb565b80925081935050508381611de791906139e0565b90506000835167ffffffffffffffff811115611e0657611e0561352d565b5b604051908082528060200260200182016040528015611e345781602001602082028036833780820191505090505b50905060008451905060008184611e4b91906139af565b90506000865190505b6000811115611f9f576000600182611e6c9190614028565b905082878281518110611e8257611e81613ca7565b5b60200260200101516020015110611f01578380611e9e9061405c565b945050868181518110611eb457611eb3613ca7565b5b60200260200101516020015186611ecb9190614028565b95508386611ed991906139af565b92506000858281518110611ef057611eef613ca7565b5b602002602001018181525050611f8b565b868181518110611f1457611f13613ca7565b5b60200260200101516020015183611f2b9190614028565b858281518110611f3e57611f3d613ca7565b5b602002602001018181525050808487611f579190614086565b1115611f8a57848181518110611f7057611f6f613ca7565b5b602002602001018051809190611f8590613cd6565b815250505b5b508080611f979061405c565b915050611e54565b5060008267ffffffffffffffff811115611fbc57611fbb61352d565b5b604051908082528060200260200182016040528015611fea5781602001602082028036833780820191505090505b50905060008367ffffffffffffffff8111156120095761200861352d565b5b6040519080825280602002602001820160405280156120375781602001602082028036833780820191505090505b50905060005b848110156120fe5787818151811061205857612057613ca7565b5b60200260200101516000015183828151811061207757612076613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508581815181106120c4576120c3613ca7565b5b60200260200101518282815181106120df576120de613ca7565b5b60200260200101818152505080806120f690613cd6565b91505061203d565b50606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301c21d598a84846040518463ffffffff1660e01b815260040161215d9291906140b7565b6000604051808303818588803b15801561217657600080fd5b505af115801561218a573d6000803e3d6000fd5b5050505050505050505050505050565b600080836001016000848152602001908152602001600020549050600081146122a25760006001826121cc9190614028565b90506000600186600001805490506121e49190614028565b905081811461225357600086600001828154811061220557612204613ca7565b5b906000526020600020015490508087600001848154811061222957612228613ca7565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480612267576122666140ee565b5b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506122a8565b60009150505b92915050565b60006122ba8383612b63565b612313578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612318565b600090505b92915050565b600081600001805490509050919050565b6060806000808490506000612344606a61146d565b90508067ffffffffffffffff8111156123605761235f61352d565b5b60405190808252806020026020018201604052801561238e5781602001602082028036833780820191505090505b5094508067ffffffffffffffff8111156123ab576123aa61352d565b5b6040519080825280602002602001820160405280156123d95781602001602082028036833780820191505090505b5093506000925060005b818110156126915783806123f690613cd6565b94505061240d81606a6130aa90919063ffffffff16565b8682815181106124205761241f613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663acd201d08884815181106124ad576124ac613ca7565b5b60200260200101516040518263ffffffff1660e01b81526004016124d1919061381d565b602060405180830381865afa1580156124ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251291906138ca565b905061251e84826130c4565b86838151811061253157612530613ca7565b5b6020026020010181815250508582815181106125505761254f613ca7565b5b6020026020010151846125639190614028565b935085828151811061257857612577613ca7565b5b602002602001015181141561266e576125b587838151811061259d5761259c613ca7565b5b6020026020010151606a61140d90919063ffffffff16565b612610578682815181106125cc576125cb613ca7565b5b60200260200101516040517fbe8534b7000000000000000000000000000000000000000000000000000000008152600401612607919061381d565b60405180910390fd5b86828151811061262357612622613ca7565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167fa78a88a551e130ce9732be17784bdff12f72ab4a2c833fb2dcb3ef0818956b0360405160405180910390a25b600084141561267d5750612691565b50808061268990613cd6565b9150506123e3565b50509193509193565b606080600083141561274d5760008067ffffffffffffffff8111156126c2576126c161352d565b5b6040519080825280602002602001820160405280156126f05781602001602082028036833780820191505090505b50905060008067ffffffffffffffff81111561270f5761270e61352d565b5b60405190808252806020026020018201604052801561273d5781602001602082028036833780820191505090505b5090508181935093505050612a15565b6000612759606861146d565b90506060600061277161276c6068611d5c565b612eeb565b809250819350505085816127859190614028565b905060008390506000818361279a91906139af565b905060005b8581101561283157818582815181106127bb576127ba613ca7565b5b602002602001015160200151116128195782806127d79061405c565b9350508481815181106127ed576127ec613ca7565b5b602002602001015160200151846128049190614028565b9350828461281291906139af565b915061281e565b612831565b808061282990613cd6565b91505061279f565b5060008267ffffffffffffffff81111561284e5761284d61352d565b5b60405190808252806020026020018201604052801561287c5781602001602082028036833780820191505090505b50905060008367ffffffffffffffff81111561289b5761289a61352d565b5b6040519080825280602002602001820160405280156128c95781602001602082028036833780820191505090505b509050600084886128da9190614028565b905060005b85811015612a05578782826128f491906139e0565b8151811061290557612904613ca7565b5b60200260200101516000015183828151811061292457612923613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508488838361296c91906139e0565b8151811061297d5761297c613ca7565b5b6020026020010151602001516129939190614028565b8482815181106129a6576129a5613ca7565b5b6020026020010181815250508086886129bf9190614086565b11156129f2578381815181106129d8576129d7613ca7565b5b6020026020010180518091906129ed9061405c565b815250505b80806129fd90613cd6565b9150506128df565b5081839950995050505050505050505b915091565b6000819050919050565b612a2d816130dd565b612a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a639061418f565b60405180910390fd5b80612a997f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b612a1a565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6060612b02838360405180606001604052806027815260200161439e602791396130f0565b905092915050565b6000819050919050565b612b1d81612a24565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b600080836001016000848152602001908152602001600020541415905092915050565b606081600001805480602002602001604051908101604052809291908181526020018280548015612bd657602002820191906000526020600020905b815481526020019060010190808311612bc2575b50505050509050919050565b60606000612bf0606861146d565b90506000808267ffffffffffffffff811115612c0f57612c0e61352d565b5b604051908082528060200260200182016040528015612c3d5781602001602082028036833780820191505090505b50905060005b83811015612e0a576000612c618260686130aa90919063ffffffff16565b90506000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fd5c95e836040518263ffffffff1660e01b8152600401612cc0919061381d565b6020604051808303816000875af1158015612cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0391906138ca565b9050612d0d611c95565b73ffffffffffffffffffffffffffffffffffffffff1663e59ea3e883838b612d3591906139e0565b6040518363ffffffff1660e01b8152600401612d52929190613a36565b602060405180830381865afa158015612d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d9391906141e7565b15612df55781848681518110612dac57612dab613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508480612df190613cd6565b9550505b50508080612e0290613cd6565b915050612c43565b5060008267ffffffffffffffff811115612e2757612e2661352d565b5b604051908082528060200260200182016040528015612e555781602001602082028036833780820191505090505b50905060005b83811015612ede57828181518110612e7657612e75613ca7565b5b6020026020010151828281518110612e9157612e90613ca7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080612ed690613cd6565b915050612e5b565b5080945050505050919050565b6060600080835167ffffffffffffffff811115612f0b57612f0a61352d565b5b604051908082528060200260200182016040528015612f4457816020015b612f31613376565b815260200190600190039081612f295790505b5090506000805b8551811015613093576000606760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663acd201d0888481518110612fa757612fa6613ca7565b5b60200260200101516040518263ffffffff1660e01b8152600401612fcb919061381d565b602060405180830381865afa158015612fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300c91906138ca565b9050808361301a91906139e0565b9250604051806040016040528088848151811061303a57613039613ca7565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018281525084838151811061307457613073613ca7565b5b602002602001018190525050808061308b90613cd6565b915050612f4b565b5061309d826131bd565b8181935093505050915091565b60006130b983600001836132e4565b60001c905092915050565b60008183106130d357816130d5565b825b905092915050565b600080823b905060008111915050919050565b60606130fb846130dd565b61313a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161313190614286565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516131629190614320565b600060405180830381855af49150503d806000811461319d576040519150601f19603f3d011682016040523d82523d6000602084013e6131a2565b606091505b50915091506131b282828661330f565b925050509392505050565b6000600190505b81518110156132e05760008190505b60008111801561322a5750826001826131ec9190614028565b815181106131fd576131fc613ca7565b5b60200260200101516020015183828151811061321c5761321b613ca7565b5b602002602001015160200151105b156132cc578260018261323d9190614028565b8151811061324e5761324d613ca7565b5b602002602001015183828151811061326957613268613ca7565b5b602002602001015184838151811061328457613283613ca7565b5b60200260200101856001856132999190614028565b815181106132aa576132a9613ca7565b5b60200260200101829052829052505080806132c49061405c565b9150506131d3565b5080806132d890613cd6565b9150506131c4565b5050565b60008260000182815481106132fc576132fb613ca7565b5b9060005260206000200154905092915050565b6060831561331f5782905061336f565b6000835111156133325782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613366919061437b565b60405180910390fd5b9392505050565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006133e5826133ba565b9050919050565b6133f5816133da565b811461340057600080fd5b50565b600081359050613412816133ec565b92915050565b60006020828403121561342e5761342d6133b0565b5b600061343c84828501613403565b91505092915050565b6000819050919050565b61345881613445565b811461346357600080fd5b50565b6000813590506134758161344f565b92915050565b600060208284031215613491576134906133b0565b5b600061349f84828501613466565b91505092915050565b6134b181613445565b82525050565b60006020820190506134cc60008301846134a8565b92915050565b600080604083850312156134e9576134e86133b0565b5b60006134f785828601613403565b925050602061350885828601613403565b9150509250929050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6135658261351c565b810181811067ffffffffffffffff821117156135845761358361352d565b5b80604052505050565b60006135976133a6565b90506135a3828261355c565b919050565b600067ffffffffffffffff8211156135c3576135c261352d565b5b6135cc8261351c565b9050602081019050919050565b82818337600083830152505050565b60006135fb6135f6846135a8565b61358d565b90508281526020810184848401111561361757613616613517565b5b6136228482856135d9565b509392505050565b600082601f83011261363f5761363e613512565b5b813561364f8482602086016135e8565b91505092915050565b6000806040838503121561366f5761366e6133b0565b5b600061367d85828601613403565b925050602083013567ffffffffffffffff81111561369e5761369d6133b5565b5b6136aa8582860161362a565b9150509250929050565b6000819050919050565b60006136d96136d46136cf846133ba565b6136b4565b6133ba565b9050919050565b60006136eb826136be565b9050919050565b60006136fd826136e0565b9050919050565b61370d816136f2565b82525050565b60006020820190506137286000830184613704565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613763816133da565b82525050565b6000613775838361375a565b60208301905092915050565b6000602082019050919050565b60006137998261372e565b6137a38185613739565b93506137ae8361374a565b8060005b838110156137df5781516137c68882613769565b97506137d183613781565b9250506001810190506137b2565b5085935050505092915050565b60006020820190508181036000830152613806818461378e565b905092915050565b613817816133da565b82525050565b6000602082019050613832600083018461380e565b92915050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061387f602083613838565b915061388a82613849565b602082019050919050565b600060208201905081810360008301526138ae81613872565b9050919050565b6000815190506138c48161344f565b92915050565b6000602082840312156138e0576138df6133b0565b5b60006138ee848285016138b5565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061393182613445565b915061393c83613445565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613975576139746138f7565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006139ba82613445565b91506139c583613445565b9250826139d5576139d4613980565b5b828204905092915050565b60006139eb82613445565b91506139f683613445565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a2b57613a2a6138f7565b5b828201905092915050565b6000604082019050613a4b600083018561380e565b613a5860208301846134a8565b9392505050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f64656c656761746563616c6c0000000000000000000000000000000000000000602082015250565b6000613abb602c83613838565b9150613ac682613a5f565b604082019050919050565b60006020820190508181036000830152613aea81613aae565b9050919050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f6163746976652070726f78790000000000000000000000000000000000000000602082015250565b6000613b4d602c83613838565b9150613b5882613af1565b604082019050919050565b60006020820190508181036000830152613b7c81613b40565b9050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000613bdf602e83613838565b9150613bea82613b83565b604082019050919050565b60006020820190508181036000830152613c0e81613bd2565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613c71602683613838565b9150613c7c82613c15565b604082019050919050565b60006020820190508181036000830152613ca081613c64565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000613ce182613445565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d1457613d136138f7565b5b600182019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613d5481613445565b82525050565b6000613d668383613d4b565b60208301905092915050565b6000602082019050919050565b6000613d8a82613d1f565b613d948185613d2a565b9350613d9f83613d3b565b8060005b83811015613dd0578151613db78882613d5a565b9750613dc283613d72565b925050600181019050613da3565b5085935050505092915050565b6000606082019050613df2600083018661380e565b8181036020830152613e04818561378e565b90508181036040830152613e188184613d7f565b9050949350505050565b7f45524331393637557067726164653a207570677261646520627265616b73206660008201527f7572746865722075706772616465730000000000000000000000000000000000602082015250565b6000613e7e602f83613838565b9150613e8982613e22565b604082019050919050565b60006020820190508181036000830152613ead81613e71565b9050919050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b6000613f10602b83613838565b9150613f1b82613eb4565b604082019050919050565b60006020820190508181036000830152613f3f81613f03565b9050919050565b600081905092915050565b7f456c656374696f6e000000000000000000000000000000000000000000000000600082015250565b6000613f87600883613f46565b9150613f9282613f51565b600882019050919050565b6000613fa882613f7a565b9150819050919050565b6000819050919050565b613fc581613fb2565b82525050565b6000602082019050613fe06000830184613fbc565b92915050565b600081519050613ff5816133ec565b92915050565b600060208284031215614011576140106133b0565b5b600061401f84828501613fe6565b91505092915050565b600061403382613445565b915061403e83613445565b925082821015614051576140506138f7565b5b828203905092915050565b600061406782613445565b9150600082141561407b5761407a6138f7565b5b600182039050919050565b600061409182613445565b915061409c83613445565b9250826140ac576140ab613980565b5b828206905092915050565b600060408201905081810360008301526140d1818561378e565b905081810360208301526140e58184613d7f565b90509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60008201527f6f74206120636f6e747261637400000000000000000000000000000000000000602082015250565b6000614179602d83613838565b91506141848261411d565b604082019050919050565b600060208201905081810360008301526141a88161416c565b9050919050565b60008115159050919050565b6141c4816141af565b81146141cf57600080fd5b50565b6000815190506141e1816141bb565b92915050565b6000602082840312156141fd576141fc6133b0565b5b600061420b848285016141d2565b91505092915050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b6000614270602683613838565b915061427b82614214565b604082019050919050565b6000602082019050818103600083015261429f81614263565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156142da5780820151818401526020810190506142bf565b838111156142e9576000848401525b50505050565b60006142fa826142a6565b61430481856142b1565b93506143148185602086016142bc565b80840191505092915050565b600061432c82846142ef565b915081905092915050565b600081519050919050565b600061434d82614337565b6143578185613838565b93506143678185602086016142bc565b6143708161351c565b840191505092915050565b600060208201905081810360008301526143958184614342565b90509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220091ef2319acaa9ad8cfdcb62797da14261fe0106a4a14924d32a8a420cff9efe64736f6c634300080b0033