ETH Price: $3,397.89 (-1.78%)
Gas: 6 Gwei

Contract

0xb268E2C85861B74ec75fe728Ae40D9A2308AD9Bb
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Approve198698132024-05-14 17:48:2365 days ago1715708903IN
0xb268E2C8...2308AD9Bb
0 ETH0.000717115.47721928
Approve188550042023-12-24 10:22:47207 days ago1703413367IN
0xb268E2C8...2308AD9Bb
0 ETH0.0010238522.09777959
Approve188549882023-12-24 10:19:35207 days ago1703413175IN
0xb268E2C8...2308AD9Bb
0 ETH0.000949220.48123518
Approve188526952023-12-24 2:34:35208 days ago1703385275IN
0xb268E2C8...2308AD9Bb
0 ETH0.0007923517.11023102
Approve186847132023-11-30 13:27:23231 days ago1701350843IN
0xb268E2C8...2308AD9Bb
0 ETH0.0016823736.30109499
Approve184501722023-10-28 17:25:35264 days ago1698513935IN
0xb268E2C8...2308AD9Bb
0 ETH0.0011318424.42209462
Approve183812232023-10-19 1:51:35274 days ago1697680295IN
0xb268E2C8...2308AD9Bb
0 ETH0.000262099.91552526
Approve183812222023-10-19 1:51:23274 days ago1697680283IN
0xb268E2C8...2308AD9Bb
0 ETH0.000455149.82326927
Approve183401962023-10-13 8:11:35280 days ago1697184695IN
0xb268E2C8...2308AD9Bb
0 ETH0.000235425.08113243
Approve176094482023-07-02 22:58:59382 days ago1688338739IN
0xb268E2C8...2308AD9Bb
0 ETH0.0005505611.87980193
Approve175982062023-07-01 9:04:47384 days ago1688202287IN
0xb268E2C8...2308AD9Bb
0 ETH0.0006757214.58039731
Approve175982062023-07-01 9:04:47384 days ago1688202287IN
0xb268E2C8...2308AD9Bb
0 ETH0.0006757214.58039731
Approve175978742023-07-01 7:58:11384 days ago1688198291IN
0xb268E2C8...2308AD9Bb
0 ETH0.0006627314.3
Approve175965852023-07-01 3:36:47384 days ago1688182607IN
0xb268E2C8...2308AD9Bb
0 ETH0.000776216.74845443
Approve175880622023-06-29 22:54:47385 days ago1688079287IN
0xb268E2C8...2308AD9Bb
0 ETH0.001500932.37703122
Approve175797042023-06-28 18:48:59386 days ago1687978139IN
0xb268E2C8...2308AD9Bb
0 ETH0.0007086115.29006251
Approve175754602023-06-28 4:32:23387 days ago1687926743IN
0xb268E2C8...2308AD9Bb
0 ETH0.000580812.52890686
Approve175737152023-06-27 22:40:35387 days ago1687905635IN
0xb268E2C8...2308AD9Bb
0 ETH0.0005861712.64805342
Approve175723282023-06-27 18:00:23387 days ago1687888823IN
0xb268E2C8...2308AD9Bb
0 ETH0.0007716216.64957289
Grant Role162214542022-12-19 21:33:35577 days ago1671485615IN
0xb268E2C8...2308AD9Bb
0 ETH0.0007680915
0x61012060162214522022-12-19 21:33:11577 days ago1671485591IN
 Create: Strategy
0 ETH0.0556893615

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Strategy

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 29 : Strategy.sol
// SPDX-License-Identifier: BUSL-1.1
// Audit of commit 9e6a33d at https://hackmd.io/7YB8QorOSs-nAAaz_f8EbQ

pragma solidity >=0.8.13;

import { IStrategy } from "./interfaces/IStrategy.sol";
import { StrategyMigrator } from "./StrategyMigrator.sol";
import { AccessControl } from "@yield-protocol/utils-v2/contracts/access/AccessControl.sol";
import { SafeERC20Namer } from "@yield-protocol/utils-v2/contracts/token/SafeERC20Namer.sol";
import { MinimalTransferHelper } from "@yield-protocol/utils-v2/contracts/token/MinimalTransferHelper.sol";
import { IERC20 } from "@yield-protocol/utils-v2/contracts/token/IERC20.sol";
import { ERC20Rewards } from "@yield-protocol/utils-v2/contracts/token/ERC20Rewards.sol";
import { IFYToken } from "@yield-protocol/vault-v2/contracts/interfaces/IFYToken.sol";
import { IPool } from "@yield-protocol/yieldspace-tv/src/interfaces/IPool.sol";

/// @dev The Strategy contract allows liquidity providers to provide liquidity in yieldspace
/// pool tokens and receive strategy tokens that represent a stake in a YieldSpace pool contract.
/// Upon maturity, the strategy can `divest` from the mature pool, becoming a proportional
/// ownership underlying vault. When not invested, the strategy can `invest` into a Pool using
/// all its underlying.
/// The strategy can also `eject` from a Pool before maturity. Any fyToken obtained will be available
/// to be bought by anyone at face value. If the pool tokens can't be burned, they will be ejected
/// and the strategy can be recapitalized.
contract Strategy is AccessControl, ERC20Rewards, StrategyMigrator { // TODO: I'd like to import IStrategy
    enum State {DEPLOYED, DIVESTED, INVESTED, EJECTED, DRAINED}
    using MinimalTransferHelper for IERC20;
    using MinimalTransferHelper for IFYToken;
    using MinimalTransferHelper for IPool;

    event Invested(address indexed pool, uint256 baseInvested, uint256 lpTokensObtained);
    event Divested(address indexed pool, uint256 lpTokenDivested, uint256 baseObtained);
    event Ejected(address indexed pool, uint256 lpTokenDivested, uint256 baseObtained, uint256 fyTokenObtained);
    event Drained(address indexed pool, uint256 lpTokenDivested);
    event SoldFYToken(uint256 soldFYToken, uint256 returnedBase);

    State public state;                          // The state determines which functions are available

    // IERC20 public immutable base;             // Base token for this strategy (inherited from StrategyMigrator)
    // IFYToken public override fyToken;         // Current fyToken for this strategy (inherited from StrategyMigrator)
    IPool public pool;                           // Current pool that this strategy invests in

    uint256 public baseCached;                   // Base tokens held by the strategy
    uint256 public poolCached;                   // Pool tokens held by the strategy
    uint256 public fyTokenCached;                // In emergencies, the strategy can keep fyToken

    constructor(string memory name_, string memory symbol_, IFYToken fyToken_)
        ERC20Rewards(name_, symbol_, SafeERC20Namer.tokenDecimals(address(fyToken_)))
        StrategyMigrator(
            IERC20(fyToken_.underlying()),
            fyToken_)
    {
        // Deploy with a seriesId_ matching the migrating strategy if using the migration feature
        // Deploy with any series matching the desired base in any other case
        fyToken = fyToken_;

        base = IERC20(fyToken_.underlying());

        _grantRole(Strategy.init.selector, address(this)); // Enable the `mint` -> `init` hook.
    }

    modifier isState(State target) {
        require (
            target == state,
            "Not allowed in this state"
        );
        _;
    }

    /// @dev State and state variable management
    /// @param target State to transition to
    /// @param pool_ If transitioning to invested, update pool state variable with this parameter
    function _transition(State target, IPool pool_) internal {
        if (target == State.INVESTED) {
            pool = pool_;
            fyToken = IFYToken(address(pool_.fyToken()));
            maturity = pool_.maturity();
        } else if (target == State.DIVESTED) {
            delete fyToken;
            delete maturity;
            delete pool;
        } else if (target == State.EJECTED) {
            delete maturity;
            delete pool;
        } else if (target == State.DRAINED) {
            delete maturity;
            delete pool;
        }
        state = target;
    }

    /// @dev State and state variable management
    /// @param target State to transition to
    function _transition(State target) internal {
        require (target != State.INVESTED, "Must provide a pool");
        _transition(target, IPool(address(0)));
    }

    // ----------------------- INVEST & DIVEST --------------------------- //

    /// @notice Mock pool mint called by a strategy when trying to migrate.
    /// @dev Will initialize the strategy and return strategy tokens.
    /// It is expected that base has been transferred in, but no fyTokens
    /// @return baseIn Amount of base tokens found in contract
    /// @return fyTokenIn This is always returned as 0 since they aren't used
    /// @return minted Amount of strategy tokens minted from base tokens which is the same as baseIn
    function mint(address, address, uint256, uint256)
        external
        override
        auth
        returns (uint256 baseIn, uint256 fyTokenIn, uint256 minted)
    {
        fyTokenIn = 0; // Silence compiler warning
        baseIn = minted = _init(msg.sender);
    }

    /// @dev Mint the first strategy tokens, without investing
    /// @param to Recipient for the strategy tokens
    /// @return minted Amount of strategy tokens minted from base tokens
    function init(address to)
        external
        auth
        returns (uint256 minted)
    {
        minted = _init(to);
    }

    /// @dev Mint the first strategy tokens, without investing
    /// @param to Recipient for the strategy tokens
    /// @return minted Amount of strategy tokens minted from base tokens
    function _init(address to)
        internal
        isState(State.DEPLOYED)
        returns (uint256 minted)
    {
        // Clear fyToken in case we initialized through `mint`
        delete fyToken;

        baseCached = minted = base.balanceOf(address(this));
        require (minted > 0, "Not enough base in");
        // Make sure that at the end of the transaction the strategy has enough tokens as to not expose itself to a rounding-down liquidity attack.
        _mint(to, minted);

        _transition(State.DIVESTED);
    }

    /// @dev Start the strategy investments in the next pool
    /// @param pool_ Pool to invest into
    /// @return poolTokensObtained Amount of pool tokens minted from base tokens
    /// @notice When calling this function for the first pool, some underlying needs to be transferred to the strategy first, using a batchable router.
    function invest(IPool pool_)
        external
        auth
        isState(State.DIVESTED)
        returns (uint256 poolTokensObtained)
    {
        // Caching
        IFYToken fyToken_ = IFYToken(address(pool_.fyToken()));
        uint256 baseCached_ = baseCached; // We could read the real balance, but this is a bit safer

        require(base == pool_.base(), "Mismatched base");

        // Mint LP tokens and initialize the pool
        delete baseCached;
        base.safeTransfer(address(pool_), baseCached_);
        (,, poolTokensObtained) = pool_.init(address(this));
        poolCached = poolTokensObtained;

        // Update state variables
        fyToken = fyToken_;
        maturity = pool_.maturity();
        pool = pool_;

        _transition(State.INVESTED, pool_);
        emit Invested(address(pool_), baseCached_, poolTokensObtained);
    }

    /// @dev Divest out of a pool once it has matured
    /// @return baseObtained Amount of base tokens obtained from burning pool tokens   
    function divest()
        external
        isState(State.INVESTED)
        returns (uint256 baseObtained)
    {
        // Caching
        IPool pool_ = pool;
        IFYToken fyToken_ = fyToken;
        require (uint32(block.timestamp) >= maturity, "Only after maturity");

        uint256 toDivest = pool_.balanceOf(address(this));

        // Burn lpTokens
        delete poolCached;
        pool_.safeTransfer(address(pool_), toDivest);
        (, uint256 baseFromBurn, uint256 fyTokenFromBurn) = pool_.burn(address(this), address(this), 0, type(uint256).max); // We don't care about slippage, because the strategy holds to maturity

        // Redeem any fyToken
        uint256 baseFromRedeem = fyToken_.redeem(address(this), fyTokenFromBurn);

        // Reset the base cache
        baseCached = base.balanceOf(address(this));

        // Transition to Divested
        _transition(State.DIVESTED, pool_);
        emit Divested(address(pool_), toDivest, baseObtained = baseFromBurn + baseFromRedeem);
    }

    // ----------------------- EJECT --------------------------- //

    /// @dev Divest out of a pool at any time. If possible the pool tokens will be burnt for base and fyToken, the latter of which
    /// must be sold to return the strategy to a functional state. If the pool token burn reverts, the pool tokens will be transferred
    /// to the caller as a last resort.
    /// @return baseReceived Amount of base tokens received from pool tokens
    /// @return fyTokenReceived Amount of fyToken received from pool tokens
    /// @notice The caller must take care of slippage when selling fyToken, if relevant.
    function eject()
        external
        auth
        isState(State.INVESTED)
        returns (uint256 baseReceived, uint256 fyTokenReceived)
    {
        // Caching
        IPool pool_ = pool;
        uint256 toDivest = pool_.balanceOf(address(this));

        // Burn lpTokens, if not possible, eject the pool tokens out. Slippage should be managed by the caller.
        delete poolCached;
        try this.burnPoolTokens(pool_, toDivest) returns (uint256 baseReceived_, uint256 fyTokenReceived_) {
            baseCached = baseReceived = baseReceived_;
            fyTokenCached = fyTokenReceived = fyTokenReceived_;
            if (fyTokenReceived > 0) {
                _transition(State.EJECTED, pool_);
                emit Ejected(address(pool_), toDivest, baseReceived, fyTokenReceived);
            } else {
                _transition(State.DIVESTED, pool_);
                emit Divested(address(pool_), toDivest, baseReceived);
            }

        } catch {
            pool_.safeTransfer(msg.sender, toDivest);
            _transition(State.DRAINED, pool_);
            emit Drained(address(pool_), toDivest);
        }
    }

    /// @dev Burn an amount of pool tokens.
    /// @notice Only the Strategy itself can call this function. It is external and exists so that the transfer is reverted if the burn also reverts.
    /// @param pool_ Pool for the pool tokens.
    /// @param poolTokens Amount of tokens to burn.
    /// @return baseReceived Amount of base tokens received from pool tokens
    /// @return fyTokenReceived Amount of fyToken received from pool tokens
    function burnPoolTokens(IPool pool_, uint256 poolTokens)
        external
        returns (uint256 baseReceived, uint256 fyTokenReceived)
    {
        require (msg.sender ==  address(this), "Unauthorized");

        // Burn lpTokens
        pool_.safeTransfer(address(pool_), poolTokens);
        uint256 baseBalance = base.balanceOf(address(this));
        uint256 fyTokenBalance = fyToken.balanceOf(address(this));
        (, baseReceived, fyTokenReceived) = pool_.burn(address(this), address(this), 0, type(uint256).max);
        require(base.balanceOf(address(this)) - baseBalance == baseReceived, "Burn failed - base");
        require(fyToken.balanceOf(address(this)) - fyTokenBalance == fyTokenReceived, "Burn failed - fyToken");
    }

    /// @dev Buy ejected fyToken in the strategy at face value
    /// @param fyTokenTo Address to send the purchased fyToken to.
    /// @param baseTo Address to send any remaining base to.
    /// @return soldFYToken Amount of fyToken sold.
    /// @return returnedBase Amount of base unused and returned.
    function buyFYToken(address fyTokenTo, address baseTo)
        external
        isState(State.EJECTED)
        returns (uint256 soldFYToken, uint256 returnedBase)
    {
        // Caching
        IFYToken fyToken_ = fyToken;
        uint256 baseCached_ = baseCached;
        uint256 fyTokenCached_ = fyTokenCached;

        uint256 baseIn = base.balanceOf(address(this)) - baseCached_;
        (soldFYToken, returnedBase) = baseIn > fyTokenCached_ ? (fyTokenCached_, baseIn - fyTokenCached_) : (baseIn, 0);

        // Update base and fyToken cache
        baseCached = baseCached_ + soldFYToken; // soldFYToken is base not returned
        fyTokenCached = fyTokenCached_ -= soldFYToken;

        // Transition to divested if done
        if (fyTokenCached_ == 0) {
            // Transition to Divested
            _transition(State.DIVESTED);
            emit Divested(address(0), 0, 0);
        }

        // Transfer fyToken and base (if surplus)
        fyToken_.safeTransfer(fyTokenTo, soldFYToken);
        if (soldFYToken < baseIn) {
            base.safeTransfer(baseTo, baseIn - soldFYToken);
        }

        emit SoldFYToken(soldFYToken, returnedBase);
    }

    /// @dev If we drained the strategy, we can recapitalize it with base to avoid a forced migration
    /// @return baseIn Amount of base tokens used to restart
    function restart()
        external
        auth
        isState(State.DRAINED)
        returns (uint256 baseIn)
    {
        require((baseCached = baseIn = base.balanceOf(address(this))) > 0, "No base to restart");
        _transition(State.DIVESTED);
        emit Divested(address(0), 0, 0);
    }

    // ----------------------- MINT & BURN --------------------------- //

    /// @dev Mint strategy tokens with pool tokens. It can be called only when invested.
    /// @param to Recipient for the strategy tokens
    /// @return minted Amount of strategy tokens minted
    /// @notice The pool tokens that the user contributes need to have been transferred previously, using a batchable router.
    function mint(address to)
        external
        isState(State.INVESTED)
        returns (uint256 minted)
    {
        // Caching
        IPool pool_ = pool;
        uint256 poolCached_ = poolCached;

        // minted = supply * value(deposit) / value(strategy)

        // Find how much was deposited
        uint256 deposit = pool_.balanceOf(address(this)) - poolCached_;

        // Update the pool cache
        poolCached = poolCached_ + deposit;

        // Mint strategy tokens
        minted = _totalSupply * deposit / poolCached_;
        _mint(to, minted);
    }

    /// @dev Burn strategy tokens to withdraw pool tokens. It can be called only when invested.
    /// @param to Recipient for the pool tokens
    /// @return poolTokensObtained Amount of pool tokens obtained
    /// @notice The strategy tokens that the user burns need to have been transferred previously, using a batchable router.
    function burn(address to)
        external
        isState(State.INVESTED)
        returns (uint256 poolTokensObtained)
    {
        // Caching
        IPool pool_ = pool;
        uint256 poolCached_ = poolCached;
        uint256 totalSupply_ = _totalSupply;

        // Burn strategy tokens
        uint256 burnt = _balanceOf[address(this)];
        _burn(address(this), burnt);

        poolTokensObtained = pool.balanceOf(address(this)) * burnt / totalSupply_;
        pool_.safeTransfer(address(to), poolTokensObtained);

        // Update pool cache
        poolCached = poolCached_ - poolTokensObtained;
    }

    /// @dev Mint strategy tokens with base tokens. It can be called only when not invested and not ejected.
    /// @param to Recipient for the strategy tokens
    /// @return minted Amount of strategy tokens minted
    /// @notice The base tokens that the user invests need to have been transferred previously, using a batchable router.
    function mintDivested(address to)
        external
        isState(State.DIVESTED)
        returns (uint256 minted)
    {
        // minted = supply * value(deposit) / value(strategy)
        uint256 baseCached_ = baseCached;
        uint256 deposit = base.balanceOf(address(this)) - baseCached_;
        baseCached = baseCached_ + deposit;

        minted = _totalSupply * deposit / baseCached_;

        _mint(to, minted);
    }

    /// @dev Burn strategy tokens to withdraw base tokens. It can be called when not invested and not ejected.
    /// @param to Recipient for the base tokens
    /// @return baseObtained Amount of base tokens obtained
    /// @notice The strategy tokens that the user burns need to have been transferred previously, using a batchable router.
    function burnDivested(address to)
        external
        isState(State.DIVESTED)
        returns (uint256 baseObtained)
    {
        // strategy * burnt/supply = withdrawal
        uint256 baseCached_ = baseCached;
        uint256 burnt = _balanceOf[address(this)];
        baseObtained = baseCached_ * burnt / _totalSupply;
        baseCached = baseCached_ - baseObtained;

        _burn(address(this), burnt);
        base.safeTransfer(to, baseObtained);
    }
}

