# Welcome to XEI

## The EVM Compatibility of the SEI Network

The SEI Network, initially launched using the COSMOS SDK, is undergoing a transformative evolution to become the first parallel-chain that boasts complete Ethereum Virtual Machine (EVM) compatibility. The new parallel SEI Network is expected to produce a block every 0.4 seconds with a transaction processing speed approximately ten times faster than that of Solana. Such enhancements in efficiency and EVM compatibility are anticipated to be a major draw for developers, fostering a vibrant community eager for cutting-edge decentralized applications.

## **XEI: A New Paradigm in Decentralized Trading**

XEI, the decentralized exchange designed to be seamlessly integrated with the SEI Network’s new EVM capabilities, is poised to launch and significantly contribute to the SEI ecosystem. The unique attributes of the SEI chain post-EVM compatibility are expected to provide XEI with a competitive edge in the rapidly evolving crypto market. XEI’s innovative approach will not only spotlight the exchange but also enhance the accessibility of the SEI Network, thereby accelerating the ecosystem’s growth.

&#x20;Positioned as a crucial component within the broader EVM landscape, XEI aims to support all EVM-compatible chains in the future, cementing its role as a pivotal player in the mass adoption of blockchain technologies.

## **XEI Basic Features**

XEI integrates the core trading engine of Uniswap while introducing an array of innovative features that leverage the latest advancements in blockchain technology. Below are the fundamental characteristics that define the XEI platform:

1. **Self-Custody Asset**: True to the decentralized exchange ethos, XEI allows users to trade directly from their personal wallets, ensuring full control over their assets without the need for third-party custody. This model enhances security and trust, providing traders with peace of mind.
2. **AMM Swap Trading**: Drawing on the proven mechanics of Uniswap, XEI utilizes automated market maker (AMM) protocols to facilitate fluid and efficient token swaps, ensuring liquidity and reducing slippage.
3. **Customized Liquidity Concentration**: Inspired by Uniswap V3, this feature allows liquidity providers to allocate their funds to specific price ranges, optimizing their capital efficiency and potentially earning greater returns on their staked assets.
4. **Limit Order Support**: Innovating beyond traditional DEX capabilities, XEI supports limit orders, enabling traders to specify the price at which they wish to buy or sell a token, thus offering greater control over trading strategies and risk management.
5. **Decentralized Perpetual Swap**: XEI introduces decentralized perpetual swaps, allowing for leveraged trading without the need for traditional futures contracts. This feature broadens the trading possibilities significantly within the decentralized framework.
6. **Lightning Execution Speed**: Leveraging the specialized capabilities of the SEI Network, XEI achieves lightning-fast transaction speeds, markedly reducing latency and improving the trading experience for all users.
7. **MEV-proof Execution**: Addressing the common concern of miner extractable value (MEV), XEI ensures that transactions are executed in a way that protects traders from potential front-running and other forms of exploitation, promoting fairness and integrity in trading.
8. **Social Wallet Compatibility and Seamless Social Trading**: XEI is designed to be fully compatible with social wallets, integrating trading capabilities directly into social media platforms. This enables seamless social trading experiences, making trading more accessible and engaging for a broader audience.

Together, these features make XEI not just a cutting-edge trading platform but also a leader in the evolution of decentralized trading solutions, setting new standards in user experience, security, and functionality.

## Quick links

{% content-ref url="/pages/tsRLI2Wls7X131mPjJuz" %}
[Swap Trading](/feature-description/swap-trading)
{% endcontent-ref %}

{% content-ref url="/pages/YayI2JYKXkv2SFGvZDFT" %}
[Leverage Trading](/feature-description/leverage-trading)
{% endcontent-ref %}


# Swap Trading

Drawing on the proven mechanics of Uniswap, XEI utilizes automated market maker (AMM) protocols to facilitate fluid and efficient token swaps, ensuring liquidity and reducing slippage.

Inspired by Uniswap V3, this feature allows liquidity providers to allocate their funds to specific price ranges, optimizing their capital efficiency and potentially earning greater returns on their staked assets.

