ETH Price: $3,103.03 (-3.30%)
Gas: 7 Gwei

Contract

0x96C4A48Abdf781e9c931cfA92EC0167Ba219ad8E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00
Transaction Hash
Method
Block
From
To
Value
0x60806040173909062023-06-02 5:11:35398 days ago1685682695IN
 Create: XEqbToken
0 ETH0.0617201722.4314879

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
XEqbToken

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 17 : XEqbToken.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "./Interfaces/IVlEqb.sol";
import "./Interfaces/IXEqbToken.sol";

contract XEqbToken is
    IXEqbToken,
    ERC20Upgradeable,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable
{
    using Address for address;
    using EnumerableSet for EnumerableSet.AddressSet;
    using SafeERC20 for IERC20;

    struct RedeemInfo {
        uint256 eqbAmount; // EQB amount to receive when vesting has ended
        uint256 xEqbAmount; // xEQB amount to redeem
        uint256 endTime;
    }

    IERC20 public eqb; // eqb to convert to/from
    address public vlEqb;
    address public burnAddress; // burn address to send excess eqb to

    EnumerableSet.AddressSet private _transferWhitelist; // addresses allowed to send/receive xEQB

    uint256 public constant MAX_FIXED_RATIO = 100; // 100%

    // Redeeming min/max settings
    uint256 public minRedeemRatio;
    uint256 public maxRedeemRatio;
    uint256 public minRedeemDuration;
    uint256 public maxRedeemDuration;

    mapping(address => uint256) public redeemingAmounts; // User's redeeming amounts
    mapping(address => RedeemInfo[]) public userRedeems; // User's redeeming instances

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

    function initialize() public initializer {
        __Ownable_init();

        __ERC20_init_unchained("max EQB", "xEQB");
    }

    /***********************************************/
    /****************** MODIFIERS ******************/
    /***********************************************/

    /*
     * @dev Check if a redeem entry exists
     */
    modifier validateRedeem(address userAddress, uint256 redeemIndex) {
        require(
            redeemIndex < userRedeems[userAddress].length,
            "validateRedeem: redeem entry does not exist"
        );
        _;
    }

    /**************************************************/
    /****************** PUBLIC VIEWS ******************/
    /**************************************************/
    /*
     * @dev returns redeemable EQB for "amount" of xEQB vested for "duration" seconds
     */
    function getEqbByVestingDuration(
        uint256 amount,
        uint256 duration
    ) public view returns (uint256) {
        if (duration < minRedeemDuration) {
            return 0;
        }

        // capped to maxRedeemDuration
        if (duration > maxRedeemDuration) {
            return (amount * maxRedeemRatio) / MAX_FIXED_RATIO;
        }

        uint256 ratio = minRedeemRatio +
            (((duration - minRedeemDuration) *
                (maxRedeemRatio - minRedeemRatio)) /
                (maxRedeemDuration - minRedeemDuration));

        return (amount * ratio) / MAX_FIXED_RATIO;
    }

    /**
     * @dev returns quantity of "userAddress" pending redeems
     */
    function getUserRedeemsLength(
        address userAddress
    ) external view returns (uint256) {
        return userRedeems[userAddress].length;
    }

    /**
     * @dev returns "userAddress" info for a pending redeem identified by "redeemIndex"
     */
    function getUserRedeem(
        address userAddress,
        uint256 redeemIndex
    )
        external
        view
        validateRedeem(userAddress, redeemIndex)
        returns (uint256 eqbAmount, uint256 xEqbAmount, uint256 endTime)
    {
        RedeemInfo memory _redeem = userRedeems[userAddress][redeemIndex];
        return (_redeem.eqbAmount, _redeem.xEqbAmount, _redeem.endTime);
    }

    /**
     * @dev returns length of transferWhitelist array
     */
    function transferWhitelistLength() external view returns (uint256) {
        return _transferWhitelist.length();
    }

    /**
     * @dev returns transferWhitelist array item's address for "index"
     */
    function transferWhitelist(uint256 index) external view returns (address) {
        return _transferWhitelist.at(index);
    }

    /**
     * @dev returns if "account" is allowed to send/receive xEQB
     */
    function isTransferWhitelisted(
        address account
    ) external view returns (bool) {
        return _transferWhitelist.contains(account);
    }

    /*******************************************************/
    /****************** OWNABLE FUNCTIONS ******************/
    /*******************************************************/

    function setParams(
        address _eqb,
        address _vlEqb,
        address _burnAddress
    ) external onlyOwner {
        require(address(eqb) == address(0), "setParams: already set");
        require(_eqb != address(0), "setParams: eqb cannot be null");
        require(_vlEqb != address(0), "setParams: vlEqb cannot be null");
        require(
            _burnAddress != address(0),
            "setParams: burnAddress cannot be null"
        );

        eqb = IERC20(_eqb);
        vlEqb = _vlEqb;
        burnAddress = _burnAddress;

        minRedeemRatio = 50; // 1:0.5
        maxRedeemRatio = 100; // 1:1
        minRedeemDuration = 14 days;
        maxRedeemDuration = 168 days;

        _transferWhitelist.add(address(this));
    }

    /**
     * @dev Updates all redeem ratios and durations
     *
     * Must only be called by owner
     */
    function updateRedeemSettings(
        uint256 minRedeemRatio_,
        uint256 maxRedeemRatio_,
        uint256 minRedeemDuration_,
        uint256 maxRedeemDuration_
    ) external onlyOwner {
        require(
            minRedeemRatio_ <= maxRedeemRatio_,
            "updateRedeemSettings: wrong ratio values"
        );
        require(
            minRedeemDuration_ < maxRedeemDuration_,
            "updateRedeemSettings: wrong duration values"
        );
        // should never exceed 100%
        require(
            maxRedeemRatio_ <= MAX_FIXED_RATIO,
            "updateRedeemSettings: wrong ratio values"
        );

        minRedeemRatio = minRedeemRatio_;
        maxRedeemRatio = maxRedeemRatio_;
        minRedeemDuration = minRedeemDuration_;
        maxRedeemDuration = maxRedeemDuration_;

        emit UpdateRedeemSettings(
            minRedeemRatio_,
            maxRedeemRatio_,
            minRedeemDuration_,
            maxRedeemDuration_
        );
    }

    /**
     * @dev Adds or removes addresses from the transferWhitelist
     */
    function updateTransferWhitelist(
        address account,
        bool add
    ) external onlyOwner {
        require(
            account != address(this),
            "updateTransferWhitelist: Cannot remove xEqb from whitelist"
        );

        if (add) {
            _transferWhitelist.add(account);
        } else {
            _transferWhitelist.remove(account);
        }

        emit SetTransferWhitelist(account, add);
    }

    /*****************************************************************/
    /******************  EXTERNAL PUBLIC FUNCTIONS  ******************/
    /*****************************************************************/

    /**
     * @dev Convert caller's "amount" of EQB to xEQB
     */
    function convert(uint256 amount) external override nonReentrant {
        _convert(amount, msg.sender);
    }

    /**
     * @dev Convert caller's "amount" of EQB to xEQB to "to" address
     */
    function convertTo(
        uint256 amount,
        address to
    ) external override nonReentrant {
        require(address(msg.sender).isContract(), "convertTo: not allowed");
        _convert(amount, to);
    }

    /**
     * @dev Initiates redeem process (xEQB to EQB)
     */
    function redeem(
        uint256 xEqbAmount,
        uint256 duration
    ) external nonReentrant {
        require(xEqbAmount > 0, "redeem: xEqbAmount cannot be null");
        require(duration >= minRedeemDuration, "redeem: duration too low");

        _transfer(msg.sender, address(this), xEqbAmount);

        // get corresponding EQB amount
        uint256 eqbAmount = getEqbByVestingDuration(xEqbAmount, duration);
        emit Redeem(msg.sender, xEqbAmount, eqbAmount, duration);

        // if redeeming is not immediate, go through vesting process
        if (duration > 0) {
            redeemingAmounts[msg.sender] += xEqbAmount;

            // add redeeming entry
            userRedeems[msg.sender].push(
                RedeemInfo(
                    eqbAmount,
                    xEqbAmount,
                    _currentBlockTimestamp() + duration
                )
            );
        } else {
            // immediately redeem for EQB
            _finalizeRedeem(msg.sender, msg.sender, xEqbAmount, eqbAmount);
        }
    }

    /**
     * @dev Finalizes redeem process when vesting duration has been reached
     *
     * Can only be called by the redeem entry owner
     */
    function finalizeRedeem(
        uint256 redeemIndex
    ) external nonReentrant validateRedeem(msg.sender, redeemIndex) {
        RedeemInfo storage _redeem = userRedeems[msg.sender][redeemIndex];
        require(
            _currentBlockTimestamp() >= _redeem.endTime,
            "finalizeRedeem: vesting duration has not ended yet"
        );

        redeemingAmounts[msg.sender] -= _redeem.xEqbAmount;
        _finalizeRedeem(
            msg.sender,
            msg.sender,
            _redeem.xEqbAmount,
            _redeem.eqbAmount
        );

        // remove redeem entry
        _deleteRedeemEntry(redeemIndex);
    }

    /**
     * @dev Cancels an ongoing redeem entry
     *
     * Can only be called by its owner
     */
    function cancelRedeem(
        uint256 redeemIndex
    ) external nonReentrant validateRedeem(msg.sender, redeemIndex) {
        RedeemInfo storage _redeem = userRedeems[msg.sender][redeemIndex];

        // make redeeming xEQB available again
        redeemingAmounts[msg.sender] -= _redeem.xEqbAmount;
        _transfer(address(this), msg.sender, _redeem.xEqbAmount);

        emit CancelRedeem(msg.sender, _redeem.xEqbAmount);

        // remove redeem entry
        _deleteRedeemEntry(redeemIndex);
    }

    /**
     * @dev Lock to VlEqb (xEQB to EQB to VlEqb)
     */
    function lock(uint256 _xEqbAmount, uint256 _weeks) external nonReentrant {
        require(_xEqbAmount > 0, "lock: xEqbAmount cannot be null");
        uint256 duration = _weeks * 1 weeks;
        require(duration >= minRedeemDuration, "lock: duration too low");

        _transfer(msg.sender, address(this), _xEqbAmount);

        // get corresponding EQB amount
        uint256 eqbAmount = getEqbByVestingDuration(_xEqbAmount, duration);
        _finalizeRedeem(msg.sender, address(this), _xEqbAmount, eqbAmount);

        _approveTokenIfNeeded(address(eqb), vlEqb, eqbAmount);
        IVlEqb(vlEqb).lock(msg.sender, eqbAmount, _weeks);

        emit Lock(msg.sender, _xEqbAmount, eqbAmount, _weeks);
    }

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

    /**
     * @dev Convert caller's "amount" of EQB into xEQB to "to"
     */
    function _convert(uint256 amount, address to) internal {
        require(amount != 0, "convert: amount cannot be null");

        // mint new xEQB
        _mint(to, amount);

        emit Convert(msg.sender, to, amount);
        eqb.safeTransferFrom(msg.sender, address(this), amount);
    }

    /**
     * @dev Finalizes the redeeming process for "userAddress" by transferring him "eqbAmount" and removing "xEqbAmount" from supply
     *
     * Any vesting check should be ran before calling this
     * EQB excess is automatically sent to burn address
     */
    function _finalizeRedeem(
        address userAddress,
        address receiverAddress,
        uint256 xEqbAmount,
        uint256 eqbAmount
    ) internal {
        // sends due eqb
        if (receiverAddress != address(this)) {
            eqb.safeTransfer(receiverAddress, eqbAmount);
        }

        // sends EQB excess to burn address if any
        if (xEqbAmount > eqbAmount) {
            eqb.safeTransfer(burnAddress, xEqbAmount - eqbAmount);
        }

        _burn(address(this), xEqbAmount);

        emit FinalizeRedeem(
            userAddress,
            receiverAddress,
            xEqbAmount,
            eqbAmount
        );
    }

    function _deleteRedeemEntry(uint256 index) internal {
        userRedeems[msg.sender][index] = userRedeems[msg.sender][
            userRedeems[msg.sender].length - 1
        ];
        userRedeems[msg.sender].pop();
    }

    /**
     * @dev Hook override to forbid transfers except from whitelisted addresses and minting
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 /*amount*/
    ) internal view override {
        require(
            from == address(0) ||
                _transferWhitelist.contains(from) ||
                _transferWhitelist.contains(to),
            "transfer: not allowed"
        );
    }

    /**
     * @dev Utility function to get the current block timestamp
     */
    function _currentBlockTimestamp() internal view virtual returns (uint256) {
        return block.timestamp;
    }

    function _approveTokenIfNeeded(
        address _token,
        address _to,
        uint256 _amount
    ) internal {
        if (IERC20(_token).allowance(address(this), _to) < _amount) {
            IERC20(_token).safeApprove(_to, 0);
            IERC20(_token).safeApprove(_to, type(uint256).max);
        }
    }
}

