Address Details
contract

0x3DdEc31b0D6139B678E5156152173d6762144762

Contract Name
GroupHealth
Creator
0x5bc1c4–68a788 at 0x20edd7–fcd565
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
17704842
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
GroupHealth




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




EVM Version
istanbul




Verified at
2023-05-12T12:12:08.248787Z

contracts/GroupHealth.sol

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

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

import "./common/UsingRegistryUpgradeable.sol";
import "./common/UUPSOwnableUpgradeable.sol";

/**
 * @title GroupHealth stores and updates info about validator group health.
 */
contract GroupHealth is UUPSOwnableUpgradeable, UsingRegistryUpgradeable {
    using EnumerableSet for EnumerableSet.AddressSet;

    /**
     * @notice Mapping that stores health state of groups.
     */
    mapping(address => bool) public isGroupValid;

    /**
     * @notice Used as helper varible during call to `areGroupMembersElected`.
     */
    mapping(address => bool) private membersMappingHelper;

    /**
     * @notice Emitted when `updateGroupHealth` called.
     * @param group The group's address.
     * @param healthy Whether or not group is healthy.
     */
    event GroupHealthUpdated(address group, bool healthy);

    /**
     * @notice Used when checking elected validator group members
     * but there is member length and indexes length mismatch.
     */
    error MembersLengthMismatch();

    /**
     * @notice Used when calling `markGroupHealthy` on already healthy group.
     * @param group The group's address.
     */
    error GroupHealthy(address group);

    /**
     * @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 Returns the storage, major, minor, and patch version of the contract.
     * @return Storage version of the contract.
     * @return Major version of the contract.
     * @return Minor version of the contract.
     * @return Patch version of the contract.
     */
    function getVersionNumber()
        external
        pure
        returns (
            uint256,
            uint256,
            uint256,
            uint256
        )
    {
        return (1, 1, 0, 0);
    }

    /**
     * @notice Updates validator group health.
     * @param group The group address.
     */
    function updateGroupHealth(address group) public {
        IValidators validators = getValidators();

        (bool valid, address[] memory members) = _isGroupPartiallyValid(validators, group);
        if (valid) {
            valid = areGroupMembersElected(members);
        }

        if (isGroupValid[group] != valid) {
            isGroupValid[group] = valid;
            emit GroupHealthUpdated(group, valid);
        }
    }

    /**
     * @notice Updates validator group to healthy if eligible.
     * @param group The group's address.
     * @param membersElectedIndex The indexes of elected members.
     * This array needs to have same length as all (even not elected) members of validator group.
     * Index of not elected member can be any uint256 number.
     */
    function markGroupHealthy(address group, uint256[] calldata membersElectedIndex) public {
        if (isGroupValid[group] == true) {
            revert GroupHealthy(group);
        }

        IValidators validators = getValidators();

        (bool valid, address[] memory members) = _isGroupPartiallyValid(validators, group);

        if (!valid) {
            return;
        }

        if (membersElectedIndex.length != members.length) {
            revert MembersLengthMismatch();
        }

        uint256 currentNumberOfElectedValidators = numberValidatorsInCurrentSet();
        // check that at least one member is elected.
        for (uint256 i = 0; i < members.length; i++) {
            if (
                isGroupMemberElected(
                    members[i],
                    membersElectedIndex[i],
                    currentNumberOfElectedValidators
                )
            ) {
                isGroupValid[group] = true;
                emit GroupHealthUpdated(group, true);
                return;
            }
        }
    }

    /**
     * @notice Gets a validator address from the current validator set.
     * @param index Index of requested validator in the validator set.
     * @return Address of validator at the requested index.
     */
    function validatorSignerAddressFromCurrentSet(uint256 index)
        internal
        view
        virtual
        returns (address)
    {
        return getElection().validatorSignerAddressFromCurrentSet(index);
    }

    /**
     * @notice Gets the size of the current elected validator set.
     * @return Size of the current elected validator set.
     */
    function numberValidatorsInCurrentSet() internal view virtual returns (uint256) {
        return getElection().numberValidatorsInCurrentSet();
    }

    /**
     * @notice Checks if a group member is elected.
     * @param groupMember The member of the group to check election status for.
     * @param index The index of elected validator in current set.
     * @param currentNumberOfElectedValidators The count of currently elected validators.
     * @return Whether or not the group member is elected.
     */
    function isGroupMemberElected(
        address groupMember,
        uint256 index,
        uint256 currentNumberOfElectedValidators
    ) internal view returns (bool) {
        if (index > currentNumberOfElectedValidators) {
            return false;
        }
        return validatorSignerAddressFromCurrentSet(index) == groupMember;
    }

    /**
     * @notice Checks if any of group members are elected.
     * @param members All group members of checked validator group.
     * @return Whether or not any of the group members are elected.
     */
    function areGroupMembersElected(address[] memory members) private returns (bool) {
        for (uint256 j = 0; j < members.length; j++) {
            membersMappingHelper[members[j]] = true;
        }

        bool result;
        address validator;
        uint256 n = numberValidatorsInCurrentSet();
        for (uint256 i = 0; i < n; i++) {
            validator = validatorSignerAddressFromCurrentSet(i);
            if (membersMappingHelper[validator] == true) {
                result = true;
                break;
            }
        }

        for (uint256 j = 0; j < members.length; j++) {
            delete membersMappingHelper[members[j]];
        }
        return result;
    }

    /**
     * Checks group validator status, members and slashing multiplier.
     * @param validators Validators contract.
     * @param group The group to check.
     * @return Whether the group passed checks.
     * @return members The members of the validator group.
     */
    function _isGroupPartiallyValid(IValidators validators, address group)
        private
        view
        returns (bool, address[] memory members)
    {
        if (!validators.isValidatorGroup(group)) {
            return (false, members);
        }

        uint256 slashMultiplier;
        (members, , , , , slashMultiplier, ) = validators.getValidatorGroup(group);
        // check if group has no members
        if (members.length == 0) {
            return (false, members);
        }
        // check for recent slash
        if (slashMultiplier < 10**24) {
            return (false, members);
        }

        return (true, members);
    }
}
        

