I’ve been trying to understand the yearn.finance ecosystem and ran into a confusing scenario on why withdrawal fees are handled this way.
The contract I’m reviewing is yVault, specifically the
withdraw() function on line 339:
Withdrawal fees are only charged when
b < r is
b is the balance of the vault, and
r is the total balance in the system (strategy contract + liquidity pools, etc.) for this strategy.
In other words, strategies that utilize external pools (such as how the yCRV strategy holds most of the assets in curve to generate yield) will not pay withdrawal fees since
b < r under most normal operating conditions. Strategies that don’t hold much assets externally (such as the yDai strategy) will have a majority of its assets in its vault, and thus
b > r mostly, and users will incur withdrawal fees.
A transaction withdrawing yCRV from the yCRV yVault does not incur withdrawal fees:
A transaction withdrawing yDai from the yDai yVault does incur withdrawal fees:
If anyone can shed some light on why withdrawal fees are handled this way, please do!