Innovating beyond traditional DEX capabilities, XEI supports limit orders, enabling traders to specify the price at which they wish to buy or sell a token, thus offering greater control over trading strategies and risk management.

<figure><img src="/files/70ND0bCq3BVI7Ee0wBL8" alt=""><figcaption></figcaption></figure>


# Leverage Trading

Leverage trading on XEI allows traders to borrow assets for immediate trading, utilizing strategies like short selling and leverage long positions. In short selling, investors profit from declining asset prices by repaying the lender at a lower cost. Leveraged long positions involve borrowing to purchase assets, profiting from price increases. These strategies depend on price changes and leverage ratios, offering a balanced mix of risk and reward.

What sets our perpetual swap design apart is its full on-chain functionality, based on margined loans provided to traders. This unique approach enables traders to engage in perpetual swaps using leverage funds sourced directly from the on-chain loan platform YEI.

In practical terms, XEI allows anyone to create lending pools for specific trading pairs, such as SEI/USDC, facilitating a wide range of leveraged trading activities. Users contribute to these pools, providing liquidity and earning interest based on utilization rates. Traders can then borrow from these pools for leveraged trades, with XEI ensuring efficient execution and loan management.&#x20;

This system simplifies the trading process and enhances liquidity on the decentralized exchange, obviating the need for separate order books. When traders close their positions, XEI handles the conversion and repayment processes, ensuring that lenders receive their due while traders settle their debts, reaping profits or bearing losses as per their trade outcomes.

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


# Liquidity Pools

## What is a liquidity pool?

A liquidity pool is a collection of tokens secured within a smart contract, facilitating asset trading on decentralized exchanges (DEX) such as XEI.

In conventional finance, liquidity is managed through a central limit order book, where buyers and sellers place orders organized by price and demand.

The XEI Protocol employs a unique strategy, utilizing an Automated Market Maker (AMM) instead of the traditional order book system. This involves a liquidity pool of two assets, with the AMM determining their prices.

Liquidity providers (LPs) supply these tokens and, in return, receive LP tokens as a reward for their contribution.

## XEI V3

When you contribute your tokens to a Liquidity Pool, you will receive Liquidity Provider NFT tokens and gain a share of the fees.

In V3, liquidity providers gain greater control over the price range at which they deploy their liquidity. Adding your token to a Liquidity Pool in V3 will result in the creation of a unique non-fungible liquidity position with specific settings.

As such, liquidity positions in V3 are represented by NFTs. These NFTs are transferable and signify ownership of the underlying assets and the trading fees they accumulate.

Unlike before, trading fees in V3 will not be automatically compounded within the position. You will need to manually claim them on each position's detail page.

You can withdraw your funds at any time by removing your liquidity.

## **Active liquidity and price ranges**

In V3, liquidity providers have the option to set their positions to supply liquidity only within a specified price range. If the trading price shifts outside of this range, the position will hold only one type of token from the pair and will be rendered inactive.

Inactive liquidity positions will not engage in trading or accumulate any trading fees.


# Lending Pools

The uDEX protocol features lending pools for leveraged trading, where users can contribute any asset.

* By providing assets to these pools, users are rewarded with LTokens, representing their stake in the pool, along with token incentives.
* Lenders earn interest when trading pairs involve borrowing from these pools. The distribution of this interest, alongside LTokens and token rewards, is proportional to the lender's contribution compared to the pool's total assets.

To safeguard against flash loan attacks, the uDEX protocol mandates that lending and repayment cannot be executed within the same block, necessitating users to open and close their positions across different blocks.

### Risk Considerations&#x20;

Contributing assets to the uDEX protocol's lending pools carries risks. In adverse scenarios, the equity in traders' accounts may become negative, potentially resulting in losses for lenders. To address these situations, the uDEX protocol maintains a risk protection pool, managed by the DAO, which provides a certain percentage of coverage for these extreme cases.

### Customized Lending Pools&#x20;

The uDEX protocol allows anyone to create a lending pool for a trading pair, provided there's existing liquidity for that pair on a DEX.&#x20;

