Yield and APY tracking

In Yelay V3, all earned yield is collected in the YieldExtractor contract. The yield is then becoming available to be claimed for clients and end users on a daily basis.

Fetch aggregated yield accrual info

Use this method to retrieve aggregated yield data for specified vaults, pools, and users within a given timeframe:

const aggregatedYieldData = await sdk.yields.getYields([vaults], [poolIds], [users], timeframe);

Where:

  • vaults – Array of vault addresses to filter results.

  • poolIds – Array of pool IDs to filter results.

  • users – Array of user addresses to filter results.

  • timeframe – Timeframe to limit results within a specific period.

Fetch yield and APY per vault

Fetch yield info and APY per specific vault per given timeframe:

const aggregatedYieldData = const vaultYieldData = await sdk.yields.getVaultsYield([vaults], {fromTimestamp, toTimestamp});await sdk.yields.getYields([vaults], [poolIds], [users], timeframe);

The method returns a response of the following structure:

[{ vault: '0x39dac87be293dc855b60fedd89667364865378cc',
startBlock: 22629951,
finishBlock: 22637089,
startTimestamp: 1749024047,
finishTimestamp: 1749110483,
yield: '336925898',
apy: '9.22'}]

The tracked APY value of my vault suddenly spiked. What has happened?

Most likely, you are using small time interval in order to fetch APY value, this results in big spikes in the APY. APY is calculated from vault’s yield over the specified time/block interval (f.e. 7 days). Since this period is usually shorter than a full year, the yield is extrapolated to an annual percentage. However, yield tends to spike at certain times, mainly when farmed protocol rewards /are exchanged to the vault asset tokens and compounded (which are typically done every 3rd day). If your chosen interval happens to "capture" such a spike, the extrapolated APY can appear unusually high. While the calculation is technically correct, the result can be misleading. To smooth out these fluctuations, we recommend not using timeframes shorter than a week when querying APY.

Zooming in on rewards

The yield comes from two sources:

  • the native yield of the underlying vault

  • reward tokens (f.e. $MORPHO or $SILO)

The native yield is usually distributed more frequently, often whenever someone deposits or withdraws from the vault. On the other hand, rewards can be distributed by protocols sporadically and less regularly.

Compounding rewards means following process:

  • Yelay vault claims those reward tokens (which are usually in a different ERC-20 token)

  • Swaps them into the Yelay vault's underlying token

  • Distributes them among users in form of yield.

Let’s say a user deposited an unspecified amount and earned 70 USDC in yield over the course of one week. The native APY is 4%, and there’s an additional 2% APY from rewards. On the 3rd day, the user receives an additional 35 USDC from compounding the rewards. So, his total yield suddenly jumps from 70 USDC to 105 USDC. If APY is calculated using data from each day except the last, the average yield is based on 10 USDC per day. However, if you calculate it using only the last 24 hours, the daily yield appears to be 45 USDC (10 + 35), which is significantly higher and results in an inflated APY.

Last updated