We use microeconomic theory to describe the inner workings of Constant Function Market Makers (CFMMs). We show that standard results from consumer theory apply in this new context, endowing us with powerful tools to characterize the optimal design of CFMMs. We employ them to analyze the externalities that traders and liquidity providers exert on each other when interacting through a CFMM. Liquidity providers reduce the execution costs by flattening the bonding curve on which trades are executed. Arbitrageurs impose an adverse selection cost on liquidity providers by unfavorably rebalancing their portfolio. We show that the strengths of these two externalities are pinned down by the curvature of the bonding curve and are inversely related to each other, thereby identifying the fundamental economic tradeoff that market designers have to address.