Swaps
Directory: src/Swaps
Utilities for performing DEX swaps for EVK credit vault operations.
The Swapper
and SwapVerifier
contracts are helper contracts designed to facilitate swaps and swap-to-repay operations on EVK vaults using EVC batches. A swap operation in Euler is executed through two consecutive calls to these contracts within an EVC batch.
Swapper
The Swapper
contract is provided with tokens to sell, either by withdrawing from a collateral vault or by borrowing. It can then execute multiple external calls to arbitrary contracts, most often DEXs, to carry out the trade. The Swapper contract functions as a black box and does not guarantee that the trade will be executed as requested. It can be replaced at any time without requiring an audit. The system's security is ensured by the SwapVerifier
contract.
SwapVerifier
Executing token swaps can be complex, but verifying them is straightforward. Given a specific amount of a token to sell, verifying a trade's correctness requires only confirming that the amount of the purchased token matches the quoted amount or falls within an acceptable slippage range. In Euler, this verification responsibility is delegated to the SwapVerifier
contract, which, unlike the Swapper
, is a trusted and fully audited contract.
More information
For a general overview of swaps in Euler and links to technical resources, please refer to the Swaps section