File 2 of 29 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes4` identifier. These are expected to be the 
 * signatures for all the functions in the contract. Special roles should be exposed
 * in the external API and be unique:
 *
 * ```
 * bytes4 public constant ROOT = 0x00000000;
 * ```
 *
 * Roles represent restricted access to a function call. For that purpose, use {auth}:
 *
 * ```
 * function foo() public auth {
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `ROOT`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {setRoleAdmin}.
 *
 * WARNING: The `ROOT` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
contract AccessControl {
    struct RoleData {
        mapping (address => bool) members;
        bytes4 adminRole;
    }

    mapping (bytes4 => RoleData) private _roles;

    bytes4 public constant ROOT = 0x00000000;
    bytes4 public constant ROOT4146650865 = 0x00000000; // Collision protection for ROOT, test with ROOT12007226833()
    bytes4 public constant LOCK = 0xFFFFFFFF;           // Used to disable further permissioning of a function
    bytes4 public constant LOCK8605463013 = 0xFFFFFFFF; // Collision protection for LOCK, test with LOCK10462387368()

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role
     *
     * `ROOT` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes4 indexed role, bytes4 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call.
     */
    event RoleGranted(bytes4 indexed role, address indexed account, address indexed sender);

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

    /**
     * @dev Give msg.sender the ROOT role and create a LOCK role with itself as the admin role and no members. 
     * Calling setRoleAdmin(msg.sig, LOCK) means no one can grant that msg.sig role anymore.
     */
    constructor () {
        _grantRole(ROOT, msg.sender);   // Grant ROOT to msg.sender
        _setRoleAdmin(LOCK, LOCK);      // Create the LOCK role by setting itself as its own admin, creating an independent role tree
    }

    /**
     * @dev Each function in the contract has its own role, identified by their msg.sig signature.
     * ROOT can give and remove access to each function, lock any further access being granted to
     * a specific action, or even create other roles to delegate admin control over a function.
     */
    modifier auth() {
        require (_hasRole(msg.sig, msg.sender), "Access denied");
        _;
    }

    /**
     * @dev Allow only if the caller has been granted the admin role of `role`.
     */
    modifier admin(bytes4 role) {
        require (_hasRole(_getRoleAdmin(role), msg.sender), "Only admin");
        _;
    }

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

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

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.

     * If ``role``'s admin role is not `adminRole` emits a {RoleAdminChanged} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function setRoleAdmin(bytes4 role, bytes4 adminRole) external virtual admin(role) {
        _setRoleAdmin(role, adminRole);
    }

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

    
    /**
     * @dev Grants all of `role` in `roles` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - For each `role` in `roles`, the caller must have ``role``'s admin role.
     */
    function grantRoles(bytes4[] memory roles, address account) external virtual {
        for (uint256 i = 0; i < roles.length; i++) {
            require (_hasRole(_getRoleAdmin(roles[i]), msg.sender), "Only admin");
            _grantRole(roles[i], account);
        }
    }

    /**
     * @dev Sets LOCK as ``role``'s admin role. LOCK has no members, so this disables admin management of ``role``.

     * Emits a {RoleAdminChanged} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function lockRole(bytes4 role) external virtual admin(role) {
        _setRoleAdmin(role, LOCK);
    }

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

    /**
     * @dev Revokes all of `role` in `roles` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - For each `role` in `roles`, the caller must have ``role``'s admin role.
     */
    function revokeRoles(bytes4[] memory roles, address account) external virtual {
        for (uint256 i = 0; i < roles.length; i++) {
            require (_hasRole(_getRoleAdmin(roles[i]), msg.sender), "Only admin");
            _revokeRole(roles[i], account);
        }
    }

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

        _revokeRole(role, account);
    }

    function _hasRole(bytes4 role, address account) internal view returns (bool) {
        return _roles[role].members[account];
    }

    function _getRoleAdmin(bytes4 role) internal view returns (bytes4) {
        return _roles[role].adminRole;
    }

    function _setRoleAdmin(bytes4 role, bytes4 adminRole) internal virtual {
        if (_getRoleAdmin(role) != adminRole) {
            _roles[role].adminRole = adminRole;
            emit RoleAdminChanged(role, adminRole);
        }
    }

    function _grantRole(bytes4 role, address account) internal {
        if (!_hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, msg.sender);
        }
    }

    function _revokeRole(bytes4 role, address account) internal {
        if (_hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, msg.sender);
        }
    }
}

File 3 of 29 : IFYToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC5095.sol";
import "./IJoin.sol";
import "./IOracle.sol";

interface IFYToken is IERC5095 {

    /// @dev Oracle for the savings rate.
    function oracle() view external returns (IOracle);

    /// @dev Source of redemption funds.
    function join() view external returns (IJoin); 

    /// @dev Asset to be paid out on redemption.
    function underlying() view external returns (address);

    /// @dev Yield id of the asset to be paid out on redemption.
    function underlyingId() view external returns (bytes6);

    /// @dev Time at which redemptions are enabled.
    function maturity() view external returns (uint256);

    /// @dev Spot price (exchange rate) between the base and an interest accruing token at maturity, set to 2^256-1 before maturity
    function chiAtMaturity() view external returns (uint256);
    
    /// @dev Record price data at maturity
    function mature() external;

    /// @dev Mint fyToken providing an equal amount of underlying to the protocol
    function mintWithUnderlying(address to, uint256 amount) external;

    /// @dev Burn fyToken after maturity for an amount of underlying.
    function redeem(address to, uint256 amount) external returns (uint256);

    /// @dev Mint fyToken.
    /// This function can only be called by other Yield contracts, not users directly.
    /// @param to Wallet to mint the fyToken in.
    /// @param fyTokenAmount Amount of fyToken to mint.
    function mint(address to, uint256 fyTokenAmount) external;

    /// @dev Burn fyToken.
    /// This function can only be called by other Yield contracts, not users directly.
    /// @param from Wallet to burn the fyToken from.
    /// @param fyTokenAmount Amount of fyToken to burn.
    function burn(address from, uint256 fyTokenAmount) external;
}

File 4 of 29 : SafeERC20Namer.sol
// SPDX-License-Identifier: MIT
// Last audit: https://github.com/yieldprotocol/yield-utils-v2/commit/0d0b08b6b67cef6dfa69e6e6539bee542f49e25b
// Report: https://code4rena.com/reports/2021-05-yield

pragma solidity >=0.5.0;

import "../token/IERC20Metadata.sol";
import "../utils/AddressStringUtil.sol";

// produces token descriptors from inconsistent or absent ERC20 symbol implementations that can return string or bytes32
// this library will always produce a string symbol to represent the token
library SafeERC20Namer {
    function bytes32ToString(bytes32 x) private pure returns (string memory) {
        bytes memory bytesString = new bytes(32);
        uint256 charCount = 0;
        for (uint256 j = 0; j < 32; j++) {
            bytes1 char = x[j];
            if (char != 0) {
                bytesString[charCount] = char;
                charCount++;
            }
        }
        bytes memory bytesStringTrimmed = new bytes(charCount);
        for (uint256 j = 0; j < charCount; j++) {
            bytesStringTrimmed[j] = bytesString[j];
        }
        return string(bytesStringTrimmed);
    }

    // assumes the data is in position 2
    function parseStringData(bytes memory b) private pure returns (string memory) {
        uint256 charCount = 0;
        // first parse the charCount out of the data
        for (uint256 i = 32; i < 64; i++) {
            charCount <<= 8;
            charCount += uint8(b[i]);
        }

        bytes memory bytesStringTrimmed = new bytes(charCount);
        for (uint256 i = 0; i < charCount; i++) {
            bytesStringTrimmed[i] = b[i + 64];
        }

        return string(bytesStringTrimmed);
    }

    // uses a heuristic to produce a token name from the address
    // the heuristic returns the full hex of the address string in upper case
    function addressToName(address token) private pure returns (string memory) {
        return AddressStringUtil.toAsciiString(token, 40);
    }

    // uses a heuristic to produce a token symbol from the address
    // the heuristic returns the first 6 hex of the address string in upper case
    function addressToSymbol(address token) private pure returns (string memory) {
        return AddressStringUtil.toAsciiString(token, 6);
    }

    // calls an external view token contract method that returns a symbol or name, and parses the output into a string
    function callAndParseStringReturn(address token, bytes4 selector) private view returns (string memory) {
        (bool success, bytes memory data) = token.staticcall(abi.encodeWithSelector(selector));
        // if not implemented, or returns empty data, return empty string
        if (!success || data.length == 0) {
            return "";
        }
        // bytes32 data always has length 32
        if (data.length == 32) {
            bytes32 decoded = abi.decode(data, (bytes32));
            return bytes32ToString(decoded);
        } else if (data.length > 64) {
            return abi.decode(data, (string));
        }
        return "";
    }

    // attempts to extract the token symbol. if it does not implement symbol, returns a symbol derived from the address
    function tokenSymbol(address token) public view returns (string memory) {
        string memory symbol = callAndParseStringReturn(token, IERC20Metadata.symbol.selector);
        if (bytes(symbol).length == 0) {
            // fallback to 6 uppercase hex of address
            return addressToSymbol(token);
        }
        return symbol;
    }

    // attempts to extract the token name. if it does not implement name, returns a name derived from the address
    function tokenName(address token) public view returns (string memory) {
        string memory name = callAndParseStringReturn(token, IERC20Metadata.name.selector);
        if (bytes(name).length == 0) {
            // fallback to full hex of address
            return addressToName(token);
        }
        return name;
    }

    /// @notice Provides a safe ERC20.decimals version which returns '0' as fallback value.
    /// @param token The address of the ERC-20 token contract.
    /// @return (uint8) Token decimals.
    function tokenDecimals(address token) public view returns (uint8) {
        (bool success, bytes memory data) = token.staticcall(abi.encodeWithSelector(IERC20Metadata.decimals.selector));
        return success && data.length == 32 ? abi.decode(data, (uint8)) : 0;
    }
}

File 5 of 29 : MinimalTransferHelper.sol
// SPDX-License-Identifier: MIT
// Taken from https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/TransferHelper.sol

pragma solidity >=0.6.0;

import "./IERC20.sol";
import "../utils/RevertMsgExtractor.sol";


// helper methods for transferring ERC20 tokens that do not consistently return true/false
library MinimalTransferHelper {
    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with the underlying revert message if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        if (!(success && (data.length == 0 || abi.decode(data, (bool))))) revert(RevertMsgExtractor.getRevertMsg(data));
    }
}

File 6 of 29 : ERC20Rewards.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./ERC20Permit.sol";
import "../access/AccessControl.sol";
import "../utils/RevertMsgExtractor.sol";
import "../token/MinimalTransferHelper.sol";
import "../cast/CastU256U128.sol";
import "../cast/CastU256U32.sol";


/// @dev A token inheriting from ERC20Rewards will reward token holders with a rewards token.
/// The rewarded amount will be a fixed wei per second, distributed proportionally to token holders
/// by the size of their holdings.
contract ERC20Rewards is AccessControl, ERC20Permit {
    using MinimalTransferHelper for IERC20;
    using CastU256U32 for uint256;
    using CastU256U128 for uint256;

    event RewardsTokenSet(IERC20 token);
    event RewardsSet(uint32 start, uint32 end, uint256 rate);
    event RewardsPerTokenUpdated(uint256 accumulated);
    event UserRewardsUpdated(address user, uint256 userRewards, uint256 paidRewardPerToken);
    event Claimed(address user, address receiver, uint256 claimed);

    struct RewardsPeriod {
        uint32 start;                                   // Start time for the current rewardsToken schedule
        uint32 end;                                     // End time for the current rewardsToken schedule
    }

    struct RewardsPerToken {
        uint128 accumulated;                            // Accumulated rewards per token for the period, scaled up by 1e18
        uint32 lastUpdated;                             // Last time the rewards per token accumulator was updated
        uint96 rate;                                    // Wei rewarded per second among all token holders
    }

    struct UserRewards {
        uint128 accumulated;                            // Accumulated rewards for the user until the checkpoint
        uint128 checkpoint;                             // RewardsPerToken the last time the user rewards were updated
    }

    IERC20 public rewardsToken;                         // Token used as rewards
    RewardsPeriod public rewardsPeriod;                 // Period in which rewards are accumulated by users

    RewardsPerToken public rewardsPerToken;             // Accumulator to track rewards per token               
    mapping (address => UserRewards) public rewards;    // Rewards accumulated by users
    
    constructor(string memory name, string memory symbol, uint8 decimals)
        ERC20Permit(name, symbol, decimals)
    { }

    /// @dev Return the earliest of two timestamps
    function earliest(uint32 x, uint32 y) internal pure returns (uint32 z) {
        z = (x < y) ? x : y;
    }

    /// @dev Set a rewards token.
    /// @notice Careful, this can only be done once.
    function setRewardsToken(IERC20 rewardsToken_)
        external
        auth
    {
        require(rewardsToken == IERC20(address(0)), "Rewards token already set");
        rewardsToken = rewardsToken_;
        emit RewardsTokenSet(rewardsToken_);
    }

    /// @dev Set a rewards schedule
    function setRewards(uint32 start, uint32 end, uint96 rate)
        external
        auth
    {
        require(
            start <= end,
            "Incorrect input"
        );
        require(
            rewardsToken != IERC20(address(0)),
            "Rewards token not set"
        );
        // A new rewards program can be set if one is not running
        require(
            block.timestamp.u32() < rewardsPeriod.start || block.timestamp.u32() > rewardsPeriod.end,
            "Ongoing rewards"
        );

        // Update the rewards per token so that we don't lose any rewards
        _updateRewardsPerToken();

        rewardsPeriod.start = start;
        rewardsPeriod.end = end;

        // If setting up a new rewards program, the rewardsPerToken.accumulated is used and built upon
        // New rewards start accumulating from the new rewards program start
        // Any unaccounted rewards from last program can still be added to the user rewards
        // Any unclaimed rewards can still be claimed
        rewardsPerToken.lastUpdated = start;
        rewardsPerToken.rate = rate;

        emit RewardsSet(start, end, rate);
    }

    /// @dev Update the rewards per token accumulator.
    /// @notice Needs to be called on each liquidity event
    function _updateRewardsPerToken() internal {
        RewardsPerToken memory rewardsPerToken_ = rewardsPerToken;
        RewardsPeriod memory rewardsPeriod_ = rewardsPeriod;
        uint256 totalSupply_ = _totalSupply;

        // We skip the update if the program hasn't started
        if (block.timestamp.u32() < rewardsPeriod_.start) return;

        // Find out the unaccounted time
        uint32 end = earliest(block.timestamp.u32(), rewardsPeriod_.end);
        uint256 unaccountedTime = end - rewardsPerToken_.lastUpdated; // Cast to uint256 to avoid overflows later on
        if (unaccountedTime == 0) return; // We skip the storage changes if already updated in the same block

        // Calculate and update the new value of the accumulator. unaccountedTime casts it into uint256, which is desired.
        // If the first mint happens mid-program, we don't update the accumulator, no one gets the rewards for that period.
        if (totalSupply_ != 0) rewardsPerToken_.accumulated = (rewardsPerToken_.accumulated + 1e18 * unaccountedTime * rewardsPerToken_.rate / totalSupply_).u128(); // The rewards per token are scaled up for precision
        rewardsPerToken_.lastUpdated = end;
        rewardsPerToken = rewardsPerToken_;
        
        emit RewardsPerTokenUpdated(rewardsPerToken_.accumulated);
    }

    /// @dev Accumulate rewards for an user.
    /// @notice Needs to be called on each liquidity event, or when user balances change.
    function _updateUserRewards(address user) internal returns (uint128) {
        UserRewards memory userRewards_ = rewards[user];
        RewardsPerToken memory rewardsPerToken_ = rewardsPerToken;
        
        // Calculate and update the new value user reserves. _balanceOf[user] casts it into uint256, which is desired.
        userRewards_.accumulated = (userRewards_.accumulated + _balanceOf[user] * (rewardsPerToken_.accumulated - userRewards_.checkpoint) / 1e18).u128(); // We must scale down the rewards by the precision factor
        userRewards_.checkpoint = rewardsPerToken_.accumulated;
        rewards[user] = userRewards_;
        emit UserRewardsUpdated(user, userRewards_.accumulated, userRewards_.checkpoint);

        return userRewards_.accumulated;
    }

    /// @dev Mint tokens, after accumulating rewards for an user and update the rewards per token accumulator.
    function _mint(address dst, uint256 wad)
        internal virtual override
        returns (bool)
    {
        _updateRewardsPerToken();
        _updateUserRewards(dst);
        return super._mint(dst, wad);
    }

    /// @dev Burn tokens, after accumulating rewards for an user and update the rewards per token accumulator.
    function _burn(address src, uint256 wad)
        internal virtual override
        returns (bool)
    {
        _updateRewardsPerToken();
        _updateUserRewards(src);
        return super._burn(src, wad);
    }

    /// @dev Transfer tokens, after updating rewards for source and destination.
    function _transfer(address src, address dst, uint wad) internal virtual override returns (bool) {
        _updateRewardsPerToken();
        _updateUserRewards(src);
        _updateUserRewards(dst);
        return super._transfer(src, dst, wad);
    }

    /// @dev Claim all rewards from caller into a given address
    function claim(address to)
        external
        returns (uint256 claiming)
    {
        claiming = _claim(msg.sender, to);
    }

    /// @dev Trigger a claim for any user
    function remit(address user)
        external
        returns (uint256 claiming)
    {
        claiming = _claim(user, user);
    }

    /// @dev Claim all rewards from a user into an arbitrary receiver
    function _claim(address from, address to)
        internal
        returns (uint256 claiming)
    {
        _updateRewardsPerToken();
        claiming = _updateUserRewards(from);
        rewards[from].accumulated = 0; // A Claimed event implies the rewards were set to zero
        rewardsToken.safeTransfer(to, claiming);
        emit Claimed(from, to, claiming);
    }
}

