ETH Price: $3,792.89 (-1.36%)

Token

ERC-20: FYETH2306 (FYETH2306)
 

Overview

Max Total Supply

50.893234478993045053 FYETH2306

Holders

5

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Filtered by Token Holder
198707.eth
Balance
0.201908389762257038 FYETH2306

Value
$0.00
0xa85821c91f16285173d3b3da59605afce29b227b
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
FYToken

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 21 : FYToken.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.13;

import "erc3156/contracts/interfaces/IERC3156FlashBorrower.sol";
import "erc3156/contracts/interfaces/IERC3156FlashLender.sol";
import "@yield-protocol/utils-v2/contracts/token/ERC20Permit.sol";
import "@yield-protocol/utils-v2/contracts/token/SafeERC20Namer.sol";
import "@yield-protocol/utils-v2/contracts/access/AccessControl.sol";
import "@yield-protocol/utils-v2/contracts/math/WMul.sol";
import "@yield-protocol/utils-v2/contracts/math/WDiv.sol";
import "@yield-protocol/utils-v2/contracts/math/WDivUp.sol";
import "@yield-protocol/utils-v2/contracts/cast/CastU256U128.sol";
import "@yield-protocol/utils-v2/contracts/cast/CastU256U32.sol";
import "./interfaces/IFYToken.sol";
import "./interfaces/IJoin.sol";
import "./interfaces/IOracle.sol";
import "./constants/Constants.sol";

contract FYToken is IFYToken, IERC3156FlashLender, AccessControl, ERC20Permit, Constants {
    using WMul for uint256;
    using WDiv for uint256;
    using WDivUp for uint256;

    using CastU256U128 for uint256;
    using CastU256U32 for uint256;

    event Point(bytes32 indexed param, address value);
    event FlashFeeFactorSet(uint256 indexed fee);
    event SeriesMatured(uint256 chiAtMaturity);
    event Redeemed(address indexed holder, address indexed receiver, uint256 principalAmount, uint256 underlyingAmount);

    uint256 constant CHI_NOT_SET = type(uint256).max;

    uint256 internal constant MAX_TIME_TO_MATURITY = 126144000; // seconds in four years
    bytes32 internal constant FLASH_LOAN_RETURN = keccak256("ERC3156FlashBorrower.onFlashLoan");
    uint256 constant FLASH_LOANS_DISABLED = type(uint256).max;
    uint256 public flashFeeFactor = FLASH_LOANS_DISABLED; // Fee on flash loans, as a percentage in fixed point with 18 decimals. Flash loans disabled by default by overflow from `flashFee`.

    IOracle public oracle; // Oracle for the savings rate.
    IJoin public override join; // Source of redemption funds.
    address public immutable override underlying;
    bytes6 public immutable underlyingId; // Needed to access the oracle
    uint256 public immutable override maturity;
    uint256 public chiAtMaturity = CHI_NOT_SET; // Spot price (exchange rate) between the base and an interest accruing token at maturity

    constructor(
        bytes6 underlyingId_,
        IOracle oracle_, // Underlying vs its interest-bearing version
        IJoin join_,
        uint256 maturity_,
        string memory name,
        string memory symbol
    ) ERC20Permit(name, symbol, SafeERC20Namer.tokenDecimals(address(IJoin(join_).asset()))) {
        // The join asset is this fyToken's underlying, from which we inherit the decimals
        uint256 now_ = block.timestamp;
        require(
            maturity_ > now_ && maturity_ < now_ + MAX_TIME_TO_MATURITY && maturity_ < type(uint32).max,
            "Invalid maturity"
        );

        underlyingId = underlyingId_;
        join = join_;
        maturity = maturity_;
        underlying = address(IJoin(join_).asset());
        oracle = oracle_;
    }

    modifier afterMaturity() {
        require(uint32(block.timestamp) >= maturity, "Only after maturity");
        _;
    }

    modifier beforeMaturity() {
        require(uint32(block.timestamp) < maturity, "Only before maturity");
        _;
    }

    /// @dev Point to a different Oracle or Join
    function point(bytes32 param, address value) external auth {
        if (param == "oracle") {
            require (chiAtMaturity == CHI_NOT_SET, "Already matured");
            oracle = IOracle(value);
        } else if (param == "join") {
            join = IJoin(value);
        } else revert("Unrecognized parameter");
        emit Point(param, value);
    }

    /// @dev Set the flash loan fee factor
    function setFlashFeeFactor(uint256 flashFeeFactor_) external auth {
        flashFeeFactor = flashFeeFactor_;
        emit FlashFeeFactorSet(flashFeeFactor_);
    }

    ///@dev Converts the amount of the principal to the underlying
    function convertToUnderlying(uint256 principalAmount) external override returns (uint256 underlyingAmount) {
        return _convertToUnderlying(principalAmount);
    }

    ///@dev Converts the amount of the principal to the underlying
    ///Before maturity, returns amount as if at maturity.
    function _convertToUnderlying(uint256 principalAmount) internal returns (uint256 underlyingAmount) {
        if (chiAtMaturity == CHI_NOT_SET) {
            return principalAmount;
        } else {
            return principalAmount.wmul(_accrual());
        }
    }

    ///@dev Converts the amount of the underlying to the principal
    function convertToPrincipal(uint256 underlyingAmount) external override returns (uint256 principalAmount) {
        return _convertToPrincipal(underlyingAmount);
    }

    ///@dev Converts the amount of the underlying to the principal
    ///Before maturity, returns amount as if at maturity.
    function _convertToPrincipal(uint256 underlyingAmount) internal returns (uint256 princpalAmount) {
        if (chiAtMaturity == CHI_NOT_SET) {
            return underlyingAmount;
        } else {
            return underlyingAmount.wdivup(_accrual());
        }
    }

    /// @dev Mature the fyToken by recording the chi.
    /// If called more than once, it will revert.
    function mature() external override afterMaturity {
        require(chiAtMaturity == CHI_NOT_SET, "Already matured");
        _mature();
    }

    /// @dev Mature the fyToken by recording the chi.
    function _mature() internal returns (uint256 _chiAtMaturity) {
        (_chiAtMaturity, ) = oracle.get(underlyingId, CHI, 0); // The value returned is an accumulator, it doesn't need an input amount
        require (_chiAtMaturity > 0, "Chi oracle malfunction"); // The chi accumulator needs to have been started
        chiAtMaturity = _chiAtMaturity;
        emit SeriesMatured(_chiAtMaturity);
    }

    /// @dev Retrieve the chi accrual since maturity, maturing if necessary.
    function accrual() external afterMaturity returns (uint256) {
        return _accrual();
    }

    /// @dev Retrieve the chi accrual since maturity, maturing if necessary.
    /// Note: Call only after checking we are past maturity
    function _accrual() internal returns (uint256 accrual_) {
        if (chiAtMaturity == CHI_NOT_SET) {
            // After maturity, but chi not yet recorded. Let's record it, and accrual is then 1.
            _mature();
        } else {
            (uint256 chi, ) = oracle.get(underlyingId, CHI, 0); // The value returned is an accumulator, it doesn't need an input amount
            accrual_ = chi.wdiv(chiAtMaturity);
        }
        accrual_ = accrual_ >= 1e18 ? accrual_ : 1e18; // The accrual can't be below 1 (with 18 decimals)
    }

    ///@dev returns the maximum redeemable amount for the address holder in terms of the principal
    function maxRedeem(address holder) external override view returns (uint256 maxPrincipalAmount) {
        return _balanceOf[holder];
    }

    ///@dev returns the amount of underlying redeemable in terms of the principal
    function previewRedeem(uint256 principalAmount) external override beforeMaturity returns (uint256 underlyingAmount) {
        return _convertToUnderlying(principalAmount);
    }

    /// @dev Burn fyToken after maturity for an amount of principal that increases according to `chi`
    /// If `amount` is 0, the contract will redeem instead the fyToken balance of this contract. Useful for batches.
    function redeem(uint256 principalAmount, address receiver, address holder) external override afterMaturity returns (uint256 underlyingAmount) {
        principalAmount = (principalAmount == 0) ? _balanceOf[address(this)] : principalAmount;
        _burn(holder, principalAmount);
        underlyingAmount = _convertToUnderlying(principalAmount);
        join.exit(receiver, underlyingAmount.u128());

        emit Redeemed(holder, receiver, principalAmount, underlyingAmount);
    }

    /// @dev Burn fyToken after maturity for an amount of principal that increases according to `chi`
    /// If `amount` is 0, the contract will redeem instead the fyToken balance of this contract. Useful for batches.
    function redeem(address receiver, uint256 principalAmount) external override afterMaturity returns (uint256 underlyingAmount) {
        principalAmount = (principalAmount == 0) ? _balanceOf[address(this)] : principalAmount;
        _burn(msg.sender, principalAmount);
        underlyingAmount = _convertToUnderlying(principalAmount);
        join.exit(receiver, underlyingAmount.u128());

        emit Redeemed(msg.sender, receiver, principalAmount, underlyingAmount);
    }

    ///@dev returns the maximum withdrawable amount for the address holder in terms of the underlying
    function maxWithdraw(address holder) external override returns (uint256 maxUnderlyingAmount) {
        return _convertToUnderlying(_balanceOf[holder]);
    }

    ///@dev returns the amount of the principal withdrawable in terms of the underlying
    function previewWithdraw(uint256 underlyingAmount) external override beforeMaturity returns (uint256 principalAmount) {
        return _convertToPrincipal(underlyingAmount);
    }

    /// @dev Burn fyToken after maturity for an amount of underlying that increases according to `chi`
    /// If `amount` is 0, the contract will redeem instead the fyToken balance of this contract. Useful for batches.
    function withdraw(uint256 underlyingAmount, address receiver, address holder) external override afterMaturity returns (uint256 principalAmount) {
        principalAmount = (underlyingAmount == 0) ? _balanceOf[address(this)] : _convertToPrincipal(underlyingAmount);
        _burn(holder, principalAmount);
        underlyingAmount = _convertToUnderlying(principalAmount);
        join.exit(receiver, underlyingAmount.u128());

        emit Redeemed(holder, receiver, principalAmount, underlyingAmount);
    }

    /// @dev Mint fyToken providing an equal amount of underlying to the protocol
    function mintWithUnderlying(address receiver, uint256 underlyingAmount) external override beforeMaturity {
        _mint(receiver, underlyingAmount);
        join.join(msg.sender, underlyingAmount.u128());
    }

    /// @dev Mint fyTokens.
    function mint(address receiver, uint256 principalAmount) external override beforeMaturity auth {
        _mint(receiver, principalAmount);
    }

    /// @dev Burn fyTokens. The user needs to have either transferred the tokens to this contract, or have approved this contract to take them.
    function burn(address holder, uint256 principalAmount) external override auth {
        _burn(holder, principalAmount);
    }

    /// @dev Burn fyTokens.
    /// Any tokens locked in this contract will be burned first and subtracted from the amount to burn from the user's wallet.
    /// This feature allows someone to transfer fyToken to this contract to enable a `burn`, potentially saving the cost of `approve` or `permit`.
    function _burn(address holder, uint256 principalAmount) internal override returns (bool) {
        // First use any tokens locked in this contract
        uint256 available = _balanceOf[address(this)];
        if (available >= principalAmount) {
            return super._burn(address(this), principalAmount);
        } else {
            if (available > 0) super._burn(address(this), available);
            unchecked {
                _decreaseAllowance(holder, principalAmount - available);
            }
            unchecked {
                return super._burn(holder, principalAmount - available);
            }
        }
    }

    /**
     * @dev From ERC-3156. The amount of currency available to be lended.
     * @param token The loan currency. It must be a FYDai contract.
     * @return The amount of `token` that can be borrowed.
     */
    function maxFlashLoan(address token) external view override beforeMaturity returns (uint256) {
        return token == address(this) ? type(uint256).max - _totalSupply : 0;
    }

    /**
     * @dev From ERC-3156. The fee to be charged for a given loan.
     * @param token The loan currency. It must be the asset.
     * @param principalAmount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function flashFee(address token, uint256 principalAmount) external view override returns (uint256) {
        require(token == address(this), "Unsupported currency");
        return _flashFee(principalAmount);
    }

    /**
     * @dev The fee to be charged for a given loan.
     * @param principalAmount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function _flashFee(uint256 principalAmount) internal view returns (uint256) {
        return principalAmount.wmul(flashFeeFactor);
    }

    /**
     * @dev From ERC-3156. Loan `amount` fyDai to `receiver`, which needs to return them plus fee to this contract within the same transaction.
     * Note that if the initiator and the borrower are the same address, no approval is needed for this contract to take the principal + fee from the borrower.
     * If the borrower transfers the principal + fee to this contract, they will be burnt here instead of pulled from the borrower.
     * @param receiver The contract receiving the tokens, needs to implement the `onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata)` interface.
     * @param token The loan currency. Must be a fyDai contract.
     * @param principalAmount The amount of tokens lent.
     * @param data A data parameter to be passed on to the `receiver` for any custom use.
     */
    function flashLoan(
        IERC3156FlashBorrower receiver,
        address token,
        uint256 principalAmount,
        bytes memory data
    ) external override beforeMaturity returns (bool) {
        require(token == address(this), "Unsupported currency");
        _mint(address(receiver), principalAmount);
        uint128 fee = _flashFee(principalAmount).u128();
        require(
            receiver.onFlashLoan(msg.sender, token, principalAmount, fee, data) == FLASH_LOAN_RETURN,
            "Non-compliant borrower"
        );
        _burn(address(receiver), principalAmount + fee);
        return true;
    }
}

