Swappers

Swappers are a contract that allows users to perform a swap as part of the series of operation they bundle together when they 'cook' a transaction with Abracadabra. It is often used in 3 contexts: Leverage, Deleverage and Liquidations, to swap collateral and MIM.
While the freedom that cauldrons gives the user in terms of callable contracts would enable them to call any decentralize exchange, swappers are contracts that facilitate this process, standardizing the calls to be made.
Early Swappers hardcoded a route, using a Curve Pool or a UniV2-like DEX, while SwapperV2 support DEX Aggregators and augment the possibilities and adaptability of the system.
Here are the 2 interfaces Swappers can conform to. V2 added a 'data' parameter to be given to the dex aggregator in order to perform swaps in any arbitrary route.

ISwapperV1

interface ISwapper {
/// @notice Withdraws 'amountFrom' of token 'from' from the BentoBox account for this swapper.
/// Swaps it for at least 'amountToMin' of token 'to'.
/// Transfers the swapped tokens of 'to' into the BentoBox using a plain ERC20 transfer.
/// Returns the amount of tokens 'to' transferred to BentoBox.
/// (The BentoBox skim function will be used by the caller to get the swapped funds).
function swap(
IERC20 fromToken,
IERC20 toToken,
address recipient,
uint256 shareToMin,
uint256 shareFrom
) external returns (uint256 extraShare, uint256 shareReturned);

ISwapperV2

interface ISwapperV2 {
/// @notice Withdraws 'amountFrom' of token 'from' from the BentoBox account for this swapper.
/// Swaps it for at least 'amountToMin' of token 'to'.
/// Transfers the swapped tokens of 'to' into the BentoBox using a plain IERC20 transfer.
/// Returns the amount of tokens 'to' transferred to BentoBox.
/// (The BentoBox skim function will be used by the caller to get the swapped funds).
function swap(
address fromToken,
address toToken,
address recipient,
uint256 shareToMin,
uint256 shareFrom,
bytes calldata data
) external returns (uint256 extraShare, uint256 shareReturned);
}