ETH Price: $2,973.66 (-4.71%)
 

Overview

Max Total Supply

750.388755113606132175 WIG

Holders

286

Transfers

-
0

Market

Price

$0.00 @ 0.000000 ETH

Onchain Market Cap

-

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
TOKEN

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "contracts/interfaces/IOTOKEN.sol";
import "contracts/interfaces/IVTOKEN.sol";
import "contracts/interfaces/IOTOKENFactory.sol";
import "contracts/interfaces/IVTOKENFactory.sol";
import "contracts/interfaces/ITOKENFeesFactory.sol";

/**
 * @title TOKEN Bonding Curve
 * @author heesho
 * 
 * This contract governs the price dynamics of an ERC20 TOKEN via a dual bonding curve mechanism:
 * 1. A fixed-price curve, y = c, where the TOKEN price is invariant at 1 BASE/TOKEN (the floor price). 
 *    TOKENs are minted from floor reserves by exercising OTOKEN call options equivalent to the BASE amount. 
 *    TOKENs can be consistently redeemed from floor reserves at the floor price.
 * 2. A variable-price curve that employs the xy=k formula for TOKEN price discovery. An initial TOKEN supply 
 *    is minted into market reserves, balanced by a corresponding quantity of virtual BASE. TOKEN pricing on the 
 *    market reserves spans a range of 1 BASE/TOKEN (lower bound) to infinity BASE/TOKEN (upper bound). The market 
 *    reserve facilitates the buying and selling of TOKENs.
 * 
 * The integration of these reserves forms the comprehensive bonding curve for the TOKEN.
 *  _____________________
 * |           |        /|
 * |           |       / |
 * |           |      /  |
 * |           |     /   |
 * |           |    /    |
 * |           |   /     |
 * |           |  /      |
 * |           | /       |
 * |___________|/        |
 * | FLOOR     | MARKET  |
 * | RESERVE   | RESERVE |
 * |___________|_________|
 * |<----Cf--->|<---Cm-->|
 *
 * The constructs of floor reserves and market reserves underpin this contract.
 * Floor reserves are BASE pools allowing TOKEN redemption at a static floor price. 
 * TOKENs are exclusively minted from floor reserves via exercising OTOKEN call options using BASE.
 * Market reserves incorporate variable amounts of BASE and TOKEN subjected to market-driven pricing 
 * derived from a virtual xy=k invariant. An initial TOKEN supply is minted into the market reserves, 
 * with an equal virtual BASE reserve amount. TOKEN pricing in the market reserves varies from a minimum 
 * of 1 BASE/TOKEN (floor price) to an upper limit of infinity BASE/TOKEN.
 * 
 * The contract is designed to interact with external contracts including: OTOKEN, VTOKEN, and a FEES contract. 
 * It is also equipped to levy protocol and UI hosting provider fees. The TOKEN's initial supply is minted to the 
 * bonding curve balanced by an equal amount of virtual BASE. For the bonding curve to operate correctly, BASE must 
 * be an 18 decimal ERC20 token.
 */