File 2 of 17 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

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

File 3 of 17 : 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 4 of 17 : 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 5 of 17 : 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 6 of 17 : 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 7 of 17 : 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 8 of 17 : 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 9 of 17 : 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 10 of 17 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 11 of 17 : IERC20.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 IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

File 13 of 17 : Address.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 Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

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

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

File 14 of 17 : EnumerableSet.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 EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @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 15 of 17 : IRewards.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

interface IRewards {
    function queueNewRewards(address, uint256) external payable;

    event RewardAdded(address indexed _rewardToken, uint256 _reward);
}

File 16 of 17 : IVlEqb.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "./IRewards.sol";

interface IVlEqb is IRewards {
    function lock(address _user, uint256 _amount, uint256 _weeks) external;

    event LockCreated(address indexed _user, uint256 _amount, uint256 _weeks);

    event LockExtended(
        address indexed _user,
        uint256 _amount,
        uint256 _oldWeeks,
        uint256 _newWeeks
    );

    event Unlocked(
        address indexed _user,
        uint256 _amount,
        uint256 _lastUnlockedWeek
    );

    event RewardTokenAdded(address indexed _rewardToken);

    event RewardPaid(
        address indexed _user,
        address indexed _rewardToken,
        uint256 _reward
    );

    event AccessSet(address indexed _address, bool _status);
}

