This Automated Market Maker (AMM) system is a decentralized exchange mechanism built on the Sui blockchain, leveraging the Move programming language. Designed to facilitate automated trading and liquidity provision, our AMM system employs a constant product formula x * y = k
to ensure liquidity and enable seamless asset swaps within its ecosystem.
The core of this AMM system lies in its ability to create and manage liquidity pools for pairs of assets. It introduces concepts like liquidity pool coins (LP coins) which represent an individual's stake in a pool. The creation of a pool requires an initial liquidity supply, adhering to the sqrt(amount_coin_a * amount_coin_b) - 1000
formula, ensuring a minimum liquidity threshold.
This project provides various functionalities including creating liquidity pools, adding or removing liquidity, and performing asset swaps through several methods like swap_exact_a_for_b
or swap_a_for_exact_b
, each catering to different trading strategies and ensuring efficient market operations.
Ensure you have the following installed:
- Sui Devnet Node
- Move CLI for compiling and deploying smart contracts
-
Clone the Repository
git clone https://github.com/ksmit323/liquidity-pool-move cd liquidity-pool-move
-
Compile the Move Package
sui move compile
-
Deploy to Sui
sui move publish
-
Creating a Liquidity Pool Utilize the
create_liquidity_pool
function with the initial asset amounts to establish a new liquidity pool. -
Supplying Liquidity Call
supply_liquidity
with the desired asset amounts to add liquidity to an existing pool. -
Removing Liquidity Use
remove_liquidity
and specify the LP coins you wish to redeem for underlying assets. -
Swapping Assets Engage in trades using functions like
swap_exact_a_for_b
to exchange assets at current market rates.
To run the tests, use the following command:
sui move test
This is the Pool Party quest given by Overmind