# Introduction

## **About Yuzu**

Yuzu is a non-custodial, highly efficient Concentrated Liquidity Market Maker DEX (CLMM) built on the Movement Network. By leveraging the innovative architecture of Movement, Yuzu offers a hyper-efficient liquidity hub with unparalleled scalability, seamless user experiences, and secure trading.

Founded in 2024, Yuzu is supported by pioneers in DeFi and blockchain development and is committed to accelerating the Movement Network ecosystem, with the mission to make DeFi accessible to everyone while serving as a critical bridge between Movement-based projects and the broader market.

***

### **Building for the Movement Ecosystem**

Yuzu is dedicated to advancing the Movement's ecosystem with scalable infrastructure and robust liquidity solutions, ensuring long-term sustainability and growth.

### **Unlocking Capital Efficiency**

With an innovative concentrated liquidity model, Yuzu optimizes capital usage by focusing liquidity where it’s most effective. This approach eliminates unused collateral and enhances returns for liquidity providers.

### **Empowering Liquidity Providers**

Yuzu provides tools for liquidity providers to manage their assets dynamically. Customize trading price ranges in real time to adapt to ever-changing market conditions and maximize profitability.

### **Streamlined Trading for All**

Yuzu is designed with simplicity and functionality at its core. Whether you’re a seasoned trader or new to DeFi, the intuitive interface and efficient workflows ensures a smooth trading experience.


# Testnet Activity Quests

Welcome to the Yuzu Testnet Quest Campaign!

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

On this page you can learn more about Yuzu, Movement, as well for participating in fun and rewarding quests!

## How to Get Involved