File 17 of 17 : IXEqbToken.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IXEqbToken {
    function convert(uint256 amount) external;

    function convertTo(uint256 amount, address to) external;

    /********************************************/
    /****************** EVENTS ******************/
    /********************************************/

    event Convert(address indexed from, address to, uint256 amount);
    event UpdateRedeemSettings(
        uint256 minRedeemRatio,
        uint256 maxRedeemRatio,
        uint256 minRedeemDuration,
        uint256 maxRedeemDuration
    );
    event SetTransferWhitelist(address account, bool add);
    event Redeem(
        address indexed userAddress,
        uint256 xEqbAmount,
        uint256 eqbAmount,
        uint256 duration
    );
    event FinalizeRedeem(
        address indexed userAddress,
        address indexed receiverAddress,
        uint256 xEqbAmount,
        uint256 eqbAmount
    );
    event CancelRedeem(address indexed userAddress, uint256 xEqbAmount);
    event Lock(
        address indexed _userAddress,
        uint256 _xEqbAmount,
        uint256 _eqbAmount,
        uint256 _weeks
    );
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"xEqbAmount","type":"uint256"}],"name":"CancelRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Convert","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"address","name":"receiverAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"xEqbAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eqbAmount","type":"uint256"}],"name":"FinalizeRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_xEqbAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_eqbAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_weeks","type":"uint256"}],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"xEqbAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eqbAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"add","type":"bool"}],"name":"SetTransferWhitelist","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":false,"internalType":"uint256","name":"minRedeemRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRedeemRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minRedeemDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRedeemDuration","type":"uint256"}],"name":"UpdateRedeemSettings","type":"event"},{"inputs":[],"name":"MAX_FIXED_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"name":"burnAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"cancelRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"convertTo","outputs":[],"stateMutability":"nonpayable","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":"eqb","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"finalizeRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"getEqbByVestingDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"getUserRedeem","outputs":[{"internalType":"uint256","name":"eqbAmount","type":"uint256"},{"internalType":"uint256","name":"xEqbAmount","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getUserRedeemsLength","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":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isTransferWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_xEqbAmount","type":"uint256"},{"internalType":"uint256","name":"_weeks","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxRedeemDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRedeemRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRedeemDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRedeemRatio","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":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"xEqbAmount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redeemingAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_eqb","type":"address"},{"internalType":"address","name":"_vlEqb","type":"address"},{"internalType":"address","name":"_burnAddress","type":"address"}],"name":"setParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"transferWhitelist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferWhitelistLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minRedeemRatio_","type":"uint256"},{"internalType":"uint256","name":"maxRedeemRatio_","type":"uint256"},{"internalType":"uint256","name":"minRedeemDuration_","type":"uint256"},{"internalType":"uint256","name":"maxRedeemDuration_","type":"uint256"}],"name":"updateRedeemSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"add","type":"bool"}],"name":"updateTransferWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userRedeems","outputs":[{"internalType":"uint256","name":"eqbAmount","type":"uint256"},{"internalType":"uint256","name":"xEqbAmount","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vlEqb","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61307080620000f46000396000f3fe608060405234801561001057600080fd5b50600436106102c85760003560e01c80638129fc1c1161017b578063b90c2b52116100d8578063dd62ed3e1161008c578063e3a2950b11610071578063e3a2950b146105ed578063e9ed87f8146105f6578063f2fde38b146105ff57600080fd5b8063dd62ed3e14610594578063de137c03146105cd57600080fd5b8063c4b10766116100bd578063c4b1076614610565578063ca6132921461056e578063cc6c54231461058157600080fd5b8063b90c2b5214610529578063be3f4d681461055257600080fd5b8063a081df7f1161012f578063a457c2d711610114578063a457c2d7146104f0578063a9059cbb14610503578063aff6cbf11461051657600080fd5b8063a081df7f146104ca578063a3908e1b146104dd57600080fd5b80638da5cb5b116101605780638da5cb5b1461049e57806395d89b41146104af578063983103e0146104b757600080fd5b80638129fc1c14610483578063890836541461048b57600080fd5b80634b359d3811610229578063646fcdd2116101dd57806370d5ae05116101c257806370d5ae0514610455578063715018a6146104685780637cbc23731461047057600080fd5b8063646fcdd21461041957806370a082311461042c57600080fd5b8063539ffb771161020e578063539ffb77146103eb5780635a1d34dc146103fe578063619ac95b1461041157600080fd5b80634b359d38146103925780634f62b7ec146103bd57600080fd5b80631c3526791161028057806323b872dd1161026557806323b872dd1461035d578063313ce56714610370578063395093511461037f57600080fd5b80631c352679146103415780631eee7e601461034a57600080fd5b80631338736f116102b15780631338736f1461030e578063161aab431461032357806318160ddd1461033957600080fd5b806306fdde03146102cd578063095ea7b3146102eb575b600080fd5b6102d5610612565b6040516102e29190612bce565b60405180910390f35b6102fe6102f9366004612c1d565b6106a4565b60405190151581526020016102e2565b61032161031c366004612c47565b6106be565b005b61032b6108de565b6040519081526020016102e2565b60355461032b565b61032b60ce5481565b6102fe610358366004612c69565b6108ef565b6102fe61036b366004612c84565b6108fc565b604051601281526020016102e2565b6102fe61038d366004612c1d565b610922565b6103a56103a0366004612cc0565b610961565b6040516001600160a01b0390911681526020016102e2565b6103d06103cb366004612c1d565b61096e565b604080519384526020840192909252908201526060016102e2565b6103216103f9366004612cc0565b6109b0565b61032161040c366004612cd9565b610b49565b61032b606481565b60c9546103a5906001600160a01b031681565b61032b61043a366004612c69565b6001600160a01b031660009081526033602052604090205490565b60cb546103a5906001600160a01b031681565b610321610c01565b61032161047e366004612c47565b610c15565b610321610e3a565b610321610499366004612d13565b610fce565b6065546001600160a01b03166103a5565b6102d56110bf565b60ca546103a5906001600160a01b031681565b6103216104d8366004612d4a565b6110ce565b6103216104eb366004612cc0565b6112ca565b6102fe6104fe366004612c1d565b611333565b6102fe610511366004612c1d565b6113e8565b610321610524366004612cc0565b6113f6565b61032b610537366004612c69565b6001600160a01b0316600090815260d3602052604090205490565b61032b610560366004612c47565b6115ba565b61032b60d05481565b61032161057c366004612d8d565b611669565b6103d061058f366004612c1d565b61180b565b61032b6105a2366004612dbf565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b61032b6105db366004612c69565b60d26020526000908152604090205481565b61032b60cf5481565b61032b60d15481565b61032161060d366004612c69565b611902565b60606036805461062190612de9565b80601f016020809104026020016040519081016040528092919081815260200182805461064d90612de9565b801561069a5780601f1061066f5761010080835404028352916020019161069a565b820191906000526020600020905b81548152906001019060200180831161067d57829003601f168201915b5050505050905090565b6000336106b281858561198f565b60019150505b92915050565b6002609754036107155760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002609755816107675760405162461bcd60e51b815260206004820152601f60248201527f6c6f636b3a2078457162416d6f756e742063616e6e6f74206265206e756c6c00604482015260640161070c565b60006107768262093a80612e39565b905060d0548110156107ca5760405162461bcd60e51b815260206004820152601660248201527f6c6f636b3a206475726174696f6e20746f6f206c6f7700000000000000000000604482015260640161070c565b6107d5333085611ae7565b60006107e184836115ba565b90506107ef33308684611d09565b60c95460ca5461080c916001600160a01b03908116911683611dcb565b60ca546040517fe2ab691d00000000000000000000000000000000000000000000000000000000815233600482015260248101839052604481018590526001600160a01b039091169063e2ab691d90606401600060405180830381600087803b15801561087857600080fd5b505af115801561088c573d6000803e3d6000fd5b505060408051878152602081018590529081018690523392507f0e31f07bae79135368ff475cf6c7f6abb31e0fd731e03c18ad425bd9406cf0c0915060600160405180910390a2505060016097555050565b60006108ea60cc611e74565b905090565b60006106b860cc83611e7e565b60003361090a858285611ea0565b610915858585611ae7565b60019150505b9392505050565b3360008181526034602090815260408083206001600160a01b03871684529091528120549091906106b2908290869061095c908790612e50565b61198f565b60006106b860cc83611f2c565b60d3602052816000526040600020818154811061098a57600080fd5b600091825260209091206003909102018054600182015460029092015490935090915083565b600260975403610a025760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975533600081815260d3602052604090205482908110610a7b5760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201526a1cc81b9bdd08195e1a5cdd60aa1b606482015260840161070c565b33600090815260d360205260408120805485908110610a9c57610a9c612e63565b90600052602060002090600302019050806001015460d26000336001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ae59190612e79565b92505081905550610afb30338360010154611ae7565b600181015460405190815233907f56d7520e387607a8daa892e3fed116badc2a636307bdc794b1c1aed97ae203f49060200160405180910390a2610b3e84611f38565b505060016097555050565b600260975403610b9b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b6002609755333b610bee5760405162461bcd60e51b815260206004820152601660248201527f636f6e76657274546f3a206e6f7420616c6c6f77656400000000000000000000604482015260640161070c565b610bf88282612019565b50506001609755565b610c096120d3565b610c13600061212d565b565b600260975403610c675760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975581610cdf5760405162461bcd60e51b815260206004820152602160248201527f72656465656d3a2078457162416d6f756e742063616e6e6f74206265206e756c60448201527f6c00000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b60d054811015610d315760405162461bcd60e51b815260206004820152601860248201527f72656465656d3a206475726174696f6e20746f6f206c6f770000000000000000604482015260640161070c565b610d3c333084611ae7565b6000610d4883836115ba565b604080518581526020810183905290810184905290915033907fbd5034ffbd47e4e72a94baa2cdb74c6fad73cb3bcdc13036b72ec8306f5a76469060600160405180910390a28115610e245733600090815260d2602052604081208054859290610db3908490612e50565b909155505033600090815260d360209081526040918290208251606081018452848152918201869052918101610de98542612e50565b905281546001818101845560009384526020938490208351600390930201918255928201519281019290925560400151600290910155610e30565b610e3033338584611d09565b5050600160975550565b600054610100900460ff1615808015610e5a5750600054600160ff909116105b80610e745750303b158015610e74575060005460ff166001145b610ee65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161070c565b6000805460ff191660011790558015610f09576000805461ff0019166101001790555b610f1161218c565b610f856040518060400160405280600781526020017f6d617820455142000000000000000000000000000000000000000000000000008152506040518060400160405280600481526020017f78455142000000000000000000000000000000000000000000000000000000008152506121ff565b8015610fcb576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b610fd66120d3565b306001600160a01b038316036110545760405162461bcd60e51b815260206004820152603a60248201527f7570646174655472616e7366657257686974656c6973743a2043616e6e6f742060448201527f72656d6f766520784571622066726f6d2077686974656c697374000000000000606482015260840161070c565b801561106b5761106560cc83612283565b50611078565b61107660cc83612298565b505b604080516001600160a01b038416815282151560208201527f3a34209cb941a5d23a56dea730a13738454bc7daefd4bb32e8d7df58c1bd920d910160405180910390a15050565b60606037805461062190612de9565b6110d66120d3565b60c9546001600160a01b03161561112f5760405162461bcd60e51b815260206004820152601660248201527f736574506172616d733a20616c72656164792073657400000000000000000000604482015260640161070c565b6001600160a01b0383166111855760405162461bcd60e51b815260206004820152601d60248201527f736574506172616d733a206571622063616e6e6f74206265206e756c6c000000604482015260640161070c565b6001600160a01b0382166111db5760405162461bcd60e51b815260206004820152601f60248201527f736574506172616d733a20766c4571622063616e6e6f74206265206e756c6c00604482015260640161070c565b6001600160a01b0381166112575760405162461bcd60e51b815260206004820152602560248201527f736574506172616d733a206275726e416464726573732063616e6e6f7420626560448201527f206e756c6c000000000000000000000000000000000000000000000000000000606482015260840161070c565b60c980546001600160a01b0380861673ffffffffffffffffffffffffffffffffffffffff199283161790925560ca805485841690831617905560cb805492841692909116919091179055603260ce55606460cf556212750060d05562dd7c0060d1556112c460cc30612283565b50505050565b60026097540361131c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975561132b8133612019565b506001609755565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156113d05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161070c565b6113dd828686840361198f565b506001949350505050565b6000336106b2818585611ae7565b6002609754036114485760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975533600081815260d36020526040902054829081106114c15760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201526a1cc81b9bdd08195e1a5cdd60aa1b606482015260840161070c565b33600090815260d3602052604081208054859081106114e2576114e2612e63565b9060005260206000209060030201905080600201546114fe4290565b10156115725760405162461bcd60e51b815260206004820152603260248201527f66696e616c697a6552656465656d3a2076657374696e67206475726174696f6e60448201527f20686173206e6f7420656e646564207965740000000000000000000000000000606482015260840161070c565b600181015433600090815260d2602052604081208054909190611596908490612e79565b925050819055506115b1333383600101548460000154611d09565b610b3e84611f38565b600060d0548210156115ce575060006106b8565b60d1548211156115f957606460cf54846115e89190612e39565b6115f29190612e8c565b90506106b8565b600060d05460d15461160b9190612e79565b60ce5460cf5461161b9190612e79565b60d0546116289086612e79565b6116329190612e39565b61163c9190612e8c565b60ce546116499190612e50565b905060646116578286612e39565b6116619190612e8c565b949350505050565b6116716120d3565b828411156116d25760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e6720726174696044820152676f2076616c75657360c01b606482015260840161070c565b8082106117475760405162461bcd60e51b815260206004820152602b60248201527f75706461746552656465656d53657474696e67733a2077726f6e67206475726160448201527f74696f6e2076616c756573000000000000000000000000000000000000000000606482015260840161070c565b60648311156117a95760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e6720726174696044820152676f2076616c75657360c01b606482015260840161070c565b60ce84905560cf83905560d082905560d18190556040805185815260208101859052908101839052606081018290527ff282865353a487a40c4983b3a1a4e8901e81cb5605f653e6352dc57cdb5744889060800160405180910390a150505050565b6001600160a01b038216600090815260d360205260408120548190819085908590811061188e5760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201526a1cc81b9bdd08195e1a5cdd60aa1b606482015260840161070c565b6001600160a01b038716600090815260d3602052604081208054889081106118b8576118b8612e63565b60009182526020918290206040805160608101825260039390930290910180548084526001820154948401859052600290910154929091018290529a919950975095505050505050565b61190a6120d3565b6001600160a01b0381166119865760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161070c565b610fcb8161212d565b6001600160a01b038316611a0a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b038216611a865760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611b635760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b038216611bdf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161070c565b611bea8383836122ad565b6001600160a01b03831660009081526033602052604090205481811015611c795760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290611cb0908490612e50565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611cfc91815260200190565b60405180910390a36112c4565b6001600160a01b0383163014611d305760c954611d30906001600160a01b03168483612326565b80821115611d655760cb54611d65906001600160a01b0316611d528385612e79565b60c9546001600160a01b03169190612326565b611d6f30836123cf565b826001600160a01b0316846001600160a01b03167f97e9420300f4f0cbc2f0000a63fbde2ed410110b48c4e6866580ead3e95b42698484604051611dbd929190918252602082015260400190565b60405180910390a350505050565b604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015282919085169063dd62ed3e90604401602060405180830381865afa158015611e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3e9190612eae565b1015611e6f57611e596001600160a01b038416836000612560565b611e6f6001600160a01b03841683600019612560565b505050565b60006106b8825490565b6001600160a01b0381166000908152600183016020526040812054151561091b565b6001600160a01b0383811660009081526034602090815260408083209386168352929052205460001981146112c45781811015611f1f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161070c565b6112c4848484840361198f565b600061091b8383612695565b33600090815260d3602052604090208054611f5590600190612e79565b81548110611f6557611f65612e63565b906000526020600020906003020160d36000336001600160a01b03166001600160a01b031681526020019081526020016000208281548110611fa957611fa9612e63565b60009182526020808320845460039093020191825560018085015490830155600293840154939091019290925533815260d390915260409020805480611ff157611ff1612ec7565b6000828152602081206003600019909301928302018181556001810182905560020155905550565b816000036120695760405162461bcd60e51b815260206004820152601e60248201527f636f6e766572743a20616d6f756e742063616e6e6f74206265206e756c6c0000604482015260640161070c565b61207381836126bf565b604080516001600160a01b03831681526020810184905233917fccfaeb3043a96a967dc036ab72e078a9632af809671bc2a1ac30a8043645f89e910160405180910390a260c9546120cf906001600160a01b03163330856127aa565b5050565b6065546001600160a01b03163314610c135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161070c565b606580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166121f75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161070c565b610c136127fb565b600054610100900460ff1661226a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161070c565b60366122768382612f41565b506037611e6f8282612f41565b600061091b836001600160a01b03841661286f565b600061091b836001600160a01b0384166128be565b6001600160a01b03831615806122c957506122c960cc84611e7e565b806122da57506122da60cc83611e7e565b611e6f5760405162461bcd60e51b815260206004820152601560248201527f7472616e736665723a206e6f7420616c6c6f7765640000000000000000000000604482015260640161070c565b6040516001600160a01b038316602482015260448101829052611e6f9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526129b1565b6001600160a01b03821661244b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b612457826000836122ad565b6001600160a01b038216600090815260336020526040902054818110156124e65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b0383166000908152603360205260408120838303905560358054849290612515908490612e79565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b8015806125da5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156125b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d89190612eae565b155b61264c5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606482015260840161070c565b6040516001600160a01b038316602482015260448101829052611e6f9084907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161236b565b60008260000182815481106126ac576126ac612e63565b9060005260206000200154905092915050565b6001600160a01b0382166127155760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161070c565b612721600083836122ad565b80603560008282546127339190612e50565b90915550506001600160a01b03821660009081526033602052604081208054839290612760908490612e50565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526112c49085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161236b565b600054610100900460ff166128665760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161070c565b610c133361212d565b60008181526001830160205260408120546128b6575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106b8565b5060006106b8565b600081815260018301602052604081205480156129a75760006128e2600183612e79565b85549091506000906128f690600190612e79565b905081811461295b57600086600001828154811061291657612916612e63565b906000526020600020015490508087600001848154811061293957612939612e63565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061296c5761296c612ec7565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106b8565b60009150506106b8565b6000612a06826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a969092919063ffffffff16565b805190915015611e6f5780806020019051810190612a249190613001565b611e6f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161070c565b60606116618484600085856001600160a01b0385163b612af85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161070c565b600080866001600160a01b03168587604051612b14919061301e565b60006040518083038185875af1925050503d8060008114612b51576040519150601f19603f3d011682016040523d82523d6000602084013e612b56565b606091505b5091509150612b66828286612b71565b979650505050505050565b60608315612b8057508161091b565b825115612b905782518084602001fd5b8160405162461bcd60e51b815260040161070c9190612bce565b60005b83811015612bc5578181015183820152602001612bad565b50506000910152565b6020815260008251806020840152612bed816040850160208701612baa565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114612c1857600080fd5b919050565b60008060408385031215612c3057600080fd5b612c3983612c01565b946020939093013593505050565b60008060408385031215612c5a57600080fd5b50508035926020909101359150565b600060208284031215612c7b57600080fd5b61091b82612c01565b600080600060608486031215612c9957600080fd5b612ca284612c01565b9250612cb060208501612c01565b9150604084013590509250925092565b600060208284031215612cd257600080fd5b5035919050565b60008060408385031215612cec57600080fd5b82359150612cfc60208401612c01565b90509250929050565b8015158114610fcb57600080fd5b60008060408385031215612d2657600080fd5b612d2f83612c01565b91506020830135612d3f81612d05565b809150509250929050565b600080600060608486031215612d5f57600080fd5b612d6884612c01565b9250612d7660208501612c01565b9150612d8460408501612c01565b90509250925092565b60008060008060808587031215612da357600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215612dd257600080fd5b612ddb83612c01565b9150612cfc60208401612c01565b600181811c90821680612dfd57607f821691505b602082108103612e1d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106b8576106b8612e23565b808201808211156106b8576106b8612e23565b634e487b7160e01b600052603260045260246000fd5b818103818111156106b8576106b8612e23565b600082612ea957634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612ec057600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f821115611e6f57600081815260208120601f850160051c81016020861015612f1a5750805b601f850160051c820191505b81811015612f3957828155600101612f26565b505050505050565b815167ffffffffffffffff811115612f5b57612f5b612edd565b612f6f81612f698454612de9565b84612ef3565b602080601f831160018114612fa45760008415612f8c5750858301515b600019600386901b1c1916600185901b178555612f39565b600085815260208120601f198616915b82811015612fd357888601518255948401946001909101908401612fb4565b5085821015612ff15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561301357600080fd5b815161091b81612d05565b60008251613030818460208701612baa565b919091019291505056fea2646970667358221220064f9217e793f6f2d2ba3be800f32d9f1c54e6f6bd834181a052966ec26a02ad64736f6c63430008110033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102c85760003560e01c80638129fc1c1161017b578063b90c2b52116100d8578063dd62ed3e1161008c578063e3a2950b11610071578063e3a2950b146105ed578063e9ed87f8146105f6578063f2fde38b146105ff57600080fd5b8063dd62ed3e14610594578063de137c03146105cd57600080fd5b8063c4b10766116100bd578063c4b1076614610565578063ca6132921461056e578063cc6c54231461058157600080fd5b8063b90c2b5214610529578063be3f4d681461055257600080fd5b8063a081df7f1161012f578063a457c2d711610114578063a457c2d7146104f0578063a9059cbb14610503578063aff6cbf11461051657600080fd5b8063a081df7f146104ca578063a3908e1b146104dd57600080fd5b80638da5cb5b116101605780638da5cb5b1461049e57806395d89b41146104af578063983103e0146104b757600080fd5b80638129fc1c14610483578063890836541461048b57600080fd5b80634b359d3811610229578063646fcdd2116101dd57806370d5ae05116101c257806370d5ae0514610455578063715018a6146104685780637cbc23731461047057600080fd5b8063646fcdd21461041957806370a082311461042c57600080fd5b8063539ffb771161020e578063539ffb77146103eb5780635a1d34dc146103fe578063619ac95b1461041157600080fd5b80634b359d38146103925780634f62b7ec146103bd57600080fd5b80631c3526791161028057806323b872dd1161026557806323b872dd1461035d578063313ce56714610370578063395093511461037f57600080fd5b80631c352679146103415780631eee7e601461034a57600080fd5b80631338736f116102b15780631338736f1461030e578063161aab431461032357806318160ddd1461033957600080fd5b806306fdde03146102cd578063095ea7b3146102eb575b600080fd5b6102d5610612565b6040516102e29190612bce565b60405180910390f35b6102fe6102f9366004612c1d565b6106a4565b60405190151581526020016102e2565b61032161031c366004612c47565b6106be565b005b61032b6108de565b6040519081526020016102e2565b60355461032b565b61032b60ce5481565b6102fe610358366004612c69565b6108ef565b6102fe61036b366004612c84565b6108fc565b604051601281526020016102e2565b6102fe61038d366004612c1d565b610922565b6103a56103a0366004612cc0565b610961565b6040516001600160a01b0390911681526020016102e2565b6103d06103cb366004612c1d565b61096e565b604080519384526020840192909252908201526060016102e2565b6103216103f9366004612cc0565b6109b0565b61032161040c366004612cd9565b610b49565b61032b606481565b60c9546103a5906001600160a01b031681565b61032b61043a366004612c69565b6001600160a01b031660009081526033602052604090205490565b60cb546103a5906001600160a01b031681565b610321610c01565b61032161047e366004612c47565b610c15565b610321610e3a565b610321610499366004612d13565b610fce565b6065546001600160a01b03166103a5565b6102d56110bf565b60ca546103a5906001600160a01b031681565b6103216104d8366004612d4a565b6110ce565b6103216104eb366004612cc0565b6112ca565b6102fe6104fe366004612c1d565b611333565b6102fe610511366004612c1d565b6113e8565b610321610524366004612cc0565b6113f6565b61032b610537366004612c69565b6001600160a01b0316600090815260d3602052604090205490565b61032b610560366004612c47565b6115ba565b61032b60d05481565b61032161057c366004612d8d565b611669565b6103d061058f366004612c1d565b61180b565b61032b6105a2366004612dbf565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b61032b6105db366004612c69565b60d26020526000908152604090205481565b61032b60cf5481565b61032b60d15481565b61032161060d366004612c69565b611902565b60606036805461062190612de9565b80601f016020809104026020016040519081016040528092919081815260200182805461064d90612de9565b801561069a5780601f1061066f5761010080835404028352916020019161069a565b820191906000526020600020905b81548152906001019060200180831161067d57829003601f168201915b5050505050905090565b6000336106b281858561198f565b60019150505b92915050565b6002609754036107155760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002609755816107675760405162461bcd60e51b815260206004820152601f60248201527f6c6f636b3a2078457162416d6f756e742063616e6e6f74206265206e756c6c00604482015260640161070c565b60006107768262093a80612e39565b905060d0548110156107ca5760405162461bcd60e51b815260206004820152601660248201527f6c6f636b3a206475726174696f6e20746f6f206c6f7700000000000000000000604482015260640161070c565b6107d5333085611ae7565b60006107e184836115ba565b90506107ef33308684611d09565b60c95460ca5461080c916001600160a01b03908116911683611dcb565b60ca546040517fe2ab691d00000000000000000000000000000000000000000000000000000000815233600482015260248101839052604481018590526001600160a01b039091169063e2ab691d90606401600060405180830381600087803b15801561087857600080fd5b505af115801561088c573d6000803e3d6000fd5b505060408051878152602081018590529081018690523392507f0e31f07bae79135368ff475cf6c7f6abb31e0fd731e03c18ad425bd9406cf0c0915060600160405180910390a2505060016097555050565b60006108ea60cc611e74565b905090565b60006106b860cc83611e7e565b60003361090a858285611ea0565b610915858585611ae7565b60019150505b9392505050565b3360008181526034602090815260408083206001600160a01b03871684529091528120549091906106b2908290869061095c908790612e50565b61198f565b60006106b860cc83611f2c565b60d3602052816000526040600020818154811061098a57600080fd5b600091825260209091206003909102018054600182015460029092015490935090915083565b600260975403610a025760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975533600081815260d3602052604090205482908110610a7b5760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201526a1cc81b9bdd08195e1a5cdd60aa1b606482015260840161070c565b33600090815260d360205260408120805485908110610a9c57610a9c612e63565b90600052602060002090600302019050806001015460d26000336001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ae59190612e79565b92505081905550610afb30338360010154611ae7565b600181015460405190815233907f56d7520e387607a8daa892e3fed116badc2a636307bdc794b1c1aed97ae203f49060200160405180910390a2610b3e84611f38565b505060016097555050565b600260975403610b9b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b6002609755333b610bee5760405162461bcd60e51b815260206004820152601660248201527f636f6e76657274546f3a206e6f7420616c6c6f77656400000000000000000000604482015260640161070c565b610bf88282612019565b50506001609755565b610c096120d3565b610c13600061212d565b565b600260975403610c675760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975581610cdf5760405162461bcd60e51b815260206004820152602160248201527f72656465656d3a2078457162416d6f756e742063616e6e6f74206265206e756c60448201527f6c00000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b60d054811015610d315760405162461bcd60e51b815260206004820152601860248201527f72656465656d3a206475726174696f6e20746f6f206c6f770000000000000000604482015260640161070c565b610d3c333084611ae7565b6000610d4883836115ba565b604080518581526020810183905290810184905290915033907fbd5034ffbd47e4e72a94baa2cdb74c6fad73cb3bcdc13036b72ec8306f5a76469060600160405180910390a28115610e245733600090815260d2602052604081208054859290610db3908490612e50565b909155505033600090815260d360209081526040918290208251606081018452848152918201869052918101610de98542612e50565b905281546001818101845560009384526020938490208351600390930201918255928201519281019290925560400151600290910155610e30565b610e3033338584611d09565b5050600160975550565b600054610100900460ff1615808015610e5a5750600054600160ff909116105b80610e745750303b158015610e74575060005460ff166001145b610ee65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161070c565b6000805460ff191660011790558015610f09576000805461ff0019166101001790555b610f1161218c565b610f856040518060400160405280600781526020017f6d617820455142000000000000000000000000000000000000000000000000008152506040518060400160405280600481526020017f78455142000000000000000000000000000000000000000000000000000000008152506121ff565b8015610fcb576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b610fd66120d3565b306001600160a01b038316036110545760405162461bcd60e51b815260206004820152603a60248201527f7570646174655472616e7366657257686974656c6973743a2043616e6e6f742060448201527f72656d6f766520784571622066726f6d2077686974656c697374000000000000606482015260840161070c565b801561106b5761106560cc83612283565b50611078565b61107660cc83612298565b505b604080516001600160a01b038416815282151560208201527f3a34209cb941a5d23a56dea730a13738454bc7daefd4bb32e8d7df58c1bd920d910160405180910390a15050565b60606037805461062190612de9565b6110d66120d3565b60c9546001600160a01b03161561112f5760405162461bcd60e51b815260206004820152601660248201527f736574506172616d733a20616c72656164792073657400000000000000000000604482015260640161070c565b6001600160a01b0383166111855760405162461bcd60e51b815260206004820152601d60248201527f736574506172616d733a206571622063616e6e6f74206265206e756c6c000000604482015260640161070c565b6001600160a01b0382166111db5760405162461bcd60e51b815260206004820152601f60248201527f736574506172616d733a20766c4571622063616e6e6f74206265206e756c6c00604482015260640161070c565b6001600160a01b0381166112575760405162461bcd60e51b815260206004820152602560248201527f736574506172616d733a206275726e416464726573732063616e6e6f7420626560448201527f206e756c6c000000000000000000000000000000000000000000000000000000606482015260840161070c565b60c980546001600160a01b0380861673ffffffffffffffffffffffffffffffffffffffff199283161790925560ca805485841690831617905560cb805492841692909116919091179055603260ce55606460cf556212750060d05562dd7c0060d1556112c460cc30612283565b50505050565b60026097540361131c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975561132b8133612019565b506001609755565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156113d05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161070c565b6113dd828686840361198f565b506001949350505050565b6000336106b2818585611ae7565b6002609754036114485760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161070c565b600260975533600081815260d36020526040902054829081106114c15760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201526a1cc81b9bdd08195e1a5cdd60aa1b606482015260840161070c565b33600090815260d3602052604081208054859081106114e2576114e2612e63565b9060005260206000209060030201905080600201546114fe4290565b10156115725760405162461bcd60e51b815260206004820152603260248201527f66696e616c697a6552656465656d3a2076657374696e67206475726174696f6e60448201527f20686173206e6f7420656e646564207965740000000000000000000000000000606482015260840161070c565b600181015433600090815260d2602052604081208054909190611596908490612e79565b925050819055506115b1333383600101548460000154611d09565b610b3e84611f38565b600060d0548210156115ce575060006106b8565b60d1548211156115f957606460cf54846115e89190612e39565b6115f29190612e8c565b90506106b8565b600060d05460d15461160b9190612e79565b60ce5460cf5461161b9190612e79565b60d0546116289086612e79565b6116329190612e39565b61163c9190612e8c565b60ce546116499190612e50565b905060646116578286612e39565b6116619190612e8c565b949350505050565b6116716120d3565b828411156116d25760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e6720726174696044820152676f2076616c75657360c01b606482015260840161070c565b8082106117475760405162461bcd60e51b815260206004820152602b60248201527f75706461746552656465656d53657474696e67733a2077726f6e67206475726160448201527f74696f6e2076616c756573000000000000000000000000000000000000000000606482015260840161070c565b60648311156117a95760405162461bcd60e51b815260206004820152602860248201527f75706461746552656465656d53657474696e67733a2077726f6e6720726174696044820152676f2076616c75657360c01b606482015260840161070c565b60ce84905560cf83905560d082905560d18190556040805185815260208101859052908101839052606081018290527ff282865353a487a40c4983b3a1a4e8901e81cb5605f653e6352dc57cdb5744889060800160405180910390a150505050565b6001600160a01b038216600090815260d360205260408120548190819085908590811061188e5760405162461bcd60e51b815260206004820152602b60248201527f76616c696461746552656465656d3a2072656465656d20656e74727920646f6560448201526a1cc81b9bdd08195e1a5cdd60aa1b606482015260840161070c565b6001600160a01b038716600090815260d3602052604081208054889081106118b8576118b8612e63565b60009182526020918290206040805160608101825260039390930290910180548084526001820154948401859052600290910154929091018290529a919950975095505050505050565b61190a6120d3565b6001600160a01b0381166119865760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161070c565b610fcb8161212d565b6001600160a01b038316611a0a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b038216611a865760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611b635760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b038216611bdf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161070c565b611bea8383836122ad565b6001600160a01b03831660009081526033602052604090205481811015611c795760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290611cb0908490612e50565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611cfc91815260200190565b60405180910390a36112c4565b6001600160a01b0383163014611d305760c954611d30906001600160a01b03168483612326565b80821115611d655760cb54611d65906001600160a01b0316611d528385612e79565b60c9546001600160a01b03169190612326565b611d6f30836123cf565b826001600160a01b0316846001600160a01b03167f97e9420300f4f0cbc2f0000a63fbde2ed410110b48c4e6866580ead3e95b42698484604051611dbd929190918252602082015260400190565b60405180910390a350505050565b604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015282919085169063dd62ed3e90604401602060405180830381865afa158015611e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3e9190612eae565b1015611e6f57611e596001600160a01b038416836000612560565b611e6f6001600160a01b03841683600019612560565b505050565b60006106b8825490565b6001600160a01b0381166000908152600183016020526040812054151561091b565b6001600160a01b0383811660009081526034602090815260408083209386168352929052205460001981146112c45781811015611f1f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161070c565b6112c4848484840361198f565b600061091b8383612695565b33600090815260d3602052604090208054611f5590600190612e79565b81548110611f6557611f65612e63565b906000526020600020906003020160d36000336001600160a01b03166001600160a01b031681526020019081526020016000208281548110611fa957611fa9612e63565b60009182526020808320845460039093020191825560018085015490830155600293840154939091019290925533815260d390915260409020805480611ff157611ff1612ec7565b6000828152602081206003600019909301928302018181556001810182905560020155905550565b816000036120695760405162461bcd60e51b815260206004820152601e60248201527f636f6e766572743a20616d6f756e742063616e6e6f74206265206e756c6c0000604482015260640161070c565b61207381836126bf565b604080516001600160a01b03831681526020810184905233917fccfaeb3043a96a967dc036ab72e078a9632af809671bc2a1ac30a8043645f89e910160405180910390a260c9546120cf906001600160a01b03163330856127aa565b5050565b6065546001600160a01b03163314610c135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161070c565b606580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166121f75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161070c565b610c136127fb565b600054610100900460ff1661226a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161070c565b60366122768382612f41565b506037611e6f8282612f41565b600061091b836001600160a01b03841661286f565b600061091b836001600160a01b0384166128be565b6001600160a01b03831615806122c957506122c960cc84611e7e565b806122da57506122da60cc83611e7e565b611e6f5760405162461bcd60e51b815260206004820152601560248201527f7472616e736665723a206e6f7420616c6c6f7765640000000000000000000000604482015260640161070c565b6040516001600160a01b038316602482015260448101829052611e6f9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526129b1565b6001600160a01b03821661244b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b612457826000836122ad565b6001600160a01b038216600090815260336020526040902054818110156124e65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161070c565b6001600160a01b0383166000908152603360205260408120838303905560358054849290612515908490612e79565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b8015806125da5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156125b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d89190612eae565b155b61264c5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606482015260840161070c565b6040516001600160a01b038316602482015260448101829052611e6f9084907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161236b565b60008260000182815481106126ac576126ac612e63565b9060005260206000200154905092915050565b6001600160a01b0382166127155760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161070c565b612721600083836122ad565b80603560008282546127339190612e50565b90915550506001600160a01b03821660009081526033602052604081208054839290612760908490612e50565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526112c49085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161236b565b600054610100900460ff166128665760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161070c565b610c133361212d565b60008181526001830160205260408120546128b6575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106b8565b5060006106b8565b600081815260018301602052604081205480156129a75760006128e2600183612e79565b85549091506000906128f690600190612e79565b905081811461295b57600086600001828154811061291657612916612e63565b906000526020600020015490508087600001848154811061293957612939612e63565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061296c5761296c612ec7565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106b8565b60009150506106b8565b6000612a06826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a969092919063ffffffff16565b805190915015611e6f5780806020019051810190612a249190613001565b611e6f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161070c565b60606116618484600085856001600160a01b0385163b612af85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161070c565b600080866001600160a01b03168587604051612b14919061301e565b60006040518083038185875af1925050503d8060008114612b51576040519150601f19603f3d011682016040523d82523d6000602084013e612b56565b606091505b5091509150612b66828286612b71565b979650505050505050565b60608315612b8057508161091b565b825115612b905782518084602001fd5b8160405162461bcd60e51b815260040161070c9190612bce565b60005b83811015612bc5578181015183820152602001612bad565b50506000910152565b6020815260008251806020840152612bed816040850160208701612baa565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114612c1857600080fd5b919050565b60008060408385031215612c3057600080fd5b612c3983612c01565b946020939093013593505050565b60008060408385031215612c5a57600080fd5b50508035926020909101359150565b600060208284031215612c7b57600080fd5b61091b82612c01565b600080600060608486031215612c9957600080fd5b612ca284612c01565b9250612cb060208501612c01565b9150604084013590509250925092565b600060208284031215612cd257600080fd5b5035919050565b60008060408385031215612cec57600080fd5b82359150612cfc60208401612c01565b90509250929050565b8015158114610fcb57600080fd5b60008060408385031215612d2657600080fd5b612d2f83612c01565b91506020830135612d3f81612d05565b809150509250929050565b600080600060608486031215612d5f57600080fd5b612d6884612c01565b9250612d7660208501612c01565b9150612d8460408501612c01565b90509250925092565b60008060008060808587031215612da357600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215612dd257600080fd5b612ddb83612c01565b9150612cfc60208401612c01565b600181811c90821680612dfd57607f821691505b602082108103612e1d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106b8576106b8612e23565b808201808211156106b8576106b8612e23565b634e487b7160e01b600052603260045260246000fd5b818103818111156106b8576106b8612e23565b600082612ea957634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612ec057600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f821115611e6f57600081815260208120601f850160051c81016020861015612f1a5750805b601f850160051c820191505b81811015612f3957828155600101612f26565b505050505050565b815167ffffffffffffffff811115612f5b57612f5b612edd565b612f6f81612f698454612de9565b84612ef3565b602080601f831160018114612fa45760008415612f8c5750858301515b600019600386901b1c1916600185901b178555612f39565b600085815260208120601f198616915b82811015612fd357888601518255948401946001909101908401612fb4565b5085821015612ff15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561301357600080fd5b815161091b81612d05565b60008251613030818460208701612baa565b919091019291505056fea2646970667358221220064f9217e793f6f2d2ba3be800f32d9f1c54e6f6bd834181a052966ec26a02ad64736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.