This method allows the caller to swap assets using the provided pool. The swapped amount is sent to the caller's address. The following interfaces can be used to call the method, with the arguments described below:
Interfaces
public entry fun swap_assets<CoinTypeA, CoinTypeB>(
clock: &Clock,
protocol_config: &GlobalConfig,
pool: &mut Pool<CoinTypeA, CoinTypeB>,
coin_a: Coin<CoinTypeA>,
coin_b: Coin<CoinTypeB>,
a2b: bool,
by_amount_in: bool,
amount: u64,
amount_limit: u64,
sqrt_price_max_limit: u128,
ctx: &mut TxContext) {
abort 0
}
/// Parameters:
/// - clock : Sui clock object
/// - protocol_config : The `config::GlobalConfig` object used for version verification
/// - pool : Mutable reference to the pool on which to perform swap
/// - coin_a : The coin A object. It will be ZERO if swapping from b2a
/// - coin_b : The coin B object. It will be ZERO if swapping from a2b
/// - a2b : True if direction of swap is from token A to B
/// - by_amount_in : True if the provided amount is the amount of input token
/// - amount : The input/output amount of token
/// - amount_limit : The max amount of input token to be used or the min amount of output tokens expected from swap
/// - sqrt_price_max_limit : The max price limit to hit during swap ( Max slippage )
/// - ctx : Murable reference to caller's transaction context
///
/// Events Emitted : AssetSwap