A token conservation test for preventing unfair surplus shifting

As a follow-up observation, and the credit for this observation goes to @tbosman who communicated this to me, the above “attack” actually is a result of just Uniform Clearing Prices (UCP) and global token conservation! In other words, the example described above happens exactly as is, even without enforcing local token conservation.

To see this, note that because of UCP, we have r(o1) = 1 / r(o2). Moreover, due to global token conservation, we have:

  • amount_o1_sells = amount_o2_buys + amount_Uniswap_buys

  • amount_o1_buys = amount_o2_sells + amount_Uniswap_sells

Thus, we have

amount_Uniswap_sells = amount_o1_buys - amount_o2_sells
= amount_o1_buys - r(o2) * amount_o2_buys

and

amount_Uniswap_buys = amount_o1_sells - amount_o2_buys
= r(o1) * amount_o1_buys - amount_o2_buys

Putting everything together, we get that r(Uniswap) = r(o2).

I still think that one can construct more involved examples where the above phenomenon is caused by local token conservation and not just global and UCPs, but I don’t have any such concrete example yet.

Since I think that global token conservation is natural to ask here, this, in my opinion, actually shows some of the limitations of UCP.

1 Like