# Protocol Design

A more comprehensive summary of Vest’s risk engine and the exact models behind it can be found on our whitepaper.

Vest continuously calculates risk to support dynamic fees and funding rates along with partial liquidations. For any given source of risk (a new trade, asset price risk, liquidation) Vest calculates the additional capital needed to support the additional risk and adjusts the system accordingly to guarantee solvency.

## zkRisk

zkRisk is a novel framework to guarantee the solvency of an exchange with high probability. The system enforces a risk-indifferent pricing model by quantifying the potential for shortfall in any trade using a coherent risk measure.

zkRisk uses a specific extension of a coherent risk measure known as Entropic Value-at-Risk (EVaR) to determine the probability of protocol insolvency at any given moment. In short, EVaR defines a state after each trade that represents the amount of risk in the system.

Calculations associated with this risk measurement are conducted off-chain and submitted to an on-chain verifier. This on-chain verifier can reject the transaction if the proof is incorrect, or accept the transaction. This verification component leveraging ZK technology is first-of-its-kind in the perp DEX space, with most other protocols conducting matching or pricing off-chain with no on-chain verification.

## Premia

Premia is a dynamic trading fee derived by taking the difference in the EVaR-defined risk state before and after the risk engine accepts a trade.

If a trade increases the risk of insolvency, traders are charged a higher premia in proportion to that risk, protecting LPs and decreasing the cost of trading for users who mitigate the system’s risk.

If a trade decreases the risk of insolvency, traders are charged zero premia.

## Funding Rate

Funding is determined by taking the difference in the EVaR-defined risk state before and after price movements. Funding is first distributed to LPs and AMM to guarantee solvency, with excess funding distributed to traders.

Funding is distributed across different markets using Euler Allocation to determine an overall funding rate per asset. This measure is then split across traders based on how much open interest they own within that market.

Rather than funding being settled at fixed intervals, funding is applied on a continuous interval and settled upon position close.

## AMM

The Automated Market Maker (AMM) contains its own proprietary capital that users trade against. AMM capital serves as a barrier between traders and LPs, protecting passive LPs from being the direct counterparty of profitable traders. Trader PnL is primarily settled via AMM capital.

Should the AMM run out of capital, LP capital will be used to provide trading until the AMM accrues more capital via fees and trader PnL.

Last updated