How Perpetual DEXs Work: Funding, Oracles, Margin and Liquidations
In decentralized finance, perpetual trading is one of the more technically challenging products. A perpetual contract is a contract that does not expire for traders to buy or sell either long or short. Unlike a spot swap, the trader does not have to have an underlying asset.
There are multiple issues that a decentralized perpetuals trading platform would need to address: Where is the reference price, how are positions valued, how does a trading platform calculate the funding, how does a trading platform keep the collateral and what happens if a position becomes unsafe?
These are accomplished in different ways for each protocol, but they all share a similar framework. Understanding them makes it easier to evaluate a dex trading platform beyond its leverage figure.
What Is a Perpetual DEX?
A perpetual DEX is a decentralized exchange dedicated to perpetual contracts trading, not just tokens trading.
A trader can go long on an asset if he thinks its price will go up or short an asset if he thinks its price will go down. Collateral supports the position and leverage is the extent to which the size of the market exposure is greater than the collateral.
Instead, perpetual markets use funding payments to keep the contract price near a reference price for the underlying asset. dYdX describes funding as a payment between longs and shorts that helps keep perpetual prices aligned with the oracle price.
That sounds straightforward, but the risk engine underneath has several moving parts.
How Does a Perpetual DEX Price a Position?
The first question is where the protocol gets its price.
Most perpetual systems use an oracle to obtain a reference price rather than relying solely on the last trade executed on the DEX. This matters because a single low-volume transaction could otherwise move the displayed price and potentially trigger an unfair liquidation.
Some protocols also distinguish between an index price and a mark price. The index represents the external reference price, while the mark is a protocol-defined value used for calculations such as unrealized PnL and liquidation.
GMX , for example, documents oracle-based pricing and says its liquidations use Chainlink Data Streams rather than relying on temporary spread movements.
The oracle design therefore becomes part of the security model of a decentralized crypto exchange.
Why Do Perpetual Markets Need Funding Rates?
A perpetual contract has no expiry through which its price naturally converges with spot.
Funding addresses that problem by transferring payments between long and short traders. When the perpetual trades above its reference price, longs may pay shorts. When it trades below the reference, shorts may pay longs.
The exact formula and payment interval vary by protocol. dYdX currently calculates funding using market activity and applies parameters that can be adjusted through governance.
Dexlyn uses a different mechanism. Its documentation describes funding as a function of market skew, with the skew determining the velocity at which the funding rate changes. Positive funding means longs pay shorts, while negative funding reverses the direction.
Funding is not the same as a trading fee. It is generally a transfer between market participants rather than a fee paid directly to the exchange.
What Happens When a Position Loses Money?
Every leveraged position has a margin requirement.
Initial margin is the collateral required to open a position. Maintenance margin is the minimum equity required to keep it open. If losses reduce the trader's equity below the required threshold, the protocol can liquidate the position.
The exact liquidation process varies. Some systems attempt partial reductions before closing the full position, while others use liquidity pools, insurance funds, or other mechanisms to absorb losses.
This is one reason a decentralized exchange platform should be evaluated by its risk engine rather than its maximum leverage alone.
Higher leverage leaves less room between the entry price and liquidation price. A small adverse move can therefore have a much larger effect on available margin.
Where Does Liquidity Come From?
Perpetual DEXs do not all use the same market architecture.
Some use order books where traders interact through bids and asks. Others use liquidity pools that act as counterparties to traders.
Dexlyn's perpetual system uses a liquidity pool containing $CASH, with liquidity providers receiving DXLP tokens representing their share. The documentation states that the pool acts as the counterparty to protocol trades and that LP returns are affected by trader PnL and fees.
GMX uses GM and GLV liquidity pools for its perpetual and spot trading system.
The distinction matters for LPs. In a spot AMM, liquidity providers commonly think about trading fees and impermanent loss. In a perpetual pool, they also have exposure to the aggregate PnL of traders and the protocol's risk controls.
What Should Traders Check Before Opening a Perpetual?
A trader comparing a decentralized trading platform should look beyond the leverage selector.
Check:
- Oracle source: Which price feed determines PnL and liquidation?
- Funding: How is the rate calculated and how often does it update?
- Margin: what is the initial and maintenance requirement?
- Price impact: Can your position move the execution price?
- Fees: Check both opening and closing costs.
- Liquidity: Know who/what is the counterparty.
- Liquidation: Understand how positions are liquidated if there's not enough margin.
- Risk controls: Look for circuit breakers, caps, or other protection mechanisms.
Dexlyn, for example, applies price impact based partly on market skew and uses the Supra Oracle Network as its index-price source. Its documentation also lists position-level stop-loss and take-profit functionality.
Why the Architecture Matters
A perpetual DEX is more than a leveraged trading interface. It is a collection of pricing, collateral, liquidity, funding, and liquidation systems that have to work together.
Two platforms can offer the same trading pair and leverage limit while exposing traders and liquidity providers to very different mechanisms underneath.
For that reason, choosing a dex trading platform should start with the mechanics of the market rather than the headline leverage number. A trader who knows how the oracle works, where liquidity comes from, how funding is charged, and when liquidation occurs has a much clearer picture of the position being opened.
Perpetual trading can make on-chain markets more flexible, but the tradeoff is a more complicated risk system. Reading the protocol's documentation before trading is often just as useful as checking the chart.