> For instance, someone interested in leverage trading for the SHIB/USDT pair could establish a lending pool for it, where lenders can supply SHIB solely to purchase USDT or vice versa.

### LToken Overview&#x20;

LTokens represent a key method of engagement with uDEX's lending pools, serving as interest-accumulating tokens.&#x20;

When a user deposits assets into a lending pool, they are issued LTokens in return. These tokens enable the holder to accumulate interest over time, not through direct distribution but through their intrinsic value growth. The exchange rate of LTokens increases, meaning the underlying asset value they represent grows, while the quantity of LTokens in one's possession remains constant.

In addition, various projects might offer LTokens via their yield farming programs. This strategy is designed to encourage fund providers to deposit assets, thereby facilitating leveraged trading for borrowers using these tokens.


# Liquidation

## Independent Risk Management Between Trading Pairs&#x20;

To support an open margin trading market, we have established isolated pools with targeted risk parameters, tailored to the unique volatility of each asset. Each trading pair is assigned a specific collateral ratio, determined by its inherent volatility and the blockchain's block time and processing capacity.

## Risk Assessment with AMM Prices&#x20;

Real-time pricing provided by the on-chain Automated Market Maker (AMM) model is utilized as a benchmark for risk assessment and liquidation. This approach is crucial in accelerating the development of the leveraged trading market in a decentralized environment, especially when compared to the delay in waiting for Chainlink oracles to generate or update market data. The instant price data provided by DEXs, maintained on-chain and secured by both technical and economic measures, has become the standard oracle for various DeFi applications, such as margin trading.

## Operational Restrictions&#x20;

To prevent flash loan attacks, multiple restrictions have been implemented in the protocol's design:

* Conducting open, close, or liquidation operations within the same transaction is prohibited.&#x20;
* During the liquidation process, [Oracle](/feature-description/oracle) ensure the validity of the liquidation price to prevent attackers from manipulating prices to trigger liquidations for profit or to cause cascading liquidation events.


# Oracle

## Oracle Application and Protection

In developing a permissionless margin trading market, we have opted not to rely on external oracles to convey off-chain price data for risk calculation purposes. Instead, we utilize the Time-Weighted Average Price (TWAP) provided by XEI, including its forks, to build an Oracle that updates as needed. This approach aims to prevent price manipulation in permissionless markets and allows for real-time risk calculations based on on-chain prices.

## Protection for  XEI V3 and Its Forks&#x20;

&#x20;XEI offers cumulative price data updated every second. To ensure the accuracy of the TWAP, we check the cumulative total at the start and end of each period.

### Additional Price Storage&#x20;

We record the cumulative total and the latest prices, representing the most recent TWAP for currency pairs on XEI V3.

### Price Verification Measures&#x20;

We calculate different margin ratios by comparing three reference prices to protect against price manipulation. These prices include the last recorded TWAP, the most recent TWAP, and the latest spot price. The margin ratio for each new position must exceed all three calculated ratios. Conversely, for a position to be liquidated, its margin ratio must fall below these three ratios. This approach mitigates the risk of flash loan attacks, which can only manipulate spot prices within a single block, not the TWAP. Large trade manipulations are theoretically possible but come with high risk and cost.

### Oracle Update Mechanism&#x20;

The Oracle updates only if at least 60 seconds have passed since the last update and the current TWAP differs from the last recorded TWAP by more than 5%. If the current and last recorded TWAPs differ significantly, new positions and liquidations might be paused until a manual update is done. However, closing healthy positions doesn't require an update. Successful trades also trigger an automatic update of the recorded price. Therefore, in active markets with relatively stable price fluctuations, the recorded TWAP is continuously updated, eliminating the need for frequent Oracle updates.

## Protection for XEI V3&#x20;

&#x20;XEI V3 has significantly improved its TWAP oracle, allowing for the calculation of the latest TWAP over approximately the past nine days with a single on-chain call. This enables us to calculate the TWAP based on the previous two blocks. We also ensure that any new positions or liquidations meet the margin ratio requirements calculated based on these three prices: the TWAP between T-2 and T-1 blocks, the TWAP from T-1 to the present, and the spot price. Trading pairs on XEI V3 do not require individual Oracle updates.


