# OVERVIEW

Kim is an ecosystem-focused, community-driven DEX built on Mode.

Kim has been built as a highly efficient and customizable protocol, allowing both builders and users to leverage our custom infrastructure for deep, sustainable, and adaptable liquidity. Kim moves beyond the traditional design of DEXs to focus on offering a custom approach that prioritizes the community and ecosystem. By leveraging Mode's unique approach to sequencer fee sharing, Kim is able to provide projects with greater incentives.

### Why Mode?

Mode is an Ethereum L2 built to encourage and support a cooperative on-chain experience. Users and builders grow as the network grows.

The goal of Mode is to empower developers and users to grow an ecosystem of world-class applications and be directly rewarded for their contribution to the ecosystem through Sequencer Fee Sharing and User Referral fees.&#x20;

{% embed url="<https://docs.mode.network/>" %}

The Kim team believes that through an on-chain cooperative we can grow the ecosystem to onboard the next billion users.


# FAQ

Explore FAQs on Kim DEX for quick answers on liquidity, swap fees, earnings, and platform use, helping you navigate and maximize your DeFi experience


# Liquidity and Yield Farming

## V4

How does V4 manual mode function?

V4 Concentrated liquidity allows liquidity providers on Kim to set custom price ranges for their tokens instead of evenly distributing them across the entire price range. This means that liquidity providers can concentrate their capital on specific price ranges where they believe there will be more trading activity, while still providing liquidity across a broader range of prices rather than the entire price range. In other words, concentrated liquidity allows providing liquidity for specific prices you like, instead of sharing all your liquidity across the whole range.

The unique aspect of Kim vs typical v3 concentrated liquidity comes from Algebra's integral system which allows for the usage of custom plugins (hooks) that can be invoked before or after certain activity.

More info on plugins (hooks) can be found on the Algebra docs portal at:

{% embed url="<https://docs.algebra.finance/algebra-integral-documentation/overview-faq/algebra-integral>" %}

Example of the mechanics:

{% hint style="info" %}
For volatile pair, an LP could provide liquidity for a price range of $1.10 - $1.30. This means that liquidity would only be used within that price range, allowing for more targeted liquidity provision

In a stable pair, a liquidity provider may opt to allocate their capital only to the range of $0.995-$1.005. This can result in deeper liquidity for traders around the mid-price, and the LP can earn more trading fees using their capital
{% endhint %}

### **Merkl**

Merkl is a mechanism to incentivize Kim's V4 manual liquidity positions.

From the user's point of view, the process is quite simple; If the pair of your position is incentivized with market maker rewards, you will receive additional rewards on top of the trading fees that are harvestable in the positions section of the DApp's interface.

### How should price ranges be selected?

* Consider how much prices are likely to move during the lifetime of your position
* Be willing to actively manage the position as the market changes
* Take into account the economics of the transactions required to manage the position
* If prices move outside your specified range, your position will be concentrated in one asset and you won't earn trading fees until prices return to the range
* Providing liquidity across the full range is an option, but it will result in a lower rate of return than a narrower range

### Range presets

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

1. **Full range** - Liquidity is provided across the entire price range of the asset being traded. This can be useful for assets that have a wide trading range or are subject to high volatility
2. **Wide range** - Liquidity is concentrated in a wider price range. This can be useful for assets with moderate volatility, as it provides sufficient liquidity across a range of prices
3. **Common range** - Liquidity is concentrated in both the buy and sell range around the current market price
4. **Narrow range** Liquidity is concentrated in a specific price range, usually close to the current market price. This can be useful for assets that have relatively stable prices, as it reduces the amount of capital required to provide liquidity while still maintaining efficient trading

#### Is my position liquidated if the price exceeds my price range?

If the price of a trading pair goes beyond the range that you set for your LP, then your position will only consist of the less valuable asset in that pair.

{% hint style="info" %}
For instance, if your price range for ETH/USDC is 555-1555, and ETH drops to 550, then your balance will only be in ETH. On the other hand, if ETH increases to 1560, then your balance will only be in USDC
{% endhint %}

When the price remains outside of your specified range, your position will be in an <mark style="color:red;">out of range</mark> mode, which means that you will not earn any fees until the price returns to your set range.

#### How are fees earned and distributed in concentrated liquidity pools?

Fees are earned from swap transactions that occur within the specified price range set by the liquidity providers. These fees are automatically distributed proportionally to the liquidity providers based on the amount of liquidity they have contributed and the time they have been in the pool. For manual mode, pending rewards are harvestable on the V4 position management panel - when it comes to auto mode the LP fees auto-compounding in the LP.


# Protocol Earnings

## **Liquidity Provision on Kim DEX**

