Sturdy Finance crvUSD Aggregator: Understanding the Oracle
An introduction to the Oracle used in Sturdy silos managed by Llama Risk
Links
Sturdy App: crvUSD Aggregator | USDC Silo | USDT Silo | FRAX Silo | mkUSD Silo
Sturdy Governance: Llama Risk Proposal for crvUSD Aggregator
Oracle Contracts: yvUSDTcrvUSDOracle | yvUSDCcrvUSDOracle | yvFRAXcrvUSDOracle | yvMkUSDcrvUSDOracle
Introduction
Last week we announced the launch of the crvUSD aggregator on Sturdy Finance v2, managed by Llama Risk. We are excited to support the Curve ecosystem by enabling additional yield opportunities for users and providing them with the necessary tools and information to manage their risk exposure.
The crvUSD aggregator is a Yearn V3 vault that allocates crvUSD deposits to a set of strategies, i.e. Sturdy siloed lending pairs that use crvUSD as the borrowable asset. The aggregator redistributes crvUSD on behalf of its depositors to optimize yield and is currently incentivized with additional CRV and STRDY rewards. The aggregator manager controls additional parameters, such as allocation, minimum idle, and individual debt ceilings. Allocation during the bootstrapping phase is currently manual, with a plan to move to a keeper that derives optimal allocation via computation done on zkML.
There are four silos whitelisted in the crvUSD aggregator, all of them using crvUSD stableswap LPs as collateral and wrapped in a Yearn vault that regularly harvests and compounds the interest on the underlying LPs. The Yearn vaults employ configurable strategies such as boosted farming with Yearn’s veCRV position, or depositing to Convex and harvesting rewards there.
The table below lists the collateral types along with information about the forecasted yield on collateral, the delta between the yield and borrow cost, and the delta if the user selects max leverage (8.8x leverage on USDC/USDT/FRAX silos and 5.5x on mkUSD silo).
Sturdy allows borrowers to select their desired leverage when opening a position. The yield potential from farming the pools with leverage is substantial, but increasing leverage also comes with an increased liquidation risk. The collateral types were selected for the low volatility inherent to stableswap LPs. Still, understanding the price feed oracle is essential for borrowers to assess an amount of leverage that suits their risk appetite.
This post aims to introduce the Sturdy Oracle for Yearn LP vaults. We are developing a dashboard with metrics for these silos that will include the historical behavior of the price oracle, among other metrics about borrow positions, liquidations, and interest rates. Ultimately these guides and tools aim to serve users in making well-informed decisions about participating in the crvUSD aggregator and its constituent silos.
Understanding the Oracle
The crvUSD aggregator currently allocates to four different markets. Below we will examine how oracles are calculated. Two oracles are deployed: one for USDT/USDC/FRAX and another for mkUSD. Let's delve into the details:
Type A - CrvUSDYv3CRVCrvUSDOracle
This Oracle contract determines the price of a specific Yearn vault token, which represents a Curve Finance liquidity pool share containing a stablecoin (USDT, USDC, or FRAX) and crvUSD. It fetches and calculates prices from multiple sources, including Curve StableSwap EMA Oracle, LLAMMA AMM EMA Oracle, and Chainlink, applying these prices to derive the final Oracle price.
Step 1: Fetch crvUSD/ETH Prices from Two Sources
LLAMMA: The Curve pool EMA price_oracle from crvUSD/ETH.
Chainlink: Provides crvUSD/USD and ETH/USD feeds, with a staleness check to ensure data freshness.
_getCrvUSDPrice() returns the min of the two values.
Step 2: Determine the Price of the Yearn LP Token in ETH
The price of the Yearn Curve LP token (Curve-(USDT/USDC/FRAX)-CrvUSD LP Token) in ETH is calculated by first taking the min value between crvUSDPrice and the counterparty asset price in the pool by taking:
Chainlink's feed for (USDT/USDC/FRAX)/ETH, including a staleness check.
_crvUSDPrice calculated in the previous step.
This base value assumes the entire pool is composed of the lower-priced stable to prevent manipulation and is multiplied by the pool’s virtual_price to account for the increase in pool value over time from swap fees.
Finally, the LP token price is multiplied by the Yearn vault pricePerShare to account for an increase in vault value over time from harvesting and compounding within the vault.
This process to price Curve stableswap LP tokens in a manipulation-resistant way was publicized in this Chainlink blog post.
Step 3: Return the Final Values
The final rate is calculated as the crvUSD price in ETH divided by the Yearn LP position value in ETH to produce a value of crvUSD/yv3CRVCrvUSD. This produces an inverted value for the Yearn LP price, normalized to crvUSD, that should decrease over time as the vault accrues interest.
The oracle returns the following values:
priceHigh: The calculated rate or PRICE_MIN, whichever is higher. PRICE_MIN acts as a safeguard: if the calculated value is lower than PRICE_MIN (indicating a higher collateral value), the oracle defaults to using PRICE_MIN. This cap ensures that users can never borrow assets worth more than their collateral's value.
priceLow: Identically set to price high in the current implementation, not used in this specific Oracle.
Type B - CrvUSDYvMkUSDCrvUSDPairOracle
This Oracle is specific to mkUSD, which does not currently have a Chainlink feed. Most steps are identical, except for Step 2, where the mkUSD price for mkUSD is fetched from the mkUSD/crvUSD Curve pool (EMA).
It takes the min value between the mkUSD price from the Curve pool and 1 and normalizes the price to ETH. The rationale for enforcing a 1:1 ceiling on the mkUSD price is to prevent manipulation of the pool Oracle. The remaining steps to determine the Yearn vault price are the same.
Next Steps
We will be releasing a public dashboard that includes metrics across the various components making up the crvUSD aggregator, including:
Curve pool and stablecoin metrics
Yearn vault metrics
Sturdy Silo metrics
crvUSD aggregator metrics
Stay tuned for more information, we’ll be announcing the dashboard release on our Twitter @LlamaRisk.
In the meantime, readers may also find a useful resource in our overview of the legal rules applicable to yield optimizers:
Disclaimer:
LlamaRisk provides the review of the aggregator on Sturdy Finance v2 for informational purposes only, and such provision does not constitute financial, investment, legal, or professional advice. In the context of Sturdy Finance v2, LlamaRisk does not take custody, control, or influence over user funds or investment choices and expressly disclaims any liability or responsibility for losses, damages, or other issues that may arise from users' investment decisions.
The content provided by LlamaRisk, including any reports or overviews, is intended as a general guide and should not be relied upon as definitive or comprehensive advice. Users are advised not to act upon this information without seeking appropriate professional counsel specific to their situation.