Swap

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.

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

TokenPairMetadata

Metadata related to the token pair and liquidity pool.

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.

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.

Is Pair Created

Check if the pool XY is created or not.

LP Balance

Check the LP balance of a user.

Total LP Supply

Retrieve the total amount of LP tokens in the pool.

Token Reserves

Retrieve the reserves of the token pair XY.

Token Balance

Retrieve the token balances in the pool XY.

Last updated