# Overview

Found in June 2020, originated from the classic mathematical formula y=f(x)

## YFX - Decentralized Perpetual Exchange

YFX is a leading decentralized perpetual protocol that began in 2020. After three years and four versions of iterations, YFX has transitioned to a community-based. Currently, the project is co-managed by a community geek representative, 0xEuler, along with several developers from the technical community. The restructured YFX team, based on the current market demand for decentralized perpetual contracts, has launched the brand new V4 version. The design of the V4 version will greatly enhance the capital utilization rate and system fairness of the YFX protocol.

## YFX Current Version

| Version                                      | Launch Date  | Available On                                                                                                                       |
| -------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| [V1](/previous-version/what-is-yfx-v1)       | January 2021 | [~~Tron~~](https://trx.yfx.com/) [~~BSC~~](https://bsc.yfx.com/) [~~Heco~~](https://ht.yfx.com/) [~~xDai~~](https://xdai.yfx.com/) |
| [V2](/previous-version/yfx-v2)               | June 2022    | [~~zkSync~~](https://zks-v2.yfx.com/)                                                                                              |
| [V3](broken://pages/JB2QY1HlfwcOjnv2zxcc)    | Aug 2023     | [Arbitrum](https://app3.yfx.com/)                                                                                                  |
| [V4](/yfx-v4/what-is-yfx-v4) Arbitrum        | Apr 2024     | Arbitrum                                                                                                                           |
| [V4](https://app.yfx.com/#/?chain=base) Base | July 2024    | Base                                                                                                                               |

## **YFX.COM Slogan**&#x20;

{% hint style="info" %}
In Math, We Trust. In Blockchain, We Trustless.
{% endhint %}

## Common Links

Official website: <https://www.yfx.com>

Telegram: <https://t.me/YFX_COM>

Twitter: <https://twitter.com/YFX_COM>

Discord: <https://discord.gg/SqBxPQXW2P>

Medium: <https://yfxdefi.medium.com/>

E-mail: <contact@yfx.com>

[Media Kit](/common-resources/media-kit)


# YFX Token

Introduced on May 2021

**YFX token is the platform's utility and governance token. Holding the token unlocks a variety of benefits, including 30% of the platform's transaction fees.**

**Learn more about YFX token:** [**https://yfx.com/coins-en.html**](https://yfx.com/coins-en.html)**.**

{% hint style="info" %}
YFX holders can earn platform-generated fees and vote on community proposals when V4 is released.
{% endhint %}

{% hint style="info" %}
YFX V3 and V4 will be released on the Arbitrum blockchain. After V3 is released, YFX will stop supporting YFX services on BSC, Heco, xDai, and Tron. Users should move their funds from these chains to Arbitrum using YFX Cross-chain Bridge.
{% endhint %}

## **YFX Token New Features:**

**YFX Token:** The platform's utility and governance token. Users can stake YFX to earn 30% of the platform's transaction fees.

**IYFX Token** (Immaturate YFX): Users can stake IYFX to earn rewards similar to regular YFX tokens, and users can vest IYFX to become actual YFX tokens over a period of one year. Note that users cannot transfer or trade their IYFX tokens.

{% hint style="info" %}
**YFX Token Contract Addresses**

ETH [0xf55a93b613d172b86c2ba3981a849dae2aecde2f](https://etherscan.io/token/0xf55a93b613d172b86c2ba3981a849dae2aecde2f)

Heco ~~0xf55a93b613d172b86c2ba3981a849dae2aecde2f~~

BSC ~~0xf55a93b613d172b86c2ba3981a849dae2aecde2f~~

TRON ~~TAP7qf8Ao26ZAKYS5E6SGozUNoSLvBHsGa~~

**Arbitrum**  [0x569deb225441FD18BdE18aED53E2EC7Eb4e10D93](https://arbiscan.io/token/0x569deb225441FD18BdE18aED53E2EC7Eb4e10D93)

OKExChain ~~0x5415dcc6281d64a946f84686a56e51330fb6d92a~~
{% endhint %}

| Name               | YFX Token                                                                                |
| ------------------ | ---------------------------------------------------------------------------------------- |
| Symbol             | YFX                                                                                      |
| Standard           | ERC-20, Arbitrum, ~~TRC-20, BEP-20, HRC-20, KIP-20~~                                     |
| Total Supply       | 100,000,000                                                                              |
| Circulation Supply | [37,300,000 YFX](https://etherscan.io/token/0xf55a93b613d172b86c2ba3981a849dae2aecde2f]) |

## Initial Distribution

<table data-full-width="true"><thead><tr><th> Distribution</th><th>Total</th><th>Already in Circulation</th></tr></thead><tbody><tr><td>Community rewards</td><td>50,000,000</td><td>7,000,000</td></tr><tr><td>Founding team</td><td>18,750,000</td><td>18,750,000</td></tr><tr><td>Angel investors</td><td>6,250,000</td><td>6,250,000</td></tr><tr><td>IDO &#x26; Private Sale investors</td><td>15,000,000</td><td>15,000,000</td></tr><tr><td>Foundation reserve</td><td>10,000,000</td><td>2,300,000</td></tr></tbody></table>

<https://etherscan.io/address/0xf55a93b613d172b86c2ba3981a849dae2aecde2f>

### Fee Distribution

All fees generated in YFX are distributed to the community. ChainLink, Signer, and other fees are paid weekly. Buybacks and burns are executed periodically. The remaining fees are converted to ETH and distributed to the community through mining.

<table><thead><tr><th width="422"></th><th></th></tr></thead><tbody><tr><td>YFX, IYFX Holder</td><td>30%</td></tr><tr><td>YFX Buy Back</td><td>30%</td></tr><tr><td>YLP Holder</td><td>30%</td></tr><tr><td>YFX Locking Rewards</td><td>10%</td></tr></tbody></table>

## Burn History

{% embed url="<https://yfx.com/coins-en.html>" %}

## MutiSignature Addresses

YFX token has multi-signature addresses with mint authority and adopts a 3/5 multi-signature scheme:

| Public Chain | Multi-signature address with mint authority |
| ------------ | ------------------------------------------- |
| ETH          | 0xEf088E2D9760a8e459970df3B3eA20de73eB7A6b  |
| BSC          | 0x3F2a7D4535E212870321A57231e260580286C0B7  |
| Heco         | 0x830299564875b4659B805969Bf0E96588AbF8f4B  |
| Tron         | TMFrFfVc4CQ46JKjXnr7biKqFiMeae74m6          |
| Arbitrum One | 0xDb3A92a5CC57111FbD92991C49A7cF320152fAf9  |


# YFX Cross-chain Bridge

{% hint style="warning" %}
Through the YFXIP-1 proposal, we have stopped supporting Heco, Tron, and BSC. The final cross-chain date for YFX Tokens on these three chains was 2023-01-31. Any tokens that were not cross-chained by then will be considered as having abandoned the cross-chain process and will be burned.

<https://snapshot.org/#/yfxcom.eth/proposal/0x24b2043bc9a10b0eefb4831d74fe3c7c04be35ee6433e6081eeb6a8c6a9a7186>
{% endhint %}

> Since YFX services have been suspended on BSC, Heco, xDai, and Tron, YFX has developed a cross-chain bridge to help users to move funds from BSC, Heco, and Tron to the Arbitrum blockchain.

> <https://yfx.com/bridge/>
>
> The bridge is suspended now.


# Roadmap

## Roadmap Update

{% hint style="success" %}
The YFX project started in June 2020, and the V1 app was successfully deployed on Tron mainnet in January 2021.
{% endhint %}

## 2020

* June - The project was founded to develop a decentralized perpetual contract trading platform.
* GitHub: <https://github.com/yfxcom/yfx-contract-v1-core>

## 2021

* January - V1 was launched and deployed on Tron
* April - V1 was deployed on Heco and BSC
* May - V1 was deployed on Gnosis Chain (formerly xDai Chain)
* GitHub: <https://github.com/yfxcom/yfx-contract-v1-core>

## 2022

* Developed more functions such as funding fees, limit orders, stop-loss & take-profit orders, net position, etc., in V2
* GitHub: <https://github.com/yfxcom/yfx-v2-core>
* June - V2 Certik Audit was complete
* July - V2 was launched and deployed on Heco

## 2023

* April - V2 was deployed on zkSync
* May - The system was upgraded, and V3 was launched on the Aritrum Goerli test network for public testing. YFX Cross-chain Bridge was launched.
* June - V3 Certik Audit will be complete. YFX will be launched and deployed on Arbitrum
* Github: <https://github.com/yfxcom/yfx_v3_core>

## 2024

* January - YFX V4 Develop
* March - YFX V4 Audit
* April- YFX V4 Launch


# Why Choose YFX?

{% hint style="info" %}
YFX began to develop the decentralized perpetual contract protocol in June 2020 and has been iterated to the third version. Many designs of the YFX perpetual contract have been widely referenced and used by other DeFi protocols.
{% endhint %}

## High Security

YFX smart contracts are open source and have passed the audits of many security agencies. There has been no security breach over the years. Users have full control over their funds and can redeem them from the smart contract anytime.

## Better Trading Experience

YFX offers up to 100x leverage for linear, inverse, and quanto perpetual contracts and accepts BTC, ETH, USDT, USDC, and other cryptocurrencies as margin, supports new features like limit orders, take-profit & stop-loss orders, and funding fees, and has an easy-to-navigate trading interface suited for new and professional traders alike.

## Easy to Use

There is no need to register and log in. No KYC is required. You can start trading perpetual contracts after connecting your crypto wallet to YFX.

## High Liquidity

YFX uses the LPB-AMM model, which optimizes the liquidity on the exchange. You can enter and exit positions with minimal spread and zero price impact.


# What is YFX V4？

Building on the current Perpetual Protocol market, YFX V4 offers the most comprehensive solution with lowest cost, providing traders and makers with the most convenient, capital-efficient, and profitable trading platform. Both traders and makers can use a leverage up to 200x for in YFX V4, significantly increasing the capital efficiency within the system. Also the Premium Index and Market Price are introduced to balance long and short positions. In the new earning system and referral system, users can earn YFX tokens with lowest cost and enjoy commissions with up to 75% rebate rate.

## Features: &#x20;

### [Leading protocol ](/yfx-v4/trading/trading-mechanism)

YFX first launched the PvPool trading mechanism in 2021, allowing traders and liquidity pools to trade directly, and it has been widely adopted by today's mainstream Perpetual protocols.  &#x20;

### [Single Asset Pool ](/yfx-v4/ylp)

Liquidity providers can add or remove liquidity for linear (USD-Based) and inverse (Coin-Based) contracts to or from single-asset pools with no impermanent loss.&#x20;

### [Maximized Capital Efficiency](/yfx-v4/lp-leverage)     &#x20;

YFX V4 introduces Leveraged Liquidity Pool (LLP) , enabling liquidity providers to provided liquidity with up to 100x Leverage and maximize the capital efficiency.    &#x20;

### [LPB-AMM](#lpb-amm)

In YFX V4, a new LP Balance Automated Market Maker (LPB-AMM) mechanism is introduced, where the depth of users' trades is determined by the LP's Balance. The greater the LP Balance, the better the trading depth for users; conversely, the lesser the LP Balance, the poorer the trading depth.

### [Diverse Earning System](/yfx-v4/earning)&#x20;

YFX V4 introduces a brand-new earning system, where users can earn YFX tokens and enjoy high rewards through actions such as trading, holding positions, adding liquidity, and referral.&#x20;

### [MPC Wallet](#mpc-wallet)

YFX V4 supports **MPC (Multi-Party Computation)** wallets, enablaing users to log into their wallet systems using **Email, Google, Twitter, Facebook, Discord,** and other accounts, significantly lowering the barrier for users to utilize DeFi products.


# LPB-AMM

LP Balance Automated Market Maker

{% hint style="info" %}
In YFX V4, a new LP Balance Automated Market Maker (LPB-AMM) mechanism is introduced, where the depth of users' trades is determined by the LP's Balance. The greater the LP Balance, the better the trading depth for users; conversely, the lesser the LP Balance, the poorer the trading depth.
{% endhint %}

In the classic UniSwap AMM model, the $$x\*y = k$$ curve is used to calculate the liquidity of the entire market. Under YFX's LPB-AMM model, a new linear function $$y=kx+b$$ is employed, utilizing segmented functions to mimic the depth chart found in CEX (Centralized Exchanges).&#x20;

This approach ultimately achieves a depth chart similar to the ones observed in centralized trading platforms, offering a more nuanced and dynamic representation of market depth that adjusts according to the balance and participation of liquidity providers.&#x20;

<figure><img src="/files/E5f4fvqS5TV3aCEaN2xj" alt=""><figcaption></figcaption></figure>

### Highlights of the LPB-AMM Model in YFX V4

The LPB-AMM model introduced in YFX V4 marks a significant advancement in decentralized finance by bridging the gap between traditional and decentralized finance platforms. Below are some of the standout features of this innovative model:

* **Dynamic Trading Depth**: The depth of trades directly correlates with the LP's Balance, enabling deeper and more liquid trades for participants with greater contributions.
* **Enhanced Market Depth Visualization**: This model provides a depth chart similar to those found in centralized exchanges, thereby offering users a familiar trading experience with the benefits of decentralized security and autonomy.
* **Adaptable Market Dynamics**: The liquidity and depth of the market adjust in real-time based on the activity and balance of liquidity providers, promoting a more responsive and balanced trading environment.

This innovative approach not only enhances the trading experience on decentralized platforms but also paves the way for further integration of traditional financial mechanisms into the DeFi space.


# YLP

### What is YLP?

YLP is a token representing liquidity providers. It is minted based on real cryptocurrencies and can be exchanged back into actual cryptocurrencies. Users holding YLP tokens can earn profits through transaction fees and can also profit from selling LP tokens when the YLP price increases. In version V4, liquidity providers can use high leverage to increase liquidity.

### Buy YLP

Any user can add liquidity into the fund pool by purchasing YLPs. Each fund pool has a corresponding net value(**YLP Price**), which can also be regarded as the price of the YLP token. When users buy YLPs, they will receive an amount of YLPs based on the current net value of the fund pool. The purchased YLPs will be displayed as LP positions in the LP system.

When a fund pool is created, the initial net value is set to 1. The net value is determined by the sum of the fund pool's accumulated unrealized profits and losses (PNL), funding costs, and borrowing costs. The formula for calculating the net value is as follows:

> **YLP Price = (Available liquidity + Occupied liquidity + Unrealized PNL of positions + Receivable funding costs) / Total amount of YLP**
>
> **Amount of YLP =  Margin \* Leverage  / YLP Price**

### Sell YLP/Close LP Position

If users wish to withdraw funds from the liquidity pool, they can sell their held YLP tokens (**if sfLP is used in the Earning System to participate in iYFX Vesting, sfLP must be redeemed before withdrawing from the liquidity pool**), which is represented as closing LP positions in YFX V4. The amount of assets users can retrieve is determined by the net value of the liquidity pool at that time:

> ```
> Assets obtained by the user = Margin+YLP quantity * (exit YLP price - entry YLP price)
> ```

### YLP Liquidation

```
Liquidation price = Entry Price*(1-1/Leverage)*(1 + Maintenance Margin Rate)
```

### Bankruptcy &#x20;

&#x20;Due to the leverage added to the liquidity pools in YFX V4, although highly unlikely, there is still a possibility that the funds in the liquidity pool could be entirely lost to the Taker. This condition is referred to as a bankruptcy state. The YLP price at this state is called the bankruptcy YLP price. The index price at this state is called the bankruptcy index price. All the positions from takers and makers will be closed at a uniform price, remaining funds will be returned to their wallets and the system will be rebooted.&#x20;

&#x20;


# LP Leverage

> In traditional centralized exchanges (CEX) like Binance and BitMex, because of the order book model, traders (Takers) and market makers (Makers) trade under the same model, allowing for up to 100x leverage, which makes the capital utilization efficiency of both parties very high. However, in most decentralized perpetual contract products, including YFX, because traders trade with liquidity pools, LPs cannot use leverage, leading to low capital utilization rates for LPs.

**The innovative measures in the YFX V4 version effectively solve this problem by providing leverage functionality to LPs, allowing them to use up to 100x leverage when adding liquidity.** In other words, LPs can buy into the fund pool's YLP with 100x leverage. When the price of YLP rises, it generates a profit 100 times greater than before. Of course, this also brings greater risk to LPs; when the price of YLP falls, it will generate a loss 100 times greater than before.

## For example:

Assume the **YLP Price = 1**, and Alice has **100 USDC**. She buys YLP with 100x leverage, which means she now owns 10,000 YLP. When the YLP price rises by 1% to 1.01, the value of her YLP becomes `1.01 * 10,000 = 10,100 USDC`, making her profit `10,100 - 10,000 = 100`, which is a **100%** return on her investment. However, if the YLP price drops to 0.99, the value of her YLP becomes `0.99 * 10,000 = 9,900 USDC`, a loss of `9,900 - 10,000 = -100` USDC, making her return **-100%**.

Thus, after adding leverage for LPs, there is no difference from traditional leverage trading, except that the trading subject has become YLP, and the trading index has become the YLP Price.

Under this trading model, the YFX fund pool undergoes an essential change. The YLP Price will change following the value of the fund pool. Essentially, buying YLP represents going long on the fund pool, believing that trading users will incur losses during some trading period.

<figure><img src="/files/N1lH123dvyTEEz7mHK5I" alt=""><figcaption></figcaption></figure>

## Liquidation：

Since users used leverage to purchase YLP, forced liquidation will be triggered when the price of YLP drops to a certain level. When liquidation occurs, 0.2% of the position value will go into the risk fund, and the remaining money will be returned to the wallet address.

**YLP Maintenance Margin Rate：**

| Max Leverage | Maintenance Margin Rate |
| ------------ | ----------------------- |
| 100x         | 0.5%                    |
| 50x          | 1%                      |

**YLP Liquidation:**

> <pre><code><strong>Liquidation price = Entry Price*(1-1/Leverage)*(1 + Maintenance Margin Rate)
> </strong></code></pre>

## Note:

Since LPs can use leverage to buy YLP, in extreme cases, all LPs' margins may not be sufficient to cover all traders' unrealized profit and loss differences. At this time, the LP fund pool might not be able to compensate. In such cases, the system will take automatic position reduction measures, where all trading users and LPs' positions will be automatically reduced and settled at a certain price, and the trading pair will be automatically restarted, resetting the YLP price back to $1.


# Trading


# Trading Mechanism

> **PvPool (PvP)** trading mechanism was first introduced by YFX V1 in 2021, allowing traders and liquidity pools to trade directly. Now, it has been widely adopted by most major perpetual protocols. In YFX V4, liquidity pools are still holding single assets but divided to multiple pools depending on trading pairs.  &#x20;

&#x20;All traders' orders are settled with fund pools. A trader's profit from perpetual contract trading is a fund pool's loss, and vice versa. If a trader makes a profit trading perpetual contracts, the profit will be taken from an LP fund pool; if a trader suffers a loss trading perpetual contracts, the loss will be given to an LP fund pool.&#x20;

A liquidity provider only needs to buy YLP (w/ or w/o leverage) to participate in market making. When a liquidity provider wants to withdraw funds from a fund pool, if the net value of the fund pool is greater than the net value of the fund pool when they deposit funds to the fund pool, they will make a profit. Otherwise, they will suffer a loss. A liquidity provider suffers no impermanent loss for adding or removing funds to or from a fund pool.&#x20;


# Premium\&Market Price

## Premium

The **Premium Index** is a metric used to measure the difference between the Market Price and the Index Price. The system adjusts the Premium and Market Price based on the net position direction of traders, aiming to maintain a balance between long and short positions as much as possible. Specifically, when traders' net positions are long, the Premium is positive, and the Market Price will be higher than the Index Price. In this scenario, the cost of going long increases, which suppresses the creation of new long positions in the market. Conversely, if one chooses to go short, reducing the net long positions, the opening price will be advantageous, thereby lowering the overall market premium.

The current Premium Index is determined by multiple segmented functions $$y=kx+b$$, as outlined in the configuration table below.

Let's assume the **ETH Price = 1000 USDC**, and the **LP Balance = 1,000,000 USDC**, allowing for a Max Position of **1000 ETH** provided by the LP Balance.

<table data-full-width="false"><thead><tr><th width="256.3333333333333">(Long-short)/Max Position  </th><th>Premium </th><th>Net Position Difference</th></tr></thead><tbody><tr><td>0.04  </td><td>0.0005  </td><td>1000*0.04 = 40ETH </td></tr><tr><td>0.08  </td><td>0.001  </td><td>1000*0.08 = 80ETH </td></tr><tr><td>0.1  </td><td>0.0015  </td><td>1000*0.1 = 100ETH </td></tr><tr><td>0.12  </td><td>0.002  </td><td>1000*0.12 = 120ETH </td></tr><tr><td>0.2  </td><td>0.006  </td><td>1000*0.2 = 200ETH </td></tr><tr><td>1  </td><td>0.1  </td><td>1000 * 1 = 1000ETH </td></tr></tbody></table>

Given this setup, let's further explore how changes in traders' positions could affect the Premium Index, and consequently, the Market Price relative to the Index Price. Suppose we have a segmented function that defines different premium levels based on the proportion of net positions to LP Balance. For example:

* If the net long positions constitute up to 10% of the LP Balance, the premium could be set at a certain percentage, leading to a slight increase in the Market Price over the Index Price.
* As the proportion of net long positions increases beyond certain thresholds (e.g., 20%, 30% of LP Balance), the premium and, therefore, the Market Price would increase progressively to discourage further long positions and encourage shorts.

This mechanism ensures the market dynamically adjusts to maintain liquidity and balance, discouraging excessive speculation in one direction and promoting a healthier trading environment.

## Market Price

When the net position of the user is long:

> **market price = index price \* (1 + current premium)**

When the net position of the user is short:

> **market price = index price \* (1 - current premium)**

Referencing Table 1, when the ratio of net positions is 0.04, the premium index is 0.0005; when the ratio reaches 0.08, the premium index increases to 0.001; and so on, until the ratio of net positions reaches 1, the premium index becomes 0.1. Such a configuration can intricately and professionally reflect the market impact of traders' holdings and accordingly calculate a reasonable premium level.

Assuming the current long positions exceed short positions by 40 ETH, according to the table above, the premium index reaches 0.0005, **Market Price = 1000 \* (1 + 0.0005) = 1000.5.** If a user decides to go long 40 ETH at this time, the user's Entry Price will be **1000.5 \* (1.0005 + 1.001) / 2 = 1001.250375**. If the user goes short 40 ETH, the Entry Price will be **1000.5 \* (1 + 1.0005) / 2 = 1000.750125.**<br>


# Price Impact

> In YFX versions V1, V2, and V3, the trading price solely depended on the index price and the slippage calculation formula, leading to issues such as imbalance between long and short positions. Over time, as decentralized perpetual contract products adopting the PvPool model emerged, discussions began to revolve around Price Impact, Depth, Premium, and Funding, with different solutions being proposed for each issue.

Building on these solutions, YFX V4 introduced the LP Balance Automated Market Maker (LPB-AMM) mechanism, where the trading depth in YFX is determined by the LP Balance. A greater LP Balance results in better depth and lower slippage, whereas a lesser LP Balance leads to worse depth and higher slippage.

When an imbalance between long and short positions occurs, the Premium will increase, causing the Market Price to deviate from the Index Price. At this point, the Price Impact becomes more favorable towards the direction with smaller positions, thus gradually balancing out the long and short positions.


# Transaction Process

There are two steps involved in opening/closing/editing a position and LP position on YFX V4:&#x20;

1\. The user sends a transaction request to the blockchain, including parameters like margin amount and leverage&#x20;

2\. Keepers observe the blockchain for the request, retrieve the price feed from ChainLink, PYTH, then execute the request.&#x20;


# Contract Types

YFX V4 supports linear and inverse contracts.

## Linear contract&#x20;

Also known as "USD-based contract." When trading linear contracts, traders can use stable coins (USDC or USDT) as margins to go long or short BTC, ETH, and other coins.&#x20;

## Inverse contract

Also known as "Coin-based contract" When trading inverse contracts, traders can use ETH as a margin to trade ETH/USD contracts.&#x20;


# Pricing Mechanism

In YFX V3, we introduced a mechanism for comparing on-chain oracle prices with ChainLink to prevent failures with our Oracle. In the product design of YFX V4, we have made further optimizations by introducing real-time prices from two leading oracle products in the market, [ChainLink](https://chain.link/) and [PYTH](https://pyth.network/), as the index price for YFX, ensuring the fairness and openness of the index price.

## ChainLink solution

We have adopted ChainLink's [DataStream](https://chain.link/data-streams) and [Automation](https://chain.link/automation) to execute market orders and judge whether limit orders, take-profit, stop-loss, and forced liquidation are triggered.

## PYTH solution

We accept real-time prices published by PYTH and use PYTH's official contract to verify signatures. [PYTH Price Feeds](https://pyth.network/price-feeds)

Through collaboration with ChainLink and PYTH, YFX has thoroughly resolved the issue of the openness and fairness of index prices, making trading more equitable. Anyone can verify that YFX's index price sources are from ChainLink or PYTH.


# Fees

## Transaction Fees

The fee for opening and closing positions is currently set at **0.03% for 200x leverage，0.05% for 100x  or lower leverage.**

{% hint style="info" %}
Transaction Fee = Transaction Value x **fee rate**
{% endhint %}

## Funding Fees

YFX V4 implements the funding fee mechanism to balance the aggregated long and short positions. The funding fee is settled between traders and fund pools.

{% hint style="warning" %}
The funding fee is not settled every 8 hours, but the previous funding fees will be settled every time a transaction is made.
{% endhint %}

**The funding fees on YFX are calculated in seconds on the blockchain, and the 1-hour estimated funding fee displayed on the trading page is the estimated 1-hour funding fee calculated using the real-time funding fees.**

### The 8 hours funding fee formula:

> **F:** Funding Rate
>
> **P:** Premium Index
>
> **I:** Default Interest

$$
F = P + clamp(I - P, -0.05%, 0.05%)\\
I = 0.01% \\
$$

$$
F = \begin{cases}\\
\begin{aligned}
P + 0.05% ;;; & \text{When } P \le -0.04%\\
0.01% ;;; & \text{When }-0.04% \le P \le 0.06% \\
P - 0.05% ;;; &\text{When }P \gt 0.06%\\
\end{aligned}
\end{cases}
$$

<figure><img src="/files/p7oG8Lm840AablauZof5" alt=""><figcaption></figcaption></figure>

Users can find real-time funding rates in their positions, and they can view the funding profit and loss for a particular trade in their trade history. A positive funding rate means the user earned funding, while a negative funding rate means the user paid funding.

<figure><img src="/files/GYQSy5XASmxVKUNcb3zK" alt=""><figcaption></figcaption></figure>

## Execution Fees

There are two steps involved in opening/closing/editing a position: The first step is that the user sends a transaction request to the blockchain, including parameters like margin amount and leverage.&#x20;

The second step is that **Keepers** observe the blockchain for the request, retrieve the price feed from the oracles, then execute the request. After the second step, the transaction is considered to be completely on-chain.

Therefore, when each transaction request is sent to the blockchain, an additional execution fee is required and paid to the blockchain network.

{% hint style="info" %}
Currently, the execution fee on the Arbitrum blockchain is **0.0001** ETH per time.

Execution fees will be adjusted based on the gas fees for each blockchain over certain time periods.
{% endhint %}

##


# Order Types

## Market Orders

Market orders will be opened and closed at the price the **Keeper** retrieves from the oracles. Since it takes time for the order to be confirmed on the blockchain, the position will be opened usually within 1-5 seconds.

{% hint style="warning" %}
The executed price is calaulated based on Market Price and Price Impact.
{% endhint %}

## Limit Orders

Limit orders are trigger orders on YFX. Traders can set a specified price for a limit order. If the set price crosses the current **index price**, the limit order will be executed as a market order.

{% hint style="warning" %}
Note: Limit orders are not guaranteed to be triggered due to delays on the blockchain.
{% endhint %}

Each limit order will collect the initial margin when the order is placed. When the limit order is executed, if the position size increases, the initial margin of the limit order will be added to the position margin; if the position size is reduced, the profit and loss will be settled, and the initial margin of the limit order will be refunded.

## Take-profit and stop-loss Orders

**Take-profit and stop-loss orders(TP\&SL)** are for the entire position, and when the **index price** reaches the set trigger price, the entire position will be closed. If the direction of the overall position changes, for example, a long position becomes a short position, the original take-profit and stop-loss orders will become invalid.

After a trader successfully opens a position, he can set up take-profit and stop-loss orders by setting up two prices to take profit and stop loss. After setting the prices, they can edit them under the "Position Panel."

{% hint style="warning" %}
Note: The take-profit and stop-loss orders are not guaranteed to be triggered due to delays on the blockchain.
{% endhint %}

### For example:&#x20;

1\. Bob holds a long position in BTC. The current price is 40,000. Bob can set a take-profit order priced at 40,010 and a stop-loss order priced at 39,990.

2\. Alice holds a short position in ETH, and the current price is 4,000. Alice can set a take-profit order priced at 3,990 and a stop-loss order priced at 4,010.


# Position Modes

For position modes, YFX V4 supports both one-way mode and hedge mode, whick can be swithed in the order panel.

<figure><img src="/files/JU8hrZK1mae6Is4QD247" alt=""><figcaption></figcaption></figure>

## One-way mode

In one-way mode, traders can only hold a long or a short position for any trading pair. Positions in different directions will be merged. If the new trade is in the same direction as the original position, the position size will increase; if the new trade is in the opposite direction, the position size will decrease.

In one-way mode, the order types can only be "Long" or "Short."

{% hint style="warning" %}
In the one direction mode, due to issues with the execution order on the blockchain, there is currently no limit price liquidation function available, only market price liquidation.
{% endhint %}

<figure><img src="/files/PKpOAm8MLNGhifQZp8Sq" alt=""><figcaption></figcaption></figure>

## Hedge mode

In hedge mode, traders can simultaneously hold long and short positions for any trading pair. To open a position or add margin to an existing position in hedge mode, go to the "Order Panel." To close a position, click "Close" under the "Position Tab."

In hedge mode, margins are not shared between long and short positions. If the margin of a long/short position falls below the Maintenance Margin level, the long/short position is liquidated without affecting the other position.


# Earning

> YFX will initiate its first mining event after migrating to Arbitrum, including YFX Staking, Position Mining, LP Mining, Trade Mining, Invite Mining, etc.
>
> Under this incentive system, participants of the entire platform, including Traders, Makers, and Inviters, will all receive appropriate incentives.

## YFX Mining:&#x20;

Holding YFX tokens allows participation in YFX mining

**YFX Pool:**

Users stake **YFX** to earn a share of the WETH transaction fees generated, iYFX, and MP (Multiplier Points). Upon staking YFX tokens, users receive an equivalent amount of sbfYFX tokens as proof of staking.

**iYFX** represents the immature token within the mining system. Users can deposit iYFX into the iYFX pool for secondary staking to earn more WETH transaction fee shares, iYFX tokens, and MP. Since YFX tokens and iYFX tokens have the same rights, staking iYFX tokens also grants sbfYFX tokens.

**MP (Multiplier Point):** The longer the staking period, the more MPs are earned, which can be used to accelerate mining. MPs are reset to zero when the staked YFX or iYFX tokens are withdrawn.

In YFX staking mining, converting iYFX into YFX tokens involves depositing both iYFX and sbfYFX tokens into the iYFX Vesting pool, after which unlocked YFX tokens can be obtained after a certain period.

## Position Mining (Phase One)

Holding positions in any trading pair is considered participation in position mining, and participants will earn **YFX tokens**.

The release mechanism for YFX tokens obtained through position mining involves active unlocking. When users claim their earned YFX tokens, they can choose an unlocking period. Early unlocking will result in the burning of a certain percentage of YFX tokens. The relationship between the unlocking period and the release quantity ratio is as follows:

| Lock duration | Withdraw Amount | Burn Amount |
| ------------- | --------------- | ----------- |
| 21 Days       | 100%            | 0%          |
| 14 Days       | 75%             | 25%         |
| 7 Days        | 50%             | 50%         |
| No Lock       | 25%             | 75%         |

## Liquidity Mining

When users add liquidity to a liquidity pool, they automatically participate in liquidity mining. Depending on the liquidity pool and the type of assets deposited, the rewards include YFX, iYFX, and a share of WETH transaction fees. Upon adding liquidity, users receive sfLP as proof of liquidity.

In the process of liquidity mining, converting iYFX into YFX tokens involves depositing both iYFX tokens and sfLP into the corresponding iYFX Vesting pool. After a certain period, unlocked YFX tokens will be obtained.

## Pool 2 Mining

When users adds liquidity in [ETH/YFX pairs](https://app.uniswap.org/add/ETH/0x569deb225441FD18BdE18aED53E2EC7Eb4e10D93/3000?minPrice=0.0000000000000000000000000000000000000029543\&maxPrice=338490000000000000000000000000000000000) on Uniswap, they can stake their Uniswap LP NFT to Pool 2 Mining in YFX to earn more YFX tokens. The APR of Pool 2 Mining is always higher than other pools.

## Compound

Users can perform a one-click reinvestment by clicking the "Compound" button, allowing them to claim all earned YFX and iYFX for secondary staking, and to collect their share of WETH dividends.


# Referrals

> YFX offers a new referral program that allows invitees to enjoy a transaction fee discount and inviters to earn transaction fee rebates whenever invitees trade on YFX. **The maximum rebate rate is 75%, while the maximum discount rate is 20%.**

**Once an inviter-invitee relationship is established, the transaction fee rebate is credited to the inviter’s wallet in real time after each invitee’s transaction is confirmed on the chain**. The inviter can get 1 **URP** token (**USD Referral Points**) for every 1 USD traded by the invitees. There are eight tiers of transaction fee rebates and discounts. When the inviter’s URP accumulates to a certain amount, users can burn URP tokens to move up a tier.

[Higer Tier Rebate Code Application Form<br>](https://forms.gle/ejBbeoazPfLwU5EZ7)

| Tier | Transaction Fee Rebate % (For Inviters) | Transaction Fee Discount % (For Invitees) | URP Requirement For Moving Up A Tier Level |
| ---- | --------------------------------------- | ----------------------------------------- | ------------------------------------------ |
| 1    | 5%                                      | 5%                                        | None                                       |
| 2    | 7%                                      | 5%                                        | 2,000,000                                  |
| 3    | 9%                                      | 5%                                        | 6,000,000                                  |
| 4    | 11%                                     | 5%                                        | 10,000,000                                 |
| 5    | 13%                                     | 10%                                       | 30,000,000                                 |
| 6    | 15%                                     | 10%                                       | 50,000,000                                 |
| 7    | 17%                                     | 10%                                       | 70,000,000                                 |
| 8    | 20%                                     | 10%                                       | 80,000,000                                 |

<figure><img src="/files/8IOqLw2JtuLZY6KANzuR" alt=""><figcaption><p>How to create invitation code.</p></figcaption></figure>

The referral code is recorded on the blockchain and will never expire. Suppose an invitee wants to establish a new invitation relationship. In that case, they can go to "Referrals," click "Traders," and click "Active Referral Code" to link with a new referral code. Alternatively, they can click on a new invitation link. The invitation relationship is updated when they successfully make a trade.

<figure><img src="/files/sBzYUNICWYyuyjEGZeiH" alt=""><figcaption><p>How to active referral code.</p></figcaption></figure>

After creating the referral code, the inviter can share the invitation link on any platform, like Twitter and Telegram. When a user clicks on the link and starts trading perpetual contracts, that user can enjoy a transaction fee discount, and the inviter will receive a transaction fee rebate.

## Example

For example, Alice invites Bob to trade on YFX (the rebate rate is 10%, and the discount rate is 5%).&#x20;

When Bob is charged with a $100 USDC transaction fee, Bob will only need to pay $95 USDC in fees, and Alice will receive a $9.5 USDC referral rebate.

## Notes

{% hint style="warning" %}
Notes:

The referral code is case-sensitive. For example, ALICE and Alice are two referral codes.

A user can create multiple referral codes. Every referral code is unique on a public blockchain.
{% endhint %}

## Unique invite code on each blockchain

Since there is no direct way to sync between multiple blockchains, the same referral code may have different owners on different blockchains. The protocol will determine the ownership of the referral code based on the oldest TimeStamp associated with the referral code. The owner of the referral code with the oldest TimeStamp owns the same referral code on other blockchains.

For example, Alice creates an referral code "Alice001" on Arbitrum. Later, another user creates an referral code "Alice001" on another blockchain. Because Alice's referral code has the oldest TimeStamp, the protocol can change the owner of the referral code "Alice001" on the other blockchain to Alice.

## UTP & URP

> UTP: USD Trade Points
>
> URP: USD Referral Points

When an invitee trades perpetual contracts, for every $1 traded, YFX will send 1 UTP token to the invitee and 1 URP token to their inviter. UTP and URP tokens cannot be transferred or withdrawn. Users can only use UTP and URP tokens to stake and earn rewards.

For example, Alice invites Bob to trade on YFX. If Bob trades $2,000 worth of perpetual contracts, Bob will receive 2,000 UTP tokens, and Alice will receive 2,000 URP tokens.

UTP and URP will only be issued when an invitee trades linear and inverse contracts.

Users can claim UTP and URP on the "Referrals" page.

UTP and URP will not be issued if it is a liquidation order.

{% hint style="success" %}
YFX provides an additional business affiliate program for KOLs, community leaders, media organizations, and data aggregation websites. You can contact us to directly set an invite code with a rebate of over 50% as an advanced invite code. Let's work together to build a fair trading community.

If you are interested, please fill in the [Application Form](https://forms.gle/ejBbeoazPfLwU5EZ7). Our team will get in touch with you soon.
{% endhint %}


# MPC Wallet

YFX has integrated WalletConnect’s functionality to replace the existing web3 wallet solution.

**There are more advantages to using WalletConnect:**

* WalletConnect’s official login plugin offers better security, higher compatibility, and supports multi-terminal logins on Website, Android, and iOS.
* It supports login with your social accounts such as Email, Twitter, Google, Apple, and Facebook.
* Supports most EVM chain MPC Wallets.
* Supports login with hundreds of Web3 wallets, including Metamask, Coinbase, Trust, Binance Wallet, OKX Wallet, and more.
* Supports purchasing digital currencies directly with Visa and Mastercard.
* Allows swapping most major coins directly in the wallet.
* Supports Web3 message push notifications, which may later be used for forced liquidation notifications.

**Social Media Connection:** You can connect with your social media account like Google, Twitter, Github and Apple ID.

**Wallet Connection:** All your installed wallet will be displayed first and you can choose any of them to connect with YFX. The user experience is the same like you are using those wallets.

&#x20;                                         <img src="/files/xhOYJ84qwLltEPyiGZO6" alt="" data-size="original">


# API

{% hint style="info" %}
YFX is currently deployed on Arbitrum One, you can directly call the smart contract to trade, buy YLP, sell YLP.
{% endhint %}

## Contracts for YFX V3

### Arbitrum

* Manager: [0x29bd0372A8A087e4d34d4098259Cd298d554BAc4](https://arbiscan.io/address/0x29bd0372A8A087e4d34d4098259Cd298d554BAc4)
* Router: [0xebb4871d1be1262C8bd1aa7dfc4C047483f02028](https://arbiscan.io/address/0xebb4871d1be1262C8bd1aa7dfc4C047483f02028)
* InviteManager: [0x0A1c07bd77Ff45743af42b579962C2C36e777f01](https://arbiscan.io/address/0x0A1c07bd77Ff45743af42b579962C2C36e777f01)
* Periphery: [0xEae658B32300ff8544bb03d1b8762466a5e99433](https://arbiscan.io/address/0xEae658B32300ff8544bb03d1b8762466a5e99433)
* Vault: [0x48F4B8f77b1E0EFBBF17b2082F12829b87FD1933](https://arbiscan.io/address/0x48F4B8f77b1E0EFBBF17b2082F12829b87FD1933)
* Insurance Fund: [0x4177EA126f6B87A9D83Cb3292548086D1a971303](https://arbiscan.io/address/0x4177EA126f6B87A9D83Cb3292548086D1a971303)
* MarketPriceFeed: [0x7e5151fe2ec125b7C732cb3728046D3025D75a0c](https://arbiscan.io/address/0x7e5151fe2ec125b7C732cb3728046D3025D75a0c)
* **Pools:**
  * USDC1: [0xdC07Ed24738FC2deb3610f9FD337e59e815E7307](https://arbiscan.io/address/0xdC07Ed24738FC2deb3610f9FD337e59e815E7307)
  * USDC2: [0xB63e869a3A777fbe5E606A0192f9c2c3Bb3a49d9](https://arbiscan.io/address/0xB63e869a3A777fbe5E606A0192f9c2c3Bb3a49d9)
  * ETH: [0x396AA1B82F32e84a970805C0972F17dd1C0DEC56](https://arbiscan.io/address/0x396AA1B82F32e84a970805C0972F17dd1C0DEC56)
  * ARB: [0xe089B57dfC9B05F73bdB25B016d45972147dDd05](https://arbiscan.io/address/0xe089B57dfC9B05F73bdB25B016d45972147dDd05)
* **Markets:**
  * BTC\_USD(USDC): [0xe7F0dac16278388FBB1f4aFa409c512333c28F78](https://arbiscan.io/address/0xe7F0dac16278388FBB1f4aFa409c512333c28F78)
  * ETH\_USD(USDC): [0x7f597c44101Ee16fc48Dc7BD37fCAA21A5bFDA91](https://arbiscan.io/address/0x7f597c44101Ee16fc48Dc7BD37fCAA21A5bFDA91)
  * ARB\_USD(USDC): [0x749140688891A97103c15119D2deeebAe8516d6b](https://arbiscan.io/address/0x749140688891A97103c15119D2deeebAe8516d6b)
  * ETH\_USD(ETH): [0x0472686084b7d756E992d32EdA2613aeF99cf9dE](https://arbiscan.io/address/0x0472686084b7d756E992d32EdA2613aeF99cf9dE)
  * ARB\_USD(ARB): [0xC0927411896B350c6318673f0dd75b7e422c8551](https://arbiscan.io/address/0xC0927411896B350c6318673f0dd75b7e422c8551)
* **Tokens:**
  * USDC [0xaf88d065e77c8cC2239327C5EDb3A432268e5831](https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831)
  * ARB [0x912CE59144191C1204E64559FE8253a0e49E6548](https://arbiscan.io/address/0x912CE59144191C1204E64559FE8253a0e49E6548)
  * WETH [0x82aF49447D8a07e3bd95BD0d56f35241523fBab1](https://arbiscan.io/address/0x82aF49447D8a07e3bd95BD0d56f35241523fBab1)

### Add Liquidity(Buy YLP)

{% hint style="info" %}
To add liquidity to a pool:
{% endhint %}

1. Approve the Router contract for the base token and amount you would like to add for liquidity
2. Call **Router.addLiquidity** with parameters to add USDC pools or other ERC20 pools
   * **\_pool**: pool address
   * **\_amount**: base token amount you would like to spend
   * **isStakeLp**: true if automatically to stake LP for earn (to be online)
   * **\_deadline**: request deadline timestamp
3. Call **Router.addLiquidityETH** with parameters to add ETH pools
   * **\_pool**: pool address
   * **\_amount**: base token amount you would like to spend, should be less than transaction value
   * **isStakeLp**: true if automatically to stake LP for earn (to be online)
   * **\_deadline**: request deadline timestamp for price protection

### Remove Liquidity ( Sell YLP)

{% hint style="info" %}
To remove liquidity from a pool:
{% endhint %}

1. Call **Router.removeLiquidity** with parameters to remove liquidity from USDC pools or other ERC20 pools:
   * **\_pool**: pool address
   * **\_liquidity**: how much liquidity you would like to remove
   * **isUnstake**: should unstake staked LP from earn (to be online)
   * **\_deadline**: request deadline timestamp for price protection
2. Call **Router.removeLiquidityETH** to remove liquidity from ETH pools, parameters are the same as above.

### Open Position

{% hint style="info" %}
To open a position:
{% endhint %}

1. Approve the Router contract for the margin asset token and amount you would like to spend as the initial margin
2. Call **Router.takerOpen** or **takerOpenETH** with parameters:

   ```
   struct TakerOpenParams {
       address _market;        // market contract address
       bytes32 inviterCode;    // inviter code
       uint128 minPrice;       // min price for the slippage
       uint128 maxPrice;       // max price for the slippage
       uint256 margin;         // margin of this order
       uint16 leverage;    	// leverage
       int8 direction;         // order direction, 1: long, -1: short
       int8 triggerDirection;  // trigger flag {1: index price >= trigger price, -1: index price <= trigger price}
       uint256 triggerPrice;	// trigger price
       uint256 deadline;		// request deadline timestamp for price protection
   }
   ```

### Close Position

{% hint style="info" %}
To Close a position:
{% endhint %}

* Call **Router.takerClose** with parameters:

  ```
  struct TakerCloseParams {
      address _market;            // market contract address
      uint256 id;                 // position id
      bytes32 inviterCode;        // inviter code
      uint128 minPrice;           // min price for the slippage
      uint128 maxPrice;           // max price for the slippage
      uint256 amount;             // position amount to close
      int8 triggerDirection;      // trigger flag {1: index price >= trigger price, -1: index price <= trigger price}
      uint256 triggerPrice;		// trigger price
      uint256 deadline;			// request deadline timestamp for price protection
  }
  ```

### Liquidate

{% hint style="warning" %}
Everyone can liquidate other positions that should be liquidated. Liquidation keeper can get 2USDC reward each time.

To run a liquidation keeper, you should:
{% endhint %}

1. Trace positions. You can trace positions by our subgraph or listen contract event.
2. Call **Periphery.getPositionStatus** to check if the position can be liquidated. Return value with `true` means this position can be liquidated.
3. Call **Router.liquidateByCommunity** to execute liquidation.
4. Call **Vault.collectExecutedFee** to get liquidation bonus.

### Get Position Info

To get your position information:

* Call **Market.getPositionId** to get position id
  * **\_taker**: position owner address
  * **\_direction**: 1: long, -1: short
* Call **Market.getPosition** with the position id


# Common Resources

## GitHub

{% embed url="<https://github.com/yfxcom/>" %}

## Common Links

Telegram: <https://t.me/YFX_COM>

Twitter: <https://twitter.com/YFX_COM>

Discord: <https://discord.gg/SqBxPQXW2P>

Medium: <https://yfxdefi.medium.com/>

E-mail: <contact@yfx.com>


# Audit

YFX (all versions) is audited by Certik. Click the link below to view the report:

{% embed url="<https://skynet.certik.com/projects/yfx>" %}

<table><thead><tr><th>Version</th><th>Time of Audit</th><th data-hidden></th></tr></thead><tbody><tr><td>V1</td><td>January 2021</td><td></td></tr><tr><td>V2</td><td>June 2022</td><td></td></tr><tr><td>V3</td><td>July 2023</td><td></td></tr></tbody></table>


# Media Kit

## YFX Logo

![](/files/eLBmRpdf3CL4mS2zuWBM)

![](/files/03bEiqm0DIXNWi9bStDu)

![](/files/vOypECPxQcYvbanVkCjR)

![](/files/ErkAAH6Vgi8a3qI6zGox)

{% file src="/files/cobHi4N1D30DYeA6oaQt" %}


# FAQ

## 1. What is YFX？

[YFX](https://www.yfx.com/) is a decentralized perpetual exchange with up to 100x leverage, high liquidity, low fees, and no transaction slippage.

YFX adopts the PvPool (PvP) trading mechanism, allowing traders and liquidity pools to trade directly. Liquidity providers can add or remove liquidity for linear, inverse, and quanto contracts to or from single-asset pools with no impermanent loss. Liquidity providers can earn transaction fees and profit from selling LP tokens at a higher price.

## 2. What are the official domain names of YFX?

[https://www.yfx.com](https://www.yfx.com/)

<https://www.yfx.io>

## 3. Who developed YFX?

YFX is developed by a team of technical geeks from all over the world. The team believes in the decentralized nature of the blockchain. The project was founded in 2020 and deployed on multiple public chains.

## 4. Is YFX audited?

Yes, YFX is audited by Certik.

Certik Audit Results: <https://www.certik.org/projects/yfx>

## 5. What roles are included in the YFX perpetual contract trading?

The contract trading system is divided into "traders" and "liquidity providers." Any user can deposit funds to the fund pool and provide liquidity to the system. Fund pools take all the orders from perpetual contract trading and are the direct counterparty to traders.

## 6. How are trading pairs priced in different versions?

For VFX V1 and V2, the QIC-AMM model is used for pricing. The index price takes the weighted average prices on major exchanges and is updated every second.

V3 mainly uses Chainlink price feeds, supplemented by the latest price on major centralized exchanges.

## 7. What is the maximum position size?

If the fund pool is insufficient, the position size that the user can have is determined by the assets in the fund pools. The larger the fund pool, the larger the position size that the user can have. For the protocol's safety, there is a cap to the position size the user can have for each trading pair.

## 8. Can liquidity providers withdraw funds at any time?

The corresponding proportion of funds in the fund pool will be locked into the position margin when the trader opens a position.

{% hint style="info" %}
TotalMakerAssets = BorrowedFund + Balance + UnPNL + Funding + Borrow Fees
{% endhint %}

Currently, the protocol can use up to 80% of the fund pool as trading margin, and the remaining 20% is used as a reserve to meet withdrawal demands from liquidity providers.

If there is insufficient liquidity, liquidity providers must wait for traders to close their positions before withdrawing funds.

## 9. How is the transaction fee calculated?

{% hint style="info" %}
The transaction fee for trading is 0.08%.
{% endhint %}

There is no fee for liquidity providers to deposit funds to fund pools; the withdrawal fee is 0.1%.

## 10. Does YFX have a funding fee?

YFX V1 does not have a funding fee. It uses a maximum holding period of 30 days to ensure the system's stable operation.

Both YFX V2 and V3 have a funding fee. For more information on the funding fee, visit the subpage on fees.

## 11. Who cannot use YFX services?

If you reside in the United States, Quebec (Canada), Singapore, Cuba, Crimea, Sevastopol, Iran, Syria, North Korea, Sudan, Mainland China, or any other area where the services provided by YFX are restricted by law, you must acknowledge and agree that you shall not trade on YFX or use any services provided by YFX.

## 12. Does YFX have administrative control?

YFX has certain administrative control on exchange governance and parameter settings to ensure the exchange runs smoothly.

{% hint style="info" %}
YFX's administrative control does not control users' funds. Users can redeem their funds from the smart contracts at any time.
{% endhint %}

In detail, YFX has administrative control over the opening and closing of all trading on the exchange, the opening and closing of all trading of a certain trading pair, the settlement of a certain trading pair, the triggering of forced liquidation, the index price setting of users' orders, etc.

YFX can change the parameter settings on funding fee rate, transaction fee distribution ratio, maintenance margin rate, trading pairs/transaction-related parameters, etc.


# YFX V3

YFX is a decentralized perpetual exchange with up to 100x leverage, high liquidity, low fees, and no slippage.

YFX adopts the PvPool (PvP) trading mechanism, allowing traders and liquidity pools to trade directly. Liquidity providers can add or remove liquidity for linear, inverse, and quanto contracts to or from single-asset pools with no impermanent loss. Liquidity providers can earn transaction fees and profit from selling LP tokens at a higher price.

The V1 version was developed in June 2020, and the V2 version was developed in January 2022.

YFX V3 is a new upgraded version of YFX V2. This upgrade mainly adds aggregated fund pools, ChainLink price feeds, a new Earn model, a new hedge position mode, funding fees, borrowing fees, liquidity provider tokens YLPs, a more incentivized referral program, and a new UI design that makes the protocol more decentralized and easier to use.

## Aggregated fund pool YLP (YFX Liquidity Provider)

YFX V3 adopts the PvP (PvPool) trading mechanism, which allows users and fund pools to trade directly. In V1 and V2, each trading pair corresponds to a fund pool, while in V3, YFX utilizes multiple single-asset fund pools based on the risk of the underlying assets. Mainstream trading pairs such as ETH/USD and BTC/USD share one USDC fund pool, ARB/USD, UNI/USD, DOGE/USD, and other trading pairs share another USDC (USDC 2) fund pool. Adopting multiple single-asset fund pools effectively reduces staking risks from a major market shift of another cryptocurrency.

Liquidity providers (LP) can choose to stake in a fund pool with the optimized risk level according to their own risk preferences.

## ChainLink Price Feeds

In the V1 and V2 versions, the price is determined by the weighted average price of the Top N centralized exchanges. In V3, the price is mainly determined by the ChainLink price feeds. The weighted average price of the centralized exchanges is used for rapid price corrections.

## New Earn Reward Mechanisms

In V3, YFX token holders can stake to earn 30% of the platform's transaction fees. YLP token holders can stake to earn 60% of the platform's transaction fees and profit from selling LP tokens at a higher price. The remaining 10% of the platform's transaction fees are used to repurchase and burn TFX tokens. In addition, YFX introduces new “trade to earn” and “invite to earn” reward mechanisms that further incentivize users to trade and invite others to trade on YFX.

## Switch Between One-way Mode and Hedge Mode

In V1, traders can simultaneously have long and short positions for any trading pair. In V2, traders can only have a long or a short position for any trading pair. In V3, traders can switch between one-way and hedge modes based on their preferences.

## Funding Fees

YFX implements the funding fee mechanism to balance the aggregated long and short positions. When the funding fee is positive, longs pay shorts. When the funding fee is negative, shorts pay longs.

## Borrowing Fees

When a trader opens a position on YFX, they borrow some funds from an LP fund pool. Therefore, traders need to pay borrowing fees to the fund pool.

In YFX V3, the maximum borrowing fee a trader can pay is 0.008%/hour.

## A comparison between V1, V2, and V3

| Version                            | V1                                                                              | V2                                                                              | V3                                                                                                                |
| ---------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| Development Time                   | June 2020                                                                       | January 2022                                                                    | January 2023                                                                                                      |
| Position Mode                      | Support only Hedge Mode                                                         | Support only One-way Mode                                                       | Support both Hedge Mode and One-way Mode                                                                          |
| Funding Fees                       | No                                                                              | Yes                                                                             | Yes                                                                                                               |
| Borrowing Fees                     | No                                                                              | No                                                                              | Yes                                                                                                               |
| Trigger Orders                     | No                                                                              | Yes                                                                             | Yes                                                                                                               |
| Stop-loss & Take-profit Orders     | No                                                                              | Yes                                                                             | Yes                                                                                                               |
| Deposit & Withdrawal               | Yes                                                                             | Yes                                                                             | No                                                                                                                |
| Liquidation Execution              | YFX Liquidation Bot                                                             | YFX Liquidation Bot                                                             | YFX Liquidation Bot and YFX community (when there are too many liquidations to process)                           |
| Remaining Margin after Liquidation | Add to YFX Insurance Fund                                                       | Add to YFX Insurance Fund                                                       | Return to traders                                                                                                 |
| Fund Pool Model                    | One pool funds one market                                                       | One pool funds one market                                                       | One pool funds multiple markets                                                                                   |
| Referral                           | The address is recorded on-chain. One address can only have one invitation code | The address is recorded on-chain. One address can only have one invitation code | Invitation codes are recorded on-chain. One address can have multiple invitation codes                            |
| Pricing Mechanism                  | Use the weighted average last price on major centralized exchanges              | Use the weighted average last price on major centralized exchanges              | Mainly uses ChainLink price feeds, supplemented by the weighted average last price on major centralized exchanges |
| Add Margin                         | Yes                                                                             | Yes                                                                             | Yes                                                                                                               |
| Remove Margin                      | No                                                                              | No                                                                              | Yes                                                                                                               |


# YFX V2

YFX V2, developed in 2022, is an upgraded iteration of V1.

{% hint style="info" %}
YFX V2 is an upgrade iteration of V1, which adds some features of perpetual contracts based on V1 and improves UI design to offer a better trading experience for professional traders. V2 was audited by Certik in June 2022. Learn more: <https://skynet.certik.com/projects/yfx>
{% endhint %}

## V2 New Features

| Functions                     | V1                                    | V2                                             |
| ----------------------------- | ------------------------------------- | ---------------------------------------------- |
| Position Mode                 | Long and short positions can co-exist | Only a single position (long/short) is allowed |
| Funding Fee                   | ❌                                     | ✅                                              |
| Limit Order                   | ❌                                     | ✅                                              |
| Take-profit & Stop-loss Order | ❌                                     | ✅                                              |
| Execution Fee                 | ❌                                     | ✅                                              |

## Single Position Mode

YFX V2 adopts the single position mode. All long and short orders of the same trading pair will be merged, and there will only be one position in one market.

In the single position mode, if the newly opened position is in the same direction as the current position, the position size will increase; if the newly opened position is in the opposite direction to the current position, the position size will decrease.

> Assuming that Alice holds a long position of 1 ETH and a long order of 0.5 ETH is executed, Alice's overall position will become a long position of 1.5 ETH.
>
> Assuming that Alice holds a long position of 1 ETH and a short order of 0.5 ETH is executed, Alice's overall position will become a long position of 0.5 ETH.
>
> Assuming that Alice holds a long position of 1 ETH and a short order of 3 ETH is executed, the profit and loss of 1 ETH will be settled at this time, and Alice's overall position will become a short position of 2 ETH.

## Funding Fee

The funding fee is a small percentage of the existing position's value that users must pay to or receive from their counterparty at regular intervals.

In YFX V2, the funding fee is mainly used to balance long-short positions and settle between traders and fund pools. YFX does not collect any funding fees as they happen directly between users.

> The funding fee is positive when the aggregated long position > short position in the system and longs pay shorts.
>
> The funding fee is negative when the aggregated long position < short position in the system and shorts pay longs.

The funding fee on YFX is calculated every second on the blockchain, and the funding fee displayed on the page shows the estimated 8-hour funding fee based on the real-time funding fee.

The real-time funding fee is calculated using the formula below:

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDAK2Po4voErYvh-2n-750142621%2Fuploads%2F3CIgL2yj0NHIYJfetXYE%2Fimage.png?alt=media&token=8a320f95-ab5b-4771-9a24-55d87d2d29a1>" %}

## Limit Order

YFX V2 has added limit orders. Users can set a specific price for a limit order. If the current price crosses the set price, the limit order will be executed as a market order.

When a limit order is placed, collateral will be deducted from the user's balance. When the limit order is executed, if the position increases, the collateral will be added to the position margin; if the position decreases, the profit & loss will be settled, and the collateral will be returned to the user's balance.

{% hint style="warning" %}
The limit order may not be triggered due to delay and performance issues on the blockchain. YFX is not liable for any losses caused by failures of execution of the limit order.
{% endhint %}

## Take-profit & Stop-loss Order

YFX V2 has added take-profit & stop-loss orders. Users can set two trigger prices for their position: take-profit and stop-loss prices. The position is settled immediately if one of the two prices is triggered.

If a user closes a position manually, the associated take-profit & stop-loss orders will cease to exist simultaneously.

{% hint style="info" %}

1. The take-profit & stop-loss order may not be triggered due to delay and performance issues on the blockchain. YFX is not liable for any losses caused by failures of execution of the take-profit & stop-loss order.
2. If users set the stop loss price near the liquidation price, their position may be liquidated before the stop loss order is executed when the market is volatile.
   {% endhint %}

## Execution Fee

Every transaction on YFX V2 needs to be executed on the blockchain. Therefore, users need to pay an execution fee to the blockchain network.

Currently, the execution fee on zkSync is 0.001 ETH.


# VFX V1

YFX V1 was first deployed on Tron in January 2021. Later it was deployed to Heco, BSC, and xDai.

## YFX V1 Whitepaper

<https://yfxdefi.medium.com/yfx-white-paper-d9a4feacf0b7>

{% hint style="danger" %}
YFX V4 is now live, and support for the Tron, Heco, BSC, and xDAI public chains has been suspended. Please redeem your funds as soon as possible.

<https://trx.yfx.com/>

<https://ht.yfx.com/>

<https://bsc.yfx.com/>

<https://xdai.yfx.com/>
{% endhint %}

For more info, please view the docs under YFX V2.


