Contract 0x010564ada45f11588e3e4b965bad083b4439b5cf

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xbeee907fafcd6f2d217d9a0b82d125254a87c70771aa6a2293538b772ecd2a550x60a0604058009492022-11-30 13:44:4869 days 6 hrs ago0x902a3f17114f815573cb1d87e16a027d52e2a158 IN  Create: LiquidCro0 CRO22.418253688972 4,868.191100065
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
LiquidCro

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 29 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

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

File 2 of 29 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

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

File 3 of 29 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 4 of 29 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 29 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 6 of 29 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.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 {
    }

    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 _upgradeToAndCallUUPS(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

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

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

File 7 of 29 : 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);
}

File 8 of 29 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * 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 prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 9 of 29 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
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, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    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 Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate that the this implementation remains valid after an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(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);
        _upgradeToAndCallUUPS(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;

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

File 10 of 29 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

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

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

File 11 of 29 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

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

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

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

    uint256 private _status;

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

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

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

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

        _;

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

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

File 12 of 29 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

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

File 13 of 29 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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);
}

File 14 of 29 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 15 of 29 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

File 16 of 29 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

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

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

File 17 of 29 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

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

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

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

File 18 of 29 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 19 of 29 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

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

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

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

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

File 20 of 29 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 21 of 29 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @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 == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`.
        // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
        // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
        // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
        // good first aproximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1;
        uint256 x = a;
        if (x >> 128 > 0) {
            x >>= 128;
            result <<= 64;
        }
        if (x >> 64 > 0) {
            x >>= 64;
            result <<= 32;
        }
        if (x >> 32 > 0) {
            x >>= 32;
            result <<= 16;
        }
        if (x >> 16 > 0) {
            x >>= 16;
            result <<= 8;
        }
        if (x >> 8 > 0) {
            x >>= 8;
            result <<= 4;
        }
        if (x >> 4 > 0) {
            x >>= 4;
            result <<= 2;
        }
        if (x >> 2 > 0) {
            result <<= 1;
        }

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        uint256 result = sqrt(a);
        if (rounding == Rounding.Up && result * result < a) {
            result += 1;
        }
        return result;
    }
}

File 22 of 29 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 23 of 29 : LiquidCro.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./UUPSUpgradeableWithDelay.sol";
import "./interfaces/ILiquidCro.sol";
import "./LiquidCroStorage.sol";

contract LiquidCro is
    ILiquidCro,
    ERC20Upgradeable,
    UUPSUpgradeableWithDelay,
    PausableUpgradeable,
    AccessControlEnumerableUpgradeable,
    ReentrancyGuardUpgradeable,
    LiquidCroStorage
{
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    /// @notice Emitted when user stake CRO
    event Stake(address indexed receiver, uint256 croAmount, uint256 shareAmount);

    /// @notice Emitted when a user request to unbond their staked cro
    event RequestUnbond(
        address indexed receiver,
        uint256 indexed tokenId,
        uint256 shareAmount,
        uint256 liquidCro2CroExchangeRate,
        uint256 batchNo
    );

    /// @notice Emitted when a user redeems the NFT for CRO
    event Unbond(address indexed receiver, uint256 indexed tokenId, uint256 croAmount, uint256 croFeeAmount);

    /// @notice Emitted when the bot has an update for an unbonding batch
    event SetUnbondingBatchStatus(uint256 batchNo, UnbondingStatus status);

    /// @notice Emitted when the bot claim reward on Crypto.org
    event AccrueReward(uint256 indexed amount, string indexed txnHash);

    /// @notice Emitted when a slash happen on unbonding request
    event SlashRequest(uint256 tokenId, uint256 oldExchangeRate, uint256 newExchangeRate);

    /// @notice Emitted when a slash happen on Crypto.org
    event Slash(string indexed validatorAddress, uint256 indexed amount, uint256 time);

    /// @notice Emitted when a new bridge destination on Crypto.org is set
    event SetBridgeDestination(string oldDestination, string newDestination);

    /// @notice Emitted when the CRO is bridged over to Crypto.org
    event Bridge(uint256 amount);

    /// @notice Emitted when CRO is bridged from Crypto.org back to contract
    event Deposit(uint256 amount);

    /// @notice Emitted when new unbonding fee is set
    event SetUnbondingFee(uint256 oldFee, uint256 newFee);

    /// @notice Emitted when new treasury is set
    event SetTreasury(address oldTreasury, address newTreasury);

    /// @notice Emitted when new ibc receiver is set
    event SetIBCReceiver(address oldReceiver, address newReceiver);

    /// @notice Emitted when the unbonding duration is updated
    event SetUnbondingDuration(uint256 oldUnbondingDuration, uint256 newUnbondingDuration);

    // @notice Emitted when unbonding processing time is updated
    event SetUnbondingMaxProcessingTime(
        uint256 oldUnbondingMaxProcessingDuration,
        uint256 newUnbondingMaxProcessingDuration
    );

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

    /**
     * @param _venoNft NFT address
     * @param _croBridge Bridge CRO to Crypto.org chain
     * @param _ibcReceiver IBC fund from crypto.org are IBC to here
     * @param _treasury Withdrawal fee will be sent here
     * @param _upgradeDelay Time to wait before new upgrade implementation
     */
    function initialize(
        IVenoNft _venoNft,
        ICroBridge _croBridge,
        IIBCReceiver _ibcReceiver,
        address _treasury,
        uint256 _upgradeDelay
    ) public initializer {
        require(address(_venoNft) != address(0), "venoNft addresss zero");
        require(address(_croBridge) != address(0), "croBridge address zero");
        require(address(_ibcReceiver) != address(0), "ibcReceiver address zero");
        require(_treasury != address(0), "treasury address zero");
        require(_upgradeDelay > 0, "upgradeDelay is zero");

        venoNft = _venoNft;
        croBridge = _croBridge;
        ibcReceiver = _ibcReceiver;
        treasury = _treasury;

        // Default 0.2%
        unbondingFee = 200;
        unbondingDuration = 28 days;

        // 4 days from max 7 concurrent unbonding request and 12 hours for:
        // 1) bot to process unbonding
        // 2) bot to IBC the cro back after unbonding
        // When the protocol is stable, the 12 hours can be reduced gradually
        unbondingProcessingTime = 4 days + 12 hours;

        // Set batch 0 as pending status
        batch2UnbondingStatus[currentUnbondingBatchNo] = UnbondingStatus.PENDING_BOT;

        __ERC20_init("Liquid CRO", "LCRO");
        __UUPSUpgradeableWithDelay_init(_upgradeDelay);
        __Pausable_init();
        __AccessControl_init();
        __ReentrancyGuard_init();

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    function stake(address _receiver) external payable override nonReentrant whenNotPaused returns (uint256) {
        require(_receiver != address(0), "ZERO_ADDRESS");
        require(msg.value > 0, "ZERO_DEPOSIT");
        require(msg.value % 1e10 == 0, "MAX_8_DECIMALS");

        uint256 shareAmount = convertToShare(msg.value);
        _mint(_receiver, shareAmount);

        totalPooledCro += msg.value;
        totalCroToBridge += msg.value;

        emit Stake(_receiver, msg.value, shareAmount);
        return shareAmount;
    }

    function requestUnbond(
        uint256 _shareAmount,
        address _receiver
    ) external override nonReentrant whenNotPaused returns (uint256) {
        require(_receiver != address(0), "ZERO_ADDRESS");
        require(_shareAmount > 0, "ZERO_SHAREAMOUNT");

        uint256 unlockTime = getUnbondUnlockDate();
        uint256 tokenId = venoNft.mint(_receiver);
        unbondRequests.add(tokenId);

        uint256 liquidCro2CroExchangeRate = (totalPooledCro * EXCHANGE_RATE_PRECISION) / totalSupply();
        token2UnbondRequest[tokenId] = UnbondRequest({
            unlockStartTime: uint128(block.timestamp),
            unlockEndTime: uint128(unlockTime),
            liquidCroAmount: _shareAmount,
            liquidCro2CroExchangeRate: liquidCro2CroExchangeRate,
            batchNo: currentUnbondingBatchNo
        });

        // Reduce totalPooledCro in protocol and burn share
        totalPooledCro -= (_shareAmount * liquidCro2CroExchangeRate) / EXCHANGE_RATE_PRECISION;
        _burn(msg.sender, _shareAmount);

        emit RequestUnbond(
            _receiver,
            tokenId,
            _shareAmount,
            liquidCro2CroExchangeRate,
            currentUnbondingBatchNo
        );
        return tokenId;
    }

    function batchUnbond(
        uint256[] calldata _tokenIds,
        address _receiver
    ) external override returns (uint256) {
        uint256 totalCroAmt;
        for (uint256 i; i < _tokenIds.length; i++) {
            totalCroAmt += unbond(_tokenIds[i], _receiver);
        }

        return totalCroAmt;
    }

    function unbond(
        uint256 _tokenId,
        address _receiver
    ) public override nonReentrant whenNotPaused returns (uint256) {
        require(_receiver != address(0), "ZERO_ADDRESS");
        require(venoNft.isApprovedOrOwner(msg.sender, _tokenId), "NOT_OWNER");

        UnbondRequest storage unbondRequest = token2UnbondRequest[_tokenId];
        require(unbondRequest.unlockEndTime <= block.timestamp, "NOT_UNLOCK_YET");

        UnbondingStatus status = batch2UnbondingStatus[unbondRequest.batchNo];
        require(status == UnbondingStatus.UNBONDED, "NOT_UNBONDED_YET");

        // Collect any pending CRO - this would prevent a situation where fund are in IBCReceiver
        // and the bot have not take the fund over
        if (address(ibcReceiver).balance > 0) {
            ibcReceiver.transfer();
        }

        // Burn NFT
        venoNft.burn(_tokenId);
        unbondRequests.remove(_tokenId);

        uint256 totalCroAmount = (unbondRequest.liquidCroAmount * unbondRequest.liquidCro2CroExchangeRate) /
            EXCHANGE_RATE_PRECISION;

        // Send cro fee amount to treasury
        uint256 croFeeAmount = (totalCroAmount * unbondingFee) / UNBONDING_FEE_DENOMINATOR;
        payable(treasury).transfer(croFeeAmount);

        // Send cro amount to user
        uint256 croAmount = totalCroAmount - croFeeAmount;
        payable(_receiver).transfer(croAmount);

        emit Unbond(_receiver, _tokenId, croAmount, croFeeAmount);
        return croAmount;
    }

    /// @dev deposit CRO into the contract, meant mostly for IBCReceiver to call
    function deposit() external payable override {
        emit Deposit(msg.value);
    }

    /*********************************************************************************
     *                                                                               *
     *                    BOT AND ADMIN-ONLY FUNCTIONS                               *
     *                                                                               *
     *********************************************************************************/

    function accrueReward(uint256 amount, string calldata txnHash) external override onlyRole(ROLE_BOT) {
        require(amount > 0, "ZERO_AMOUNT");
        require(txnHash2AccrueRewardAmount[txnHash] == 0, "ACCRUE_RECORDED");

        totalPooledCro += amount;
        txnHash2AccrueRewardAmount[txnHash] = amount;

        emit AccrueReward(amount, txnHash);
    }

    function bridge(uint256 amount) external override onlyRole(ROLE_BOT) {
        require(amount <= totalCroToBridge, "amount must be smaller than totalCroToBridge");

        require(bytes(bridgeDestination).length > 0, "EMPTY_DESTINATION");

        totalCroToBridge -= amount;
        croBridge.send_cro_to_crypto_org{value: amount}(bridgeDestination);

        emit Bridge(amount);
    }

    function setUnbondingBatchStatus(uint256 _batchNo, UnbondingStatus _status) external onlyRole(ROLE_BOT) {
        require(_status != UnbondingStatus.PENDING_BOT, "PENDING_BOT set by contract only");
        require(_batchNo <= currentUnbondingBatchNo, "Cannot set future batch");
        UnbondingStatus batchStatus = batch2UnbondingStatus[_batchNo];

        if (_status == UnbondingStatus.PROCESSING) {
            // Processing - When bot started to process the unbonding requests
            require(_batchNo == currentUnbondingBatchNo, "Should process only current batch number");
            require(batchStatus == UnbondingStatus.PENDING_BOT, "batchStatus should be PENDING_BOT");

            if (_batchNo > 0) {
                // theres a previous batch, double check previous batch status is unbonding or unbonded
                UnbondingStatus prevStatus = batch2UnbondingStatus[_batchNo - 1];
                require(
                    prevStatus == UnbondingStatus.UNBONDING || prevStatus == UnbondingStatus.UNBONDED,
                    "previous batch should be unbonding or unbonded"
                );
            }

            // new unbonding request will be in next batch
            currentUnbondingBatchNo += 1;

            batch2UnbondingStatus[_batchNo] = UnbondingStatus.PROCESSING;
            emit SetUnbondingBatchStatus(_batchNo, UnbondingStatus.PROCESSING);

            // Set the new batch to PENDING_BOT status
            batch2UnbondingStatus[currentUnbondingBatchNo] = UnbondingStatus.PENDING_BOT;
            emit SetUnbondingBatchStatus(currentUnbondingBatchNo, UnbondingStatus.PENDING_BOT);
        } else if (_status == UnbondingStatus.UNBONDING) {
            // Unbonding - When bot has successfully informed validator to start unbonding
            require(batchStatus == UnbondingStatus.PROCESSING, "batchStatus should be PROCESSING");

            // Also update lastUnbondTime
            lastUnbondTime = block.timestamp;

            batch2UnbondingStatus[_batchNo] = UnbondingStatus.UNBONDING;
            emit SetUnbondingBatchStatus(_batchNo, UnbondingStatus.UNBONDING);
        } else if (_status == UnbondingStatus.UNBONDED) {
            // UNBONDED - When bot has IBC the fund for the batch back to cronos
            require(batchStatus == UnbondingStatus.UNBONDING, "batchStatus should be UNBONDING");

            batch2UnbondingStatus[_batchNo] = UnbondingStatus.UNBONDED;
            emit SetUnbondingBatchStatus(_batchNo, UnbondingStatus.UNBONDED);
        }
    }

    function pauseDueSlashing() external onlyRole(ROLE_BOT) {
        _pause();
    }

    function togglePause() external onlyRole(DEFAULT_ADMIN_ROLE) {
        paused() ? _unpause() : _pause();
    }

    function slashUnbondingRequests(
        uint256[] calldata _tokenIds,
        uint256[] calldata _newRates
    ) external onlyRole(ROLE_SLASHER) {
        require(_tokenIds.length == _newRates.length, "Both input length must match");

        for (uint256 i = 0; i < _tokenIds.length; i++) {
            UnbondRequest storage request = token2UnbondRequest[_tokenIds[i]];
            require(request.liquidCro2CroExchangeRate > _newRates[i], "New exchange rate must be lower");
            require(
                (request.liquidCro2CroExchangeRate * 9) / 10 <= _newRates[i],
                "New exchange rate cannot drop more than 10 percent"
            );

            uint256 oldRate = request.liquidCro2CroExchangeRate;
            request.liquidCro2CroExchangeRate = _newRates[i];

            emit SlashRequest(_tokenIds[i], oldRate, _newRates[i]);
        }
    }

    /**
     * @dev see interface on detailed instruction, only execute this after calculating how much
     *      cro to slash between unbonding users / protocol (both parties should slash by equal percentage)
     */
    function slash(
        string calldata _validatorAddress,
        uint256 _amount,
        uint256 _time
    ) external override onlyRole(ROLE_SLASHER) {
        require(validator2Time2AmountSlashed[_validatorAddress][_time] == 0, "SLASH_RECORDED");
        require(_amount > 0, "ZERO_AMOUNT");
        // totalPooledCro cannot go to 0, otherwise convertToShare will not mint the correct share for new stakers
        require(_amount < totalPooledCro, "amount must be less than totalPooledCro");

        validator2Time2AmountSlashed[_validatorAddress][_time] = _amount;
        totalPooledCro -= _amount;

        emit Slash(_validatorAddress, _amount, _time);
    }

    function setBridgeDestination(string memory _destination) external onlyRole(DEFAULT_ADMIN_ROLE) {
        //TODO: potentially better validation on destination
        require(bytes(_destination).length > 0, "EMPTY_DESTINATION");

        string memory oldDestination = bridgeDestination;
        bridgeDestination = _destination;
        emit SetBridgeDestination(oldDestination, _destination);
    }

    /// @param _unbondingFee - 100 = 0.1%
    function setUnbondingFee(uint256 _unbondingFee) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_unbondingFee <= 1000, "Fee must be 1% or lower");

        uint256 oldUnbondingFee = unbondingFee;
        unbondingFee = _unbondingFee;
        emit SetUnbondingFee(oldUnbondingFee, unbondingFee);
    }

    function setTreasury(address _treasury) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_treasury != address(0), "EMPTY_ADDRESS");

        address oldTreasury = treasury;
        treasury = _treasury;
        emit SetTreasury(oldTreasury, treasury);
    }

    function setIBCReceiver(address _ibcReceiver) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_ibcReceiver != address(0), "EMPTY_ADDRESS");

        address oldIbcReceiver = address(ibcReceiver);
        ibcReceiver = IIBCReceiver(_ibcReceiver);
        emit SetIBCReceiver(oldIbcReceiver, _ibcReceiver);
    }

    /**
     * @dev only called if Crypto org has a new proposal which changes the unbonding duration
     */
    function setUnbondingDuration(uint256 _unbondingDuration) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_unbondingDuration <= 28 days, "_unbondingDuration is too high");

        uint256 oldUnbondingDuration = unbondingDuration;
        unbondingDuration = _unbondingDuration;

        emit SetUnbondingDuration(oldUnbondingDuration, _unbondingDuration);
    }

    /**
     * @dev Set unbonding processing time. Together with unbondingDuration, they will be used to
     *      estimate the unlock time for user's unbonding request. This value might be tweaked based
     *      on how stable IBC and bot are to avoid under-promising the user the unlock time.
     */
    function setUnbondingProcessingTime(
        uint256 _unbondingProcessingTime
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_unbondingProcessingTime <= 7 days, "_unbondingProcessingTime is too high");

        uint256 oldUnbondingProcessingTime = unbondingProcessingTime;
        unbondingProcessingTime = _unbondingProcessingTime;

        emit SetUnbondingMaxProcessingTime(oldUnbondingProcessingTime, _unbondingProcessingTime);
    }

    /*********************************************************************************
     *                                                                               *
     *                            VIEW-ONLY FUNCTIONS                                *
     *                                                                               *
     *********************************************************************************/

    /**
     * @dev In the future with ICA, this function could call ICA contract to retrieve
     *      totalCRO staked across validators.
     */
    function getTotalPooledCro() public view returns (uint256) {
        return totalPooledCro;
    }

    function convertToShare(uint256 croAmount) public view override returns (uint256) {
        uint256 totalSupply = totalSupply();

        if (totalSupply == 0) return croAmount;

        uint256 share = (croAmount * totalSupply) / totalPooledCro;
        // Protect user in the case where user deposit in small amount resulting in 0 share
        require(share > 0, "Invalid share");

        return share;
    }

    function convertToAsset(uint256 shareAmount) public view override returns (uint256) {
        uint256 totalSupply = totalSupply();

        // if totalSupply == 0, it means either (1) protocol just launched or (2) protocol got slashed until 0
        // in either case, returning 0 is expected as LCRO will swap to 0 CRO
        if (totalSupply == 0) return 0;
        return (shareAmount * totalPooledCro) / totalSupply;
    }

    function convertToAssetWithUnbondingFee(
        uint256 shareAmount
    ) public view override returns (uint256 croAmt, uint256 unbondingFeeAmt) {
        uint256 totalCroAmount = convertToAsset(shareAmount);

        unbondingFeeAmt = (totalCroAmount * unbondingFee) / UNBONDING_FEE_DENOMINATOR;
        croAmt = totalCroAmount - unbondingFeeAmt;
    }

    function getUnbondRequestLength() external view returns (uint256) {
        return unbondRequests.length();
    }

    function getUnbondRequests(uint256 limit, uint256 offset) external view returns (uint256[] memory) {
        uint256[] memory elements = new uint256[](limit);

        for (uint256 i = 0; i < elements.length; i++) {
            elements[i] = unbondRequests.at(i + offset);
        }

        return elements;
    }

    /**
     * @notice This is an estimation unlock date as there can be unforseen circumstance such as
     *         IBC relayer delay or bot issue. When ICA is live, this unlock date would be accurate
     * @return unboundUnlockDate if the user unbond now
     */
    function getUnbondUnlockDate() public view returns (uint256) {
        uint256 nextUnbondTime = lastUnbondTime + unbondingProcessingTime;

        if (nextUnbondTime < block.timestamp) {
            // nextUnbondTime lesser when
            // 1. contract just deployed, lastUnbondTime = 0
            // 2. Bot has not unbonded since 4 days 15 mins ago (could be due to bot issue)
            return block.timestamp + unbondingProcessingTime + unbondingDuration;
        }

        return nextUnbondTime + unbondingDuration;
    }

    /*********************************************************************************
     *                                                                               *
     *                            INTERNAL FUNCTIONS                                 *
     *                                                                               *
     *********************************************************************************/

    /**
     * @dev Required by UUPSUpgradeableWithDelay
     */
    function _authorizeUpgradeWithDelay(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {}
}

File 24 of 29 : LiquidCroStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "./interfaces/IVenoNft.sol";
import "./interfaces/ICroBridge.sol";
import "./interfaces/IIBCReceiver.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

/**
 * @title LiquidCroStorage
 * @dev Contains all the storage for LiquidCro. As LiquidCro is upgradable:
 *      1) do not remove or change the type for existing storage
 *      2) only add new storage variable (append at the last)
 */
contract LiquidCroStorage {
    enum UnbondingStatus {
        PENDING_BOT, // batch is waiting for bot process
        PROCESSING, // bot started processing, new unbonding request will be in next batch
        UNBONDING, // bot finished processing unbonding request for this batch
        UNBONDED // batch is unbonded, user can claim
    }

    struct UnbondRequest {
        // timestamp of when unlock request starts
        uint128 unlockStartTime;
        // timestamp of when unlock request ends
        uint128 unlockEndTime;
        // total liquidCro amount pending unlock
        uint256 liquidCroAmount;
        // liquidCro to cro rate - this can decrease in the event of slashing, require divide by 1e18
        uint256 liquidCro2CroExchangeRate;
        // unbond request batch
        uint256 batchNo;
    }

    uint8 public constant EXCHANGE_RATE_DECIMAL = 8;
    // exchange rate = totalSupply() / totalPooledCro which could be 1.01
    // multiply by 1e8 to get up to 8 decimals precision
    uint256 public constant EXCHANGE_RATE_PRECISION = 10**EXCHANGE_RATE_DECIMAL;

    /// @dev includes action such as accrueReward, bridge, pause
    bytes32 public constant ROLE_BOT = keccak256("ROLE_BOT");

    /// @dev include action involving user's fund (eg. slashing)
    bytes32 public constant ROLE_SLASHER = keccak256("ROLE_SLASHER");

    IVenoNft public venoNft;

    ICroBridge public croBridge;

    IIBCReceiver public ibcReceiver;

    // Batch no for new unbonding request, batch no will increase when current batch is processing
    uint256 public currentUnbondingBatchNo;

    // Unbonding Batch no => unbonding status
    mapping(uint256 => UnbondingStatus) public batch2UnbondingStatus;

    // tokenId to withdrawal request
    mapping(uint256 => UnbondRequest) public token2UnbondRequest;

    // list of unclaimed unbond requests
    EnumerableSetUpgradeable.UintSet internal unbondRequests;

    // Crypto.org txn hash ==> reward accrued
    mapping(string => uint256) public txnHash2AccrueRewardAmount;

    // validator address => time => amount
    mapping(string => mapping(uint256 => uint256)) public validator2Time2AmountSlashed;

    address public treasury;

    // Unbonding fee - 100 = 0.1%, 200 = 0.2%
    uint256 public unbondingFee;

    // Unbonding time by the bot, eg. 4 days 15 mins at the worst case
    // 1. 4 days from max 7 unbonding per validator
    // 2. 15 mins from bot processing (gather unbonding request or ibc back to cronos)
    uint256 public unbondingProcessingTime;

    // Unbonding duration - eg. 28 days
    uint256 public unbondingDuration;

    // 1000 = 1% for unbonding fee, thus 100_000 represent 100%
    uint256 public constant UNBONDING_FEE_DENOMINATOR = 100_000;

    // The total amount of CRO with the protocol
    uint256 public totalPooledCro;

    // Last time where bot unbond from delegator
    uint256 public lastUnbondTime;

    // Total amount of CRO pending to be bridged and delegated
    uint256 public totalCroToBridge;

    // Bridge destination on Crypto.org chain
    string public bridgeDestination;
}

File 25 of 29 : UUPSUpgradeableWithDelay.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

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

/**
 * @title  UUPSUpgradeableWithDelay
 * @notice extends UUPSUpgradeable to include a time delay before protocol can upgrade implementation
 */
abstract contract UUPSUpgradeableWithDelay is UUPSUpgradeable {
    uint256 public UPGRADE_DELAY;

    // implementation address => upgrade time
    mapping(address => uint256) public implementationToUpgradeTime;

    event SignalUpgrade(address, uint256);

    function __UUPSUpgradeableWithDelay_init(uint256 delay) internal onlyInitializing {
        UPGRADE_DELAY = delay;
        __UUPSUpgradeable_init();
    }

    function signalUpgrade(address _implementation) public virtual {
        _authorizeUpgradeWithDelay(_implementation);

        uint256 upgradeTime = block.timestamp + UPGRADE_DELAY;
        implementationToUpgradeTime[_implementation] = upgradeTime;

        emit SignalUpgrade(_implementation, upgradeTime);
    }

    function _authorizeUpgrade(address _implementation) internal override {
        _authorizeUpgradeWithDelay(_implementation);

        uint256 upgradeTime = implementationToUpgradeTime[_implementation];
        require(upgradeTime > 0, "NOT_SIGNALED");

        require(upgradeTime <= block.timestamp, "STILL_UNDER_DELAY");

        // Remove address from mapping such that a new signal is required
        implementationToUpgradeTime[_implementation] = 0;
    }

    function _authorizeUpgradeWithDelay(address) internal virtual;
}

File 26 of 29 : ICroBridge.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

/**
 * Reference from https://github.com/crypto-org-chain/cronos-public-contracts/blob/master/CROBridge/CROBridge.sol
 */
interface ICroBridge {
    // Pay the contract a certain CRO amount and trigger a CRO transfer
    // from the contract to recipient through IBC
    function send_cro_to_crypto_org(string memory recipient) external payable;
}

File 27 of 29 : IIBCReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

interface IIBCReceiver {
    /**
     * Initiate a transfer to LiquidCro
     */
    function transfer() external;
}

File 28 of 29 : ILiquidCro.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "../LiquidCroStorage.sol";

interface ILiquidCro {
    /**
     * @notice Process user's cro deposit and mint LiquidCro to receiver
     * @return minted shares from user's deposit
     */
    function stake(address receiver) external payable returns (uint256);

    /**
     * @notice Process user's unbonding request - conversion of LiquidCro to
     *         staked CRO. Also mint an ERC-721 NFT to represent the request
     * @param shareAmount Total share amount to unbound
     * @param receiver To receive the ERC-721 NFT
     * @return tokenId ERC721 tokenId
     */
    function requestUnbond(uint256 shareAmount, address receiver) external returns (uint256);

    /**
     * @notice Batch unbond, swapping list of tokenIds for CRO amount
     * @param _tokenIds array of ERC-721 received when receiver requestUnbond
     * @return croAmount Represent total CRO user receives for the batch
     */
    function batchUnbond(uint256[] calldata _tokenIds, address _receiver) external returns (uint256);

    /**
     * @notice After cooldown period, return user's CRO
     * @param tokenId of ERC-721 received when receiver requestUnbond
     * @return croAmount Represent total CRO user receives
     */
    function unbond(uint256 tokenId, address receiver) external returns (uint256);

    /*********************************************************************************
     *                                                                               *
     *                            BOT-RELATED FUNCTIONS                               *
     *                                                                               *
     *********************************************************************************/

    /**
     * @notice Bridge CRO to Crypto.org chain
     */
    function bridge(uint256 amount) external;

    /**
     * @notice Accrue staking reward to the pool
     * @param amount of cro reward from GetReward call at Crypto.org
     * @param txnHash Hash of GetReward call
     */
    function accrueReward(uint256 amount, string calldata txnHash) external;

    /**
     * @notice Initiated by protocol only when validator receive slashing, protocol take loss as a whole
     * @param validatorAddress Slashed validator
     * @param amount of cro slashed
     * @param time When the slash happened on Crypto.org
     */
    function slash(
        string calldata validatorAddress,
        uint256 amount,
        uint256 time
    ) external;

    /**
     * @notice Initiated by protocol only when validator receive slashing, protocol take loss as a whole
     * @param _tokenIds list of unbonding requests to slash
     * @param _exchangeRates updated exchange rate for each request
     */
    function slashUnbondingRequests(uint256[] calldata _tokenIds, uint256[] calldata _exchangeRates) external;

    /**
     * @notice Deposit CRO into the contract without minting share
     * @dev Called by IBCReceiver to deposit bridged CRO from Crypto org
     */
    function deposit() external payable;

    /**
     * @notice Update the batch processing status
     * @param _batchNo to update
     * @param _status to be update for the batch
     */
    function setUnbondingBatchStatus(uint256 _batchNo, LiquidCroStorage.UnbondingStatus _status) external;

    /*********************************************************************************
     *                                                                               *
     *                            VIEW FUNCTIONS                                     *
     *                                                                               *
     *********************************************************************************/

    /**
     * @return The amount of share that correspond to this croAmount
     */
    function convertToShare(uint256 croAmount) external view returns (uint256);

    /**
     * @return The amount of CRO that corresponds to this shareAmount
     */
    function convertToAsset(uint256 shareAmount) external view returns (uint256);

    /**
     * @notice helper function for FE to get the fee and cro amount
     * @return croAmt Amount of cro user will receive after deducting unbondingFee
     * @return unbondingFeeAmt Amount of cro amount taken as unbondingFee
     */
    function convertToAssetWithUnbondingFee(uint256 shareAmount)
        external
        view
        returns (uint256 croAmt, uint256 unbondingFeeAmt);

    /**
     * @return length of unclaimed unbonding requests
     */
    function getUnbondRequestLength() external view returns (uint256);

    /**
     * @param limit number of results to return
     * @param offset starting index of result
     * @return list of tokensId
     */
    function getUnbondRequests(uint256 limit, uint256 offset) external view returns (uint256[] memory);

    /**
     * @notice returns the next unlock date for new unbonding request
     * @return timestamp in sec on next unlock date
     */
    function getUnbondUnlockDate() external view returns (uint256);
}

File 29 of 29 : IVenoNft.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

interface IVenoNft {
    function mint(address to) external returns (uint256);

    function burn(uint256 tokenId) external;

    function isApprovedOrOwner(address spender, uint256 tokenId) external returns (bool);
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solidity-datetime/=lib/solidity-datetime/",
    "solidity-datetime/contracts/=lib/solidity-datetime/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"string","name":"txnHash","type":"string"}],"name":"AccrueReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Bridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shareAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidCro2CroExchangeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"batchNo","type":"uint256"}],"name":"RequestUnbond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"oldDestination","type":"string"},{"indexed":false,"internalType":"string","name":"newDestination","type":"string"}],"name":"SetBridgeDestination","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldReceiver","type":"address"},{"indexed":false,"internalType":"address","name":"newReceiver","type":"address"}],"name":"SetIBCReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"newTreasury","type":"address"}],"name":"SetTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"batchNo","type":"uint256"},{"indexed":false,"internalType":"enum LiquidCroStorage.UnbondingStatus","name":"status","type":"uint8"}],"name":"SetUnbondingBatchStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldUnbondingDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newUnbondingDuration","type":"uint256"}],"name":"SetUnbondingDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"SetUnbondingFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldUnbondingMaxProcessingDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newUnbondingMaxProcessingDuration","type":"uint256"}],"name":"SetUnbondingMaxProcessingTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"SignalUpgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"validatorAddress","type":"string"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"Slash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldExchangeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newExchangeRate","type":"uint256"}],"name":"SlashRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"croAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shareAmount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"croAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"croFeeAmount","type":"uint256"}],"name":"Unbond","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXCHANGE_RATE_DECIMAL","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXCHANGE_RATE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_BOT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_SLASHER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNBONDING_FEE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"txnHash","type":"string"}],"name":"accrueReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"batch2UnbondingStatus","outputs":[{"internalType":"enum LiquidCroStorage.UnbondingStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"batchUnbond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bridgeDestination","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareAmount","type":"uint256"}],"name":"convertToAsset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareAmount","type":"uint256"}],"name":"convertToAssetWithUnbondingFee","outputs":[{"internalType":"uint256","name":"croAmt","type":"uint256"},{"internalType":"uint256","name":"unbondingFeeAmt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"croAmount","type":"uint256"}],"name":"convertToShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"croBridge","outputs":[{"internalType":"contract ICroBridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentUnbondingBatchNo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalPooledCro","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnbondRequestLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"offset","type":"uint256"}],"name":"getUnbondRequests","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnbondUnlockDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ibcReceiver","outputs":[{"internalType":"contract IIBCReceiver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"implementationToUpgradeTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVenoNft","name":"_venoNft","type":"address"},{"internalType":"contract ICroBridge","name":"_croBridge","type":"address"},{"internalType":"contract IIBCReceiver","name":"_ibcReceiver","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_upgradeDelay","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastUnbondTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseDueSlashing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shareAmount","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"requestUnbond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_destination","type":"string"}],"name":"setBridgeDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ibcReceiver","type":"address"}],"name":"setIBCReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchNo","type":"uint256"},{"internalType":"enum LiquidCroStorage.UnbondingStatus","name":"_status","type":"uint8"}],"name":"setUnbondingBatchStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unbondingDuration","type":"uint256"}],"name":"setUnbondingDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unbondingFee","type":"uint256"}],"name":"setUnbondingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unbondingProcessingTime","type":"uint256"}],"name":"setUnbondingProcessingTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_implementation","type":"address"}],"name":"signalUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_validatorAddress","type":"string"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"slash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_newRates","type":"uint256[]"}],"name":"slashUnbondingRequests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"stake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"token2UnbondRequest","outputs":[{"internalType":"uint128","name":"unlockStartTime","type":"uint128"},{"internalType":"uint128","name":"unlockEndTime","type":"uint128"},{"internalType":"uint256","name":"liquidCroAmount","type":"uint256"},{"internalType":"uint256","name":"liquidCro2CroExchangeRate","type":"uint256"},{"internalType":"uint256","name":"batchNo","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalCroToBridge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPooledCro","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"txnHash2AccrueRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"unbond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unbondingDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unbondingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unbondingProcessingTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"validator2Time2AmountSlashed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"venoNft","outputs":[{"internalType":"contract IVenoNft","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516151d562000120600039600081816116f301528181611733015281816119300152818161197001526119ff01526151d56000f3fe6080604052600436106104315760003560e01c80638dad201511610229578063c4ae31681161012e578063dd62ed3e116100b6578063f06d1cd81161007a578063f06d1cd814610d03578063f0f4426014610d38578063f47def5c14610d58578063f7013ef614610da1578063fcd39b3e14610dc157600080fd5b8063dd62ed3e14610c03578063e073ba3114610c23578063e51c903414610c43578063e8fa26cc14610c5a578063e995a13314610ce357600080fd5b8063ccf6802a116100fd578063ccf6802a14610b6a578063d0e30db014610b81578063d2a6bcd314610b89578063d547741f14610baa578063d980caca14610bca57600080fd5b8063c4ae316814610afe578063c4c21b3e14610b13578063ca03294914610b33578063ca15c87314610b4a57600080fd5b80639efdc5d4116101b1578063a8ccd6ab11610180578063a8ccd6ab14610a73578063a9059cbb14610a88578063aee94c7214610aa8578063bd4ffa8714610ac8578063c4708be714610add57600080fd5b80639efdc5d4146109fc578063a217fddf14610a11578063a412deb814610a26578063a457c2d714610a5357600080fd5b806390fd50b3116101f857806390fd50b31461097b57806391d148541461099b57806395d89b41146109bb5780639b260a41146109d05780639edbe494146109e757600080fd5b80638dad2015146108f05780638fa5c00f146109245780639010d07c1461094457806390653a171461096457600080fd5b806347fe8b1d1161033a5780635b5f0547116102c25780636fbf4129116102865780636fbf412914610837578063706068251461086457806370a08231146108795780637bb34054146108af5780637c23741f146108cf57600080fd5b80635b5f05471461078f5780635c975abb146107af578063606659d4146107c75780636189c5c9146107e757806361d027b3146107fe57600080fd5b806352d1902d1161030957806352d1902d146106ef5780635396e555146107045780635467a91e1461071a57806354d9b1a91461073157806358f612561461076f57600080fd5b806347fe8b1d146106845780634b5a24651461069a5780634ccc35fb146106ba5780634f1ef286146106dc57600080fd5b806326476204116103bd5780633659cfe61161038c5780633659cfe6146105ef578063395093511461060f5780633a01b9641461062f57806340decaad1461064457806342c5dd621461066457600080fd5b8063264762041461057a5780632f2ff15d1461058d578063313ce567146105ad57806336568abe146105cf57600080fd5b8063095ea7b311610404578063095ea7b3146104d457806313467619146104f457806318160ddd1461051457806323b872dd14610529578063248a9ca31461054957600080fd5b806301f349121461043657806301ffc9a714610458578063034e09321461048d57806306fdde03146104b2575b600080fd5b34801561044257600080fd5b50610456610451366004614559565b610de1565b005b34801561046457600080fd5b50610478610473366004614595565b610f15565b60405190151581526020015b60405180910390f35b34801561049957600080fd5b506104a46101c85481565b604051908152602001610484565b3480156104be57600080fd5b506104c7610f40565b6040516104849190614617565b3480156104e057600080fd5b506104786104ef36600461463f565b610fd2565b34801561050057600080fd5b5061045661050f36600461466b565b610fea565b34801561052057600080fd5b506035546104a4565b34801561053557600080fd5b5061047861054436600461469f565b61149c565b34801561055557600080fd5b506104a46105643660046146e0565b600090815261012f602052604090206001015490565b6104a46105883660046146f9565b6114c2565b34801561059957600080fd5b506104566105a8366004614716565b611640565b3480156105b957600080fd5b5060125b60405160ff9091168152602001610484565b3480156105db57600080fd5b506104566105ea366004614716565b61166b565b3480156105fb57600080fd5b5061045661060a3660046146f9565b6116e9565b34801561061b57600080fd5b5061047861062a36600461463f565b6117c8565b34801561063b57600080fd5b506104a46117ea565b34801561065057600080fd5b5061045661065f3660046146e0565b6117f9565b34801561067057600080fd5b506104a461067f366004614786565b611896565b34801561069057600080fd5b506104a460c95481565b3480156106a657600080fd5b506104a46106b53660046146e0565b6118ed565b3480156106c657600080fd5b506104a460008051602061511983398151915281565b6104566106ea3660046147dc565b611926565b3480156106fb57600080fd5b506104a46119f2565b34801561071057600080fd5b506101d3546104a4565b34801561072657600080fd5b506104a46101d45481565b34801561073d57600080fd5b5061076261074c3660046146e0565b6101c96020526000908152604090205460ff1681565b6040516104849190614877565b34801561077b57600080fd5b5061045661078a3660046148c6565b611aa5565b34801561079b57600080fd5b506104a46107aa366004614716565b611be4565b3480156107bb57600080fd5b5060cb5460ff16610478565b3480156107d357600080fd5b506104566107e2366004614911565b611fd2565b3480156107f357600080fd5b506104a4620186a081565b34801561080a57600080fd5b506101cf5461081f906001600160a01b031681565b6040516001600160a01b039091168152602001610484565b34801561084357600080fd5b506104a46108523660046146f9565b60ca6020526000908152604090205481565b34801561087057600080fd5b5061045661224e565b34801561088557600080fd5b506104a46108943660046146f9565b6001600160a01b031660009081526033602052604090205490565b3480156108bb57600080fd5b506104566108ca3660046146e0565b61226e565b3480156108db57600080fd5b506101c55461081f906001600160a01b031681565b3480156108fc57600080fd5b506104a47f88ce96678e8eb55f90d01d2b0029590d4ab2a8433e2edc9b9683e338217a059281565b34801561093057600080fd5b5061045661093f3660046146f9565b61230a565b34801561095057600080fd5b5061081f61095f36600461497c565b6123b6565b34801561097057600080fd5b506104a46101d35481565b34801561098757600080fd5b506104566109963660046146e0565b6123cf565b3480156109a757600080fd5b506104786109b6366004614716565b61255e565b3480156109c757600080fd5b506104c761258a565b3480156109dc57600080fd5b506104a46101d55481565b3480156109f357600080fd5b506104a4612599565b348015610a0857600080fd5b506104c76125ab565b348015610a1d57600080fd5b506104a4600081565b348015610a3257600080fd5b50610a46610a4136600461497c565b61263a565b604051610484919061499e565b348015610a5f57600080fd5b50610478610a6e36600461463f565b6126db565b348015610a7f57600080fd5b506105bd600881565b348015610a9457600080fd5b50610478610aa336600461463f565b612761565b348015610ab457600080fd5b50610456610ac33660046146e0565b61276f565b348015610ad457600080fd5b506104a4612818565b348015610ae957600080fd5b506101c65461081f906001600160a01b031681565b348015610b0a57600080fd5b50610456612867565b348015610b1f57600080fd5b50610456610b2e3660046146f9565b61288c565b348015610b3f57600080fd5b506104a46101d15481565b348015610b5657600080fd5b506104a4610b653660046146e0565b6128f9565b348015610b7657600080fd5b506104a46101d25481565b610456612911565b348015610b9557600080fd5b506101c75461081f906001600160a01b031681565b348015610bb657600080fd5b50610456610bc5366004614716565b612947565b348015610bd657600080fd5b506104a4610be5366004614559565b80516020818301810180516101cd8252928201919093012091525481565b348015610c0f57600080fd5b506104a4610c1e3660046149e2565b61296d565b348015610c2f57600080fd5b506104a4610c3e3660046146e0565b612998565b348015610c4f57600080fd5b506104a46101d05481565b348015610c6657600080fd5b50610cb0610c753660046146e0565b6101ca6020526000908152604090208054600182015460028301546003909301546001600160801b0380841694600160801b90940416929085565b604080516001600160801b039687168152959094166020860152928401919091526060830152608082015260a001610484565b348015610cef57600080fd5b506104a4610cfe366004614716565b612a12565b348015610d0f57600080fd5b50610d23610d1e3660046146e0565b612c85565b60408051928352602083019190915201610484565b348015610d4457600080fd5b50610456610d533660046146f9565b612cc6565b348015610d6457600080fd5b506104a4610d73366004614a10565b81516020818401810180516101ce825292820194820194909420919093529091526000908152604090205481565b348015610dad57600080fd5b50610456610dbc366004614a54565b612d72565b348015610dcd57600080fd5b50610456610ddc366004614ab8565b613100565b6000610dec816132d8565b6000825111610e365760405162461bcd60e51b815260206004820152601160248201527022a6a82a2cafa222a9aa24a720aa24a7a760791b60448201526064015b60405180910390fd5b60006101d68054610e4690614b08565b80601f0160208091040260200160405190810160405280929190818152602001828054610e7290614b08565b8015610ebf5780601f10610e9457610100808354040283529160200191610ebf565b820191906000526020600020905b815481529060010190602001808311610ea257829003601f168201915b50505050509050826101d69081610ed69190614b88565b507fe45df32f17274cd2bb6ad5f4d9217e4a3df695d7c8fe0e343a2c52b707b75bf48184604051610f08929190614c47565b60405180910390a1505050565b60006001600160e01b03198216635a05180f60e01b1480610f3a5750610f3a826132e2565b92915050565b606060368054610f4f90614b08565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7b90614b08565b8015610fc85780601f10610f9d57610100808354040283529160200191610fc8565b820191906000526020600020905b815481529060010190602001808311610fab57829003601f168201915b5050505050905090565b600033610fe0818585613317565b5060019392505050565b600080516020615119833981519152611002816132d8565b60008260038111156110165761101661483f565b036110635760405162461bcd60e51b815260206004820181905260248201527f50454e44494e475f424f542073657420627920636f6e7472616374206f6e6c796044820152606401610e2d565b6101c8548311156110b65760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f7420736574206675747572652062617463680000000000000000006044820152606401610e2d565b60008381526101c9602052604090205460ff1660018360038111156110dd576110dd61483f565b0361131a576101c85484146111455760405162461bcd60e51b815260206004820152602860248201527f53686f756c642070726f63657373206f6e6c792063757272656e7420626174636044820152673410373ab6b132b960c11b6064820152608401610e2d565b60008160038111156111595761115961483f565b146111b05760405162461bcd60e51b815260206004820152602160248201527f62617463685374617475732073686f756c642062652050454e44494e475f424f6044820152601560fa1b6064820152608401610e2d565b83156112735760006101c9816111c7600188614c82565b815260208101919091526040016000205460ff16905060028160038111156111f1576111f161483f565b148061120e5750600381600381111561120c5761120c61483f565b145b6112715760405162461bcd60e51b815260206004820152602e60248201527f70726576696f75732062617463682073686f756c6420626520756e626f6e646960448201526d1b99c81bdc881d5b989bdb99195960921b6064820152608401610e2d565b505b60016101c860008282546112879190614c99565b909155505060008481526101c9602052604090819020805460ff191660019081179091559051600080516020615180833981519152916112c991879190614cb1565b60405180910390a16101c8805460009081526101c96020526040808220805460ff19169055915491516000805160206151808339815191529261130d929091614cb1565b60405180910390a1611496565b600283600381111561132e5761132e61483f565b036113d65760018160038111156113475761134761483f565b146113945760405162461bcd60e51b815260206004820181905260248201527f62617463685374617475732073686f756c642062652050524f43455353494e476044820152606401610e2d565b426101d45560008481526101c9602052604090819020805460ff1916600290811790915590516000805160206151808339815191529161130d91879190614cb1565b60038360038111156113ea576113ea61483f565b036114965760028160038111156114035761140361483f565b146114505760405162461bcd60e51b815260206004820152601f60248201527f62617463685374617475732073686f756c6420626520554e424f4e44494e47006044820152606401610e2d565b60008481526101c9602052604090819020805460ff1916600390811790915590516000805160206151808339815191529161148d91879190614cb1565b60405180910390a15b50505050565b6000336114aa85828561343b565b6114b58585856134af565b60019150505b9392505050565b6000600261019354036114e75760405162461bcd60e51b8152600401610e2d90614cc5565b6002610193556114f561367d565b6001600160a01b03821661151b5760405162461bcd60e51b8152600401610e2d90614cfc565b6000341161155a5760405162461bcd60e51b815260206004820152600c60248201526b16915493d7d1115413d4d25560a21b6044820152606401610e2d565b6115696402540be40034614d38565b156115a75760405162461bcd60e51b815260206004820152600e60248201526d4d41585f385f444543494d414c5360901b6044820152606401610e2d565b60006115b234612998565b90506115be83826136c5565b346101d360008282546115d19190614c99565b92505081905550346101d560008282546115eb9190614c99565b909155505060408051348152602081018390526001600160a01b038516917f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6910160405180910390a260016101935592915050565b600082815261012f602052604090206001015461165c816132d8565b61166683836137a4565b505050565b6001600160a01b03811633146116db5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610e2d565b6116e582826137c7565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036117315760405162461bcd60e51b8152600401610e2d90614d4c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661177a600080516020615139833981519152546001600160a01b031690565b6001600160a01b0316146117a05760405162461bcd60e51b8152600401610e2d90614d98565b6117a9816137ea565b604080516000808252602082019092526117c5918391906138a7565b50565b600033610fe08185856117db838361296d565b6117e59190614c99565b613317565b6117f66008600a614ec8565b81565b6000611804816132d8565b6224ea008211156118575760405162461bcd60e51b815260206004820152601e60248201527f5f756e626f6e64696e674475726174696f6e20697320746f6f206869676800006044820152606401610e2d565b6101d280549083905560408051828152602081018590527f91ca161220456b40d7cd87fc3bf71e728005ec010317b9b85fed0b5b3b6334019101610f08565b60008060005b848110156118e4576118c68686838181106118b9576118b9614ed7565b9050602002013585611be4565b6118d09083614c99565b9150806118dc81614eed565b91505061189c565b50949350505050565b6000806118f960355490565b90508060000361190c5750600092915050565b806101d3548461191c9190614f06565b6114bb9190614f25565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361196e5760405162461bcd60e51b8152600401610e2d90614d4c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166119b7600080516020615139833981519152546001600160a01b031690565b6001600160a01b0316146119dd5760405162461bcd60e51b8152600401610e2d90614d98565b6119e6826137ea565b6116e5828260016138a7565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a925760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610e2d565b5060008051602061513983398151915290565b600080516020615119833981519152611abd816132d8565b60008411611afb5760405162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b6044820152606401610e2d565b6101cd8383604051611b0e929190614f39565b908152602001604051809103902054600014611b5e5760405162461bcd60e51b815260206004820152600f60248201526e1050d0d4955157d49150d3d4911151608a1b6044820152606401610e2d565b836101d36000828254611b719190614c99565b92505081905550836101cd8484604051611b8c929190614f39565b90815260405190819003602001812091909155611bac9084908490614f39565b6040519081900381209085907f61728c6bcea2c9a14085005e8b8d5f502591ae8f1c96fe5ecaf72e51698de4bb90600090a350505050565b600060026101935403611c095760405162461bcd60e51b8152600401610e2d90614cc5565b600261019355611c1761367d565b6001600160a01b038216611c3d5760405162461bcd60e51b8152600401610e2d90614cfc565b6101c55460405163430c208160e01b8152336004820152602481018590526001600160a01b039091169063430c2081906044016020604051808303816000875af1158015611c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb39190614f49565b611ceb5760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b6044820152606401610e2d565b60008381526101ca60205260409020805442600160801b9091046001600160801b03161115611d4d5760405162461bcd60e51b815260206004820152600e60248201526d1393d517d5539313d0d2d7d6515560921b6044820152606401610e2d565b60038082015460009081526101c9602052604090205460ff1690816003811115611d7957611d7961483f565b14611db95760405162461bcd60e51b815260206004820152601060248201526f1393d517d5539093d391115117d6515560821b6044820152606401610e2d565b6101c7546001600160a01b03163115611e36576101c760009054906101000a90046001600160a01b03166001600160a01b0316638a4068dd6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611e1d57600080fd5b505af1158015611e31573d6000803e3d6000fd5b505050505b6101c554604051630852cd8d60e31b8152600481018790526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015611e7d57600080fd5b505af1158015611e91573d6000803e3d6000fd5b50505050611eaa856101cb613a1290919063ffffffff16565b506000611eb96008600a614ec8565b83600201548460010154611ecd9190614f06565b611ed79190614f25565b90506000620186a06101d05483611eee9190614f06565b611ef89190614f25565b6101cf546040519192506001600160a01b03169082156108fc029083906000818181858888f19350505050158015611f34573d6000803e3d6000fd5b506000611f418284614c82565b6040519091506001600160a01b0388169082156108fc029083906000818181858888f19350505050158015611f7a573d6000803e3d6000fd5b50604080518281526020810184905289916001600160a01b038a16917f93530ac0ee8c50e696e13c5ac62355d0c0ba4bd943620d5bda1eb08b64ae7512910160405180910390a3600161019355979650505050505050565b7f88ce96678e8eb55f90d01d2b0029590d4ab2a8433e2edc9b9683e338217a0592611ffc816132d8565b83821461204b5760405162461bcd60e51b815260206004820152601c60248201527f426f746820696e707574206c656e677468206d757374206d61746368000000006044820152606401610e2d565b60005b848110156122465760006101ca600088888581811061206f5761206f614ed7565b905060200201358152602001908152602001600020905084848381811061209857612098614ed7565b905060200201358160020154116120f15760405162461bcd60e51b815260206004820152601f60248201527f4e65772065786368616e67652072617465206d757374206265206c6f776572006044820152606401610e2d565b84848381811061210357612103614ed7565b90506020020135600a8260020154600961211d9190614f06565b6121279190614f25565b11156121905760405162461bcd60e51b815260206004820152603260248201527f4e65772065786368616e676520726174652063616e6e6f742064726f70206d6f6044820152711c99481d1a185b880c4c081c195c98d95b9d60721b6064820152608401610e2d565b60028101548585848181106121a7576121a7614ed7565b60200291909101356002840155507feac30fac47eb846b6257fa6f8ba1b30a0e896146a731cdee7bcb7edaca13bb2b8888858181106121e8576121e8614ed7565b905060200201358288888781811061220257612202614ed7565b90506020020135604051612229939291909283526020830191909152604082015260600190565b60405180910390a15050808061223e90614eed565b91505061204e565b505050505050565b600080516020615119833981519152612266816132d8565b6117c5613a1e565b6000612279816132d8565b6103e88211156122cb5760405162461bcd60e51b815260206004820152601760248201527f466565206d757374206265203125206f72206c6f7765720000000000000000006044820152606401610e2d565b6101d080549083905560408051828152602081018590527ffad00e6b4312d4e0df37a950d852b89a83f19b553969c1b8d34e6ea31ad3f4c39101610f08565b6000612315816132d8565b6001600160a01b03821661235b5760405162461bcd60e51b815260206004820152600d60248201526c454d5054595f4144445245535360981b6044820152606401610e2d565b6101c780546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527fbeddd1f54f9db4e5b3d6408bd9ead8dad743b1d4df18b3d08f4b90c3cfbe58a89101610f08565b6000828152610161602052604081206114bb9083613a73565b6000805160206151198339815191526123e7816132d8565b6101d55482111561244f5760405162461bcd60e51b815260206004820152602c60248201527f616d6f756e74206d75737420626520736d616c6c6572207468616e20746f746160448201526b6c43726f546f42726964676560a01b6064820152608401610e2d565b60006101d6805461245f90614b08565b9050116124a25760405162461bcd60e51b815260206004820152601160248201527022a6a82a2cafa222a9aa24a720aa24a7a760791b6044820152606401610e2d565b816101d560008282546124b59190614c82565b90915550506101c654604051630c41cc2760e41b81526001600160a01b039091169063c41cc2709084906124ef906101d690600401614f6b565b6000604051808303818588803b15801561250857600080fd5b505af115801561251c573d6000803e3d6000fd5b50505050507f1df51e0cdaa2916e4cbf58d947bbfca1d775e2007421329f7575cd9b86f4467b8260405161255291815260200190565b60405180910390a15050565b600091825261012f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060378054610f4f90614b08565b60006125a66101cb613a7f565b905090565b6101d680546125b990614b08565b80601f01602080910402602001604051908101604052809291908181526020018280546125e590614b08565b80156126325780601f1061260757610100808354040283529160200191612632565b820191906000526020600020905b81548152906001019060200180831161261557829003601f168201915b505050505081565b60606000836001600160401b03811115612656576126566144ae565b60405190808252806020026020018201604052801561267f578160200160208202803683370190505b50905060005b81518110156126d3576126a461269b8583614c99565b6101cb90613a73565b8282815181106126b6576126b6614ed7565b6020908102919091010152806126cb81614eed565b915050612685565b509392505050565b600033816126e9828661296d565b9050838110156127495760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610e2d565b6127568286868403613317565b506001949350505050565b600033610fe08185856134af565b600061277a816132d8565b62093a808211156127d95760405162461bcd60e51b8152602060048201526024808201527f5f756e626f6e64696e6750726f63657373696e6754696d6520697320746f6f206044820152630d0d2ced60e31b6064820152608401610e2d565b6101d180549083905560408051828152602081018590527f7845684f1d66caf5643b8f54c5d425ed379851f4ced5a18695515dad3646e14a9101610f08565b6000806101d1546101d45461282d9190614c99565b905042811015612859576101d2546101d1546128499042614c99565b6128539190614c99565b91505090565b6101d2546128539082614c99565b6000612872816132d8565b60cb5460ff16612884576117c5613a1e565b6117c5613a89565b61289581613ac2565b600060c954426128a59190614c99565b6001600160a01b038316600081815260ca6020908152604091829020849055815192835282018390529192507f183e2335bd7c9df9aa40bbfb075ebaf3b331dbf63a371cdf4d523f953f38effb9101612552565b600081815261016160205260408120610f3a90613a7f565b6040513481527f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e38426906020015b60405180910390a1565b600082815261012f6020526040902060010154612963816132d8565b61166683836137c7565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6000806129a460355490565b9050806000036129b5575090919050565b6101d3546000906129c68386614f06565b6129d09190614f25565b9050600081116114bb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420736861726560981b6044820152606401610e2d565b600060026101935403612a375760405162461bcd60e51b8152600401610e2d90614cc5565b600261019355612a4561367d565b6001600160a01b038216612a6b5760405162461bcd60e51b8152600401610e2d90614cfc565b60008311612aae5760405162461bcd60e51b815260206004820152601060248201526f16915493d7d4d2105491505353d5539560821b6044820152606401610e2d565b6000612ab8612818565b6101c5546040516335313c2160e11b81526001600160a01b03868116600483015292935060009290911690636a627842906024016020604051808303816000875af1158015612b0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2f9190614ff6565b9050612b3d6101cb82613acd565b506000612b4960355490565b612b556008600a614ec8565b6101d354612b639190614f06565b612b6d9190614f25565b6040805160a0810182526001600160801b03428116825286811660208084019182528385018c8152606085018781526101c8546080870190815260008b81526101ca90945296909220945192518416600160801b02929093169190911783559051600183015551600282015590516003909101559050612bef6008600a614ec8565b612bf98288614f06565b612c039190614f25565b6101d36000828254612c159190614c82565b90915550612c2590503387613ad9565b6101c8546040805188815260208101849052808201929092525183916001600160a01b038816917fbda264759a953362f913574e9adb9db893106115bc707e9abfaaa1e5d02804ab9181900360600190a350600161019355949350505050565b6000806000612c93846118ed565b9050620186a06101d05482612ca89190614f06565b612cb29190614f25565b9150612cbe8282614c82565b925050915091565b6000612cd1816132d8565b6001600160a01b038216612d175760405162461bcd60e51b815260206004820152600d60248201526c454d5054595f4144445245535360981b6044820152606401610e2d565b6101cf80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f190c262dc6f09322c68a13bf67c9659e58367755ba6190fa7ce5ca8aa45a877d9101610f08565b600054610100900460ff1615808015612d925750600054600160ff909116105b80612dac5750303b158015612dac575060005460ff166001145b612e0f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610e2d565b6000805460ff191660011790558015612e32576000805461ff0019166101001790555b6001600160a01b038616612e805760405162461bcd60e51b815260206004820152601560248201527476656e6f4e6674206164647265737373207a65726f60581b6044820152606401610e2d565b6001600160a01b038516612ecf5760405162461bcd60e51b815260206004820152601660248201527563726f4272696467652061646472657373207a65726f60501b6044820152606401610e2d565b6001600160a01b038416612f255760405162461bcd60e51b815260206004820152601860248201527f69626352656365697665722061646472657373207a65726f00000000000000006044820152606401610e2d565b6001600160a01b038316612f735760405162461bcd60e51b815260206004820152601560248201527474726561737572792061646472657373207a65726f60581b6044820152606401610e2d565b60008211612fba5760405162461bcd60e51b81526020600482015260146024820152737570677261646544656c6179206973207a65726f60601b6044820152606401610e2d565b6101c580546001600160a01b038089166001600160a01b0319928316179092556101c680548884169083161790556101c780548784169083161790556101cf80549286169290911691909117905560c86101d0556224ea006101d2556205eec06101d1556101c85460009081526101c960205260408120805460ff191660018302179055506130876040518060400160405280600a8152602001694c69717569642043524f60b01b815250604051806040016040528060048152602001634c43524f60e01b815250613c27565b61309082613c58565b613098613c8c565b6130a0613cbb565b6130a8613ce2565b6130b36000336137a4565b8015612246576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b7f88ce96678e8eb55f90d01d2b0029590d4ab2a8433e2edc9b9683e338217a059261312a816132d8565b6101ce858560405161313d929190614f39565b908152604080516020928190038301902060008581529252902054156131965760405162461bcd60e51b815260206004820152600e60248201526d14d31054d217d49150d3d491115160921b6044820152606401610e2d565b600083116131d45760405162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b6044820152606401610e2d565b6101d35483106132365760405162461bcd60e51b815260206004820152602760248201527f616d6f756e74206d757374206265206c657373207468616e20746f74616c506f6044820152666f6c656443726f60c81b6064820152608401610e2d565b826101ce868660405161324a929190614f39565b9081526020016040518091039020600084815260200190815260200160002081905550826101d360008282546132809190614c82565b909155505060405183906132979087908790614f39565b604051908190038120848252907f8c29de5cfb07f24be53cfbd062c22557adda4f0655ec11ec10a59648ad38faa09060200160405180910390a35050505050565b6117c58133613d11565b60006001600160e01b03198216637965db0b60e01b1480610f3a57506301ffc9a760e01b6001600160e01b0319831614610f3a565b6001600160a01b0383166133795760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610e2d565b6001600160a01b0382166133da5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610e2d565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000613447848461296d565b9050600019811461149657818110156134a25760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610e2d565b6114968484848403613317565b6001600160a01b0383166135135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610e2d565b6001600160a01b0382166135755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610e2d565b6001600160a01b038316600090815260336020526040902054818110156135ed5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610e2d565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290613624908490614c99565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161367091815260200190565b60405180910390a3611496565b60cb5460ff16156136c35760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610e2d565b565b6001600160a01b03821661371b5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610e2d565b806035600082825461372d9190614c99565b90915550506001600160a01b0382166000908152603360205260408120805483929061375a908490614c99565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6137ae8282613d75565b6000828152610161602052604090206116669082613dfc565b6137d18282613e11565b6000828152610161602052604090206116669082613e79565b6137f381613ac2565b6001600160a01b038116600090815260ca6020526040902054806138485760405162461bcd60e51b815260206004820152600c60248201526b1393d517d4d251d39053115160a21b6044820152606401610e2d565b4281111561388c5760405162461bcd60e51b81526020600482015260116024820152705354494c4c5f554e4445525f44454c415960781b6044820152606401610e2d565b506001600160a01b0316600090815260ca6020526040812055565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156138da5761166683613e8e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613934575060408051601f3d908101601f1916820190925261393191810190614ff6565b60015b6139975760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610e2d565b6000805160206151398339815191528114613a065760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610e2d565b50611666838383613f2a565b60006114bb8383613f4f565b613a2661367d565b60cb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613a5b3390565b6040516001600160a01b03909116815260200161293d565b60006114bb8383614042565b6000610f3a825490565b613a9161406c565b60cb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33613a5b565b60006116e5816132d8565b60006114bb83836140b5565b6001600160a01b038216613b395760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610e2d565b6001600160a01b03821660009081526033602052604090205481811015613bad5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610e2d565b6001600160a01b0383166000908152603360205260408120838303905560358054849290613bdc908490614c82565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600054610100900460ff16613c4e5760405162461bcd60e51b8152600401610e2d9061500f565b6116e58282614104565b600054610100900460ff16613c7f5760405162461bcd60e51b8152600401610e2d9061500f565b60c98190556117c5613cbb565b600054610100900460ff16613cb35760405162461bcd60e51b8152600401610e2d9061500f565b6136c3614144565b600054610100900460ff166136c35760405162461bcd60e51b8152600401610e2d9061500f565b600054610100900460ff16613d095760405162461bcd60e51b8152600401610e2d9061500f565b6136c3614177565b613d1b828261255e565b6116e557613d33816001600160a01b031660146141a6565b613d3e8360206141a6565b604051602001613d4f92919061505a565b60408051601f198184030181529082905262461bcd60e51b8252610e2d91600401614617565b613d7f828261255e565b6116e557600082815261012f602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613db83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006114bb836001600160a01b0384166140b5565b613e1b828261255e565b156116e557600082815261012f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006114bb836001600160a01b038416613f4f565b6001600160a01b0381163b613efb5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610e2d565b60008051602061513983398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b613f3383614341565b600082511180613f405750805b15611666576114968383614381565b60008181526001830160205260408120548015614038576000613f73600183614c82565b8554909150600090613f8790600190614c82565b9050818114613fec576000866000018281548110613fa757613fa7614ed7565b9060005260206000200154905080876000018481548110613fca57613fca614ed7565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613ffd57613ffd6150cf565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610f3a565b6000915050610f3a565b600082600001828154811061405957614059614ed7565b9060005260206000200154905092915050565b60cb5460ff166136c35760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610e2d565b60008181526001830160205260408120546140fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610f3a565b506000610f3a565b600054610100900460ff1661412b5760405162461bcd60e51b8152600401610e2d9061500f565b60366141378382614b88565b5060376116668282614b88565b600054610100900460ff1661416b5760405162461bcd60e51b8152600401610e2d9061500f565b60cb805460ff19169055565b600054610100900460ff1661419e5760405162461bcd60e51b8152600401610e2d9061500f565b600161019355565b606060006141b5836002614f06565b6141c0906002614c99565b6001600160401b038111156141d7576141d76144ae565b6040519080825280601f01601f191660200182016040528015614201576020820181803683370190505b509050600360fc1b8160008151811061421c5761421c614ed7565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061424b5761424b614ed7565b60200101906001600160f81b031916908160001a905350600061426f846002614f06565b61427a906001614c99565b90505b60018111156142f2576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106142ae576142ae614ed7565b1a60f81b8282815181106142c4576142c4614ed7565b60200101906001600160f81b031916908160001a90535060049490941c936142eb816150e5565b905061427d565b5083156114bb5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610e2d565b61434a81613e8e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6143e95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610e2d565b600080846001600160a01b03168460405161440491906150fc565b600060405180830381855af49150503d806000811461443f576040519150601f19603f3d011682016040523d82523d6000602084013e614444565b606091505b509150915061446c828260405180606001604052806027815260200161515960279139614475565b95945050505050565b606083156144845750816114bb565b8251156144945782518084602001fd5b8160405162461bcd60e51b8152600401610e2d9190614617565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b03808411156144de576144de6144ae565b604051601f8501601f19908116603f01168101908282118183101715614506576145066144ae565b8160405280935085815286868601111561451f57600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261454a57600080fd5b6114bb838335602085016144c4565b60006020828403121561456b57600080fd5b81356001600160401b0381111561458157600080fd5b61458d84828501614539565b949350505050565b6000602082840312156145a757600080fd5b81356001600160e01b0319811681146114bb57600080fd5b60005b838110156145da5781810151838201526020016145c2565b838111156114965750506000910152565b600081518084526146038160208601602086016145bf565b601f01601f19169290920160200192915050565b6020815260006114bb60208301846145eb565b6001600160a01b03811681146117c557600080fd5b6000806040838503121561465257600080fd5b823561465d8161462a565b946020939093013593505050565b6000806040838503121561467e57600080fd5b8235915060208301356004811061469457600080fd5b809150509250929050565b6000806000606084860312156146b457600080fd5b83356146bf8161462a565b925060208401356146cf8161462a565b929592945050506040919091013590565b6000602082840312156146f257600080fd5b5035919050565b60006020828403121561470b57600080fd5b81356114bb8161462a565b6000806040838503121561472957600080fd5b8235915060208301356146948161462a565b60008083601f84011261474d57600080fd5b5081356001600160401b0381111561476457600080fd5b6020830191508360208260051b850101111561477f57600080fd5b9250929050565b60008060006040848603121561479b57600080fd5b83356001600160401b038111156147b157600080fd5b6147bd8682870161473b565b90945092505060208401356147d18161462a565b809150509250925092565b600080604083850312156147ef57600080fd5b82356147fa8161462a565b915060208301356001600160401b0381111561481557600080fd5b8301601f8101851361482657600080fd5b614835858235602084016144c4565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b6004811061487357634e487b7160e01b600052602160045260246000fd5b9052565b60208101610f3a8284614855565b60008083601f84011261489757600080fd5b5081356001600160401b038111156148ae57600080fd5b60208301915083602082850101111561477f57600080fd5b6000806000604084860312156148db57600080fd5b8335925060208401356001600160401b038111156148f857600080fd5b61490486828701614885565b9497909650939450505050565b6000806000806040858703121561492757600080fd5b84356001600160401b038082111561493e57600080fd5b61494a8883890161473b565b9096509450602087013591508082111561496357600080fd5b506149708782880161473b565b95989497509550505050565b6000806040838503121561498f57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156149d6578351835292840192918401916001016149ba565b50909695505050505050565b600080604083850312156149f557600080fd5b8235614a008161462a565b915060208301356146948161462a565b60008060408385031215614a2357600080fd5b82356001600160401b03811115614a3957600080fd5b614a4585828601614539565b95602094909401359450505050565b600080600080600060a08688031215614a6c57600080fd5b8535614a778161462a565b94506020860135614a878161462a565b93506040860135614a978161462a565b92506060860135614aa78161462a565b949793965091946080013592915050565b60008060008060608587031215614ace57600080fd5b84356001600160401b03811115614ae457600080fd5b614af087828801614885565b90989097506020870135966040013595509350505050565b600181811c90821680614b1c57607f821691505b602082108103614b3c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561166657600081815260208120601f850160051c81016020861015614b695750805b601f850160051c820191505b8181101561224657828155600101614b75565b81516001600160401b03811115614ba157614ba16144ae565b614bb581614baf8454614b08565b84614b42565b602080601f831160018114614bea5760008415614bd25750858301515b600019600386901b1c1916600185901b178555612246565b600085815260208120601f198616915b82811015614c1957888601518255948401946001909101908401614bfa565b5085821015614c375787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614c5a60408301856145eb565b828103602084015261446c81856145eb565b634e487b7160e01b600052601160045260246000fd5b600082821015614c9457614c94614c6c565b500390565b60008219821115614cac57614cac614c6c565b500190565b828152604081016114bb6020830184614855565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600c908201526b5a45524f5f4144445245535360a01b604082015260600190565b634e487b7160e01b600052601260045260246000fd5b600082614d4757614d47614d22565b500690565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181815b80851115614e1f578160001904821115614e0557614e05614c6c565b80851615614e1257918102915b93841c9390800290614de9565b509250929050565b600082614e3657506001610f3a565b81614e4357506000610f3a565b8160018114614e595760028114614e6357614e7f565b6001915050610f3a565b60ff841115614e7457614e74614c6c565b50506001821b610f3a565b5060208310610133831016604e8410600b8410161715614ea2575081810a610f3a565b614eac8383614de4565b8060001904821115614ec057614ec0614c6c565b029392505050565b60006114bb60ff841683614e27565b634e487b7160e01b600052603260045260246000fd5b600060018201614eff57614eff614c6c565b5060010190565b6000816000190483118215151615614f2057614f20614c6c565b500290565b600082614f3457614f34614d22565b500490565b8183823760009101908152919050565b600060208284031215614f5b57600080fd5b815180151581146114bb57600080fd5b6000602080835260008454614f7f81614b08565b80848701526040600180841660008114614fa05760018114614fba57614fe8565b60ff1985168984015283151560051b890183019550614fe8565b896000528660002060005b85811015614fe05781548b8201860152908301908801614fc5565b8a0184019650505b509398975050505050505050565b60006020828403121561500857600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516150928160178501602088016145bf565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516150c38160288401602088016145bf565b01602801949350505050565b634e487b7160e01b600052603160045260246000fd5b6000816150f4576150f4614c6c565b506000190190565b6000825161510e8184602087016145bf565b919091019291505056fe5bf81cabe53ab1fac30c9f534a726d1efa4d39604cae6fbb7d5396c82ef5f5cf360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65648da7f4eb5f54086f55cc454f22a1291cbcdd928b414ef402caef8343b0d82720a26469706673582212208562fa740c9af05602b0756509082c9352e549fe8ee19c00a167e94ded2cb50264736f6c634300080f0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.