/_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";
import "../interfaces/IGovernance.sol";
import "../interfaces/IValidators.sol";

/**
 * @title A helper for getting Celo core contracts from the Registry.
 */
abstract contract UsingRegistryUpgradeable is Initializable {
    /// @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 ID for the Governance contract.
    bytes32 private constant GOVERNANCE_REGISTRY_ID = keccak256(abi.encodePacked("Governance"));

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

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

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

    /**
     * @notice Gets the Governance contract from the Registry.
     * @return The Governance contract from the Registry.
     */
    function getGovernance() internal view returns (IGovernance) {
        return IGovernance(registry.getAddressForOrDie(GOVERNANCE_REGISTRY_ID));
    }

    /**
     * @notice Gets the validators contract from the Registry.
     * @return The validators contract from the Registry.
     */
    function getValidators() internal view returns (IValidators) {
        return IValidators(registry.getAddressForOrDie(VALIDATORS_REGISTRY_ID));
    }
}
          

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

    // 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 allowedToVoteOverMaxNumberOfGroups(address) external returns (bool);

    function setAllowedToVoteOverMaxNumberOfGroups(bool flag) external;

    // view functions
    function electValidatorSigners() external view returns (address[] memory);

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

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

    function maxNumGroupsVotedFor() external view returns (uint256);

    function validatorSignerAddressFromCurrentSet(uint256 index) external view returns (address);

    function numberValidatorsInCurrentSet() external view returns (uint256);

    function getEpochNumber() 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/IGovernance.sol

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

interface IGovernance {
    function votePartially(
        uint256 proposalId,
        uint256 index,
        uint256 yesVotes,
        uint256 noVotes,
        uint256 abstainVotes
    ) external returns (bool);

    function getProposal(uint256 proposalId)
        external
        view
        returns (
            address,
            uint256,
            uint256,
            uint256,
            string memory
        );

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

/contracts/interfaces/ILockedGold.sol

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

interface ILockedGold {
    function lock() external payable;

    function incrementNonvotingAccountBalance(address, uint256) external;

    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 decrementNonvotingAccountBalance(address, uint256) external;

    function unlockingPeriod() external view returns (uint256);

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

    function getTotalLockedGold() external view returns (uint256);

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

    function getSlashingWhitelist() external view returns (bytes32[] memory);

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

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

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

    function owner() external view returns (address);

    function getAccountNonvotingLockedGold(address account) external view returns (uint256);
}
          

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

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

interface IValidators {
    function registerValidator(
        bytes calldata,
        bytes calldata,
        bytes calldata
    ) external returns (bool);

    function deregisterValidator(uint256) external returns (bool);

    function affiliate(address) external returns (bool);

    function deaffiliate() external returns (bool);

    function updateBlsPublicKey(bytes calldata, bytes calldata) external returns (bool);

    function registerValidatorGroup(uint256) external returns (bool);

    function deregisterValidatorGroup(uint256) external returns (bool);

    function addMember(address) external returns (bool);

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

    function removeMember(address) external returns (bool);

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

    function updateCommission() external;

    function setNextCommissionUpdate(uint256) external;

    function resetSlashingMultiplier() external;

    // only owner
    function setCommissionUpdateDelay(uint256) external;

    function setMaxGroupSize(uint256) external returns (bool);

    function setMembershipHistoryLength(uint256) external returns (bool);

    function setValidatorScoreParameters(uint256, uint256) external returns (bool);

    function setGroupLockedGoldRequirements(uint256, uint256) external returns (bool);

    function setValidatorLockedGoldRequirements(uint256, uint256) external returns (bool);

    function setSlashingMultiplierResetPeriod(uint256) external;

    // view functions
    function getMaxGroupSize() external view returns (uint256);

    function getCommissionUpdateDelay() external view returns (uint256);

    function getValidatorScoreParameters() external view returns (uint256, uint256);

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

    function calculateEpochScore(uint256) external view returns (uint256);

    function calculateGroupEpochScore(uint256[] calldata) external view returns (uint256);

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

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

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

    function getValidator(address account)
        external
        view
        returns (
            bytes memory,
            bytes memory,
            address,
            uint256,
            address
        );

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

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

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

    function getGroupsNumMembers(address[] calldata accounts)
        external
        view
        returns (uint256[] memory);

    function getNumRegisteredValidators() external view returns (uint256);

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

    // only registered contract
    function updateEcdsaPublicKey(
        address,
        address,
        bytes calldata
    ) external returns (bool);