# Tutorial


# Getting Started on XEI

To begin trading, first set up a crypto wallet.  Click the "Connect Wallet" button, choose your wallet type, and start trading on XEI promptly.

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

## Deposit Instructions:

1. For your first deposit, visit <https://app.sei.io/> and connect your EVM wallet.

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

2. Once connected, find your "EVM Address" and "Sei Address" under Overview.

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

3. Deposit the desired tokens to your "Sei Address". Once the deposit is complete, the same tokens will appear in your "EVM Address".

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


# How to Start a Market Swap

Market swap is a key feature of XEI, exemplifying the advantages of a DEX. Follow these simple steps to complete a market swap:

1. Open the token dropdown by selecting the token name.

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

2. Find and select your swap token from the list or by searching its name or address.

> * Choose your target token by clicking another token name.
> * Locate and select your target token, either from the list or via search.

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

3. Enter the swap amount or select “**Max**” to use all available tokens. Click "**Swap**".

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

4. Review and confirm the details, then click “**Confirm**”.

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

5. After the transaction is completed, you can view the transaction records here.

<figure><img src="/files/0ldWFNzvmPbJXJmbayjT" alt=""><figcaption></figcaption></figure>


# How to Add Trading Tokens

XEI supports you in adding any token on Sei Network for trading.

1. Search for the token contract address and click to open the "Select Token" window, and paste the contract address of the token.

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

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

2. Choose the token pair you want to trade.
3. The system automatically matches DEXs that support trading. After successful addition, you can trade with the new token.

<br>


# How to Start Futures Trading

This guide will show you how to begin futures trading on the SEI-USDT trading pair with 5X leverage.

1. Initially, select the "SEI - USDT" trading pair. You'll see its chart displayed centrally in the dApp, with the margin trading panel on the right. Here, you can set your trading preferences—such as direction (long or short), leverage level, and the amount of margin to commit based on your risk tolerance.

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

2. For going long on SEI, adjust the leverage to 5X using the provided slider.

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

3. After enabling permissions, choose "Long SEI" once more and set the leverage to "5X." A MetaMask confirmation page will pop up. Review all the details carefully. If everything looks correct, confirm the transaction by clicking the "Confirm" button.

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


# How to Add Liquidity

How to Add Liquidity on XEI

1. Begin by clicking on the "Liquidity" option located in the top left corner of the page.

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

2. Select the option to create a "New Position."

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

3. Adjust the liquidity parameters according to your preferences and the market conditions.

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

4. Input the amount you wish to add to the liquidity pool to complete the process.


# FAQ


# What should I do if I can't find the cryptocurrency I want to trade?

### If you're unable to find the token you wish to trade on our DEX.&#x20;

#### You can [Add a Custom Token](/product-guides/tutorial/how-to-add-trading-tokens):

&#x20;If you're sure the token exists on the blockchain network our DEX operates on, you may have the option to add it manually using its contract address. Be cautious and verify the contract address from a reliable source to avoid scams.


# What are market orders and limit orders?

### [Market Orders](/product-guides/tutorial/how-to-start-a-market-swap):&#x20;

A market order is an instruction to buy or sell a token immediately at the current market price. It's executed quickly but doesn't guarantee a specific price. This type of order is suitable when speed is more critical than price.&#x20;

### [Limit Orders](broken://pages/cLN1wLuiZmGj1lrgq9Jw):&#x20;

A limit order is an instruction to buy or sell a token at a specific price or better. You set the maximum price you’re willing to pay, or the minimum price you’re willing to accept. The trade will only execute if the market price reaches your set limit.


# What fees are associated with Swap transactions?

#### When engaging in [swap](/product-guides/tutorial/how-to-start-a-market-swap) transactions on XEI, there are several types of fees that users might encounter:

#### Trading Fees:&#x20;

This is a fee charged by the XEI for each swap transaction. It's usually a small percentage of the transaction value. The transaction fees collected are typically used to reward community members who contribute to the platform's development.

