Introduction
Annual Percentage Yield (APY) is a critical metric for evaluating the returns on investments in DeFi protocols. In Compound V3, calculating the APY for COMP rewards involves understanding the reward rates and their impact on supply and borrow activities. If you want to understand how the rewards system works for Compound V3, please checkout this post. In this post, lets explore the method to calculate the APY for COMP rewards in Compound V3 with detailed examples.
Understanding APY Calculation
APY measures the real rate of return on an investment, taking into account the effect of compounding interest. For COMP rewards in Compound V3, the APY calculation involves several steps:
- Gathering Key Variables:
baseTrackingSupplySpeed
andbaseTrackingBorrowSpeed
: These indicate the speed at which COMP rewards are accumulated for supply and borrow activities, respectively.baseIndexScale
: The scaling factor for the indexes.totalSupply
andtotalBorrow
: The total amount of assets supplied and borrowed in the protocol.- Prices of COMP and USDC in USD to convert values into a common unit.
- Daily Reward Calculation:
- Calculate the daily COMP rewards for both suppliers and borrowers.
- For suppliers:
- For borrowers:
- Converting to APY:
- Convert the daily reward rates into APY using the formula for compounding interest:
- Similarly for borrowers:
Example Calculation
Let’s go through an example to illustrate the calculation of COMP reward APY:
- Given Data:
- BaseTrackingSupplySpeed: 1,747,685,185,185 COMP per second
- COMP Price: $54.17
- Total Supply: 550,801,738 USDC
- USDC Price: $0.99998462
- baseIndexScale: 1e15.
- seconds per day: 86,400.
- days in year: 365.
- Daily COMP Rewards for Suppliers:
- Calculating APY:
Conclusion
By understanding the detailed mechanics of the Compound V3 rewards system and the method for calculating APY, users can make informed decisions about their lending and borrowing strategies. This in-depth knowledge helps in maximizing returns and optimizing participation in the protocol.