File 7 of 29 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

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

File 8 of 29 : IPool.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.0;
import "@yield-protocol/utils-v2/contracts/token/IERC20.sol";
import "@yield-protocol/utils-v2/contracts/token/IERC2612.sol";
import {IMaturingToken} from "./IMaturingToken.sol";
import {IERC20Metadata} from  "@yield-protocol/utils-v2/contracts/token/ERC20.sol";

interface IPool is IERC20, IERC2612 {
    function baseToken() external view returns(IERC20Metadata);
    function base() external view returns(IERC20);
    function burn(address baseTo, address fyTokenTo, uint256 minRatio, uint256 maxRatio) external returns (uint256, uint256, uint256);
    function burnForBase(address to, uint256 minRatio, uint256 maxRatio) external returns (uint256, uint256);
    function buyBase(address to, uint128 baseOut, uint128 max) external returns(uint128);
    function buyBasePreview(uint128 baseOut) external view returns(uint128);
    function buyFYToken(address to, uint128 fyTokenOut, uint128 max) external returns(uint128);
    function buyFYTokenPreview(uint128 fyTokenOut) external view returns(uint128);
    function currentCumulativeRatio() external view returns (uint256 currentCumulativeRatio_, uint256 blockTimestampCurrent);
    function cumulativeRatioLast() external view returns (uint256);
    function fyToken() external view returns(IMaturingToken);
    function g1() external view returns(int128);
    function g2() external view returns(int128);
    function getC() external view returns (int128);
    function getCurrentSharePrice() external view returns (uint256);
    function getCache() external view returns (uint104 baseCached, uint104 fyTokenCached, uint32 blockTimestampLast, uint16 g1Fee_);
    function getBaseBalance() external view returns(uint128);
    function getFYTokenBalance() external view returns(uint128);
    function getSharesBalance() external view returns(uint128);
    function init(address to) external returns (uint256, uint256, uint256);
    function maturity() external view returns(uint32);
    function mint(address to, address remainder, uint256 minRatio, uint256 maxRatio) external returns (uint256, uint256, uint256);
    function mu() external view returns (int128);
    function mintWithBase(address to, address remainder, uint256 fyTokenToBuy, uint256 minRatio, uint256 maxRatio) external returns (uint256, uint256, uint256);
    function retrieveBase(address to) external returns(uint128 retrieved);
    function retrieveFYToken(address to) external returns(uint128 retrieved);
    function retrieveShares(address to) external returns(uint128 retrieved);
    function scaleFactor() external view returns(uint96);
    function sellBase(address to, uint128 min) external returns(uint128);
    function sellBasePreview(uint128 baseIn) external view returns(uint128);
    function sellFYToken(address to, uint128 min) external returns(uint128);
    function sellFYTokenPreview(uint128 fyTokenIn) external view returns(uint128);
    function setFees(uint16 g1Fee_) external;
    function sharesToken() external view returns(IERC20Metadata);
    function ts() external view returns(int128);
    function wrap(address receiver) external returns (uint256 shares);
    function wrapPreview(uint256 assets) external view returns (uint256 shares);
    function unwrap(address receiver) external returns (uint256 assets);
    function unwrapPreview(uint256 shares) external view returns (uint256 assets);
    /// Returns the max amount of FYTokens that can be sold to the pool
    function maxFYTokenIn() external view returns (uint128) ;
    /// Returns the max amount of FYTokens that can be bought from the pool
    function maxFYTokenOut() external view returns (uint128) ;
    /// Returns the max amount of Base that can be sold to the pool
    function maxBaseIn() external view returns (uint128) ;
    /// Returns the max amount of Base that can be bought from the pool
    function maxBaseOut() external view returns (uint128);
    /// Returns the result of the total supply invariant function
    function invariant() external view returns (uint128);
}

File 9 of 29 : StrategyMigrator.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.13;

import {IStrategyMigrator} from "./interfaces/IStrategyMigrator.sol";
import {IFYToken} from "@yield-protocol/vault-v2/contracts/interfaces/IFYToken.sol";
import {IERC20} from "@yield-protocol/utils-v2/contracts/token/IERC20.sol";
import {ERC20Permit} from "@yield-protocol/utils-v2/contracts/token/ERC20Permit.sol";


/// @dev The Migrator contract poses as a Pool to receive all assets from a Strategy
/// during a roll operation.
/// @notice The Pool and fyToken must exist. The fyToken needs to be not mature, and the pool needs to have no fyToken in it.
/// There will be no state changes on pool or fyToken.
/// TODO: For this to work, the implementing class must inherit from ERC20 and make sure that totalSupply is not zero after the `mint` call.
abstract contract StrategyMigrator is IStrategyMigrator {

    /// Mock pool base - Must match that of the calling strategy
    IERC20 public base;

    /// Mock pool fyToken - Must be set to a real fyToken registered to a series in the Cauldron, any will do
    IFYToken public fyToken;

    /// Mock pool maturity - Its contents don't matter
    uint32 public maturity;

    constructor(IERC20 base_, IFYToken fyToken_) {
        base = base_;
        fyToken = fyToken_;
    }

    /// @dev Mock pool mint. Called within `startPool`. This contract must hold 1 wei of base.
    function mint(address, address, uint256, uint256)
        external
        virtual
        returns (uint256, uint256, uint256)
    {
        return (0, 0, 0);
    }

    /// @dev Mock pool burn and make it revert so that `endPool`never suceeds, and `burnForBase` can never be called.
    function burn(address, address, uint256, uint256)
        external
        returns  (uint256, uint256, uint256)
    {
        revert();
    }

    /// @dev Mock pool getBaseBalance
    function getBaseBalance() external view returns(uint128) {
        return 0;
    }

    /// @dev Mock pool getFYTokenBalance
    function getFYTokenBalance() external view returns(uint128) {
        return 0;
    }

    /// @dev Mock pool ts
    function ts() external view returns(int128) {
        return 0;
    }
}

File 10 of 29 : IStrategy.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.13;

import {IStrategyMigrator} from "./IStrategyMigrator.sol";
import {IERC20} from "@yield-protocol/utils-v2/contracts/token/IERC20.sol";
import {IFYToken} from "@yield-protocol/vault-v2/contracts/interfaces/IFYToken.sol";
import {ICauldron} from "@yield-protocol/vault-v2/contracts/interfaces/ICauldron.sol";
import {ILadle} from "@yield-protocol/vault-v2/contracts/interfaces/ILadle.sol";
import {IPool} from "@yield-protocol/yieldspace-tv/src/interfaces/IPool.sol";


/// @dev The Strategy contract allows liquidity providers to provide liquidity in underlying
/// and receive strategy tokens that represent a stake in a YieldSpace pool contract.
/// Upon maturity, the strategy can `divest` from the mature pool, becoming a proportional
/// ownership underlying vault. When not invested, the strategy can `invest` into a Pool using
/// all its underlying.
/// The strategy can also `eject` from a Pool before maturity, immediately converting its assets
/// to underlying as much as possible. If any fyToken can't be exchanged for underlying, the
/// strategy will hold them until maturity when `redeemEjected` can be used.
interface IStrategy is IStrategyMigrator {
    enum State {DEPLOYED, DIVESTED, INVESTED, EJECTED, DRAINED}

    function state() external view returns(State);                          // The state determines which functions are available
    function base() external view returns(IERC20);                          // Base token for this strategy (inherited from StrategyMigrator)
    function fyToken() external view returns(IFYToken);                     // Current fyToken for this strategy (inherited from StrategyMigrator)
    function pool() external view returns(IPool);                           // Current pool that this strategy invests in
    function cached() external view returns(uint256);                       // Base tokens owned by the strategy after the last operation
    function fyTokenCached() external view returns(uint256);                // In emergencies, the strategy can keep fyToken of one series

    /// @dev Mint the first strategy tokens, without investing
    function init(address to)
        external
        returns (uint256 minted);

    /// @dev Start the strategy investments in the next pool
    /// @notice When calling this function for the first pool, some underlying needs to be transferred to the strategy first, using a batchable router.
    function invest(IPool pool_)
        external
        returns (uint256 poolTokensObtained);


    /// @dev Divest out of a pool once it has matured
    function divest()
        external
        returns (uint256 baseObtained);

    /// @dev Divest out of a pool at any time. If possible the pool tokens will be burnt for base and fyToken, the latter of which
    /// must be sold to return the strategy to a functional state. If the pool token burn reverts, the pool tokens will be transferred
    /// to the caller as a last resort.
    /// @notice The caller must take care of slippage when selling fyToken, if relevant.
    function eject()
        external
        returns (uint256 baseObtained, uint256 fyTokenObtained);

    /// @dev Buy ejected fyToken in the strategy at face value
    /// @param fyTokenTo Address to send the purchased fyToken to.
    /// @param baseTo Address to send any remaining base to.
    /// @return soldFYToken Amount of fyToken sold.
    /// @return returnedBase Amount of base unused and returned.
    function buyFYToken(address fyTokenTo, address baseTo)
        external
        returns (uint256 soldFYToken, uint256 returnedBase);

    /// @dev If we ejected the pool tokens, we can recapitalize the strategy to avoid a forced migration
    function restart()
        external
        returns (uint256 baseIn);

    /// @dev Mint strategy tokens with pool tokens. It can be called only when invested.
    /// @notice The pool tokens that the user contributes need to have been transferred previously, using a batchable router.
    function mint(address to)
        external
        returns (uint256 minted);

    /// @dev Burn strategy tokens to withdraw pool tokens. It can be called only when invested.
    /// @notice The strategy tokens that the user burns need to have been transferred previously, using a batchable router.
    function burn(address to)
        external
        returns (uint256 poolTokensObtained);

    /// @dev Mint strategy tokens with base tokens. It can be called only when not invested and not ejected.
    /// @notice The base tokens that the user invests need to have been transferred previously, using a batchable router.
    function mintDivested(address to)
        external
        returns (uint256 minted);
    
    /// @dev Burn strategy tokens to withdraw base tokens. It can be called when not invested and not ejected.
    /// @notice The strategy tokens that the user burns need to have been transferred previously, using a batchable router.
    function burnDivested(address baseTo)
        external
        returns (uint256 baseObtained);

    /// @dev Token used as rewards
    function rewardsToken() external view returns(IERC20);
    
    /// @dev Rewards schedule
    function rewardsPeriod() external view returns(uint32 start, uint32 end);

    /// @dev Rewards per token
    function rewardsPerToken() external view returns(uint128 accumulated, uint32 lastUpdated, uint96 rate);
    
    /// @dev Rewards accumulated by users
    function rewards(address user) external view returns(uint128 accumulatedUserStart, uint128 accumulatedCheckpoint);

    /// @dev Set the rewards token
    function setRewardsToken(IERC20 rewardsToken_)
        external;

    /// @dev Set a rewards schedule
    function setRewards(uint32 start, uint32 end, uint96 rate)
        external;

    /// @dev Claim all rewards from caller into a given address
    function claim(address to)
        external
        returns (uint256 claiming);

    /// @dev Trigger a claim for any user
    function remit(address user)
        external
        returns (uint256 claiming);
}

File 11 of 29 : IERC5095.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.13;

import "@yield-protocol/utils-v2/contracts/token/IERC20.sol";

interface IERC5095 is IERC20 {
    /// @dev Asset that is returned on redemption.
    function underlying() external view returns (address underlyingAddress);

    /// @dev Unix time at which redemption of fyToken for underlying are possible
    function maturity() external view returns (uint256 timestamp);

    /// @dev Converts a specified amount of principal to underlying
    function convertToUnderlying(uint256 principalAmount) external returns (uint256 underlyingAmount);

    /// @dev Converts a specified amount of underlying to principal
    function convertToPrincipal(uint256 underlyingAmount) external returns (uint256 principalAmount);

    /// @dev Gives the maximum amount an address holder can redeem in terms of the principal
    function maxRedeem(address holder) external view returns (uint256 maxPrincipalAmount);

    /// @dev Gives the amount in terms of underlying that the princiapl amount can be redeemed for plus accrual
    function previewRedeem(uint256 principalAmount) external returns (uint256 underlyingAmount);

    /// @dev Burn fyToken after maturity for an amount of principal.
    function redeem(uint256 principalAmount, address to, address from) external returns (uint256 underlyingAmount);

    /// @dev Gives the maximum amount an address holder can withdraw in terms of the underlying
    function maxWithdraw(address holder) external returns (uint256 maxUnderlyingAmount);

    /// @dev Gives the amount in terms of principal that the underlying amount can be withdrawn for plus accrual
    function previewWithdraw(uint256 underlyingAmount) external returns (uint256 principalAmount);

    /// @dev Burn fyToken after maturity for an amount of underlying.
    function withdraw(uint256 underlyingAmount, address to, address from) external returns (uint256 principalAmount);
}

File 12 of 29 : IJoin.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@yield-protocol/utils-v2/contracts/token/IERC20.sol";

interface IJoin {
    /// @dev asset managed by this contract
    function asset() external view returns (address);

    /// @dev amount of assets held by this contract
    function storedBalance() external view returns (uint256);

    /// @dev Add tokens to this contract.
    function join(address user, uint128 wad) external returns (uint128);

    /// @dev Remove tokens to this contract.
    function exit(address user, uint128 wad) external returns (uint128);

    /// @dev Retrieve any tokens other than the `asset`. Useful for airdropped tokens.
    function retrieve(IERC20 token, address to) external;
}

File 13 of 29 : IOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IOracle {
    /**
     * @notice Doesn't refresh the price, but returns the latest value available without doing any transactional operations
     * @param base The asset in which the `amount` to be converted is represented
     * @param quote The asset in which the converted `value` will be represented
     * @param amount The amount to be converted from `base` to `quote`
     * @return value The converted value of `amount` from `base` to `quote`
     * @return updateTime The timestamp when the conversion price was taken
     */
    function peek(
        bytes32 base,
        bytes32 quote,
        uint256 amount
    ) external view returns (uint256 value, uint256 updateTime);

    /**
     * @notice Does whatever work or queries will yield the most up-to-date price, and returns it.
     * @param base The asset in which the `amount` to be converted is represented
     * @param quote The asset in which the converted `value` will be represented
     * @param amount The amount to be converted from `base` to `quote`
     * @return value The converted value of `amount` from `base` to `quote`
     * @return updateTime The timestamp when the conversion price was taken
     */
    function get(
        bytes32 base,
        bytes32 quote,
        uint256 amount
    ) external returns (uint256 value, uint256 updateTime);
}

File 14 of 29 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// Taken from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Metadata.sol

pragma solidity ^0.8.0;

import "./IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
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);
}

File 15 of 29 : AddressStringUtil.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

library AddressStringUtil {
    // converts an address to the uppercase hex string, extracting only len bytes (up to 20, multiple of 2)
    function toAsciiString(address addr, uint256 len) internal pure returns (string memory) {
        require(len % 2 == 0 && len > 0 && len <= 40, "AddressStringUtil: INVALID_LEN");
        bytes memory s = new bytes(len);
        uint256 addrNum = uint256(uint160(addr));
        for (uint256 ii = 0; ii < len ; ii +=2) {
            uint8 b = uint8(addrNum >> (4 * (38 - ii)));
            s[ii] = char(b >> 4);
            s[ii + 1] = char(b & 0x0f);
        }
        return string(s);
    }

    // hi and lo are only 4 bits and between 0 and 16
    // this method converts those values to the unicode/ascii code point for the hex representation
    // uses upper case for the characters
    function char(uint8 b) private pure returns (bytes1 c) {
        if (b < 10) {
            return bytes1(b + 0x30);
        } else {
            return bytes1(b + 0x37);
        }
    }
}

File 16 of 29 : RevertMsgExtractor.sol
// SPDX-License-Identifier: MIT
// Taken from https://github.com/sushiswap/BoringSolidity/blob/441e51c0544cf2451e6116fe00515e71d7c42e2c/contracts/BoringBatchable.sol

pragma solidity >=0.6.0;


library RevertMsgExtractor {
    /// @dev Helper function to extract a useful revert message from a failed call.
    /// If the returned data is malformed or not correctly abi encoded then this call can fail itself.
    function getRevertMsg(bytes memory returnData)
        internal pure
        returns (string memory)
    {
        // If the _res length is less than 68, then the transaction failed silently (without a revert message)
        if (returnData.length < 68) return "Transaction reverted silently";

        assembly {
            // Slice the sighash.
            returnData := add(returnData, 0x04)
        }
        return abi.decode(returnData, (string)); // All that remains is the revert string
    }
}

File 17 of 29 : ERC20Permit.sol
// SPDX-License-Identifier: MIT
// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/53516bc555a454862470e7860a9b5254db4d00f5/contracts/token/ERC20/ERC20Permit.sol
pragma solidity ^0.8.0;

import "./ERC20.sol";
import "./IERC2612.sol";

/**
 * @dev Extension of {ERC20} that allows token holders to use their tokens
 * without sending any transactions by setting {IERC20-allowance} with a
 * signature using the {permit} method, and then spend them via
 * {IERC20-transferFrom}.
 *
 * The {permit} signature mechanism conforms to the {IERC2612} interface.
 */