contract TOKEN is ERC20, ReentrancyGuard {
    using SafeERC20 for IERC20;

    /*===================================================================*/
    /*===========================  SETTINGS  ============================*/

    string internal constant NAME = 'ToupeeTech';     // Name of TOKEN
    string internal constant SYMBOL = 'WIG';       // Symbol of TOKEN

    uint256 public constant PROTOCOL_FEE = 30;      // Swap and borrow fee: buy, sell, borrow
    uint256 public constant PROVIDER_FEE = 4000;    // Fee for the UI hosting provider

    /*===========================  END SETTINGS  ========================*/
    /*===================================================================*/

    /*----------  CONSTANTS  --------------------------------------------*/

    uint256 public constant DIVISOR = 10000;        // Divisor for fee calculation
    uint256 public constant FLOOR_PRICE = 1e18;     // Floor price of TOKEN in BASE
    uint256 public constant PRECISION = 1e18;       // Precision
    uint8 public constant DECIMALS = 18;            // Required BASE decimals

    /*----------  STATE VARIABLES  --------------------------------------*/

    // Address state variables
    IERC20 public immutable BASE;       // ERC20 token that backs TOKEN with liquidity in Bonding Curve. Must be 18 decimals
    address public immutable OTOKEN;    // Call option on TOKEN that can be exercised at the floor price of the bonding curve
    address public immutable VTOKEN;    // Staking contract for TOKEN to earn fees, rewards, voting power, and collateral for loans
    address public immutable FEES;      // Fees contract collects fees swaps and loans to distribute through rewarder

    // Bonding Curve state variables
    uint256 public frBASE;              // floor reserve BASE
    uint256 public immutable mrvBASE;   // market reserve virtual BASE, also is the max amount of TOKEN allowed in the market reserve
    uint256 public mrrBASE;             // market reserve real BASE
    uint256 public mrrTOKEN;            // market reserve real TOKEN

    // Lending state variables
    uint256 public debtTotal;                               // total debt in BASE owed to the bonding curve
    mapping(address => uint256) public debts;               // debt in BASE owed to the bonding curve per account

    /*----------  ERRORS ------------------------------------------------*/

    error TOKEN__InvalidDecimals();
    error TOKEN__InvalidZeroInput();
    error TOKEN__SwapExpired();
    error TOKEN__ExceedsSwapSlippageTolerance();
    error TOKEN__ExceedsSwapMarketReserves();
    error TOKEN__ExceedsBorrowCreditLimit();
    error TOKEN__InvalidZeroAddress();

    /*----------  EVENTS ------------------------------------------------*/

    event TOKEN__Buy(address indexed account, address indexed to, uint256 amount);
    event TOKEN__Sell(address indexed account, address indexed to, uint256 amount);
    event TOKEN__Exercise(address indexed account, address indexed to, uint256 amount);
    event TOKEN__Redeem(address indexed account, address indexed to, uint256 amount);
    event TOKEN__Borrow(address indexed account, uint256 amount);
    event TOKEN__Repay(address indexed account, uint256 amount);

    /*----------  MODIFIERS  --------------------------------------------*/

    modifier nonZeroInput(uint256 _amount) {
        if (_amount == 0) revert TOKEN__InvalidZeroInput();
        _;
    }

    modifier nonExpiredSwap(uint256 expireTimestamp) {
        if (expireTimestamp < block.timestamp) revert TOKEN__SwapExpired();
        _;
    }

    modifier nonZeroAddress(address _account) {
        if (_account == address(0)) revert TOKEN__InvalidZeroAddress();
        _;
    }

    /*----------  FUNCTIONS  --------------------------------------------*/

    /**
     * @notice Construct a new TOKEN Bonding Curve. TOKEN and BASE reserves will be equal.
     *         The initial supply of TOKEN will be minted to the bonding curve with an equal amount of virtual BASE.
     * @dev The BASE must be an 18 decimal ERC20 token, otherwise the bonding curve will not function correctly
     * @param _BASE The ERC20 in the bonding curve reserves
     * @param _supplyTOKEN The initial supply of TOKEN to mint to the bonding curve
     * @param _OTOKENFactory The factory contract to create the OTOKEN
     * @param _VTOKENFactory The factory contract to create the VTOKEN
     * @param _VTOKENRewarderFactory The factory contract to create the VTOKENRewarder
     * @param _TOKENFeesFactory The factory contract to create the TOKENFees
     */
    constructor(
        address _BASE, 
        uint256 _supplyTOKEN, 
        address _OTOKENFactory, 
        address _VTOKENFactory, 
        address _VTOKENRewarderFactory, 
        address _TOKENFeesFactory
    )
        ERC20(NAME, SYMBOL)
        nonZeroAddress(_BASE)
        nonZeroInput(_supplyTOKEN)
    {
        if (IERC20Metadata(_BASE).decimals() != DECIMALS) revert TOKEN__InvalidDecimals();
        address _owner = msg.sender;
        BASE = IERC20(_BASE);
        mrvBASE = _supplyTOKEN;
        mrrTOKEN = _supplyTOKEN;
        OTOKEN = IOTOKENFactory(_OTOKENFactory).createOToken(_owner);
        (address vToken, address rewarder) = IVTOKENFactory(_VTOKENFactory).createVToken(address(this), OTOKEN, _VTOKENRewarderFactory, _owner);
        VTOKEN = vToken;
        FEES = ITOKENFeesFactory(_TOKENFeesFactory).createTokenFees(rewarder, address(this), _BASE, OTOKEN);
    }

    /**
     * @notice Buy TOKEN from the bonding curve market reserves with BASE
     * @param amountBase Amount of BASE to spend
     * @param minToken Minimum amount of TOKEN to receive, reverts when outTOKEN < minToken
     * @param expireTimestamp Expiration timestamp of the swap, reverts when block.timestamp > expireTimestamp
     * @param toAccount Account address to receive TOKEN
     * @param provider Account address (UI provider) to receive provider fee, address(0) does not take a fee
     * @return bool true=success, otherwise false
     */
    function buy(uint256 amountBase, uint256 minToken, uint256 expireTimestamp, address toAccount, address provider) 
        external
        nonReentrant
        nonZeroInput(amountBase)
        nonExpiredSwap(expireTimestamp)
        returns (bool)
    {
        uint256 feeBASE = amountBase * PROTOCOL_FEE / DIVISOR;
        uint256 newMrBASE = (mrvBASE + mrrBASE) + amountBase - feeBASE;
        uint256 newMrTOKEN = (mrvBASE + mrrBASE) * mrrTOKEN / newMrBASE;
        uint256 outTOKEN = mrrTOKEN - newMrTOKEN;

        if (outTOKEN < minToken) revert TOKEN__ExceedsSwapSlippageTolerance();

        mrrBASE = newMrBASE - mrvBASE;
        mrrTOKEN = newMrTOKEN;

        emit TOKEN__Buy(msg.sender, toAccount, amountBase);

        if (provider != address(0)) {
            uint256 providerFee = feeBASE * PROVIDER_FEE / DIVISOR;
            BASE.safeTransferFrom(msg.sender, provider, providerFee);
            BASE.safeTransferFrom(msg.sender, FEES, feeBASE - providerFee);
        } else {
            BASE.safeTransferFrom(msg.sender, FEES, feeBASE);
        }
        IERC20(BASE).safeTransferFrom(msg.sender, address(this), amountBase - feeBASE);
        _mint(toAccount, outTOKEN);
        return true;
    }

    /**
     * @notice Sell TOKEN to the bonding curve market reserves for BASE
     * @param amountToken Amount of TOKEN to spend
     * @param minBase Minimum amount of BASE to receive, reverts when outBase < minBase
     * @param expireTimestamp Expiration timestamp of the swap, reverts when block.timestamp > expireTimestamp
     * @param toAccount Account address to receive BASE
     * @param provider Account address (UI provider) to receive provider fee, address(0) does not take a fee
     * @return bool true=success, otherwise false
     */
    function sell(uint256 amountToken, uint256 minBase, uint256 expireTimestamp, address toAccount, address provider) 
        external
        nonReentrant
        nonZeroInput(amountToken)
        nonExpiredSwap(expireTimestamp)
        returns (bool)
    {
        if (amountToken > getMaxSell()) revert TOKEN__ExceedsSwapMarketReserves();
        uint256 feeTOKEN = amountToken * PROTOCOL_FEE / DIVISOR;
        uint256 newMrTOKEN = mrrTOKEN + amountToken - feeTOKEN;
        uint256 newMrBASE = (mrvBASE + mrrBASE) * mrrTOKEN / newMrTOKEN;
        uint256 outBASE = (mrvBASE + mrrBASE) - newMrBASE;

        if (outBASE < minBase) revert TOKEN__ExceedsSwapSlippageTolerance();

        mrrBASE = newMrBASE - mrvBASE;
        mrrTOKEN = newMrTOKEN;

        emit TOKEN__Sell(msg.sender, toAccount, amountToken);

        if (provider != address(0)) {
            uint256 providerFee = feeTOKEN * PROVIDER_FEE / DIVISOR;
            IERC20(address(this)).transferFrom(msg.sender, provider, providerFee);
            IERC20(address(this)).transferFrom(msg.sender, FEES, feeTOKEN - providerFee);
        } else {
            IERC20(address(this)).transferFrom(msg.sender, FEES, feeTOKEN);
        }
        _burn(msg.sender, amountToken - feeTOKEN); 
        BASE.safeTransfer(toAccount, outBASE);
        return true;
    }

    /**
     * @notice Exercise equal amounts of OTOKEN with BASE to receive and an equal amount of TOKEN. 
     *         OTOKEN is a call option with no expiry that can be exercised to purchase TOKEN 
     *         with BASE at the constant floor price from the floor reserves.
     * @param amountOToken Amount of OTOKEN to exercise, an equal amount of BASE will be required
     * @param toAccount Account address to receive TOKEN
     * @return bool true=success, otherwise false
     */
    function exercise(uint256 amountOToken, address toAccount) 
        external
        nonReentrant
        nonZeroInput(amountOToken)
        returns (bool)
    {
        address account = msg.sender;
        frBASE += amountOToken;
        _mint(toAccount, amountOToken);
        emit TOKEN__Exercise(account, toAccount, amountOToken);
        IOTOKEN(OTOKEN).burnFrom(account, amountOToken);
        BASE.safeTransferFrom(account, address(this), amountOToken);
        return true;
    }

    /**
     * @notice Redeem TOKEN for an equal amount of BASE from the floor reserves at the constant floor price
     * @param amountToken Amount of TOKEN to redeem, an equal amount of BASE will be received
     * @param toAccount Account address to receive BASE
     * @return bool true=success, otherwise false
     */
    function redeem(uint256 amountToken, address toAccount)
        external
        nonReentrant
        nonZeroInput(amountToken)
        returns (bool)
    {
        address account = msg.sender;
        frBASE -= amountToken;
        _burn(account, amountToken);
        emit TOKEN__Redeem(account, toAccount, amountToken);
        BASE.safeTransfer(toAccount, amountToken);
        return true;
    }

    /**
     * @notice Borrow BASE from the bonding curve against VTOKEN collateral at the floor price of TOKEN.
     *         VTOKEN collateral is locked until the debt is repaid. No bad debt is possible because TOKEN can
     *         never go below the floor price. Therefore, no oracle or liquidation mechanism is required.
     * @param amountBase Amount of BASE to borrow, must be less than the account's borrow credit limit 
     *                   (VTOKEN balance * floor price of TOKEN)
     * @return bool true=success, otherwise false
     */
    function borrow(uint256 amountBase)
        external
        nonReentrant
        nonZeroInput(amountBase)
        returns (bool)
    {
        address account = msg.sender;
        uint256 credit = getAccountCredit(account);
        if (credit < amountBase) revert TOKEN__ExceedsBorrowCreditLimit();
        debts[account] += amountBase;
        debtTotal += amountBase;
        uint256 feeBASE = amountBase * PROTOCOL_FEE / DIVISOR;
        emit TOKEN__Borrow(account, amountBase);
        BASE.safeTransfer(FEES, feeBASE);
        BASE.safeTransfer(account, amountBase - feeBASE);
        return true;
    }

    /**
     * @notice Repay BASE to the bonding curve to reduce the account's borrow credit limit and unlock VTOKEN collateral
     * @param amountBase Amount of BASE to repay, must be less than or equal to the account's debt
     * @return bool true=success, otherwise false
     */
    function repay(uint256 amountBase) 
        external
        nonReentrant
        nonZeroInput(amountBase)
        returns (bool)
    {
        address account = msg.sender;
        debts[account] -= amountBase;
        debtTotal -= amountBase;
        emit TOKEN__Repay(account, amountBase);
        BASE.safeTransferFrom(account, address(this), amountBase);
        return true;
    }

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

    function getFloorPrice() public pure returns (uint256) {
        return FLOOR_PRICE;
    }

    function getMarketPrice() public view returns (uint256) {
        return ((mrvBASE + mrrBASE) * PRECISION) / mrrTOKEN;
    }

    function getOTokenPrice() public view returns (uint256) {
        return getMarketPrice() - getFloorPrice();
    }

    function getMaxSell() public view returns (uint256) {
        return (mrrTOKEN * mrrBASE / mrvBASE);
    }

    function getTotalValueLocked() public view returns (uint256) {
        return frBASE + mrrBASE;
    }

    function getAccountCredit(address account) public view returns (uint256) {
        return IVTOKEN(VTOKEN).balanceOfTOKEN(account) - debts[account];
    }

}

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

