---
# System prepended metadata

title: Untitled

---

## Liquidity proxy batch swap

`swap_transfer_batch` makes swap of `input_asset_id` to sum of `target_amount`s of `receivers` of `output_asset_id` and transfer `target_amount` of `output_asset_id` to receivers

For example 
```
swap_transfer_batch(
 [
   {account_id: bob(), target_amount: 100.0},
   {account_id: charlie(), target_amount: 150.0},
 ],
 0,
 0x0200080000000000000000000000000000000000000000000000000000000000,
 0x0200060000000000000000000000000000000000000000000000000000000000
 250.0,
 [
   LiquiditySourceType::PoolXYK,
 ],
 FilterMode::Disabled
).sign_by(alice())
```

```rust
pub struct BatchReceiverInfo<T: Config> {
    // Receiver account id
    pub account_id: T::AccountId,
    // Amount of output_asset_id to be transferred to receiver
    pub target_amount: Balance,
}

pub fn swap_transfer_batch(
    origin: OriginFor<T>,
    // Receivers array
    receivers: Vec<BatchReceiverInfo<T>>,
    // 0 - Polkaswap, 1 - PolkaswapXSTUSD
    dex_id: T::DEXId,
    input_asset_id: T::AssetId,
    output_asset_id: T::AssetId,
    // Upper bound for input asset. 
    // If swap require more tokens function return error
    max_input_amount: Balance,
    selected_source_types: Vec<LiquiditySourceType>,
    filter_mode: FilterMode,
)
```