1. **What is Liquidity Provision?**
   * Liquidity provision involves depositing a pair of tokens into a pool to facilitate trading on the platform.
   * By providing liquidity, users contribute to the overall health and efficiency of the exchange.
2. **Benefits for Liquidity Providers**
   * Liquidity providers earn a portion of the transaction fees generated from trades in the pool.
   * They play a crucial role in ensuring enough liquidity for smooth trading operations.

### **Swap Fees APR (Annual Percentage Rate)**

1. **Understanding Swap Fees**
   * Each swap (trade) on Kim DEX incurs a transaction fee of 0.3%.
   * This fee is a key revenue source for liquidity providers.
2. **Distribution of Swap Fees**
   * The entirety of the 0.3% transaction fee is distributed directly to the providers of the liquidity pool involved in the swap.
   * This distribution is proportional to each provider's share in the pool.
3. **APR Calculation**
   * The Annual Percentage Rate (APR) for liquidity providers is calculated based on annualized total fees earned from swaps.
   * This rate represents the potential earnings a liquidity provider can expect over a year based on current trading volumes and fee structures.

### **Critical Considerations for Earning Through Liquidity Provision**

1. **Pool Selection**: Consider the trading volume and token stability factors when choosing liquidity pools.
2. **Risk Assessment**: Be aware of impermanent loss, especially in volatile market conditions.
3. **Active Management**: Regularly monitor and adjust your liquidity provision strategy to optimize earnings.

Participating in liquidity provision on Kim DEX offers a compelling opportunity to earn from swap fees. For v4 pools, fees are adaptive based on the volatility of the pair and ranges from 0.01% - 1.5%. For v2 pools, 0.3% transaction fee on swaps, entirely allocated to liquidity providers, is an incentive for contributing to the platform's liquidity. By understanding the dynamics of swap fees APR and selecting suitable pools, users can effectively earn passive income while supporting the ecosystem of Kim DEX. Consider the associated risks and manage your investments actively for the best results.


# What is Impermanent Loss ?

Understanding Impermanent Loss in Automated Market Makers (AMM) and its Impact on KimDex Liquidity Providers

Impermanent loss is crucial for anyone participating in liquidity provision on Automated Market Makers (AMM) like Kim DEX. This phenomenon can affect the value of your investment in a liquidity pool, especially in volatile market conditions. Understanding impermanent loss is crucial for effective liquidity management.

**What is Impermanent Loss?** \
\
Impermanent loss occurs when the price of tokens in a liquidity pool changes compared to their price at the time of deposit. Essentially, it's the difference in value between holding tokens in the pool versus holding them in your wallet. If the prices return to their original levels, the loss is 'impermanent' as the value realigns. However, if prices remain changed, the loss becomes permanent.

**Key Points:**

1. **Price Deviation**: The greater the change in price of the tokens from the time of deposit, the higher the potential impermanent loss.
2. **Volatility Consideration**: Tokens with high volatility are more prone to impermanent loss.
3. **Fee Compensation**: Trading fees earned from providing liquidity can offset impermanent loss but may not always cover it entirely.

**Strategies to Mitigate Impermanent Loss:**

1. **Asset Correlation**: Choosing highly correlated assets might reduce the risk of impermanent loss.
2. **Pool Size and Volume Analysis**: Larger pools with high trading volumes generally have lower impermanent loss risk. Use Kim DEX's analytics tools for this analysis.
3. **Regular Monitoring**: Monitor market conditions and adjust your liquidity strategy as necessary.

Impermanent loss is a fundamental risk in liquidity provision on platforms like Kim DEX. While trading fees can help mitigate this loss, understanding its mechanics and actively managing your investment can significantly influence the outcome.  Being informed and proactive is critical to navigating the complexities of AMM liquidity provision.


# Smart Contract Security and Features

Kim DEX is committed to providing its users with a secure and efficient trading experience. By leveraging expertly crafted intelligent contracts and implementing advanced security measures, Kim DEX ensures the safety and optimization of your investments. This knowledge-based article overviews Kim DEX's platform's critical security features and functionalities.

**Robust Smart Contract Development** Kim DEX's smart contracts are developed by seasoned professionals who deeply understand the industry. The development process prioritizes the following aspects:

1. **Security**: Ensuring the highest level of safety for user funds and transactions.
2. **Efficiency**: Optimizing contract performance for smooth and cost-effective operations.
3. **Scalability**: Designing contracts to support a growing number of users and transactions.

