Description: This module contains entry functions for users to call and interact with the yuzuswap contract.
Public Functions
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
Fungible asset metadata of token 0
Fungible asset metadata of token 1
Initial sqrt price of the pool
Create pool with one coin and one fungible asset
Creates a new liquidity pool with one coin (Token0) and one fungible asset. Reverts if the pool already exists.
Function type arguments
Function arguments
Fungible asset metadata of token 1
Initial sqrt price of the pool
Create pool with two coins
Creates a new liquidity pool with two coins Token0 and Token1. Reverts if the pool already exists.
Function type arguments
The coin’s type of the token 0
The coin’s type of the token 1
Function arguments
Initial sqrt price of the pool
Add liquidity to a pool with two fungible assets
Adds liquidity to a pool with two fungible assets.
Function arguments
The liquidity pool to add liquidity to.
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.
The lower tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.
The upper tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.
The amount of token 0 to add to the liquidity.
The amount of token 1 to add to the liquidity.
The minimum amount of token 0 to add to the liquidity.
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.
Function type arguments
Function arguments
The liquidity pool to add liquidity to.
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.
The lower tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.
The upper tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.
The amount of token 0 to add to the liquidity.
The amount of token 1 to add to the liquidity.
The minimum amount of token 0 to add to the liquidity.
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.
Function type arguments
The coin’s type of the token 0
The coin’s type of the token 1
Function arguments
The liquidity pool to add liquidity to.
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.
The lower tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.
The upper tick of the liquidity. Required in the case of creating a new position. Otherwise, leave it as 0.
The amount of token 0 to add to the liquidity.
The amount of token 1 to add to the liquidity.
The minimum amount of token 0 to add to the liquidity.
The minimum amount of token 1 to add to the liquidity.
Remove liquidity |
Remove liquidity from a pool
Removes liquidity from a pool.
Function arguments
The liquidity pool to remove liquidity from.
The position ID of the liquidity.
The amount of liquidity to remove.
The minimum amount of token 0 to get.
The minimum amount of token 1 to get.
Burns a position.
Function arguments
Collects fee from a position.
Function arguments
The amount of token 0 requested.
The amount of token 1 requested.
Collects reward from a position.
Function arguments
The amount of reward requested.
Swap exact fungible asset for fungible asset
Swaps an exact amount of fungible asset for another fungible asset.
Function arguments
The input token metadata.
The amount of input token.
The minimum amount of output token.
Swap exact coin for fungible asset
Swaps an exact amount of coin for a fungible asset.
Function type arguments
Function arguments
The amount of input coin.
The minimum amount of output token.
Swap fungible asset for exact fungible asset
Swaps a fungible asset for an exact amount of another fungible asset.
Function arguments
The input token metadata.
The amount of input token.
The minimum amount of output token.
Swap coin for exact fungible asset
Swaps a coin for an exact amount of a fungible asset.
Function type arguments
Function arguments
The amount of input coin.
The minimum amount of 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.
Function arguments
The input token metadata.
The amount of input token.
The minimum amount of output token.
Swap exact coin for fungible asset with multiple hops
Swaps an exact amount of coin for a fungible asset with multiple hops.
Function type arguments
Function arguments
The amount of input coin.
The minimum amount of output token.
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.
Function arguments
The input token metadata.
The maximum amount of input token.
The desired amount of 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.
Function type arguments
Function arguments
The maximum amount of input coin.
The desired amount of output token.