  We study Just-in-time (JIT) liquidity provision in blockchain-based
decentralized exchanges. A JIT liquidity provider (LP) monitors pending swap
orders in public mempools of blockchains to sandwich orders of their choice
with liquidity, depositing right before and withdrawing right after the order.
Our game-theoretic model with asymmetrically informed agents reveals that a JIT
LP's presence does not always enhance liquidity pool depth, as one might
expect. While passive LPs face adverse selection by informed arbitrageurs, a
JIT LP's ability to detect pending orders for toxic order flow prior to
liquidity provision lets them avoid being adversely selected. JIT LPs thus only
provide liquidity to uninformed orders and crowd out passive LPs when order
volume is not sufficiently elastic to pool depth, possibly reducing overall
market liquidity. We show that using a two-tiered fee structure which transfers
a part of a JIT LP's fee revenue to passive LPs or allowing for JIT LPs to
compete \`{a} la Cournot are potential solutions to mitigate the negative
effects of JIT liquidity.
