false
false
0
The new Blockscout UI is now open source! Learn how to deploy it here

Contract Address Details

0xcE965b256E8735911b5e569ABA4508fd27AfDe1E

Contract Name
KeeperRegistry
Creator
0x077675–fb67cc at 0x413545–bf04c2
Balance
0 ETH
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
486329
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
KeeperRegistry




Optimization enabled
true
Compiler version
v0.8.12+commit.f00d7308




Optimization runs
10
EVM Version
london




Verified at
2024-06-07T13:15:31.510168Z

contracts/KeeperRegistry.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import { IKeeperRegistry } from "./interfaces/IKeeperRegistry.sol";

/**
 * @dev owned by governance contract
 */
contract KeeperRegistry is
    Initializable,
    OwnableUpgradeable,
    UUPSUpgradeable,
    IKeeperRegistry
{
    using SafeERC20 for IERC20;
    uint256 public maxNumKeepers; // Max # of keepers to allow at a time
    uint256 public currentNumKeepers; // Current # of keepers.

    // Bond token
    IERC20 public bondCoin; // ERC20 token used to provide bonds. Meant to be Steer token.
    uint256 public bondAmount; // Amount of bondCoin required to become a keeper
    uint256 public freeCoin; // Amount of bondCoin no longer affiliated with any keeper (due to slashing etc.)

    /**
     * Slash safety period--if a keeper leaves, this is the amount of time (in seconds) they must 
        wait before they can withdraw their bond.
     */
    uint256 public transferDelay;

    mapping(uint256 => address) public keeperLicenses; // This mapping is pretty much just used to track which licenses are free.
    mapping(address => WorkerDetails) public registry; // Registry of keeper info for keepers and former keepers.

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer() {}

    function initialize(
        address coinAddress,
        uint256 keeperTransferDelay,
        uint256 maxKeepers,
        uint256 bondSize
    ) public initializer {
        __UUPSUpgradeable_init();
        __Ownable_init();
        bondCoin = IERC20(coinAddress);
        transferDelay = keeperTransferDelay;
        maxNumKeepers = maxKeepers;
        require(bondSize > 0, "SIZE");
        bondAmount = bondSize;
    }

    function _authorizeUpgrade(address) internal override onlyOwner {}

    /**
     * @dev setup utility function for owner to add initial keepers. Addresses must each be unique and not hold any bondToken.
     * @param joiners array of addresses to become keepers.
     * note that this function will pull bondToken from the owner equal to bondAmount * numJoiners.
     * note that this function assumes that the keeper registry currently has no keepers. It will revert if this assumption fails.
     */
    function joiningForOwner(address[] calldata joiners) public onlyOwner {
        uint256 noOfJoiners = joiners.length;
        require(noOfJoiners != 0, "JOINERS");
        // Cache last license index
        uint256 lastKeeperLicense = noOfJoiners + 1;

        // Cache bond amount
        uint256 _bondAmount = bondAmount;

        bondCoin.safeTransferFrom(
            msg.sender,
            address(this),
            _bondAmount * noOfJoiners
        );

        // Ensure not too many keepers are being added.
        require(noOfJoiners <= maxNumKeepers, "MAX_KEEPERS");

        // Add each keeper to the registry
        for (uint256 i = 1; i != lastKeeperLicense; ++i) {
            // Make sure license is not already claimed by another keeper
            require(keeperLicenses[i] == address(0), "Address not new.");

            // Register keeper to license
            keeperLicenses[i] = joiners[i - 1];

            // Register license (and other info) to keeper
            registry[joiners[i - 1]] = WorkerDetails({
                bondHeld: _bondAmount,
                licenseNumber: i,
                leaveTimestamp: 0
            });
        }

        currentNumKeepers += noOfJoiners;
    }

    /**
     * @param amount Amount of bondCoin to be deposited.
     * @dev this function has three uses:
        1. If the caller is a keeper, they can increase their bondHeld by amount. This helps to avoid slashing.
        2. If the caller is not a keeper or former keeper, they can attempt to claim a keeper license and become a keeper.
        3. If the caller is a former keeper, they can attempt to cancel their leave request, claim a keeper license, and become a keeper.
        In all 3 cases registry[msg.sender].bondHeld is increased by amount. In the latter 2, msg.sender's bondHeld after the transaction must be >= bondAmount.
     */
    function join(uint256 licenseNumber, uint256 amount) public {
        // Transfer in bond.
        if (amount > 0) {
            bondCoin.safeTransferFrom(msg.sender, address(this), amount);
        }

        // Look up msg.sender in the mapping
        WorkerDetails memory _workerDetails = registry[msg.sender];

        if (_workerDetails.licenseNumber > 0) {
            // If they have a license, they're a keeper, and amount will go towards their bondHeld
            // If maxNumKeepers was decreased, they may not be a keeper, but this won't cause anything to break.
            registry[msg.sender].bondHeld = _workerDetails.bondHeld + amount;
        } else {
            /*
                Two scenarios here:
                1. If their bondAmount is zero and their leaveTimestamp is zero, they are not yet a keeper, so this is a new address attempting to become a keeper.
                2. If they are queued to leave but have not yet left, they are not a keeper, so this will cancel their leave request (by zeroing out leaveTimestamp) 
                and attempt to make them a keeper.
                Either way the solution is the same -- if their new bondAmount is enough, they become a keeper with no leave date. Otherwise, this function reverts.
            */

            // Make sure requested license is valid and available
            require(
                keeperLicenses[licenseNumber] == address(0),
                "License not available."
            );
            require(licenseNumber > 0, "LICENSE_NUMBER");
            require(licenseNumber <= maxNumKeepers, "LICENSE_NUMBER");

            // Join must be sufficient to become a keeper
            uint256 newBondAmount = _workerDetails.bondHeld + amount;
            require(newBondAmount >= bondAmount, "Insufficient bond amount.");

            ++currentNumKeepers;

            // Register license/bond amount with keeper
            registry[msg.sender] = WorkerDetails({
                bondHeld: newBondAmount,
                licenseNumber: licenseNumber,
                leaveTimestamp: 0
            });

            // Register keeper with license
            keeperLicenses[licenseNumber] = msg.sender;

            emit PermissionChanged(msg.sender, permissionType.FULL);
        }
    }

    /**
     * @dev Allows keepers to queue to leave the registry. Their elevated permissions are immediately revoked, and their funds can be retrieved once the transferDelay has passed.
     * note that this function can only be called by keepers (or, in rare cases, former keepers whose licenses were revoked by a decrease in maxNumKeepers)
     * emits a permissionChanged event if the call succeeds.
     */
    function queueToLeave() public {
        WorkerDetails memory _workerDetails = registry[msg.sender];
        require(
            _workerDetails.licenseNumber > 0,
            "msg.sender is already not a keeper."
        );

        // Remove permissions immediately. Keeper can remove funds once the transferDelay has passed. This ensures that keeper can be slashed if they misbehaved just before leaving.
        registry[msg.sender] = WorkerDetails({
            bondHeld: _workerDetails.bondHeld,
            licenseNumber: 0,
            leaveTimestamp: block.timestamp + transferDelay
        });
        delete keeperLicenses[_workerDetails.licenseNumber];

        // Decrease numKeepers count
        --currentNumKeepers;

        emit PermissionChanged(msg.sender, permissionType.NONE);
    }

    /**
     * @dev addresses call this after they have queued to leave and waited the requisite amount of time.
     */
    function leave() external {
        WorkerDetails memory info = registry[msg.sender];

        // Validate leave request
        require(info.leaveTimestamp > 0, "Not queued to leave.");
        require(
            info.leaveTimestamp < block.timestamp,
            "Transfer delay not passed."
        );

        // Send former keeper their previously staked tokens
        bondCoin.safeTransfer(msg.sender, info.bondHeld);

        // Reset the former keeper's data
        delete registry[msg.sender];
    }

    /**
     * @dev returns true if the given address has the power to vote, reverts otherwise. This function is built to be called by the orchestrator.
     * @param targetAddress address to check
     * @return licenseNumber true if the given address has the power to vote, reverts otherwise.
     */
    function checkLicense(
        address targetAddress
    ) public view returns (uint256 licenseNumber) {
        licenseNumber = registry[targetAddress].licenseNumber;
        require(licenseNumber > 0, "NOT_A_KEEPER");
    }

    /**
     * @dev slashes a keeper, removing their permissions and forfeiting their bond.
     * @param targetKeeper keeper to denounce
     * @param amount amount of bondCoin to slash
     * note that the keeper will only lose their license if, post-slash, their bond held is less than bondAmount.
     */
    function denounce(
        address targetKeeper,
        uint256 amount
    ) external onlyOwner {
        WorkerDetails memory _workerDetails = registry[targetKeeper];

        // Remove bondCoin from keeper who is being denounced, add to freeCoin (to be withdrawn by owner)
        uint256 currentBondHeld = _workerDetails.bondHeld;

        // If slash amount is greater than keeper's held bond, just slash 100% of their bond
        if (currentBondHeld < amount) {
            amount = currentBondHeld;
        }

        // Slash keeper's bond by amount
        uint256 newBond = currentBondHeld - amount;
        // Add keeper's slashed bond tokens to freeCoin
        freeCoin += amount;

        // Remove user as keeper if they are below threshold, and are a keeper
        if (newBond < bondAmount && _workerDetails.licenseNumber > 0) {
            keeperLicenses[_workerDetails.licenseNumber] = address(0);
            registry[targetKeeper].licenseNumber = 0;
            --currentNumKeepers;
            registry[targetKeeper].bondHeld = 0;
            //User is not a keeper anymore so user's remaining bond amount after substracting the slashed amount is given back
            bondCoin.safeTransfer(targetKeeper, newBond);
            //User can again try to become a keeper by calling join and bonding again.
        } else {
            registry[targetKeeper].bondHeld = newBond;
        }
        emit PermissionChanged(targetKeeper, permissionType.SLASHED);
    }

    /**
     * @dev withdraws slashed tokens from the vault and sends them to targetAddress.
     * @param amount amount of bondCoin to withdraw
     * @param targetAddress address receiving the tokens
     */
    function withdrawFreeCoin(
        uint256 amount,
        address targetAddress
    ) external onlyOwner {
        freeCoin -= amount;
        bondCoin.safeTransfer(targetAddress, amount);
    }

    /**
     * @dev change bondAmount to a new value.
     * @dev Does not change existing keeper permissions. If the bondAmount is being increased, existing keepers will not be slashed or removed. 
            note, they will still be able to vote until they are slashed.
     * @param amount new bondAmount.
     */
    function changeBondAmount(uint256 amount) external onlyOwner {
        bondAmount = amount;
    }

    /**
     * @dev change numKeepers to a new value. If numKeepers is being reduced, this will not remove any keepers, nor will it change orchestrator requirements.
        However, it will render keeper licenses > maxNumKeepers invalid and their votes will stop counting.
     */
    function changeMaxKeepers(uint16 newNumKeepers) external onlyOwner {
        maxNumKeepers = newNumKeepers;
    }
}
        

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol

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

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
        __ERC1967Upgrade_init_unchained();
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

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

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

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

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

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

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

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

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

        // Perform rollback test if not already in progress
        StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            _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 StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

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

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

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

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

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }
    uint256[50] private __gap;
}
          

