Skip to main content

Funding Rate

To maintain a healthy balance between long and short positions, Denaria introduces a continuous, onchain funding rate mechanism. Whenever the market tilts too heavily in one direction, for example, if too many traders are long, the system compensates participants on the less popular side through funding payments.

In this context, exposure refers to the net position that traders collectively hold in the system. Since LPs always take the opposite side of trader positions, they inherit the reverse exposure by design. For example, if traders in aggregate are long, LPs as a group are short.

Funding payments are the tool that rebalances this dynamic: traders on the crowded side of the market pay funding, and those payments flow to LPs and traders on the opposite side. This means that overall, traders pay funding fees to LPs, who are naturally positioned as the counterparty to excess trader exposure.

Unlike traditional perpetual protocols that calculate funding as the difference between an external index price and an internal mark price, Denaria’s model ties the funding rate directly to net open interest imbalance. The result is a simpler, more transparent incentive structure that continuously redistributes value from the majority side of the market to the minority side and to liquidity providers.

Where:

  • Net Trader Exposure is the total value of long positions minus short positions.
  • Total Liquidity is the combined value of all the vAsset and vStable in the pool, expressed in USD.
  • c is the funding coefficient, a configurable variable that determines how aggressively the funding rate reacts to imbalance.

This funding rate accrues continuously, in real time. Rather than settling payments in fixed intervals (e.g., every 8 hours), Denaria updates funding calculations on every relevant protocol interaction, including trading, liquidity changes, and position closures. This block-level granularity ensures that funding remains accurate and resistant to timing-based manipulation.

A Practical Example​

Suppose the system holds 100millionβˆ—βˆ—intotalvirtualliquidity,withaβˆ—βˆ—netlongexposureof100 million** in total virtual liquidity, with a **net long exposure of 500,000. If the funding coefficient is set to 10, the daily funding rate becomes:

This rate is not paid out instantly but is continuously accumulated and attributed to each position based on its notional size and holding time. It adjusts dynamically as new trades are executed or existing positions are closed, ensuring that incentives always reflect the current market imbalance.

How Funding is Accrued and Settled​

Funding payments are accounted for continuously but settled lazily, meaning they are not streamed block by block, but instead computed and applied when a trader or LP interacts with the system. This could include opening, closing, modifying a position, or withdrawing liquidity.

Every user holds a snapshot of the last known funding state when they interacted with the protocol. When the user returns, their owed or earned funding fees are calculated as the product of their position size and the change in the global funding rate since that snapshot. For LPs, whose positions and exposure shift continuously with every trade executed in the pool, the protocol employs a matrix-based accounting model. This approach dynamically reconstructs their effective exposure over time and ensures precise computation of funding payments.

This model ensures scalability without requiring constant onchain writes or fund transfers. It also minimizes gas costs while preserving real-time accuracy, aligning perfectly with Denaria’s goal of performance without compromise.