<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b54b0a68-39c7-4c2b-be53-44707229d25b/Plenty_Liquidity_Provider_Token.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b54b0a68-39c7-4c2b-be53-44707229d25b/Plenty_Liquidity_Provider_Token.png" width="40px" /> The Plenty Automated Market Maker (AMM) is designed for exchanging both FA1.2 and FA2 tokens on the Tezos blockchain. The smart contracts allow users to trade trustlessly, peer-to-peer, with liquidity that is supplied by other users. The architecture is based on Uniswap V2.

</aside>

Unlike traditional orderbook-based exchanges, where buyers and sellers cross the bid-ask spread to execute trades and determine asset prices, Automated Market Makers (AMM) are a type of decentralized exchange composed of “smart contract-liquidity pools that hold (at least) two crypto assets in reserve and allow anyone to deposit tokens of one type and thereby to withdraw tokens of the other type (aka a 'swap')."

figure 1

figure 1

Trading

Each pool is defined by a smart contract that includes a few functions to enable swapping tokens, adding liquidity, and more. At its core, each pool uses the function $x * y = k$ to maintain a curve along which trades can happen. For example, $x = tokenABC$, $y = tokenXYZ$, and $k = constant$. During each trade, a certain amount of one token is removed from the pool for an amount of the other token. To maintain $k$, the balances held by the smart contract are adjusted during the execution of the trade, thereby changing the token price. This also means that the exchange rates are coupled to the trade size; larger trades will be executed at less favorable rates than smaller trades, depending on the total amount of reserves (liquidity) in the pools of the trading pair. The smart contracts maintaining the pools keep track of the reserves by updating them every single time someone trades. Because the reserves are automatically rebalanced, a Plenty liquidity pool can always be used to buy or sell a token without requiring a counterparty on the other side of a trade.

Token prices

Considering that the equation  $x * y = k$ must hold, when someone executes a trade, we get $(x + Δx) · (y + Δy) = k$. It can then be easily shown that $Δy = (k/x + Δx) – y$. Consequently, $Δy$ will assume negative values for any $Δx > 0$. In fact, any exchange corresponds to a move on a convex token reserve curve, which is shown in Figure 1. Liquidity pool using this model cannot be depleted, as tokens will get more expensive with lower reserves. When the token supply of either one of the two tokens approaches zero, its relative price rises infinitely as a result.

Figure 1

Figure 1

The token prices coupled to a trading pair can only be changed through trading, hence divergences between the price on Plenty and external prices create arbitrage opportunities. This mechanism ensures that token prices on Plenty always balance out towards the market-clearing price.

Fees

The trading fee is set at 0.35%, out of which 0.25% is added to the liquidity pools as rewards for the liquidity providers, while the other 0.1% is used as rewards for the next iteration of PLENTY staking. As a result, each trade actually increases $k$. This functions as a payout to LPs, which is realized when they burn their pool tokens to withdraw their portion of total reserves.


Liquidity

It is important to point out that smart contract-based liquidity pools are not reliant on external price feeds (so-called “oracles”). Whenever the market price of an asset shifts, anyone can use the arbitrage opportunity and trade tokens with the smart contract until the liquidity pool price converges to the current market price. The implicit bid/ask spread of the constant product model (plus a trading fee) may lead to the accumulation of additional funds.

To provide liquidity, two equal parts of a token pair are supplied. In return, the liquidity providers receive Plenty Liquidity Provider (PLP) tokens, that allow them to participate in this accumulation and to redeem these tokens for their share of a potentially growing liquidity pool. Liquidity providers earn 0.25% trading fee for each swap in the liquidity pool. Liquidity provision results in a growing k and is visualized in Figure 3.

Figure 3

Figure 3


Yield Farming