@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol

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

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}
          

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

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

@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol

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

pragma solidity ^0.8.0;

import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
        __ERC1967Upgrade_init_unchained();
        __UUPSUpgradeable_init_unchained();
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

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

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

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol

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

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

/**
 * @dev Collection of functions related to array types.
 */
library ArraysUpgradeable {
    /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * `array` is expected to be sorted in ascending order, and to contain no
     * repeated elements.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        if (array.length == 0) {
            return 0;
        }

        uint256 low = 0;
        uint256 high = array.length;

        while (low < high) {
            uint256 mid = MathUpgradeable.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds down (it does integer division with truncation).
            if (array[mid] > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && array[low - 1] == element) {
            return low - 1;
        } else {
            return low;
        }
    }
}
          

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

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

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}
          

@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.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 StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        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-upgradeable/utils/math/MathUpgradeable.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 MathUpgradeable {
    /**
     * @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/token/ERC20/IERC20.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
          

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

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

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}
          

@openzeppelin/contracts/utils/Address.sol

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

pragma solidity ^0.8.1;

/**
 * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
          

contracts/interfaces/IKeeperRegistry.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.12;

interface IKeeperRegistry {
    enum permissionType {
        NONE,
        FULL,
        SLASHED
    }

    /**
     * Any given address can be in one of three different states:
        1. Not a keeper.
        2. A former keeper who is queued to leave, i.e. they no longer have a keeper license but still have some funds locked in the contract. 
        3. A current keeper.
     * Keepers can themselves each be in one of two states:
        1. In good standing. This is signified by bondHeld >= bondAmount.
        2. Not in good standing. 
        If a keepers is not in good standing, they retain their license and ability to vote, but any slash will remove their privileges.
     * The only way for a keeper's bondHeld to drop to 0 is for them to leave or be slashed. Either way they lose their license in the process.
     */
    struct WorkerDetails {
        uint256 bondHeld; // bondCoin held by this keeper.
        uint256 licenseNumber; // Index of this keeper in the license mapping, i.e. which license they own. If they don't own a license, this will be 0.
        uint256 leaveTimestamp; // If this keeper has queued to leave, they can withdraw their bond after this date.
    }

    event PermissionChanged(
        address indexed _subject,
        permissionType indexed _permissionType
    );
    event LeaveQueued(address indexed keeper, uint256 leaveTimestamp);

    /**
     * @param coinAddress the address of the ERC20 which will be used for bonds; intended to be Steer token.
     * @param keeperTransferDelay the amount of time (in seconds) between when a keeper relinquishes their license and when they can
            withdraw their funds. Intended to be 2 weeks - 1 month.
     */
    function initialize(
        address coinAddress,
        uint256 keeperTransferDelay,
        uint256 maxKeepers,
        uint256 bondSize
    ) external;

    function maxNumKeepers() external view returns (uint256);

    function currentNumKeepers() external view returns (uint256);

    /**
     * @dev setup utility function for owner to add initial keepers. Addresses must each be unique and not hold any bondToken.
     * @param joiners array of addresses to become keepers.
     * note that this function will pull bondToken from the owner equal to bondAmount * numJoiners.
     */
    function joiningForOwner(address[] calldata joiners) external;

    /**
     * @param amount Amount of bondCoin to be deposited.
     * @dev this function has three uses:
        1. If the caller is a keeper, they can increase their bondHeld by amount.
        2. If the caller is not a keeper or former keeper, they can attempt to claim a keeper license and become a keeper.
        3. If the caller is a former keeper, they can attempt to cancel their leave request, claim a keeper license, and become a keeper.
        In all 3 cases registry[msg.sender].bondHeld is increased by amount. In the latter 2, msg.sender's bondHeld after the transaction must be >= bondAmount.
     */
    function join(uint256 licenseNumber, uint256 amount) external;

    function queueToLeave() external;

    function leave() external;

    /**
     * @dev returns true if the given address has the power to vote, false otherwise. The address has the power to vote if it is within the keeper array.
     */
    function checkLicense(address targetAddress)
        external
        view
        returns (uint256);

    /**
     * @dev slashes a keeper, removing their permissions and forfeiting their bond.
     * @param targetKeeper keeper to denounce
     * @param amount amount of bondCoin to slash
     */
    function denounce(address targetKeeper, uint256 amount) external;

    /**
     * @dev withdraws slashed tokens from the vault and sends them to targetAddress.
     * @param amount amount of bondCoin to withdraw
     * @param targetAddress address receiving the tokens
     */
    function withdrawFreeCoin(uint256 amount, address targetAddress) external;

    /**
     * @dev change bondAmount to a new value.
     * @dev implicitly changes keeper permissions. If the bondAmount is being increased, existing keepers will not be slashed or removed. 
            note, they will still be able to vote until they are slashed.
     * @param amount new bondAmount.
     */
    function changeBondAmount(uint256 amount) external;

    /**
     * @dev change numKeepers to a new value. If numKeepers is being reduced, this will not remove any keepers, nor will it change orchestrator requirements.
        However, it will render keeper licenses > maxNumKeepers invalid and their votes will stop counting.
     */
    function changeMaxKeepers(uint16 newNumKeepers) external;
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":10,"enabled":true},"metadata":{"useLiteralContent":true,"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"london"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","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":"LeaveQueued","inputs":[{"type":"address","name":"keeper","internalType":"address","indexed":true},{"type":"uint256","name":"leaveTimestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PermissionChanged","inputs":[{"type":"address","name":"_subject","internalType":"address","indexed":true},{"type":"uint8","name":"_permissionType","internalType":"enum IKeeperRegistry.permissionType","indexed":true}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"bondAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"bondCoin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeBondAmount","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeMaxKeepers","inputs":[{"type":"uint16","name":"newNumKeepers","internalType":"uint16"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"licenseNumber","internalType":"uint256"}],"name":"checkLicense","inputs":[{"type":"address","name":"targetAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentNumKeepers","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"denounce","inputs":[{"type":"address","name":"targetKeeper","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"freeCoin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"coinAddress","internalType":"address"},{"type":"uint256","name":"keeperTransferDelay","internalType":"uint256"},{"type":"uint256","name":"maxKeepers","internalType":"uint256"},{"type":"uint256","name":"bondSize","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"join","inputs":[{"type":"uint256","name":"licenseNumber","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"joiningForOwner","inputs":[{"type":"address[]","name":"joiners","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"keeperLicenses","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"leave","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxNumKeepers","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"queueToLeave","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"bondHeld","internalType":"uint256"},{"type":"uint256","name":"licenseNumber","internalType":"uint256"},{"type":"uint256","name":"leaveTimestamp","internalType":"uint256"}],"name":"registry","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"transferDelay","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawFreeCoin","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"targetAddress","internalType":"address"}]}]
              

Contract Creation Code

0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff16620000335760005460ff16156200003d565b6200003d620000e2565b620000a55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000c8576000805461ffff19166101011790555b8015620000db576000805461ff00191690555b5062000106565b6000620000fa306200010060201b620010d11760201c565b15905090565b3b151590565b608051611e186200013760003960008181610503015281816105430152818161082d015261086d0152611e186000f3fe6080604052600436106101105760003560e01c806301a5024b14610115578063038defd71461013757806303a7c9e4146101935780630a702e8d146101c157806314b80553146101d757806320f600ee146101ed5780633659cfe61461020d57806339b5aac21461022d5780634ec81af1146102425780634f1ef286146102625780635bc3835914610275578063715018a61461028b57806379e66b46146102a057806380f323a7146102c057806388b0ff48146102d65780638da5cb5b146103035780638f23982e14610318578063d66d9e191461034e578063d8c3ff0d14610363578063df82e0bd14610383578063eec7b735146103a3578063f2fde38b146103b9578063fa4e9953146103d9575b600080fd5b34801561012157600080fd5b5061013561013036600461188e565b6103f9565b005b34801561014357600080fd5b506101736101523660046118ba565b60d06020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b34801561019f57600080fd5b506101b36101ae3660046118ba565b610463565b60405190815260200161018a565b3480156101cd57600080fd5b506101b360ce5481565b3480156101e357600080fd5b506101b360c95481565b3480156101f957600080fd5b506101356102083660046118d5565b6104c0565b34801561021957600080fd5b506101356102283660046118ba565b6104f8565b34801561023957600080fd5b506101356105c1565b34801561024e57600080fd5b5061013561025d3660046118f9565b6106f5565b610135610270366004611948565b610822565b34801561028157600080fd5b506101b360cd5481565b34801561029757600080fd5b506101356108d8565b3480156102ac57600080fd5b506101356102bb366004611a09565b610913565b3480156102cc57600080fd5b506101b360cc5481565b3480156102e257600080fd5b5060cb546102f6906001600160a01b031681565b60405161018a9190611a2b565b34801561030f57600080fd5b506102f6610b1d565b34801561032457600080fd5b506102f6610333366004611a3f565b60cf602052600090815260409020546001600160a01b031681565b34801561035a57600080fd5b50610135610b2c565b34801561036f57600080fd5b5061013561037e366004611a58565b610c31565b34801561038f57600080fd5b5061013561039e366004611acc565b610e7f565b3480156103af57600080fd5b506101b360ca5481565b3480156103c557600080fd5b506101356103d43660046118ba565b611000565b3480156103e557600080fd5b506101356103f4366004611a3f565b61109d565b33610402610b1d565b6001600160a01b0316146104315760405162461bcd60e51b815260040161042890611af6565b60405180910390fd5b8160cd60008282546104439190611b41565b909155505060cb5461045f906001600160a01b031682846110d7565b5050565b6001600160a01b038116600090815260d06020526040902060010154806104bb5760405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa0afa5a2a2a822a960a11b6044820152606401610428565b919050565b336104c9610b1d565b6001600160a01b0316146104ef5760405162461bcd60e51b815260040161042890611af6565b61ffff1660c955565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105415760405162461bcd60e51b815260040161042890611b58565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661057361113a565b6001600160a01b0316146105995760405162461bcd60e51b815260040161042890611b92565b6105a281611156565b604080516000808252602082019092526105be91839190611185565b50565b33600090815260d060209081526040918290208251606081018452815481526001820154928101839052600290910154928101929092526106505760405162461bcd60e51b815260206004820152602360248201527f6d73672e73656e64657220697320616c7265616479206e6f742061206b65657060448201526232b91760e91b6064820152608401610428565b6040518060600160405280826000015181526020016000815260200160ce544261067a9190611bcc565b905233600090815260d060209081526040808320845181558483015160018201559381015160029094019390935583810151825260cf905290812080546001600160a01b031916905560ca80549091906106d390611be4565b9091555060006040513390600080516020611d5c83398151915290600090a350565b600054610100900460ff166107105760005460ff1615610714565b303b155b6107775760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610428565b600054610100900460ff16158015610799576000805461ffff19166101011790555b6107a16112c5565b6107a96112fc565b60cb80546001600160a01b0319166001600160a01b03871617905560ce84905560c9839055816108045760405162461bcd60e51b81526004016104289060208082526004908201526353495a4560e01b604082015260600190565b60cc829055801561081b576000805461ff00191690555b5050505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561086b5760405162461bcd60e51b815260040161042890611b58565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661089d61113a565b6001600160a01b0316146108c35760405162461bcd60e51b815260040161042890611b92565b6108cc82611156565b61045f82826001611185565b336108e1610b1d565b6001600160a01b0316146109075760405162461bcd60e51b815260040161042890611af6565b6109116000611333565b565b80156109315760cb54610931906001600160a01b0316333084611385565b33600090815260d060209081526040918290208251606081018452815481526001820154928101839052600290910154928101929092521561098f57805161097a908390611bcc565b33600090815260d06020526040902055505050565b600083815260cf60205260409020546001600160a01b0316156109ed5760405162461bcd60e51b81526020600482015260166024820152752634b1b2b739b2903737ba1030bb30b4b630b136329760511b6044820152606401610428565b60008311610a0d5760405162461bcd60e51b815260040161042890611bfb565b60c954831115610a2f5760405162461bcd60e51b815260040161042890611bfb565b8051600090610a3f908490611bcc565b905060cc54811015610a8f5760405162461bcd60e51b815260206004820152601960248201527824b739bab33334b1b4b2b73a103137b7321030b6b7bab73a1760391b6044820152606401610428565b60ca60008154610a9e90611c23565b9091555060408051606081018252828152602080820187815260008385018181523380835260d08552868320955186559251600180870191909155905160029095019490945588815260cf90925283822080546001600160a01b031916821790559251919291600080516020611d5c8339815191529190a3505b505050565b6033546001600160a01b031690565b33600090815260d060209081526040918290208251606081018452815481526001820154928101929092526002015491810182905290610ba55760405162461bcd60e51b81526020600482015260146024820152732737ba1038bab2bab2b2103a37903632b0bb329760611b6044820152606401610428565b42816040015110610bf55760405162461bcd60e51b815260206004820152601a6024820152792a3930b739b332b9103232b630bc903737ba103830b9b9b2b21760311b6044820152606401610428565b805160cb54610c11916001600160a01b039091169033906110d7565b5033600090815260d0602052604081208181556001810182905560020155565b33610c3a610b1d565b6001600160a01b031614610c605760405162461bcd60e51b815260040161042890611af6565b8080610c985760405162461bcd60e51b81526020600482015260076024820152664a4f494e45525360c81b6044820152606401610428565b6000610ca5826001611bcc565b60cc54909150610cce3330610cba8685611c3e565b60cb546001600160a01b0316929190611385565b60c954831115610d0e5760405162461bcd60e51b815260206004820152600b60248201526a4d41585f4b45455045525360a81b6044820152606401610428565b60015b828114610e6057600081815260cf60205260409020546001600160a01b031615610d705760405162461bcd60e51b815260206004820152601060248201526f20b2323932b9b9903737ba103732bb9760811b6044820152606401610428565b8585610d7d600184611b41565b818110610d8c57610d8c611c5d565b9050602002016020810190610da191906118ba565b600082815260cf6020908152604080832080546001600160a01b0319166001600160a01b039590951694909417909355825160608101845285815290810184905291820181905260d0908888610df8600187611b41565b818110610e0757610e07611c5d565b9050602002016020810190610e1c91906118ba565b6001600160a01b031681526020808201929092526040908101600020835181559183015160018301559190910151600290910155610e5981611c23565b9050610d11565b508260ca6000828254610e739190611bcc565b90915550505050505050565b33610e88610b1d565b6001600160a01b031614610eae5760405162461bcd60e51b815260040161042890611af6565b6001600160a01b038216600090815260d06020908152604091829020825160608101845281548082526001830154938201939093526002909101549281019290925282811015610efc578092505b6000610f088483611b41565b90508360cd6000828254610f1c9190611bcc565b909155505060cc5481108015610f36575060008360200151115b15610fb957602080840151600090815260cf8252604080822080546001600160a01b03191690556001600160a01b038816825260d090925290812060010181905560ca8054909190610f8790611be4565b909155506001600160a01b03808616600090815260d0602052604081205560cb54610fb4911686836110d7565b610fd5565b6001600160a01b038516600090815260d0602052604090208190555b60026040516001600160a01b03871690600080516020611d5c83398151915290600090a35050505050565b33611009610b1d565b6001600160a01b03161461102f5760405162461bcd60e51b815260040161042890611af6565b6001600160a01b0381166110945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610428565b6105be81611333565b336110a6610b1d565b6001600160a01b0316146110cc5760405162461bcd60e51b815260040161042890611af6565b60cc55565b3b151590565b6040516001600160a01b038316602482015260448101829052610b1890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526113c3565b600080516020611d9c833981519152546001600160a01b031690565b3361115f610b1d565b6001600160a01b0316146105be5760405162461bcd60e51b815260040161042890611af6565b600061118f61113a565b905061119a84611498565b6000835111806111a75750815b156111b8576111b6848461152b565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff1661081b57805460ff19166001178155604051611233908690611204908590602401611a2b565b60408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b17905261152b565b50805460ff1916815561124461113a565b6001600160a01b0316826001600160a01b0316146112bc5760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610428565b61081b85611616565b600054610100900460ff166112ec5760405162461bcd60e51b815260040161042890611c73565b6112f4611656565b610911611656565b600054610100900460ff166113235760405162461bcd60e51b815260040161042890611c73565b61132b611656565b61091161167d565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526113bd9085906323b872dd60e01b90608401611103565b50505050565b6000611418826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116ad9092919063ffffffff16565b90508051600014806114395750808060200190518101906114399190611cbe565b610b185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610428565b803b6114fc5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610428565b600080516020611d9c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b61158a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610428565b600080846001600160a01b0316846040516115a59190611d0c565b600060405180830381855af49150503d80600081146115e0576040519150601f19603f3d011682016040523d82523d6000602084013e6115e5565b606091505b509150915061160d8282604051806060016040528060278152602001611dbc602791396116c6565b95945050505050565b61161f81611498565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600054610100900460ff166109115760405162461bcd60e51b815260040161042890611c73565b600054610100900460ff166116a45760405162461bcd60e51b815260040161042890611c73565b61091133611333565b60606116bc84846000856116ff565b90505b9392505050565b606083156116d55750816116bf565b8251156116e55782518084602001fd5b8160405162461bcd60e51b81526004016104289190611d28565b6060824710156117605760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610428565b600080866001600160a01b0316858760405161177c9190611d0c565b60006040518083038185875af1925050503d80600081146117b9576040519150601f19603f3d011682016040523d82523d6000602084013e6117be565b606091505b50915091506117cf878383876117dc565b925050505b949350505050565b60608315611848578251611841576001600160a01b0385163b6118415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610428565b50816117d4565b6117d4838381511561185d5781518083602001fd5b8060405162461bcd60e51b81526004016104289190611d28565b80356001600160a01b03811681146104bb57600080fd5b600080604083850312156118a157600080fd5b823591506118b160208401611877565b90509250929050565b6000602082840312156118cc57600080fd5b6116bf82611877565b6000602082840312156118e757600080fd5b813561ffff811681146116bf57600080fd5b6000806000806080858703121561190f57600080fd5b61191885611877565b966020860135965060408601359560600135945092505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561195b57600080fd5b61196483611877565b915060208301356001600160401b038082111561198057600080fd5b818501915085601f83011261199457600080fd5b8135818111156119a6576119a6611932565b604051601f8201601f19908116603f011681019083821181831017156119ce576119ce611932565b816040528281528860208487010111156119e757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008060408385031215611a1c57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215611a5157600080fd5b5035919050565b60008060208385031215611a6b57600080fd5b82356001600160401b0380821115611a8257600080fd5b818501915085601f830112611a9657600080fd5b813581811115611aa557600080fd5b8660208260051b8501011115611aba57600080fd5b60209290920196919550909350505050565b60008060408385031215611adf57600080fd5b611ae883611877565b946020939093013593505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611b5357611b53611b2b565b500390565b6020808252602c90820152600080516020611d7c83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020611d7c83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b60008219821115611bdf57611bdf611b2b565b500190565b600081611bf357611bf3611b2b565b506000190190565b6020808252600e908201526d2624a1a2a729a2afa72aa6a122a960911b604082015260600190565b6000600019821415611c3757611c37611b2b565b5060010190565b6000816000190483118215151615611c5857611c58611b2b565b500290565b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215611cd057600080fd5b815180151581146116bf57600080fd5b60005b83811015611cfb578181015183820152602001611ce3565b838111156113bd5750506000910152565b60008251611d1e818460208701611ce0565b9190910192915050565b6020815260008251806020840152611d47816040850160208701611ce0565b601f01601f1916919091016040019291505056fe02ab42f6b82517d797a585d5319a95696ea5167a6fbb0e0322c9ee66edec682c46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212202b5c3b694736761672df5da732236942f9aed1bc54962d93ffd7909456f1fcb264736f6c634300080c0033

Deployed ByteCode

0x6080604052600436106101105760003560e01c806301a5024b14610115578063038defd71461013757806303a7c9e4146101935780630a702e8d146101c157806314b80553146101d757806320f600ee146101ed5780633659cfe61461020d57806339b5aac21461022d5780634ec81af1146102425780634f1ef286146102625780635bc3835914610275578063715018a61461028b57806379e66b46146102a057806380f323a7146102c057806388b0ff48146102d65780638da5cb5b146103035780638f23982e14610318578063d66d9e191461034e578063d8c3ff0d14610363578063df82e0bd14610383578063eec7b735146103a3578063f2fde38b146103b9578063fa4e9953146103d9575b600080fd5b34801561012157600080fd5b5061013561013036600461188e565b6103f9565b005b34801561014357600080fd5b506101736101523660046118ba565b60d06020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b34801561019f57600080fd5b506101b36101ae3660046118ba565b610463565b60405190815260200161018a565b3480156101cd57600080fd5b506101b360ce5481565b3480156101e357600080fd5b506101b360c95481565b3480156101f957600080fd5b506101356102083660046118d5565b6104c0565b34801561021957600080fd5b506101356102283660046118ba565b6104f8565b34801561023957600080fd5b506101356105c1565b34801561024e57600080fd5b5061013561025d3660046118f9565b6106f5565b610135610270366004611948565b610822565b34801561028157600080fd5b506101b360cd5481565b34801561029757600080fd5b506101356108d8565b3480156102ac57600080fd5b506101356102bb366004611a09565b610913565b3480156102cc57600080fd5b506101b360cc5481565b3480156102e257600080fd5b5060cb546102f6906001600160a01b031681565b60405161018a9190611a2b565b34801561030f57600080fd5b506102f6610b1d565b34801561032457600080fd5b506102f6610333366004611a3f565b60cf602052600090815260409020546001600160a01b031681565b34801561035a57600080fd5b50610135610b2c565b34801561036f57600080fd5b5061013561037e366004611a58565b610c31565b34801561038f57600080fd5b5061013561039e366004611acc565b610e7f565b3480156103af57600080fd5b506101b360ca5481565b3480156103c557600080fd5b506101356103d43660046118ba565b611000565b3480156103e557600080fd5b506101356103f4366004611a3f565b61109d565b33610402610b1d565b6001600160a01b0316146104315760405162461bcd60e51b815260040161042890611af6565b60405180910390fd5b8160cd60008282546104439190611b41565b909155505060cb5461045f906001600160a01b031682846110d7565b5050565b6001600160a01b038116600090815260d06020526040902060010154806104bb5760405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa0afa5a2a2a822a960a11b6044820152606401610428565b919050565b336104c9610b1d565b6001600160a01b0316146104ef5760405162461bcd60e51b815260040161042890611af6565b61ffff1660c955565b306001600160a01b037f000000000000000000000000ce965b256e8735911b5e569aba4508fd27afde1e1614156105415760405162461bcd60e51b815260040161042890611b58565b7f000000000000000000000000ce965b256e8735911b5e569aba4508fd27afde1e6001600160a01b031661057361113a565b6001600160a01b0316146105995760405162461bcd60e51b815260040161042890611b92565b6105a281611156565b604080516000808252602082019092526105be91839190611185565b50565b33600090815260d060209081526040918290208251606081018452815481526001820154928101839052600290910154928101929092526106505760405162461bcd60e51b815260206004820152602360248201527f6d73672e73656e64657220697320616c7265616479206e6f742061206b65657060448201526232b91760e91b6064820152608401610428565b6040518060600160405280826000015181526020016000815260200160ce544261067a9190611bcc565b905233600090815260d060209081526040808320845181558483015160018201559381015160029094019390935583810151825260cf905290812080546001600160a01b031916905560ca80549091906106d390611be4565b9091555060006040513390600080516020611d5c83398151915290600090a350565b600054610100900460ff166107105760005460ff1615610714565b303b155b6107775760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610428565b600054610100900460ff16158015610799576000805461ffff19166101011790555b6107a16112c5565b6107a96112fc565b60cb80546001600160a01b0319166001600160a01b03871617905560ce84905560c9839055816108045760405162461bcd60e51b81526004016104289060208082526004908201526353495a4560e01b604082015260600190565b60cc829055801561081b576000805461ff00191690555b5050505050565b306001600160a01b037f000000000000000000000000ce965b256e8735911b5e569aba4508fd27afde1e16141561086b5760405162461bcd60e51b815260040161042890611b58565b7f000000000000000000000000ce965b256e8735911b5e569aba4508fd27afde1e6001600160a01b031661089d61113a565b6001600160a01b0316146108c35760405162461bcd60e51b815260040161042890611b92565b6108cc82611156565b61045f82826001611185565b336108e1610b1d565b6001600160a01b0316146109075760405162461bcd60e51b815260040161042890611af6565b6109116000611333565b565b80156109315760cb54610931906001600160a01b0316333084611385565b33600090815260d060209081526040918290208251606081018452815481526001820154928101839052600290910154928101929092521561098f57805161097a908390611bcc565b33600090815260d06020526040902055505050565b600083815260cf60205260409020546001600160a01b0316156109ed5760405162461bcd60e51b81526020600482015260166024820152752634b1b2b739b2903737ba1030bb30b4b630b136329760511b6044820152606401610428565b60008311610a0d5760405162461bcd60e51b815260040161042890611bfb565b60c954831115610a2f5760405162461bcd60e51b815260040161042890611bfb565b8051600090610a3f908490611bcc565b905060cc54811015610a8f5760405162461bcd60e51b815260206004820152601960248201527824b739bab33334b1b4b2b73a103137b7321030b6b7bab73a1760391b6044820152606401610428565b60ca60008154610a9e90611c23565b9091555060408051606081018252828152602080820187815260008385018181523380835260d08552868320955186559251600180870191909155905160029095019490945588815260cf90925283822080546001600160a01b031916821790559251919291600080516020611d5c8339815191529190a3505b505050565b6033546001600160a01b031690565b33600090815260d060209081526040918290208251606081018452815481526001820154928101929092526002015491810182905290610ba55760405162461bcd60e51b81526020600482015260146024820152732737ba1038bab2bab2b2103a37903632b0bb329760611b6044820152606401610428565b42816040015110610bf55760405162461bcd60e51b815260206004820152601a6024820152792a3930b739b332b9103232b630bc903737ba103830b9b9b2b21760311b6044820152606401610428565b805160cb54610c11916001600160a01b039091169033906110d7565b5033600090815260d0602052604081208181556001810182905560020155565b33610c3a610b1d565b6001600160a01b031614610c605760405162461bcd60e51b815260040161042890611af6565b8080610c985760405162461bcd60e51b81526020600482015260076024820152664a4f494e45525360c81b6044820152606401610428565b6000610ca5826001611bcc565b60cc54909150610cce3330610cba8685611c3e565b60cb546001600160a01b0316929190611385565b60c954831115610d0e5760405162461bcd60e51b815260206004820152600b60248201526a4d41585f4b45455045525360a81b6044820152606401610428565b60015b828114610e6057600081815260cf60205260409020546001600160a01b031615610d705760405162461bcd60e51b815260206004820152601060248201526f20b2323932b9b9903737ba103732bb9760811b6044820152606401610428565b8585610d7d600184611b41565b818110610d8c57610d8c611c5d565b9050602002016020810190610da191906118ba565b600082815260cf6020908152604080832080546001600160a01b0319166001600160a01b039590951694909417909355825160608101845285815290810184905291820181905260d0908888610df8600187611b41565b818110610e0757610e07611c5d565b9050602002016020810190610e1c91906118ba565b6001600160a01b031681526020808201929092526040908101600020835181559183015160018301559190910151600290910155610e5981611c23565b9050610d11565b508260ca6000828254610e739190611bcc565b90915550505050505050565b33610e88610b1d565b6001600160a01b031614610eae5760405162461bcd60e51b815260040161042890611af6565b6001600160a01b038216600090815260d06020908152604091829020825160608101845281548082526001830154938201939093526002909101549281019290925282811015610efc578092505b6000610f088483611b41565b90508360cd6000828254610f1c9190611bcc565b909155505060cc5481108015610f36575060008360200151115b15610fb957602080840151600090815260cf8252604080822080546001600160a01b03191690556001600160a01b038816825260d090925290812060010181905560ca8054909190610f8790611be4565b909155506001600160a01b03808616600090815260d0602052604081205560cb54610fb4911686836110d7565b610fd5565b6001600160a01b038516600090815260d0602052604090208190555b60026040516001600160a01b03871690600080516020611d5c83398151915290600090a35050505050565b33611009610b1d565b6001600160a01b03161461102f5760405162461bcd60e51b815260040161042890611af6565b6001600160a01b0381166110945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610428565b6105be81611333565b336110a6610b1d565b6001600160a01b0316146110cc5760405162461bcd60e51b815260040161042890611af6565b60cc55565b3b151590565b6040516001600160a01b038316602482015260448101829052610b1890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526113c3565b600080516020611d9c833981519152546001600160a01b031690565b3361115f610b1d565b6001600160a01b0316146105be5760405162461bcd60e51b815260040161042890611af6565b600061118f61113a565b905061119a84611498565b6000835111806111a75750815b156111b8576111b6848461152b565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff1661081b57805460ff19166001178155604051611233908690611204908590602401611a2b565b60408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b17905261152b565b50805460ff1916815561124461113a565b6001600160a01b0316826001600160a01b0316146112bc5760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610428565b61081b85611616565b600054610100900460ff166112ec5760405162461bcd60e51b815260040161042890611c73565b6112f4611656565b610911611656565b600054610100900460ff166113235760405162461bcd60e51b815260040161042890611c73565b61132b611656565b61091161167d565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526113bd9085906323b872dd60e01b90608401611103565b50505050565b6000611418826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116ad9092919063ffffffff16565b90508051600014806114395750808060200190518101906114399190611cbe565b610b185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610428565b803b6114fc5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610428565b600080516020611d9c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b61158a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610428565b600080846001600160a01b0316846040516115a59190611d0c565b600060405180830381855af49150503d80600081146115e0576040519150601f19603f3d011682016040523d82523d6000602084013e6115e5565b606091505b509150915061160d8282604051806060016040528060278152602001611dbc602791396116c6565b95945050505050565b61161f81611498565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600054610100900460ff166109115760405162461bcd60e51b815260040161042890611c73565b600054610100900460ff166116a45760405162461bcd60e51b815260040161042890611c73565b61091133611333565b60606116bc84846000856116ff565b90505b9392505050565b606083156116d55750816116bf565b8251156116e55782518084602001fd5b8160405162461bcd60e51b81526004016104289190611d28565b6060824710156117605760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610428565b600080866001600160a01b0316858760405161177c9190611d0c565b60006040518083038185875af1925050503d80600081146117b9576040519150601f19603f3d011682016040523d82523d6000602084013e6117be565b606091505b50915091506117cf878383876117dc565b925050505b949350505050565b60608315611848578251611841576001600160a01b0385163b6118415760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610428565b50816117d4565b6117d4838381511561185d5781518083602001fd5b8060405162461bcd60e51b81526004016104289190611d28565b80356001600160a01b03811681146104bb57600080fd5b600080604083850312156118a157600080fd5b823591506118b160208401611877565b90509250929050565b6000602082840312156118cc57600080fd5b6116bf82611877565b6000602082840312156118e757600080fd5b813561ffff811681146116bf57600080fd5b6000806000806080858703121561190f57600080fd5b61191885611877565b966020860135965060408601359560600135945092505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561195b57600080fd5b61196483611877565b915060208301356001600160401b038082111561198057600080fd5b818501915085601f83011261199457600080fd5b8135818111156119a6576119a6611932565b604051601f8201601f19908116603f011681019083821181831017156119ce576119ce611932565b816040528281528860208487010111156119e757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008060408385031215611a1c57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215611a5157600080fd5b5035919050565b60008060208385031215611a6b57600080fd5b82356001600160401b0380821115611a8257600080fd5b818501915085601f830112611a9657600080fd5b813581811115611aa557600080fd5b8660208260051b8501011115611aba57600080fd5b60209290920196919550909350505050565b60008060408385031215611adf57600080fd5b611ae883611877565b946020939093013593505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611b5357611b53611b2b565b500390565b6020808252602c90820152600080516020611d7c83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020611d7c83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b60008219821115611bdf57611bdf611b2b565b500190565b600081611bf357611bf3611b2b565b506000190190565b6020808252600e908201526d2624a1a2a729a2afa72aa6a122a960911b604082015260600190565b6000600019821415611c3757611c37611b2b565b5060010190565b6000816000190483118215151615611c5857611c58611b2b565b500290565b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215611cd057600080fd5b815180151581146116bf57600080fd5b60005b83811015611cfb578181015183820152602001611ce3565b838111156113bd5750506000910152565b60008251611d1e818460208701611ce0565b9190910192915050565b6020815260008251806020840152611d47816040850160208701611ce0565b601f01601f1916919091016040019291505056fe02ab42f6b82517d797a585d5319a95696ea5167a6fbb0e0322c9ee66edec682c46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212202b5c3b694736761672df5da732236942f9aed1bc54962d93ffd7909456f1fcb264736f6c634300080c0033