In Gnosis Protocol v2, we are aiming at integrating different on-chain liquidity sources, starting with Uniswap. This topic is around what Uniswap price our quoted clearing price should refer to.
Let’s start with a simple scenario for illustration:
consider the Uniswap pool ETH-DAI that has a current spot price
p_uni_curr = 500 [DAI per ETH]
assume a trader wants to buy 1 ETH (leaving limit prices aside for now)
Now, if the trader goes to Uniswap, they need to spend, say, 510 DAI to buy 1 ETH, which means the effective price is
p_uni_eff = 510 [DAI per ETH].
However, this trade moves the Uniswap to a new spot price of
p_uni_new ~= 520 [DAI per ETH].
The question is if the quoted price of GPv2 should refer to
Option 1 – effective Uniswap price
[+] The user is guaranteed to receive a price “at least as good” Uniswap, hence this approach is well suited in a version that does not integrate other liquidity sources.
[+] The quoted GPv2 clearing price holds for all items in the solution (limit orders + Uniswap). A trader might not be particularly interested in the a-posteriori state of the Uniswap pool.
[–] Moving the new Uniswap spot price beyond the clearing price might immediately result in trades “in the other direction” in the next batch (e.g., if a trader wants to sell ETH @ 515 [DAI per ETH]).
Option 2 – new Uniswap spot price
[+] When the batch is cleared and there are no new incoming orders, there will also no be any feasible trade in the subsequent batch.
[–] The user pays a higher price than they would directly on Uniswap (i.e., 520 [DAI per ETH]).
[?] In a protocol version with a wide variety of liquidity integrations, the order by the user will likely be matched against another source at a significantly better price than the new Uniswap spot price.
[?] Uniswap receives less than our quoted price (i.e., only 510 instead of 520 [DAI per ETH]), so the uniform clearing price does only hold for regular limit orders. However, this creates a surplus of 10 DAI in the protocol that can be used in various ways (e.g., return to affected trader, distribute to all traders, keep as buffer, keep as revenue, …)
[+] The argument is even stronger for potential prediction market tokens, where a trader associates a personal likelihood estimate with a limit price (i.e., if the trader judges the likelihood of an even to be at 80%, they set their limit price to 0.80 and don’t want the AMM to move beyond 80%).