pub fn sell_asset<T: Config>(
    sold_asset_id: CurrencyIdOf<T>,
    bought_asset_id: CurrencyIdOf<T>,
    sold_asset_amount: BalanceOf<T>,
    min_amount_out: BalanceOf<T>
)
Expand description

Executes sell_asset swap. First the swap is prevalidated, if it is successful then the extrinsic is accepted. Beyond this point the exchange commission will be charged. The sold amount of the sold asset is used to determine the bought asset amount. If the bought asset amount is lower than the min_amount_out then it will fail on slippage. The percentage exchange commission is still charged even if the swap fails on slippage. Though the swap itself will be a no-op. The slippage is calculated based upon the sold_asset_amount. Upon slippage failure, the extrinsic is marked “successful”, but an event for the failure is emitted

Args:

  • sold_asset_id - The token being sold
  • bought_asset_id - The token being bought
  • sold_asset_amount: The amount of the sold token being sold
  • min_amount_out - The minimum amount of bought asset that must be bought 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::sell_asset.