Diamond and Dybvig (1983) show that while demand–deposit contracts let banks provide liquidity, they expose them to panic-based bank runs. However, their model does not provide tools to derive the probability of the bank-run equilibrium, and thus cannot determine whether banks increase welfare overall. We study a modified model in which the fundamentals determine which equilibrium occurs. This lets us compute the ex ante probability of panic-based bank runs and relate it to the contract. We find conditions under which banks increase welfare overall and construct a demand–deposit contract that trades off the benefits from liquidity against the costs of runs.