Swap
Movemement testnet is unstable by the time of writing and using the contracts below are for testing and development purposes only
Contract Info
Contract Name:
yuzu::swap
Contract Address: [tba]
Admin Multi Sig: [tba]
Types
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.
struct LPToken<phantom X, phantom Y> has key {}
TokenPairMetadata
Metadata related to the token pair and liquidity pool.
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>>,
}
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.
struct TokenPairReserve<phantom X, phantom Y> has key {
reserve_x: u64,
reserve_y: u64,
block_timestamp_last: u64
}
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.
public fun register_lp<X, Y>(sender: &signer)
Is Pair Created
Check if the pool XY is created or not.
public fun is_pair_created<X, Y>(): bool
LP Balance
Check the LP balance of a user.
public fun lp_balance<X, Y>(addr: address): u64
Total LP Supply
Retrieve the total amount of LP tokens in the pool.
public fun total_lp_supply<X, Y>(): u128
Token Reserves
Retrieve the reserves of the token pair XY.
public fun token_reserves<X, Y>(): (u64, u64, u64)
Token Balance
Retrieve the token balances in the pool XY.
public fun token_balances<X, Y>(): (u64, u64)
Last updated