  Decentralized exchanges (DEXs) provide a means for users to trade pairs of
assets on-chain without the need for a trusted third party to effectuate a
trade. Amongst these, constant function market maker DEXs such as Uniswap
handle the most volume of trades between ERC-20 tokens. With the introduction
of Uniswap v3, liquidity providers can differentially allocate liquidity to
trades that occur within specific price intervals. In this paper, we formalize
the profit and loss that liquidity providers can earn when providing specific
liquidity allocations to a v3 contract. We give a convex stochastic
optimization problem for computing optimal liquidity allocation for a liquidity
provider who holds a belief on how prices will evolve over time and use this to
study the design question regarding how v3 contracts should partition the price
space for permissible liquidity allocations. Our results show that making a
greater diversity of price-space partitions available to a contract designer
can simultaneously benefit both liquidity providers and traders.
