• © Goverland Inc. 2026
  • Privacy Policy
  • Terms of Use
EulerEulerby0x13214Af5a958E47D0FA1366fC3D36dC3Fa46E80f0x1321…E80f

eIP 21: Deploy SwapHub module and swap handlers

Voting ended over 3 years agoSucceeded

Motivation

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.

Implementation

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.

Conclusion

This upgrade proposes to install the new SwapHub module, deploy the swap handlers, and to complete the UI features that will use this module.

Resources:

  • SwapHub documentation
  • SwapHub pull request
  • Omniscia audit

Off-Chain Vote

Yes
14.02K EUL100%
No
0.66 EUL0%
Quorum:140%
Download mobile app to vote

Discussion

EulereIP 21: Deploy SwapHub module and swap handlers

Timeline

Oct 10, 2022Proposal created
Oct 10, 2022Proposal vote started
Oct 16, 2022Proposal vote ended
Oct 26, 2023Proposal updated