V2 路由

Router v2

Contract info

Contract name: pancake::router Contract address: c7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa::router

Admin Multi Sig: b11ccaed0056a75472539c2b0d9511c82fc6a36622bec7578216af5fe550dd0d

View on Aptos Explorer

Types

Entry Functions

Create Pair

Create the pool pair for swap.

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

Params

Add Liquidity

Add liquidity to the pool.

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,
)

Params

Remove Liquidity

Remove liquidity from the pool.

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

Params

Swap Exact Input

Swap exact amount of tokenX to tokenY.

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

Params

Swap Exact Output

Swap tokenX to exact amount of tokenY.

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

Params

Swap Exact Input Double Hop

Swap exact amount of tokenX to tokenZ using 2 pools (Pool XY and Pool YZ).

public entry fun swap_exact_input_doublehop<X, Y, Z>(
    sender: &signer,
    x_in: u64,
    z_min_out: u64,
)

Params

Swap Exact Output Double Hop

Swap tokenX to exact amount of tokenZ using 2 pools (Pool XY and Pool YZ).

public entry fun swap_exact_output_doublehop<X, Y, Z>(
    sender: &signer,
    z_out: u64,
    x_max_in: u64,
)

Params

Swap Exact Input Triple Hop

Swap exact amount of tokenX to tokenA using 3 pools (Pool XY, Pool YZ and Pool ZA).

public entry fun swap_exact_input_triplehop<X, Y, Z, A>(
    sender: &signer,
    x_in: u64,
    a_min_out: u64,
) 

Params

Swap Exact Output Triple Hop

Swap tokenX to exact amount of tokenA using 3 pools (Pool XY, Pool YZ and Pool ZA).

public entry fun swap_exact_output_triplehop<X, Y, Z, A>(
    sender: &signer,
    a_out: u64,
    x_max_in: u64,
) 

Swap Exact Input Quadruple Hop

Swap exact amount of tokenX to tokenB using 3 pools (Pool XY, Pool YZ, Pool ZA and Pool AB).

public entry fun swap_exact_input_quadruplehop<X, Y, Z, A, B>(
    sender: &signer,
    x_in: u64,
    b_min_out: u64,
)

Swap Exact Output Quadruple Hop

Swap tokenX to exact amount of tokenB using 3 pools (Pool XY, Pool YZ, Pool ZA and Pool AB).

public entry fun swap_exact_output_quadruplehop<X, Y, Z, A, B>(
    sender: &signer,
    b_out: u64,
    x_max_in: u64,
)

Public Functions

Swap Exact X to Y

Swap exact amount of tokenX to tokenY.

public fun swap_exact_x_to_y_direct_external<X, Y>(x_in: coin::Coin<X>): coin::Coin<Y> 

Input Values

Return Values

Swap X to Exact Y

Swap tokenX to the exact amount of tokenY.

public fun swap_x_to_exact_y_direct_external<X, Y>(x_in: coin::Coin<X>, y_out_amount:u64): (coin::Coin<X>, coin::Coin<Y>)

Input Values

Return Values

Get Amount In

The amount required in order to the the output amount.

public fun get_amount_in<X, Y>(y_out_amount: u64): u64

Input Values

Return Values

最后更新于