File 2 of 21 : IERC3156FlashBorrower.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;


interface IERC3156FlashBorrower {

    /**
     * @dev Receive a flash loan.
     * @param initiator The initiator of the loan.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @param fee The additional amount of tokens to repay.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     * @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan"
     */
    function onFlashLoan(
        address initiator,
        address token,
        uint256 amount,
        uint256 fee,
        bytes calldata data
    ) external returns (bytes32);
}

File 3 of 21 : IERC3156FlashLender.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "./IERC3156FlashBorrower.sol";


interface IERC3156FlashLender {

    /**
     * @dev The amount of currency available to be lended.
     * @param token The loan currency.
     * @return The amount of `token` that can be borrowed.
     */
    function maxFlashLoan(
        address token
    ) external view returns (uint256);

    /**
     * @dev The fee to be charged for a given loan.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function flashFee(
        address token,
        uint256 amount
    ) external view returns (uint256);

    /**
     * @dev Initiate a flash loan.
     * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     */
    function flashLoan(
        IERC3156FlashBorrower receiver,
        address token,
        uint256 amount,
        bytes calldata data
    ) external returns (bool);
}

File 4 of 21 : 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 5 of 21 : 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 6 of 21 : WDivUp.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;


library WDivUp { // Fixed point arithmetic in 18 decimal units
    // Taken from https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol
    /// @dev Divide x and y, with y being fixed point. If both are integers, the result is a fixed point factor. Rounds up.
    function wdivup(uint256 x, uint256 y) internal pure returns (uint256 z) {
        z = x * 1e18 + y;            // 101 (1.01) / 1000 (10) -> (101 * 100 + 1000 - 1) / 1000 -> 11 (0.11 = 0.101 rounded up).
        unchecked { z -= 1; }       // Can do unchecked subtraction since division in next line will catch y = 0 case anyway
        z /= y;
    }
}

File 7 of 21 : WMul.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;


library WMul {
    // Taken from https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol
    /// @dev Multiply an amount by a fixed point factor with 18 decimals, rounds down.
    function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
        z = x * y;
        unchecked { z /= 1e18; }
    }
}

File 8 of 21 : 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 9 of 21 : 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 10 of 21 : WDiv.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;


