DFP-22: Single Asset Withdrawal V2

Header Content
Author Edson Ayllon (@relativeread)
Created 2022-3-16
Status Draft

Motivation

The current version of Single Asset Withdrawal (SAW) adds unneeded complexity to the Pool Logic contract when adding new integrations, as the core team has seen with Uniswap V3.

This new version of Single Asset Withdrawal will be layered on top of the Pool Logic, instead of resting inside of it, decreasing security concerns and increasing the speed of implementing new integrations.

This version also reduces the burden on managers created by the previous version of Single Asset Withdrawal. In SAW v1, a user could withdraw any token directly from the pool in accordance with their share, changing the pool composition in the process. SAW v2 works like regular withdrawal in that it does not change the pool composition.

Description

This version of Single Asset withdrawal will have the contracts receive the withdrawal assets first, swap them into a single asset, then send that single asset to the user withdrawing.

Implementation

The contract will be an upgraded version of what Toros uses for their withdrawal but adds compatibility for unwrapping LP tokens. This intermediary contract will be available for all dHEDGE pools. In the case of an unsupported integration, users may still withdraw directly from the pool contract.

Implementation will be rolled out in phases. In the first phase, only unwrapping of LP tokens will be done, no swapping into a single asset just yet. Once an on-chain router with sufficiently good prices (lower slippage) is developed, then swapping to a single asset will be rolled out.