Example: barber

Uniswap v3 Core

Uniswap v3 CoreMarch 2021 Hayden v3is a noncustodial automated market maker imple-mented for the Ethereum Virtual Machine. In comparison to earlierversions of the protocol, Uniswap v3provides increased capitalefficiency and fine-tuned control to liquidity providers, improvesthe accuracy and convenience of the price oracle, and has a moreflexible fee INTRODUCTIONA utomated market makers (AMMs) are agents that pool liquidityand make it available to traders according to an algorithm [5]. Con-stant function market makers (CFMMs), a broad class of AMMs ofwhichUniswapis a member, have seen widespread use in the con-text of decentralized finance, where they are typically implementedas smart contracts that trade tokens on a permissionless blockchain[2].

Uniswap v3 Core March 2021 Hayden Adams hayden@uniswap.org Noah Zinsmeister noah@uniswap.org Moody Salem moody@uniswap.org River Keefer river@uniswap.org

Tags:

  Uniswap

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Uniswap v3 Core

1 Uniswap v3 CoreMarch 2021 Hayden v3is a noncustodial automated market maker imple-mented for the Ethereum Virtual Machine. In comparison to earlierversions of the protocol, Uniswap v3provides increased capitalefficiency and fine-tuned control to liquidity providers, improvesthe accuracy and convenience of the price oracle, and has a moreflexible fee INTRODUCTIONA utomated market makers (AMMs) are agents that pool liquidityand make it available to traders according to an algorithm [5]. Con-stant function market makers (CFMMs), a broad class of AMMs ofwhichUniswapis a member, have seen widespread use in the con-text of decentralized finance, where they are typically implementedas smart contracts that trade tokens on a permissionless blockchain[2].

2 CFMMs as they are implemented today are often capital inef-ficient. In the constant product market maker formula used byUniswap v1andv2, only a fraction of the assets in the pool areavailable at a given price. This is inefficient, particularly whenassets are expected to trade close to a particular price at all attempts to address this capital efficiency issue, such asCurve [3] and YieldSpace [4], have involved building pools that usedifferent functions to describe the relation between reserves. Thisrequires all liquidity providers in a given pool to adhere to a singleformula, and could result in liquidity fragmentation if liquidityproviders want to provide liquidity within different price this paper, we presentUniswap v3, a novel AMM that givesliquidity providers more control over the price ranges in whichtheir capital is used, with limited effect on liquidity fragmentationand gas inefficiency.

3 This design does not depend on any sharedassumption about the price behavior of the v3is based on the same constant product reserves curve as earlierversions [1], but offers several significant new features: Concentrated Liquidity: Liquidity providers (LPs) are giventhe ability to concentrate their liquidity by bounding" itwithin an arbitrary price range. This improves the pool scapital efficiency and allows LPs to approximate their pre-ferred reserves curve, while still being efficiently aggregatedwith the rest of the pool. We describe this feature in section2 and its implementation in Section 6. Flexible Fees: The swap fee is no longer locked , the fee tier for each pool (of which there can bemultiple per asset pair) is set on initialization (Section ).

4 The initially supported fee tiers , , and1%.UNIgovernance is able to add additional values to this set. Protocol Fee Governance:UNIgovernance has more flexibilityin setting the fraction of swap fees collected by the protocol(Section ). Improved Price Oracle: Uniswap v3provides a way for usersto query recent price accumulator values, thus avoiding theneed to checkpoint the accumulator value at the exact be-ginning and end of the period for which a TWAP is beingmeasured. (Section ).1 Hayden Adams, Noah Zinsmeister, Moody Salem, River Keefer, and Dan Robinson Liquidity Oracle: The contracts expose a time-weighted av-erage liquidity oracle (Section ).