library WDiv { // Fixed point arithmetic in 18 decimal units
    // Taken from https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol
    /// @dev Divide an amount by a fixed point factor with 18 decimals
    function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
        z = (x * 1e18) / y;
    }
}

File 11 of 21 : 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 12 of 21 : Constants.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.13;

contract Constants {
    bytes32 constant CHI = "CHI";
    bytes32 constant RATE = "RATE";
    bytes6 constant ETH = "00";
}

File 13 of 21 : 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 14 of 21 : 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 15 of 21 : 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 16 of 21 : 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 17 of 21 : 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 18 of 21 : 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 19 of 21 : 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 20 of 21 : 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 21 of 21 : 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);
}

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":"bytes6","name":"underlyingId_","type":"bytes6"},{"internalType":"contract IOracle","name":"oracle_","type":"address"},{"internalType":"contract IJoin","name":"join_","type":"address"},{"internalType":"uint256","name":"maturity_","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FlashFeeFactorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"param","type":"bytes32"},{"indexed":false,"internalType":"address","name":"value","type":"address"}],"name":"Point","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"principalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"Redeemed","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":"chiAtMaturity","type":"uint256"}],"name":"SeriesMatured","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"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":[],"name":"accrual","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"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":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"chiAtMaturity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"convertToPrincipal","outputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"name":"convertToUnderlying","outputs":[{"internalType":"uint256","name":"underlyingAmount","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":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"name":"flashFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flashFeeFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC3156FlashBorrower","name":"receiver","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"principalAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashLoan","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":[],"name":"join","outputs":[{"internalType":"contract IJoin","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"role","type":"bytes4"}],"name":"lockRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mature","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maturity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"maxFlashLoan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"maxPrincipalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"maxUnderlyingAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"mintWithUnderlying","outputs":[],"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":[],"name":"oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"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":[{"internalType":"bytes32","name":"param","type":"bytes32"},{"internalType":"address","name":"value","type":"address"}],"name":"point","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"holder","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"underlyingAmount","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":[{"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":"uint256","name":"flashFeeFactor_","type":"uint256"}],"name":"setFlashFeeFactor","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":"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":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingId","outputs":[{"internalType":"bytes6","name":"","type":"bytes6"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"holder","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"principalAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

6101806040526003610140908152623f3f3f60e81b61016052600490620000279082620005e7565b506040805180820190915260038152623f3f3f60e81b6020820152600590620000519082620005e7565b506006805460ff191660121790557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c96080526000196008819055600b553480156200009b57600080fd5b506040516200337f3803806200337f833981016040819052620000be9162000783565b81817339bb9cbe0221d769e30bd08d185842065bce1706638ee573ac876001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000119573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013f919062000842565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865af415801562000184573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001aa919062000869565b828282620001ba60003362000356565b620001ce6001600160e01b031980620003ee565b6004620001dc8482620005e7565b506005620001eb8382620005e7565b506006805460ff191660ff9290921691909117905550504660c081905262000213906200048c565b60a0525042915050808411801562000239575062000236630784ce00826200088e565b84105b801562000249575063ffffffff84105b6200028d5760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964206d6174757269747960801b604482015260640160405180910390fd5b6001600160d01b0319871661010052600a80546001600160a01b0319166001600160a01b038716908117909155610120859052604080516338d52e0f60e01b815290516338d52e0f916004808201926020929091908290030181865afa158015620002fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000322919062000842565b6001600160a01b0390811660e052600980546001600160a01b03191697909116969096179095555062000933945050505050565b6001600160e01b031982166000908152602081815260408083206001600160a01b038516845290915290205460ff16620003ea576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916600117905551339391927fe6231789d19137da31d0550f4ba9ee379020a8cfb64cb79bf1790c996d2e616591a45b5050565b6001600160e01b0319811662000420836001600160e01b03191660009081526020819052604090206001015460e01b90565b6001600160e01b03191614620003ea576001600160e01b0319828116600081815260208190526040808220600101805463ffffffff191660e087901c17905551928416927fd348e2220a50b4500ec353f6e802d2f14dd1b5d6786148fd1bbcc570bf92d4739190a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6004604051620004c09190620008b5565b60408051918290038220828201825260018352603160f81b602093840152815180840194909452838201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606084015260808301949094523060a0808401919091528451808403909101815260c09092019093528051920191909120919050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200056d57607f821691505b6020821081036200058e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620005e257600081815260208120601f850160051c81016020861015620005bd5750805b601f850160051c820191505b81811015620005de57828155600101620005c9565b5050505b505050565b81516001600160401b0381111562000603576200060362000542565b6200061b8162000614845462000558565b8462000594565b602080601f8311600181146200065357600084156200063a5750858301515b600019600386901b1c1916600185901b178555620005de565b600085815260208120601f198616915b82811015620006845788860151825594840194600190910190840162000663565b5085821015620006a35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b0381168114620006c957600080fd5b50565b600082601f830112620006de57600080fd5b81516001600160401b0380821115620006fb57620006fb62000542565b604051601f8301601f19908116603f0116810190828211818310171562000726576200072662000542565b816040528381526020925086838588010111156200074357600080fd5b600091505b8382101562000767578582018301518183018401529082019062000748565b83821115620007795760008385830101525b9695505050505050565b60008060008060008060c087890312156200079d57600080fd5b86516001600160d01b031981168114620007b657600080fd5b6020880151909650620007c981620006b3565b6040880151909550620007dc81620006b3565b6060880151608089015191955093506001600160401b03808211156200080157600080fd5b6200080f8a838b01620006cc565b935060a08901519150808211156200082657600080fd5b506200083589828a01620006cc565b9150509295509295509295565b6000602082840312156200085557600080fd5b81516200086281620006b3565b9392505050565b6000602082840312156200087c57600080fd5b815160ff811681146200086257600080fd5b60008219821115620008b057634e487b7160e01b600052601160045260246000fd5b500190565b6000808354620008c58162000558565b60018281168015620008e05760018114620008f65762000927565b60ff198416875282151583028701945062000927565b8760005260208060002060005b858110156200091e5781548a82015290840190820162000903565b50505082870194505b50929695505050505050565b60805160a05160c05160e0516101005161012051612985620009fa600039600081816103cf0152818161081801528181610a2b01528181610b8a01528181610c3401528181610cf501528181610daa01528181610f400152818161100601528181611187015281816112d2015261139f0152600081816105b501528181611b5c0152611e74015260006105120152600081816106b601528181610bdf01526115e8015260008181610c10015261161d01526000818161041c015261155f01526129856000f3fe608060405234801561001057600080fd5b50600436106102dd5760003560e01c80636f307dc311610188578063b64b8084116100e4578063d505accf11610092578063d505accf146106eb578063d905777e1461054c578063d9d98ce4146106fe578063dd62ed3e14610711578063de02cde71461074a578063effae3531461075d578063ffffffff1461060b57600080fd5b8063b64b808414610666578063b688a36314610679578063ba0876521461068c578063bac7340c1461069f578063c077b492146106a8578063cd0d0096146106b1578063ce96cb77146106d857600080fd5b806395d89b411161014157806395d89b41146105f05780639dc29fac146105f8578063a4f0d7d01461060b578063a9059cbb1461061a578063ad82110f1461062d578063ae93c1b514610640578063b460af941461065357600080fd5b80636f307dc31461050d57806370a082311461054c5780637dc0d1d0146105755780637ecebe001461058857806387b65207146105a857806391ff394c146105b057600080fd5b806330adf81f1161024257806354fd4d50116101f057806354fd4d50146104a6578063559742d9146104ae5780635909c12f146102e25780635ba5e9f0146104c15780635cffe9de146104d4578063613255ab146104e7578063687f0e4c146104fa57600080fd5b806330adf81f14610417578063313ce5671461043e578063341f141d1461045d5780633644e5151461046557806340c10f191461046d57806344faded0146104805780634cdad5061461049357600080fd5b8063159c03dd1161029f578063159c03dd1461038957806318160ddd1461039c5780631dc7f521146103a45780631e9a6950146103b7578063204f83f9146103ca57806323b872dd146103f157806325a8d87d1461040457600080fd5b80156102e257806306fdde0314610308578063095ea7b31461031d5780630a28a4771461034057806310ab9432146103615780631295bd0814610374575b600080fd5b6102ea600081565b6040516001600160e01b031990911681526020015b60405180910390f35b610310610770565b6040516102ff9190612116565b61033061032b366004612149565b6107fe565b60405190151581526020016102ff565b61035361034e366004612175565b610814565b6040519081526020016102ff565b61033061036f3660046121a6565b610875565b6103876103823660046121dd565b610881565b005b610387610397366004612175565b6109b7565b600154610353565b6103536103b2366004612175565b610a1c565b6103536103c5366004612149565b610a27565b6103537f000000000000000000000000000000000000000000000000000000000000000081565b6103306103ff366004612202565b610b5b565b610353610412366004612175565b610b7b565b6103537f000000000000000000000000000000000000000000000000000000000000000081565b60065461044b9060ff1681565b60405160ff90911681526020016102ff565b610353610b86565b610353610bdb565b61038761047b366004612149565b610c32565b61038761048e3660046121a6565b610cb8565b6103536104a1366004612175565b610cf1565b610310610d41565b6103876104bc366004612243565b610d5c565b6102ea6104cf366004612243565b610d9b565b6103306104e23660046122a5565b610da6565b6103536104f5366004612369565b610f3c565b6103876105083660046121a6565b610fa9565b6105347f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016102ff565b61035361055a366004612369565b6001600160a01b031660009081526002602052604090205490565b600954610534906001600160a01b031681565b610353610596366004612369565b60076020526000908152604090205481565b610387611004565b6105d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160d01b031990911681526020016102ff565b610310611078565b610387610606366004612149565b611085565b6102ea6001600160e01b031981565b610330610628366004612149565b6110c1565b61038761063b36600461238d565b6110ce565b61038761064e36600461244c565b611150565b61035361066136600461247f565b611183565b610387610674366004612149565b6112d0565b600a54610534906001600160a01b031681565b61035361069a36600461247f565b61139b565b61035360085481565b610353600b5481565b6103537f000000000000000000000000000000000000000000000000000000000000000081565b6103536106e6366004612369565b6114d1565b6103876106f93660046124c1565b6114f3565b61035361070c366004612149565b611762565b61035361071f366004612538565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6103876107583660046121a6565b611795565b61038761076b36600461238d565b6117c8565b6004805461077d90612556565b80601f01602080910402602001604051908101604052809291908181526020018280546107a990612556565b80156107f65780601f106107cb576101008083540402835291602001916107f6565b820191906000526020600020905b8154815290600101906020018083116107d957829003601f168201915b505050505081565b600061080b33848461183d565b90505b92915050565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff16106108645760405162461bcd60e51b815260040161085b90612590565b60405180910390fd5b61086d826118a6565b90505b919050565b600061080b83836118c9565b6108976000356001600160e01b031916336118c9565b6108b35760405162461bcd60e51b815260040161085b906125be565b81656f7261636c6560d01b0361090657600019600b54146108e65760405162461bcd60e51b815260040161085b906125e5565b600980546001600160a01b0319166001600160a01b038316179055610975565b81633537b4b760e11b0361093457600a80546001600160a01b0319166001600160a01b038316179055610975565b60405162461bcd60e51b81526020600482015260166024820152752ab73932b1b7b3b734bd32b2103830b930b6b2ba32b960511b604482015260640161085b565b6040516001600160a01b038216815282907fd61f2f59686784f82db8673820acfa642f9709c800724e09f7ac0e1aaedf4af79060200160405180910390a25050565b6109cd6000356001600160e01b031916336118c9565b6109e95760405162461bcd60e51b815260040161085b906125be565b600881905560405181907ff68737d5e8496ca5e19cbdd129d7c94946f794b55f680f7df5a9893eb689044990600090a250565b600061086d826118fe565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff161015610a6f5760405162461bcd60e51b815260040161085b9061260e565b8115610a7b5781610a8c565b306000908152600260205260409020545b9150610a983383611921565b50610aa2826118fe565b600a549091506001600160a01b03166312e5ff7784610ac084611975565b6040518363ffffffff1660e01b8152600401610add92919061263b565b6020604051808303816000875af1158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b20919061265d565b5060408051838152602081018390526001600160a01b038516913391600080516020612910833981519152910160405180910390a392915050565b6000610b6784836119c2565b50610b73848484611a6b565b949350505050565b600061086d826118a6565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff161015610bce5760405162461bcd60e51b815260040161085b9061260e565b610bd6611b18565b905090565b60007f00000000000000000000000000000000000000000000000000000000000000004614610c0d57610bd646611c0c565b507f000000000000000000000000000000000000000000000000000000000000000090565b7f00000000000000000000000000000000000000000000000000000000000000004263ffffffff1610610c775760405162461bcd60e51b815260040161085b90612590565b610c8d6000356001600160e01b031916336118c9565b610ca95760405162461bcd60e51b815260040161085b906125be565b610cb38282611c9d565b505050565b81610ccb610cc582611d24565b336118c9565b610ce75760405162461bcd60e51b815260040161085b90612686565b610cb38383611d46565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff1610610d385760405162461bcd60e51b815260040161085b90612590565b61086d826118fe565b6040805180820190915260018152603160f81b602082015290565b80610d69610cc582611d24565b610d855760405162461bcd60e51b815260040161085b90612686565b610d97826001600160e01b0319611db5565b5050565b600061086d82611d24565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff1610610ded5760405162461bcd60e51b815260040161085b90612590565b6001600160a01b0384163014610e155760405162461bcd60e51b815260040161085b906126aa565b610e1f8584611c9d565b506000610e33610e2e85611e34565b611975565b90507f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd9866001600160a01b03166323e30c8b33888886896040518663ffffffff1660e01b8152600401610e8a9594939291906126d8565b6020604051808303816000875af1158015610ea9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecd9190612725565b14610f135760405162461bcd60e51b81526020600482015260166024820152752737b716b1b7b6b83634b0b73a103137b93937bbb2b960511b604482015260640161085b565b610f2f86610f2a6001600160801b03841687612754565b611921565b5060019695505050505050565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff1610610f835760405162461bcd60e51b815260040161085b90612590565b6001600160a01b0382163014610f9a57600061086d565b60015461086d9060001961276c565b6001600160a01b0381163314610ffa5760405162461bcd60e51b81526020600482015260166024820152752932b737bab731b29037b7363c903337b91039b2b63360511b604482015260640161085b565b610d978282611d46565b7f00000000000000000000000000000000000000000000000000000000000000004263ffffffff16101561104a5760405162461bcd60e51b815260040161085b9061260e565b600019600b541461106d5760405162461bcd60e51b815260040161085b906125e5565b611075611e4b565b50565b6005805461077d90612556565b61109b6000356001600160e01b031916336118c9565b6110b75760405162461bcd60e51b815260040161085b906125be565b610cb38282611921565b600061080b338484611a6b565b60005b8251811015610cb3576110ff610cc58483815181106110f2576110f2612783565b6020026020010151611d24565b61111b5760405162461bcd60e51b815260040161085b90612686565b61113e83828151811061113057611130612783565b602002602001015183611d46565b8061114881612799565b9150506110d1565b8161115d610cc582611d24565b6111795760405162461bcd60e51b815260040161085b90612686565b610cb38383611db5565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff1610156111cb5760405162461bcd60e51b815260040161085b9061260e565b83156111df576111da846118a6565b6111f0565b306000908152600260205260409020545b90506111fc8282611921565b50611206816118fe565b600a549094506001600160a01b03166312e5ff778461122487611975565b6040518363ffffffff1660e01b815260040161124192919061263b565b6020604051808303816000875af1158015611260573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611284919061265d565b50826001600160a01b0316826001600160a01b031660008051602061291083398151915283876040516112c1929190918252602082015260400190565b60405180910390a39392505050565b7f00000000000000000000000000000000000000000000000000000000000000004263ffffffff16106113155760405162461bcd60e51b815260040161085b90612590565b61131f8282611c9d565b50600a546001600160a01b031663ceae3abd3361133b84611975565b6040518363ffffffff1660e01b815260040161135892919061263b565b6020604051808303816000875af1158015611377573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb3919061265d565b60007f00000000000000000000000000000000000000000000000000000000000000004263ffffffff1610156113e35760405162461bcd60e51b815260040161085b9061260e565b83156113ef5783611400565b306000908152600260205260409020545b935061140c8285611921565b50611416846118fe565b600a549091506001600160a01b03166312e5ff778461143484611975565b6040518363ffffffff1660e01b815260040161145192919061263b565b6020604051808303816000875af1158015611470573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611494919061265d565b50826001600160a01b0316826001600160a01b031660008051602061291083398151915286846040516112c1929190918252602082015260400190565b6001600160a01b03811660009081526002602052604081205461086d906118fe565b428410156115435760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161085b565b6001600160a01b038716600090815260076020526040812080547f0000000000000000000000000000000000000000000000000000000000000000918a918a918a91908661159083612799565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060007f0000000000000000000000000000000000000000000000000000000000000000461461161b5761161646611c0c565b61163d565b7f00000000000000000000000000000000000000000000000000000000000000005b60405161190160f01b602082015260228101919091526042810183905260620160408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa1580156116c8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906116fe5750896001600160a01b0316816001600160a01b0316145b61174a5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161085b565b6117558a8a8a61183d565b5050505050505050505050565b60006001600160a01b038316301461178c5760405162461bcd60e51b815260040161085b906126aa565b61080b82611e34565b816117a2610cc582611d24565b6117be5760405162461bcd60e51b815260040161085b90612686565b610cb38383611f6c565b60005b8251811015610cb3576117ec610cc58483815181106110f2576110f2612783565b6118085760405162461bcd60e51b815260040161085b90612686565b61182b83828151811061181d5761181d612783565b602002602001015183611f6c565b8061183581612799565b9150506117cb565b6001600160a01b03838116600081815260036020908152604080832094871680845294825280832086905551858152919392917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a35060019392505050565b6000600019600b54036118b7575090565b61086d6118c2611b18565b8390611fdd565b6001600160e01b031982166000908152602081815260408083206001600160a01b038516845290915290205460ff1692915050565b6000600019600b540361190f575090565b61086d61191a611b18565b839061200c565b3060009081526002602052604081205482811061194a57611942308461202a565b91505061080e565b801561195c5761195a308261202a565b505b611968848285036119c2565b506119428482850361202a565b60006001600160801b038211156119be5760405162461bcd60e51b815260206004820152600d60248201526c43617374206f766572666c6f7760981b604482015260640161085b565b5090565b60006001600160a01b0383163314611a62576001600160a01b03831660009081526003602090815260408083203384529091529020546000198114611a605782811015611a515760405162461bcd60e51b815260206004820152601c60248201527f45524332303a20496e73756666696369656e7420617070726f76616c00000000604482015260640161085b565b611a5e843385840361183d565b505b505b50600192915050565b6001600160a01b038316600090815260026020526040812054821115611aa35760405162461bcd60e51b815260040161085b906127b2565b6001600160a01b038085166000908152600260205260408082208054869003905591851681522054611ad6908390612754565b6001600160a01b038085166000818152600260205260409081902093909355915190861690600080516020612930833981519152906118949086815260200190565b6000600019600b5403611b3357611b2d611e4b565b50611bec565b6009546040516308c5f34560e31b81526000916001600160a01b03169063462f9a2890611b8e907f0000000000000000000000000000000000000000000000000000000000000000906243484960e81b9086906004016127e9565b60408051808303816000875af1158015611bac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd0919061280b565b509050611be8600b54826120aa90919063ffffffff16565b9150505b670de0b6b3a7640000811015611c095750670de0b6b3a764000090565b90565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6004604051611c3e919061282f565b6040518091039020611c4e610d41565b80516020918201206040805192830194909452928101919091526060810191909152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6001600160a01b038216600090815260026020526040812054611cc1908390612754565b6001600160a01b038416600090815260026020526040902055600154611ce8908390612754565b6001556040518281526001600160a01b03841690600090600080516020612930833981519152906020015b60405180910390a350600192915050565b6001600160e01b03191660009081526020819052604090206001015460e01b90565b611d5082826118c9565b15610d97576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339391927f4ddc7b757e7bdd7254a9cd39452d307a52761bc824625c6a33104a075d8099e691a45050565b6001600160e01b03198116611dc983611d24565b6001600160e01b03191614610d97576001600160e01b0319828116600081815260208190526040808220600101805463ffffffff191660e087901c17905551928416927fd348e2220a50b4500ec353f6e802d2f14dd1b5d6786148fd1bbcc570bf92d4739190a35050565b600061086d6008548361200c90919063ffffffff16565b6009546040516308c5f34560e31b81526000916001600160a01b03169063462f9a2890611ea6907f0000000000000000000000000000000000000000000000000000000000000000906243484960e81b9086906004016127e9565b60408051808303816000875af1158015611ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee8919061280b565b50905080611f315760405162461bcd60e51b815260206004820152601660248201527521b4349037b930b1b6329036b0b6333ab731ba34b7b760511b604482015260640161085b565b600b8190556040518181527f8be75db1b82d3c69cbae9639f0c64031bc1ec21b06cf1fd56c9b24034497f9ff9060200160405180910390a190565b611f7682826118c9565b610d97576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916600117905551339391927fe6231789d19137da31d0550f4ba9ee379020a8cfb64cb79bf1790c996d2e616591a45050565b600081611ff284670de0b6b3a76400006128ce565b611ffc9190612754565b60001901905061080b82826128ed565b600061201882846128ce565b670de0b6b3a764000090049392505050565b6001600160a01b0382166000908152600260205260408120548211156120625760405162461bcd60e51b815260040161085b906127b2565b6001600160a01b038316600081815260026020908152604080832080548790039055600180548790039055518581529192916000805160206129308339815191529101611d13565b6000816120bf84670de0b6b3a76400006128ce565b61080b91906128ed565b6000815180845260005b818110156120ef576020818501810151868301820152016120d3565b81811115612101576000602083870101525b50601f01601f19169290920160200192915050565b60208152600061080b60208301846120c9565b6001600160a01b038116811461107557600080fd5b803561087081612129565b6000806040838503121561215c57600080fd5b823561216781612129565b946020939093013593505050565b60006020828403121561218757600080fd5b5035919050565b80356001600160e01b03198116811461087057600080fd5b600080604083850312156121b957600080fd5b6121c28361218e565b915060208301356121d281612129565b809150509250929050565b600080604083850312156121f057600080fd5b8235915060208301356121d281612129565b60008060006060848603121561221757600080fd5b833561222281612129565b9250602084013561223281612129565b929592945050506040919091013590565b60006020828403121561225557600080fd5b61080b8261218e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561229d5761229d61225e565b604052919050565b600080600080608085870312156122bb57600080fd5b84356122c681612129565b93506020858101356122d781612129565b935060408601359250606086013567ffffffffffffffff808211156122fb57600080fd5b818801915088601f83011261230f57600080fd5b8135818111156123215761232161225e565b612333601f8201601f19168501612274565b9150808252898482850101111561234957600080fd5b808484018584013760008482840101525080935050505092959194509250565b60006020828403121561237b57600080fd5b813561238681612129565b9392505050565b600080604083850312156123a057600080fd5b823567ffffffffffffffff808211156123b857600080fd5b818501915085601f8301126123cc57600080fd5b81356020828211156123e0576123e061225e565b8160051b92506123f1818401612274565b828152928401810192818101908985111561240b57600080fd5b948201945b84861015612430576124218661218e565b82529482019490820190612410565b965061243f905087820161213e565b9450505050509250929050565b6000806040838503121561245f57600080fd5b6124688361218e565b91506124766020840161218e565b90509250929050565b60008060006060848603121561249457600080fd5b8335925060208401356124a681612129565b915060408401356124b681612129565b809150509250925092565b600080600080600080600060e0888a0312156124dc57600080fd5b87356124e781612129565b965060208801356124f781612129565b95506040880135945060608801359350608088013560ff8116811461251b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561254b57600080fd5b82356121c281612129565b600181811c9082168061256a57607f821691505b60208210810361258a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601490820152734f6e6c79206265666f7265206d6174757269747960601b604082015260600190565b6020808252600d908201526c1058d8d95cdcc819195b9a5959609a1b604082015260600190565b6020808252600f908201526e105b1c9958591e481b585d1d5c9959608a1b604082015260600190565b6020808252601390820152724f6e6c79206166746572206d6174757269747960681b604082015260600190565b6001600160a01b039290921682526001600160801b0316602082015260400190565b60006020828403121561266f57600080fd5b81516001600160801b038116811461238657600080fd5b6020808252600a908201526927b7363c9030b236b4b760b11b604082015260600190565b602080825260149082015273556e737570706f727465642063757272656e637960601b604082015260600190565b6001600160a01b03868116825285166020820152604081018490526001600160801b038316606082015260a06080820181905260009061271a908301846120c9565b979650505050505050565b60006020828403121561273757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156127675761276761273e565b500190565b60008282101561277e5761277e61273e565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600182016127ab576127ab61273e565b5060010190565b6020808252601b908201527f45524332303a20496e73756666696369656e742062616c616e63650000000000604082015260600190565b6001600160d01b03199390931683526020830191909152604082015260600190565b6000806040838503121561281e57600080fd5b505080516020909101519092909150565b600080835481600182811c91508083168061284b57607f831692505b6020808410820361286a57634e487b7160e01b86526022600452602486fd5b81801561287e5760018114612893576128c0565b60ff19861689528415158502890196506128c0565b60008a81526020902060005b868110156128b85781548b82015290850190830161289f565b505084890196505b509498975050505050505050565b60008160001904831182151516156128e8576128e861273e565b500290565b60008261290a57634e487b7160e01b600052601260045260246000fd5b50049056fe5cdf07ad0fc222442720b108e3ed4c4640f0fadc2ab2253e66f259a0fea83480ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207ec419e4e7f57ba27bb036df60f1d089a2310e2d144c53a2cb1825b39ba4fad964736f6c634300080f0033303000000000000000000000000000000000000000000000000000000000000000000000000000000000000053fba816bd69a7f2a096f58687f87dd3020d0d5c0000000000000000000000003bdb887dc46ec0e964df89ffe2980db0121f0fd000000000000000000000000000000000000000000000000000000000649eedf000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000009465945544832333036000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000094659455448323330360000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102dd5760003560e01c80636f307dc311610188578063b64b8084116100e4578063d505accf11610092578063d505accf146106eb578063d905777e1461054c578063d9d98ce4146106fe578063dd62ed3e14610711578063de02cde71461074a578063effae3531461075d578063ffffffff1461060b57600080fd5b8063b64b808414610666578063b688a36314610679578063ba0876521461068c578063bac7340c1461069f578063c077b492146106a8578063cd0d0096146106b1578063ce96cb77146106d857600080fd5b806395d89b411161014157806395d89b41146105f05780639dc29fac146105f8578063a4f0d7d01461060b578063a9059cbb1461061a578063ad82110f1461062d578063ae93c1b514610640578063b460af941461065357600080fd5b80636f307dc31461050d57806370a082311461054c5780637dc0d1d0146105755780637ecebe001461058857806387b65207146105a857806391ff394c146105b057600080fd5b806330adf81f1161024257806354fd4d50116101f057806354fd4d50146104a6578063559742d9146104ae5780635909c12f146102e25780635ba5e9f0146104c15780635cffe9de146104d4578063613255ab146104e7578063687f0e4c146104fa57600080fd5b806330adf81f14610417578063313ce5671461043e578063341f141d1461045d5780633644e5151461046557806340c10f191461046d57806344faded0146104805780634cdad5061461049357600080fd5b8063159c03dd1161029f578063159c03dd1461038957806318160ddd1461039c5780631dc7f521146103a45780631e9a6950146103b7578063204f83f9146103ca57806323b872dd146103f157806325a8d87d1461040457600080fd5b80156102e257806306fdde0314610308578063095ea7b31461031d5780630a28a4771461034057806310ab9432146103615780631295bd0814610374575b600080fd5b6102ea600081565b6040516001600160e01b031990911681526020015b60405180910390f35b610310610770565b6040516102ff9190612116565b61033061032b366004612149565b6107fe565b60405190151581526020016102ff565b61035361034e366004612175565b610814565b6040519081526020016102ff565b61033061036f3660046121a6565b610875565b6103876103823660046121dd565b610881565b005b610387610397366004612175565b6109b7565b600154610353565b6103536103b2366004612175565b610a1c565b6103536103c5366004612149565b610a27565b6103537f00000000000000000000000000000000000000000000000000000000649eedf081565b6103306103ff366004612202565b610b5b565b610353610412366004612175565b610b7b565b6103537f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60065461044b9060ff1681565b60405160ff90911681526020016102ff565b610353610b86565b610353610bdb565b61038761047b366004612149565b610c32565b61038761048e3660046121a6565b610cb8565b6103536104a1366004612175565b610cf1565b610310610d41565b6103876104bc366004612243565b610d5c565b6102ea6104cf366004612243565b610d9b565b6103306104e23660046122a5565b610da6565b6103536104f5366004612369565b610f3c565b6103876105083660046121a6565b610fa9565b6105347f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b0390911681526020016102ff565b61035361055a366004612369565b6001600160a01b031660009081526002602052604090205490565b600954610534906001600160a01b031681565b610353610596366004612369565b60076020526000908152604090205481565b610387611004565b6105d77f303000000000000000000000000000000000000000000000000000000000000081565b6040516001600160d01b031990911681526020016102ff565b610310611078565b610387610606366004612149565b611085565b6102ea6001600160e01b031981565b610330610628366004612149565b6110c1565b61038761063b36600461238d565b6110ce565b61038761064e36600461244c565b611150565b61035361066136600461247f565b611183565b610387610674366004612149565b6112d0565b600a54610534906001600160a01b031681565b61035361069a36600461247f565b61139b565b61035360085481565b610353600b5481565b6103537f000000000000000000000000000000000000000000000000000000000000000181565b6103536106e6366004612369565b6114d1565b6103876106f93660046124c1565b6114f3565b61035361070c366004612149565b611762565b61035361071f366004612538565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6103876107583660046121a6565b611795565b61038761076b36600461238d565b6117c8565b6004805461077d90612556565b80601f01602080910402602001604051908101604052809291908181526020018280546107a990612556565b80156107f65780601f106107cb576101008083540402835291602001916107f6565b820191906000526020600020905b8154815290600101906020018083116107d957829003601f168201915b505050505081565b600061080b33848461183d565b90505b92915050565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff16106108645760405162461bcd60e51b815260040161085b90612590565b60405180910390fd5b61086d826118a6565b90505b919050565b600061080b83836118c9565b6108976000356001600160e01b031916336118c9565b6108b35760405162461bcd60e51b815260040161085b906125be565b81656f7261636c6560d01b0361090657600019600b54146108e65760405162461bcd60e51b815260040161085b906125e5565b600980546001600160a01b0319166001600160a01b038316179055610975565b81633537b4b760e11b0361093457600a80546001600160a01b0319166001600160a01b038316179055610975565b60405162461bcd60e51b81526020600482015260166024820152752ab73932b1b7b3b734bd32b2103830b930b6b2ba32b960511b604482015260640161085b565b6040516001600160a01b038216815282907fd61f2f59686784f82db8673820acfa642f9709c800724e09f7ac0e1aaedf4af79060200160405180910390a25050565b6109cd6000356001600160e01b031916336118c9565b6109e95760405162461bcd60e51b815260040161085b906125be565b600881905560405181907ff68737d5e8496ca5e19cbdd129d7c94946f794b55f680f7df5a9893eb689044990600090a250565b600061086d826118fe565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff161015610a6f5760405162461bcd60e51b815260040161085b9061260e565b8115610a7b5781610a8c565b306000908152600260205260409020545b9150610a983383611921565b50610aa2826118fe565b600a549091506001600160a01b03166312e5ff7784610ac084611975565b6040518363ffffffff1660e01b8152600401610add92919061263b565b6020604051808303816000875af1158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b20919061265d565b5060408051838152602081018390526001600160a01b038516913391600080516020612910833981519152910160405180910390a392915050565b6000610b6784836119c2565b50610b73848484611a6b565b949350505050565b600061086d826118a6565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff161015610bce5760405162461bcd60e51b815260040161085b9061260e565b610bd6611b18565b905090565b60007f00000000000000000000000000000000000000000000000000000000000000014614610c0d57610bd646611c0c565b507f13e41dff362c4f7303d1c6aa77edefdcd397f88c3ebc4b017d44b667bdff377990565b7f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff1610610c775760405162461bcd60e51b815260040161085b90612590565b610c8d6000356001600160e01b031916336118c9565b610ca95760405162461bcd60e51b815260040161085b906125be565b610cb38282611c9d565b505050565b81610ccb610cc582611d24565b336118c9565b610ce75760405162461bcd60e51b815260040161085b90612686565b610cb38383611d46565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff1610610d385760405162461bcd60e51b815260040161085b90612590565b61086d826118fe565b6040805180820190915260018152603160f81b602082015290565b80610d69610cc582611d24565b610d855760405162461bcd60e51b815260040161085b90612686565b610d97826001600160e01b0319611db5565b5050565b600061086d82611d24565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff1610610ded5760405162461bcd60e51b815260040161085b90612590565b6001600160a01b0384163014610e155760405162461bcd60e51b815260040161085b906126aa565b610e1f8584611c9d565b506000610e33610e2e85611e34565b611975565b90507f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd9866001600160a01b03166323e30c8b33888886896040518663ffffffff1660e01b8152600401610e8a9594939291906126d8565b6020604051808303816000875af1158015610ea9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecd9190612725565b14610f135760405162461bcd60e51b81526020600482015260166024820152752737b716b1b7b6b83634b0b73a103137b93937bbb2b960511b604482015260640161085b565b610f2f86610f2a6001600160801b03841687612754565b611921565b5060019695505050505050565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff1610610f835760405162461bcd60e51b815260040161085b90612590565b6001600160a01b0382163014610f9a57600061086d565b60015461086d9060001961276c565b6001600160a01b0381163314610ffa5760405162461bcd60e51b81526020600482015260166024820152752932b737bab731b29037b7363c903337b91039b2b63360511b604482015260640161085b565b610d978282611d46565b7f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff16101561104a5760405162461bcd60e51b815260040161085b9061260e565b600019600b541461106d5760405162461bcd60e51b815260040161085b906125e5565b611075611e4b565b50565b6005805461077d90612556565b61109b6000356001600160e01b031916336118c9565b6110b75760405162461bcd60e51b815260040161085b906125be565b610cb38282611921565b600061080b338484611a6b565b60005b8251811015610cb3576110ff610cc58483815181106110f2576110f2612783565b6020026020010151611d24565b61111b5760405162461bcd60e51b815260040161085b90612686565b61113e83828151811061113057611130612783565b602002602001015183611d46565b8061114881612799565b9150506110d1565b8161115d610cc582611d24565b6111795760405162461bcd60e51b815260040161085b90612686565b610cb38383611db5565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff1610156111cb5760405162461bcd60e51b815260040161085b9061260e565b83156111df576111da846118a6565b6111f0565b306000908152600260205260409020545b90506111fc8282611921565b50611206816118fe565b600a549094506001600160a01b03166312e5ff778461122487611975565b6040518363ffffffff1660e01b815260040161124192919061263b565b6020604051808303816000875af1158015611260573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611284919061265d565b50826001600160a01b0316826001600160a01b031660008051602061291083398151915283876040516112c1929190918252602082015260400190565b60405180910390a39392505050565b7f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff16106113155760405162461bcd60e51b815260040161085b90612590565b61131f8282611c9d565b50600a546001600160a01b031663ceae3abd3361133b84611975565b6040518363ffffffff1660e01b815260040161135892919061263b565b6020604051808303816000875af1158015611377573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb3919061265d565b60007f00000000000000000000000000000000000000000000000000000000649eedf04263ffffffff1610156113e35760405162461bcd60e51b815260040161085b9061260e565b83156113ef5783611400565b306000908152600260205260409020545b935061140c8285611921565b50611416846118fe565b600a549091506001600160a01b03166312e5ff778461143484611975565b6040518363ffffffff1660e01b815260040161145192919061263b565b6020604051808303816000875af1158015611470573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611494919061265d565b50826001600160a01b0316826001600160a01b031660008051602061291083398151915286846040516112c1929190918252602082015260400190565b6001600160a01b03811660009081526002602052604081205461086d906118fe565b428410156115435760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161085b565b6001600160a01b038716600090815260076020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a91908661159083612799565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060007f0000000000000000000000000000000000000000000000000000000000000001461461161b5761161646611c0c565b61163d565b7f13e41dff362c4f7303d1c6aa77edefdcd397f88c3ebc4b017d44b667bdff37795b60405161190160f01b602082015260228101919091526042810183905260620160408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa1580156116c8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906116fe5750896001600160a01b0316816001600160a01b0316145b61174a5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161085b565b6117558a8a8a61183d565b5050505050505050505050565b60006001600160a01b038316301461178c5760405162461bcd60e51b815260040161085b906126aa565b61080b82611e34565b816117a2610cc582611d24565b6117be5760405162461bcd60e51b815260040161085b90612686565b610cb38383611f6c565b60005b8251811015610cb3576117ec610cc58483815181106110f2576110f2612783565b6118085760405162461bcd60e51b815260040161085b90612686565b61182b83828151811061181d5761181d612783565b602002602001015183611f6c565b8061183581612799565b9150506117cb565b6001600160a01b03838116600081815260036020908152604080832094871680845294825280832086905551858152919392917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a35060019392505050565b6000600019600b54036118b7575090565b61086d6118c2611b18565b8390611fdd565b6001600160e01b031982166000908152602081815260408083206001600160a01b038516845290915290205460ff1692915050565b6000600019600b540361190f575090565b61086d61191a611b18565b839061200c565b3060009081526002602052604081205482811061194a57611942308461202a565b91505061080e565b801561195c5761195a308261202a565b505b611968848285036119c2565b506119428482850361202a565b60006001600160801b038211156119be5760405162461bcd60e51b815260206004820152600d60248201526c43617374206f766572666c6f7760981b604482015260640161085b565b5090565b60006001600160a01b0383163314611a62576001600160a01b03831660009081526003602090815260408083203384529091529020546000198114611a605782811015611a515760405162461bcd60e51b815260206004820152601c60248201527f45524332303a20496e73756666696369656e7420617070726f76616c00000000604482015260640161085b565b611a5e843385840361183d565b505b505b50600192915050565b6001600160a01b038316600090815260026020526040812054821115611aa35760405162461bcd60e51b815260040161085b906127b2565b6001600160a01b038085166000908152600260205260408082208054869003905591851681522054611ad6908390612754565b6001600160a01b038085166000818152600260205260409081902093909355915190861690600080516020612930833981519152906118949086815260200190565b6000600019600b5403611b3357611b2d611e4b565b50611bec565b6009546040516308c5f34560e31b81526000916001600160a01b03169063462f9a2890611b8e907f3030000000000000000000000000000000000000000000000000000000000000906243484960e81b9086906004016127e9565b60408051808303816000875af1158015611bac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd0919061280b565b509050611be8600b54826120aa90919063ffffffff16565b9150505b670de0b6b3a7640000811015611c095750670de0b6b3a764000090565b90565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6004604051611c3e919061282f565b6040518091039020611c4e610d41565b80516020918201206040805192830194909452928101919091526060810191909152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6001600160a01b038216600090815260026020526040812054611cc1908390612754565b6001600160a01b038416600090815260026020526040902055600154611ce8908390612754565b6001556040518281526001600160a01b03841690600090600080516020612930833981519152906020015b60405180910390a350600192915050565b6001600160e01b03191660009081526020819052604090206001015460e01b90565b611d5082826118c9565b15610d97576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339391927f4ddc7b757e7bdd7254a9cd39452d307a52761bc824625c6a33104a075d8099e691a45050565b6001600160e01b03198116611dc983611d24565b6001600160e01b03191614610d97576001600160e01b0319828116600081815260208190526040808220600101805463ffffffff191660e087901c17905551928416927fd348e2220a50b4500ec353f6e802d2f14dd1b5d6786148fd1bbcc570bf92d4739190a35050565b600061086d6008548361200c90919063ffffffff16565b6009546040516308c5f34560e31b81526000916001600160a01b03169063462f9a2890611ea6907f3030000000000000000000000000000000000000000000000000000000000000906243484960e81b9086906004016127e9565b60408051808303816000875af1158015611ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee8919061280b565b50905080611f315760405162461bcd60e51b815260206004820152601660248201527521b4349037b930b1b6329036b0b6333ab731ba34b7b760511b604482015260640161085b565b600b8190556040518181527f8be75db1b82d3c69cbae9639f0c64031bc1ec21b06cf1fd56c9b24034497f9ff9060200160405180910390a190565b611f7682826118c9565b610d97576001600160e01b031982166000818152602081815260408083206001600160a01b0386168085529252808320805460ff1916600117905551339391927fe6231789d19137da31d0550f4ba9ee379020a8cfb64cb79bf1790c996d2e616591a45050565b600081611ff284670de0b6b3a76400006128ce565b611ffc9190612754565b60001901905061080b82826128ed565b600061201882846128ce565b670de0b6b3a764000090049392505050565b6001600160a01b0382166000908152600260205260408120548211156120625760405162461bcd60e51b815260040161085b906127b2565b6001600160a01b038316600081815260026020908152604080832080548790039055600180548790039055518581529192916000805160206129308339815191529101611d13565b6000816120bf84670de0b6b3a76400006128ce565b61080b91906128ed565b6000815180845260005b818110156120ef576020818501810151868301820152016120d3565b81811115612101576000602083870101525b50601f01601f19169290920160200192915050565b60208152600061080b60208301846120c9565b6001600160a01b038116811461107557600080fd5b803561087081612129565b6000806040838503121561215c57600080fd5b823561216781612129565b946020939093013593505050565b60006020828403121561218757600080fd5b5035919050565b80356001600160e01b03198116811461087057600080fd5b600080604083850312156121b957600080fd5b6121c28361218e565b915060208301356121d281612129565b809150509250929050565b600080604083850312156121f057600080fd5b8235915060208301356121d281612129565b60008060006060848603121561221757600080fd5b833561222281612129565b9250602084013561223281612129565b929592945050506040919091013590565b60006020828403121561225557600080fd5b61080b8261218e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561229d5761229d61225e565b604052919050565b600080600080608085870312156122bb57600080fd5b84356122c681612129565b93506020858101356122d781612129565b935060408601359250606086013567ffffffffffffffff808211156122fb57600080fd5b818801915088601f83011261230f57600080fd5b8135818111156123215761232161225e565b612333601f8201601f19168501612274565b9150808252898482850101111561234957600080fd5b808484018584013760008482840101525080935050505092959194509250565b60006020828403121561237b57600080fd5b813561238681612129565b9392505050565b600080604083850312156123a057600080fd5b823567ffffffffffffffff808211156123b857600080fd5b818501915085601f8301126123cc57600080fd5b81356020828211156123e0576123e061225e565b8160051b92506123f1818401612274565b828152928401810192818101908985111561240b57600080fd5b948201945b84861015612430576124218661218e565b82529482019490820190612410565b965061243f905087820161213e565b9450505050509250929050565b6000806040838503121561245f57600080fd5b6124688361218e565b91506124766020840161218e565b90509250929050565b60008060006060848603121561249457600080fd5b8335925060208401356124a681612129565b915060408401356124b681612129565b809150509250925092565b600080600080600080600060e0888a0312156124dc57600080fd5b87356124e781612129565b965060208801356124f781612129565b95506040880135945060608801359350608088013560ff8116811461251b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561254b57600080fd5b82356121c281612129565b600181811c9082168061256a57607f821691505b60208210810361258a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601490820152734f6e6c79206265666f7265206d6174757269747960601b604082015260600190565b6020808252600d908201526c1058d8d95cdcc819195b9a5959609a1b604082015260600190565b6020808252600f908201526e105b1c9958591e481b585d1d5c9959608a1b604082015260600190565b6020808252601390820152724f6e6c79206166746572206d6174757269747960681b604082015260600190565b6001600160a01b039290921682526001600160801b0316602082015260400190565b60006020828403121561266f57600080fd5b81516001600160801b038116811461238657600080fd5b6020808252600a908201526927b7363c9030b236b4b760b11b604082015260600190565b602080825260149082015273556e737570706f727465642063757272656e637960601b604082015260600190565b6001600160a01b03868116825285166020820152604081018490526001600160801b038316606082015260a06080820181905260009061271a908301846120c9565b979650505050505050565b60006020828403121561273757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156127675761276761273e565b500190565b60008282101561277e5761277e61273e565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600182016127ab576127ab61273e565b5060010190565b6020808252601b908201527f45524332303a20496e73756666696369656e742062616c616e63650000000000604082015260600190565b6001600160d01b03199390931683526020830191909152604082015260600190565b6000806040838503121561281e57600080fd5b505080516020909101519092909150565b600080835481600182811c91508083168061284b57607f831692505b6020808410820361286a57634e487b7160e01b86526022600452602486fd5b81801561287e5760018114612893576128c0565b60ff19861689528415158502890196506128c0565b60008a81526020902060005b868110156128b85781548b82015290850190830161289f565b505084890196505b509498975050505050505050565b60008160001904831182151516156128e8576128e861273e565b500290565b60008261290a57634e487b7160e01b600052601260045260246000fd5b50049056fe5cdf07ad0fc222442720b108e3ed4c4640f0fadc2ab2253e66f259a0fea83480ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212207ec419e4e7f57ba27bb036df60f1d089a2310e2d144c53a2cb1825b39ba4fad964736f6c634300080f0033

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

303000000000000000000000000000000000000000000000000000000000000000000000000000000000000053fba816bd69a7f2a096f58687f87dd3020d0d5c0000000000000000000000003bdb887dc46ec0e964df89ffe2980db0121f0fd000000000000000000000000000000000000000000000000000000000649eedf000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000009465945544832333036000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000094659455448323330360000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : underlyingId_ (bytes6): 0x303000000000
Arg [1] : oracle_ (address): 0x53FBa816BD69a7f2a096f58687f87dd3020d0d5c
Arg [2] : join_ (address): 0x3bDb887Dc46ec0E964Df89fFE2980db0121f0fD0
Arg [3] : maturity_ (uint256): 1688137200
Arg [4] : name (string): FYETH2306
Arg [5] : symbol (string): FYETH2306

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 3030000000000000000000000000000000000000000000000000000000000000
Arg [1] : 00000000000000000000000053fba816bd69a7f2a096f58687f87dd3020d0d5c
Arg [2] : 0000000000000000000000003bdb887dc46ec0e964df89ffe2980db0121f0fd0
Arg [3] : 00000000000000000000000000000000000000000000000000000000649eedf0
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [7] : 4659455448323330360000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [9] : 4659455448323330360000000000000000000000000000000000000000000000


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

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