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
andB
, withtoken0
andtoken1
, andtoken1
andtoken2
, respectively.Each pool has a different Liquidity Module ,
LM A
andLM B
, both sharing the samesovereignVault
A swap for
token0 -> token2
can start inpool A
, since input tokentoken0
belongs topool A
.pool A
queriesLM A
.LM A
understands thattokenOut
istoken2
LM A
then queryLM B
to price thetoken1 -> token2
LM A
now has a price fortoken0 -> token1 -> token2
sovereignVault
approvespool A
to transfer the appropriate amount oftoken2
to the userpool A
transfers the appropriate amount oftoken0
from the user tosovereignVault
and transfers the appropriate amount oftoken2
fromsovereignVault
to the user.pool A
optionally makes a callback to update the state ofLM A
andLM 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