abstract contract ERC20Permit is ERC20, IERC2612 {
    mapping (address => uint256) public override nonces;

    bytes32 public immutable PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 private immutable _DOMAIN_SEPARATOR;
    uint256 public immutable deploymentChainId;

    constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_, decimals_) {
        deploymentChainId = block.chainid;
        _DOMAIN_SEPARATOR = _calculateDomainSeparator(block.chainid);
    }

    /// @dev Calculate the DOMAIN_SEPARATOR.
    function _calculateDomainSeparator(uint256 chainId) private view returns (bytes32) {
        return keccak256(
            abi.encode(
                keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                keccak256(bytes(name)),
                keccak256(bytes(version())),
                chainId,
                address(this)
            )
        );
    }

    /// @dev Return the DOMAIN_SEPARATOR.
    function DOMAIN_SEPARATOR() external view returns (bytes32) {
        return block.chainid == deploymentChainId ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(block.chainid);
    }

    /// @dev Setting the version as a function so that it can be overriden
    function version() public pure virtual returns(string memory) { return "1"; }

    /**
     * @dev See {IERC2612-permit}.
     *
     * In cases where the free option is not a concern, deadline can simply be
     * set to uint(-1), so it should be seen as an optional parameter
     */
    function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external virtual override {
        require(deadline >= block.timestamp, "ERC20Permit: expired deadline");

        bytes32 hashStruct = keccak256(
            abi.encode(
                PERMIT_TYPEHASH,
                owner,
                spender,
                amount,
                nonces[owner]++,
                deadline
            )
        );

        bytes32 hash = keccak256(
            abi.encodePacked(
                "\x19\x01",
                block.chainid == deploymentChainId ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(block.chainid),
                hashStruct
            )
        );

        address signer = ecrecover(hash, v, r, s);
        require(
            signer != address(0) && signer == owner,
            "ERC20Permit: invalid signature"
        );

        _setAllowance(owner, spender, amount);
    }
}

File 18 of 29 : CastU256U128.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;


library CastU256U128 {
    /// @dev Safely cast an uint256 to an uint128
    function u128(uint256 x) internal pure returns (uint128 y) {
        require (x <= type(uint128).max, "Cast overflow");
        y = uint128(x);
    }
}

File 19 of 29 : CastU256U32.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;


library CastU256U32 {
    /// @dev Safely cast an uint256 to an u32
    function u32(uint256 x) internal pure returns (uint32 y) {
        require (x <= type(uint32).max, "Cast overflow");
        y = uint32(x);
    }
}

File 20 of 29 : ERC20.sol
// SPDX-License-Identifier: MIT
// Inspired on token.sol from DappHub. Natspec adpated from OpenZeppelin.

pragma solidity ^0.8.0;
import "./IERC20Metadata.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}.
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of 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.
 * 
 * Calls to {transferFrom} do not check for allowance if the caller is the owner
 * of the funds. This allows to reduce the number of approvals that are necessary.
 *
 * Finally, {transferFrom} does not decrease the allowance if it is set to
 * type(uint256).max. This reduces the gas costs without any likely impact.
 */