5 TheUniswap v2core contracts are non-upgradeable by de-sign, soUniswap v3is implemented as an entirely new set ofcontracts, available here. TheUniswap v3core contracts are alsonon-upgradeable, with some parameters controlled by governanceas described in Section CONCENTRATED LIQUIDITYThe defining idea ofUniswap v3is that ofconcentrated liquidity:liquidity bounded within some price earlier versions, liquidity was distributed uniformly along the = ( )reserves curve, where and are the respective reserves of twoassetsXandY, and is a constant [1]. In other words, earlier ver-sions were designed to provide liquidity across the entire pricerange(0, ).

6 This is simple to implement and allows liquidity tobe efficiently aggregated, but means that much of the assets held ina pool are never considered this, it seems reasonable to allow LPs toconcentrate their liquidity to smaller price ranges than(0, ). Wecall liquidity concentrated to a finite range aposition. A positiononly needs to maintain enough reserves to support trading withinits range, and therefore can act like a constant product pool withlarger reserves (we call these thevirtual reserves) within that range. real realXReservesYReservesvirtual reservesFigure 1: Simulation of Virtual LiquiditySpecifically, a position only needs to hold enough of assetXtocover price movement to its upper bound, because upwards pricemovement1corresponds to depletion of theXreserves.

7 Similarly,it only needs to hold enough of assetYto cover price movementto its lower bound. Fig. 1 depicts this relationship for a position ona range[ , ]and a current price [ , ]. realand realdenote the position s real the price exits a position s range, the position s liquidityis no longer active, and no longer earns fees. At that point, its1We take assetYto be the unit of account, which corresponds totoken1in is composed entirely of a single asset, because the reservesof the other asset must have been entirely depleted. If the price everreenters the range, the liquidity becomes active amount of liquidity provided can be measured by the value , which is equal to.

8 The real reserves of a position are describedby the curve:( + )( + )= 2( )This curve is a translation of formula such that the position issolvent exactly within its range (Fig. 2). XReservesYReservesvirtual reserves ( )real reserves ( )Figure 2: Real ReservesLiquidity providers are free to create as many positions as theysee fit, each on its own price range. In this way, LPs can approximateany desired distribution of liquidity on the price space (see Fig. 3for a few examples). Moreover, this serves as a mechanism to letthe market decide where liquidity should be allocated. Rational LPscan reduce their capital costs by concentrating their liquidity ina narrow band around the current price, and adding or removingtokens as the price moves to keep their liquidity Range OrdersPositions on very small ranges act similarly to limit orders if therange is crossed, the position flips from being composed entirelyof one asset, to being composed entirely of the other asset (plusaccrued fees).

9 There are two differences between thisrange orderand a traditional limit order: There is a limit to how narrow a position s range can the price is within that range, the limit order mightbe partially executed. When the position has been crossed, it needs to be with-drawn. If it is not, and the price crosses back across thatrange, the position will be traded back, effectively reversingthe v3 Core0 PriceLiquidity(I) Uniswap v2 PriceLiquidity(II)A single position on[ , ]PriceLiquidity(III)A collection of custom positionsFigure 3: Example Liquidity Distributions3 ARCHITECTURAL CHANGESU niswap v3makes a number of architectural changes, some ofwhich are necessitated by the inclusion of concentrated liquidity,and some of which are independent Multiple Pools Per PairInUniswap v1andv2, every pair of tokens corresponds to a singleliquidity pool, which applies a uniform fee all this default fee tier historically worked well enough for manytokens, it is likely too high for some pools (such as pools betweentwo stablecoins), and too low for others (such as pools that includehighly volatile or rarely traded tokens).

10 Uniswap v3introduces multiple pools for each pair of tokens,each with a different swap fee. All pools are created by the samefactory contract. The factory contract initially allows pools to becreated at three fee , , and1%. Additional fee tierscan be enabled by UNI Non-Fungible Non-Compounding earned in earlier versions werecontinuously deposited in the pool as liquidity. This meant thatliquidity in the pool would grow over time, even without explicitdeposits, and that fee earnings v3, due to the non-fungible nature of positions, thisis no longer possible. Instead, fee earnings are stored separatelyand held as the tokens in which the fees are paid (see Section ).


Related search queries