#### Network Fees (Gas Fees):&#x20;

These are fees paid to blockchain network validators for processing and validating transactions. The amount of this fee can vary greatly depending on the blockchain's current congestion and the complexity of the transaction.


# What are fee tiers, and how do you choose the right fee tier?

When you provide liquidity, you can select from several different trading fees (0.01%, 0.05%, 0.3%, and 0.1%) for the same token pair.

> For example, for SEI-USDT, there is a 0.25% fee tier, which means that a 0.25% trading fee is charged for each transaction. However, some liquidity providers may choose to provide liquidity for the SEI-USDT trading pair at a 0.05% rate to offer better quotes and attract more trading volume.

There is no "correct" answer for which trading fee tier to choose. It depends on the tokens within the trading pair. Generally, tokens with high volatility should have higher trading fees to better compensate for the impermanent loss caused by the volatility. On the other hand, tokens like stablecoins, which have smaller price fluctuations and lower impermanent loss, should have lower trading fees.


# What happens if the current price exceeds the price range set for my liquidity position?

If the current price exceeds the price range you have set for your position, you will not earn any trading fee rewards.

Additionally, the tokens in the corresponding liquidity position will be converted to a single token based on the direction of the price condition.

> For example, if the price range configured for the SEI-USDT position is 3 SEI-USDT to 5 SEI-USDT, and the SEI price is higher than or equal to 5 SEI-USDT, all assets in that position will be converted to SEI, and vice versa.

**Please note that if the current price returns within the range, you do not need to take any additional action, and you will start earning trading fee rewards again.**


# Are fee rewards automatically compounded?

**No, they are not.**&#x20;

You need to manually claim your trading fee rewards. You can find all your liquidity positions on the liquidity page and claim your trading fee rewards on the details page of the corresponding position.


# What factors affect LP APR?

The LP fee reward APR of different liquidity positions may vary. It is based on the following influencing factors:

### Trading volume

More trading volume generates more fee rewards.

### Fee tier of the liquidity token pair

Higher fee tiers result in higher fee rewards from a single transaction.

### Amount of tokens added to the liquidity position

The larger the amount of tokens added, the greater the relative share in the total effective liquidity, which will result in more fee rewards from transactions.

### Set price range

When setting a smaller price range, the liquidity concentration is higher for the same amount of tokens added, meaning that this liquidity accounts for a larger share relative to the total effective liquidity and can obtain more fee rewards from transactions.

### Amount of currently effective liquidity

If more users deposit and concentrate their liquidity in the same range as you, you will receive fewer fee rewards because your relative share of the total is smaller.

### Whether the liquidity position is in an active state

Only liquidity positions in an active state can earn trading fee rewards.


# What is Lending Pools?

Lending Pool is a decentralized financial service that allows users to lend or borrow assets for trading. It functions through individual liquidity pools for each trading pair, ensuring that the funds are highly aligned with specific trades. Users can deposit assets into these pools to earn interest, or borrow from them for trading.


# How is the reward period calculated after participating in Lending Pool?

The reward period is typically calculated from the moment you deposit your assets into the Lending Pool.


# Which cryptocurrencies are supported by Lending Pool?

The platform pre-sets pools for multiple mainstream cryptocurrencies to facilitate instant trading. Users also have the option to create pools for other, less common cryptocurrencies, based on their specific trading needs.


# How long does it take for redemption to be credited to the account?

The redemption time can vary depending on the liquidity and rules of the specific Pool. In general, redemptions are processed within 1 to 5 minutes.


# Contact Us

We highly value the XEI community and warmly welcome everyone to participate in our community activities. Whether you're a XEI user or not, anyone can reach out to us at any time. Join the conversation or get support by joining the following channels:

* X: [@XeiFinance](https://x.com/XeiFinance)
* Telegram: [t.me/XEI\_Finance](https://t.me/XEI_Finance)

If you have any questions or concerns, feel free to email us at <contact@innoguild.com>. We're always here to help and engage with our community members.


