Owners: @Giacomo Pasini @David Rusu
Reviewers: 🟢@Álvaro Castro-Castilla 🟨@Thomas Lavaur
This documents presents the findings of trying to create a Nomos zone as close as possible to Uniswap V2, from difficulties arising from using UTxOs to quirks in our architecture.
Uniswap V2 is a Automated Market Maker (AMM), a system that allows users to trade on different assets by regulating prices algorithmically. Anybody can contribute liquidity to the protocol and earn fees.
The central operation is a SWAP, a trade on some currency pair. Each currency pair has some associated liquidity (called a pool), where reserves of both currencies are held. The price for a swap is automatically determined based on the balances of each currency according the following formula
$$ (x_{1} − 0.003 · x_{in})) · y_1 >= x_0 · y_0 $$
where:
This design allows an user to become a liquidity provider (LP) by depositing his funds into a pair, this allows the user to passively provide a market making service while collecting fees from each swap.
The details around how LP’s and fee distribution works has been removed from the scope of this PoC. Instead we will focus on the SWAP operation
We will focus on the main components of the Uniswap Zone: