Portfolio Valuation
Total Asset Value Calculation
The Term Strategy Vault's implementation of _harvestAndReport() calculates the total asset value by invoking _totalAssetValue(). This function updates the totalAssets value in the BaseStrategy and provides a comprehensive view of the portfolio’s value. It aggregates three components:
Idle Liquidity: The balance of idle funds held within the idle vault.
Repo Token Holdings: The present value of active repoToken positions, discounted using rates from the
discountRateAdapter.Pending Auction Offers: The present value of any pending auction offers, assuming those offers are filled.
Total Value Implementation
The _totalAssetValue() function aggregates these components to calculate the total portfolio value:
function _totalAssetValue(uint256 liquidBalance) internal view returns (uint256) {        
    return
        liquidBalance +  // Yearn vault + idle balance
        repoTokenListData.getPresentValue(  // Active repo token positions
            strategyState.discountRateAdapter,
            PURCHASE_TOKEN_PRECISION
        ) +
        termAuctionListData.getPresentValue(  // Pending auction offers
            repoTokenListData,
            strategyState.discountRateAdapter,
            PURCHASE_TOKEN_PRECISION,
            address(0)
        );
}Key Components
1. Repo Token Holdings
Managed by the
RepoTokenListDatastruct:struct RepoTokenListData { address head; mapping(address => RepoTokenListNode) nodes; mapping(address => uint256) discountRates; mapping(address => uint256) collateralTokenParams; }Purpose:
Maintains a linked list of repo tokens held by the vault.
Tracks discount rates and collateral parameters for each token.
2. Discount Rate Adapter
Interface:
ITermDiscountRateAdapterPurpose:
Serves as an interest rate oracle for Term repoTokens.
Applies redemption haircuts to account for bad debt risks.
3. Pending Offers
Managed by the
TermAuctionListDatastruct:struct TermAuctionListData { bytes32 head; mapping(bytes32 => TermAuctionListNode) nodes; mapping(bytes32 => PendingOffer) offers; }Purpose:
Tracks all pending auction offers.
Estimates the present value of pending offers, assuming they are filled.
Present Value Calculation
The portfolio valuation uses:
RepoToken face value adjusted by redemptionValue
Actual/360 day count convention from current time to redemptionTimestamp
Market rates from Term auctions plus configurable markup
Base Formula:
timeLeftToMaturityDayFraction = ((redemptionTimestamp - block.timestamp) * purchaseTokenPrecision) / THREESIXTY_DAYCOUNT_SECONDS;
presentValue = (repoTokenAmountInBaseAssetPrecision * purchaseTokenPrecision) / 
    (purchaseTokenPrecision + (discountRate * timeLeftToMaturityDayFraction / RATE_PRECISION));Last updated