pragma solidity ^0.8.0;

/**
 * @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 ReentrancyGuard {
    // 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;

    constructor() {
        _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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

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

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * 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 ERC20 is Context, IERC20, IERC20Metadata {
    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}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _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 default value returned by this function, unless
     * it's 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;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _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;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _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;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _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 {}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @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);
}

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

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IOTOKEN {
    /*----------  FUNCTIONS  --------------------------------------------*/
    function burnFrom(address account, uint256 amount) external;
    /*----------  RESTRICTED FUNCTIONS  ---------------------------------*/
    function mint(address account, uint amount) external returns (bool);
    /*----------  VIEW FUNCTIONS  ---------------------------------------*/
    function minter() external view returns (address);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IOTOKENFactory {
    /*----------  FUNCTIONS  --------------------------------------------*/
    function createOToken(address _owner) external returns (address);
    /*----------  RESTRICTED FUNCTIONS  ---------------------------------*/
    /*----------  VIEW FUNCTIONS  ---------------------------------------*/
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface ITOKENFeesFactory {
    /*----------  FUNCTIONS  --------------------------------------------*/
    function createTokenFees(address _rewarder, address _TOKEN, address _BASE, address _OTOKEN) external returns (address);
    /*----------  RESTRICTED FUNCTIONS  ---------------------------------*/
    /*----------  VIEW FUNCTIONS  ---------------------------------------*/
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IVTOKEN {
    /*----------  FUNCTIONS  --------------------------------------------*/
    /*----------  RESTRICTED FUNCTIONS  ---------------------------------*/
    /*----------  VIEW FUNCTIONS  ---------------------------------------*/
    function OTOKEN() external view returns (address);
    function balanceOf(address account) external view returns (uint256);
    function balanceOfTOKEN(address account) external view returns (uint256);
    function totalSupply() external view returns (uint256);
    function totalSupplyTOKEN() external view returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IVTOKENFactory {
    /*----------  FUNCTIONS  --------------------------------------------*/
    function createVToken(address _TOKEN, address _OTOKEN, address _VTOKENRewarderFactory, address _owner) external returns (address, address);
    /*----------  RESTRICTED FUNCTIONS  ---------------------------------*/
    /*----------  VIEW FUNCTIONS  ---------------------------------------*/
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_BASE","type":"address"},{"internalType":"uint256","name":"_supplyTOKEN","type":"uint256"},{"internalType":"address","name":"_OTOKENFactory","type":"address"},{"internalType":"address","name":"_VTOKENFactory","type":"address"},{"internalType":"address","name":"_VTOKENRewarderFactory","type":"address"},{"internalType":"address","name":"_TOKENFeesFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"TOKEN__ExceedsBorrowCreditLimit","type":"error"},{"inputs":[],"name":"TOKEN__ExceedsSwapMarketReserves","type":"error"},{"inputs":[],"name":"TOKEN__ExceedsSwapSlippageTolerance","type":"error"},{"inputs":[],"name":"TOKEN__InvalidDecimals","type":"error"},{"inputs":[],"name":"TOKEN__InvalidZeroAddress","type":"error"},{"inputs":[],"name":"TOKEN__InvalidZeroInput","type":"error"},{"inputs":[],"name":"TOKEN__SwapExpired","type":"error"},{"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":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TOKEN__Borrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TOKEN__Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TOKEN__Exercise","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TOKEN__Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TOKEN__Repay","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TOKEN__Sell","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"},{"inputs":[],"name":"BASE","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DECIMALS","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEES","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FLOOR_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OTOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROTOCOL_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROVIDER_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VTOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"uint256","name":"amountBase","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountBase","type":"uint256"},{"internalType":"uint256","name":"minToken","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"},{"internalType":"address","name":"toAccount","type":"address"},{"internalType":"address","name":"provider","type":"address"}],"name":"buy","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"debtTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"debts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOToken","type":"uint256"},{"internalType":"address","name":"toAccount","type":"address"}],"name":"exercise","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"frBASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountCredit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFloorPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getMarketPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxSell","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOTokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalValueLocked","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":"mrrBASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mrrTOKEN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mrvBASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"address","name":"toAccount","type":"address"}],"name":"redeem","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountBase","type":"uint256"}],"name":"repay","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"minBase","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"},{"internalType":"address","name":"toAccount","type":"address"},{"internalType":"address","name":"provider","type":"address"}],"name":"sell","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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"}]