* Join our Telegram Community: <https://t.me/YuzuDEX>&#x20;
* Join our Galxe Testnet Quest Campaign: <https://app.galxe.com/quest/Yuzu>&#x20;
* Join our Discord: <https://discord.gg/sRZmSQgR7K>
* Follow us on X: [https://x.com/YuzuDEX ](<https://x.com/YuzuDEX >)
* Quest Center: <https://testnet.movementlabs.xyz>&#x20;

## Community Guilds

Movement Labs values inclusivity and acknowledges that every community member possesses distinct skills and interests. This philosophy inspired the creation of our "Guilds," which allow you to showcase your unique talents. To assist you in finding your passion, we've compiled the ultimate guide to navigating each Guild and Quest.

### How The Community Program Works

Each Guild consists of multiple levels. Early levels are easy to reach, while the higher levels are reserved for the truly dedicated Movers.

To advance, you must complete quests and accumulate a minimum number of loyalty points.

While you can join multiple Guilds, most members will find their niche and excel in one or two.

### Program Perks

Our goal is to motivate, support, and reward members who actively engage!

Here are some benefits and rewards you can earn as you advance:

* Early Access: Be among the first to experience new features and products from Interest Protocol.
* Public Acknowledgment: Receive shout-outs and mentions on Interest Protocol’s official social media platforms.
* Exclusive Discord Roles: Stand out with unique roles that reflect your Guild achievements.
* Contests and Giveaways: Gain access to whitelists and win real-life products.
* Collaboration Projects: Partner with our content team on special initiatives.
* Networking Events: Connect with ambassadors, the Interest Protocol team, and industry leaders.
* Enhanced Visibility: Increase your exposure to a global audience, boosting your follower count and influence.
* Career Opportunities: Elevate your personal brand within the blockchain and crypto community, potentially unlocking job opportunities within the ecosystem.

## Your Journey Starts Here

### Pathfinder

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

Keep up with everything Yuzu! Follow us on social media for the latest news, updates, and exclusive behind-the-scenes content. Get to know more about Yuzu and our amazing ecosystem partners!

Complete the Explorer Quests from the link below.

{% embed url="<https://app.galxe.com/quest/Yuzu/GCJ6NtkEs5>" %}

### Explorer

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

Explore the Socials of Yuzu and the Movement Network.

Join, like, tweet, follow, refer and more quests to come to earn your well-deserved points!

{% embed url="<https://app.galxe.com/quest/Yuzu/GChbEtkTNN>" %}

### Creator

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

Are you a creative powerhouse? Then this Guild is made for you! Unleash your artistic abilities and craft masterpieces. Write poetry, compose music, and find your inner Picasso! Join us and let your creativity shine!

{% embed url="<https://app.galxe.com/quest/Yuzu/GCwHNtkoXD>" %}

### Scholar

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

Calling all nerds and geeks! Rise to the rank of Grand Master in the Movement. Craft insightful articles and blogs about Interest Protocol and Movement Labs, and develop comprehensive threads and tutorials on Interest Protocol's Decentralized Exchange. Dive into the Move Language, explore our GitHub repository, and contribute your expertise.

{% embed url="<https://app.galxe.com/quest/Yuzu/GCFRNtkaNj>" %}

### Spartan - Onchain Quests (Coming Soon)

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

To complete every on-chain interaction on Yuzu, follow these steps. Get your wallets ready for the journey and take advantage of the opportunities in the DeFi world.

Follow these steps to ensure all your on-chain interactions on Yuzu are completed.

{% embed url="<https://app.galxe.com/quest/Yuzu/GCFcNtkP28>" %}

### Onchain Quests Explained

#### Quest 1 - Swap (Coming Soon)

* Visit <https://YuzuDEX.xyz/>.
* Complete a swap of any coin and claim your points on Galxe.

#### Quest 2 - Provide Liquidity to any pool (Coming Soon)

* Visit <https://YuzuDEX.xyz/>.
* Select the pool you’d like to add liquidity to.
* Choose your deposit amount.
* Complete the transaction.

#### Quest 3 - Create Token (Coming Soon)

* Visit <https://YuzuDEX.xyz/>.
* Fill in the required information: **Name**, **Symbol**, **Description**, and **Logo**.
* Set the **total supply**.
* Complete the transaction.

#### Quest 4 - Create a Liquidity Pair and add Liquidity to your created token (Coming Soon)

Note: A Liquidity Pair can only be created once between the same two tokens.&#x20;

E.g. The MOVE/USDT pair can only be created once, then one can only add to the existing pool.

* Visit <https://YuzuDEX.xyz/>.
* Create a pair to the token you just created by pasting its contract address, together with any verified token.
* Choose your deposit amount
* Complete the transaction.


# Get Started on Movement

To get started on Movement, the first thing you'll need is to set up a wallet that supports the Movement chain. Wallets are available both on desktop computers and smartphone devices. Please find below a comparison between various MOVE compatible wallets, so you can choose the wallet that matches your preferences.

{% hint style="warning" %}
**When you're setting up a wallet, be sure to:**

* ✅ **Download and install only the latest version from an official source.**
* ✅ **Follow the setup guide carefully.**
* ✅ **Safely back up your recovery phrases.**
* ❌ **NEVER share your recovery phrases with anyone, under any circumstances.**
* ❌ **NEVER input your recovery phrase to a website or app, other than your wallet app.**
  {% endhint %}

## Smartphone/Mobile or Desktop wallet?

Mobile device wallets and desktop-based wallets have different strengths and weaknesses. Consider which fits your needs better to help decide which type of wallet to use.

|                                   | Mobile | Desktop |
| --------------------------------- | ------ | ------- |
| Use anywhere                      | ✅      | ➖       |
| Easy to use                       | ✅      | ✅       |
| More secure                       | ➖      | ✅       |
| Accessibility friendly            | ✅      | ✅       |
| Damage/loss/theft resistant       | ➖      | ✅       |
| Power/connection outage resistant | ✅      | ➖       |

## **Smartphone/Mobile wallets**

Smartphone/Mobile wallets allow you to access your crypto almost anywhere. Wallets are available on both Android and iOS devices.

### Which mobile wallet should I choose?

This comparison table gives an overview of the most popular mobile wallets used with Yuzuswap.

<table><thead><tr><th width="269"></th><th width="166">Nightly</th><th width="156">Pont</th></tr></thead><tbody><tr><td>Movement Chain support</td><td>✅</td><td>✅</td></tr><tr><td>Built-in DApp browser</td><td>✅</td><td>✅</td></tr><tr><td>Hardware wallet compatible</td><td>➖</td><td>➖</td></tr><tr><td>Open source (auditability)</td><td>✅</td><td>✅</td></tr></tbody></table>

You can find more in-depth information about each wallet below, as well as download links and installation guides.

{% tabs %}
{% tab title="Wallet 1" %}
Intro text

**Highlights:**

*

**Note:**

* Desktop and Mobile Support

**Download Wallet**

**Wallet Setup Guide**
{% endtab %}

{% tab title="Untitled" %}

{% endtab %}
{% endtabs %}

## **Desktop/Web Browser wallets**

Desktop wallets are available on your home computer or laptop computer. Wallets on your computer can run as standalone applications, or as web browser plugins for popular browsers like Chrome and Firefox.

### Which desktop wallet should I choose?

This comparison table gives an overview of the most popular desktop wallets used with Yuzu on Movement.

<table><thead><tr><th width="205"></th><th>1</th><th width="115">2</th><th>3</th><th>4</th><th>5</th></tr></thead><tbody><tr><td>Movement Chain support</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td></tr><tr><td>Hardware wallet compatible</td><td>➖</td><td>➖</td><td>➖</td><td>➖</td><td>➖</td></tr><tr><td>Open source (auditability)</td><td>✅</td><td>❓</td><td>✅</td><td>❓</td><td>❓</td></tr></tbody></table>

*❓ - as of writing, we are unsure about the status of this information*

You can find more in-depth information about each wallet below, as well as download links and installation guides.

{% tabs %}
{% tab title="Wallet 1" %}
Intro

**Highlights:**

*

**Note:**

* Desktop only

**Download Wallet**

**Wallet Setup Guide**
{% endtab %}

{% tab title="Untitled" %}

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
NEVER, in any situation, should you ever give someone your private key or recovery phrase ("seed phrase"). This will give that person complete control over your wallet and funds!

The Yuzu site and staff will never ask you to input your seed phrase or private key!
{% endhint %}


# Get MOVE Coins

The native token of Movement is **$MOVE**.

To do most things on Movement, you will need to pay gas, which comes in the form of $MOVE.&#x20;

#### Testnet

For testnet you can aquire $MOVE through the [faucet](https://faucet.movementnetwork.xyz/).

#### Mainnet (COMING SOON)

You will also need $MOVE if you plan to trade or stake on the Movement mainnet. The simplest way to acquire $MOVE is by purchasing it on a supported centralized exchange (CEX). Alternatively, you can transfer your assets to the Movement mainnet using decentralized bridges. Here are the ones we recommend:

{% tabs %}
{% tab title="Bridge 1" %}

{% endtab %}
{% endtabs %}


# CLMM

Yuzu's concentrated liquidity DEX enables users to provide liquidity within targeted price ranges, optimizing capital efficiency and minimizing impermanent loss for liquidity providers. This approach ensures a more sustainable and rewarding trading experience.

## About Concentrated Liquidity

### **Automated Market Making (AMM):**

Yuzu operates as an innovative automated market-making platform, facilitating efficient token swaps and liquidity provision.

The Movement Network’s non-custodial framework, which eliminates intermediaries and ensures low transaction costs, aligns perfectly with Yuzu’s vision of providing a seamless and cost-effective trading experience. By distributing minimal trading fees entirely to liquidity providers (LPs), Yuzu incentivizes deep liquidity and competitive pricing for all users.

### **Concentrated Liquidity:**

Yuzu redefines liquidity provision with its concentrated liquidity model, enabling LPs to focus their capital within specific price ranges. This results in higher returns on investment and reduces unnecessary risk exposure.

This approach ensures ultra-low slippage for trades, often outperforming traditional DEXs and centralized exchanges. It also allows LPs to optimize their positions, offering greater exposure to preferred assets while simultaneously mitigating downside risk, making the platform an ideal choice for both experienced traders and investors.

Additionally, LPs can use concentrated liquidity to mimic fee-earning limit orders by adding liquidity entirely above or below the current market price. This feature enhances flexibility, enabling strategic trading and maximizing earning potential while maintaining a smooth, intuitive user experience.

Yuzu combines innovation and user-centric design to deliver a highly efficient and profitable platform for all participants in the decentralized finance ecosystem.


# Fee Tiers

At Yuzu, we've redefined the concentrated liquidity AMM to prioritize user-friendliness and cost-efficiency, offering a superior alternative to traditional DEXs and CEXs.

## **For Liquidity Providers (LPs):**

Yuzu features a flexible fee tier structure tailored to different token pair characteristics. This system empowers LPs to optimize their strategies based on the correlation and price volatility of the tokens they provide liquidity for:

| **Fee Tier**                                 | **Description**                                                                                                                                                                          |
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **0.01%** – Historically Proven Stable Pairs | Designed for pairs, with a proven history of being very stable.                                                                                                                          |
| **0.05%** – Stable Pairs                     | Designed for highly correlated pairs, such as stablecoins (e.g., USDT-USDC). These pairs involve minimal price risk, and the low fee suits traders seeking cost-effective swaps.         |
| **0.3%** – Most Pairs                        | Ideal for token pairs with moderate correlation and occasional price swings (e.g., MOVE-USDC). The higher fee compensates LPs for the increased price risk compared to stablecoin pairs. |
| **1%** – Exotic Pairs                        | Best suited for pairs with minimal correlation and significant price volatility (e.g., exotic token pairs). This elevated fee rewards LPs for bearing higher price risk.                 |

By aligning fees with token behavior, Yuzu provides a balanced approach that benefits both traders and liquidity providers, fostering a sustainable and profitable ecosystem for all participants.


# Price Ranges

## **How Do Liquidity Price Ranges Work?**

In concentrated liquidity market maker (CLMM) pools, users can define specific price ranges within which they provide liquidity. Liquidity providers (LPs) earn fees based on their share of liquidity at the current market price, creating a strong incentive to actively manage positions to ensure the price remains within their selected range.

If the market price moves outside an LP's chosen range, their position becomes inactive, ceasing to earn fees. Additionally, LPs may face increased impermanent loss. Similar to standard AMM pools, when the price of a base token rises, traders exchange the quote token for the base token, leaving the pool—and the LP—with more of the quote token and less of the base token.

In CLMMs, this process is more concentrated within the selected price range, leading to accelerated effects:

* If the price drops below the minimum of the selected range, the LP's position will consist entirely of the base token.
* If the price exceeds the maximum of the range, the LP's position will fully convert to the quote token.

This dynamic allows LPs to have greater control over their liquidity and the potential for higher returns but requires careful monitoring to minimize the risk of being out of range and missing fee opportunities.


# Active & Inactive Liquidity

As an asset's price fluctuates, it may move beyond the price range set by liquidity providers (LPs) for a specific position. When this happens, the liquidity for that position becomes inactive, and the LP stops earning fees until the price reenters the range.

As the price shifts in one direction, LPs accumulate more of one asset as traders exchange for the other. This continues until the liquidity position consists entirely of one asset. However, unlike traditional models, concentrated liquidity ensures LPs rarely reach extremes (e.g., 0 or ∞) because of the ability to define precise price intervals. When the price reenters a defined range, the liquidity becomes active again, and LPs resume earning fees.

LPs have the freedom to create multiple positions, each with its own price range. This flexibility allows LPs to strategically distribute their liquidity across ranges, optimizing earnings while keeping their liquidity active as much as possible.

Concentrated liquidity not only gives LPs granular control over their positions but also lets the market naturally determine an efficient distribution of liquidity. Rational LPs are incentivized to focus their liquidity where it will remain active, maximizing returns and supporting a more efficient trading ecosystem.


# LP Position NFTs

Each liquidity position provides an LP Position NFT, giving liquidity providers full control over their position. This NFT holds ownership of the fees and rewards accumulated within the given price range for the specific pool where liquidity is deposited. These NFTs are transferable, allowing holders to transfer ownership of the position or sell it on a secondary NFT marketplace.

**Why is Liquidity Position Ownership Represented by Tokens or NFTs?**

This approach is used because NFTs can store all the unique data associated with a liquidity position, such as the specific price range, the amount of tokens provided, and the fees accrued.


# LP Farms


# Incentives and gamification


# Exchange

## Introduction

Yuzuswap facilitates seamless swaps on Movement, allowing users to trade tokens in a straightforward and permissionless manner. This guide explains the key aspects of swapping tokens using the Yuzuswap protocol.

## Understanding Swaps on Yuzu

### Basic Swap Mechanism

* **Process**: Users select a token they own and a token they wish to acquire.
* **Execution**: The swap sells owned tokens for the desired tokens, minus the swap fee (awarded to liquidity providers).

### Protocol vs. Web Interface

**Note**: Swapping via web interfaces may introduce additional permission structures and differ in execution behavior from using the Yuzu protocol directly.

### Automated Market Maker (AMM) Model

Swaps on Yuzu are executed against a pool of liquidity, not on a first-in-first-out basis like traditional order book trades.

Liquidity providers earn fees proportional to their capital commitment. Learn more about Fees on Yuzu (link coming).

## Key Considerations in Swapping

### Price Impact

#### **Definition**

Price impact is the change in execution price due to the size of the market order against available liquidity.

#### **AMM Dynamics**

The relative value of assets shifts continuously during a swap, affecting the final execution price.

#### **Liquidity and Price Impact**

The amount of liquidity at different price points influences the price impact. More liquidity equals lower price impact, and vice versa.

#### **Interface Display**

The Yuzu interface provides real-time estimates of price impact and warnings for unusually high impacts.

### Slippage

#### **Definition**

Slippage refers to price changes that occur while a transaction is pending.

#### **Gas Fee and Execution Order**

The amount of gas fee influences the transaction's execution speed. Lower gas fees can lead to longer pending times and potential price changes.

#### **Slippage Tolerance**

Users set a slippage range within which the transaction will execute. Transactions fail if the execution price falls outside this range.

### Additional Token Fees

Some tokens on Yuzuswap may have additional fees. Transactions may fail if the slippage is set too low to cover:

* Price Impact Percentage
* Individual Token Fees (for both X and Y tokens)
* Network Gas Fees

## Safety Checks in the Yuzuswap Protocol

### Common Safety Measures

* **Expired Transaction**: Cancels a swap pending longer than a predetermined deadline to avoid price changes over extended periods.
* **INSUFFICIENT\_OUTPUT\_AMOUNT**: Protects against drastic unfavorable price changes. If the output amount deviates significantly from the estimated amount (beyond slippage tolerance), the swap is canceled.

## Conclusion

By understanding price impact, slippage, and Yuzuswap’s safety checks, users can effectively navigate the swapping process. Remember to account for additional fees and network conditions to ensure successful transactions.

## Support and Assistance

Need help with launching or migrating your token to Yuzu? Connect with us on Twitter or Telegram for assistance.

***

1. Proportional in this instance takes into account many factors, including the relative price of one token in terms of the other, slippage, price impact and other factors related to the open and adversarial nature of Movement. ↩
2. For information about liquidity provision, see the liquidity user guide. ↩
3. The Yuzu interface informs the user about the circumstances of their swap, but it is not guaranteed.↩


# How To Trade

## Introduction

Trading on Yuzu is designed to be straightforward and user-friendly, with a streamlined process that minimizes complexity and automatically handles calculations for you.

## Getting Set Up for Trading

### Requirements

1. **Movement-Compatible Wallet**: Before trading, ensure you have an Movement-compatible wallet. Learn how to get one [here](/general-information/get-started-on-movement).&#x20;
2. **$MOVE Coins**: You'll also need $MOVE coins for trading. Instructions for acquiring $MOVE are available [here](/general-information/get-move-coins).

## Trading Process

### Accessing the Exchange

1. Navigate to the Yuzu exchange here.
2. Unlock your wallet by selecting "Connect" in the top-right corner. If you haven't set up a wallet yet, follow [this guide](/general-information/get-started-on-movement).

### Executing a Trade

1. **Select 'From' Token**: Choose the token you wish to trade from the dropdown in the "From" section. Ensure you have a sufficient balance, which is displayed above the dropdown.
2. **Select 'To' Token**: In the "To" section, choose the token you want to receive. If the token is not added to the supported token list, you can import it by pasting the contract address in the search bar. Enter the amount in the input box, and the corresponding "From" amount will be estimated automatically.
3. **Initiate Swap**: Verify the details and click "Swap".
4. **Confirm Details**: Review the information in the pop-up window and click "Confirm Swap". Your wallet will prompt you for final confirmation.
5. **Completion**: Once confirmed, you can view the transaction on the Movement Explorer.

## Troubleshooting

### Why Isn't My Transaction Going Through?

#### Gas Fees

Ensure you have sufficient $MOVE for gas fees, which fluctuate based on network traffic. Learn more about gas fee here.&#x20;

#### Transaction Fees

Check if the tokens you're swapping have any fees or restrictions. Tokens on Yuzu may include a transaction fee in their contracts for various purposes, such as funding a treasury or rewarding stakers.

### Swapping with Transaction Fees

Research tokens beforehand to understand any transaction fee mechanisms. Adjust your slippage settings to accommodate these fees. For example, a 5% Tax may require a slippage setting of at least 6%-7%.

## Conclusion

By following these steps and being aware of token-specific fees and restrictions, you can enjoy a smooth trading experience on Yuzu. Always stay informed about the tokens you trade to ensure successful transactions.


# Liquidity Pools

## Introduction

Liquidity pools are essential components of the Yuzu platform, allowing users to provide liquidity and earn rewards. This document explains the mechanics of Liquidity Pools and the associated benefits and risks.

## LP Tokens (Liquidity Provider Tokens)

### Definition and Function

LP tokens are issued to users who deposit assets into liquidity pools. They serve as a receipt, representing the user's share in the pool and entitling them to a portion of the trading fees generated.

### Example

> If you deposit $YUZU and $MOVE into a pool, you receive YUZU-MOVE LP tokens, which represent your share in the YUZU-MOVE Liquidity Pool. These tokens can be redeemed to withdraw your original stake and earned interest.

## Earning from Trading Fees

### How it Works

As a liquidity provider, you earn a portion of the trading fees generated from your pool.

In Yuzu, a **0.90**% trading fee is charged on swaps, with **0.30%** of that fee added to the liquidity pool involved in the trade.

### Example

> Consider a pool with 10 LP tokens representing 10 $YUZU and 10 $MOVE each.
>
> * A trade occurs, and the pool's assets grow to 10.030 $YUZU and 10.030 $MOVE.
> * Each LP token's value increases correspondingly.

## Benefits of Providing Liquidity

### Importance for the Exchange

Liquidity is vital for enabling asset swaps on Yuzu. Insufficient liquidity can make swaps difficult, expensive, or impossible.

By providing liquidity, you facilitate trading and earn rewards from trading fees.

### Stability and Sustainability

A robust liquidity pool enhances asset stability and mitigates price impact during trading.

### Earnings Sources for LP Providers

LP providers earn from:

* The **0.3%** trading fee from each pair trade.

### Impermanent Loss

{% hint style="danger" %}
Providing liquidity comes with the risk of impermanent loss, which occurs when the price of your deposited assets changes compared to when you deposited them. This is an important consideration for all potential liquidity providers.
{% endhint %}

\
[“Simply put, impermanent loss is the difference between holding tokens in an AMM and holding them in your wallet.” - Nate Hindman](https://blog.bancor.network/beginners-guide-to-getting-rekt-by-impermanent-loss-7c9510cb2f22)


# How to Add/Remove Liquidity

## Introduction

Liquidity is a key element of decentralized exchanges like Yuzu. This guide provides instructions on how to add and remove liquidity for token pairs on the Yuzu Exchange.

## Adding Liquidity

### Basic Requirements

To add liquidity, you must stake two tokens in a pair. The amount you can add is limited by the lower value of the two tokens in USD.

### Steps to Add Liquidity

1. **Select a Token Pair**: Currently, Yuzu supports adding liquidity for M1 pairs, such as YUZU/MOVE.
2. **Commit Your Tokens**: Decide on the amount of each token you want to stake. Remember, the pair's liquidity limit is set by the lesser value of the two tokens.
3. **Exchange Tokens If Necessary**: If you don't have the required tokens, you can acquire them through trading. Refer to our guide on [How to Trade on Yuzu](/products/exchange/how-to-trade) for assistance.
4. **Navigate to the Liquidity Page**: Access the Liquidity page on Yuzu to begin the process of adding liquidity.
5. **Receive LP Tokens**: Upon adding liquidity, you'll receive LP Tokens, which represent your share in the pool and entitle you to a portion of the trading fees generated from that pair.

## Removing Liquidity

### Process Overview

Removing liquidity involves redeeming your LP Tokens to withdraw your staked assets and any accrued fees.

### Steps to Remove Liquidity

1. **Access Your LP Tokens**: Go to the Liquidity page where your LP Tokens are managed.
2. **Select the Pool**: Choose the liquidity pool you have staked in and wish to withdraw from.
3. **Redeem LP Tokens**: Initiate the process to redeem your LP Tokens. This will return your staked assets along with any earned fees.
4. **Confirm the Transaction**: Verify and confirm the transaction details in your wallet.

## Conclusion

Adding and removing liquidity on Yuzu is a straightforward process. By providing liquidity, you contribute to the exchange's functionality and earn rewards in the form of trading fees. Always ensure you understand the implications, including risks like impermanent loss, before committing your assets to a liquidity pool.


# Token Deployer

## Introduction

Launching tokens on Movement M1 is now accessible to everyone, thanks to Yuzu's Token Deployer Tool. This tool is designed for ease of use, requiring no coding knowledge, making it ideal for teams unfamiliar with the technical complexities of blockchain development.

## Understanding Move

In MOVE, the code data is stored under the code module under the resource account.&#x20;

For [contract upgrades](https://aptos.dev/guides/move-guides/upgrading-move-code/), M1 Move executes the upgrade logic in system module `code.move` where the upgrade policy and compatibility is checked before the code deployment. After compatibility check, the code written in the resource is replaced through a native function call and will execute the new logic.

### Implications of Move's Model

#### **Ownership Control**

The original deployer retains upgrade privileges indefinitely.

#### **Immutability of Ownership**

The owner of the code is fixed post-deployment, making the deployer address the permanent owner.

#### **Token Ownership on M1 tokens**

Contrary to Solidity, token ownership on M1 tokens is determined by the wallet holding the owner modules, which cannot be transferred post-deployment.

***

## Yuzu's Solution

With Yuzu's Token Deployer, the owner modules are sent to the team's wallet upon token creation, allowing them to claim 100% of the token's ownership for further scaling.

By creating a token through the Yuzu Token Deployer, teams can rest assured that their token will work seamless with the Yuzu ecosystem.

* The token is created through Yuzu's own Token Deployer Tool, resulting in the token's modules are published from the team's wallet interacting with the deployer.
* The token is published directly from a wallet owned by the team, resulting that the team controls a wallet with the token's modules.

## Creating Tokens on Movement Made Simple

Our goal is to allow everyone to easily deploy and launch tokens on Movement. Due to Movement's M1 operating with the legacy standard for tokens, it works a bit different than EVM blockchains. Getting started requires some more technical knowledge. We have therefore created a tool that requires **zero coding knowledge**, to let teams launching their own token!

### Issues With Using Other Token Deployers

Typically when creating tokens with tools provided by other protocols, the ownership modules are held back within the smart contracts of the deployers themselves. Tokens are sent to the wallet interacting with the deployers, however they will not receive the full ownership of their token.


# Glossary

## **Price Tick**

The price tick refers to the smallest price movement by which a liquidity range can be adjusted. Yuzu allows liquidity providers (LPs) to define their desired price tick, giving them control over the granularity of their price ranges. This flexibility enables LPs to fine-tune their liquidity strategies to suit market conditions.

## **Price Bin**

A price bin represents a specific segment within the overall price range. LPs can divide the price range into multiple bins, each corresponding to a distinct portion of their liquidity provision. By allocating liquidity across different price bins, LPs can effectively manage their exposure to varying market conditions, optimizing their strategies.

## **Liquidity Fees**

Yuzu incentivizes LPs with liquidity fees, which are generated from trading activity within their specified price ranges. The concentrated liquidity model allows LPs to focus their capital, resulting in the potential for higher fees compared to traditional AMMs. These fees reflect LP contributions to the platform and reward active participation in liquidity provision.

## **Impermanent Loss Mitigation**

Concentrated liquidity on Yuzu aims to minimize impermanent loss, a common challenge for LPs. By enabling LPs to focus their liquidity within a chosen price range, the impact of significant price movements outside that range is reduced. This approach provides a more stable and predictable earning potential for LPs.

## **Customization and Flexibility**

Yuzu offers LPs extensive customization and flexibility in managing their liquidity positions. LPs can adjust their price ranges, price ticks, and price bins to align with their risk preferences and trading goals. This level of control empowers LPs to optimize their liquidity strategies and maximize their earning potential.

Through its concentrated liquidity model, Yuzu transforms the decentralized exchange landscape by providing LPs with greater control, advanced customization options, and enhanced earning potential. By leveraging these features, LPs can refine their strategies and actively contribute to the growth of the Yuzu ecosystem.


# Contacts

## Support

If you're experiencing issues:

* Open a support ticket in the official [Discord community](https://discord.gg/YuzuFinance).
* Reach out to us in the official [Telegram](https://t.me/YuzuFinance) chat.

{% hint style="danger" %}
Admins will NEVER send you a direct message. If anybody approaches you directly on e.g. Telegram pretending to represent customer support, please block them and report as spam.

**NEVER, under any situation, should you ever give someone your private key or recovery phrases. Immediately block and report anyone that asks for them.**
{% endhint %}

## Social Accounts & Communities

Here you'll find a list of Yuzu's official Social media channels and communities.

### [Yuzu on X](https://x.com/YuzuFinance)

### [Move.Fun on X](https://x.com/movedotfun)

### [📰 Blog (Medium)](https://medium.com/@yuzufinance)

### [Discord Community](https://discord.gg/YuzuFinance)

### 💬 Telegram Community

* [🌐 English](https://t.me/YuzuFinance)

## Support and Assistance

Need help? Connect with us on Twitter or Telegram for assistance.


# Brand & Logos

Below is the official brand kit for Yuzu. The kit will be updated and expanded regularly.&#x20;

{% embed url="<https://drive.google.com/drive/folders/1QrBMSO8wioN6VjRQYaMJm4ZCHCqpmxp2?usp=sharing>" %}


# Careers

Are you interested in taking part building the biggest decentralized platform on Movement M1?

If you’re passionate, dedicated and a fan of innovation, we’d love to hear from you!

Connect with us on Twitter or Telegram


# Click Here for Help

If you find yourself stuck, if something isn't working like it's meant to, or you're not sure if something has worked or not, this help section may be able to, well, help.

## Help sections

We have broken the help topic down into sections to help you find what you're after. Below is an overview on what you'll find.

### Troubleshooting Errors

The [Troubleshooting Errors page](#troubleshooting-errors) has a collection of errors users may run into while using Yuzu. It shows the problem with both a solution to the problem, and a reason explaining why the problem happened.

### General FAQ

The [General FAQ page](#general-faq) answers the common questions we get from Yuzu's users. The answers to these questions give advice, an explanation, or a link to a useful resource.

### Other Guides

There will also be a number of guides in the help topic that will walk you through technical problems. We will add guides when a problem that may be difficult to solve comes up often, so if you're having trouble be sure to check here for a guide to your problem.

## Seeking support

Yuzu doesn't have a dedicated support service. Instead, if you find yourself with a problem that has no answer here, you can ask for help in the Telegram Community. For your safety, make sure you read the notice about scams if it's your first time on our Telegram.


# General FAQs

## YUZUSWAP

### Is Yuzu audited?

Yes, Yuzu has undergone an audit conducted by Movebit. The audit report can be accessed at the link given below (Coming after mainnet release):

### Are the Yuzuswap funds secure?

Yes, a multi-signature wallet protects funds such as those in the Treasury. However, Yuzu does not hold users' funds.

## STAKING AND LP FARMING

Yuzu will offer a variety of options to earn.

### What are LP Farms?

### What are liquidity pools?

Liquidity pools are dual-asset pools and help increase liquidity for a specific token pair, resulting in reduced price impact during buying and selling. Explore our available liquidity farming pools by clicking the link below:

### How to add funds to a liquidity pool?

You can follow these steps on our liquidity page:

1. Choose a liquidity pool that you have both tokens for in your wallet.
2. Specify the amount of tokens you wish to add to the farm. Keep in mind that both values must be equal, and this will be calculated automatically.
3. Give approval for the liquidity farming transaction(s).

You can access our liquidity farming pools by clicking on the link provided below:

{% hint style="danger" %}
Investing in LP farms is often incentivized due to the potential risk of impermanent loss.
{% endhint %}

## GENERAL

### What are the recommended wallets for the Movement Chain?

* Razor Wallet
* Petra Wallet
* Pontem Wallet

### How to buy $MOVE coins?

$MOVE coins will be available for purchase on various exchanges. To view a comprehensive list of how to aquire $MOVE, [see our guide here](/general-information/get-move-coins).

## SUPPORT

### Why does my transaction fail?

There are several reasons why your transaction could fail. The following are the most common ones:

* Insufficient $MOVE to cover gas fees.
* The token you want to purchase is not registered in your wallet.

If you need technical support, feel free to contact us via the links to our Telegram or Discord servers.


# Smart Contracts

{% content-ref url="/pages/SGMlXFjsaaAMOXvKJRmo" %}
[Yuzu CLMM](/technical/smart-contracts/yuzu-clmm)
{% endcontent-ref %}

{% content-ref url="/pages/JVd2rV5W1hiHfRpZaul8" %}
[Yuzu AMM (Testnet)](/technical/smart-contracts/yuzu-amm-testnet)
{% endcontent-ref %}

{% content-ref url="/pages/ElcYGouuvvRgIerw1xbK" %}
[Technical](/move.fun/technical)
{% endcontent-ref %}


# Yuzu CLMM

{% content-ref url="/pages/pFJaXy73YKo4W2V16gAp" %}
[Liquidity Pool](/technical/smart-contracts/yuzu-clmm/liquidity-pool)
{% endcontent-ref %}

{% content-ref url="/pages/k2uCIAIf8cedWaPm9dZ3" %}
[Router](/technical/smart-contracts/yuzu-clmm/router)
{% endcontent-ref %}

{% content-ref url="/pages/clbtrUKcO3X5McsAdYTn" %}
[Scripts](/technical/smart-contracts/yuzu-clmm/scripts)
{% endcontent-ref %}


# Liquidity Pool

## Module Info

* **Name**: <mark style="color:red;">`yuzuswap::liquidity_pool`</mark>
* **Description**: This module contains the core logic for the liquidity pool of the <mark style="color:red;">`yuzuswap`</mark> contract. This module only works with fungible assets. If you want to use coins, please check the <mark style="color:red;">`router`</mark> module, which contains functions to work with coins.

## Public Functions

### Swap releated functions

The <mark style="color:red;">`liquidity_pool`</mark> uses the <mark style="color:red;">`"Hot potato"`</mark> pattern for swapping feature.

### Swap Functions

***

Swaps tokens in the liquidity pool. This function returns a <mark style="color:red;">`SwapReciept`</mark> object and requires to pay back in the same transaction to complete (<mark style="color:red;">`"Hot potato"`</mark> pattern).

```
public fun swap(
    trader: &signer,
    pool: Object<LiquidityPool>,
    zero_for_one: bool,
    is_exact_in: bool,
    specified_amount: u64,
    sqrt_price_limit: u128,
): (FungibleAsset, SwapReciept)
```

#### Function arguments

| Argument           | Type     | Description                                                                                                                                           |
| ------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| trade              | \&signer | The trader’s signer.                                                                                                                                  |
| pool               | Object   | The liquidity pool.                                                                                                                                   |
| zero\_for\_one     | bool     | Direction of the swap. <mark style="color:red;">`true`</mark> for token 0 to token 1, <mark style="color:red;">`false`</mark> for token 1 to token 0. |
| is\_exact\_in      | bool     | Whether the specified amount is the exact input amount.                                                                                               |
| specified\_amount  | u64      | The specified amount for the swap.                                                                                                                    |
| sqrt\_price\_limit | u128     | The sqrt price limit for the swap.                                                                                                                    |

#### Returns

| Type          | Description                |
| ------------- | -------------------------- |
| FungibleAsset | The swapped fungible asset |
| SwapReciept   | The swap receipt.          |

#### SwapReciept

```
struct SwapReciept {
    pool: Object<LiquidityPool>,
    token_metadata: Object<Metadata>,
    amount_in: u64,
}
```

| Field           | Type   | Description                                           |
| --------------- | ------ | ----------------------------------------------------- |
| pool            | Object | The liquidity pool of the swap.                       |
| token\_metadata | Object | The metadata of the token in of the swap.             |
| amount\_in      | u64    | The amount of token in needs to be paid for the swap. |

### Get swap receipt amount

***

Gets the amount from a <mark style="color:red;">`SwapReciept`</mark>.

```
public fun get_swap_receipt_amount(swap_receipt: &SwapReciept): u64
```

#### Function arguments

| Argument      | Type          | Description       |
| ------------- | ------------- | ----------------- |
| swap\_receipt | \&SwapReciept | The swap receipt. |

#### Returns

| Type | Description                |
| ---- | -------------------------- |
| u64  | The amount in the receipt. |

### Get swap receipt token metadata

***

Gets the token metadata from a <mark style="color:red;">`SwapReciept`</mark>.

```
public fun get_swap_receipt_token_metadata(swap_receipt: &SwapReciept): Object<Metadata>
```

#### Function arguments

| Argument      | Type          | Description   |
| ------------- | ------------- | ------------- |
| swap\_receipt | \&SwapReciept | \&SwapReciept |

#### Returns

| Type   | Description                        |
| ------ | ---------------------------------- |
| Object | The token metadata in the receipt. |

### Pay swap

***

Pays the swap using the provided token and receipt.

```
public fun pay_swap(
    token_in: FungibleAsset,
    reciept: SwapReciept,
)
```

#### Function arguments

| Argument  | Type          | Description               |
| --------- | ------------- | ------------------------- |
| token\_in | FungibleAsset | The input fungible asset. |
| receipt   | SwapReciept   | The swap receipt.         |

### Quote swap

***

Quotes a swap in the liquidity pool without executing it.

```
public fun quote_swap(
    trader: address,
    pool: Object<LiquidityPool>,
    zero_for_one: bool,
    is_exact_in: bool,
    specified_amount: u64,
    sqrt_price_limit: u128,
): (u64, u64, u64)
```

#### Function arguments

| Argument           | Type    | Description                                                                                                                                           |
| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| trader             | address | The trader’s address.                                                                                                                                 |
| pool               | Object  | The liquidity pool.                                                                                                                                   |
| zero\_for\_one     | bool    | Direction of the swap. <mark style="color:red;">`true`</mark> for token 0 to token 1, <mark style="color:red;">`false`</mark> for token 1 to token 0. |
| is\_exact\_in      | bool    | Whether the specified amount is the exact input amount.                                                                                               |
| specified\_amount  | u64     | The specified amount for the swap.                                                                                                                    |
| sqrt\_price\_limit | u128    | The sqrt price limit for the swap.                                                                                                                    |

#### Returns

| Type | Description                  |
| ---- | ---------------------------- |
| u64  | The amount of token in.      |
| u64  | The amount of token out.     |
| u64  | The fee amount for the swap. |


# Router

## Module info

* **Name**: <mark style="color:red;">`yuzuswap::router`</mark>
* **Description**: This module contains public functions for other modules/contracts to call and interact with the <mark style="color:red;">`yuzuswap`</mark> contract.

## Public Functions

### Create Pool

#### Create pool with two fungible assets

***

Creates a new liquidity pool for two fungible assets. Reverts if the pool already exists.

```
public fun create_pool(
    creator: &signer,
    token_0: Object<Metadata>,
    token_1: Object<Metadata>,
    fee: u64,
    sqrt_price: u128,
)
```

**Function arguments**

| Argument    | Type     | Description                        |
| ----------- | -------- | ---------------------------------- |
| creator     | \&signer | The creator’s signer               |
| token\_0    | Object   | Fungible asset metadata of token 0 |
| token\_1    | Object   | Fungible asset metadata of token 1 |
| fee         | u64      | Fee tier of the pool               |
| sqrt\_price | u128     | Initial sqrt price of the pool     |

### Create pool with one coin and one fungible asset

***

Creates a new liquidity pool with one coin (<mark style="color:red;">`Token0`</mark>) and one fungible asset. Reverts if the pool already exists.

```
public fun create_pool_one_coin<Token0>(
    creator: &signer,
    token_1: Object<Metadata>,
    fee: u64,
    sqrt_price: u128,
)
```

**Function type arguments**

| Argument | Description      |
| -------- | ---------------- |
| Token0   | The coin’s type. |

**Function arguments**

| Argument    | Type     | Description                        |
| ----------- | -------- | ---------------------------------- |
| creator     | \&signer | The creator’s signer               |
| token\_1    | Object   | Fungible asset metadata of token 1 |
| fee         | u64      | Fee tier of the pool               |
| sqrt\_price | u128     | Initial sqrt price of the pool     |

### Create pool with two coins

***

Creates a new liquidity pool with two coins <mark style="color:red;">`Token0`</mark> and <mark style="color:red;">`Token1`</mark>. Reverts if the pool already exists.

```
public fun create_pool_both_coins<Coin0, Coin1>(
    creator: &signer,
    fee: u64,
    sqrt_price: u128,
)
```

**Function type arguments**

| Argument | Description                    |
| -------- | ------------------------------ |
| Coin0    | The coin’s type of the token 0 |
| Coin1    | The coin’s type of the token 1 |

**Function arguments**

| Argument    | Type     | Description                     |
| ----------- | -------- | ------------------------------- |
| creator     | \&signer | The creator’s signer.           |
| fee         | u64      | Fee tier of the pool.           |
| sqrt\_price | u128     | Initial sqrt price of the pool. |

## Add liquidity

### Add liquidity to a pool with two fungible assets

***

Adds liquidity to a pool with two fungible assets.

```
public fun add_liquidity(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    tick_lower: u32,
    tick_upper: u32,
    token_0: FungibleAsset,
    token_1: FungibleAsset,
    amount_0_min: u64,
    amount_1_min: u64,
): (FungibleAsset, FungibleAsset)
```

**Function arguments**

| Argument       | Type          | Description                                                                                                              |
| -------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------ |
| user           | \&signer      | The user’s signer.                                                                                                       |
| pool           | Object        | The liquidity pool to add liquidity to.                                                                                  |
| position\_id   | u64           | The position ID of the liquidity. Leave it as 0 if you want to create a new position or you don’t have any position yet. |
| tick\_lower    | u32           | The lower tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| tick\_upper    | u32           | The upper tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| token\_0       | FungibleAsset | The amount of token 0 to add to the liquidity.                                                                           |
| token\_1       | FungibleAsset | The amount of token 1 to add to the liquidity.                                                                           |
| amount\_0\_min | u64           | The minimum amount of token 0 to add to the liquidity.                                                                   |
| amount\_1\_min | u64           | The minimum amount of token 1 to add to the liquidity.                                                                   |

**Returns**

| Type                           | Description                |
| ------------------------------ | -------------------------- |
| (FungibleAsset, FungibleAsset) | The added fungible assets. |

### Remove liquidity from a pool

***

Removes liquidity from a pool.

```
public fun remove_liquidity(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    liquidity: u128,
    amount_0_min: u64,
    amount_1_min: u64,
): (FungibleAsset, FungibleAsset)
```

**Function arguments**

| Argument       | Type     | Description                                  |
| -------------- | -------- | -------------------------------------------- |
| user           | \&signer | The user’s signer.                           |
| pool           | Object   | The liquidity pool to remove liquidity from. |
| position\_id   | u64      | The position ID of the liquidity.            |
| liquidity      | u128     | The amount of liquidity to remove.           |
| amount\_0\_min | u64      | The minimum amount of token 0 to get.        |
| amount\_1\_min | u64      | The minimum amount of token 1 to get.        |

**Returns**

| Type          | Description                                                           |
| ------------- | --------------------------------------------------------------------- |
| FungibleAsset | The returned fungible assets of the token 0 after removing liquidity. |
| FungibleAsset | The returned fungible assets of the token 1 after removing liquidity. |

### Collect fee

***

Collects fee from a position.

```
public fun collect_fee(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    amount_0_requested: u64,
    amount_1_requested: u64,
): (FungibleAsset, FungibleAsset)
```

**Function arguments**

| Argument             | Type     | Description                      |
| -------------------- | -------- | -------------------------------- |
| user                 | \&signer | The user’s signer.               |
| pool                 | Object   | The liquidity pool.              |
| position\_id         | u64      | The position ID.                 |
| amount\_0\_requested | u64      | The amount of token 0 requested. |
| amount\_1\_requested | u64      | The amount of token 1 requested. |

**Returns**

| Type          | Description                       |
| ------------- | --------------------------------- |
| FungibleAsset | The collected fee of the token 0. |
| FungibleAsset | The collected fee of the token 1. |

### Collect reward

***

Collects reward from a position.

```
public fun collect_reward(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    reward_index: u64,
    amount_requested: u64,
): FungibleAsset
```

**Function arguments**

| Argument          | Type     | Description                     |
| ----------------- | -------- | ------------------------------- |
| user              | \&signer | The user’s signer.              |
| pool              | Object   | The liquidity pool.             |
| position\_id      | u64      | The position ID.                |
| reward\_index     | u64      | The reward index.               |
| amount\_requested | u64      | The amount of reward requested. |

**Returns**

| Type          | Description           |
| ------------- | --------------------- |
| FungibleAsset | The collected reward. |

## Swap functions

### Swap exact fungible asset for fungible asset

***

Swaps an exact amount of fungible asset for another fungible asset.

```
public fun swap_exact_fa_for_fa(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: FungibleAsset,
    amount_out_min: u64,
    sqrt_price_limit: u128,
): FungibleAsset
```

**Function arguments**

| Argument           | Type          | Description                         |
| ------------------ | ------------- | ----------------------------------- |
| trader             | \&signer      | The trader’s signer.                |
| pool               | Object        | The liquidity pool.                 |
| token\_in          | FungibleAsset | The input token.                    |
| amount\_out\_min   | u64           | The minimum amount of output token. |
| sqrt\_price\_limit | u128          | The sqrt price limit.               |

**Returns**

| Type          | Description                 |
| ------------- | --------------------------- |
| FungibleAsset | The swapped fungible asset. |

### Swap exact fungible asset for coin

***

Swaps an exact amount of fungible asset for a coin.

```
public fun swap_exact_fa_for_coin<CoinType>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: FungibleAsset,
    amount_out_min: u64,
    sqrt_price_limit: u128,
): Coin<CoinType>
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument           | Type          | Description                         |
| ------------------ | ------------- | ----------------------------------- |
| trader             | \&signer      | The trader’s signer.                |
| pool               | Object        | The liquidity pool.                 |
| token\_in          | FungibleAsset | The input token.                    |
| amount\_out\_min   | u64           | The minimum amount of output token. |
| sqrt\_price\_limit | u128          | The sqrt price limit.               |

**Returns**

| Type | Description       |
| ---- | ----------------- |
| Coin | The swapped coin. |

### Swap exact coin for fungible asset

***

Swaps an exact amount of coin for a fungible asset.

```
public fun swap_exact_coin_for_fa<CoinType>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: Coin<CoinType>,
    amount_out_min: u64,
    sqrt_price_limit: u128,
): FungibleAsset
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument           | Type     | Description                         |
| ------------------ | -------- | ----------------------------------- |
| trader             | \&signer | The trader’s signer.                |
| pool               | Object   | The liquidity pool.                 |
| token\_in          | Coin     | The input coin.                     |
| amount\_out\_min   | u64      | The minimum amount of output token. |
| sqrt\_price\_limit | u128     | The sqrt price limit.               |

**Returns**

| Type          | Description                 |
| ------------- | --------------------------- |
| FungibleAsset | The swapped fungible asset. |

### Swap exact coin for coin

***

Swaps an exact amount of coin for another coin.

```
public fun swap_exact_coin_for_coin<CoinIn, CoinOut>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: Coin<CoinIn>,
    amount_out_min: u64,
    sqrt_price_limit: u128,
): Coin<CoinOut>
```

**Function type arguments**

| Argument | Description            |
| -------- | ---------------------- |
| CoinIn   | The input coin’s type  |
| CoinOut  | The output coin’s type |

**Function arguments**

| Argument           | Type     | Description                         |
| ------------------ | -------- | ----------------------------------- |
| trader             | \&signer | The trader’s signer.                |
| pool               | Object   | The liquidity pool.                 |
| token\_in          | Coin     | The input coin.                     |
| amount\_out\_min   | u64      | The minimum amount of output token. |
| sqrt\_price\_limit | u128     | The sqrt price limit.               |

**Returns**

| Type | Description       |
| ---- | ----------------- |
| Coin | The swapped coin. |

### Swap fungible asset for exact fungible asset

***

Swaps a fungible asset for an exact amount of another fungible asset.

```
public fun swap_fa_for_exact_fa(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: FungibleAsset,
    amount_out_desired: u64,
    sqrt_price_limit: u128,
): (FungibleAsset, FungibleAsset)
```

**Function arguments**

| Argument             | Type          | Description                         |
| -------------------- | ------------- | ----------------------------------- |
| trader               | \&signer      | The trader’s signer.                |
| pool                 | Object        | The liquidity pool.                 |
| token\_in            | FungibleAsset | The input token.                    |
| amount\_out\_desired | u64           | The desired amount of output token. |
| sqrt\_price\_limit   | u128          | The sqrt price limit.               |

**Returns**

| Type          | Description                                      |
| ------------- | ------------------------------------------------ |
| FungibleAsset | The remaining fungible asset of the input token. |
| FungibleAsset | The swapped fungible asset of the output token.  |

### Swap fungible asset for exact coin

***

Swaps a fungible asset for an exact amount of a coin.

```
public fun swap_fa_for_exact_coin<CoinType>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: FungibleAsset,
    amount_out_desired: u64,
    sqrt_price_limit: u128,
): (FungibleAsset, Coin<CoinType>)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument             | Type          | Description                         |
| -------------------- | ------------- | ----------------------------------- |
| trader               | \&signer      | The trader’s signer.                |
| pool                 | Object        | The liquidity pool.                 |
| token\_in            | FungibleAsset | The input token.                    |
| amount\_out\_desired | u64           | The desired amount of output token. |
| sqrt\_price\_limit   | u128          | The sqrt price limit.               |

**Returns**

| Type          | Description                                      |
| ------------- | ------------------------------------------------ |
| FungibleAsset | The remaining fungible asset of the input token. |
| Coin          | The swapped coin of the output token.            |

### Swap coin for exact fungible asset

***

Swaps a coin for an exact amount of a fungible asset.

```
public fun swap_coin_for_exact_fa<CoinType>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: Coin<CoinType>,
    amount_out_desired: u64,
    sqrt_price_limit: u128,
): (Coin<CoinType>, FungibleAsset)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument             | Type     | Description                         |
| -------------------- | -------- | ----------------------------------- |
| trader               | \&signer | The trader’s signer.                |
| pool                 | Object   | The liquidity pool.                 |
| token\_in            | Coin     | The input coin.                     |
| amount\_out\_desired | u64      | The desired amount of output token. |
| sqrt\_price\_limit   | u128     | The sqrt price limit.               |

**Returns**

| Type          | Description                                     |
| ------------- | ----------------------------------------------- |
| Coin          | The remaining coin of the input token.          |
| FungibleAsset | The swapped fungible asset of the output token. |

### Swap coin for exact coin

***

Swaps a coin for an exact amount of another coin.

```
public fun swap_coin_for_exact_coin<CoinIn, CoinOut>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: Coin<CoinIn>,
    amount_out_desired: u64,
    sqrt_price_limit: u128,
): (Coin<CoinIn>, Coin<CoinOut>)
```

**Function type arguments**

| Argument | Description            |
| -------- | ---------------------- |
| CoinIn   | The input coin’s type  |
| CoinOut  | The output coin’s type |

**Function arguments**

| Argument             | Type     | Description                         |
| -------------------- | -------- | ----------------------------------- |
| trader               | \&signer | The trader’s signer.                |
| pool                 | Object   | The liquidity pool.                 |
| token\_in            | Coin     | The input coin.                     |
| amount\_out\_desired | u64      | The desired amount of output token. |
| sqrt\_price\_limit   | u128     | The sqrt price limit.               |

**Returns**

| Type | Description                            |
| ---- | -------------------------------------- |
| Coin | The remaining coin of the input token. |
| Coin | The swapped coin of the output token.  |

### Swap exact fungible asset for fungible asset with multiple hops

***

Swaps an exact amount of fungible asset for another fungible asset with multiple hops.

```
public fun swap_exact_fa_for_fa_multi_hops(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    token_in: FungibleAsset,
    amount_out_min: u64,
): FungibleAsset
```

**Function arguments**

| Argument         | Type            | Description                         |
| ---------------- | --------------- | ----------------------------------- |
| trader           | \&signer        | The trader’s signer.                |
| pools            | vector\<Object> | The liquidity pools.                |
| token\_in        | FungibleAsset   | The input token.                    |
| amount\_out\_min | u64             | The minimum amount of output token. |

**Returns**

| Type          | Description                 |
| ------------- | --------------------------- |
| FungibleAsset | The swapped fungible asset. |

### Swap exact coin for fungible asset with multiple hops

***

Swaps an exact amount of coin for a fungible asset with multiple hops.

```
public fun swap_exact_coin_for_fa_multi_hops<CoinType>(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    token_in: Coin<CoinType>,
    amount_out_min: u64,
): FungibleAsset
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument         | Type            | Description                         |
| ---------------- | --------------- | ----------------------------------- |
| trader           | \&signer        | The trader’s signer.                |
| pools            | vector\<Object> | The liquidity pools.                |
| token\_in        | Coin            | The input coin.                     |
| amount\_out\_min | u64             | The minimum amount of output token. |

**Returns**

| Type          | Description                 |
| ------------- | --------------------------- |
| FungibleAsset | The swapped fungible asset. |

### Swap fungible asset for exact fungible asset with multiple hops

***

Swaps a fungible asset for an exact amount of another fungible asset with multiple hops.

```
public fun swap_fa_for_exact_fa_multi_hops(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    token_in: FungibleAsset,
    amount_out_desired: u64,
): (FungibleAsset, FungibleAsset)
```

**Function arguments**

| Argument             | Type            | Description                         |
| -------------------- | --------------- | ----------------------------------- |
| trader               | \&signer        | The trader’s signer.                |
| pools                | vector\<Object> | The liquidity pools.                |
| token\_in            | FungibleAsset   | The input token.                    |
| amount\_out\_desired | u64             | The desired amount of output token. |
| sqrt\_price\_limit   | u128            | The sqrt price limit.               |

**Returns**

| Type          | Description                                      |
| ------------- | ------------------------------------------------ |
| FungibleAsset | The remaining fungible asset of the input token. |
| FungibleAsset | The swapped fungible asset of the output token.  |

### Swap coin for exact fungible asset with multiple hops

***

Swaps a coin for an exact amount of a fungible asset with multiple hops.

```
public fun swap_coin_for_exact_fa_multi_hops<CoinType>(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    token_in: Coin<CoinType>,
    amount_out_desired: u64,
): (Coin<CoinType>, FungibleAsset)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument             | Type            | Description                         |
| -------------------- | --------------- | ----------------------------------- |
| trader               | \&signer        | The trader’s signer.                |
| pools                | vector\<Object> | The liquidity pools.                |
| token\_in            | Coin            | The input coin.                     |
| amount\_out\_desired | u64             | The desired amount of output token. |

**Returns**

| Type          | Description                                     |
| ------------- | ----------------------------------------------- |
| Coin          | The remaining coin of the input token.          |
| FungibleAsset | The swapped fungible asset of the output token. |

## Get pool functions

### Get pool

***

Gets the liquidity pool for two fungible assets.

```
#[view]
public fun get_pool(
    token_0: Object<Metadata>,
    token_1: Object<Metadata>,
    fee: u64,
): Object<LiquidityPool>
```

**Function arguments**

| Argument | Type   | Description                        |
| -------- | ------ | ---------------------------------- |
| token\_0 | Object | Fungible asset metadata of token 0 |
| token\_1 | Object | Fungible asset metadata of token 1 |
| fee      | u64    | Fee tier of the pool               |

**Returns**

| Type   | Description         |
| ------ | ------------------- |
| Object | The liquidity pool. |

### Get pool with one coin and one fungible asset

***

Gets the liquidity pool for one coin (<mark style="color:red;">`CoinType`</mark>) and one fungible asset.

```
#[view]
public fun get_pool_one_coin<CoinType>(
    token_1: Object<Metadata>,
    fee: u64,
): Object<LiquidityPool>
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument | Type   | Description                        |
| -------- | ------ | ---------------------------------- |
| token\_1 | Object | Fungible asset metadata of token 1 |
| fee      | u64    | Fee tier of the pool               |

**Returns**

| Type   | Description         |
| ------ | ------------------- |
| Object | The liquidity pool. |

### Get pool with two coins

***

Gets the liquidity pool for two coins <mark style="color:red;">`Coin0`</mark> and <mark style="color:red;">`Coin1`</mark>.

```
#[view]
public fun get_pool_both_coins<Coin0, Coin1>(
    fee: u64,
): Object<LiquidityPool>
```

**Function type arguments**

| Argument | Description                    |
| -------- | ------------------------------ |
| Coin0    | The coin’s type of the token 0 |
| Coin1    | The coin’s type of the token 1 |

**Function arguments**

| Argument | Type | Description          |
| -------- | ---- | -------------------- |
| fee      | u64  | Fee tier of the pool |

**Returns**

| Type   | Description         |
| ------ | ------------------- |
| Object | The liquidity pool. |


# Scripts

## Module info

* **Name**: <mark style="color:red;">`yuzuswap::scripts`</mark>
* **Description**: This module contains entry functions for users to call and interact with the <mark style="color:red;">`yuzuswap`</mark> contract.

## Public Functions

## Create Pool

### Create pool with two fungible assets

***

Creates a new liquidity pool for two fungible assets. Reverts if the pool already exists.

```
public entry fun create_pool(
    creator: &signer,
    token_0: Object<Metadata>,
    token_1: Object<Metadata>,
    fee: u64,
    sqrt_price: u128,****
)
```

**Function arguments**

| Argument    | Type     | Description                        |
| ----------- | -------- | ---------------------------------- |
| sender      | \&signer | The sender’s signer                |
| token\_0    | Object   | Fungible asset metadata of token 0 |
| token\_1    | Object   | Fungible asset metadata of token 1 |
| fee         | u64      | Fee tier of the pool               |
| sqrt\_price | u128     | Initial sqrt price of the pool     |

### Create pool with one coin and one fungible asset

***

Creates a new liquidity pool with one coin (<mark style="color:red;">`Token0`</mark>) and one fungible asset. Reverts if the pool already exists.

```
public entry fun create_pool_one_coin<Token0>(
    creator: &signer,
    token_1: Object<Metadata>,
    fee: u64,
    sqrt_price: u128,
)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| Token0   | The coin’s type |

**Function arguments**

| Argument    | Type     | Description                        |
| ----------- | -------- | ---------------------------------- |
| sender      | \&signer | The sender’s signer                |
| token\_1    | Object   | Fungible asset metadata of token 1 |
| fee         | u64      | Fee tier of the pool               |
| sqrt\_price | u128     | Initial sqrt price of the pool     |

### Create pool with two coins

***

Creates a new liquidity pool with two coins <mark style="color:red;">`Token0`</mark> and <mark style="color:red;">`Token1`</mark>. Reverts if the pool already exists.

```
public entry fun create_pool_both_coins<Coin0, Coin1>(
    creator: &signer,
    fee: u64,
    sqrt_price: u128,
)
```

**Function type arguments**

| Argument | Description                    |
| -------- | ------------------------------ |
| Token1   | The coin’s type of the token 0 |
| Token0   | The coin’s type of the token 1 |

**Function arguments**

| Argument    | Type     | Description                    |
| ----------- | -------- | ------------------------------ |
| sender      | \&signer | The sender’s signer            |
| fee         | u64      | Fee tier of the pool           |
| sqrt\_price | u128     | Initial sqrt price of the pool |

## Add liquidity

### Add liquidity to a pool with two fungible assets

***

Adds liquidity to a pool with two fungible assets.

```
public entry fun add_liquidity(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    tick_lower: u32,
    tick_upper: u32,
    amount_0: u64,
    amount_1: u64,
    amount_0_min: u64,
    amount_1_min: u64,
)
```

**Function arguments**

| Argument       | Type     | Description                                                                                                              |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
| user           | \&signer | The user’s signer.                                                                                                       |
| pool           | Object   | The liquidity pool to add liquidity to.                                                                                  |
| position\_id   | u64      | The position ID of the liquidity. Leave it as 0 if you want to create a new position or you don’t have any position yet. |
| tick\_lower    | u32      | The lower tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| tick\_upper    | u32      | The upper tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| amount\_0      | u64      | The amount of token 0 to add to the liquidity.                                                                           |
| amount\_1      | u64      | The amount of token 1 to add to the liquidity.                                                                           |
| amount\_0\_min | u64      | The minimum amount of token 0 to add to the liquidity.                                                                   |
| amount\_1\_min | u64      | The minimum amount of token 1 to add to the liquidity.                                                                   |

### Add liquidity to a pool with one coin and one fungible asset

***

Adds liquidity to a pool with one coin and one fungible asset.

```
public entry fun add_liquidity_one_coin<CoinType>(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    tick_lower: u32,
    tick_upper: u32,
    amount_0: u64,
    amount_1: u64,
    amount_0_min: u64,
    amount_1_min: u64,
)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument       | Type     | Description                                                                                                              |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
| user           | \&signer | The user’s signer.                                                                                                       |
| pool           | Object   | The liquidity pool to add liquidity to.                                                                                  |
| position\_id   | u64      | The position ID of the liquidity. Leave it as 0 if you want to create a new position or you don’t have any position yet. |
| tick\_lower    | u32      | The lower tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| tick\_upper    | u32      | The upper tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| amount\_0      | u64      | The amount of token 0 to add to the liquidity.                                                                           |
| amount\_1      | u64      | The amount of token 1 to add to the liquidity.                                                                           |
| amount\_0\_min | u64      | The minimum amount of token 0 to add to the liquidity.                                                                   |
| amount\_1\_min | u64      | The minimum amount of token 1 to add to the liquidity.                                                                   |

### Add liquidity to a pool with two coins

***

Adds liquidity to a pool with two coins.

```
public entry fun add_liquidity_both_coins<Coin0, Coin1>(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    tick_lower: u32,
    tick_upper: u32,
    amount_0: u64,
    amount_1: u64,
    amount_0_min: u64,
    amount_1_min: u64,
)
```

**Function type arguments**

| Argument | Description                    |
| -------- | ------------------------------ |
| Coin0    | The coin’s type of the token 0 |
| Coin1    | The coin’s type of the token 1 |

**Function arguments**

| Argument       | Type     | Description                                                                                                              |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
| user           | \&signer | The user’s signer.                                                                                                       |
| pool           | Object   | The liquidity pool to add liquidity to.                                                                                  |
| position\_id   | u64      | The position ID of the liquidity. Leave it as 0 if you want to create a new position or you don’t have any position yet. |
| tick\_lower    | u32      | The lower tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| tick\_upper    | u32      | The upper tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.              |
| amount\_0      | u64      | The amount of token 0 to add to the liquidity.                                                                           |
| amount\_1      | u64      | The amount of token 1 to add to the liquidity.                                                                           |
| amount\_0\_min | u64      | The minimum amount of token 0 to add to the liquidity.                                                                   |
| amount\_1\_min | u64      | The minimum amount of token 1 to add to the liquidity.                                                                   |

## Remove liquidity |

### Remove liquidity from a pool

***

Removes liquidity from a pool.

```
public entry fun remove_liquidity(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    liquidity: u128,
    amount_0_min: u64,
    amount_1_min: u64,
)
```

**Function arguments**

| Argument       | Type     | Description                                  |
| -------------- | -------- | -------------------------------------------- |
| user           | \&signer | The user’s signer.                           |
| pool           | Object   | The liquidity pool to remove liquidity from. |
| position\_id   | u64      | The position ID of the liquidity.            |
| liquidity      | u128     | The amount of liquidity to remove.           |
| amount\_0\_min | u64      | The minimum amount of token 0 to get.        |
| amount\_1\_min | u64      | The minimum amount of token 1 to get.        |

### Burn position

***

Burns a position.

```
public entry fun burn_position(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
)
```

**Function arguments**

| Argument     | Type     | Description              |
| ------------ | -------- | ------------------------ |
| user         | \&signer | The user’s signer.       |
| pool         | Object   | The liquidity pool.      |
| position\_id | u64      | The position ID to burn. |

### Collect fee

***

Collects fee from a position.

```
public entry fun collect_fee(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    amount_0_requested: u64,
    amount_1_requested: u64,
    recipient: address,
)
```

**Function arguments**

| Argument             | Type     | Description                      |
| -------------------- | -------- | -------------------------------- |
| user                 | \&signer | The user’s signer.               |
| pool                 | Object   | The liquidity pool.              |
| position\_id         | u64      | The position ID.                 |
| amount\_0\_requested | u64      | The amount of token 0 requested. |
| amount\_1\_requested | u64      | The amount of token 1 requested. |
| recipient            | address  | The recipient address.           |

### Collect reward

***

Collects reward from a position.

```
public entry fun collect_reward(
    user: &signer,
    pool: Object<LiquidityPool>,
    position_id: u64,
    reward_index: u64,
    amount_requested: u64,
    recipient: address,
)
```

**Function arguments**

| Argument          | Type     | Description                     |
| ----------------- | -------- | ------------------------------- |
| user              | \&signer | The user’s signer.              |
| pool              | Object   | The liquidity pool.             |
| position\_id      | u64      | The position ID.                |
| reward\_index     | u64      | The reward index.               |
| amount\_requested | u64      | The amount of reward requested. |
| recipient         | address  | The recipient address.          |

## Swap functions

### Swap exact fungible asset for fungible asset

***

Swaps an exact amount of fungible asset for another fungible asset.

```
public entry fun swap_exact_fa_for_fa(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: Object<Metadata>,
    amount_in: u64,
    amount_out_min: u64,
    sqrt_price_limit: u128,
    recipient: address,
)
```

**Function arguments**

| Argument           | Type     | Description                         |
| ------------------ | -------- | ----------------------------------- |
| trader             | \&signer | The trader’s signer.                |
| pool               | Object   | The liquidity pool.                 |
| token\_in          | Object   | The input token metadata.           |
| amount\_in         | u64      | The amount of input token.          |
| amount\_out\_min   | u64      | The minimum amount of output token. |
| sqrt\_price\_limit | u128     | The sqrt price limit.               |
| recipient          | address  | The recipient address.              |

### Swap exact coin for fungible asset

***

Swaps an exact amount of coin for a fungible asset.

```
public entry fun swap_exact_coin_for_fa<CoinType>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    amount_in: u64,
    amount_out_min: u64,
    sqrt_price_limit: u128,
    recipient: address,
)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument           | Type     | Description                         |
| ------------------ | -------- | ----------------------------------- |
| trader             | \&signer | The trader’s signer.                |
| pool               | Object   | The liquidity pool.                 |
| amount\_in         | u64      | The amount of input coin.           |
| amount\_out\_min   | u64      | The minimum amount of output token. |
| sqrt\_price\_limit | u128     | The sqrt price limit.               |
| recipient          | address  | The recipient address.              |

### Swap fungible asset for exact fungible asset

***

Swaps a fungible asset for an exact amount of another fungible asset.

```
public entry fun swap_fa_for_exact_fa(
    trader: &signer,
    pool: Object<LiquidityPool>,
    token_in: Object<Metadata>,
    amount_in: u64,
    amount_out_min: u64,
    sqrt_price_limit: u128,
    recipient: address,
)
```

**Function arguments**

| Argument           | Type     | Description                         |
| ------------------ | -------- | ----------------------------------- |
| trader             | \&signer | The trader’s signer.                |
| pool               | Object   | The liquidity pool.                 |
| token\_in          | Object   | The input token metadata.           |
| amount\_in         | u64      | The amount of input token.          |
| amount\_out\_min   | u64      | The minimum amount of output token. |
| sqrt\_price\_limit | u128     | The sqrt price limit.               |
| recipient          | address  | The recipient address.              |

### Swap coin for exact fungible asset

***

Swaps a coin for an exact amount of a fungible asset.

```
public entry fun swap_coin_for_exact_fa<CoinType>(
    trader: &signer,
    pool: Object<LiquidityPool>,
    amount_in: u64,
    amount_out_min: u64,
    sqrt_price_limit: u128,
    recipient: address,
)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument           | Type     | Description                         |
| ------------------ | -------- | ----------------------------------- |
| trader             | \&signer | The trader’s signer.                |
| pool               | Object   | The liquidity pool.                 |
| amount\_in         | u64      | The amount of input coin.           |
| amount\_out\_min   | u64      | The minimum amount of output token. |
| sqrt\_price\_limit | u128     | The sqrt price limit.               |
| recipient          | address  | The recipient address.              |

### Swap exact fungible asset for fungible asset with multiple hops

***

Swaps an exact amount of fungible asset for another fungible asset with multiple hops.

```
public entry fun swap_exact_fa_for_fa_multi_hops(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    token_in: Object<Metadata>,
    amount_in: u64,
    amount_out_min: u64,
    recipient: address,
)
```

**Function arguments**

| Argument         | Type            | Description                         |
| ---------------- | --------------- | ----------------------------------- |
| trader           | \&signer        | The trader’s signer.                |
| pools            | vector\<Object> | The liquidity pools.                |
| token\_in        | Object          | The input token metadata.           |
| amount\_in       | u64             | The amount of input token.          |
| amount\_out\_min | u64             | The minimum amount of output token. |
| recipient        | address         | The recipient address.              |

### Swap exact coin for fungible asset with multiple hops

***

Swaps an exact amount of coin for a fungible asset with multiple hops.

```
public entry fun swap_exact_coin_for_fa_multi_hops<CoinType>(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    amount_in: u64,
    amount_out_min: u64,
    recipient: address,
)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument         | Type            | Description                         |
| ---------------- | --------------- | ----------------------------------- |
| trader           | \&signer        | The trader’s signer.                |
| pools            | vector\<Object> | The liquidity pools.                |
| amount\_in       | u64             | The amount of input coin.           |
| amount\_out\_min | u64             | The minimum amount of output token. |
| recipient        | address         | The recipient address.              |

### Swap fungible asset for exact fungible asset with multiple hops

***

Swaps a fungible asset for an exact amount of another fungible asset with multiple hops.

```
public entry fun swap_fa_for_exact_fa_multi_hops(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    token_in: Object<Metadata>,
    amount_in_max: u64,
    amount_out_desired: u64,
    recipient: address,
)
```

**Function arguments**

| Argument             | Type            | Description                         |
| -------------------- | --------------- | ----------------------------------- |
| trader               | \&signer        | The trader’s signer.                |
| pools                | vector\<Object> | The liquidity pools.                |
| token\_in            | Object          | The input token metadata.           |
| amount\_in\_max      | u64             | The maximum amount of input token.  |
| amount\_out\_desired | u64             | The desired amount of output token. |
| recipient            | address         | The recipient address.              |

### Swap coin for exact fungible asset with multiple hops

***

Swaps a coin for an exact amount of a fungible asset with multiple hops.

```
public entry fun swap_coin_for_exact_fa_multi_hops<CoinType>(
    trader: &signer,
    pools: vector<Object<LiquidityPool>>,
    amount_in_max: u64,
    amount_out_desired: u64,
    recipient: address,
)
```

**Function type arguments**

| Argument | Description     |
| -------- | --------------- |
| CoinType | The coin’s type |

**Function arguments**

| Argument             | Type            | Description                         |
| -------------------- | --------------- | ----------------------------------- |
| trader               | \&signer        | The trader’s signer.                |
| pools                | vector\<Object> | The liquidity pools.                |
| amount\_in\_max      | u64             | The maximum amount of input coin.   |
| amount\_out\_desired | u64             | The desired amount of output token. |
| recipient            | address         | The recipient address.              |


# Example Usage


# Liquidity Pool

**Extract key attributes of a position**

This function is used to extract key attributes of a position.

```
public fun extract_core_position(
    position: &Position,
): (u64, u32, u32, u128, u256, u256, u64, u64)
```

**Function arguments**

| Argument | Type       | Description                                    |
| -------- | ---------- | ---------------------------------------------- |
| position | \&Position | The current position to extract detailed data. |

**Returns**

| Type   | Description                          |
| ------ | ------------------------------------ |
| `u64`  | Position identifier                  |
| `u32`  | Lower tick boundary                  |
| `u32`  | Upper tick boundary                  |
| `u128` | Liquidity value                      |
| `u256` | Fee growth inside for token 0        |
| `u256` | Fee growth inside for token 1        |
| `u64`  | Pending fees for position in token 0 |
| `u64`  | Pending fees for position in token 1 |

**Extract position rewards**

This function is used to extract all reward information associated with the given position.

```
public fun extract_position_rewards(
    position: &Position,
): vector<PositionRewardInfo>
```

**Function arguments**

| Argument   | Type        | Description                                                         |
| ---------- | ----------- | ------------------------------------------------------------------- |
| `position` | `&Position` | A reference to the position from which reward details are retrieved |

**Returns**

| Type                         | Description                                                        |
| ---------------------------- | ------------------------------------------------------------------ |
| `vector<PositionRewardInfo>` | A vector containing all reward information records of the position |

**Extract reward info of a position**

This function is used to extract the detailed reward data from a position reward information.

```
public fun extract_reward_info(
    reward_info: &PositionRewardInfo,
): (u256, u64)
```

**Function arguments**

| Argument      | Type                  | Description                                                    |
| ------------- | --------------------- | -------------------------------------------------------------- |
| `reward_info` | `&PositionRewardInfo` | A reference to the reward info record to extract detailed data |

**Returns**

| Type   | Description                   |
| ------ | ----------------------------- |
| `u256` | The reward growth accumulated |
| `u64`  | The pending reward amount     |


# Position NFT Manager Module

* **Name**: `yuzuswap::position_nft_manager`
* **Description**: This module provides functions to work with liquidity positions.

### Public Functions

#### Get positions info

Get info of positions with pending fees and pending rewards.

```
#[view]
public fun get_positions(
    pool_addresses: vector<address>,
    position_ids: vector<u64>,
): vector<Option<Position>>
```

**Parameters**

| Name             | Type              | Description                                                                                                                                                              |
| ---------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `pool_addresses` | `vector<address>` | A list of pool addresses to retrieve position information based on the position IDs vector. The length of `pool_addresses` must be equal to the length of `position_ids` |
|                  |                   |                                                                                                                                                                          |
| `position_ids`   | `vector<u64>`     | List of position IDs to query                                                                                                                                            |

**Returns**

| Type                       | Description                                                                                                                |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `vector<Option<Position>>` | List of position information, where each element is either `Some(Position)` if the position exists or `None` if it doesn't |

#### Get position token amounts

Returns the amounts of tokens held in a specific position.

```
#[view]
public fun get_position_token_amounts(
    pool: Object<LiquidityPool>,
    position_id: u64,
): (u64, u64) acquires ResourceSignerCap
```

**Parameters**

| Name          | Type                    | Description                            |
| ------------- | ----------------------- | -------------------------------------- |
| `pool`        | `Object<LiquidityPool>` | The Liquidity Pool object              |
| `position_id` | `u64`                   | The unique identifier for the position |

**Returns**

| Type         | Description                                                           |
| ------------ | --------------------------------------------------------------------- |
| `(u64, u64)` | A tuple containing the amounts of token 0 and token 1 in the position |


# Tick Math Module

* **Name**: `yuzuswap::tick_math`
* **Description**: This module provides functions to work with ticks and their corresponding square root prices. In YuzuSwap, the square root price is represented in a fixed-point format 48x80, using a `u128` number.

### Sqrt Price Formula

To compute the client-side square root price (`sqrt_price_x80`), use the following formula:

`sqrt_price_x80 = floor(sqrt(price) * 2^80)`

For example, if the price is 1.5, then:

`sqrt_price_x80 = floor(sqrt(1.5) * 2^80) = 1480625697465890259337216`

### Public Functions

#### Calculate Tick from Square Root Price

Calculates the tick value corresponding to a given square root price.

```
public fun get_tick_at_sqrt_price(sqrt_price: u128): u32
```

**Function Parameters**

| Parameter    | Type   | Description                                        |
| ------------ | ------ | -------------------------------------------------- |
| `sqrt_price` | `u128` | The square root price in fixed-point format 48x80. |

**Return Value**

| Type  | Description                                            |
| ----- | ------------------------------------------------------ |
| `u32` | The tick value corresponding to the given sqrt\_price. |


# Sqrt Price Limit

Controlling Slippage in CLMM Swaps

In a **Concentrated Liquidity Market Maker (CLMM)**, the `sqrt_price_limit` parameter is used to define a price boundary for a swap — effectively acting as a **slippage protection mechanism**. Depending on the direction of your trade (i.e., which token you're selling vs. buying), you must use either a `min_sqrt_price_limit` or `max_sqrt_price_limit`.

**Determining Token Order**

Each CLMM pool defines a `token0` and a `token1`.\
You can identify the token order by using the `get_pool_view` function.

***

#### Swap Direction and Price Limits

| Trade Direction   | Use Limit              | Description                                                                          |
| ----------------- | ---------------------- | ------------------------------------------------------------------------------------ |
| `token0 → token1` | `min_sqrt_price_limit` | Sets a lower bound on the price to prevent excessive slippage when selling `token0`  |
| `token1 → token0` | `max_sqrt_price_limit` | Sets an upper bound on the price to prevent excessive slippage when selling `token1` |

**Example:**

If the pool consists of:

* `token0` = USDC
* `token1` = MOVE

Then:

* **Swapping USDC → MOVE**: Use `MIN_SQRT_PRICE`
* **Swapping MOVE → USDC**: Use `MAX_SQRT_PRICE`

***

#### Constants

```ts
export const MIN_SQRT_PRICE = "281480266797392";
export const MAX_SQRT_PRICE = "5192199275492655220258463701383891";
```

Use these constants to safely bound the swap and avoid undesired price execution due to rapid pool movement or low liquidity conditions.


# Yuzu AMM (Testnet)


# Router

{% hint style="warning" %}
Movemement testnet is unstable by the time of writing and using the contracts below are for testing and development purposes only
{% endhint %}

## **Contract Info**

* **Contract Name**: `yuzu::router`
* **Contract Address**: \[tba]
* **Admin Multi Sig**: \[tba]

### Public Functions

***

#### **Create Pair**

Creates a new liquidity pair for tokens X and Y. Reverts if the pair already exists.

```move
public entry fun create_pair<X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Register Fee On Transfer in Pair**

Adds fee-on-transfer functionality to a token pair (only callable by token owners).

```move
public entry fun register_fee_on_transfer_in_a_pair<CoinType, X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Stake Tokens in Pool**

Deposit tokens into the staking pool for a liquidity pair.

```move
public entry fun stake_tokens_in_pool<X, Y>(sender: &signer, amount: u64)
```

| Input Values | Type   | Description                    |
| ------------ | ------ | ------------------------------ |
| sender       | signer | The sender's signer.           |
| amount       | u64    | The amount of tokens to stake. |

***

#### **Unstake Tokens from Pool**

Withdraw tokens from the staking pool for a liquidity pair.

```move
public entry fun unstake_tokens_from_pool<X, Y>(sender: &signer, amount: u64)
```

| Input Values | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| sender       | signer | The sender's signer.              |
| amount       | u64    | The amount of tokens to withdraw. |

***

#### **Claim Rewards from Pool**

Claim staking rewards from the rewards pool.

```move
public entry fun claim_rewards_from_pool<X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Add Liquidity**

Add liquidity to a pair or create the pair if it doesn't exist.

```move
public entry fun add_liquidity<X, Y>(sender: &signer, amount_x_desired: u64, amount_y_desired: u64, amount_x_min: u64, amount_y_min: u64)
```

| Input Values       | Type   | Description                           |
| ------------------ | ------ | ------------------------------------- |
| sender             | signer | The sender's signer.                  |
| amount\_x\_desired | u64    | The amount of token X desired.        |
| amount\_y\_desired | u64    | The amount of token Y desired.        |
| amount\_x\_min     | u64    | The minimum amount of token X to add. |
| amount\_y\_min     | u64    | The minimum amount of token Y to add. |

***

#### **Remove Liquidity**

Remove liquidity from a pair.

```move
public entry fun remove_liquidity<X, Y>(sender: &signer, liquidity: u64, amount_x_min: u64, amount_y_min: u64)
```

| Input Values   | Type   | Description                               |
| -------------- | ------ | ----------------------------------------- |
| sender         | signer | The sender's signer.                      |
| liquidity      | u64    | The amount of liquidity to remove.        |
| amount\_x\_min | u64    | The minimum amount of token X to receive. |
| amount\_y\_min | u64    | The minimum amount of token Y to receive. |

***

#### **Swap Exact Input**

Swap an exact input amount of token X for the maximum possible amount of token Y.

```move
public entry fun swap_exact_input<X, Y>(sender: &signer, x_in: u64, y_min_out: u64)
```

| Input Values | Type   | Description                               |
| ------------ | ------ | ----------------------------------------- |
| sender       | signer | The sender's signer.                      |
| x\_in        | u64    | The exact amount of token X to swap.      |
| y\_min\_out  | u64    | The minimum amount of token Y to receive. |

***

#### **Swap Exact Output**

Swap the minimum possible amount of token X to receive an exact output amount of token Y.

```move
public entry fun swap_exact_output<X, Y>(sender: &signer, y_out: u64, x_max_in: u64)
```

| Input Values | Type   | Description                             |
| ------------ | ------ | --------------------------------------- |
| sender       | signer | The sender's signer.                    |
| y\_out       | u64    | The exact amount of token Y to receive. |
| x\_max\_in   | u64    | The maximum amount of token X to swap.  |

***

#### **Multi-Hop Exact Input**

Swap token X for token Y through an intermediate token Z.

```move
public entry fun swap_exact_input_with_one_intermediate_coin<X, Y, Z>(sender: &signer, x_in: u64, y_min_out: u64)
```

| Input Values | Type   | Description                               |
| ------------ | ------ | ----------------------------------------- |
| sender       | signer | The sender's signer.                      |
| x\_in        | u64    | The exact amount of token X to swap.      |
| y\_min\_out  | u64    | The minimum amount of token Y to receive. |

***

#### **Register LP**

Register the LP token for a pair to the sender's account.

```move
public entry fun register_lp<X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Update Fee Tier**

Update the fee tier for a liquidity pair.

```move
public entry fun update_fee_tier<Tier, X, Y>(signer_ref: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| signer\_ref  | signer | The sender's signer. |


# Aggregator Integration

To integrate YuzuSwap with your aggregator, use the following public functions for swap calculations.

### Get Amount In

`router::get_amount_in`

#### **Description**

This function calculates the required input amount of token **X** to receive a specific output amount of token **Y**.

#### **Usage**

* **Checks**: Ensures that a pair exists between token **X** and token **Y** before proceeding.
* **Returns**: The amount of token **X** required for the swap.

#### **Parameters**

| Input Value    | Type  | Description                               |
| -------------- | ----- | ----------------------------------------- |
| `y_out_amount` | `u64` | The desired output amount of token **Y**. |

#### **Code**

```move
public fun get_amount_in<X, Y>(y_out_amount: u64): u64 {
    assert!(swap::is_pair_created<X, Y>(), errors::pair_not_created());
    let is_x_to_y = swap_utils::sort_token_type<X, Y>();
    get_amount_in_internal<X, Y>(is_x_to_y, y_out_amount)
}
```

***

### Get Amount Out

`router::get_amount_out`

#### **Description**

This function calculates the output amount of token **Y** given an input amount of token **X**.

#### **Usage**

* **Checks**: Ensures that a pair exists between token **X** and token **Y** before proceeding.
* **Returns**: The amount of token **Y** that will be received for the swap.

#### **Parameters**

| Input Value   | Type  | Description                      |
| ------------- | ----- | -------------------------------- |
| `x_in_amount` | `u64` | The input amount of token **X**. |

#### **Code**

```move
public fun get_amount_out<X, Y>(x_in_amount: u64): u64 {
    assert!(swap::is_pair_created<X, Y>(), errors::pair_not_created());
    let is_x_to_y = swap_utils::sort_token_type<X, Y>();
    get_amount_out_internal<X, Y>(is_x_to_y, x_in_amount)
} 
```


# Swap

{% hint style="warning" %}
Movemement testnet is unstable by the time of writing and using the contracts below are for testing and development purposes only
{% endhint %}

### **Contract Info**

* **Contract Name**: `yuzu::swap`
* **Contract Address**: \[tba]
* **Admin Multi Sig**: \[tba]

### Types

| Name | Type         | Description                                   |
| ---- | ------------ | --------------------------------------------- |
| X    | type address | The coin type address of token X in the pair. |
| Y    | type address | The coin type address of token Y in the pair. |

### Resources

#### **LPToken**

The liquidity token corresponds to each pool XY.

```move
struct LPToken<phantom X, phantom Y> has key {}
```

***

#### **TokenPairMetadata**

Metadata related to the token pair and liquidity pool.

```move
struct TokenPairMetadata<phantom X, phantom Y> has key {
    creator: address,
    fee_on_transfer_x: Option<FeeOnTransferInfo<X>>,
    fee_on_transfer_y: Option<FeeOnTransferInfo<Y>>,
    k_last: u128,
    liquidity_fee: u128,
    rewards_fee: u128,
    team_fee: u128,
    treasury_fee: u128,
    balance_x: coin::Coin<X>,
    balance_y: coin::Coin<Y>,
    mint_cap: coin::MintCapability<LPToken<X, Y>>,
    burn_cap: coin::BurnCapability<LPToken<X, Y>>,
    freeze_cap: coin::FreezeCapability<LPToken<X, Y>>,
}
```

| Name          | Type                 | Description                                                   |
| ------------- | -------------------- | ------------------------------------------------------------- |
| creator       | address              | The creator address of the pool.                              |
| k\_last       | u128                 | The last recorded reserve product (reserve\_x \* reserve\_y). |
| balance\_x    | coin::Coin           | The total amount of token X in the pool.                      |
| balance\_y    | coin::Coin           | The total amount of token Y in the pool.                      |
| mint\_cap     | coin::MintCapability | Capability to mint LP tokens.                                 |
| burn\_cap     | coin::BurnCapability | Capability to burn LP tokens.                                 |
| treasury\_fee | u128                 | The fee collected by the treasury.                            |

***

#### **TokenPairReserve**

Reserve balances and metadata related to liquidity reserves.

```move
struct TokenPairReserve<phantom X, phantom Y> has key {
    reserve_x: u64,
    reserve_y: u64,
    block_timestamp_last: u64
}
```

| Name                   | Type | Description                              |
| ---------------------- | ---- | ---------------------------------------- |
| reserve\_x             | u64  | The total amount of token X in the pool. |
| reserve\_y             | u64  | The total amount of token Y in the pool. |
| block\_timestamp\_last | u64  | The last time the reserves were updated. |

***

### Public Functions

#### **Register LP**

Register the LP token to the account.

```move
public fun register_lp<X, Y>(sender: &signer)
```

#### **Is Pair Created**

Check if the pool XY is created or not.

```move
public fun is_pair_created<X, Y>(): bool
```

#### **LP Balance**

Check the LP balance of a user.

```move
public fun lp_balance<X, Y>(addr: address): u64
```

#### **Total LP Supply**

Retrieve the total amount of LP tokens in the pool.

```move
public fun total_lp_supply<X, Y>(): u128
```

#### **Token Reserves**

Retrieve the reserves of the token pair XY.

```move
public fun token_reserves<X, Y>(): (u64, u64, u64)
```

#### **Token Balance**

Retrieve the token balances in the pool XY.

```move
public fun token_balances<X, Y>(): (u64, u64)
```


# Ecosystem Participants of Yuzu

## Introduction

The Yuzu ecosystem is a dynamic and diverse environment, hosting a variety of participants including liquidity providers, traders, developers, and the Yuzu community. Each group plays a crucial role in sustaining and advancing the ecosystem.

## Liquidity Providers (LPs)

### Types of LPs

**Passive LPs**: Token holders seeking to invest their assets to earn trading fees.

**Professional LPs**: Market makers utilizing custom tools to manage liquidity positions across DeFi projects.

**Token Projects as LPs**: Projects that supply liquidity to create a more accessible market for their tokens, enhancing interoperability with other DeFi projects.

**Innovative LPs**: Pioneers experimenting with incentivized liquidity, using liquidity as collateral, and other novel strategies.

## Traders

### Categories of Traders

**Speculators**: Individuals leveraging community-built tools to swap tokens through Yuzu’s liquidity.

**Arbitrage Bots**: Automated systems that balance prices across different markets, contributing to market fairness.

**DAPP Users**: Users acquiring tokens on Yuzu for application usage on the Movement network.

**Smart Contract Trades**: Automated trades executed by smart contracts, from DEX aggregators to custom scripts.

### Trading Dynamics

All trades incur a fixed fee, which is crucial for maintaining price accuracy and incentivizing liquidity.

## Developers and Projects

### Utilization of Yuzu

**User Experience Experiments**: Various front-ends and interfaces built to access Yuzu's functionalities, contributing to major DeFi dashboard projects.

**Wallet Integrations**: Incorporation of swapping and liquidity provision as key features in crypto wallets.

**DEX Aggregators**: Utilization of Yuzu’s liquidity in combination with other protocols to offer optimal trading prices.

**Smart Contract Innovation**: Developers creating new DeFi tools and experimental projects using Yuzu's functionalities.

## Yuzu Team and Community

### Collaborative Development

The Yuzu team, in collaboration with the broader community, spearheads the development and continuous enhancement of the protocol and its ecosystem.

## Stronger Together

The synergy between these various participants creates a vibrant and efficient ecosystem, continually evolving and expanding the digital economy on the Movement Network through Yuzu.


# Understanding Returns

## Introduction

This guide provides an insight into how liquidity providers earn returns and the associated risks in the Yuzu ecosystem.

## Liquidity Provider Incentives

### Fee Rewards

Liquidity providers are rewarded with a portion of the fees generated from trading within their pools. Yuzu charges a 0.9% fee for swapping tokens, distributed among liquidity providers and the Yuzu Treasury.

### Token Distribution

Providers receive “liquidity tokens” proportional to their share in the liquidity pool. These tokens represent a claim on the pool's assets and are not meant for trading.

## Risks and Returns

### Understanding Risks

Market making, while potentially profitable, carries the risk of losses, especially during significant price movements of the underlying assets. An in-depth analysis of these risks is available in [this article](https://medium.com/@pintail/uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2).

### Example Scenario

The article provides an example where a provider's stake in a pool could lead to missed profits compared to simply holding the assets due to market price changes. This scenario illustrates the concept of "impermanent loss".

## Impermanent Loss Explained

### Definition

Impermanent loss occurs when the price of assets in a liquidity pool changes compared to when they were deposited. The loss is 'impermanent' as it can be reversed if the prices return to their original state.

### Calculation

The loss can be calculated using the formula:&#x20;

`impermanent_loss = 2 × price_ratio / (1+price_ratio) − 1impermanent_loss = 2 × price_ratio​ / (1+price_ratio) − 1`

### Impact at Different Price Ratios

For example:

* A 1.25x price change results in a 0.6% loss relative to holding (HODL).
* A 2x price change results in a 5.7% loss relative to HODL.
* Larger price changes result in increasingly significant losses.

### Direction of Price Change

The direction of the price change (increase or decrease) does not affect the magnitude of the impermanent loss.

## Conclusion

While providing liquidity on Yuzu can be rewarding due to trading fees, it is important for liquidity providers to be aware of the risks, particularly impermanent loss. Understanding these dynamics is crucial for making informed decisions in the decentralized finance landscape.


# Tradingview

We use [TradingView’s Advanced Charts Library](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/), which includes a wide range of technical indicators, drawing tools, and options for integrating real-time data, enabling the creation of interactive financial charts. These charts allow users to track cryptocurrency prices like the [BTCUSD chart](https://www.tradingview.com/symbols/BTCUSD/) and use various tools to analyze trends, predict price movements, and make informed trading decisions.


# Technical


# Smart Contracts

## 1. Module: `move_fun::bonding_curve`

### Module Info

* **Description**: Core logic for managing bonding curves used in fungible asset pricing.

### Resources

**`BondingCurves`**

```
struct BondingCurves has key {
    table: table::Table<String, BondingCurve>
}
```

**`BondingCurve`**

```
struct BondingCurve has key, drop, store, copy {
    initial_price_numerator: u128,
    initial_price_denominator: u128,
    growth_constant: u128
}
```

### Public Functions

| Function                     | Description                                                    |
| ---------------------------- | -------------------------------------------------------------- |
| `initialize<CoinType>`       | Initialize bonding curve for a token.                          |
| `initialize_fa`              | Initialize bonding curve for a fungible asset object.          |
| `calculate_k`                | Calculate the growth constant `k`.                             |
| `calculate_buy_amount_out`   | Get amount out when buying with given input.                   |
| `calculate_buy_amount_in`    | Get amount needed to buy specific output.                      |
| `calculate_sell_amount_out`  | Get amount received when selling tokens.                       |
| `calculate_sell_amount_in`   | Calculate tokens needed to get a specific return when selling. |
| `calculate_price`            | Calculate token price based on supply.                         |
| `set_market_cap_goal`        | Adjust bonding curve's growth constant `k`.                    |
| `calculate_price_by_amounts` | Quick price calculation helper.                                |
| `bonding_curve<CoinType>`    | Access bonding curve for a token type.                         |
| `fa_bonding_curve`           | Access bonding curve for a fungible asset.                     |
| `initial_price`              | Return initial price components (numerator, denominator).      |
| `growth_constant`            | Return the growth constant `k`.                                |

### Errors

| Code | Description                       |
| ---- | --------------------------------- |
| `1`  | Same growth constant as existing. |
| `2`  | Amount out exceeds limits.        |

***

## 2. Module: `move_fun::fungible_asset`

### Module Info

* **Description**: Defines a fungible asset backed by a bonding curve with mechanisms for buying, selling, and tracking supply.

### Resources

**`Registry`**

Manages fungible asset info per address.

**`Info`**

Stores details for an asset's bonding curve.

**`Store`**

Manages virtual balances for wallets.

**`FaMetadata`**

Stores additional metadata: logo, banner, description, links.

### Events

| Event          | Description                             |
| -------------- | --------------------------------------- |
| `FaDeployed`   | Emitted after deploying a FA.           |
| `FaBought`     | Emitted after a successful FA buy.      |
| `FaSold`       | Emitted after a successful FA sale.     |
| `BundleBuy`    | Emitted after bundled buy distribution. |
| `FeeExtracted` | Emitted after fee extraction.           |

### Public Functions

| Function                         | Description                                         |
| -------------------------------- | --------------------------------------------------- |
| `initialize_registry`            | Setup registry.                                     |
| `initialize<DEX>`                | Initialize a fungible asset.                        |
| `buy_exact_out`                  | Buy exact token amount, paying MOVE.                |
| `buy_exact_in`                   | Buy as much token as possible with given MOVE.      |
| `sell_exact_in`                  | Sell tokens for MOVE.                               |
| `sell_exact_out`                 | Sell exact MOVE amount worth of tokens.             |
| `quote_buy_exact_in`             | Quote tokens for exact MOVE input.                  |
| `quote_buy_exact_out`            | Quote MOVE for exact token output.                  |
| `quote_sell_exact_in`            | Quote MOVE for selling tokens.                      |
| `quote_sell_exact_out`           | Quote tokens needed to sell for MOVE.               |
| `retrieve_accumulated_supply`    | Retrieve all sold MOVE funds.                       |
| `claim`                          | Claim tokens post-bonding curve.                    |
| `retrieve_liquidity_supply`      | Retrieve liquidity-bound tokens.                    |
| `distribute_virtual_balances`    | Distribute tokens to wallets from virtual balances. |
| `target_price`                   | Get target price of a FA.                           |
| `transfer_from_virtual_balance`  | Move virtual tokens to wallet.                      |
| `batch_transfer`                 | Batch transfer virtual balances.                    |
| `set_bonding_curve_goal_reached` | Finalize bonding curve.                             |

### View Functions

* `price_denominator`
* `total_bound_supply`
* `available_supply`
* `accumulated_sell_supply`
* `price_at_supply`
* `virtual_balance`
* `virtual_balances`
* `has_virtual_balance`
* `icon_uri`
* `banner_uri`
* `project_uri`
* `misc_metadata`
* `bonding_curve_goal`
* `initial_price`
* `dex`
* `max_wallet_balance`
* `is_registered`

### Errors

| Code | Description                 |
| ---- | --------------------------- |
| `1`  | Wallet balance exceeds max. |
| `2`  | FA not registered.          |
| `3`  | No virtual balance owned.   |
| `4`  | No virtual balance exists.  |

***

## 3. Module: `move_fun::fungible_asset_router`

### Module Info

* **Description**: Entry point module to interact with fungible assets on bonding curves: buying, selling, launching, airdropping.

### Events

| Event          | Description                               |
| -------------- | ----------------------------------------- |
| `FeeExtracted` | Fee event (deprecated).                   |
| `FaMigrated`   | Token migration after bonding curve ends. |
| `Airdropped`   | Virtual balance airdrop event.            |

### Entry Functions

| Function                | Description                               |
| ----------------------- | ----------------------------------------- |
| `create<DEX>`           | Initialize bonding curve for existing FA. |
| `buy_exact_out`         | Buy exact FA amount for MOVE.             |
| `buy_exact_move`        | Spend fixed MOVE amount to buy FA.        |
| `sell_exact_in`         | Sell FA tokens for MOVE.                  |
| `sell_exact_move`       | Sell FA for exact MOVE amount.            |
| `claim_virtual_balance` | Claim post-bonding curve tokens.          |
| `airdrop`               | Airdrop remaining tokens to holders.      |

### View Functions

| Function                | Description                     |
| ----------------------- | ------------------------------- |
| `quote_buy_exact_out`   | Get MOVE cost for exact FA.     |
| `quote_buy_exact_move`  | Get FA for MOVE input.          |
| `quote_sell_exact_in`   | Get MOVE for selling FA.        |
| `quote_sell_exact_move` | Get FA needed to sell for MOVE. |

### Internal Functions

* `launch`: Finalize bonding curve and create liquidity pool.

### Errors

| Code | Description                      |
| ---- | -------------------------------- |
| `1`  | Not owner of FA.                 |
| `2`  | Bonding curve already completed. |
| `3`  | Slippage exceeded.               |
| `4`  | Invalid total supply.            |


# Smart Contracts

### Module: `move_fun::bonding_curve`

#### Module Info

* **Description**: Core logic for managing bonding curves used in fungible asset pricing.

***

#### Resources

**`BondingCurves`**

```move
struct BondingCurves has key {
    table: table::Table<String, BondingCurve>
}
```

**`BondingCurve`**

```move
struct BondingCurve has key, drop, store, copy {
    initial_price_numerator: u128,
    initial_price_denominator: u128,
    growth_constant: u128
}
```

***

#### Public Functions

| Function                     | Arguments                                    | Type               | Description                                           |
| ---------------------------- | -------------------------------------------- | ------------------ | ----------------------------------------------------- |
| `initialize<CoinType>`       | –                                            | –                  | Initialize bonding curve for a token.                 |
| `initialize_fa`              | –                                            | –                  | Initialize bonding curve for a fungible asset object. |
| `calculate_k`                | `initial_price_n`, `initial_price_d`, `goal` | `u128, u128, u128` | Calculate the growth constant `k`.                    |
| `calculate_buy_amount_out`   | `amount_in`, `supply`, `k`                   | `u128, u128, u128` | Get amount out when buying with given input.          |
| `calculate_buy_amount_in`    | `amount_out`, `supply`, `k`                  | `u128, u128, u128` | Get amount needed to buy specific output.             |
| `calculate_sell_amount_out`  | `amount_in`, `supply`, `k`                   | `u128, u128, u128` | Get amount received when selling tokens.              |
| `calculate_sell_amount_in`   | `amount_out`, `supply`, `k`                  | `u128, u128, u128` | Calculate tokens needed to get a specific return.     |
| `calculate_price`            | `supply`, `k`                                | `u128, u128`       | Calculate token price based on supply.                |
| `calculate_price_by_amounts` | `amount`, `supply`, `k`                      | `u128, u128, u128` | Quick price calculation helper.                       |
| `set_market_cap_goal`        | `curve_id`, `new_goal`                       | `String, u128`     | Adjust bonding curve’s growth constant `k`.           |
| `bonding_curve<CoinType>`    | –                                            | –                  | Access bonding curve for a token.                     |
| `fa_bonding_curve`           | `fa_addr`                                    | `address`          | Access bonding curve for a fungible asset.            |
| `initial_price`              | `curve_id`                                   | `String`           | Return initial price numerator and denominator.       |
| `growth_constant`            | `curve_id`                                   | `String`           | Return the growth constant `k`.                       |

***

#### Errors

| Code | Description                       |
| ---- | --------------------------------- |
| `1`  | Same growth constant as existing. |
| `2`  | Amount out exceeds limits.        |

***

### Module: `move_fun::fungible_asset`

#### Module Info

* **Description**: Defines a fungible asset backed by a bonding curve with mechanisms for buying, selling, and tracking supply.

***

#### Resources

| Resource     | Description                                          |
| ------------ | ---------------------------------------------------- |
| `Registry`   | Manages fungible asset info per address.             |
| `Info`       | Stores bonding curve data and metadata.              |
| `Store`      | Manages virtual balances for wallets.                |
| `FaMetadata` | Holds icon, banner, description, and external links. |

***

#### Events

| Event          | Description                             |
| -------------- | --------------------------------------- |
| `FaDeployed`   | Emitted after deploying a FA.           |
| `FaBought`     | Emitted after a successful FA buy.      |
| `FaSold`       | Emitted after a successful FA sale.     |
| `BundleBuy`    | Emitted after bundled buy distribution. |
| `FeeExtracted` | Emitted after fee extraction.           |

***

#### Entry Functions

| Function                         | Arguments                          | Type                                    | Description                                       |
| -------------------------------- | ---------------------------------- | --------------------------------------- | ------------------------------------------------- |
| `initialize_registry`            | –                                  | –                                       | Setup the registry resource.                      |
| `initialize<DEX>`                | `signer`, metadata, config         | `&signer, struct, struct`               | Initialize a new fungible asset with DEX target.  |
| `buy_exact_out`                  | `&signer`, `amount`                | `&signer, u64`                          | Buy exact amount of FA, paying MOVE.              |
| `buy_exact_in`                   | `&signer`, `amount_in`             | `&signer, u64`                          | Buy as much FA as possible with fixed MOVE input. |
| `sell_exact_in`                  | `&signer`, `amount_in`             | `&signer, u64`                          | Sell fixed amount of FA for MOVE.                 |
| `sell_exact_out`                 | `&signer`, `amount_out`            | `&signer, u64`                          | Sell tokens to receive exact MOVE amount.         |
| `quote_buy_exact_in`             | `amount_in`                        | `u64`                                   | Return FA amount receivable for given MOVE input. |
| `quote_buy_exact_out`            | `amount_out`                       | `u64`                                   | Return MOVE needed to get exact FA amount.        |
| `quote_sell_exact_in`            | `amount_in`                        | `u64`                                   | Return MOVE receivable from selling FA.           |
| `quote_sell_exact_out`           | `amount_out`                       | `u64`                                   | Return FA needed to receive target MOVE.          |
| `retrieve_accumulated_supply`    | `&signer`                          | `&signer`                               | Withdraw raised MOVE from bonding curve.          |
| `claim`                          | `&signer`                          | `&signer`                               | Claim tokens after bonding phase ends.            |
| `retrieve_liquidity_supply`      | `&signer`                          | `&signer`                               | Withdraw liquidity-bound FA.                      |
| `distribute_virtual_balances`    | –                                  | –                                       | Distribute virtual tokens to holders.             |
| `target_price`                   | –                                  | –                                       | Get the current FA target price.                  |
| `transfer_from_virtual_balance`  | `&signer`, `recipient`, `amount`   | `&signer, address, u64`                 | Transfer virtual balance tokens.                  |
| `batch_transfer`                 | `&signer`, `recipients`, `amounts` | `&signer, vector<address>, vector<u64>` | Transfer to many recipients.                      |
| `set_bonding_curve_goal_reached` | `&signer`                          | `&signer`                               | Finalize bonding curve.                           |


# Coin (AMM)


# Bonding Curve

### **Contract Info**

* **Contract Name**: `move_fun::bonding_curve`
* **Contract Address**: \[tba]

### Resources

***

#### **BondingCurve**

Represents a bonding curve for a token.

```move
struct BondingCurve has key, drop {
    initial_price_numerator: u128,
    initial_price_denominator: u128,
    growth_constant: u128
}
```

| Name                        | Type | Description                                                           |
| --------------------------- | ---- | --------------------------------------------------------------------- |
| initial\_price\_numerator   | u128 | Initial price numerator for the token.                                |
| initial\_price\_denominator | u128 | Initial price denominator for the token.                              |
| growth\_constant            | u128 | Growth constant (k) that determines how the price scales with supply. |

***

### Public Functions

***

#### **Initialize**

Initializes the bonding curve with initial price and growth constant.

```move
public(friend) fun initialize(
    signer_ref: &signer,
    initial_price_numerator: u128,
    initial_price_denominator: u128,
    growth_constant: u128
)
```

| Input Values                | Type   | Description                                    |
| --------------------------- | ------ | ---------------------------------------------- |
| signer\_ref                 | signer | The signer's reference.                        |
| initial\_price\_numerator   | u128   | The initial numerator for the token price.     |
| initial\_price\_denominator | u128   | The initial denominator for the token price.   |
| growth\_constant            | u128   | The growth constant (k) for the bonding curve. |

***

#### **Calculate Growth Constant**

Calculates the growth constant ( k ) based on the bonding curve parameters.

```move
public(friend) fun calculate_k(
    initial_price_numerator: u128,
    initial_price_denominator: u128,
    target_price_numerator: u128,
    target_supply: u128,
    max_supply: u128
): u128
```

| Input Values                | Type | Description                |
| --------------------------- | ---- | -------------------------- |
| initial\_price\_numerator   | u128 | Initial price numerator.   |
| initial\_price\_denominator | u128 | Initial price denominator. |
| target\_price\_numerator    | u128 | Target price numerator.    |
| target\_supply              | u128 | Target supply amount.      |
| max\_supply                 | u128 | Maximum supply amount.     |

***

#### **Calculate Price**

Calculates the token price based on the supply and bonding curve parameters.

```move
public(friend) fun calculate_price(
    curve: &BondingCurve,
    max_supply: u128,
    decimals: u128,
    new_supply_base_value: u128,
    new_supply_exponent_value: u128
): u128
```

| Input Values                 | Type           | Description                              |
| ---------------------------- | -------------- | ---------------------------------------- |
| curve                        | \&BondingCurve | The bonding curve reference.             |
| max\_supply                  | u128           | Maximum supply of the token.             |
| decimals                     | u128           | Number of decimals to use for precision. |
| new\_supply\_base\_value     | u128           | The new supply base value.               |
| new\_supply\_exponent\_value | u128           | The new supply exponent value.           |

***

#### **Set Market Cap Goal**

Adjusts the bonding curve based on a new target market cap.

```move
public(friend) fun set_market_cap_goal(
    coin_addr: address, 
    initial_price_numerator: u128,
    initial_price_denominator: u128,
    target_price_numerator: u128,
    target_supply: u128,
    max_supply: u128
): u128 acquires BondingCurve
```

| Input Values                | Type    | Description                |
| --------------------------- | ------- | -------------------------- |
| coin\_addr                  | address | Address of the token.      |
| initial\_price\_numerator   | u128    | Initial price numerator.   |
| initial\_price\_denominator | u128    | Initial price denominator. |
| target\_price\_numerator    | u128    | Target price numerator.    |
| target\_supply              | u128    | Target supply amount.      |
| max\_supply                 | u128    | Maximum supply amount.     |

***

### View Functions

***

#### **Initial Price**

Returns the initial price of the bonding curve for a token.

```move
public fun initial_price<CoinType>(): (u128, u128) acquires BondingCurve
```

| Return Values               | Type | Description                             |
| --------------------------- | ---- | --------------------------------------- |
| initial\_price\_numerator   | u128 | Initial price numerator of the token.   |
| initial\_price\_denominator | u128 | Initial price denominator of the token. |

***

#### **Growth Constant**

Returns the growth constant ( k ) for the bonding curve of a token.

```move
public fun growth_constant<CoinType>(): u128 acquires BondingCurve
```

| Return Values    | Type | Description                                 |
| ---------------- | ---- | ------------------------------------------- |
| growth\_constant | u128 | Growth constant ( k ) of the bonding curve. |


# Core

## **Contract Info**

* **Contract Name**: `move_fun::legacy_coin`
* **Contract Address**: \[tba]

### Resources

***

#### **Info**

Represents the global storage for managing the legacy coin supply and details.

```move
struct Info<phantom BuyCoinType, phantom SellCoinType> has key {
    total_bound_supply: u64,
    liquidity_supply: Coin<BuyCoinType>,
    target_price_numerator: u64,
    target_price_denominator: u64,
    buy_coin_store: Coin<BuyCoinType>,
    sell_coin_store: Coin<SellCoinType>,
    virtual_balance_store: smart_table::SmartTable<address, Coin<BuyCoinType>>,
    max_wallet_balance: Option<u64>,
}
```

| Name                       | Type                                     | Description                                        |
| -------------------------- | ---------------------------------------- | -------------------------------------------------- |
| total\_bound\_supply       | u64                                      | Total supply bound to the bonding curve.           |
| liquidity\_supply          | Coin                                     | Supply allocated for liquidity.                    |
| target\_price\_numerator   | u64                                      | Target price numerator for the buy coin.           |
| target\_price\_denominator | u64                                      | Target price denominator for the buy coin.         |
| buy\_coin\_store           | Coin                                     | Coin supply available for selling.                 |
| sell\_coin\_store          | Coin                                     | Coin supply held for selling.                      |
| virtual\_balance\_store    | smart\_table::SmartTable\<address, Coin> | Virtual balance for storing coins during buy/sell. |
| max\_wallet\_balance       | Option                                   | Maximum allowed balance per wallet (optional).     |

***

#### **CoinMetadata**

Stores metadata for the legacy coin.

```move
struct CoinMetadata<phantom CoinType> has key, store {
    name: String,
    symbol: String,
    decimals: u8,
    max_supply: u64,
    logo: String,
    banner: String,
    description: String,
    links: vector<String>
}
```

| Name        | Type   | Description                            |
| ----------- | ------ | -------------------------------------- |
| name        | String | Name of the coin.                      |
| symbol      | String | Symbol of the coin.                    |
| decimals    | u8     | Number of decimal places for the coin. |
| max\_supply | u64    | Maximum supply of the coin.            |
| logo        | String | URL to the coin's logo.                |
| banner      | String | URL to the coin's banner.              |
| description | String | Description of the coin.               |
| links       | vector | List of links related to the coin.     |

***

### Events

***

#### **CoinDeployed**

Emitted when the coin is deployed.

```move
#[event]
struct CoinDeployed has drop, store {
    coin_address: String,
    name: String,
    symbol: String,
    decimals: u8,
    max_supply: u64,
    logo: String,
    banner: String,
    description: String,
    links: vector<String>
}
```

#### **CoinBought**

Emitted when coins are bought.

```move
#[event]
struct CoinBought has drop, store {
    buyer: address,
    coin: String,
    amount_base_value: u64,
    amount_exponent_value: u64,
    at_price_numerator: u64,
    at_price_denominator: u64,
    paid: u64,
    paid_coin: String,
    accumulated_sell_supply: u64,
    remaining_supply: u64,
}
```

#### **CoinSold**

Emitted when coins are sold.

```move
#[event]
struct CoinSold has drop, store {
    seller: address,
    coin: String,
    amount_base_value: u64,
    amount_exponent_value: u64,
    at_price_numerator: u64,
    at_price_denominator: u64,
    received: u64,
    received_coin: String,
    accumulated_sell_supply: u64,
    remaining_supply: u64,
}
```

***

### Public Functions

***

#### **Initialize Legacy Coin**

Initializes the legacy coin with bonding curve parameters and metadata.

```move
public(friend) fun initialize<BuyCoinType, SellCoinType>(
    signer_ref: &signer,
    max_supply: u64,
    initial_price_numerator: u64,
    initial_price_denominator: u64,
    target_price_numerator: u64,
    target_price_denominator: u64,
    bound_supply_percentage: u8,
    logo: String,
    banner: String,
    description: String,
    links: vector<String>,
    max_wallet_balance: Option<u64>
)
```

| Input Values                | Type   | Description                                                |
| --------------------------- | ------ | ---------------------------------------------------------- |
| signer\_ref                 | signer | The signer's reference.                                    |
| max\_supply                 | u64    | Maximum supply of the coin.                                |
| initial\_price\_numerator   | u64    | Initial price numerator for the coin.                      |
| initial\_price\_denominator | u64    | Initial price denominator for the coin.                    |
| target\_price\_numerator    | u64    | Target price numerator for the coin.                       |
| target\_price\_denominator  | u64    | Target price denominator for the coin.                     |
| bound\_supply\_percentage   | u8     | Percentage of the total supply bound to the bonding curve. |
| logo                        | String | URL to the coin's logo.                                    |
| banner                      | String | URL to the coin's banner.                                  |
| description                 | String | Description of the coin.                                   |
| links                       | vector | List of links related to the coin.                         |
| max\_wallet\_balance        | Option | Optional max wallet balance.                               |

***

#### **Buy Legacy Coin**

Allows users to buy coins based on the bonding curve.

```move
public(friend) fun buy<BuyCoinType, SellCoinType>(
    buyer: &signer,
    amount_base_value: u64,
    amount_exponent_value: u64
) acquires Info
```

| Input Values            | Type   | Description                          |
| ----------------------- | ------ | ------------------------------------ |
| buyer                   | signer | The buyer's reference.               |
| amount\_base\_value     | u64    | Base value of the amount to buy.     |
| amount\_exponent\_value | u64    | Exponent value of the amount to buy. |

***

#### **Sell Legacy Coin**

Allows users to sell coins back into the bonding curve.

```move
public(friend) fun sell<BuyCoinType, SellCoinType>(
    seller: &signer,
    amount_base_value: u64,
    amount_exponent_value: u64
) acquires Info
```

| Input Values            | Type   | Description                           |
| ----------------------- | ------ | ------------------------------------- |
| seller                  | signer | The seller's reference.               |
| amount\_base\_value     | u64    | Base value of the amount to sell.     |
| amount\_exponent\_value | u64    | Exponent value of the amount to sell. |

***

### View Functions

***

#### **Get Metadata**

Retrieves the metadata for the legacy coin.

```move
#[view]
public fun metadata<CoinType>(): (String, String, u8, u64, String, String, String, vector<String>) acquires CoinMetadata
```

| Return Values | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| name          | String | Name of the coin.                      |
| symbol        | String | Symbol of the coin.                    |
| decimals      | u8     | Number of decimal places for the coin. |
| max\_supply   | u64    | Maximum supply of the coin.            |
| logo          | String | URL to the coin's logo.                |
| banner        | String | URL to the coin's banner.              |
| description   | String | Description of the coin.               |
| links         | vector | List of links related to the coin.     |


# Router

## **Contract Info**

* **Contract Name**: `move_fun::legacy_coin_router`
* **Contract Address**: \[tba]

***

### Resources

***

#### **Info**

Represents the global storage for managing the bonding curve metadata, and only admins can modify it.

```move
struct Info<phantom BuyCoinType, phantom SellCoinType> has key {
    initial_price_numerator: u64,
    initial_price_denominator: u64,
    bonding_curve_goal: u64,
    dex: TypeInfo,
}
```

| Name                        | Type     | Description                                                 |
| --------------------------- | -------- | ----------------------------------------------------------- |
| initial\_price\_numerator   | u64      | Initial price numerator of the bonding curve.               |
| initial\_price\_denominator | u64      | Initial price denominator of the bonding curve.             |
| bonding\_curve\_goal        | u64      | Total sales goal after which the liquidity pool is created. |
| dex                         | TypeInfo | The DEX where the liquidity pool will be created.           |

***

### Entry Functions

***

#### **Create Legacy Coin with Bonding Curve**

Initializes a new bonding curve for a legacy coin. Only callable by the owner of the buy coin.

```move
public(friend) entry fun create<BuyCoinType, DEX>(
    deployer: &signer,
    name: String,
    symbol: String,
    logo: String,
    banner: String,
    description: String,
    links: vector<String>,
    max_wallet_balance: Option<u64>,
    bundled_launch_amount_base_value: Option<u64>,
    bundled_launch_amount_exponent_value: Option<u64>
) acquires Info
```

| Input Values                             | Type   | Description                                 |
| ---------------------------------------- | ------ | ------------------------------------------- |
| deployer                                 | signer | The deployer's signer reference.            |
| name                                     | String | Name of the legacy coin.                    |
| symbol                                   | String | Symbol of the legacy coin.                  |
| logo                                     | String | URL to the logo of the coin.                |
| banner                                   | String | URL to the banner of the coin.              |
| description                              | String | Description of the coin.                    |
| links                                    | vector | List of links related to the coin.          |
| max\_wallet\_balance                     | Option | Optional maximum wallet balance limit.      |
| bundled\_launch\_amount\_base\_value     | Option | Optional base value for bundled launch.     |
| bundled\_launch\_amount\_exponent\_value | Option | Optional exponent value for bundled launch. |

***

#### **Buy Legacy Coin**

Allows users to buy legacy coins based on the bonding curve.

```move
public(friend) entry fun buy<BuyCoinType>(
    buyer: &signer,
    amount_base_value: u64,
    amount_exponent_value: u64
) acquires Info
```

| Input Values            | Type   | Description                          |
| ----------------------- | ------ | ------------------------------------ |
| buyer                   | signer | The buyer's signer reference.        |
| amount\_base\_value     | u64    | Base value of the amount to buy.     |
| amount\_exponent\_value | u64    | Exponent value of the amount to buy. |

***

#### **Sell Legacy Coin**

Allows users to sell legacy coins back into the bonding curve.

```move
public(friend) entry fun sell<BuyCoinType>(
    seller: &signer,
    amount_base_value: u64,
    amount_exponent_value: u64
) acquires Info
```

| Input Values            | Type   | Description                           |
| ----------------------- | ------ | ------------------------------------- |
| seller                  | signer | The seller's signer reference.        |
| amount\_base\_value     | u64    | Base value of the amount to sell.     |
| amount\_exponent\_value | u64    | Exponent value of the amount to sell. |

***

### View Functions

***

#### **Get Bonding Curve Goal**

Returns the bonding curve goal for the given coin.

```move
#[view]
public fun bonding_curve_goal<BuyCoinType>(): u64 acquires Info
```

| Return Values        | Type | Description             |
| -------------------- | ---- | ----------------------- |
| bonding\_curve\_goal | u64  | The bonding curve goal. |

***

#### **Get Initial Price**

Returns the initial price of the bonding curve.

```move
#[view]
public fun initial_price<BuyCoinType>(): (u64, u64) acquires Info
```

| Return Values               | Type | Description                    |
| --------------------------- | ---- | ------------------------------ |
| initial\_price\_numerator   | u64  | The initial price numerator.   |
| initial\_price\_denominator | u64  | The initial price denominator. |

***

#### **Get DEX**

Returns the DEX where the liquidity pool will be created.

```move
#[view]
public fun dex<BuyCoinType>(): TypeInfo acquires Info
```

| Return Values | Type     | Description                                       |
| ------------- | -------- | ------------------------------------------------- |
| dex           | TypeInfo | The DEX where the liquidity pool will be created. |


# Terms of Use

Welcome, and thank you for your interest in YuzuSwap (“Yuzu LLC, “our” “we,” or “us”) and our website at <https://YuzuDEX.xyz> (the “Site”). These Terms of Use are a legally binding contract between you and Yuzu LLC regarding your use of the Site. Please read the following terms carefully before using the Site. By using the Site, you acknowledge that you have read, understood, and agree to be bound by the following terms and conditions

## Eligibility

You must be at least 18 years of age to use the Site. By agreeing to these Terms, you represent and warrant to us that: (a) you are at least 18 years of age; and (b) your use of the Site is in compliance with any and all applicable laws and regulations. If you are an entity, organization, or company, the individual accepting these Terms on your behalf represents and warrants that they have authority to bind you to these Terms and you agree to be bound by these Terms.

## Purchases

* Payment: Purchases of any merchandise are facilitated through a third-party service provider. We may provide such service provider with information regarding your credit card or other payment instrument. You represent and warrant that such information is true and that you are authorized to use the payment instrument. You will be responsible for all taxes associated with your purchase of merchandise through the Service.
* Loss and Cancellation: Title and risk of loss for all merchandise ordered by you will pass to you on delivery to the shipping carrier. We reserve the right to cancel any order for any merchandise for any reason.
* Returns: You acknowledge and agree that goods produced for you are bespoke, custom-made goods. Other than where goods are faulty, you have no right to cancel any order or return any goods and all orders are final.
* Waiver: Your purchase of an item constitutes a waiver of any and all intellectual property, proprietary, personal, and privacy claims relating to that purchase.

## Changes to the Terms

We may periodically make changes to these Terms. When we do, we will update the “Last Updated” date above. It is your responsibility to review the most recent version of these Terms and remain informed of any changes. You agree that your continued use of the Site after the effective date of any changes will constitute your acceptance of the changed Terms for your continued use. Disputes arising under these Terms will be resolved in accordance with the version of these Terms that was in effect at the time the dispute arose.

## Changes to the Site

We reserve the right to modify or discontinue, temporarily or permanently, all or a part of the Site without notice. We will not be liable to you or to any third party for any modification, suspension, or discontinuance of the Site.

## Privacy

When you use the Interface, the only information we collect from you is your blockchain wallet address, completed transaction hashes, and the token names, symbols. We do not collect any personal information from you (e.g., your name or other identifiers that can be linked to you). We do, however, use third-party service providers which may receive or independently obtain your personal information from publicly-available sources. We do not control how these third parties handle your data and you should review their privacy policies to understand how they collect, use, and share your personal information. By accessing and using the Interface, you understand and consent to our data practices and our service providers' treatment of your information.&#x20;

We use the information we collect to detect, prevent, and mitigate financial crime and other illicit or harmful activities on the Interface. For these purposes, we may share the information we collect with blockchain analytics providers. We share information with these service providers only so that they can help us promote the safety, security, and integrity of the Interface.

Please note that when you use the Interface, you are interacting with Aptos or another public blockchain, which by nature may provide transparency into your transactions. Yuzuswap does not control and is not responsible for any information you make public on blockchains by taking actions through the Interface.&#x20;

## Limited License

Subject to these Terms, Yuzuswap grants you a limited, revocable license to access and use the Site solely for non-commercial purposes to learn more about Yuzu LLC products and services. No other use of the Site is authorized.

## Restrictions

You must comply with all applicable laws when using the Site. Except as may be expressly permitted by applicable law or expressly permitted by us in writing, you will not, and will not permit anyone else to: (a) store, copy, modify, distribute, or resell any information or material available on the Site (“Site Content”) or compile or collect any Site Content as part of a database or other work; (b) use any automated tool (e.g., robots, spiders) to use the Site or store, copy, modify, distribute, or resell any Site Content; (c) rent, lease, or sublicense your access to the Site; (d) use the Site or Site Content for any purpose except for your own personal use; (e) circumvent or disable any digital rights management, usage rules, or other security features of the Site; (f) reproduce, modify, translate, enhance, decompile, disassemble, reverse engineer, or create derivative works of the Site; (g) use the Site in a manner that threatens the integrity, performance, or availability of the Site; or (h) remove, alter, or obscure any proprietary notices (including copyright notices) on any portion of the Site or Site Content.

## Ownership

The Site is owned and operated by Yuzuswap. We retain all right, title, and interest in and to the Site and Site Content and any logos, or service marks displayed on the Site or in Site Content (“Marks”). Except as expressly authorized by Yuzuswap you may not make use of the Site, Site Content, and Marks.

## Links and Third Party Content

The Site may contain links to third party products, services, and websites. We exercise no control over the third party products, services, and websites and we are not responsible for their performance, do not endorse them, and are not responsible or liable for any content, advertising, or other materials available through the third party products, services, and websites. We are not responsible or liable, directly or indirectly, for any damage or loss caused to you by your use of or reliance on any goods or services available through the third party products, services, and websites.

Additionally, if you follow a link or otherwise navigate away from the Site, please be aware that these Terms will no longer govern. You should review the applicable terms and policies, including privacy and data gathering practices, of any third party websites to which you navigate to from the Site.

## Disclaimer of Warranties

YOUR USE OF THE SITE AND SITE CONTENT IS AT YOUR SOLE RISK. THE SITE AND SITE CONTENT ARE PROVIDED ON AN “AS IS” AND “AS AVAILABLE” BASIS. YUZU LLC EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. WE DO NOT GUARANTEE THE ACCURACY, COMPLETENESS, OR USEFULNESS OF THE SITE OR SITE CONTENT, AND YOU RELY ON THE SITE AND SITE CONTENT AT YOUR OWN RISK. ANY MATERIAL OBTAINED THROUGH THE SITE IS DONE AT YOUR OWN DISCRETION AND RISK AND YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER OR LOSS OF DATA THAT RESULTS FROM THE DOWNLOAD OF ANY MATERIAL THROUGH THE SITE. NO ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM YUZU LLC OR THROUGH OR FROM THE SITE WILL CREATE ANY WARRANTY NOT EXPRESSLY STATED IN THIS AGREEMENT. HOWEVER, YUZU LLC DOES NOT DISCLAIM ANY WARRANTY OR OTHER RIGHT THAT YUZU LLC IS PROHIBITED FROM DISCLAIMING UNDER APPLICABLE LAW.

## Limitation of Liability

YUZUSWAP WILL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER INTANGIBLE LOSSES (EVEN IF YUZU LLC HAS BEEN ADVISED OF THE POSSIBILITY OF THESE DAMAGES), RESULTING FROM YOUR USE OF THE SITE AND SITE CONTENT. UNDER NO CIRCUMSTANCES WILL YUZU LLC's TOTAL LIABILITY OF ALL KINDS ARISING OUT OF OR RELATED TO YOUR USE OF THE SITE OR SITE CONTENT (INCLUDING BUT NOT LIMITED TO WARRANTY CLAIMS), REGARDLESS OF THE FORUM AND REGARDLESS OF WHETHER ANY ACTION OR CLAIM IS BASED ON CONTRACT, TORT, OR OTHERWISE, EXCEED $50. BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

EACH PROVISION OF THESE TERMS THAT PROVIDES FOR A LIMITATION OF LIABILITY, DISCLAIMER OF WARRANTIES, OR EXCLUSION OF DAMAGES IS INTENDED TO AND DOES ALLOCATE THE RISKS BETWEEN THE PARTIES UNDER THESE TERMS. THIS ALLOCATION IS AN ESSENTIAL ELEMENT OF THE BASIS OF THE BARGAIN BETWEEN THE PARTIES. EACH OF THESE PROVISIONS IS SEVERABLE AND INDEPENDENT OF ALL OTHER PROVISIONS OF THESE TERMS. THE LIMITATIONS IN THIS SECTION WILL APPLY EVEN IF ANY LIMITED REMEDY FAILS OF ITS ESSENTIAL PURPOSE.

## Indemnity

You will indemnify and hold Yuzuswap and its partners, service providers, affiliates, officers, agents, and employees, harmless from any costs, damages, expenses, and liability caused by your use of the Site or Site Content, your violation of these Terms, or your violation of any rights of a third party through use of the Site or Site Content. We and our licensors reserve the right, at our own expense, to assume the exclusive defence and control of any matter otherwise subject to indemnification by you (without limiting your indemnification obligations with respect to that matter), and in that case, you agree to cooperate with our defence of those claims.

## Release

If you have a dispute with the Site, Site Content, or any products purchased through the Site, you hereby release us and our partners and service providers (and each party’s respective officers, directors, agents, subsidiaries, joint ventures and employees) from claims, demands and damages (actual and consequential) of every kind and nature, known and unknown, arising out of or in any way connected with such disputes. If you are a California resident, you waive California Civil Code §1542, which states: “A general release does not extend to claims that the creditor or releasing party does not know or suspect to exist in his or her favour at the time of executing the release and that, if known by him or her, would have materially affected his or her settlement with the debtor or released party.”

## General Terms

These Terms, together with any other agreements expressly incorporated by reference into these Terms, are the entire and exclusive understanding and agreement between you and Yuzuswap regarding your use of the Site. You may not assign or transfer these Terms or your rights under these Terms, in whole or in part, by operation of law or otherwise, without our prior written consent. We may assign these Terms at any time without notice or consent. The failure to require performance of any provision will not affect our right to require performance at any other time after that, nor will a waiver by us of any breach or default of these Terms, or any provision of these Terms, be a waiver of any subsequent breach or default or a waiver of the provision itself. Use of section headers in these Terms is for convenience only and will not have any impact on the interpretation of any provision. Throughout these Terms the use of the word “including” means “including but not limited to”. If any part of these Terms is held to be invalid or unenforceable, the unenforceable part will be given effect to the greatest extent possible, and the remaining parts will remain in full force and effect.

## Legal Notices

These Terms are governed by the laws of the state of without regard to conflict of law principles. The exclusive jurisdiction and venue for any claims arising out of or related to these Terms or your use of the Site will lie in the state and federal courts located in undefined, undefined, and you irrevocably agree to submit to the jurisdiction of such courts. The failure of Yuzuswap to enforce any right or provision in these Terms will not constitute a waiver of such right or provision unless acknowledged and agreed to by Yuzuswap in writing. In the event that a court of competent jurisdiction finds any provision of these Terms to be illegal, invalid or unenforceable, the remaining provisions will remain in full force and effect.

> For questions or more details, contact <support@YuzuDEX.xyz>


# Legal Disclaimer

*This article by Yuzu LLC and/or its affiliates (“we”, “us” and “our”) is for information purposes only. We do not provide tax, legal, insurance or investment advice, and nothing in this article should be construed as an offer to sell, a solicitation of an offer to buy, sell or issue or subscribe for, or a recommendation for any security, investment, cryptocurrency, token or other services, product or commodity by us or any third party. You alone are solely responsible for determining whether any purchase, sale, investment, security or strategy, or any other product or service, is appropriate or suitable for you based on your personal objectives and personal and financial situation and for evaluating the merits and risks associated with the use of the information in this article before making any decisions based on such information or other content. You should consult a lawyer and/or tax professional regarding your specific legal and/or tax situation. Past performance is no guarantee of future results. Therefore, you should not assume that the future performance of any specific investment, cryptocurrency, token, commodity or strategy will be profitable or equal to corresponding past performance levels. Inherent in any such transaction is the potential for loss. No recommendation or advice is being given as to whether any transaction is suitable for a particular person. By accessing this article, you acknowledge and agree to all of the foregoing and that you bear responsibility for your own research, due diligence and transaction decisions. You also agree that we, our affiliates and our respective directors, officers, employees, consultants, shareholders, members, representatives, advisors and agents will not be liable for any decision made or action taken by you and others based on this article, news, information, opinion, or any other material published, discussed or disseminated by us.*

*This article contains forward-looking statements or forward-looking information (referred to collectively as “forward-looking statements”). Forward-looking statements can be identified by words such as: “anticipate”, “intend”, “plan”, “goal”, “seek”, “believe”, “predict”, “project”, “estimate”, “expect”, “strategy”, “future”, “likely”, “may”, “should”, ”would”, “will”, and similar terms and phrases and the negatives of such expressions, including references to assumptions. Examples of forward-looking statements in this article include, among others, statements we make regarding our future plans, expectations and objectives.*

*Forward-looking statements are neither historical facts nor assurances of future performance. Instead, they are based only on our current beliefs, expectations and assumptions regarding the future of our business, future plans and strategies, projections, anticipated events and trends, the economy and other future conditions. Because forward-looking statements relate to the future, they are subject to inherent uncertainties, risks and changes in circumstances that are difficult to predict and many of which are outside of our control. Our actual results and financial condition may differ materially from those indicated in the forward-looking statements. Therefore, you should not rely on any of these forward-looking statements. Important factors that could cause our actual results and financial condition to differ materially from those indicated in the forward-looking statements include, among others, the following: reliance on blockchain technology and blockchain technology service providers; digital asset transactions being irrevocable and losses occurring from such transactions; our use and reliance on proprietary data and intellectual property in its business; potential misuses of digital assets and malicious actors in the digital asset industry; digital assets potentially being subject to hold periods; developments and changes in laws and regulations; and disruptions to our technology network including computer systems, software and cloud data, or other disruptions of our operating systems, structures or equipment. Readers are cautioned that the foregoing list is not exhaustive.*

*Any forward-looking statement made by us in this article is based only on information currently available to us and speaks only as of the date on which it is made. Except as required by applicable securities laws, we undertake no obligation to publicly update any forward-looking statement, whether written or oral, that may be made from time to time, whether as a result of new information, future developments or otherwise.*


