Ambiguity in charging of withdrawal fees in yVault contracts

I’ve been trying to understand the 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 true, where 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.

Example transactions:
A transaction withdrawing yCRV from the yCRV yVault does not incur withdrawal fees: 0x3e502ae3619c7302912afa66e438a355ed5f14703f1a27f67e1f6c4da0f8f639

A transaction withdrawing yDai from the yDai yVault does incur withdrawal fees: 0x15dfa2e1e9714153e01f3d05ca14446742690ce735e1bb9eedc4f48003144142

If anyone can shed some light on why withdrawal fees are handled this way, please do!

1 Like

From a telegram chat “@andrecronje any idea why the withdrawal has been hit or miss?”

“So there is a deposit buffer, when you hit this buffer, no fee, this buffer is roughly 5% of the system, if it increases above 5% the system deposits the diff of buffer less 5%, so it tries to keep the balance between available buffer and maximized earnings. So as you deposit and the buffer increases above 5% it sends it to the underlying strategy, when you withdraw from the underlying strategy, you pay 5% on the strategy withdraw amount, not the withdraw amount. Since you are working with sub $5k, it often falls within this buffer, but it is highly dependent on deposits at the time. So if a big deposit came in before your tx (which triggers strategy deposit), then your next withdrawal will hit 5%, if the deposits did not exceed it, you will withdraw from the buffer instead. Its designed so that smaller investors don’t take the fee hit”


Closed since inactive. Feel free to reopen if this topic is still relevant.