**Comprehensive Security Audits** To validate the security and integrity of its smart contracts, Kim DEX has undergone a thorough audit by Quantstamp, a leading firm in smart contract security. Quantstamp audit services are renowned for their sophistication and thoroughness, assuring the robustness of Kim DEX's contracts. Users interested in reviewing the detailed audit report can access it through the provided link on [Kim DEX's website](https://github.com/kim-protocol/public-reports/blob/main/audits/Kim_Dex_Final_Report-December-2023.pdf).

To further bolster the protocol's security, Kim DEX has implemented multisig, short for multi-signature, a type of digital signature that combines multiple unique signatures. This ensures that funds stored on a multi-signature address can only be accessed when two or more signatures are provided simultaneously. Using multisig wallets provides an additional layer of security, and by utilizing multisig, we can avoid the problems often associated with single-key wallets.


# AMM V2

An AMM is a decentralized exchange (DEX) protocol that uses a mathematical formula to price assets, facilitating trading without needing a traditional order book.

{% content-ref url="/pages/UpXRSxHV1B9lY1uZ4gRa" %}
[Dual Liquidity Type](/protocol/amm-v2/dual-liquidity-type)
{% endcontent-ref %}

{% content-ref url="/pages/6cdUN6m5MhNfMwI1xrpP" %}
[Dynamic Directional Fees](/protocol/amm-v2/dynamic-directional-fees)
{% endcontent-ref %}

{% content-ref url="/pages/pbRhMF4PwbSBxs2hih7s" %}
[Broken mention](broken://pages/pbRhMF4PwbSBxs2hih7s)
{% endcontent-ref %}


# Dual Liquidity Type

Kim's AMM is based on UniV2 constant formula, with a custom implementation of a Solidly-type logic for stables.

The Kim AMM is the core of our ecosystem-oriented approach, designed with the following in mind:

* Modular, flexible and customizable
* Optimizes trading efficiency
* Provides support to protocols' growth by adapting


# Dynamic Directional Fees

Assuming that one size does not fit all, we provide **adjustable swap fees based on market conditions and protocols' specifics.**&#x20;

### Dynamic & directional

Kim pairs can be configured with their own swap fees, but it's also possible for each of them to be set up with **different values depending on the swap direction** (buying or selling).&#x20;

As a result, we have the freedom to incentivize every pair differently, depending on the volatility or stability of its assets, as well as on the structure of protocols and their own custom needs (an established project seeking to reduce friction, a newly launched project aiming to stabilize and limit selling pressure, etc...).

### Fees handling delegation

Each project launching on our AMM and willing to work with us can have its LPs configured with specific swap rates tailored to suit its own strategy.

Ultimately, we intend to provide the possibility for partnering protocols to directly take control of their own pairs' swap fees.


# AMM V4

V4 pools in Kim are powered, in part, by Algebra.&#x20;

You can read more about Algebra and V4 pools in their [technical documentation](https://docs.algebra.finance/algebra-integral-documentation).

An overview of the benefits of V4 pools:

* Concentrated liquidity within ranges
  * Provide liquidity within your specified price ranges&#x20;
* Improved capital efficiency
* Lower slippage
* Optimized fee structures


# V4 Add Liquidity (concentrated)

V4 enables liquidity providers to concentrate their capital within specific price ranges, leading to increased liquidity at preferred prices.

To provide liquidity to V4, navigate to the **Earn** tab, select **Liquidity** and choose **V4:**

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

1. Select a pair

<figure><img src="/files/6CY7HT0HBA77nPFMyAi4" alt=""><figcaption></figcaption></figure>

Also, check if the pair is incentivized with market maker rewards (V4 manual) which serve as an additional, separate layer of rewards on top of the LP trading fees.

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

{% hint style="info" %}
Unlike regular farms, Market Maker incentives are distributed via Merkl, which checks onchain data for incentivized pools using an offchain script.

These rewards are given out every **6 hours**, depending on how many tokens you've earned and the fees your position has collected during that time. Therefore, the narrower the range, the higher the market maker's rewards.
{% endhint %}

*The exact distribution formula for market maker rewards:*

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

For more specific information about how the mechanism works, you can refer to [Merkl documentation](https://docs.angle.money/merkl/lp-guide).

2. Select a mode

The mode you choose depends on the specific utility you seek:

* Manual mode is tailored for experienced liquidity providers, granting them control over the price ranges of the liquidity they provide
* Auto mode employs focused liquidity management strategies, handling the intricate task of adjusting price ranges for users

In auto mode users can select a Automated Liquidity Management provider and select a strategy.

<div align="left"><figure><img src="/files/vYK9FlVwrtXqivSM2JOq" alt=""><figcaption></figcaption></figure></div>

More details about the strategy can be seen on the right panel with details about the ALM and the selected strategy:

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

{% hint style="info" %}
When liquidity is provided through **manual** mode, positions are created as **LP only** and can earn trading fees and market maker rewards
{% endhint %}


# Auto mode (kpNFT)

#### Select a strategy provider

<div align="left"><figure><img src="/files/RQSNxaxE5cS18hmJi54y" alt=""><figcaption></figcaption></figure></div>

#### Select a strategy

<div align="left"><figure><img src="/files/UFzbrYvaC6m32KMDPh7O" alt=""><figcaption></figcaption></figure></div>

#### Approve and Create a Position

To proceed with creating a position, start by granting approval. *(This is solely necessary for the initial liquidity provision involving a token)*

Following approval in your wallet, proceed to click on **Create position**

#### **Review the provided details**

Consider setting a time-lock to boost the APR earned from farming emissions and choosing whether you want to deposit your position into a Nitro pool (if available for the pair of your position) to earn additional rewards!

{% hint style="warning" %}
Before you lock your position, ensure that the pair of your position is emitting x/KIM emissions before locking it. If there are no emissions being generated for the pair of your position, time-locking won't enhance any APR, even though the user interface will permit you to lock the position. The bonus from time-locking is labelled as **Lock bonus APR** at the bottom of the window
{% endhint %}

#### Nitro auto-staking

(SOON) If a Nitro pool is available for the pair you intend to provide liquidity for and you want to opt to stake your position in the Nitro pool during position creation, click the **ON** button next to Nitro auto-staking. Once done, the window below will appear. Simply choose a Nitro pool from there

#### Create a position

Once you're comfortable with the specified parameters, proceed by clicking the **Create position** button and confirm the transactions in your wallet

#### WIN

* Your position is now actively contributing liquidity and earning trading fees. Additionally, it accumulates farming emissions (if emitted for your position's pair) and Nitro incentives (if you deposited the position into Nitro during creation)
* To monitor your positions, click **View existing positions** after successfully creating a position, or navigate to the **Earn** tab, choose **Positions** and select k**pNFTs**
* Note that trading fees auto-compound within the LP. When you withdraw the LP, you will receive the initially paired assets along with earned trading fees
* To harvest farming emissions and Nitro incentives, simply click the **Harvest** button on the position management panel


# Manual Mode (LP only)

When setting the range, you may either use four presets or enter the minimum and maximum prices according to your strategy. The smaller the range, the higher the yield, but there is also a greater risk of impermanent loss.

When deciding on a price range, it's important to think about how much you expect prices to change during the time that you're holding your position. You'll also need to think about how much time and effort you're willing to put into managing your position as market conditions change, as well as the costs involved in making those changes.

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

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

{% hint style="info" %}
If the price of the assets you're providing liquidity for goes outside of the range you've specified, then your position will become focused on one asset or the other. You won't earn any trading fees until the price returns to within your specified range.
{% endhint %}

{% hint style="warning" %}
Please note that the price you enter will be rounded to the nearest tick. It is not necessary to enter a round number, as this is a characteristic of how ticks function
{% endhint %}

#### Input amounts

Input the amount in one box, and the other box will automatically display the corresponding amount. The ratio between the two amounts depends on your price range relative to the market price. If your price range is closer to one side of the market price, you will provide more of that asset. If you click the **Full range** button, you can provide liquidity across the full range

Liquidity providers have the option to allocate liquidity on one side of the market, either above or below the current spot price, depending on whether they are provisioning the token with a higher or lower value

<div align="left"><figure><img src="/files/yBghyBvjIaaC9PbYAfkF" alt=""><figcaption></figcaption></figure></div>

#### Approve and Add liquidity

To proceed with adding liquidity, start by granting approval. *(This is solely necessary for the initial liquidity provision involving a token)*

Following approval in your wallet, proceed to click on **Add liquidity,** review the provided details, and then click **Add liquidity** once more to execute the transaction from your wallet

#### Earn and manage

Your assets are now actively contributing liquidity and accruing trading fees and market maker rewards (depending on whether your position pair is incentivized through Merkl)

You can oversee and monitor your positions by clicking on **View existing positions** after successfully providing liquidity or navigating to the **Earn** tab, then selecting **Positions** and finally choosing **LP V4.**

#### **Unbind / Add Liquidity and Harvest**

On the V4 position management panel, you can view your position data, pending earned fees and incentives. You can also access the following features:

* Market maker rewards: harvest your pending incentives *(It will only appear on the interface once you have pending rewards to harvest)*
* Unbind: withdraw liquidity
* Add: add more liquidity to your position
* Harvest: harvest your pending rewards

### What does the Burn Position button signify when unwrapping V3 LP?

{% hint style="info" %}
The Burn position feature allows you to entirely liquidate your V4 position. Not burning position when closing can be useful if you intend to add liquidity again in the future using the same parameters. If you decide not to burn a position, it will remain empty and available for a future liquidity deposit. If you burn it you will get back the assets that you originally paired and the position will be burned
{% endhint %}

### Single-sided liquidity provision

Single-sided liquidity feature in V4 allows liquidity providers to deposit a single asset instead of both assets in a trading pair. This feature is intended to give liquidity providers more flexibility and reduce the risk associated with providing liquidity.

#### Key points to think about for signle-sided liquidity provision in V4:

* Single-sided liquidity providing allows liquidity providers to deposit only one asset instead of both assets in a trading pair
* V4 uses the current price of the assets to calculate the correct amount of the other asset needed to create the trading pair
* Single-sided liquidity providing can reduce the risk associated with providing liquidity since liquidity providers don't have to worry about the value of both assets in the trading pair
* Liquidity providers can still earn trading fees even if they only provide one asset to the pool

{% hint style="success" %}
Single-sided liquidity providing is useful for liquidity providers who may not have both assets on hand or want to reduce their risk exposure
{% endhint %}


# Fee Collection

:warning:At the current time, fees earned from liquidity provision to V4 pools *do not* auto compound.

You must manually claim the fees from the [LP dashboard](https://app.kim.exchange/positions).

If you intend to remove liquidity, first claim the fees you have earned then remove the liquidity.


# KIM Staked Position NFTs (kpNFTs)

KIMs liquidity approach based on non-fungible staked positions, dubbed kpNFTs.

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

### How does it work? <a href="#how-does-it-work" id="how-does-it-work"></a>

Each KIM LP has its own KIM staking positions (or kpNFTs) that users can mint by wrapping LP tokens (i.e. depositing them on the relevant contract).

Upon creating a position, the deposit is sent to a specific corresponding NFTPool contract in exchange for a staking position NFT, which can be viewed as a kind of deposit receipt.

{% hint style="info" %}
Those receipts are the only thing allowing a user to withdraw the corresponding funds, regardless of who is using them, so the owner of a kpNFT is also the actual owner of the corresponding LPs, even if she did not deposit them originally.
{% endhint %}

But staked positions are more than simple receipts: they replace the usual farms generating yield that you will find in most of the DeFi protocols, and also play the role of an additional layer of features offering unlimited new opportunities and potential extensions.


# Properties

Every KIM staked position (kpNFT) has the following basic information:

* a unique ID
* a deposit LP token
* a deposit LP token amount
* an APY
* optional lock settings (duration, start/end time)
* multipliers information

### Operations <a href="#operations" id="operations"></a>

Here is the list of available interactions available to a staked position's owner:

**Deposit** Add more tokens to the position. Resets the lock if the position is locked.

**Withdraw** Withdraw an amount of tokens from the position. If the position is emptied, the kpNFT is automatically burned. Can't be used if the position is locked.

**Harvest** Harvest all pending rewards (xKIM and KIM) from the position. Only used when yield incentives are allocated to the position's LP token.

**Lock** Lock an unlocked position for a given duration.

**Extend** If the position is already locked, renews or extend the lock duration.

**Transfer** Transfer the position to another address.

**Split** Split the position into two, dividing between them the original amount. If the original position is locked, the new one will be as well with the exact same settings.

**Merge** Merge positions into one. The final position will use the longest lock duration and farthest end lock time among all the merged positions.

### Locks <a href="#locks" id="locks"></a>

It's possible to specify a lock duration when creating a position, implying it will be impossible to withdraw anything from the kpNFT until the end of the lock.

Every wrapped KIM LP has its own lock settings (max lock duration, and its matching max lock multiplier).

A lock will provide a yield bonus based on this multiplier if the position's LP is incentivized, and can be a needed requirement to have the right to stake on a Nitro Pool.

This bonus will be linearly calculated proportionally to the duration of the lock and the maximum lock multiplier.

{% hint style="info" %}
Over time, we wish to delegate control over the lock settings and its associated multiplier to the LP's protocol themselves.

However, the process will be regulated by the DAO governance.
{% endhint %}

### APY

Finally, every yield-bearing kpNFT will have its own APY, based on:

* The allocation set by the Master to the wrapped LP
* The lock multiplier
* The YieldBooster multiplier


# Yield Bearing

While staked positions under the form of kpNFTs has a wide range of use, one of their main initial purposes will be to replace classic yield farming mechanisms by receiving KIM incentives.

### Yield-bearing NFTs <a href="#yield-bearing-nfts" id="yield-bearing-nfts"></a>

From a user standpoint, the mechanics have a lot of similarities with DeFi regular farms.

However, instead of allocating rewards to those regular farms, the KIM's Master contract distributes incentives to all the staking positions of team-defined selected wrapped LPs.

{% hint style="warning" %}
In other words, it's not because a user owns a staking position that she'll necessary receive KIM yield incentives: it will only be the case for those selected assets.
{% endhint %}

Once a staked position's LP belongs to those listed pairs, **the kpNFT starts** **generating yield with rewards from the Master**, as if its owners were actually staking into a regular farm.

### Rewards <a href="#rewards" id="rewards"></a>

KIM incentives are under the form of dual-rewards: the eligible wrapped KIM LPs will have their matching staked positions receive both KIM and xKIM.

The share of both rewards in the total varies depending on the asset, with a default set to 80% xKIM / 20% KIM.

### Yield Multipliers

There are two ways to boost returns from yield-generating staked positions: through locks, or through the [YieldBooster plugin](/protocol/xkim-plugins/yield-booster).

Both values will vary depending on the staked asset, from 0% to 150% (x1 to x2.5), but will usually be set to their default 100% (x2).

The sum of those two multipliers is used to determine the total multiplier of the position. Every pool will have its own maximum boost, with a 200% (x3) default cap and an absolute cap of 250% (x3.5).


# xKIM Plugins

Plugins are contracts linked to the xKIM contract. Some are native and directly made by the KIM team (dividends, yield booster and more to come) but others are freely integrated by anyone from the ecosystem.

Users can take advantage of plugins' unique benefits by allocating xKIM to them by directly staking into the xKIM contract.

<figure><img src="/files/2LBPfqsaL4fI0XtLJc0B" alt=""><figcaption></figcaption></figure>


# Rewards

The majority of the protocol earnings are redistributed to users who allocated xKIM to the Rewards plugin.

This rewards distribution can be done in the form of one or more tokens, and happens **continuously** (reward/second), through weekly epochs.

### Epochs

The distribution is based on a weekly epoch logic: every week, a fixed part of the owner-defined accumulated tokens is marked as to be distributed.

The same process is repeated every 7 days.

### Payouts handling

The distribution of those tokens is equally spread over the duration of the epoch, and allocated on a second-basis to every user with a xKIM allocation on this Rewards plugin, proportionally to their share of the total allocation.

{% hint style="info" %}
In more simpler terms, if we go with the following values:

* a total of 10,000 xKIM allocated to the dividends plugin
* a daily distribution of 10,000 USDC

If a user has allocated 200 xKIM to the plugin, he owns 2% of the allocations and will consequently receive 2% of the daily rewards, ie 200 USDC.
{% endhint %}

{% hint style="warning" %}
Rewards are being distributed continuously, users don't need to wait for the end of the epoch to collect them.
{% endhint %}

### Deallocation

Deallocating xKIM from this plugin is not subject to any condition, and can be done at any time.


# Yield Booster

COMING SOON

Through the YieldBooster plugin, every user can allocate its xKIM to a KIM position (kpNFT) in order to earn additional rewards from farming emissions.

The induced yield boost multiplier is different based on the staking position's wrapped LP, but will usually use the default x2 value.

### Mechanics of the plugin

This value is calculated for every position from the following elements:

* The position's LP amount
* The total staked LP amount across all positions and users
* The position's allocated xKIM amount
* The total allocated xKIM across all of the positions with the same LP
* The LP max boost multiplier (can't exceed x2.5)

The formula is very straightforward:

$$
boostMultiplier = \cfrac{(userLP \* totalAllocation \* maxBoostMultiplier)}{totalLP \* userAllocation}
$$

{% hint style="warning" %}
As more xKIM is assigned to a pair, the boost will decrease for each user's allocated amount. The process works in both directions; the less xKIM is assigned to a pair in total the higher the APR for each user's allocated amount
{% endhint %}

{% hint style="info" %}
The Yield Booster affects rewards earned from farming emissions (x/KIM) only, without impacting rewards from:

* LP trading fees
  {% endhint %}

### Deallocation

Deallocating xKIM from this plugin is not subject to any condition, and can be done at any time.

The deallocation fee is 0.5%.


# Community Plugins

COMING SOON

The xKIM allocation mechanism is made so that any protocol and/or user are able to provide their very own plugin implementation.

All additional xKIM allocations will have to be handled through the xKIM token contract itself, and more generally, community plugins will have to comply with some technical requirements to make them fit with KIM's technical stack.

{% hint style="danger" %}

* KIM can't be held responsible for any authorization given by users to a third-party Plugin.
* A malicious or badly made plugin contract could make your xKIM stuck forever, so remember to be extra careful before approving a contract asking for an xKIM allocation.
  {% endhint %}


# KIM Token

Name: **Kim Token**\
Ticker: **KIM**\
Chain: **Mode**\
Max supply: **1,000,000,000 KIM**\
Contract: [0x6863fb62Ed27A9DdF458105B507C15b5d741d62e](https://explorer.mode.network/token/0x6863fb62Ed27A9DdF458105B507C15b5d741d62e)

KIM is the native token of the Kim Protocol. It serves to ensure Kim is a leader in incentivization. Read more about the power of KIM in the [Utility section](/protocol/xkim-plugins).


# xKIM Token

Name: **Kim Escrowed Token**\
Ticker: **xKIM**\
Chain: **Mode**\
Contract: [0x4D850FE01F07BEd416558A34dbde88bA60aE19BE](https://explorer.mode.network/token/0x4D850FE01F07BEd416558A34dbde88bA60aE19BE)

When you stake your KIM tokens, you receive a proportional amount of xKIM, the non-transferable governance token of the Kim ecosystem. It can be earned from yield-generating kim positions (kpNFTs), or through direct KIM conversion.

The central use case for xKIM is the ability to allocate it to Plugins. This consists of staking xKIM into the token contract and assign the deposited amount to a plugin in exchange for various benefits.

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


# How to use xKIM

xKIM is illiquid and non-transferable, but can be used through plugins' allocations, and in the future on approved (whitelisted) contracts providing additional usages.

### Allocations

Users can freely allocate their available xKIM to any plugin to take advantage of its benefits. While xKIM is allocated and consequently deposited on the token contract, **it can't be used for anything else**.

Deallocating allocated xKIM will withdraw the amount back into the owner's wallet.

{% hint style="danger" %}
Depending on the plugin, a default 0.5% fee may be applied when deallocating xKIM.
{% endhint %}

### Transfer

xKIM is by default non-transferable, except from/to whitelisted addresses. This is made so that essential interactions (like allocations and redeem with the token contract) and additional usages (for instance with partners specific implementations...) can still be leveraged.


# Conversion - Redeeming

KIM and xKIM are mutually convertible into each other, but the process is different depending on the direction.

### KIM > xKIM conversion

KIM can be freely converted into xKIM at any time. The process is instant, and the ratio is 1:1.

### xKIM > KIM redeem

The redemption process to convert xKIM to KIM implies vesting, the duration of which is selected by the user. The conversion ratio will increase proportionally with the vesting duration:

* The minimum vesting duration of 15 days will provide a 1:0.5 ratio
* The maximum vesting duration of 6 months will provide a 1:1 ratio

{% hint style="warning" %}
If the selected vesting duration is lower than the maximum (ratio < 1:1), the unclaimed excess KIM is burned
{% endhint %}

### Dividends allocation

While being redeemed, the xKIM is automatically allocated to the dividends plugin, but **only for 50% of its value**.

{% hint style="info" %}
For instance, if a user was to redeem 1000 xKIM, she would earn dividends as if she actually allocated 500 of them to the Dividends plugin.
{% endhint %}

### Cancel redeem

Any xKIM redeeming process can be freely interrupted at any time by the user.

{% hint style="warning" %}
Any cancelled redeem before its end will void the whole process. User will retrieve its entire amount of redeeming xKIM, and no KIM.
{% endhint %}


# Distribution

### KIM allocation

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

### Kim Supply Release Schedule

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


# Protocol Earnings

## V4

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

* 85% for Liquidity Providers in LP tokens
* 7% in rewards redistributed to xKIM holders
* 3.5% dedicated to KIM buyback and burn
* 1.5% to the Operating expenses
* 3% to Algebra for licensing V4 AMM

## V2

<figure><img src="/files/3FPERTtQb2hgVM8Oa2m5" alt=""><figcaption></figcaption></figure>

* 60% for Liquidity Providers in LP tokens
* 22.5% in rewards redistributed to xKIM holders
* 12.5% dedicated to KIM buyback and burn
* 5% to the Operating expenses


# Deflationary Mechanics

In addition to the hardcap set on KIM, we also implemented some deflationary mechanics in order to reduce the total supply.

## Buy back & Burn

A share of the protocol earnings is dedicated to buy back & burn KIM, in order to apply a continuous buying pressure on it.

## xKIM redeems

When converting xKIM to KIM, if the vesting duration isn't the maximum, the xKIM:KIM ratio will be lower than 1:1, down to a minimum of 1:0.5. All of the excess KIM will automatically be burned.

{% hint style="info" %}
For instance, if a user redeems 1000 xKIM with the minimal 15 days vesting duration, she will obtain a 1:0.5 ratio, and receive 500 KIM in the end.

That means a total of 1000 - 500 = 500 KIM will be burned during the process.
{% endhint %}

## xKIM deallocations

When deallocating xKIM from a Plugin, a deallocation tax is applied. It can vary between contracts, but will usually be of 0.5%.

The corresponding KIM amount will automatically be burned.


# Audits

**Comprehensive Security Audits** To validate the security and integrity of its smart contracts, Kim DEX has undergone a thorough audit by Quantstamp, a leading firm in smart contract security. Quantstamp audit services are renowned for their sophistication and thoroughness, assuring the robustness of Kim DEX's contracts. Users interested in reviewing the detailed audit report can access it [here](https://github.com/kim-protocol/public-reports/blob/main/audits/Kim_Dex_Final_Report-December-2023.pdf).

To further bolster the protocol's security, Kim DEX has implemented multisig, short for multi-signature, a type of digital signature that combines multiple unique signatures. This ensures that funds stored on a multi-signature address can only be accessed when two or more signatures are provided simultaneously. Using multisig wallets provides an additional layer of security, and by utilizing multisig, we can avoid the problems often associated with single-key wallets.

**Our V4 AMM** is based on the Algebra Integral solution. For audits related to this protocol component consult the [following page](https://docs.algebra.finance/algebra-integral-documentation/algebra-integral-technical-reference/audits).


# Community & Social

You're never alone on your crypto journey. Join the Kim community - ask questions, go full degen, and get your problems solved (your on-chain problems, nothing beyond that) in our [Discord](https://discord.gg/kimprotocol).

To keep up to date, follow us on [X here](https://x.com/kimprotocol).

For the giga-geeks, monitor our in-house team of geeks code contributions on the [Kim Github](https://github.com/kim-protocol).


# AMM V2

{% content-ref url="/pages/8nF4i1dfRyE2jJV5ocQ3" %}
[Factory](/contracts/amm-v2/factory)
{% endcontent-ref %}

{% content-ref url="/pages/QfpIDcvkj1QcjZgywNCM" %}
[Pair](/contracts/amm-v2/pair)
{% endcontent-ref %}

{% content-ref url="/pages/xWYb7Tp58Rcj2ttTFs4K" %}
[Router](/contracts/amm-v2/router)
{% endcontent-ref %}


# Factory

Mode Mainnet: <https://explorer.mode.network/address/0xc02155946dd8C89D3D3238A6c8A64D04E2CD4500>


# Pair

(cf. [Factory](/contracts/amm-v2/factory))


# Router

Mode Mainnet: <https://explorer.mode.network/address/0x5D61c537393cf21893BE619E36fC94cd73C77DD3>


# Subgraph

<https://api.goldsky.com/api/public/project_clmqdcfcs3f6d2ptj3yp05ndz/subgraphs/kim-amm/0.0.3/gn>


# AMM V4

{% content-ref url="/pages/FWdl8rVB3jlhwhP0F0wC" %}
[Factory](/contracts/amm-v4/factory)
{% endcontent-ref %}


# Factory

Mode Mainnet: <https://explorer.mode.network/address/0xB5F00c2C5f8821155D8ed27E31932CFD9DB3C5D5>

cf. [Algebra documentation](https://docs.algebra.finance/algebra-integral-documentation/overview-faq/algebra-integral)


# Non Fungible Position Manager

Mode Mainnet: <https://explorer.mode.network/address/0x2e8614625226D26180aDf6530C3b1677d3D7cf10>

cf. [Algebra documentation](https://docs.algebra.finance/algebra-integral-documentation/algebra-v1-technical-reference/contracts/api-reference-v2.0/v2.0-periphery/nonfungiblepositionmanager)


# BasePluginV1Factory

Mode Mainnet: <https://explorer.mode.network/address/0x2e8614625226D26180aDf6530C3b1677d3D7cf10>

cf. [Algebra documentation](https://docs.algebra.finance/algebra-integral-documentation/algebra-integral-technical-reference/plugins)


# SwapRouter

Mode mainnet: <https://explorer.mode.network/address/0xAc48FcF1049668B285f3dC72483DF5Ae2162f7e8>

cf. [Algebra documentation](https://docs.algebra.finance/algebra-integral-documentation/algebra-v1-technical-reference/contracts/api-reference-v2.0/v2.0-periphery/swaprouter)


# Subgraph

<https://api.goldsky.com/api/public/project_clmqdcfcs3f6d2ptj3yp05ndz/subgraphs/Algebra/0.0.1/gn>[https://api.goldsky.com/api/public/project\_clmqdcfcs3f6d2ptj3yp05ndz/subgraphs/Farming/0.0.1/gn\
https://api.goldsky.com/api/public/project\_clmqdcfcs3f6d2ptj3yp05ndz/subgraphs/blocklytics/0.0.1/gn](<https://api.goldsky.com/api/public/project_clmqdcfcs3f6d2ptj3yp05ndz/subgraphs/Farming/0.0.1/gn&#xA;https://api.goldsky.com/api/public/project_clmqdcfcs3f6d2ptj3yp05ndz/subgraphs/blocklytics/0.0.1/gn>)


