Euler’s current Swap module contains hard-coded support for swapping on 1inch and Uniswap3. In order to add new swapping methods, or improvements/optimisations to existing methods, new Swap module implementations must be created and deployed. This development cycle is slow, in part because the Swap module is executing in the context of the Euler contract so it is critical that it not have any vulnerabilities.
In order to speed the development process, Euler Labs has created a new module named SwapHub. This module delegates all the actual swapping logic to external contracts, called swap handlers. It works by transferring in the input token to the handler, and then invoking the handler with the user’s swapping parameters. The handler should perform a swap and then transfer the output token back to Euler, along with any remaining input token (if any). The SwapHub will then validate that the amounts received back satisfy the user’s swapping parameters (such as slippage), and if so, finalise the swap. With this design, a bug in a swap handler will not pose a threat to the core Euler protocol.
In addition to the new interface, the SwapHub development work has also created a general-purpose Uniswap router handler that can use both Uniswap2 and Uniswap3, and has improved the handling for rebasing tokens such as stETH.
This upgrade proposes to install the new SwapHub module, deploy the swap handlers, and to complete the UI features that will use this module.
Please use the snapshot link below to vote: