DEV Community

lilian
lilian

Posted on

Under the Hood of a Beefy Vault: How Automated Yield Compounding Works

Beefy.com Official is a leading Beefy Yield Optimizer that simplifies yield farming across dozens of blockchains. The core of the protocol is its Vaults. This guide gives a technical overview of Beefy Autocompounding Vaults and the harvest() function.

Core Concept: The Vault and mooTokens
When you deposit an asset (e.g., a Curve LP token) into a Beefy Vault, you are not just depositing into a pool. You are minting a new token: a "mooToken" (e.g., mooCurveUSDC). A look at Beefy mooTokens Explained shows this is an interest-bearing token that represents your share of the Vault's assets.

The Harvest Function: The Autocompounding Engine
The magic of Beefy is the harvest() function within each Vault's strategy contract.

Accumulation: The underlying farm (e.g., a DEX) generates reward tokens for the liquidity you provided. These rewards sit unclaimed.

harvest() Call: A permissionless keeper bot calls the harvest() function. This call triggers the strategy contract.

Execution: The strategy contract sells the accumulated reward tokens on a DEX.

Reinvestment: It uses the proceeds from the sale to buy more of the original underlying asset (e.g., more of the Curve LP token).

Compounding: This newly acquired principal is added back into the Vault.

This process happens automatically several times a day. The total amount of the underlying asset in the Vault increases, making each mooToken worth more over time. This is true, automated compounding.

A Simplified Look at How to use Beefy.com:
You simply deposit your assets into a Vault. The harvest() logic, keepers, and reinvestment are all handled for you.

For a deep dive into the strategy code and security measures, please refer to the https://sites.google.com/koinly-tax-reports.org/beefyfinance.

Top comments (0)