Multi Token Support

Input Tokens

Note: Only token0 and token1 are supported as input tokens on every swap!

Output Tokens

If funds are meant to be stored in the pool (sovereignVault == address(this)): * Only token0 and token1 are supported as output token on swaps.

Else:

Sovereign Pool can support any output token on swaps. To check supported tokens, anyone can call getTokens function in Sovereign Pool, which provides relevant information for multi-hop swaps, having the Sovereign Pool as the entry point.

Example of a multi-hop swap:

  • There are two Sovereign Pools, A and B, with token0 and token1, and token1 and token2, respectively.

  • Each pool has a different Liquidity Module , LM A and LM B, both sharing the same sovereignVault

  • A swap for token0 -> token2 can start in pool A, since input token token0 belongs to pool A.

    • pool A queries LM A.

    • LM A understands that tokenOut is token2

    • LM A then query LM B to price the token1 -> token2

    • LM A now has a price for token0 -> token1 -> token2

  • sovereignVault approves pool A to transfer the appropriate amount of token2 to the user

    • pool A transfers the appropriate amount of token0 from the user to sovereignVault and transfers the appropriate amount of token2 from sovereignVault to the user.

    • pool A optionally makes a callback to update the state of LM A and LM B postswap.

This can be done in a coordinated way where LM A and LM B are able to safely update their respective reserves in sovereignVault, but the intermediate swap leg does not need a token transfer.

At the end of this process, pool A would be able to transfer token0 from the user into sovereignVault, and sovereignVault would have approved pool A to transfer due amount of output token token2 from itself to the recipient.

This achieves the same benefits that Singleton centric designs yield for multi-hop swaps, except that it is done through a different architecture that allows multiple Sovereign Pools and Liquidity Modules to decide what kind of vault they want to share. Note that the goal was to make multi-hop swaps possible through the Sovereign Pool architecture with custom sovereignVault, Valantis Labs has not yet released an implementation of a Singleton-like sovereignVault.

Last updated