    function updatePublicKeys(
        address,
        address,
        bytes calldata,
        bytes calldata,
        bytes calldata
    ) external returns (bool);

    function getValidatorLockedGoldRequirements() external view returns (uint256, uint256);

    function getGroupLockedGoldRequirements() external view returns (uint256, uint256);

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

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

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

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

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

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

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

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

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

    function distributeEpochPaymentsFromSigner(address, uint256) external returns (uint256);

    // only slasher
    function forceDeaffiliateIfValidator(address) external;

    function halveSlashingMultiplier(address) external;
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"GroupHealthy","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"MembersLengthMismatch","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":"GroupHealthUpdated","inputs":[{"type":"address","name":"group","internalType":"address","indexed":false},{"type":"bool","name":"healthy","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersionNumber","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":"bool","name":"","internalType":"bool"}],"name":"isGroupValid","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"markGroupHealthy","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"uint256[]","name":"membersElectedIndex","internalType":"uint256[]"}]},{"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":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateGroupHealth","inputs":[{"type":"address","name":"group","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"}]}]
              

Contract Creation Code

0x60a06040523073ffffffffffffffffffffffffffffffffffffffff1660809073ffffffffffffffffffffffffffffffffffffffff168152503480156200004457600080fd5b50600060019054906101000a900460ff166200006f5760008054906101000a900460ff161562000080565b6200007f6200013c60201b60201c565b5b620000c2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000b99062000204565b60405180910390fd5b60008060019054906101000a900460ff16159050801562000113576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b8015620001355760008060016101000a81548160ff0219169083151502179055505b5062000226565b600062000154306200015a60201b62000b591760201c565b15905090565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600082825260208201905092915050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000620001ec602e836200017d565b9150620001f9826200018e565b604082019050919050565b600060208201905081810360008301526200021f81620001dd565b9050919050565b6080516128d06200025760003960008181610264015281816102f3015281816104e5015261057401526128d06000f3fe60806040526004361061009c5760003560e01c80637b103999116100645780637b103999146101545780638da5cb5b1461017f578063ab80c89f146101aa578063ac8f4425146101d3578063d1d36d3314610210578063f2fde38b146102395761009c565b80633659cfe6146100a1578063485cc955146100ca5780634f1ef286146100f357806354255be01461010f578063715018a61461013d575b600080fd5b3480156100ad57600080fd5b506100c860048036038101906100c39190611928565b610262565b005b3480156100d657600080fd5b506100f160048036038101906100ec9190611955565b6103eb565b005b61010d60048036038101906101089190611adb565b6104e3565b005b34801561011b57600080fd5b50610124610620565b6040516101349493929190611b50565b60405180910390f35b34801561014957600080fd5b5061015261063a565b005b34801561016057600080fd5b506101696106c2565b6040516101769190611bf4565b60405180910390f35b34801561018b57600080fd5b506101946106e8565b6040516101a19190611c1e565b60405180910390f35b3480156101b657600080fd5b506101d160048036038101906101cc9190611928565b610712565b005b3480156101df57600080fd5b506101fa60048036038101906101f59190611928565b61082f565b6040516102079190611c54565b60405180910390f35b34801561021c57600080fd5b5061023760048036038101906102329190611ccf565b61084f565b005b34801561024557600080fd5b50610260600480360381019061025b9190611928565b610a61565b005b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614156102f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e890611db2565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610330610b7c565b73ffffffffffffffffffffffffffffffffffffffff1614610386576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037d90611e44565b60405180910390fd5b61038f81610bd3565b6103e881600067ffffffffffffffff8111156103ae576103ad6119b0565b5b6040519080825280601f01601f1916602001820160405280156103e05781602001600182028036833780820191505090505b506000610c52565b50565b600060019054906101000a900460ff166104135760008054906101000a900460ff161561041c565b61041b610e23565b5b61045b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045290611ed6565b60405180910390fd5b60008060019054906101000a900460ff1615905080156104ab576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6104b482610e34565b6104bd83610efa565b80156104de5760008060016101000a81548160ff0219169083151502179055505b505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161415610572576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056990611db2565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166105b1610b7c565b73ffffffffffffffffffffffffffffffffffffffff1614610607576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fe90611e44565b60405180910390fd5b61061082610bd3565b61061c82826001610c52565b5050565b600080600080600180600080935093509350935090919293565b61064261100b565b73ffffffffffffffffffffffffffffffffffffffff166106606106e8565b73ffffffffffffffffffffffffffffffffffffffff16146106b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ad90611f42565b60405180910390fd5b6106c06000610e34565b565b606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061071c611013565b905060008061072b83856110da565b9150915081156107415761073e8161123e565b91505b811515606660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146108295781606660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faf5c4c2ab440a2f535091c2b12e69b4e83bb351ba27a46c77aa7cf85fbdfde7e8483604051610820929190611f62565b60405180910390a15b50505050565b60666020528060005260406000206000915054906101000a900460ff1681565b60011515606660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156108e557826040517f5e5e76170000000000000000000000000000000000000000000000000000000081526004016108dc9190611c1e565b60405180910390fd5b60006108ef611013565b90506000806108fe83876110da565b915091508161090f57505050610a5c565b8051858590501461094c576040517f738ca2d100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610956611404565b905060005b8251811015610a56576109a283828151811061097a57610979611f8b565b5b602002602001015188888481811061099557610994611f8b565b5b9050602002013584611481565b15610a43576001606660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faf5c4c2ab440a2f535091c2b12e69b4e83bb351ba27a46c77aa7cf85fbdfde7e886001604051610a31929190611f62565b60405180910390a15050505050610a5c565b8080610a4e90611fe9565b91505061095b565b50505050505b505050565b610a6961100b565b73ffffffffffffffffffffffffffffffffffffffff16610a876106e8565b73ffffffffffffffffffffffffffffffffffffffff1614610add576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad490611f42565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b44906120a4565b60405180910390fd5b610b5681610e34565b50565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000610baa7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6114d5565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610bdb61100b565b73ffffffffffffffffffffffffffffffffffffffff16610bf96106e8565b73ffffffffffffffffffffffffffffffffffffffff1614610c4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4690611f42565b60405180910390fd5b50565b6000610c5c610b7c565b9050610c67846114df565b600083511180610c745750815b15610c8557610c838484611598565b505b6000610cb37f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914360001b6115c5565b90508060000160009054906101000a900460ff16610e1c5760018160000160006101000a81548160ff021916908315150217905550610d7f8583604051602401610cfd9190611c1e565b6040516020818303038152906040527f3659cfe6000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611598565b5060008160000160006101000a81548160ff021916908315150217905550610da5610b7c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610e12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0990612136565b60405180910390fd5b610e1b856115cf565b5b5050505050565b6000610e2e30610b59565b15905090565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081603360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060019054906101000a900460ff16610f49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f40906121c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fc65761ce10606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611008565b80606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600033905090565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed6040516020016110629061223f565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611094919061226d565b602060405180830381865afa1580156110b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d5919061229d565b905090565b600060608373ffffffffffffffffffffffffffffffffffffffff166352f13a4e846040518263ffffffff1660e01b81526004016111179190611c1e565b602060405180830381865afa158015611134573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115891906122f6565b6111655760009150611237565b60008473ffffffffffffffffffffffffffffffffffffffff16639b9d5161856040518263ffffffff1660e01b81526004016111a09190611c1e565b600060405180830381865afa1580156111bd573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906111e691906124d5565b909192939450909192935090919250909150508092508193505050600082511415611215576000925050611237565b69d3c21bcecceda1000000811015611231576000925050611237565b60019250505b9250929050565b600080600090505b82518110156112d45760016067600085848151811061126857611267611f8b565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806112cc90611fe9565b915050611246565b5060008060006112e2611404565b905060005b8181101561136f576112f88161161e565b925060011515606760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561135c576001935061136f565b808061136790611fe9565b9150506112e7565b5060005b85518110156113f8576067600087838151811061139357611392611f8b565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905580806113f090611fe9565b915050611373565b50829350505050919050565b600061140e6116a8565b73ffffffffffffffffffffffffffffffffffffffff166387ee8a0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147c91906125af565b905090565b60008183111561149457600090506114ce565b8373ffffffffffffffffffffffffffffffffffffffff166114b48461161e565b73ffffffffffffffffffffffffffffffffffffffff161490505b9392505050565b6000819050919050565b6114e88161176f565b611527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151e9061264e565b60405180910390fd5b806115547f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6114d5565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606115bd838360405180606001604052806027815260200161287460279139611782565b905092915050565b6000819050919050565b6115d8816114df565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b60006116286116a8565b73ffffffffffffffffffffffffffffffffffffffff1663123633ea836040518263ffffffff1660e01b8152600401611660919061266e565b602060405180830381865afa15801561167d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a1919061229d565b9050919050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed6040516020016116f7906126d5565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611729919061226d565b602060405180830381865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a919061229d565b905090565b600080823b905060008111915050919050565b606061178d8461176f565b6117cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c39061275c565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516117f491906127f6565b600060405180830381855af49150503d806000811461182f576040519150601f19603f3d011682016040523d82523d6000602084013e611834565b606091505b509150915061184482828661184f565b925050509392505050565b6060831561185f578290506118af565b6000835111156118725782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a69190612851565b60405180910390fd5b9392505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118f5826118ca565b9050919050565b611905816118ea565b811461191057600080fd5b50565b600081359050611922816118fc565b92915050565b60006020828403121561193e5761193d6118c0565b5b600061194c84828501611913565b91505092915050565b6000806040838503121561196c5761196b6118c0565b5b600061197a85828601611913565b925050602061198b85828601611913565b9150509250929050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6119e88261199f565b810181811067ffffffffffffffff82111715611a0757611a066119b0565b5b80604052505050565b6000611a1a6118b6565b9050611a2682826119df565b919050565b600067ffffffffffffffff821115611a4657611a456119b0565b5b611a4f8261199f565b9050602081019050919050565b82818337600083830152505050565b6000611a7e611a7984611a2b565b611a10565b905082815260208101848484011115611a9a57611a9961199a565b5b611aa5848285611a5c565b509392505050565b600082601f830112611ac257611ac1611995565b5b8135611ad2848260208601611a6b565b91505092915050565b60008060408385031215611af257611af16118c0565b5b6000611b0085828601611913565b925050602083013567ffffffffffffffff811115611b2157611b206118c5565b5b611b2d85828601611aad565b9150509250929050565b6000819050919050565b611b4a81611b37565b82525050565b6000608082019050611b656000830187611b41565b611b726020830186611b41565b611b7f6040830185611b41565b611b8c6060830184611b41565b95945050505050565b6000819050919050565b6000611bba611bb5611bb0846118ca565b611b95565b6118ca565b9050919050565b6000611bcc82611b9f565b9050919050565b6000611bde82611bc1565b9050919050565b611bee81611bd3565b82525050565b6000602082019050611c096000830184611be5565b92915050565b611c18816118ea565b82525050565b6000602082019050611c336000830184611c0f565b92915050565b60008115159050919050565b611c4e81611c39565b82525050565b6000602082019050611c696000830184611c45565b92915050565b600080fd5b600080fd5b60008083601f840112611c8f57611c8e611995565b5b8235905067ffffffffffffffff811115611cac57611cab611c6f565b5b602083019150836020820283011115611cc857611cc7611c74565b5b9250929050565b600080600060408486031215611ce857611ce76118c0565b5b6000611cf686828701611913565b935050602084013567ffffffffffffffff811115611d1757611d166118c5565b5b611d2386828701611c79565b92509250509250925092565b600082825260208201905092915050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f64656c656761746563616c6c0000000000000000000000000000000000000000602082015250565b6000611d9c602c83611d2f565b9150611da782611d40565b604082019050919050565b60006020820190508181036000830152611dcb81611d8f565b9050919050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f6163746976652070726f78790000000000000000000000000000000000000000602082015250565b6000611e2e602c83611d2f565b9150611e3982611dd2565b604082019050919050565b60006020820190508181036000830152611e5d81611e21565b9050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000611ec0602e83611d2f565b9150611ecb82611e64565b604082019050919050565b60006020820190508181036000830152611eef81611eb3565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611f2c602083611d2f565b9150611f3782611ef6565b602082019050919050565b60006020820190508181036000830152611f5b81611f1f565b9050919050565b6000604082019050611f776000830185611c0f565b611f846020830184611c45565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611ff482611b37565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561202757612026611fba565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061208e602683611d2f565b915061209982612032565b604082019050919050565b600060208201905081810360008301526120bd81612081565b9050919050565b7f45524331393637557067726164653a207570677261646520627265616b73206660008201527f7572746865722075706772616465730000000000000000000000000000000000602082015250565b6000612120602f83611d2f565b915061212b826120c4565b604082019050919050565b6000602082019050818103600083015261214f81612113565b9050919050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b60006121b2602b83611d2f565b91506121bd82612156565b604082019050919050565b600060208201905081810360008301526121e1816121a5565b9050919050565b600081905092915050565b7f56616c696461746f727300000000000000000000000000000000000000000000600082015250565b6000612229600a836121e8565b9150612234826121f3565b600a82019050919050565b600061224a8261221c565b9150819050919050565b6000819050919050565b61226781612254565b82525050565b6000602082019050612282600083018461225e565b92915050565b600081519050612297816118fc565b92915050565b6000602082840312156122b3576122b26118c0565b5b60006122c184828501612288565b91505092915050565b6122d381611c39565b81146122de57600080fd5b50565b6000815190506122f0816122ca565b92915050565b60006020828403121561230c5761230b6118c0565b5b600061231a848285016122e1565b91505092915050565b600067ffffffffffffffff82111561233e5761233d6119b0565b5b602082029050602081019050919050565b600061236261235d84612323565b611a10565b9050808382526020820190506020840283018581111561238557612384611c74565b5b835b818110156123ae578061239a8882612288565b845260208401935050602081019050612387565b5050509392505050565b600082601f8301126123cd576123cc611995565b5b81516123dd84826020860161234f565b91505092915050565b6123ef81611b37565b81146123fa57600080fd5b50565b60008151905061240c816123e6565b92915050565b600067ffffffffffffffff82111561242d5761242c6119b0565b5b602082029050602081019050919050565b600061245161244c84612412565b611a10565b9050808382526020820190506020840283018581111561247457612473611c74565b5b835b8181101561249d578061248988826123fd565b845260208401935050602081019050612476565b5050509392505050565b600082601f8301126124bc576124bb611995565b5b81516124cc84826020860161243e565b91505092915050565b600080600080600080600060e0888a0312156124f4576124f36118c0565b5b600088015167ffffffffffffffff811115612512576125116118c5565b5b61251e8a828b016123b8565b975050602061252f8a828b016123fd565b96505060406125408a828b016123fd565b95505060606125518a828b016123fd565b945050608088015167ffffffffffffffff811115612572576125716118c5565b5b61257e8a828b016124a7565b93505060a061258f8a828b016123fd565b92505060c06125a08a828b016123fd565b91505092959891949750929550565b6000602082840312156125c5576125c46118c0565b5b60006125d3848285016123fd565b91505092915050565b7f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60008201527f6f74206120636f6e747261637400000000000000000000000000000000000000602082015250565b6000612638602d83611d2f565b9150612643826125dc565b604082019050919050565b600060208201905081810360008301526126678161262b565b9050919050565b60006020820190506126836000830184611b41565b92915050565b7f456c656374696f6e000000000000000000000000000000000000000000000000600082015250565b60006126bf6008836121e8565b91506126ca82612689565b600882019050919050565b60006126e0826126b2565b9150819050919050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b6000612746602683611d2f565b9150612751826126ea565b604082019050919050565b6000602082019050818103600083015261277581612739565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156127b0578082015181840152602081019050612795565b838111156127bf576000848401525b50505050565b60006127d08261277c565b6127da8185612787565b93506127ea818560208601612792565b80840191505092915050565b600061280282846127c5565b915081905092915050565b600081519050919050565b60006128238261280d565b61282d8185611d2f565b935061283d818560208601612792565b6128468161199f565b840191505092915050565b6000602082019050818103600083015261286b8184612818565b90509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208bac660b664977e8638d60ad9e5fa446bb79855e8ac9cdc934a084f414464dd064736f6c634300080b0033

