Swap
Swap functions use the liquidity available to trade one token with another
#[payable("*")]
#[endpoint(swap)]
fn swap(
&self,
first_token: TokenIdentifier,
second_token: TokenIdentifier,
opt_min_out: OptionalValue<BigUint>,
)
first_token will always be MID token and second_token indicate what liquidity to use.
Payment token can be first or second token.
opt_min_out (slippage) : is an optionnal value where user can indicate the minimum amount of token he want to receive. We will use this to set the slippage tolerance
#[payable("*")]
#[endpoint(dualSwap)]
fn dual_swap(
&self,
first_token: TokenIdentifier,
second_token: TokenIdentifier,
opt_min_out: OptionalValue<BigUint>,
)
first token and second token must be in the "swaped_tokens" list
Last updated