6101206040523480156200001257600080fd5b506040516200262e3803806200262e833981016040819052620000359162000355565b6040518060400160405280600a8152602001690a8deeae0cacaa8cac6d60b31b8152506040518060400160405280600381526020016257494760e81b815250816003908162000085919062000472565b50600462000094828262000472565b5050600160055550856001600160a01b038116620000c55760405163e859a7d360e01b815260040160405180910390fd5b8580600003620000e857604051638817380160e01b815260040160405180910390fd5b601260ff16886001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200012c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200015291906200053e565b60ff16146200017357604051623bc79760e11b815260040160405180910390fd5b6001600160a01b0388811660805261010088905260088890556040516329a4162360e11b81523360048201819052918816906353482c46906024016020604051808303816000875af1158015620001ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001f491906200056a565b6001600160a01b0390811660a0819052604051636fd29c7760e11b815230600482015260248101919091528682166044820152828216606482015260009182919089169063dfa538ee9060840160408051808303816000875af115801562000260573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000286919062000588565b6001600160a01b0380831660c05260a0516040516312b4fd6960e21b815282841660048201523060248201528f831660448201529082166064820152929450909250871690634ad3f5a4906084016020604051808303816000875af1158015620002f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200031a91906200056a565b6001600160a01b031660e05250620005c09950505050505050505050565b80516001600160a01b03811681146200035057600080fd5b919050565b60008060008060008060c087890312156200036f57600080fd5b6200037a8762000338565b955060208701519450620003916040880162000338565b9350620003a16060880162000338565b9250620003b16080880162000338565b9150620003c160a0880162000338565b90509295509295509295565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003f857607f821691505b6020821081036200041957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200046d57600081815260208120601f850160051c81016020861015620004485750805b601f850160051c820191505b81811015620004695782815560010162000454565b5050505b505050565b81516001600160401b038111156200048e576200048e620003cd565b620004a6816200049f8454620003e3565b846200041f565b602080601f831160018114620004de5760008415620004c55750858301515b600019600386901b1c1916600185901b17855562000469565b600085815260208120601f198616915b828110156200050f57888601518255948401946001909101908401620004ee565b50858210156200052e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156200055157600080fd5b815160ff811681146200056357600080fd5b9392505050565b6000602082840312156200057d57600080fd5b620005638262000338565b600080604083850312156200059c57600080fd5b620005a78362000338565b9150620005b76020840162000338565b90509250929050565b60805160a05160c05160e05161010051611f81620006ad60003960008181610471015281816108550152818161089c015281816108f701528181610c9d01528181610d9501528181610fbe01528181611008015261107f0152600081816103c801528181610a0501528181610ab301528181611153015281816111e4015261135401526000818161051e0152610d0b01526000818161049801526106d40152600081816104ee0152818161073d01528181610b4201528181610c3a01528181610e750152818161112501528181611186015281816111c10152818161133201526113910152611f816000f3fe608060405234801561001057600080fd5b506004361061023c5760003560e01c806370a082311161013b578063b26025aa116100b8578063dd62ed3e1161007c578063dd62ed3e146104cd578063e7e7e387146104e0578063ec342ad0146104e9578063f623bb8b14610510578063fb5484271461051957600080fd5b8063b26025aa14610451578063ba002b7014610459578063c2b96e9b1461046c578063c544df0c14610493578063c5ebeaec146104ba57600080fd5b8063a457c2d7116100ff578063a457c2d714610413578063a71f48a414610426578063a9059cbb14610435578063aaf5eb6814610426578063ad6cb8231461044857600080fd5b806370a08231146103875780637bde82f2146103b05780638b7b23ee146103c357806395d89b4114610402578063a07878561461040a57600080fd5b80632a33d6b2116101c9578063371fd8e61161018d578063371fd8e61461033e5780633950935114610351578063466f6311146103645780634c7ebd371461036c578063660e16c31461037f57600080fd5b80632a33d6b2146102e65780632e0f2625146102f45780632ecd4e7d1461030e578063313ce5671461032e5780633410fe6e1461033557600080fd5b806318160ddd1161021057806318160ddd1461029c5780631b6b7298146102a45780631b8f0bbc146102b757806323b872dd146102c057806326124288146102d357600080fd5b80626c72af1461024157806306fdde031461025c578063095ea7b3146102715780630b4501fd14610294575b600080fd5b610249610540565b6040519081526020015b60405180910390f35b610264610562565b6040516102539190611c90565b61028461027f366004611cda565b6105f4565b6040519015158152602001610253565b610249601e81565b600254610249565b6102846102b2366004611d04565b61060e565b61024960085481565b6102846102ce366004611d30565b610777565b6102846102e1366004611d6c565b61079b565b670de0b6b3a7640000610249565b6102fc601281565b60405160ff9091168152602001610253565b61024961031c366004611dbc565b600a6020526000908152604090205481565b60126102fc565b61024961271081565b61028461034c366004611dde565b610b86565b61028461035f366004611cda565b610c77565b610249610c99565b61024961037a366004611dbc565b610cd6565b610249610d82565b610249610395366004611dbc565b6001600160a01b031660009081526020819052604090205490565b6102846103be366004611d04565b610dc8565b6103ea7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610253565b610264610e9c565b61024960075481565b610284610421366004611cda565b610eab565b610249670de0b6b3a764000081565b610284610443366004611cda565b610f2b565b61024960065481565b610249610f39565b610284610467366004611d6c565b610f4b565b6102497f000000000000000000000000000000000000000000000000000000000000000081565b6103ea7f000000000000000000000000000000000000000000000000000000000000000081565b6102846104c8366004611dde565b611224565b6102496104db366004611df7565b6113ca565b61024960095481565b6103ea7f000000000000000000000000000000000000000000000000000000000000000081565b610249610fa081565b6103ea7f000000000000000000000000000000000000000000000000000000000000000081565b6000670de0b6b3a7640000610553610d82565b61055d9190611e37565b905090565b60606003805461057190611e4a565b80601f016020809104026020016040519081016040528092919081815260200182805461059d90611e4a565b80156105ea5780601f106105bf576101008083540402835291602001916105ea565b820191906000526020600020905b8154815290600101906020018083116105cd57829003601f168201915b5050505050905090565b6000336106028185856113f5565b60019150505b92915050565b600061061861151a565b828060000361063a57604051638817380160e01b815260040160405180910390fd5b600033905084600660008282546106519190611e84565b9091555061066190508486611573565b836001600160a01b0316816001600160a01b03167f199b105faa55cbba66c6c51adb78bf93238b4ad0cfadd14c986af220da77e7c8876040516106a691815260200190565b60405180910390a360405163079cc67960e41b81526001600160a01b038281166004830152602482018790527f000000000000000000000000000000000000000000000000000000000000000016906379cc679090604401600060405180830381600087803b15801561071857600080fd5b505af115801561072c573d6000803e3d6000fd5b506107679250506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169050823088611632565b6001925050506106086001600555565b600033610785858285611690565b610790858585611704565b506001949350505050565b60006107a561151a565b85806000036107c757604051638817380160e01b815260040160405180910390fd5b84428110156107e957604051630af1625160e31b815260040160405180910390fd5b6107f1610c99565b88111561081157604051639e0cbc9560e01b815260040160405180910390fd5b6000612710610821601e8b611e97565b61082b9190611eae565b90506000818a60085461083e9190611e84565b6108489190611e37565b90506000816008546007547f000000000000000000000000000000000000000000000000000000000000000061087e9190611e84565b6108889190611e97565b6108929190611eae565b90506000816007547f00000000000000000000000000000000000000000000000000000000000000006108c59190611e84565b6108cf9190611e37565b90508a8110156108f257604051633db0d7e560e01b815260040160405180910390fd5b61091c7f000000000000000000000000000000000000000000000000000000000000000083611e37565b60075560088390556040518c81526001600160a01b038a169033907fffc36e4a73526964b1bc25e2a44a90e979636de95ea6e59e01b6b83f2e20ae1e9060200160405180910390a36001600160a01b03881615610a96576000612710610984610fa087611e97565b61098e9190611eae565b6040516323b872dd60e01b815290915030906323b872dd906109b89033908d908690600401611ed0565b6020604051808303816000875af11580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fb9190611ef4565b50306323b872dd337f0000000000000000000000000000000000000000000000000000000000000000610a2e858a611e37565b6040518463ffffffff1660e01b8152600401610a4c93929190611ed0565b6020604051808303816000875af1158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190611ef4565b5050610b22565b6040516323b872dd60e01b815230906323b872dd90610add9033907f0000000000000000000000000000000000000000000000000000000000000000908990600401611ed0565b6020604051808303816000875af1158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b209190611ef4565b505b610b3533610b30868f611e37565b6118a8565b610b696001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168a836119d7565b60019650505050505050610b7d6001600555565b95945050505050565b6000610b9061151a565b8180600003610bb257604051638817380160e01b815260040160405180910390fd5b336000818152600a602052604081208054869290610bd1908490611e37565b925050819055508360096000828254610bea9190611e37565b90915550506040518481526001600160a01b038216907fb80483f4e501626c916db3d4b858524c6231939940f6da978cb72a88cbcb2ec29060200160405180910390a2610c626001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016823087611632565b600192505050610c726001600555565b919050565b600033610602818585610c8a83836113ca565b610c949190611e84565b6113f5565b60007f0000000000000000000000000000000000000000000000000000000000000000600754600854610ccc9190611e97565b61055d9190611eae565b6001600160a01b038181166000818152600a6020526040808220549051631ef1589960e01b81526004810193909352909290917f000000000000000000000000000000000000000000000000000000000000000090911690631ef1589990602401602060405180830381865afa158015610d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d789190611f16565b6106089190611e37565b6000600854670de0b6b3a76400006007547f0000000000000000000000000000000000000000000000000000000000000000610dbe9190611e84565b610ccc9190611e97565b6000610dd261151a565b8280600003610df457604051638817380160e01b815260040160405180910390fd5b60003390508460066000828254610e0b9190611e37565b90915550610e1b905081866118a8565b836001600160a01b0316816001600160a01b03167f817c65699baa17cda7ddee87fcdc7716aec3bf9d777f80487c2342295a30e05887604051610e6091815260200190565b60405180910390a36107676001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001685876119d7565b60606004805461057190611e4a565b60003381610eb982866113ca565b905083811015610f1e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b61079082868684036113f5565b600033610602818585611704565b600060075460065461055d9190611e84565b6000610f5561151a565b8580600003610f7757604051638817380160e01b815260040160405180910390fd5b8442811015610f9957604051630af1625160e31b815260040160405180910390fd5b6000612710610fa9601e8b611e97565b610fb39190611eae565b90506000818a6007547f0000000000000000000000000000000000000000000000000000000000000000610fe79190611e84565b610ff19190611e84565b610ffb9190611e37565b90506000816008546007547f00000000000000000000000000000000000000000000000000000000000000006110319190611e84565b61103b9190611e97565b6110459190611eae565b90506000816008546110579190611e37565b90508a81101561107a57604051633db0d7e560e01b815260040160405180910390fd5b6110a47f000000000000000000000000000000000000000000000000000000000000000084611e37565b60075560088290556040518c81526001600160a01b038a169033907f3590f0a355392f9c1de13cd72ea564d10019bb3605905ea543b424a360b9a88e9060200160405180910390a36001600160a01b038816156111b457600061271061110c610fa087611e97565b6111169190611eae565b905061114d6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338b84611632565b6111ae337f000000000000000000000000000000000000000000000000000000000000000061117c8489611e37565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016929190611632565b50611209565b6112096001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016337f000000000000000000000000000000000000000000000000000000000000000087611632565b61121a3330868f61117c9190611e37565b610b698982611573565b600061122e61151a565b818060000361125057604051638817380160e01b815260040160405180910390fd5b33600061125c82610cd6565b90508481101561127f57604051634d5f8e8160e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a6020526040812080548792906112a7908490611e84565b9250508190555084600960008282546112c09190611e84565b90915550600090506127106112d6601e88611e97565b6112e09190611eae565b9050826001600160a01b03167fd62b0b2d61fcfca895b56a92d1d2d3b6402f9b0fa3329c26d7594ed76edda0e88760405161131d91815260200190565b60405180910390a26113796001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836119d7565b6113b8836113878389611e37565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906119d7565b6001945050505050610c726001600555565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166114575760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610f15565b6001600160a01b0382166114b85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610f15565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60026005540361156c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f15565b6002600555565b6001600160a01b0382166115c95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610f15565b80600260008282546115db9190611e84565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b61168a846323b872dd60e01b85858560405160240161165393929190611ed0565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a07565b50505050565b600061169c84846113ca565b9050600019811461168a57818110156116f75760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610f15565b61168a84848484036113f5565b6001600160a01b0383166117685760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610f15565b6001600160a01b0382166117ca5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610f15565b6001600160a01b038316600090815260208190526040902054818110156118425760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610f15565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361168a565b6001600160a01b0382166119085760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610f15565b6001600160a01b0382166000908152602081905260409020548181101561197c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610f15565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161150d565b505050565b6040516001600160a01b0383166024820152604481018290526119d290849063a9059cbb60e01b90606401611653565b6000611a5c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611adc9092919063ffffffff16565b9050805160001480611a7d575080806020019051810190611a7d9190611ef4565b6119d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f15565b6060611aeb8484600085611af3565b949350505050565b606082471015611b545760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f15565b600080866001600160a01b03168587604051611b709190611f2f565b60006040518083038185875af1925050503d8060008114611bad576040519150601f19603f3d011682016040523d82523d6000602084013e611bb2565b606091505b5091509150611bc387838387611bce565b979650505050505050565b60608315611c3d578251600003611c36576001600160a01b0385163b611c365760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f15565b5081611aeb565b611aeb8383815115611c525781518083602001fd5b8060405162461bcd60e51b8152600401610f159190611c90565b60005b83811015611c87578181015183820152602001611c6f565b50506000910152565b6020815260008251806020840152611caf816040850160208701611c6c565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114610c7257600080fd5b60008060408385031215611ced57600080fd5b611cf683611cc3565b946020939093013593505050565b60008060408385031215611d1757600080fd5b82359150611d2760208401611cc3565b90509250929050565b600080600060608486031215611d4557600080fd5b611d4e84611cc3565b9250611d5c60208501611cc3565b9150604084013590509250925092565b600080600080600060a08688031215611d8457600080fd5b853594506020860135935060408601359250611da260608701611cc3565b9150611db060808701611cc3565b90509295509295909350565b600060208284031215611dce57600080fd5b611dd782611cc3565b9392505050565b600060208284031215611df057600080fd5b5035919050565b60008060408385031215611e0a57600080fd5b611e1383611cc3565b9150611d2760208401611cc3565b634e487b7160e01b600052601160045260246000fd5b8181038181111561060857610608611e21565b600181811c90821680611e5e57607f821691505b602082108103611e7e57634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561060857610608611e21565b808202811582820484141761060857610608611e21565b600082611ecb57634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215611f0657600080fd5b81518015158114611dd757600080fd5b600060208284031215611f2857600080fd5b5051919050565b60008251611f41818460208701611c6c565b919091019291505056fea2646970667358221220293e5dfbc47c9814b34440f9d8d414c6dacf81c234a5081fcdaadcf1b5563ddb64736f6c63430008130033000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000001441cba5a9df12f157c362ca0c8eed50c2b07d27000000000000000000000000d54b64a096b785d19cff3f19061509230736590c00000000000000000000000056df157dec576cc2596257fb17115a7ea0329e010000000000000000000000005ed50fbb15d047b2b6bc0e6fade25a3b1eee106d

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061023c5760003560e01c806370a082311161013b578063b26025aa116100b8578063dd62ed3e1161007c578063dd62ed3e146104cd578063e7e7e387146104e0578063ec342ad0146104e9578063f623bb8b14610510578063fb5484271461051957600080fd5b8063b26025aa14610451578063ba002b7014610459578063c2b96e9b1461046c578063c544df0c14610493578063c5ebeaec146104ba57600080fd5b8063a457c2d7116100ff578063a457c2d714610413578063a71f48a414610426578063a9059cbb14610435578063aaf5eb6814610426578063ad6cb8231461044857600080fd5b806370a08231146103875780637bde82f2146103b05780638b7b23ee146103c357806395d89b4114610402578063a07878561461040a57600080fd5b80632a33d6b2116101c9578063371fd8e61161018d578063371fd8e61461033e5780633950935114610351578063466f6311146103645780634c7ebd371461036c578063660e16c31461037f57600080fd5b80632a33d6b2146102e65780632e0f2625146102f45780632ecd4e7d1461030e578063313ce5671461032e5780633410fe6e1461033557600080fd5b806318160ddd1161021057806318160ddd1461029c5780631b6b7298146102a45780631b8f0bbc146102b757806323b872dd146102c057806326124288146102d357600080fd5b80626c72af1461024157806306fdde031461025c578063095ea7b3146102715780630b4501fd14610294575b600080fd5b610249610540565b6040519081526020015b60405180910390f35b610264610562565b6040516102539190611c90565b61028461027f366004611cda565b6105f4565b6040519015158152602001610253565b610249601e81565b600254610249565b6102846102b2366004611d04565b61060e565b61024960085481565b6102846102ce366004611d30565b610777565b6102846102e1366004611d6c565b61079b565b670de0b6b3a7640000610249565b6102fc601281565b60405160ff9091168152602001610253565b61024961031c366004611dbc565b600a6020526000908152604090205481565b60126102fc565b61024961271081565b61028461034c366004611dde565b610b86565b61028461035f366004611cda565b610c77565b610249610c99565b61024961037a366004611dbc565b610cd6565b610249610d82565b610249610395366004611dbc565b6001600160a01b031660009081526020819052604090205490565b6102846103be366004611d04565b610dc8565b6103ea7f0000000000000000000000008d05ef8093a746101cee1a0578edd277f3ecd6c181565b6040516001600160a01b039091168152602001610253565b610264610e9c565b61024960075481565b610284610421366004611cda565b610eab565b610249670de0b6b3a764000081565b610284610443366004611cda565b610f2b565b61024960065481565b610249610f39565b610284610467366004611d6c565b610f4b565b6102497f00000000000000000000000000000000000000000000003635c9adc5dea0000081565b6103ea7f000000000000000000000000be1053ec4ac137c9a5b4462d53d5c2c0b89a2b7981565b6102846104c8366004611dde565b611224565b6102496104db366004611df7565b6113ca565b61024960095481565b6103ea7f000000000000000000000000420000000000000000000000000000000000000681565b610249610fa081565b6103ea7f00000000000000000000000060c08737877a5262bdb1c1cac8fb90b5e5b1151581565b6000670de0b6b3a7640000610553610d82565b61055d9190611e37565b905090565b60606003805461057190611e4a565b80601f016020809104026020016040519081016040528092919081815260200182805461059d90611e4a565b80156105ea5780601f106105bf576101008083540402835291602001916105ea565b820191906000526020600020905b8154815290600101906020018083116105cd57829003601f168201915b5050505050905090565b6000336106028185856113f5565b60019150505b92915050565b600061061861151a565b828060000361063a57604051638817380160e01b815260040160405180910390fd5b600033905084600660008282546106519190611e84565b9091555061066190508486611573565b836001600160a01b0316816001600160a01b03167f199b105faa55cbba66c6c51adb78bf93238b4ad0cfadd14c986af220da77e7c8876040516106a691815260200190565b60405180910390a360405163079cc67960e41b81526001600160a01b038281166004830152602482018790527f000000000000000000000000be1053ec4ac137c9a5b4462d53d5c2c0b89a2b7916906379cc679090604401600060405180830381600087803b15801561071857600080fd5b505af115801561072c573d6000803e3d6000fd5b506107679250506001600160a01b037f0000000000000000000000004200000000000000000000000000000000000006169050823088611632565b6001925050506106086001600555565b600033610785858285611690565b610790858585611704565b506001949350505050565b60006107a561151a565b85806000036107c757604051638817380160e01b815260040160405180910390fd5b84428110156107e957604051630af1625160e31b815260040160405180910390fd5b6107f1610c99565b88111561081157604051639e0cbc9560e01b815260040160405180910390fd5b6000612710610821601e8b611e97565b61082b9190611eae565b90506000818a60085461083e9190611e84565b6108489190611e37565b90506000816008546007547f00000000000000000000000000000000000000000000003635c9adc5dea0000061087e9190611e84565b6108889190611e97565b6108929190611eae565b90506000816007547f00000000000000000000000000000000000000000000003635c9adc5dea000006108c59190611e84565b6108cf9190611e37565b90508a8110156108f257604051633db0d7e560e01b815260040160405180910390fd5b61091c7f00000000000000000000000000000000000000000000003635c9adc5dea0000083611e37565b60075560088390556040518c81526001600160a01b038a169033907fffc36e4a73526964b1bc25e2a44a90e979636de95ea6e59e01b6b83f2e20ae1e9060200160405180910390a36001600160a01b03881615610a96576000612710610984610fa087611e97565b61098e9190611eae565b6040516323b872dd60e01b815290915030906323b872dd906109b89033908d908690600401611ed0565b6020604051808303816000875af11580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fb9190611ef4565b50306323b872dd337f0000000000000000000000008d05ef8093a746101cee1a0578edd277f3ecd6c1610a2e858a611e37565b6040518463ffffffff1660e01b8152600401610a4c93929190611ed0565b6020604051808303816000875af1158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190611ef4565b5050610b22565b6040516323b872dd60e01b815230906323b872dd90610add9033907f0000000000000000000000008d05ef8093a746101cee1a0578edd277f3ecd6c1908990600401611ed0565b6020604051808303816000875af1158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b209190611ef4565b505b610b3533610b30868f611e37565b6118a8565b610b696001600160a01b037f0000000000000000000000004200000000000000000000000000000000000006168a836119d7565b60019650505050505050610b7d6001600555565b95945050505050565b6000610b9061151a565b8180600003610bb257604051638817380160e01b815260040160405180910390fd5b336000818152600a602052604081208054869290610bd1908490611e37565b925050819055508360096000828254610bea9190611e37565b90915550506040518481526001600160a01b038216907fb80483f4e501626c916db3d4b858524c6231939940f6da978cb72a88cbcb2ec29060200160405180910390a2610c626001600160a01b037f000000000000000000000000420000000000000000000000000000000000000616823087611632565b600192505050610c726001600555565b919050565b600033610602818585610c8a83836113ca565b610c949190611e84565b6113f5565b60007f00000000000000000000000000000000000000000000003635c9adc5dea00000600754600854610ccc9190611e97565b61055d9190611eae565b6001600160a01b038181166000818152600a6020526040808220549051631ef1589960e01b81526004810193909352909290917f00000000000000000000000060c08737877a5262bdb1c1cac8fb90b5e5b1151590911690631ef1589990602401602060405180830381865afa158015610d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d789190611f16565b6106089190611e37565b6000600854670de0b6b3a76400006007547f00000000000000000000000000000000000000000000003635c9adc5dea00000610dbe9190611e84565b610ccc9190611e97565b6000610dd261151a565b8280600003610df457604051638817380160e01b815260040160405180910390fd5b60003390508460066000828254610e0b9190611e37565b90915550610e1b905081866118a8565b836001600160a01b0316816001600160a01b03167f817c65699baa17cda7ddee87fcdc7716aec3bf9d777f80487c2342295a30e05887604051610e6091815260200190565b60405180910390a36107676001600160a01b037f00000000000000000000000042000000000000000000000000000000000000061685876119d7565b60606004805461057190611e4a565b60003381610eb982866113ca565b905083811015610f1e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b61079082868684036113f5565b600033610602818585611704565b600060075460065461055d9190611e84565b6000610f5561151a565b8580600003610f7757604051638817380160e01b815260040160405180910390fd5b8442811015610f9957604051630af1625160e31b815260040160405180910390fd5b6000612710610fa9601e8b611e97565b610fb39190611eae565b90506000818a6007547f00000000000000000000000000000000000000000000003635c9adc5dea00000610fe79190611e84565b610ff19190611e84565b610ffb9190611e37565b90506000816008546007547f00000000000000000000000000000000000000000000003635c9adc5dea000006110319190611e84565b61103b9190611e97565b6110459190611eae565b90506000816008546110579190611e37565b90508a81101561107a57604051633db0d7e560e01b815260040160405180910390fd5b6110a47f00000000000000000000000000000000000000000000003635c9adc5dea0000084611e37565b60075560088290556040518c81526001600160a01b038a169033907f3590f0a355392f9c1de13cd72ea564d10019bb3605905ea543b424a360b9a88e9060200160405180910390a36001600160a01b038816156111b457600061271061110c610fa087611e97565b6111169190611eae565b905061114d6001600160a01b037f000000000000000000000000420000000000000000000000000000000000000616338b84611632565b6111ae337f0000000000000000000000008d05ef8093a746101cee1a0578edd277f3ecd6c161117c8489611e37565b6001600160a01b037f000000000000000000000000420000000000000000000000000000000000000616929190611632565b50611209565b6112096001600160a01b037f000000000000000000000000420000000000000000000000000000000000000616337f0000000000000000000000008d05ef8093a746101cee1a0578edd277f3ecd6c187611632565b61121a3330868f61117c9190611e37565b610b698982611573565b600061122e61151a565b818060000361125057604051638817380160e01b815260040160405180910390fd5b33600061125c82610cd6565b90508481101561127f57604051634d5f8e8160e11b815260040160405180910390fd5b6001600160a01b0382166000908152600a6020526040812080548792906112a7908490611e84565b9250508190555084600960008282546112c09190611e84565b90915550600090506127106112d6601e88611e97565b6112e09190611eae565b9050826001600160a01b03167fd62b0b2d61fcfca895b56a92d1d2d3b6402f9b0fa3329c26d7594ed76edda0e88760405161131d91815260200190565b60405180910390a26113796001600160a01b037f0000000000000000000000004200000000000000000000000000000000000006167f0000000000000000000000008d05ef8093a746101cee1a0578edd277f3ecd6c1836119d7565b6113b8836113878389611e37565b6001600160a01b037f00000000000000000000000042000000000000000000000000000000000000061691906119d7565b6001945050505050610c726001600555565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166114575760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610f15565b6001600160a01b0382166114b85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610f15565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60026005540361156c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f15565b6002600555565b6001600160a01b0382166115c95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610f15565b80600260008282546115db9190611e84565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b61168a846323b872dd60e01b85858560405160240161165393929190611ed0565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a07565b50505050565b600061169c84846113ca565b9050600019811461168a57818110156116f75760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610f15565b61168a84848484036113f5565b6001600160a01b0383166117685760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610f15565b6001600160a01b0382166117ca5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610f15565b6001600160a01b038316600090815260208190526040902054818110156118425760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610f15565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361168a565b6001600160a01b0382166119085760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610f15565b6001600160a01b0382166000908152602081905260409020548181101561197c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610f15565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161150d565b505050565b6040516001600160a01b0383166024820152604481018290526119d290849063a9059cbb60e01b90606401611653565b6000611a5c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611adc9092919063ffffffff16565b9050805160001480611a7d575080806020019051810190611a7d9190611ef4565b6119d25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f15565b6060611aeb8484600085611af3565b949350505050565b606082471015611b545760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f15565b600080866001600160a01b03168587604051611b709190611f2f565b60006040518083038185875af1925050503d8060008114611bad576040519150601f19603f3d011682016040523d82523d6000602084013e611bb2565b606091505b5091509150611bc387838387611bce565b979650505050505050565b60608315611c3d578251600003611c36576001600160a01b0385163b611c365760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f15565b5081611aeb565b611aeb8383815115611c525781518083602001fd5b8060405162461bcd60e51b8152600401610f159190611c90565b60005b83811015611c87578181015183820152602001611c6f565b50506000910152565b6020815260008251806020840152611caf816040850160208701611c6c565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114610c7257600080fd5b60008060408385031215611ced57600080fd5b611cf683611cc3565b946020939093013593505050565b60008060408385031215611d1757600080fd5b82359150611d2760208401611cc3565b90509250929050565b600080600060608486031215611d4557600080fd5b611d4e84611cc3565b9250611d5c60208501611cc3565b9150604084013590509250925092565b600080600080600060a08688031215611d8457600080fd5b853594506020860135935060408601359250611da260608701611cc3565b9150611db060808701611cc3565b90509295509295909350565b600060208284031215611dce57600080fd5b611dd782611cc3565b9392505050565b600060208284031215611df057600080fd5b5035919050565b60008060408385031215611e0a57600080fd5b611e1383611cc3565b9150611d2760208401611cc3565b634e487b7160e01b600052601160045260246000fd5b8181038181111561060857610608611e21565b600181811c90821680611e5e57607f821691505b602082108103611e7e57634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561060857610608611e21565b808202811582820484141761060857610608611e21565b600082611ecb57634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215611f0657600080fd5b81518015158114611dd757600080fd5b600060208284031215611f2857600080fd5b5051919050565b60008251611f41818460208701611c6c565b919091019291505056fea2646970667358221220293e5dfbc47c9814b34440f9d8d414c6dacf81c234a5081fcdaadcf1b5563ddb64736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000420000000000000000000000000000000000000600000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000001441cba5a9df12f157c362ca0c8eed50c2b07d27000000000000000000000000d54b64a096b785d19cff3f19061509230736590c00000000000000000000000056df157dec576cc2596257fb17115a7ea0329e010000000000000000000000005ed50fbb15d047b2b6bc0e6fade25a3b1eee106d

-----Decoded View---------------
Arg [0] : _BASE (address): 0x4200000000000000000000000000000000000006
Arg [1] : _supplyTOKEN (uint256): 1000000000000000000000
Arg [2] : _OTOKENFactory (address): 0x1441cBA5A9Df12F157c362cA0C8EeD50C2b07d27
Arg [3] : _VTOKENFactory (address): 0xd54B64A096b785d19CFf3f19061509230736590c
Arg [4] : _VTOKENRewarderFactory (address): 0x56DF157dec576Cc2596257FB17115a7ea0329e01
Arg [5] : _TOKENFeesFactory (address): 0x5Ed50fbB15d047B2b6BC0E6FAdE25A3B1eee106d

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [1] : 00000000000000000000000000000000000000000000003635c9adc5dea00000
Arg [2] : 0000000000000000000000001441cba5a9df12f157c362ca0c8eed50c2b07d27
Arg [3] : 000000000000000000000000d54b64a096b785d19cff3f19061509230736590c
Arg [4] : 00000000000000000000000056df157dec576cc2596257fb17115a7ea0329e01
Arg [5] : 0000000000000000000000005ed50fbb15d047b2b6bc0e6fade25a3b1eee106d


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.