contract ERC20 is IERC20Metadata {
    uint256                                           internal  _totalSupply;
    mapping (address => uint256)                      internal  _balanceOf;
    mapping (address => mapping (address => uint256)) internal  _allowance;
    string                                            public override name = "???";
    string                                            public override symbol = "???";
    uint8                                             public override decimals = 18;

    /**
     *  @dev Sets the values for {name}, {symbol} and {decimals}.
     */
    constructor(string memory name_, string memory symbol_, uint8 decimals_) {
        name = name_;
        symbol = symbol_;
        decimals = decimals_;
    }

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

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

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

    /**
     * @dev See {IERC20-approve}.
     */
    function approve(address spender, uint wad) external virtual override returns (bool) {
        return _setAllowance(msg.sender, spender, wad);
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - the caller must have a balance of at least `wad`.
     */
    function transfer(address dst, uint wad) external virtual override returns (bool) {
        return _transfer(msg.sender, dst, wad);
    }

    /**
     * @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}.
     *
     * Requirements:
     *
     * - `src` must have a balance of at least `wad`.
     * - the caller is not `src`, it must have allowance for ``src``'s tokens of at least
     * `wad`.
     */
    /// if_succeeds {:msg "TransferFrom - decrease allowance"} msg.sender != src ==> old(_allowance[src][msg.sender]) >= wad;
    function transferFrom(address src, address dst, uint wad) external virtual override returns (bool) {
        _decreaseAllowance(src, wad);

        return _transfer(src, dst, wad);
    }

    /**
     * @dev Moves tokens `wad` from `src` to `dst`.
     * 
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `src` must have a balance of at least `amount`.
     */
    /// if_succeeds {:msg "Transfer - src decrease"} old(_balanceOf[src]) >= _balanceOf[src];
    /// if_succeeds {:msg "Transfer - dst increase"} _balanceOf[dst] >= old(_balanceOf[dst]);
    /// if_succeeds {:msg "Transfer - supply"} old(_balanceOf[src]) + old(_balanceOf[dst]) == _balanceOf[src] + _balanceOf[dst];
    function _transfer(address src, address dst, uint wad) internal virtual returns (bool) {
        require(_balanceOf[src] >= wad, "ERC20: Insufficient balance");
        unchecked { _balanceOf[src] = _balanceOf[src] - wad; }
        _balanceOf[dst] = _balanceOf[dst] + wad;

        emit Transfer(src, dst, wad);

        return true;
    }

    /**
     * @dev Sets the allowance granted to `spender` by `owner`.
     *
     * Emits an {Approval} event indicating the updated allowance.
     */
    function _setAllowance(address owner, address spender, uint wad) internal virtual returns (bool) {
        _allowance[owner][spender] = wad;
        emit Approval(owner, spender, wad);

        return true;
    }

    /**
     * @dev Decreases the allowance granted to the caller by `src`, unless src == msg.sender or _allowance[src][msg.sender] == MAX
     *
     * Emits an {Approval} event indicating the updated allowance, if the allowance is updated.
     *
     * Requirements:
     *
     * - `spender` must have allowance for the caller of at least
     * `wad`, unless src == msg.sender
     */
    /// if_succeeds {:msg "Decrease allowance - underflow"} old(_allowance[src][msg.sender]) <= _allowance[src][msg.sender];
    function _decreaseAllowance(address src, uint wad) internal virtual returns (bool) {
        if (src != msg.sender) {
            uint256 allowed = _allowance[src][msg.sender];
            if (allowed != type(uint).max) {
                require(allowed >= wad, "ERC20: Insufficient approval");
                unchecked { _setAllowance(src, msg.sender, allowed - wad); }
            }
        }

        return true;
    }

    /** @dev Creates `wad` tokens and assigns them to `dst`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     */
    /// if_succeeds {:msg "Mint - balance overflow"} old(_balanceOf[dst]) >= _balanceOf[dst];
    /// if_succeeds {:msg "Mint - supply overflow"} old(_totalSupply) >= _totalSupply;
    function _mint(address dst, uint wad) internal virtual returns (bool) {
        _balanceOf[dst] = _balanceOf[dst] + wad;
        _totalSupply = _totalSupply + wad;
        emit Transfer(address(0), dst, wad);

        return true;
    }

    /**
     * @dev Destroys `wad` tokens from `src`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `src` must have at least `wad` tokens.
     */
    /// if_succeeds {:msg "Burn - balance underflow"} old(_balanceOf[src]) <= _balanceOf[src];
    /// if_succeeds {:msg "Burn - supply underflow"} old(_totalSupply) <= _totalSupply;
    function _burn(address src, uint wad) internal virtual returns (bool) {
        unchecked {
            require(_balanceOf[src] >= wad, "ERC20: Insufficient balance");
            _balanceOf[src] = _balanceOf[src] - wad;
            _totalSupply = _totalSupply - wad;
            emit Transfer(src, address(0), wad);
        }

        return true;
    }
}

File 21 of 29 : IERC2612.sol
// SPDX-License-Identifier: MIT
// Code adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2237/
pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC2612 standard as defined in the EIP.
 *
 * Adds the {permit} method, which can be used to change one's
 * {IERC20-allowance} without having to send a transaction, by signing a
 * message. This allows users to spend tokens without having to hold Ether.
 *
 * See https://eips.ethereum.org/EIPS/eip-2612.
 */
interface IERC2612 {
    /**
     * @dev Sets `amount` 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:
     *
     * - `owner` cannot be the zero address.
     * - `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 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;

    /**
     * @dev Returns the current ERC2612 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);
}

File 22 of 29 : IMaturingToken.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.15;
import "@yield-protocol/utils-v2/contracts/token/IERC20.sol";

interface IMaturingToken is IERC20 {
    function maturity() external view returns (uint256);
}

File 23 of 29 : IStrategyMigrator.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.13;

import {IFYToken} from "@yield-protocol/vault-v2/contracts/interfaces/IFYToken.sol";
import {IERC20} from "@yield-protocol/utils-v2/contracts/token/IERC20.sol";


/// @dev The Migrator contract poses as a Pool to receive all assets from a Strategy
/// during a roll operation.
/// @notice The Pool and fyToken must exist. The fyToken needs to be not mature, and the pool needs to have no fyToken in it.
/// There will be no state changes on pool or fyToken.
interface IStrategyMigrator is IERC20 {

    /// @dev Mock pool base - Must match that of the calling strategy
    function base() external view returns(IERC20);

    /// @dev Mock pool fyToken - Must be set to a real fyToken registered to a series in the Cauldron, any will do
    function fyToken() external view returns(IFYToken);

    /// @dev Mock pool mint. Called within `startPool`. This contract must hold 1 wei of base.
    function mint(address, address, uint256, uint256) external returns (uint256, uint256, uint256);

    /// @dev Mock pool burn and make it revert so that `endPool`never suceeds, and `burnForBase` can never be called.
    function burn(address, address, uint256, uint256) external returns  (uint256, uint256, uint256);

    /// @dev Mock pool maturity
    function maturity() external view returns(uint32);

    /// @dev Mock pool getBaseBalance
    function getBaseBalance() external view returns(uint128);

    /// @dev Mock pool getFYTokenBalance
    function getFYTokenBalance() external view returns(uint128);

    /// @dev Mock pool ts
    function ts() external view returns(int128);
}

File 24 of 29 : ICauldron.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IFYToken.sol";
import "./IOracle.sol";
import "./DataTypes.sol";

interface ICauldron {
    /// @dev Variable rate lending oracle for an underlying
    function lendingOracles(bytes6 baseId) external view returns (IOracle);

    /// @dev An user can own one or more Vaults, with each vault being able to borrow from a single series.
    function vaults(bytes12 vault)
        external
        view
        returns (DataTypes.Vault memory);

    /// @dev Series available in Cauldron.
    function series(bytes6 seriesId)
        external
        view
        returns (DataTypes.Series memory);

    /// @dev Assets available in Cauldron.
    function assets(bytes6 assetsId) external view returns (address);

    /// @dev Each vault records debt and collateral balances_.
    function balances(bytes12 vault)
        external
        view
        returns (DataTypes.Balances memory);

    /// @dev Max, min and sum of debt per underlying and collateral.
    function debt(bytes6 baseId, bytes6 ilkId)
        external
        view
        returns (DataTypes.Debt memory);

    // @dev Spot price oracle addresses and collateralization ratios
    function spotOracles(bytes6 baseId, bytes6 ilkId)
        external
        view
        returns (DataTypes.SpotOracle memory);

    /// @dev Create a new vault, linked to a series (and therefore underlying) and up to 5 collateral types
    function build(
        address owner,
        bytes12 vaultId,
        bytes6 seriesId,
        bytes6 ilkId
    ) external returns (DataTypes.Vault memory);

    /// @dev Destroy an empty vault. Used to recover gas costs.
    function destroy(bytes12 vault) external;

    /// @dev Change a vault series and/or collateral types.
    function tweak(
        bytes12 vaultId,
        bytes6 seriesId,
        bytes6 ilkId
    ) external returns (DataTypes.Vault memory);

    /// @dev Give a vault to another user.
    function give(bytes12 vaultId, address receiver)
        external
        returns (DataTypes.Vault memory);

    /// @dev Move collateral and debt between vaults.
    function stir(
        bytes12 from,
        bytes12 to,
        uint128 ink,
        uint128 art
    ) external returns (DataTypes.Balances memory, DataTypes.Balances memory);

    /// @dev Manipulate a vault debt and collateral.
    function pour(
        bytes12 vaultId,
        int128 ink,
        int128 art
    ) external returns (DataTypes.Balances memory);

    /// @dev Change series and debt of a vault.
    /// The module calling this function also needs to buy underlying in the pool for the new series, and sell it in pool for the old series.
    function roll(
        bytes12 vaultId,
        bytes6 seriesId,
        int128 art
    ) external returns (DataTypes.Vault memory, DataTypes.Balances memory);

    /// @dev Reduce debt and collateral from a vault, ignoring collateralization checks.
    function slurp(
        bytes12 vaultId,
        uint128 ink,
        uint128 art
    ) external returns (DataTypes.Balances memory);

    // ==== Helpers ====

    /// @dev Convert a debt amount for a series from base to fyToken terms.
    /// @notice Think about rounding if using, since we are dividing.
    function debtFromBase(bytes6 seriesId, uint128 base)
        external
        returns (uint128 art);

    /// @dev Convert a debt amount for a series from fyToken to base terms
    function debtToBase(bytes6 seriesId, uint128 art)
        external
        returns (uint128 base);

    // ==== Accounting ====

    /// @dev Record the borrowing rate at maturity for a series
    function mature(bytes6 seriesId) external;

    /// @dev Retrieve the rate accrual since maturity, maturing if necessary.
    function accrual(bytes6 seriesId) external returns (uint256);

    /// @dev Return the collateralization level of a vault. It will be negative if undercollateralized.
    function level(bytes12 vaultId) external returns (int256);
}

File 25 of 29 : ILadle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../Router.sol";
import "./IJoin.sol";
import "./ICauldron.sol";
import "./IFYToken.sol";
import "./IOracle.sol";
import "@yield-protocol/utils-v2/contracts/interfaces/IWETH9.sol";
import "@yield-protocol/yieldspace-tv/src/interfaces/IPool.sol";

interface ILadle {
    function tokens(address) 
        external view 
        returns (bool);

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

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

    function joins(bytes6) 
        external view 
        returns (IJoin);

    function pools(bytes6) 
        external view 
        returns (address);

    function cauldron() 
        external view
         returns(ICauldron);
    
    function router() 
        external view
         returns(Router);
    
    function weth() 
        external view
         returns(IWETH9);
    
    function borrowingFee() 
        external view
         returns(uint256);
    
    // ---- Administration ----

    /// @dev Add or remove an integration.
    function addIntegration(address integration, bool set)
        external;

    /// @dev Add or remove a token that the Ladle can call `transfer` or `permit` on.
    function addToken(address token, bool set)
        external;


    /// @dev Add a new Join for an Asset, or replace an existing one for a new one.
    /// There can be only one Join per Asset. Until a Join is added, no tokens of that Asset can be posted or withdrawn.
    function addJoin(bytes6 assetId, IJoin join)
        external;

    /// @dev Add a new Pool for a Series, or replace an existing one for a new one.
    /// There can be only one Pool per Series. Until a Pool is added, it is not possible to borrow Base.
    function addPool(bytes6 seriesId, IPool pool)
        external;

    /// @dev Add or remove a module.
    /// @notice Treat modules as you would Ladle upgrades. Modules have unrestricted access to the Ladle
    /// storage, and can wreak havoc easily.
    /// Modules must not do any changes to any vault (owner, seriesId, ilkId) because of vault caching.
    /// Modules must not be contracts that can self-destruct because of `moduleCall`.
    /// Modules can't use `msg.value` because of `batch`.
    function addModule(address module, bool set)
        external;

    /// @dev Set the fee parameter
    function setFee(uint256 fee)
        external;

    // ---- Call management ----

    /// @dev Allows batched call to self (this contract).
    /// @param calls An array of inputs for each call.
    function batch(bytes[] calldata calls)
        external
        returns(bytes[] memory results);

    /// @dev Allow users to route calls to a contract, to be used with batch
    function route(address integration, bytes calldata data)
        external
        returns (bytes memory result);

    /// @dev Allow users to use functionality coded in a module, to be used with batch
    function moduleCall(address module, bytes calldata data)
        external
        returns (bytes memory result);

    // ---- Token management ----

    /// @dev Execute an ERC2612 permit for the selected token
    function forwardPermit(IERC2612 token, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
        external;

    /// @dev Execute a Dai-style permit for the selected token
    function forwardDaiPermit(IERC20 token, address spender, uint256 nonce, uint256 deadline, bool allowed, uint8 v, bytes32 r, bytes32 s)
        external;

    /// @dev Allow users to trigger a token transfer from themselves to a receiver through the ladle, to be used with batch
    function transfer(IERC20 token, address receiver, uint128 wad)
        external;

    /// @dev Retrieve any token in the Ladle
    function retrieve(IERC20 token, address to) 
        external
        returns (uint256 amount);

    /// @dev Accept Ether, wrap it and forward it to the WethJoin
    /// This function should be called first in a batch, and the Join should keep track of stored reserves
    /// Passing the id for a join that doesn't link to a contract implemnting IWETH9 will fail
    function joinEther(bytes6 etherId)
        external
        returns (uint256 ethTransferred);

    /// @dev Unwrap Wrapped Ether held by this Ladle, and send the Ether
    /// This function should be called last in a batch, and the Ladle should have no reason to keep an WETH balance
    function exitEther(address to)
        external
        returns (uint256 ethTransferred);

    // ---- Vault management ----

    /// @dev Create a new vault, linked to a series (and therefore underlying) and a collateral
    function build(bytes6 seriesId, bytes6 ilkId, uint8 salt)
        external virtual
        returns(bytes12, DataTypes.Vault memory);

    /// @dev Change a vault series or collateral.
    function tweak(bytes12 vaultId_, bytes6 seriesId, bytes6 ilkId)
        external
        returns(DataTypes.Vault memory vault);

    /// @dev Give a vault to another user.
    function give(bytes12 vaultId_, address receiver)
        external
        returns(DataTypes.Vault memory vault);

    /// @dev Destroy an empty vault. Used to recover gas costs.
    function destroy(bytes12 vaultId_)
        external;

    // ---- Asset and debt management ----

    /// @dev Move collateral and debt between vaults.
    function stir(bytes12 from, bytes12 to, uint128 ink, uint128 art)
        external;

    /// @dev Add collateral and borrow from vault, pull assets from and push borrowed asset to user
    /// Or, repay to vault and remove collateral, pull borrowed asset from and push assets to user
    /// Borrow only before maturity.
    function pour(bytes12 vaultId_, address to, int128 ink, int128 art)
        external;

    /// @dev Add collateral and borrow from vault, so that a precise amount of base is obtained by the user.
    /// The base is obtained by borrowing fyToken and buying base with it in a pool.
    /// Only before maturity.
    function serve(bytes12 vaultId_, address to, uint128 ink, uint128 base, uint128 max)
        external
        returns (uint128 art);

    /// @dev Repay vault debt using underlying token at a 1:1 exchange rate, without trading in a pool.
    /// It can add or remove collateral at the same time.
    /// The debt to repay is denominated in fyToken, even if the tokens pulled from the user are underlying.
    /// The debt to repay must be entered as a negative number, as with `pour`.
    /// Debt cannot be acquired with this function.
    function close(bytes12 vaultId_, address to, int128 ink, int128 art)
        external
        returns (uint128 base);

    /// @dev Repay debt by selling base in a pool and using the resulting fyToken
    /// The base tokens need to be already in the pool, unaccounted for.
    /// Only before maturity. After maturity use close.
    function repay(bytes12 vaultId_, address to, int128 ink, uint128 min)
        external
        returns (uint128 art);

    /// @dev Repay all debt in a vault by buying fyToken from a pool with base.
    /// The base tokens need to be already in the pool, unaccounted for. The surplus base will be returned to msg.sender.
    /// Only before maturity. After maturity use close.
    function repayVault(bytes12 vaultId_, address to, int128 ink, uint128 max)
        external
        returns (uint128 base);

    /// @dev Change series and debt of a vault.
    function roll(bytes12 vaultId_, bytes6 newSeriesId, uint8 loan, uint128 max)
        external
        returns (DataTypes.Vault memory vault, uint128 newDebt);

    // ---- Ladle as a token holder ----

    /// @dev Use fyToken in the Ladle to repay debt. Return unused fyToken to `to`.
    /// Return as much collateral as debt was repaid, as well. This function is only used when
    /// removing liquidity added with "Borrow and Pool", so it's safe to assume the exchange rate
    /// is 1:1. If used in other contexts, it might revert, which is fine.
    function repayFromLadle(bytes12 vaultId_, address to)
        external
        returns (uint256 repaid);

    /// @dev Use base in the Ladle to repay debt. Return unused base to `to`.
    /// Return as much collateral as debt was repaid, as well. This function is only used when
    /// removing liquidity added with "Borrow and Pool", so it's safe to assume the exchange rate
    /// is 1:1. If used in other contexts, it might revert, which is fine.
    function closeFromLadle(bytes12 vaultId_, address to)
        external
        returns (uint256 repaid);

    /// @dev Allow users to redeem fyToken, to be used with batch.
    /// If 0 is passed as the amount to redeem, it redeems the fyToken balance of the Ladle instead.
    function redeem(bytes6 seriesId, address to, uint256 wad)
        external
        returns (uint256);
}

File 26 of 29 : DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IFYToken.sol";
import "./IOracle.sol";

library DataTypes {
    // ======== Cauldron data types ========
    struct Series {
        IFYToken fyToken; // Redeemable token for the series.
        bytes6 baseId; // Asset received on redemption.
        uint32 maturity; // Unix time at which redemption becomes possible.
        // bytes2 free
    }

    struct Debt {
        uint96 max; // Maximum debt accepted for a given underlying, across all series
        uint24 min; // Minimum debt accepted for a given underlying, across all series
        uint8 dec; // Multiplying factor (10**dec) for max and min
        uint128 sum; // Current debt for a given underlying, across all series
    }

    struct SpotOracle {
        IOracle oracle; // Address for the spot price oracle
        uint32 ratio; // Collateralization ratio to multiply the price for
        // bytes8 free
    }

    struct Vault {
        address owner;
        bytes6 seriesId; // Each vault is related to only one series, which also determines the underlying.
        bytes6 ilkId; // Asset accepted as collateral
    }

    struct Balances {
        uint128 art; // Debt amount
        uint128 ink; // Collateral amount
    }

    // ======== Witch data types ========
    struct Auction {
        address owner;
        uint32 start;
        bytes6 baseId; // We cache the baseId here
        uint128 ink;
        uint128 art;
        address auctioneer;
        bytes6 ilkId; // We cache the ilkId here
        bytes6 seriesId; // We cache the seriesId here
    }

    struct Line {
        uint32 duration; // Time that auctions take to go to minimal price and stay there
        uint64 vaultProportion; // Proportion of the vault that is available each auction (1e18 = 100%)
        uint64 collateralProportion; // Proportion of collateral that is sold at auction start (1e18 = 100%)
    }

    struct Limits {
        uint128 max; // Maximum concurrent auctioned collateral
        uint128 sum; // Current concurrent auctioned collateral
    }
}

File 27 of 29 : Router.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.13;
import "@yield-protocol/utils-v2/contracts/utils/RevertMsgExtractor.sol";
import "@yield-protocol/utils-v2/contracts/utils/IsContract.sol";


/// @dev Router forwards calls between two contracts, so that any permissions
/// given to the original caller are stripped from the call.
/// This is useful when implementing generic call routing functions on contracts
/// that might have ERC20 approvals or AccessControl authorizations.
contract Router {
    using IsContract for address;

    address immutable public owner;

    constructor () {
        owner = msg.sender;
    }

    /// @dev Allow users to route calls to a pool, to be used with batch
    function route(address target, bytes calldata data)
        external payable
        returns (bytes memory result)
    {
        require(msg.sender == owner, "Only owner");
        require(target.isContract(), "Target is not a contract");
        bool success;
        (success, result) = target.call(data);
        if (!success) revert(RevertMsgExtractor.getRevertMsg(result));
    }
}

File 28 of 29 : IWETH9.sol
// SPDX-License-Identifier: MIT
import "../token/IERC20.sol";

pragma solidity ^0.8.0;


interface IWETH9 is IERC20 {
    event  Deposit(address indexed dst, uint wad);
    event  Withdrawal(address indexed src, uint wad);

    function deposit() external payable;
    function withdraw(uint wad) external;
}

File 29 of 29 : IsContract.sol
// SPDX-License-Identifier: MIT
// Taken from Address.sol from OpenZeppelin.
pragma solidity ^0.8.0;


library IsContract {
  /// @dev Returns true if `account` is a contract.
  function isContract(address account) internal view returns (bool) {
      // This method relies on extcodesize, which returns 0 for contracts in
      // construction, since the code is only stored at the end of the
      // constructor execution.
      return account.code.length > 0;
  }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "@yield-protocol/utils-v2/contracts/token/SafeERC20Namer.sol": {
      "SafeERC20Namer": "0x39bb9cBe0221D769E30bD08d185842065BcE1706"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"contract IFYToken","name":"fyToken_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"claimed","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpTokenDivested","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseObtained","type":"uint256"}],"name":"Divested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpTokenDivested","type":"uint256"}],"name":"Drained","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpTokenDivested","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseObtained","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fyTokenObtained","type":"uint256"}],"name":"Ejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"baseInvested","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpTokensObtained","type":"uint256"}],"name":"Invested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"accumulated","type":"uint256"}],"name":"RewardsPerTokenUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"start","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"end","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"RewardsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"token","type":"address"}],"name":"RewardsTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"role","type":"bytes4"},{"indexed":true,"internalType":"bytes4","name":"newAdminRole","type":"bytes4"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"role","type":"bytes4"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"role","type":"bytes4"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"soldFYToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"returnedBase","type":"uint256"}],"name":"SoldFYToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"userRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paidRewardPerToken","type":"uint256"}],"name":"UserRewardsUpdated","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCK","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCK8605463013","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROOT","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROOT4146650865","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"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":"wad","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"guy","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"base","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseCached","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"poolTokensObtained","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burnDivested","outputs":[{"internalType":"uint256","name":"baseObtained","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPool","name":"pool_","type":"address"},{"internalType":"uint256","name":"poolTokens","type":"uint256"}],"name":"burnPoolTokens","outputs":[{"internalType":"uint256","name":"baseReceived","type":"uint256"},{"internalType":"uint256","name":"fyTokenReceived","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fyTokenTo","type":"address"},{"internalType":"address","name":"baseTo","type":"address"}],"name":"buyFYToken","outputs":[{"internalType":"uint256","name":"soldFYToken","type":"uint256"},{"internalType":"uint256","name":"returnedBase","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[{"internalType":"uint256","name":"claiming","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deploymentChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"divest","outputs":[{"internalType":"uint256","name":"baseObtained","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eject","outputs":[{"internalType":"uint256","name":"baseReceived","type":"uint256"},{"internalType":"uint256","name":"fyTokenReceived","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fyToken","outputs":[{"internalType":"contract IFYToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fyTokenCached","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseBalance","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFYTokenBalance","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4[]","name":"roles","type":"bytes4[]"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"init","outputs":[{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPool","name":"pool_","type":"address"}],"name":"invest","outputs":[{"internalType":"uint256","name":"poolTokensObtained","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"}],"name":"lockRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maturity","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"baseIn","type":"uint256"},{"internalType":"uint256","name":"fyTokenIn","type":"uint256"},{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mintDivested","outputs":[{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract IPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolCached","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"remit","outputs":[{"internalType":"uint256","name":"claiming","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"restart","outputs":[{"internalType":"uint256","name":"baseIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4[]","name":"roles","type":"bytes4[]"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint128","name":"accumulated","type":"uint128"},{"internalType":"uint128","name":"checkpoint","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerToken","outputs":[{"internalType":"uint128","name":"accumulated","type":"uint128"},{"internalType":"uint32","name":"lastUpdated","type":"uint32"},{"internalType":"uint96","name":"rate","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPeriod","outputs":[{"internalType":"uint32","name":"start","type":"uint32"},{"internalType":"uint32","name":"end","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"start","type":"uint32"},{"internalType":"uint32","name":"end","type":"uint32"},{"internalType":"uint96","name":"rate","type":"uint96"}],"name":"setRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"rewardsToken_","type":"address"}],"name":"setRewardsToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"},{"internalType":"bytes4","name":"adminRole","type":"bytes4"}],"name":"setRoleAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"enum Strategy.State","name":"","type":"uint8"}],"stateMutability":"view","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":"dst","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ts","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]

610120604052600360e0908152623f3f3f60e81b610100526004906200002690826200056e565b506040805180820190915260038152623f3f3f60e81b60208201526005906200005090826200056e565b506006805460ff191660121790557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c96080523480156200008f57600080fd5b50604051620046a0380380620046a0833981016040819052620000b2916200070a565b806001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200011791906200078a565b6040516323b95ceb60e21b81526001600160a01b03831660048201528290859085907339bb9cbe0221d769e30bd08d185842065bce170690638ee573ac90602401602060405180830381865af415801562000176573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200019c9190620007b1565b828282828282620001af600033620002dd565b620001c36001600160e01b03198062000375565b6004620001d184826200056e565b506005620001e083826200056e565b506006805460ff191660ff9290921691909117905550504660c0819052620002089062000413565b60a0525050600c80546001600160a01b039788166001600160a01b031991821617909155600d80549789169790911687179055505060408051636f307dc360e01b81529051636f307dc39450600480830194506020935090918290030181865afa1580156200027b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002a191906200078a565b600c80546001600160a01b0319166001600160a01b0392909216919091179055620002d463066ad14f60e21b30620002dd565b50505062000854565b6001600160e01b031982166000908152602081815260408083206001600160a01b038516845290915290205460ff1662000371576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916600117905551339391927fe6231789d19137da31d0550f4ba9ee379020a8cfb64cb79bf1790c996d2e616591a45b5050565b6001600160e01b03198116620003a7836001600160e01b03191660009081526020819052604090206001015460e01b90565b6001600160e01b0319161462000371576001600160e01b0319828116600081815260208190526040808220600101805463ffffffff191660e087901c17905551928416927fd348e2220a50b4500ec353f6e802d2f14dd1b5d6786148fd1bbcc570bf92d4739190a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6004604051620004479190620007d6565b60408051918290038220828201825260018352603160f81b602093840152815180840194909452838201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606084015260808301949094523060a0808401919091528451808403909101815260c09092019093528051920191909120919050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620004f457607f821691505b6020821081036200051557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200056957600081815260208120601f850160051c81016020861015620005445750805b601f850160051c820191505b81811015620005655782815560010162000550565b5050505b505050565b81516001600160401b038111156200058a576200058a620004c9565b620005a2816200059b8454620004df565b846200051b565b602080601f831160018114620005da5760008415620005c15750858301515b600019600386901b1c1916600185901b17855562000565565b600085815260208120601f198616915b828110156200060b57888601518255948401946001909101908401620005ea565b50858210156200062a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f8301126200064c57600080fd5b81516001600160401b0380821115620006695762000669620004c9565b604051601f8301601f19908116603f01168101908282118183101715620006945762000694620004c9565b81604052838152602092508683858801011115620006b157600080fd5b600091505b83821015620006d55785820183015181830184015290820190620006b6565b83821115620006e75760008385830101525b9695505050505050565b6001600160a01b03811681146200070757600080fd5b50565b6000806000606084860312156200072057600080fd5b83516001600160401b03808211156200073857600080fd5b62000746878388016200063a565b945060208601519150808211156200075d57600080fd5b506200076c868287016200063a565b92505060408401516200077f81620006f1565b809150509250925092565b6000602082840312156200079d57600080fd5b8151620007aa81620006f1565b9392505050565b600060208284031215620007c457600080fd5b815160ff81168114620007aa57600080fd5b6000808354620007e681620004df565b60018281168015620008015760018114620008175762000848565b60ff198416875282151583028701945062000848565b8760005260208060002060005b858110156200083f5781548a82015290840190820162000824565b50505082870194505b50929695505050505050565b60805160a05160c051613e00620008a0600039600081816107ac0152818161119b01526122d90152600081816111d1015261230e0152600081816104e401526122500152613e006000f3fe608060405234801561001057600080fd5b506004361061031f5760003560e01c806370a08231116101a9578063c19d93fb116100ef578063dd3633711161009d578063dd36337114610777578063dd62ed3e14610828578063de02cde714610861578063de320cc114610874578063e86d60bf14610777578063effae35314610887578063f8f800171461089a578063ffffffff146106ee57600080fd5b8063c19d93fb14610786578063cd0d0096146107a7578063d1af0c7d146107ce578063d505accf146107e1578063d51c2828146107f4578063d7020d0a14610807578063dc3bfba91461081557600080fd5b8063a354f39e11610157578063a354f39e146106db578063a4f0d7d0146106ee578063a9059cbb146106fd578063ad82110f14610710578063ae93c1b514610723578063afeba11914610736578063b3f1c93d14610749578063c03edd221461077757600080fd5b806370a08231146106535780637ecebe001461067c57806382e94ac51461069c57806389afcb44146106a457806395d89b41146106b757806397f980c3146106bf5780639d5cf374146106d257600080fd5b806330adf81f1161026e57806358969ab91161021c57806358969ab9146105705780635909c12f14610324578063592db8b1146105985780635ba5e9f0146105a15780635c859956146105b4578063687f0e4c146105c75780636a627842146105da57806370641a36146105ed57600080fd5b806330adf81f146104df578063313ce567146105065780633644e5151461052557806344faded01461052d5780635001f3b51461054257806354fd4d5014610555578063559742d91461055d57600080fd5b806316f0115b116102d657806316f0115b1461041257806318160ddd1461043257806319ab453c1461043a5780631e83409a1461044d5780631ef3755d14610460578063204f83f91461046857806323b872dd1461049457806326ae2b78146104a757600080fd5b801561032457806303f9c7931461034a578063058aace11461036b57806306fdde03146103735780630700037d14610388578063095ea7b3146103dc57806310ab9432146103ff575b600080fd5b61032c600081565b6040516001600160e01b031990911681526020015b60405180910390f35b61035d6103583660046134f2565b6108a3565b604051908152602001610341565b61035d610bfe565b61037b610f03565b604051610341919061353f565b6103bc6103963660046134f2565b600b602052600090815260409020546001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610341565b6103ef6103ea366004613582565b610f91565b6040519015158152602001610341565b6103ef61040d3660046135c6565b610fa5565b600e54610425906001600160a01b031681565b60405161034191906135fd565b60015461035d565b61035d6104483660046134f2565b610fb1565b61035d61045b3660046134f2565b610ff4565b61035d611000565b600d5461047f90600160a01b900463ffffffff1681565b60405163ffffffff9091168152602001610341565b6103ef6104a2366004613611565b611177565b6009546104c29063ffffffff80821691600160201b90041682565b6040805163ffffffff938416815292909116602083015201610341565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b6006546105139060ff1681565b60405160ff9091168152602001610341565b61035d611197565b61054061053b3660046135c6565b6111f3565b005b600c54610425906001600160a01b031681565b61037b611231565b61054061056b366004613652565b61124c565b61058361057e366004613582565b61128b565b60408051928352602083019190915201610341565b61035d60115481565b61032c6105af366004613652565b6115d9565b6105836105c236600461366d565b6115e4565b6105406105d53660046135c6565b6117c4565b61035d6105e83660046134f2565b61181f565b600a54610620906001600160801b03811690600160801b810463ffffffff1690600160a01b90046001600160601b031683565b604080516001600160801b03909416845263ffffffff90921660208401526001600160601b031690820152606001610341565b61035d6106613660046134f2565b6001600160a01b031660009081526002602052604090205490565b61035d61068a3660046134f2565b60076020526000908152604090205481565b610583611936565b61035d6106b23660046134f2565b611bbe565b61037b611cf9565b61035d6106cd3660046134f2565b611d06565b61035d60105481565b6105406106e936600461369d565b611dbc565b61032c6001600160e01b031981565b6103ef61070b366004613582565b611fbb565b61054061071e36600461373b565b611fc8565b6105406107313660046137fa565b61204a565b61035d6107443660046134f2565b61207d565b61075c61075736600461382d565b612191565b60408051938452602084019290925290820152606001610341565b60405160008152602001610341565b600d5461079a90600160c01b900460ff1681565b6040516103419190613889565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b600854610425906001600160a01b031681565b6105406107ef3660046138b1565b6121e4565b61035d6108023660046134f2565b612453565b61075c61031f36600461382d565b600d54610425906001600160a01b031681565b61035d61083636600461366d565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61054061086f3660046135c6565b61245f565b6105406108823660046134f2565b612492565b61054061089536600461373b565b61256f565b61035d600f5481565b60006108bb6000356001600160e01b031916336125e4565b6108e05760405162461bcd60e51b81526004016108d790613928565b60405180910390fd5b600d54600190600160c01b900460ff16600481111561090157610901613873565b81600481111561091357610913613873565b146109305760405162461bcd60e51b81526004016108d79061394f565b6000836001600160a01b031663dc3bfba96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109949190613982565b90506000600f549050846001600160a01b0316635001f3b56040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff9190613982565b600c546001600160a01b03908116911614610a4e5760405162461bcd60e51b815260206004820152600f60248201526e4d69736d617463686564206261736560881b60448201526064016108d7565b6000600f55600c54610a6a906001600160a01b03168683612619565b60405163066ad14f60e21b81526001600160a01b038616906319ab453c90610a969030906004016135fd565b6060604051808303816000875af1158015610ab5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad9919061399f565b6010819055600d80546001600160a01b0319166001600160a01b03878116919091179091556040805163204f83f960e01b81529051929850908916935063204f83f992506004808201926020929091908290030181865afa158015610b42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6691906139cd565b600d805463ffffffff60a01b1916600160a01b63ffffffff9390931692909202919091179055600e80546001600160a01b0319166001600160a01b038716179055610bb2600286612718565b60408051828152602081018690526001600160a01b038716917f9e9d071824fd57d062ca63fd8b786d8da48a6807eebbcb2d83f9e8d21398e28c910160405180910390a2505050919050565b600d54600090600290600160c01b900460ff166004811115610c2257610c22613873565b816004811115610c3457610c34613873565b14610c515760405162461bcd60e51b81526004016108d79061394f565b600e54600d546001600160a01b039182169181169063ffffffff600160a01b9091048116429091161015610cbd5760405162461bcd60e51b81526020600482015260136024820152724f6e6c79206166746572206d6174757269747960681b60448201526064016108d7565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190610cec9030906004016135fd565b602060405180830381865afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d91906139ea565b60006010559050610d486001600160a01b0384168483612619565b600080846001600160a01b031663d7020d0a303060006000196040518563ffffffff1660e01b8152600401610d809493929190613a03565b6060604051808303816000875af1158015610d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc3919061399f565b92509250506000846001600160a01b0316631e9a695030846040518363ffffffff1660e01b8152600401610df8929190613a2c565b6020604051808303816000875af1158015610e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3b91906139ea565b600c546040516370a0823160e01b81529192506001600160a01b0316906370a0823190610e6c9030906004016135fd565b602060405180830381865afa158015610e89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ead91906139ea565b600f55610ebb600187612718565b6001600160a01b038616600080516020613d8b83398151915285610edf8487613a5b565b6040805192835260208301829052909b500160405180910390a25050505050505090565b60048054610f1090613a73565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3c90613a73565b8015610f895780601f10610f5e57610100808354040283529160200191610f89565b820191906000526020600020905b815481529060010190602001808311610f6c57829003601f168201915b505050505081565b6000610f9e33848461293f565b9392505050565b6000610f9e83836125e4565b6000610fc96000356001600160e01b031916336125e4565b610fe55760405162461bcd60e51b81526004016108d790613928565b610fee826129a8565b92915050565b6000610fee3383612adf565b60006110186000356001600160e01b031916336125e4565b6110345760405162461bcd60e51b81526004016108d790613928565b600d54600490600160c01b900460ff168181111561105457611054613873565b81600481111561106657611066613873565b146110835760405162461bcd60e51b81526004016108d79061394f565b600c546040516370a0823160e01b81526000916001600160a01b0316906370a08231906110b49030906004016135fd565b602060405180830381865afa1580156110d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f591906139ea565b925082600f8190551161113f5760405162461bcd60e51b8152602060048201526012602482015271139bc818985cd9481d1bc81c995cdd185c9d60721b60448201526064016108d7565b6111496001612b87565b6040805160008082526020820181905291600080516020613d8b833981519152910160405180910390a25090565b60006111838483612bec565b5061118f848484612c95565b949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146111ce576111c946612cbe565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b8161120661120082612d4f565b336125e4565b6112225760405162461bcd60e51b81526004016108d790613aa7565b61122c8383612d71565b505050565b6040805180820190915260018152603160f81b602082015290565b8061125961120082612d4f565b6112755760405162461bcd60e51b81526004016108d790613aa7565b611287826001600160e01b0319612de0565b5050565b6000803330146112cc5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b60448201526064016108d7565b6112e06001600160a01b0385168585612619565b600c546040516370a0823160e01b81526000916001600160a01b0316906370a08231906113119030906004016135fd565b602060405180830381865afa15801561132e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135291906139ea565b600d546040516370a0823160e01b81529192506000916001600160a01b03909116906370a08231906113889030906004016135fd565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906139ea565b604051636b81068560e11b81529091506001600160a01b0387169063d7020d0a90611401903090819060009060001990600401613a03565b6060604051808303816000875af1158015611420573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611444919061399f565b600c546040516370a0823160e01b815292975090955086925084916001600160a01b03909116906370a082319061147f9030906004016135fd565b602060405180830381865afa15801561149c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c091906139ea565b6114ca9190613acb565b1461150c5760405162461bcd60e51b81526020600482015260126024820152714275726e206661696c6564202d206261736560701b60448201526064016108d7565b600d546040516370a0823160e01b8152849183916001600160a01b03909116906370a08231906115409030906004016135fd565b602060405180830381865afa15801561155d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158191906139ea565b61158b9190613acb565b146115d05760405162461bcd60e51b8152602060048201526015602482015274213ab937103330b4b632b2101690333caa37b5b2b760591b60448201526064016108d7565b50509250929050565b6000610fee82612d4f565b6000806003600d60189054906101000a900460ff16600481111561160a5761160a613873565b81600481111561161c5761161c613873565b146116395760405162461bcd60e51b81526004016108d79061394f565b600d54600f54601154600c546040516370a0823160e01b81526001600160a01b039485169460009285929116906370a082319061167a9030906004016135fd565b602060405180830381865afa158015611697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bb91906139ea565b6116c59190613acb565b90508181116116d6578060006116e1565b816116e18183613acb565b90975095506116f08784613a5b565b600f556116fd8783613acb565b601181905591506000829003611742576117176001612b87565b6040805160008082526020820181905291600080516020613d8b833981519152910160405180910390a25b6117566001600160a01b0385168a89612619565b8087101561177f5761177f8861176c8984613acb565b600c546001600160a01b03169190612619565b60408051888152602081018890527fc507be2ec3f5cf464d2bb8665d035a25c6156a546684fb273e1fa95906cd7fd1910160405180910390a150505050509250929050565b6001600160a01b03811633146118155760405162461bcd60e51b81526020600482015260166024820152752932b737bab731b29037b7363c903337b91039b2b63360511b60448201526064016108d7565b6112878282612d71565b600d54600090600290600160c01b900460ff16600481111561184357611843613873565b81600481111561185557611855613873565b146118725760405162461bcd60e51b81526004016108d79061394f565b600e546010546040516370a0823160e01b81526001600160a01b0390921691600090829084906370a08231906118ac9030906004016135fd565b602060405180830381865afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed91906139ea565b6118f79190613acb565b90506119038183613a5b565b6010556001548290611916908390613ae2565b6119209190613b01565b945061192c8686612e5f565b5050505050919050565b60008061194f6000356001600160e01b031916336125e4565b61196b5760405162461bcd60e51b81526004016108d790613928565b600d54600290600160c01b900460ff16600481111561198c5761198c613873565b81600481111561199e5761199e613873565b146119bb5760405162461bcd60e51b81526004016108d79061394f565b600e546040516370a0823160e01b81526001600160a01b039091169060009082906370a08231906119f09030906004016135fd565b602060405180830381865afa158015611a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3191906139ea565b60006010556040516358969ab960e01b815290915030906358969ab990611a5e9085908590600401613a2c565b60408051808303816000875af1925050508015611a98575060408051601f3d908101601f19168201909252611a9591810190613b23565b60015b611b0357611ab06001600160a01b0383163383612619565b611abb600483612718565b816001600160a01b03167fb2559daa129ad136aac2133ac6a0c75920abbef7d6663a017a94e181b13786c382604051611af691815260200190565b60405180910390a2611bb7565b600f8290556011819055909550935084848015611b7657611b25600385612718565b60408051848152602081018990529081018790526001600160a01b038516907fa4934663617b597bfe6baf57cd7218dfe65e68ad58d417b92ed0bce047cf562a9060600160405180910390a2611bb4565b611b81600185612718565b60408051848152602081018990526001600160a01b03861691600080516020613d8b833981519152910160405180910390a25b50505b5050509091565b600d54600090600290600160c01b900460ff166004811115611be257611be2613873565b816004811115611bf457611bf4613873565b14611c115760405162461bcd60e51b81526004016108d79061394f565b600e54601054600154306000818152600260205260409020546001600160a01b039094169390611c419082612e7d565b50600e546040516370a0823160e01b8152839183916001600160a01b03909116906370a0823190611c769030906004016135fd565b602060405180830381865afa158015611c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb791906139ea565b611cc19190613ae2565b611ccb9190613b01565b9550611ce16001600160a01b0385168888612619565b611ceb8684613acb565b601055509395945050505050565b60058054610f1090613a73565b600d54600090600190600160c01b900460ff166004811115611d2a57611d2a613873565b816004811115611d3c57611d3c613873565b14611d595760405162461bcd60e51b81526004016108d79061394f565b600f5430600090815260026020526040902054600154611d798284613ae2565b611d839190613b01565b9350611d8f8483613acb565b600f55611d9c3082612e7d565b50600c54611db4906001600160a01b03168686612619565b505050919050565b611dd26000356001600160e01b031916336125e4565b611dee5760405162461bcd60e51b81526004016108d790613928565b8163ffffffff168363ffffffff161115611e3c5760405162461bcd60e51b815260206004820152600f60248201526e125b98dbdc9c9958dd081a5b9c1d5d608a1b60448201526064016108d7565b6008546001600160a01b0316611e8c5760405162461bcd60e51b815260206004820152601560248201527414995dd85c991cc81d1bdad95b881b9bdd081cd95d605a1b60448201526064016108d7565b60095463ffffffff16611e9e42612e9b565b63ffffffff161080611ecc5750600954600160201b900463ffffffff16611ec442612e9b565b63ffffffff16115b611f0a5760405162461bcd60e51b815260206004820152600f60248201526e4f6e676f696e67207265776172647360881b60448201526064016108d7565b611f12612ec5565b6009805463ffffffff85811667ffffffffffffffff199092168217600160201b91861691820217909255600a80546001600160801b0316600160801b83026001600160a01b031617600160a01b6001600160601b03861690810291909117909155604080519283526020830193909352918101919091527f95efd8a2a0aa591f48fd9673cf5d13c2150ca7a1fe1cbe438dd3f0ae470646639060600160405180910390a1505050565b6000610f9e338484612c95565b60005b825181101561122c57611ff9611200848381518110611fec57611fec613b47565b6020026020010151612d4f565b6120155760405162461bcd60e51b81526004016108d790613aa7565b61203883828151811061202a5761202a613b47565b602002602001015183612d71565b8061204281613b5d565b915050611fcb565b8161205761120082612d4f565b6120735760405162461bcd60e51b81526004016108d790613aa7565b61122c8383612de0565b600d54600090600190600160c01b900460ff1660048111156120a1576120a1613873565b8160048111156120b3576120b3613873565b146120d05760405162461bcd60e51b81526004016108d79061394f565b600f54600c546040516370a0823160e01b815260009183916001600160a01b03909116906370a08231906121089030906004016135fd565b602060405180830381865afa158015612125573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214991906139ea565b6121539190613acb565b905061215f8183613a5b565b600f556001548290612172908390613ae2565b61217c9190613b01565b93506121888585612e5f565b50505050919050565b60008060006121ac6000356001600160e01b031916336125e4565b6121c85760405162461bcd60e51b81526004016108d790613928565b600091506121d5336129a8565b90508092509450945094915050565b428410156122345760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016108d7565b6001600160a01b038716600090815260076020526040812080547f0000000000000000000000000000000000000000000000000000000000000000918a918a918a91908661228183613b5d565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060007f0000000000000000000000000000000000000000000000000000000000000000461461230c5761230746612cbe565b61232e565b7f00000000000000000000000000000000000000000000000000000000000000005b60405161190160f01b602082015260228101919091526042810183905260620160408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa1580156123b9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906123ef5750896001600160a01b0316816001600160a01b0316145b61243b5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016108d7565b6124468a8a8a61293f565b5050505050505050505050565b6000610fee8283612adf565b8161246c61120082612d4f565b6124885760405162461bcd60e51b81526004016108d790613aa7565b61122c838361309e565b6124a86000356001600160e01b031916336125e4565b6124c45760405162461bcd60e51b81526004016108d790613928565b6008546001600160a01b0316156125195760405162461bcd60e51b815260206004820152601960248201527814995dd85c991cc81d1bdad95b88185b1c9958591e481cd95d603a1b60448201526064016108d7565b600880546001600160a01b0319166001600160a01b0383161790556040517f45a4cbe003c343d60028e5acd63eecf588647b0eb369733afa2c0482180d4f74906125649083906135fd565b60405180910390a150565b60005b825181101561122c57612593611200848381518110611fec57611fec613b47565b6125af5760405162461bcd60e51b81526004016108d790613aa7565b6125d28382815181106125c4576125c4613b47565b60200260200101518361309e565b806125dc81613b5d565b915050612572565b6001600160e01b031982166000908152602081815260408083206001600160a01b038516845290915290205460ff1692915050565b600080846001600160a01b031663a9059cbb60e01b8585604051602401612641929190613a2c565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161267f9190613b76565b6000604051808303816000865af19150503d80600081146126bc576040519150601f19603f3d011682016040523d82523d6000602084013e6126c1565b606091505b50915091508180156126eb5750805115806126eb5750808060200190518101906126eb9190613b92565b612711576126f88161310f565b60405162461bcd60e51b81526004016108d7919061353f565b5050505050565b600282600481111561272c5761272c613873565b0361285b57600e80546001600160a01b0319166001600160a01b0383169081179091556040805163dc3bfba960e01b8152905163dc3bfba9916004808201926020929091908290030181865afa15801561278a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ae9190613982565b600d60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550806001600160a01b031663204f83f96040518163ffffffff1660e01b8152600401602060405180830381865afa158015612812573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283691906139cd565b600d60146101000a81548163ffffffff021916908363ffffffff160217905550612911565b600182600481111561286f5761286f613873565b0361289957600d80546001600160c01b0319169055600e80546001600160a01b0319169055612911565b60038260048111156128ad576128ad613873565b036128d757600d805463ffffffff60a01b19169055600e80546001600160a01b0319169055612911565b60048260048111156128eb576128eb613873565b0361291157600d805463ffffffff60a01b19169055600e80546001600160a01b03191690555b600d805483919060ff60c01b1916600160c01b83600481111561293657612936613873565b02179055505050565b6001600160a01b03838116600081815260036020908152604080832094871680845294825280832086905551858152919392917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a35060019392505050565b600d546000908190600160c01b900460ff1660048111156129cb576129cb613873565b8160048111156129dd576129dd613873565b146129fa5760405162461bcd60e51b81526004016108d79061394f565b600d80546001600160a01b0319169055600c546040516370a0823160e01b81526001600160a01b03909116906370a0823190612a3a9030906004016135fd565b602060405180830381865afa158015612a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7b91906139ea565b600f819055915081612ac45760405162461bcd60e51b81526020600482015260126024820152712737ba1032b737bab3b4103130b9b29034b760711b60448201526064016108d7565b612ace8383612e5f565b50612ad96001612b87565b50919050565b6000612ae9612ec5565b612af28361316e565b6001600160a01b038085166000908152600b6020526040902080546001600160801b03191690556008546001600160801b03929092169250612b3691168383612619565b604080516001600160a01b038086168252841660208201529081018290527ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926839060600160405180910390a192915050565b6002816004811115612b9b57612b9b613873565b03612bde5760405162461bcd60e51b8152602060048201526013602482015272135d5cdd081c1c9bdd9a59194818481c1bdbdb606a1b60448201526064016108d7565b612be9816000612718565b50565b60006001600160a01b0383163314612c8c576001600160a01b03831660009081526003602090815260408083203384529091529020546000198114612c8a5782811015612c7b5760405162461bcd60e51b815260206004820152601c60248201527f45524332303a20496e73756666696369656e7420617070726f76616c0000000060448201526064016108d7565b612c88843385840361293f565b505b505b50600192915050565b6000612c9f612ec5565b612ca88461316e565b50612cb28361316e565b5061118f8484846132de565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6004604051612cf09190613bb4565b6040518091039020612d00611231565b80516020918201206040805192830194909452928101919091526060810191909152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6001600160e01b03191660009081526020819052604090206001015460e01b90565b612d7b82826125e4565b15611287576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339391927f4ddc7b757e7bdd7254a9cd39452d307a52761bc824625c6a33104a075d8099e691a45050565b6001600160e01b03198116612df483612d4f565b6001600160e01b03191614611287576001600160e01b0319828116600081815260208190526040808220600101805463ffffffff191660e087901c17905551928416927fd348e2220a50b4500ec353f6e802d2f14dd1b5d6786148fd1bbcc570bf92d4739190a35050565b6000612e69612ec5565b612e728361316e565b50610f9e838361338b565b6000612e87612ec5565b612e908361316e565b50610f9e8383613412565b600063ffffffff821115612ec15760405162461bcd60e51b81526004016108d790613c53565b5090565b60408051606081018252600a546001600160801b0381168252600160801b810463ffffffff908116602080850191909152600160a01b9092046001600160601b0316838501528351808501909452600954808216808652600160201b9091049091169184019190915260015491929190612f3e42612e9b565b63ffffffff161015612f4f57505050565b6000612f67612f5d42612e9b565b8460200151613492565b90506000846020015182612f7b9190613c7a565b63ffffffff16905080600003612f92575050505050565b8215612ff857612fec8386604001516001600160601b031683670de0b6b3a7640000612fbe9190613ae2565b612fc89190613ae2565b612fd29190613b01565b8651612fe791906001600160801b0316613a5b565b6134b4565b6001600160801b031685525b63ffffffff8216602086018190528551600a80546040808a01516001600160601b0316600160a01b026001600160a01b03600160801b9096026001600160a01b03199093166001600160801b03861617929092179490941617905590517fe972555b20cae8150e291bb40efce3ef4e3ed6b6b2c39c029346600e95469d489161308f916001600160801b0391909116815260200190565b60405180910390a15050505050565b6130a882826125e4565b611287576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916600117905551339391927fe6231789d19137da31d0550f4ba9ee379020a8cfb64cb79bf1790c996d2e616591a45050565b606060448251101561315457505060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c79000000602082015290565b60048201915081806020019051810190610fee9190613c9f565b6001600160a01b0381166000908152600b602090815260408083208151808301835290546001600160801b038082168352600160801b9182900481168386019081528451606081018652600a5492831680825293830463ffffffff1696810196909652600160a01b9091046001600160601b031693850193909352915190929161325191670de0b6b3a7640000916132069190613d33565b6001600160a01b038716600090815260026020526040902054613232916001600160801b031690613ae2565b61323c9190613b01565b8351612fe791906001600160801b0316613a5b565b6001600160801b0390811683528151811660208085019182526001600160a01b0387166000818152600b835260409081902087519451948616600160801b95909616948502861790558051918252918101939093528201527f5b9aaf4cc5141c090a75f8b8a627863eba92df81f0c83c096350da9b79aedd049060600160405180910390a1505192915050565b6001600160a01b0383166000908152600260205260408120548211156133165760405162461bcd60e51b81526004016108d790613d53565b6001600160a01b038085166000908152600260205260408082208054869003905591851681522054613349908390613a5b565b6001600160a01b038085166000818152600260205260409081902093909355915190861690600080516020613dab833981519152906129969086815260200190565b6001600160a01b0382166000908152600260205260408120546133af908390613a5b565b6001600160a01b0384166000908152600260205260409020556001546133d6908390613a5b565b6001556040518281526001600160a01b03841690600090600080516020613dab833981519152906020015b60405180910390a350600192915050565b6001600160a01b03821660009081526002602052604081205482111561344a5760405162461bcd60e51b81526004016108d790613d53565b6001600160a01b03831660008181526002602090815260408083208054879003905560018054879003905551858152919291600080516020613dab8339815191529101613401565b60008163ffffffff168363ffffffff16106134ad5781610f9e565b5090919050565b60006001600160801b03821115612ec15760405162461bcd60e51b81526004016108d790613c53565b6001600160a01b0381168114612be957600080fd5b60006020828403121561350457600080fd5b8135610f9e816134dd565b60005b8381101561352a578181015183820152602001613512565b83811115613539576000848401525b50505050565b602081526000825180602084015261355e81604085016020870161350f565b601f01601f19169190910160400192915050565b803561357d816134dd565b919050565b6000806040838503121561359557600080fd5b82356135a0816134dd565b946020939093013593505050565b80356001600160e01b03198116811461357d57600080fd5b600080604083850312156135d957600080fd5b6135e2836135ae565b915060208301356135f2816134dd565b809150509250929050565b6001600160a01b0391909116815260200190565b60008060006060848603121561362657600080fd5b8335613631816134dd565b92506020840135613641816134dd565b929592945050506040919091013590565b60006020828403121561366457600080fd5b610f9e826135ae565b6000806040838503121561368057600080fd5b82356135e2816134dd565b63ffffffff81168114612be957600080fd5b6000806000606084860312156136b257600080fd5b83356136bd8161368b565b925060208401356136cd8161368b565b915060408401356001600160601b03811681146136e957600080fd5b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613733576137336136f4565b604052919050565b6000806040838503121561374e57600080fd5b823567ffffffffffffffff8082111561376657600080fd5b818501915085601f83011261377a57600080fd5b813560208282111561378e5761378e6136f4565b8160051b925061379f81840161370a565b82815292840181019281810190898511156137b957600080fd5b948201945b848610156137de576137cf866135ae565b825294820194908201906137be565b96506137ed9050878201613572565b9450505050509250929050565b6000806040838503121561380d57600080fd5b613816836135ae565b9150613824602084016135ae565b90509250929050565b6000806000806080858703121561384357600080fd5b843561384e816134dd565b9350602085013561385e816134dd565b93969395505050506040820135916060013590565b634e487b7160e01b600052602160045260246000fd5b60208101600583106138ab57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600080600060e0888a0312156138cc57600080fd5b87356138d7816134dd565b965060208801356138e7816134dd565b95506040880135945060608801359350608088013560ff8116811461390b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6020808252600d908201526c1058d8d95cdcc819195b9a5959609a1b604082015260600190565b6020808252601990820152784e6f7420616c6c6f77656420696e207468697320737461746560381b604082015260600190565b60006020828403121561399457600080fd5b8151610f9e816134dd565b6000806000606084860312156139b457600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156139df57600080fd5b8151610f9e8161368b565b6000602082840312156139fc57600080fd5b5051919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052601160045260246000fd5b60008219821115613a6e57613a6e613a45565b500190565b600181811c90821680613a8757607f821691505b602082108103612ad957634e487b7160e01b600052602260045260246000fd5b6020808252600a908201526927b7363c9030b236b4b760b11b604082015260600190565b600082821015613add57613add613a45565b500390565b6000816000190483118215151615613afc57613afc613a45565b500290565b600082613b1e57634e487b7160e01b600052601260045260246000fd5b500490565b60008060408385031215613b3657600080fd5b505080516020909101519092909150565b634e487b7160e01b600052603260045260246000fd5b600060018201613b6f57613b6f613a45565b5060010190565b60008251613b8881846020870161350f565b9190910192915050565b600060208284031215613ba457600080fd5b81518015158114610f9e57600080fd5b600080835481600182811c915080831680613bd057607f831692505b60208084108203613bef57634e487b7160e01b86526022600452602486fd5b818015613c035760018114613c1857613c45565b60ff1986168952841515850289019650613c45565b60008a81526020902060005b86811015613c3d5781548b820152908501908301613c24565b505084890196505b509498975050505050505050565b6020808252600d908201526c43617374206f766572666c6f7760981b604082015260600190565b600063ffffffff83811690831681811015613c9757613c97613a45565b039392505050565b600060208284031215613cb157600080fd5b815167ffffffffffffffff80821115613cc957600080fd5b818401915084601f830112613cdd57600080fd5b815181811115613cef57613cef6136f4565b613d02601f8201601f191660200161370a565b9150808252856020828501011115613d1957600080fd5b613d2a81602084016020860161350f565b50949350505050565b60006001600160801b0383811690831681811015613c9757613c97613a45565b6020808252601b908201527f45524332303a20496e73756666696369656e742062616c616e6365000000000060408201526060019056fef44b6ecb6421462dee6400bd4e3bb57864c0f428d0f7e7d49771f9fd7c30d4faddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220382e18bd88ca4c78ae5c1b146261173072576a0319019115ed2762404056dd9864736f6c634300080f0033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000124c9f7e97235fe3e35820f95d10affce4be9168000000000000000000000000000000000000000000000000000000000000001d5969656c642053747261746567792045544820364d204a756e2044656300000000000000000000000000000000000000000000000000000000000000000000095953455448364d4a440000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061031f5760003560e01c806370a08231116101a9578063c19d93fb116100ef578063dd3633711161009d578063dd36337114610777578063dd62ed3e14610828578063de02cde714610861578063de320cc114610874578063e86d60bf14610777578063effae35314610887578063f8f800171461089a578063ffffffff146106ee57600080fd5b8063c19d93fb14610786578063cd0d0096146107a7578063d1af0c7d146107ce578063d505accf146107e1578063d51c2828146107f4578063d7020d0a14610807578063dc3bfba91461081557600080fd5b8063a354f39e11610157578063a354f39e146106db578063a4f0d7d0146106ee578063a9059cbb146106fd578063ad82110f14610710578063ae93c1b514610723578063afeba11914610736578063b3f1c93d14610749578063c03edd221461077757600080fd5b806370a08231146106535780637ecebe001461067c57806382e94ac51461069c57806389afcb44146106a457806395d89b41146106b757806397f980c3146106bf5780639d5cf374146106d257600080fd5b806330adf81f1161026e57806358969ab91161021c57806358969ab9146105705780635909c12f14610324578063592db8b1146105985780635ba5e9f0146105a15780635c859956146105b4578063687f0e4c146105c75780636a627842146105da57806370641a36146105ed57600080fd5b806330adf81f146104df578063313ce567146105065780633644e5151461052557806344faded01461052d5780635001f3b51461054257806354fd4d5014610555578063559742d91461055d57600080fd5b806316f0115b116102d657806316f0115b1461041257806318160ddd1461043257806319ab453c1461043a5780631e83409a1461044d5780631ef3755d14610460578063204f83f91461046857806323b872dd1461049457806326ae2b78146104a757600080fd5b801561032457806303f9c7931461034a578063058aace11461036b57806306fdde03146103735780630700037d14610388578063095ea7b3146103dc57806310ab9432146103ff575b600080fd5b61032c600081565b6040516001600160e01b031990911681526020015b60405180910390f35b61035d6103583660046134f2565b6108a3565b604051908152602001610341565b61035d610bfe565b61037b610f03565b604051610341919061353f565b6103bc6103963660046134f2565b600b602052600090815260409020546001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610341565b6103ef6103ea366004613582565b610f91565b6040519015158152602001610341565b6103ef61040d3660046135c6565b610fa5565b600e54610425906001600160a01b031681565b60405161034191906135fd565b60015461035d565b61035d6104483660046134f2565b610fb1565b61035d61045b3660046134f2565b610ff4565b61035d611000565b600d5461047f90600160a01b900463ffffffff1681565b60405163ffffffff9091168152602001610341565b6103ef6104a2366004613611565b611177565b6009546104c29063ffffffff80821691600160201b90041682565b6040805163ffffffff938416815292909116602083015201610341565b61035d7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6006546105139060ff1681565b60405160ff9091168152602001610341565b61035d611197565b61054061053b3660046135c6565b6111f3565b005b600c54610425906001600160a01b031681565b61037b611231565b61054061056b366004613652565b61124c565b61058361057e366004613582565b61128b565b60408051928352602083019190915201610341565b61035d60115481565b61032c6105af366004613652565b6115d9565b6105836105c236600461366d565b6115e4565b6105406105d53660046135c6565b6117c4565b61035d6105e83660046134f2565b61181f565b600a54610620906001600160801b03811690600160801b810463ffffffff1690600160a01b90046001600160601b031683565b604080516001600160801b03909416845263ffffffff90921660208401526001600160601b031690820152606001610341565b61035d6106613660046134f2565b6001600160a01b031660009081526002602052604090205490565b61035d61068a3660046134f2565b60076020526000908152604090205481565b610583611936565b61035d6106b23660046134f2565b611bbe565b61037b611cf9565b61035d6106cd3660046134f2565b611d06565b61035d60105481565b6105406106e936600461369d565b611dbc565b61032c6001600160e01b031981565b6103ef61070b366004613582565b611fbb565b61054061071e36600461373b565b611fc8565b6105406107313660046137fa565b61204a565b61035d6107443660046134f2565b61207d565b61075c61075736600461382d565b612191565b60408051938452602084019290925290820152606001610341565b60405160008152602001610341565b600d5461079a90600160c01b900460ff1681565b6040516103419190613889565b61035d7f000000000000000000000000000000000000000000000000000000000000000181565b600854610425906001600160a01b031681565b6105406107ef3660046138b1565b6121e4565b61035d6108023660046134f2565b612453565b61075c61031f36600461382d565b600d54610425906001600160a01b031681565b61035d61083636600461366d565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61054061086f3660046135c6565b61245f565b6105406108823660046134f2565b612492565b61054061089536600461373b565b61256f565b61035d600f5481565b60006108bb6000356001600160e01b031916336125e4565b6108e05760405162461bcd60e51b81526004016108d790613928565b60405180910390fd5b600d54600190600160c01b900460ff16600481111561090157610901613873565b81600481111561091357610913613873565b146109305760405162461bcd60e51b81526004016108d79061394f565b6000836001600160a01b031663dc3bfba96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109949190613982565b90506000600f549050846001600160a01b0316635001f3b56040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff9190613982565b600c546001600160a01b03908116911614610a4e5760405162461bcd60e51b815260206004820152600f60248201526e4d69736d617463686564206261736560881b60448201526064016108d7565b6000600f55600c54610a6a906001600160a01b03168683612619565b60405163066ad14f60e21b81526001600160a01b038616906319ab453c90610a969030906004016135fd565b6060604051808303816000875af1158015610ab5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad9919061399f565b6010819055600d80546001600160a01b0319166001600160a01b03878116919091179091556040805163204f83f960e01b81529051929850908916935063204f83f992506004808201926020929091908290030181865afa158015610b42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6691906139cd565b600d805463ffffffff60a01b1916600160a01b63ffffffff9390931692909202919091179055600e80546001600160a01b0319166001600160a01b038716179055610bb2600286612718565b60408051828152602081018690526001600160a01b038716917f9e9d071824fd57d062ca63fd8b786d8da48a6807eebbcb2d83f9e8d21398e28c910160405180910390a2505050919050565b600d54600090600290600160c01b900460ff166004811115610c2257610c22613873565b816004811115610c3457610c34613873565b14610c515760405162461bcd60e51b81526004016108d79061394f565b600e54600d546001600160a01b039182169181169063ffffffff600160a01b9091048116429091161015610cbd5760405162461bcd60e51b81526020600482015260136024820152724f6e6c79206166746572206d6174757269747960681b60448201526064016108d7565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190610cec9030906004016135fd565b602060405180830381865afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d91906139ea565b60006010559050610d486001600160a01b0384168483612619565b600080846001600160a01b031663d7020d0a303060006000196040518563ffffffff1660e01b8152600401610d809493929190613a03565b6060604051808303816000875af1158015610d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc3919061399f565b92509250506000846001600160a01b0316631e9a695030846040518363ffffffff1660e01b8152600401610df8929190613a2c565b6020604051808303816000875af1158015610e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3b91906139ea565b600c546040516370a0823160e01b81529192506001600160a01b0316906370a0823190610e6c9030906004016135fd565b602060405180830381865afa158015610e89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ead91906139ea565b600f55610ebb600187612718565b6001600160a01b038616600080516020613d8b83398151915285610edf8487613a5b565b6040805192835260208301829052909b500160405180910390a25050505050505090565b60048054610f1090613a73565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3c90613a73565b8015610f895780601f10610f5e57610100808354040283529160200191610f89565b820191906000526020600020905b815481529060010190602001808311610f6c57829003601f168201915b505050505081565b6000610f9e33848461293f565b9392505050565b6000610f9e83836125e4565b6000610fc96000356001600160e01b031916336125e4565b610fe55760405162461bcd60e51b81526004016108d790613928565b610fee826129a8565b92915050565b6000610fee3383612adf565b60006110186000356001600160e01b031916336125e4565b6110345760405162461bcd60e51b81526004016108d790613928565b600d54600490600160c01b900460ff168181111561105457611054613873565b81600481111561106657611066613873565b146110835760405162461bcd60e51b81526004016108d79061394f565b600c546040516370a0823160e01b81526000916001600160a01b0316906370a08231906110b49030906004016135fd565b602060405180830381865afa1580156110d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f591906139ea565b925082600f8190551161113f5760405162461bcd60e51b8152602060048201526012602482015271139bc818985cd9481d1bc81c995cdd185c9d60721b60448201526064016108d7565b6111496001612b87565b6040805160008082526020820181905291600080516020613d8b833981519152910160405180910390a25090565b60006111838483612bec565b5061118f848484612c95565b949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000146146111ce576111c946612cbe565b905090565b507fdb7cb8a3ed810d276a9e12f5f1f5071f5d3773c8ab34df84c510392e1b21228090565b8161120661120082612d4f565b336125e4565b6112225760405162461bcd60e51b81526004016108d790613aa7565b61122c8383612d71565b505050565b6040805180820190915260018152603160f81b602082015290565b8061125961120082612d4f565b6112755760405162461bcd60e51b81526004016108d790613aa7565b611287826001600160e01b0319612de0565b5050565b6000803330146112cc5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b60448201526064016108d7565b6112e06001600160a01b0385168585612619565b600c546040516370a0823160e01b81526000916001600160a01b0316906370a08231906113119030906004016135fd565b602060405180830381865afa15801561132e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135291906139ea565b600d546040516370a0823160e01b81529192506000916001600160a01b03909116906370a08231906113889030906004016135fd565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906139ea565b604051636b81068560e11b81529091506001600160a01b0387169063d7020d0a90611401903090819060009060001990600401613a03565b6060604051808303816000875af1158015611420573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611444919061399f565b600c546040516370a0823160e01b815292975090955086925084916001600160a01b03909116906370a082319061147f9030906004016135fd565b602060405180830381865afa15801561149c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c091906139ea565b6114ca9190613acb565b1461150c5760405162461bcd60e51b81526020600482015260126024820152714275726e206661696c6564202d206261736560701b60448201526064016108d7565b600d546040516370a0823160e01b8152849183916001600160a01b03909116906370a08231906115409030906004016135fd565b602060405180830381865afa15801561155d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158191906139ea565b61158b9190613acb565b146115d05760405162461bcd60e51b8152602060048201526015602482015274213ab937103330b4b632b2101690333caa37b5b2b760591b60448201526064016108d7565b50509250929050565b6000610fee82612d4f565b6000806003600d60189054906101000a900460ff16600481111561160a5761160a613873565b81600481111561161c5761161c613873565b146116395760405162461bcd60e51b81526004016108d79061394f565b600d54600f54601154600c546040516370a0823160e01b81526001600160a01b039485169460009285929116906370a082319061167a9030906004016135fd565b602060405180830381865afa158015611697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bb91906139ea565b6116c59190613acb565b90508181116116d6578060006116e1565b816116e18183613acb565b90975095506116f08784613a5b565b600f556116fd8783613acb565b601181905591506000829003611742576117176001612b87565b6040805160008082526020820181905291600080516020613d8b833981519152910160405180910390a25b6117566001600160a01b0385168a89612619565b8087101561177f5761177f8861176c8984613acb565b600c546001600160a01b03169190612619565b60408051888152602081018890527fc507be2ec3f5cf464d2bb8665d035a25c6156a546684fb273e1fa95906cd7fd1910160405180910390a150505050509250929050565b6001600160a01b03811633146118155760405162461bcd60e51b81526020600482015260166024820152752932b737bab731b29037b7363c903337b91039b2b63360511b60448201526064016108d7565b6112878282612d71565b600d54600090600290600160c01b900460ff16600481111561184357611843613873565b81600481111561185557611855613873565b146118725760405162461bcd60e51b81526004016108d79061394f565b600e546010546040516370a0823160e01b81526001600160a01b0390921691600090829084906370a08231906118ac9030906004016135fd565b602060405180830381865afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed91906139ea565b6118f79190613acb565b90506119038183613a5b565b6010556001548290611916908390613ae2565b6119209190613b01565b945061192c8686612e5f565b5050505050919050565b60008061194f6000356001600160e01b031916336125e4565b61196b5760405162461bcd60e51b81526004016108d790613928565b600d54600290600160c01b900460ff16600481111561198c5761198c613873565b81600481111561199e5761199e613873565b146119bb5760405162461bcd60e51b81526004016108d79061394f565b600e546040516370a0823160e01b81526001600160a01b039091169060009082906370a08231906119f09030906004016135fd565b602060405180830381865afa158015611a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3191906139ea565b60006010556040516358969ab960e01b815290915030906358969ab990611a5e9085908590600401613a2c565b60408051808303816000875af1925050508015611a98575060408051601f3d908101601f19168201909252611a9591810190613b23565b60015b611b0357611ab06001600160a01b0383163383612619565b611abb600483612718565b816001600160a01b03167fb2559daa129ad136aac2133ac6a0c75920abbef7d6663a017a94e181b13786c382604051611af691815260200190565b60405180910390a2611bb7565b600f8290556011819055909550935084848015611b7657611b25600385612718565b60408051848152602081018990529081018790526001600160a01b038516907fa4934663617b597bfe6baf57cd7218dfe65e68ad58d417b92ed0bce047cf562a9060600160405180910390a2611bb4565b611b81600185612718565b60408051848152602081018990526001600160a01b03861691600080516020613d8b833981519152910160405180910390a25b50505b5050509091565b600d54600090600290600160c01b900460ff166004811115611be257611be2613873565b816004811115611bf457611bf4613873565b14611c115760405162461bcd60e51b81526004016108d79061394f565b600e54601054600154306000818152600260205260409020546001600160a01b039094169390611c419082612e7d565b50600e546040516370a0823160e01b8152839183916001600160a01b03909116906370a0823190611c769030906004016135fd565b602060405180830381865afa158015611c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb791906139ea565b611cc19190613ae2565b611ccb9190613b01565b9550611ce16001600160a01b0385168888612619565b611ceb8684613acb565b601055509395945050505050565b60058054610f1090613a73565b600d54600090600190600160c01b900460ff166004811115611d2a57611d2a613873565b816004811115611d3c57611d3c613873565b14611d595760405162461bcd60e51b81526004016108d79061394f565b600f5430600090815260026020526040902054600154611d798284613ae2565b611d839190613b01565b9350611d8f8483613acb565b600f55611d9c3082612e7d565b50600c54611db4906001600160a01b03168686612619565b505050919050565b611dd26000356001600160e01b031916336125e4565b611dee5760405162461bcd60e51b81526004016108d790613928565b8163ffffffff168363ffffffff161115611e3c5760405162461bcd60e51b815260206004820152600f60248201526e125b98dbdc9c9958dd081a5b9c1d5d608a1b60448201526064016108d7565b6008546001600160a01b0316611e8c5760405162461bcd60e51b815260206004820152601560248201527414995dd85c991cc81d1bdad95b881b9bdd081cd95d605a1b60448201526064016108d7565b60095463ffffffff16611e9e42612e9b565b63ffffffff161080611ecc5750600954600160201b900463ffffffff16611ec442612e9b565b63ffffffff16115b611f0a5760405162461bcd60e51b815260206004820152600f60248201526e4f6e676f696e67207265776172647360881b60448201526064016108d7565b611f12612ec5565b6009805463ffffffff85811667ffffffffffffffff199092168217600160201b91861691820217909255600a80546001600160801b0316600160801b83026001600160a01b031617600160a01b6001600160601b03861690810291909117909155604080519283526020830193909352918101919091527f95efd8a2a0aa591f48fd9673cf5d13c2150ca7a1fe1cbe438dd3f0ae470646639060600160405180910390a1505050565b6000610f9e338484612c95565b60005b825181101561122c57611ff9611200848381518110611fec57611fec613b47565b6020026020010151612d4f565b6120155760405162461bcd60e51b81526004016108d790613aa7565b61203883828151811061202a5761202a613b47565b602002602001015183612d71565b8061204281613b5d565b915050611fcb565b8161205761120082612d4f565b6120735760405162461bcd60e51b81526004016108d790613aa7565b61122c8383612de0565b600d54600090600190600160c01b900460ff1660048111156120a1576120a1613873565b8160048111156120b3576120b3613873565b146120d05760405162461bcd60e51b81526004016108d79061394f565b600f54600c546040516370a0823160e01b815260009183916001600160a01b03909116906370a08231906121089030906004016135fd565b602060405180830381865afa158015612125573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214991906139ea565b6121539190613acb565b905061215f8183613a5b565b600f556001548290612172908390613ae2565b61217c9190613b01565b93506121888585612e5f565b50505050919050565b60008060006121ac6000356001600160e01b031916336125e4565b6121c85760405162461bcd60e51b81526004016108d790613928565b600091506121d5336129a8565b90508092509450945094915050565b428410156122345760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016108d7565b6001600160a01b038716600090815260076020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a91908661228183613b5d565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060007f0000000000000000000000000000000000000000000000000000000000000001461461230c5761230746612cbe565b61232e565b7fdb7cb8a3ed810d276a9e12f5f1f5071f5d3773c8ab34df84c510392e1b2122805b60405161190160f01b602082015260228101919091526042810183905260620160408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa1580156123b9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906123ef5750896001600160a01b0316816001600160a01b0316145b61243b5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016108d7565b6124468a8a8a61293f565b5050505050505050505050565b6000610fee8283612adf565b8161246c61120082612d4f565b6124885760405162461bcd60e51b81526004016108d790613aa7565b61122c838361309e565b6124a86000356001600160e01b031916336125e4565b6124c45760405162461bcd60e51b81526004016108d790613928565b6008546001600160a01b0316156125195760405162461bcd60e51b815260206004820152601960248201527814995dd85c991cc81d1bdad95b88185b1c9958591e481cd95d603a1b60448201526064016108d7565b600880546001600160a01b0319166001600160a01b0383161790556040517f45a4cbe003c343d60028e5acd63eecf588647b0eb369733afa2c0482180d4f74906125649083906135fd565b60405180910390a150565b60005b825181101561122c57612593611200848381518110611fec57611fec613b47565b6125af5760405162461bcd60e51b81526004016108d790613aa7565b6125d28382815181106125c4576125c4613b47565b60200260200101518361309e565b806125dc81613b5d565b915050612572565b6001600160e01b031982166000908152602081815260408083206001600160a01b038516845290915290205460ff1692915050565b600080846001600160a01b031663a9059cbb60e01b8585604051602401612641929190613a2c565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161267f9190613b76565b6000604051808303816000865af19150503d80600081146126bc576040519150601f19603f3d011682016040523d82523d6000602084013e6126c1565b606091505b50915091508180156126eb5750805115806126eb5750808060200190518101906126eb9190613b92565b612711576126f88161310f565b60405162461bcd60e51b81526004016108d7919061353f565b5050505050565b600282600481111561272c5761272c613873565b0361285b57600e80546001600160a01b0319166001600160a01b0383169081179091556040805163dc3bfba960e01b8152905163dc3bfba9916004808201926020929091908290030181865afa15801561278a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ae9190613982565b600d60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550806001600160a01b031663204f83f96040518163ffffffff1660e01b8152600401602060405180830381865afa158015612812573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283691906139cd565b600d60146101000a81548163ffffffff021916908363ffffffff160217905550612911565b600182600481111561286f5761286f613873565b0361289957600d80546001600160c01b0319169055600e80546001600160a01b0319169055612911565b60038260048111156128ad576128ad613873565b036128d757600d805463ffffffff60a01b19169055600e80546001600160a01b0319169055612911565b60048260048111156128eb576128eb613873565b0361291157600d805463ffffffff60a01b19169055600e80546001600160a01b03191690555b600d805483919060ff60c01b1916600160c01b83600481111561293657612936613873565b02179055505050565b6001600160a01b03838116600081815260036020908152604080832094871680845294825280832086905551858152919392917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a35060019392505050565b600d546000908190600160c01b900460ff1660048111156129cb576129cb613873565b8160048111156129dd576129dd613873565b146129fa5760405162461bcd60e51b81526004016108d79061394f565b600d80546001600160a01b0319169055600c546040516370a0823160e01b81526001600160a01b03909116906370a0823190612a3a9030906004016135fd565b602060405180830381865afa158015612a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7b91906139ea565b600f819055915081612ac45760405162461bcd60e51b81526020600482015260126024820152712737ba1032b737bab3b4103130b9b29034b760711b60448201526064016108d7565b612ace8383612e5f565b50612ad96001612b87565b50919050565b6000612ae9612ec5565b612af28361316e565b6001600160a01b038085166000908152600b6020526040902080546001600160801b03191690556008546001600160801b03929092169250612b3691168383612619565b604080516001600160a01b038086168252841660208201529081018290527ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926839060600160405180910390a192915050565b6002816004811115612b9b57612b9b613873565b03612bde5760405162461bcd60e51b8152602060048201526013602482015272135d5cdd081c1c9bdd9a59194818481c1bdbdb606a1b60448201526064016108d7565b612be9816000612718565b50565b60006001600160a01b0383163314612c8c576001600160a01b03831660009081526003602090815260408083203384529091529020546000198114612c8a5782811015612c7b5760405162461bcd60e51b815260206004820152601c60248201527f45524332303a20496e73756666696369656e7420617070726f76616c0000000060448201526064016108d7565b612c88843385840361293f565b505b505b50600192915050565b6000612c9f612ec5565b612ca88461316e565b50612cb28361316e565b5061118f8484846132de565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6004604051612cf09190613bb4565b6040518091039020612d00611231565b80516020918201206040805192830194909452928101919091526060810191909152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6001600160e01b03191660009081526020819052604090206001015460e01b90565b612d7b82826125e4565b15611287576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339391927f4ddc7b757e7bdd7254a9cd39452d307a52761bc824625c6a33104a075d8099e691a45050565b6001600160e01b03198116612df483612d4f565b6001600160e01b03191614611287576001600160e01b0319828116600081815260208190526040808220600101805463ffffffff191660e087901c17905551928416927fd348e2220a50b4500ec353f6e802d2f14dd1b5d6786148fd1bbcc570bf92d4739190a35050565b6000612e69612ec5565b612e728361316e565b50610f9e838361338b565b6000612e87612ec5565b612e908361316e565b50610f9e8383613412565b600063ffffffff821115612ec15760405162461bcd60e51b81526004016108d790613c53565b5090565b60408051606081018252600a546001600160801b0381168252600160801b810463ffffffff908116602080850191909152600160a01b9092046001600160601b0316838501528351808501909452600954808216808652600160201b9091049091169184019190915260015491929190612f3e42612e9b565b63ffffffff161015612f4f57505050565b6000612f67612f5d42612e9b565b8460200151613492565b90506000846020015182612f7b9190613c7a565b63ffffffff16905080600003612f92575050505050565b8215612ff857612fec8386604001516001600160601b031683670de0b6b3a7640000612fbe9190613ae2565b612fc89190613ae2565b612fd29190613b01565b8651612fe791906001600160801b0316613a5b565b6134b4565b6001600160801b031685525b63ffffffff8216602086018190528551600a80546040808a01516001600160601b0316600160a01b026001600160a01b03600160801b9096026001600160a01b03199093166001600160801b03861617929092179490941617905590517fe972555b20cae8150e291bb40efce3ef4e3ed6b6b2c39c029346600e95469d489161308f916001600160801b0391909116815260200190565b60405180910390a15050505050565b6130a882826125e4565b611287576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916600117905551339391927fe6231789d19137da31d0550f4ba9ee379020a8cfb64cb79bf1790c996d2e616591a45050565b606060448251101561315457505060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c79000000602082015290565b60048201915081806020019051810190610fee9190613c9f565b6001600160a01b0381166000908152600b602090815260408083208151808301835290546001600160801b038082168352600160801b9182900481168386019081528451606081018652600a5492831680825293830463ffffffff1696810196909652600160a01b9091046001600160601b031693850193909352915190929161325191670de0b6b3a7640000916132069190613d33565b6001600160a01b038716600090815260026020526040902054613232916001600160801b031690613ae2565b61323c9190613b01565b8351612fe791906001600160801b0316613a5b565b6001600160801b0390811683528151811660208085019182526001600160a01b0387166000818152600b835260409081902087519451948616600160801b95909616948502861790558051918252918101939093528201527f5b9aaf4cc5141c090a75f8b8a627863eba92df81f0c83c096350da9b79aedd049060600160405180910390a1505192915050565b6001600160a01b0383166000908152600260205260408120548211156133165760405162461bcd60e51b81526004016108d790613d53565b6001600160a01b038085166000908152600260205260408082208054869003905591851681522054613349908390613a5b565b6001600160a01b038085166000818152600260205260409081902093909355915190861690600080516020613dab833981519152906129969086815260200190565b6001600160a01b0382166000908152600260205260408120546133af908390613a5b565b6001600160a01b0384166000908152600260205260409020556001546133d6908390613a5b565b6001556040518281526001600160a01b03841690600090600080516020613dab833981519152906020015b60405180910390a350600192915050565b6001600160a01b03821660009081526002602052604081205482111561344a5760405162461bcd60e51b81526004016108d790613d53565b6001600160a01b03831660008181526002602090815260408083208054879003905560018054879003905551858152919291600080516020613dab8339815191529101613401565b60008163ffffffff168363ffffffff16106134ad5781610f9e565b5090919050565b60006001600160801b03821115612ec15760405162461bcd60e51b81526004016108d790613c53565b6001600160a01b0381168114612be957600080fd5b60006020828403121561350457600080fd5b8135610f9e816134dd565b60005b8381101561352a578181015183820152602001613512565b83811115613539576000848401525b50505050565b602081526000825180602084015261355e81604085016020870161350f565b601f01601f19169190910160400192915050565b803561357d816134dd565b919050565b6000806040838503121561359557600080fd5b82356135a0816134dd565b946020939093013593505050565b80356001600160e01b03198116811461357d57600080fd5b600080604083850312156135d957600080fd5b6135e2836135ae565b915060208301356135f2816134dd565b809150509250929050565b6001600160a01b0391909116815260200190565b60008060006060848603121561362657600080fd5b8335613631816134dd565b92506020840135613641816134dd565b929592945050506040919091013590565b60006020828403121561366457600080fd5b610f9e826135ae565b6000806040838503121561368057600080fd5b82356135e2816134dd565b63ffffffff81168114612be957600080fd5b6000806000606084860312156136b257600080fd5b83356136bd8161368b565b925060208401356136cd8161368b565b915060408401356001600160601b03811681146136e957600080fd5b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613733576137336136f4565b604052919050565b6000806040838503121561374e57600080fd5b823567ffffffffffffffff8082111561376657600080fd5b818501915085601f83011261377a57600080fd5b813560208282111561378e5761378e6136f4565b8160051b925061379f81840161370a565b82815292840181019281810190898511156137b957600080fd5b948201945b848610156137de576137cf866135ae565b825294820194908201906137be565b96506137ed9050878201613572565b9450505050509250929050565b6000806040838503121561380d57600080fd5b613816836135ae565b9150613824602084016135ae565b90509250929050565b6000806000806080858703121561384357600080fd5b843561384e816134dd565b9350602085013561385e816134dd565b93969395505050506040820135916060013590565b634e487b7160e01b600052602160045260246000fd5b60208101600583106138ab57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600080600060e0888a0312156138cc57600080fd5b87356138d7816134dd565b965060208801356138e7816134dd565b95506040880135945060608801359350608088013560ff8116811461390b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6020808252600d908201526c1058d8d95cdcc819195b9a5959609a1b604082015260600190565b6020808252601990820152784e6f7420616c6c6f77656420696e207468697320737461746560381b604082015260600190565b60006020828403121561399457600080fd5b8151610f9e816134dd565b6000806000606084860312156139b457600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156139df57600080fd5b8151610f9e8161368b565b6000602082840312156139fc57600080fd5b5051919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052601160045260246000fd5b60008219821115613a6e57613a6e613a45565b500190565b600181811c90821680613a8757607f821691505b602082108103612ad957634e487b7160e01b600052602260045260246000fd5b6020808252600a908201526927b7363c9030b236b4b760b11b604082015260600190565b600082821015613add57613add613a45565b500390565b6000816000190483118215151615613afc57613afc613a45565b500290565b600082613b1e57634e487b7160e01b600052601260045260246000fd5b500490565b60008060408385031215613b3657600080fd5b505080516020909101519092909150565b634e487b7160e01b600052603260045260246000fd5b600060018201613b6f57613b6f613a45565b5060010190565b60008251613b8881846020870161350f565b9190910192915050565b600060208284031215613ba457600080fd5b81518015158114610f9e57600080fd5b600080835481600182811c915080831680613bd057607f831692505b60208084108203613bef57634e487b7160e01b86526022600452602486fd5b818015613c035760018114613c1857613c45565b60ff1986168952841515850289019650613c45565b60008a81526020902060005b86811015613c3d5781548b820152908501908301613c24565b505084890196505b509498975050505050505050565b6020808252600d908201526c43617374206f766572666c6f7760981b604082015260600190565b600063ffffffff83811690831681811015613c9757613c97613a45565b039392505050565b600060208284031215613cb157600080fd5b815167ffffffffffffffff80821115613cc957600080fd5b818401915084601f830112613cdd57600080fd5b815181811115613cef57613cef6136f4565b613d02601f8201601f191660200161370a565b9150808252856020828501011115613d1957600080fd5b613d2a81602084016020860161350f565b50949350505050565b60006001600160801b0383811690831681811015613c9757613c97613a45565b6020808252601b908201527f45524332303a20496e73756666696369656e742062616c616e6365000000000060408201526060019056fef44b6ecb6421462dee6400bd4e3bb57864c0f428d0f7e7d49771f9fd7c30d4faddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220382e18bd88ca4c78ae5c1b146261173072576a0319019115ed2762404056dd9864736f6c634300080f0033

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

000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000124c9f7e97235fe3e35820f95d10affce4be9168000000000000000000000000000000000000000000000000000000000000001d5969656c642053747261746567792045544820364d204a756e2044656300000000000000000000000000000000000000000000000000000000000000000000095953455448364d4a440000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name_ (string): Yield Strategy ETH 6M Jun Dec
Arg [1] : symbol_ (string): YSETH6MJD
Arg [2] : fyToken_ (address): 0x124c9F7E97235Fe3E35820f95D10aFfCe4bE9168

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 000000000000000000000000124c9f7e97235fe3e35820f95d10affce4be9168
Arg [3] : 000000000000000000000000000000000000000000000000000000000000001d
Arg [4] : 5969656c642053747261746567792045544820364d204a756e20446563000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [6] : 5953455448364d4a440000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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