YT Vault Module

Overview

YT module manages the configuration and lifecycle of "YT (Yield Token) products." It uses user deposits as collateral, borrows CBRToken through CBR, then generates fixed-rate liquidity positions through SLF (maturity recovery). Each YT instance is equipped with independent WalletInstance and YTHelper for executing specific strategies and fund operations. YTCore is responsible for creating/recording/maturing/liquidating YT instances and managing related permissions and statistics.

How YT Positions Work

When users open a YT position, the system follows these steps:

1. Deploy Position Wallet (Wallet Instance)

  • Deploy a lightweight wallet contract specifically for this position to custody collateral and borrowed assets

2. Create Position in CBR

  • Collateralize RWA assets

  • Borrow SLB

  • Create position and save CBR position ID in YT position information

3. Register Fixed Interest Lending Position in SLF

  • Call static interest borrowing interface

  • System calculates actual borrowable USDC based on SLB quantity

  • Create SLF position with fixed maturity and save SLF position ID in YT position information

4. Transfer Assets to Wallet Instance

  • User's RWA assets transfer to wallet

  • Borrowed USDC (converted in SLF) transfers to wallet

5. Call YTHelper to Execute Strategy

  • YTHelper converts USDC liquidity according to yield strategy

  • Currently uses mint for direct conversion between assets (testing phase)

6. Risk Control Check & Position Recording

  • Verify position meets safety requirements

  • Record position in user's portfolio


Functions and Responsibilities

1. Position Configuration Management

Allow protocol administrators to define and update position configurations:

  • Deposit Token

  • Borrow Token

  • Position logic executor (YTHelper)

  • Price oracle (Oracle)

  • Maximum borrow rate (maxBorrowRate)

  • Liquidation threshold (liquidationRate)

Bind configurations with corresponding deposit tokens for easy user strategy discovery.

2. Position Lifecycle Management

Create Position (createPosition):

  • Initialize wallet instance (WalletInstance)

  • Create loan in CBR, collateralize deposits and borrow CBRToken

  • Convert CBRToken to liquidity, borrow target tokens in SLF

  • Inject deposits and borrowed tokens into WalletInstance, execute initial investment logic through YTHelper

  • Check position borrow rate reasonableness

Refresh Position Status (pokePosition):

  • Call WalletInstance and SLF to update yield and debt data

Position Liquidation (liquidate):

  • Liquidation must be executed by authorized liquidators when position LTV ≥ liquidationRate

  • Liquidation transfers YTInstance ownership to liquidator

Position Maturity (matureYT):

  • preMatureYT: At maturity or under admin/liquidator conditions, call YTHelper's prepareClose for closure preparation (e.g., converting LP positions back to base tokens). Must be triggered by owner or admin/liquidator (meeting preMatureAt conditions or being owner and liquidator)

  • matureYT: At maturity or under authorized liquidation conditions, read current debt from SLF liquidityId (liquidityAmount + interestAmount), use YTHelper's close to complete strategy closure (convert assets back to corresponding tokens), then:

    • Authorize and call closeStatic to SLF (normal maturity closure of static position)

    • Authorize and call repay to CBR to repay corresponding CBR collateral (using collateralAmount in price lock)

    • Update totalYts (deduct settled debt amount), trigger PositionMatured event

  • matureWithLiquidation: External parties (e.g., liquidators) first pay debt with borrowing tokens then close (closeStaticEarly), subsequently call helper's close, repay to CBR and update statistics. Suitable for "third-party debt payment and closure triggering" scenarios

3. Risk Control & Access Control

Position Rate Check:

  • Use oracle prices to calculate position debt value / collateral value

  • Exceeds maxBorrowRate → Block creation or operations

  • Exceeds liquidationRate → Allow liquidator takeover

Liquidator Management:

  • Protocol administrators can add/remove liquidators

  • Only liquidators can execute position liquidations


Interactions and Dependencies

CBR Module

  • Used for collateral and lending logic (createLoan, repay)

  • Manage collateral and borrowing token ledgers

SLF Module

  • Responsible for fixed-rate liquidity positions and static borrowing

  • Provide position debt data for maturity calculations

WalletInstance

  • Independent wallet contract for each position, isolating position assets

  • Execute position logic (investment, unstaking, reward claiming)

YTHelper

  • Strategy execution logic specific to yield token strategies

  • Called by YTCore to operate assets within WalletInstance

  • Handles position closure and asset conversion at maturity

Oracle Interface

  • Provide collateral and borrowing token prices

  • Used to calculate position borrow rates and liquidation thresholds

Last updated

Was this helpful?