Function pallet_xyk::pallet::dispatchables::multiswap_buy_asset
source · pub fn multiswap_buy_asset<T: Config>(
swap_token_list: Vec<CurrencyIdOf<T>>,
bought_asset_amount: BalanceOf<T>,
max_amount_in: BalanceOf<T>
)
Expand description
Executes a multiswap buy asset in a series of buy asset atomic swaps.
Multiswaps must fee lock instead of paying transaction fees.
First the multiswap is prevalidated, if it is successful then the extrinsic is accepted and the exchange commission will be charged upon execution on the first swap using max_amount_in. multiswap_buy_asset cannot have two (or more) atomic swaps on the same pool. multiswap_buy_asset prevaildation only checks for whether there are enough funds to pay for the exchange commission. Failure to have the required amount of first asset funds will result in failure (and charging of the exchange commission).
Upon failure of an atomic swap or bad slippage, all the atomic swaps are reverted and the exchange commission is charged. Upon such a failure, the extrinsic is marked “successful”, but an event for the failure is emitted
Args:
swap_token_list
- This list of tokens is the route of the atomic swaps, starting with the asset sold and ends with the asset finally boughtbought_asset_amount
: The amount of the last asset boughtmax_amount_in
- The maximum amount of first asset that can be sold in order to not fail on slippage. Slippage failures still charge exchange commission.
Warning: Doc-Only
This function is an automatically generated, and is doc-only, uncallable
stub. See the real version in
Pallet::multiswap_buy_asset
.