Deployed ByteCode

0x60806040526004361061009c5760003560e01c80637b103999116100645780637b103999146101545780638da5cb5b1461017f578063ab80c89f146101aa578063ac8f4425146101d3578063d1d36d3314610210578063f2fde38b146102395761009c565b80633659cfe6146100a1578063485cc955146100ca5780634f1ef286146100f357806354255be01461010f578063715018a61461013d575b600080fd5b3480156100ad57600080fd5b506100c860048036038101906100c39190611928565b610262565b005b3480156100d657600080fd5b506100f160048036038101906100ec9190611955565b6103eb565b005b61010d60048036038101906101089190611adb565b6104e3565b005b34801561011b57600080fd5b50610124610620565b6040516101349493929190611b50565b60405180910390f35b34801561014957600080fd5b5061015261063a565b005b34801561016057600080fd5b506101696106c2565b6040516101769190611bf4565b60405180910390f35b34801561018b57600080fd5b506101946106e8565b6040516101a19190611c1e565b60405180910390f35b3480156101b657600080fd5b506101d160048036038101906101cc9190611928565b610712565b005b3480156101df57600080fd5b506101fa60048036038101906101f59190611928565b61082f565b6040516102079190611c54565b60405180910390f35b34801561021c57600080fd5b5061023760048036038101906102329190611ccf565b61084f565b005b34801561024557600080fd5b50610260600480360381019061025b9190611928565b610a61565b005b7f0000000000000000000000003ddec31b0d6139b678e5156152173d676214476273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1614156102f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e890611db2565b60405180910390fd5b7f0000000000000000000000003ddec31b0d6139b678e5156152173d676214476273ffffffffffffffffffffffffffffffffffffffff16610330610b7c565b73ffffffffffffffffffffffffffffffffffffffff1614610386576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037d90611e44565b60405180910390fd5b61038f81610bd3565b6103e881600067ffffffffffffffff8111156103ae576103ad6119b0565b5b6040519080825280601f01601f1916602001820160405280156103e05781602001600182028036833780820191505090505b506000610c52565b50565b600060019054906101000a900460ff166104135760008054906101000a900460ff161561041c565b61041b610e23565b5b61045b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045290611ed6565b60405180910390fd5b60008060019054906101000a900460ff1615905080156104ab576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6104b482610e34565b6104bd83610efa565b80156104de5760008060016101000a81548160ff0219169083151502179055505b505050565b7f0000000000000000000000003ddec31b0d6139b678e5156152173d676214476273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161415610572576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056990611db2565b60405180910390fd5b7f0000000000000000000000003ddec31b0d6139b678e5156152173d676214476273ffffffffffffffffffffffffffffffffffffffff166105b1610b7c565b73ffffffffffffffffffffffffffffffffffffffff1614610607576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fe90611e44565b60405180910390fd5b61061082610bd3565b61061c82826001610c52565b5050565b600080600080600180600080935093509350935090919293565b61064261100b565b73ffffffffffffffffffffffffffffffffffffffff166106606106e8565b73ffffffffffffffffffffffffffffffffffffffff16146106b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ad90611f42565b60405180910390fd5b6106c06000610e34565b565b606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061071c611013565b905060008061072b83856110da565b9150915081156107415761073e8161123e565b91505b811515606660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146108295781606660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faf5c4c2ab440a2f535091c2b12e69b4e83bb351ba27a46c77aa7cf85fbdfde7e8483604051610820929190611f62565b60405180910390a15b50505050565b60666020528060005260406000206000915054906101000a900460ff1681565b60011515606660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156108e557826040517f5e5e76170000000000000000000000000000000000000000000000000000000081526004016108dc9190611c1e565b60405180910390fd5b60006108ef611013565b90506000806108fe83876110da565b915091508161090f57505050610a5c565b8051858590501461094c576040517f738ca2d100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610956611404565b905060005b8251811015610a56576109a283828151811061097a57610979611f8b565b5b602002602001015188888481811061099557610994611f8b565b5b9050602002013584611481565b15610a43576001606660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507faf5c4c2ab440a2f535091c2b12e69b4e83bb351ba27a46c77aa7cf85fbdfde7e886001604051610a31929190611f62565b60405180910390a15050505050610a5c565b8080610a4e90611fe9565b91505061095b565b50505050505b505050565b610a6961100b565b73ffffffffffffffffffffffffffffffffffffffff16610a876106e8565b73ffffffffffffffffffffffffffffffffffffffff1614610add576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad490611f42565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b44906120a4565b60405180910390fd5b610b5681610e34565b50565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000610baa7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6114d5565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610bdb61100b565b73ffffffffffffffffffffffffffffffffffffffff16610bf96106e8565b73ffffffffffffffffffffffffffffffffffffffff1614610c4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4690611f42565b60405180910390fd5b50565b6000610c5c610b7c565b9050610c67846114df565b600083511180610c745750815b15610c8557610c838484611598565b505b6000610cb37f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914360001b6115c5565b90508060000160009054906101000a900460ff16610e1c5760018160000160006101000a81548160ff021916908315150217905550610d7f8583604051602401610cfd9190611c1e565b6040516020818303038152906040527f3659cfe6000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611598565b5060008160000160006101000a81548160ff021916908315150217905550610da5610b7c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610e12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0990612136565b60405180910390fd5b610e1b856115cf565b5b5050505050565b6000610e2e30610b59565b15905090565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081603360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060019054906101000a900460ff16610f49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f40906121c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fc65761ce10606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611008565b80606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600033905090565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed6040516020016110629061223f565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611094919061226d565b602060405180830381865afa1580156110b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d5919061229d565b905090565b600060608373ffffffffffffffffffffffffffffffffffffffff166352f13a4e846040518263ffffffff1660e01b81526004016111179190611c1e565b602060405180830381865afa158015611134573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115891906122f6565b6111655760009150611237565b60008473ffffffffffffffffffffffffffffffffffffffff16639b9d5161856040518263ffffffff1660e01b81526004016111a09190611c1e565b600060405180830381865afa1580156111bd573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906111e691906124d5565b909192939450909192935090919250909150508092508193505050600082511415611215576000925050611237565b69d3c21bcecceda1000000811015611231576000925050611237565b60019250505b9250929050565b600080600090505b82518110156112d45760016067600085848151811061126857611267611f8b565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806112cc90611fe9565b915050611246565b5060008060006112e2611404565b905060005b8181101561136f576112f88161161e565b925060011515606760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561135c576001935061136f565b808061136790611fe9565b9150506112e7565b5060005b85518110156113f8576067600087838151811061139357611392611f8b565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905580806113f090611fe9565b915050611373565b50829350505050919050565b600061140e6116a8565b73ffffffffffffffffffffffffffffffffffffffff166387ee8a0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147c91906125af565b905090565b60008183111561149457600090506114ce565b8373ffffffffffffffffffffffffffffffffffffffff166114b48461161e565b73ffffffffffffffffffffffffffffffffffffffff161490505b9392505050565b6000819050919050565b6114e88161176f565b611527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151e9061264e565b60405180910390fd5b806115547f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6114d5565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606115bd838360405180606001604052806027815260200161287460279139611782565b905092915050565b6000819050919050565b6115d8816114df565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b60006116286116a8565b73ffffffffffffffffffffffffffffffffffffffff1663123633ea836040518263ffffffff1660e01b8152600401611660919061266e565b602060405180830381865afa15801561167d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a1919061229d565b9050919050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed6040516020016116f7906126d5565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611729919061226d565b602060405180830381865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a919061229d565b905090565b600080823b905060008111915050919050565b606061178d8461176f565b6117cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c39061275c565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516117f491906127f6565b600060405180830381855af49150503d806000811461182f576040519150601f19603f3d011682016040523d82523d6000602084013e611834565b606091505b509150915061184482828661184f565b925050509392505050565b6060831561185f578290506118af565b6000835111156118725782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a69190612851565b60405180910390fd5b9392505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118f5826118ca565b9050919050565b611905816118ea565b811461191057600080fd5b50565b600081359050611922816118fc565b92915050565b60006020828403121561193e5761193d6118c0565b5b600061194c84828501611913565b91505092915050565b6000806040838503121561196c5761196b6118c0565b5b600061197a85828601611913565b925050602061198b85828601611913565b9150509250929050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6119e88261199f565b810181811067ffffffffffffffff82111715611a0757611a066119b0565b5b80604052505050565b6000611a1a6118b6565b9050611a2682826119df565b919050565b600067ffffffffffffffff821115611a4657611a456119b0565b5b611a4f8261199f565b9050602081019050919050565b82818337600083830152505050565b6000611a7e611a7984611a2b565b611a10565b905082815260208101848484011115611a9a57611a9961199a565b5b611aa5848285611a5c565b509392505050565b600082601f830112611ac257611ac1611995565b5b8135611ad2848260208601611a6b565b91505092915050565b60008060408385031215611af257611af16118c0565b5b6000611b0085828601611913565b925050602083013567ffffffffffffffff811115611b2157611b206118c5565b5b611b2d85828601611aad565b9150509250929050565b6000819050919050565b611b4a81611b37565b82525050565b6000608082019050611b656000830187611b41565b611b726020830186611b41565b611b7f6040830185611b41565b611b8c6060830184611b41565b95945050505050565b6000819050919050565b6000611bba611bb5611bb0846118ca565b611b95565b6118ca565b9050919050565b6000611bcc82611b9f565b9050919050565b6000611bde82611bc1565b9050919050565b611bee81611bd3565b82525050565b6000602082019050611c096000830184611be5565b92915050565b611c18816118ea565b82525050565b6000602082019050611c336000830184611c0f565b92915050565b60008115159050919050565b611c4e81611c39565b82525050565b6000602082019050611c696000830184611c45565b92915050565b600080fd5b600080fd5b60008083601f840112611c8f57611c8e611995565b5b8235905067ffffffffffffffff811115611cac57611cab611c6f565b5b602083019150836020820283011115611cc857611cc7611c74565b5b9250929050565b600080600060408486031215611ce857611ce76118c0565b5b6000611cf686828701611913565b935050602084013567ffffffffffffffff811115611d1757611d166118c5565b5b611d2386828701611c79565b92509250509250925092565b600082825260208201905092915050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f64656c656761746563616c6c0000000000000000000000000000000000000000602082015250565b6000611d9c602c83611d2f565b9150611da782611d40565b604082019050919050565b60006020820190508181036000830152611dcb81611d8f565b9050919050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f6163746976652070726f78790000000000000000000000000000000000000000602082015250565b6000611e2e602c83611d2f565b9150611e3982611dd2565b604082019050919050565b60006020820190508181036000830152611e5d81611e21565b9050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000611ec0602e83611d2f565b9150611ecb82611e64565b604082019050919050565b60006020820190508181036000830152611eef81611eb3565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611f2c602083611d2f565b9150611f3782611ef6565b602082019050919050565b60006020820190508181036000830152611f5b81611f1f565b9050919050565b6000604082019050611f776000830185611c0f565b611f846020830184611c45565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611ff482611b37565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561202757612026611fba565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061208e602683611d2f565b915061209982612032565b604082019050919050565b600060208201905081810360008301526120bd81612081565b9050919050565b7f45524331393637557067726164653a207570677261646520627265616b73206660008201527f7572746865722075706772616465730000000000000000000000000000000000602082015250565b6000612120602f83611d2f565b915061212b826120c4565b604082019050919050565b6000602082019050818103600083015261214f81612113565b9050919050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b60006121b2602b83611d2f565b91506121bd82612156565b604082019050919050565b600060208201905081810360008301526121e1816121a5565b9050919050565b600081905092915050565b7f56616c696461746f727300000000000000000000000000000000000000000000600082015250565b6000612229600a836121e8565b9150612234826121f3565b600a82019050919050565b600061224a8261221c565b9150819050919050565b6000819050919050565b61226781612254565b82525050565b6000602082019050612282600083018461225e565b92915050565b600081519050612297816118fc565b92915050565b6000602082840312156122b3576122b26118c0565b5b60006122c184828501612288565b91505092915050565b6122d381611c39565b81146122de57600080fd5b50565b6000815190506122f0816122ca565b92915050565b60006020828403121561230c5761230b6118c0565b5b600061231a848285016122e1565b91505092915050565b600067ffffffffffffffff82111561233e5761233d6119b0565b5b602082029050602081019050919050565b600061236261235d84612323565b611a10565b9050808382526020820190506020840283018581111561238557612384611c74565b5b835b818110156123ae578061239a8882612288565b845260208401935050602081019050612387565b5050509392505050565b600082601f8301126123cd576123cc611995565b5b81516123dd84826020860161234f565b91505092915050565b6123ef81611b37565b81146123fa57600080fd5b50565b60008151905061240c816123e6565b92915050565b600067ffffffffffffffff82111561242d5761242c6119b0565b5b602082029050602081019050919050565b600061245161244c84612412565b611a10565b9050808382526020820190506020840283018581111561247457612473611c74565b5b835b8181101561249d578061248988826123fd565b845260208401935050602081019050612476565b5050509392505050565b600082601f8301126124bc576124bb611995565b5b81516124cc84826020860161243e565b91505092915050565b600080600080600080600060e0888a0312156124f4576124f36118c0565b5b600088015167ffffffffffffffff811115612512576125116118c5565b5b61251e8a828b016123b8565b975050602061252f8a828b016123fd565b96505060406125408a828b016123fd565b95505060606125518a828b016123fd565b945050608088015167ffffffffffffffff811115612572576125716118c5565b5b61257e8a828b016124a7565b93505060a061258f8a828b016123fd565b92505060c06125a08a828b016123fd565b91505092959891949750929550565b6000602082840312156125c5576125c46118c0565b5b60006125d3848285016123fd565b91505092915050565b7f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60008201527f6f74206120636f6e747261637400000000000000000000000000000000000000602082015250565b6000612638602d83611d2f565b9150612643826125dc565b604082019050919050565b600060208201905081810360008301526126678161262b565b9050919050565b60006020820190506126836000830184611b41565b92915050565b7f456c656374696f6e000000000000000000000000000000000000000000000000600082015250565b60006126bf6008836121e8565b91506126ca82612689565b600882019050919050565b60006126e0826126b2565b9150819050919050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b6000612746602683611d2f565b9150612751826126ea565b604082019050919050565b6000602082019050818103600083015261277581612739565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156127b0578082015181840152602081019050612795565b838111156127bf576000848401525b50505050565b60006127d08261277c565b6127da8185612787565b93506127ea818560208601612792565b80840191505092915050565b600061280282846127c5565b915081905092915050565b600081519050919050565b60006128238261280d565b61282d8185611d2f565b935061283d818560208601612792565b6128468161199f565b840191505092915050565b6000602082019050818103600083015261286b8184612818565b90509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208bac660b664977e8638d60ad9e5fa446bb79855e8ac9cdc934a084f414464dd064736f6c634300080b0033