# Deposit and Exit Fee

## Vault Fee Rationale

To protect current vault shareholders from economic attacks stemming from transient depegging events, we may implement a [Pessimistic Price Oracle](https://www.inverse.finance/blog/posts/en-US/Why-We-Are-Using-Pessimistic-Price-Oracles) to generate ***dynamic*** Deposit and Exit fees. These fees are sensitive to current market price volatility for the vault reserve token.&#x20;

For Origami vaults, the Deposit Fee discourages arbitrageurs who seek to enter the vault when the underlying token was depegged to enter at a favorable price. The Exit fee covers the cost of unwinding the leveraged position, which may include slippage (up to 0.5% maximum) and gas fees.&#x20;

{% hint style="info" %}
Exiting a 11x position at 0.1% slippage means you'd be will to pay 1% fee to unwind the position. This is true regardless of whether you enter the position through Origami Finance or manually.
{% endhint %}

A Dynamic Deposit/Exit fee will be imposed *if at the time of deposit or exit,* the vault reserve token spot price deviation from the reference price is greater than the threshold deviation. The price deviation from reference price is also multiplied by the `LevFactor` to account for the impact of leverage for that vault. These vault fees are imposed as a discount on the number of vault shares issued to the user at the time of deposit, or withheld at the time of redemption. \
\
For the Fees Schedule for a specific vault, check the [Vault Fee Schedule](https://docs.origami.finance/the-second-fold-v2/vault-fee-schedule).

{% hint style="info" %}
An economic attack is exemplified when a user attempts to deposit into the vault when the share price was temporarily depressed due to the reserve asset e.g. sUSDe being in a depegged state vs DAI, and subsequently exit once the sUSDe price was restored.
{% endhint %}

## When market price volatility is low for the underlying vault token:

* A vault fee of *not less than* `minDepositFeePercent` will be assessed for User Deposits&#x20;
* A vault fee of *not less than* `minExitFeePercent` will be assessed for User Exits

### When market price volatility is high for the underlying vault token:

* The Vault deposit and exit fee may be significantly higher than the minimum (See Formula Below)

{% hint style="info" %}
The Deposit and Exit modal will always show the vault fee that is applicable. If the current Dynamic vault deposit or exit fee is higher than the `minimumFee` outlined in the [Vault Fee Schedule](https://docs.origami.finance/the-second-fold-v2/vault-fee-schedule), the higher of the two fees will be applied.
{% endhint %}

## Deposit Fee Formula

$$
\boxed{max(levFactor*min(reference-spot, 0) / reference*100, minDepositFeePercent)}
$$

<figure><img src="https://1838495634-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuQqfnSZUSHvj0FdEt8I8%2Fuploads%2FlXSeAQmpGsQTnGJnV2Jl%2FsUSDe%205x%20Deposit%20Fee.png?alt=media&#x26;token=7f4ae8af-4e15-4390-8a86-3e6e6d17fb87" alt=""><figcaption></figcaption></figure>

## Exit Fee Formula

$$
\boxed{max(levFactor*min(spot-reference, 0)/reference*100, minExitFeePercent) }
$$

<figure><img src="https://1838495634-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuQqfnSZUSHvj0FdEt8I8%2Fuploads%2FcdfyEUSQIZWiXNX697lm%2FsUSDe%205x%20Exit%20Fee%201.png?alt=media&#x26;token=6a1a0227-3611-48a1-b261-98e1c7e35735" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If the Exit fee shown on the Exit modal is is higher than the `minExitFee` for the vault, you may wait until the underlying token price is less volatile to exit at the `minExitFee`.
{% endhint %}

Formula Terms Defined for the *lov-sUSDe-a* Vault:

$$
spot = \text{Oracle Price}\_{\text{(sUSDe/DAI)}}
$$

$$
reference = \text{ShareToAsset}*\text{(sUSDe/USDe)} \* \text{Oracle}*\text{(USDe/DAI)}
$$

$$
levFactor\text{ = Vault Leverage}
$$

{% hint style="info" %}
*LevFactor* is set to the actual leverage for the *delta-neutral* lovToken vaults.
{% endhint %}
