Architecture
Fee Payout Race

Protocol Fee Payout Race

As covered in the architecture overview section, if Uniswap Governance upgrades to the system described in this documentation, it will maintain its ability to turn on protocol fees for individual Uniswap V3 pools. If fees are collected, they will be distributed as rewards to stakers.

This section describes the system's intended design. The system has not yet been deployed or adopted by Uniswap Governance.

Fees accrue on Uniswap V3 Pools in both of the tokens that makeup the pool's pair. The question, then, is how to distribute fee rewards to stakers without requiring them to transfer and collect fees in dozens or even hundreds of different tokens.

Payout Race

The V3FactoryOwner contract implements a simple "payout race" mechanism to convert fees in disparate tokens across many pools into discrete chunks of rewards denominated in a single token which can be distributed to stakers. It accomplishes this by:

  • Specifying a fixed quantity of a single token as the "payout amount (opens in a new tab)"
  • Allowing anyone to claim the protocol fees which have accrued in a given pool, as long as they provide the UniStaker contract with the payout amount for rewards distribution.

This sets up a scenario by which any network participant—such as arbitragers and MEV searchers—race to claim fees in exchange for providing the reward payout when it becomes profitable to do so for a given pool. This operation is executed by the claimFees (opens in a new tab) method.

Payout Sequence

Governance enables protocol fees on a pool

After a successful governance proposal, protocol fees are enabled on one or more particular Uniswap V3 Pools.

Fees accrue in each token as swaps execute

Users of the Uniswap protocol execute swaps against the pool(s) with protocol fees enabled. Fees accrue in the pool in both tokens that make up the pool's pair.

The payout becomes profitable for a pool

As fees collect in the pool, and token prices fluctuates, it eventually becomes the case that the fees which have accrued in a given pool are collectively worth more than the payout amount of the payout token.

MEV searchers race to perform payout

Once profitable for a given pool, it is presumed that bots and searchers will race to collect the fees and perform the rewards payout to the UniStaker contract.

UniStaker distributes rewards to stakers

The UniStaker contract updates the reward rate to reflect the rewards provided by the arbitrager that claimed the fees from the pool. The rewards begin streaming to stakers immediately.

Incentives Example

A quick example can help illustrate why an external party, such as an MEV searcher, would be incentivized to participate in the fee payout race.

Imagine, purely for the sake of example, that protocol fees have been activated for the USDC/USDT stablecoin V3 Pool. Imagine also the payout token and payout amount are WETH and 10 respectively. Finally, assume the spot USD price of ETH is $2,500, and both stablecoins are trading at their $1 peg.

As regular users swap against the USDC/USDT pool, protocol fees amass in the pool contract in both stablecoins. Once the fees in the pool total more than 25,000 in stablecoins, it becomes profitable for an external party to arbitrage the fees by calling this method, paying 10 WETH (worth $25K) and getting more than $25K worth of stablecoins.

This example ignores additional details, which real searchers would take into consideration, such as the gas/builder fee they would pay to call the method.

Degenerate Cases

The payout race, while simple does have some degenerate cases. While none of the issues described prevent the mechanism from being used if properly configured, understanding them can help mitigate their impact.

Relative Price Changes of the Payout Token

The token used for rewards payouts is immutable. As the price of payout token changes relative to the tokens in a give pool, certain adverse effects emerge.

  • If the payout token price rises relative to fee tokens, fees are rarely or never collected
  • If the payout token price drops relative to fee tokens, fees may be collected so frequently that value is leaked when a large trade puts a pool substantially over the value of the required payout amount

Discrete Changes to the Payout Amount

To mitigate the issues described above, the V3FactoryOwner contract allows Uniswap Governance to adjust the payout amount. However, a discrete change to the payout amount comes with its own (temporary) adverse effects.

  • An adjustment of the payout amount to a lower value means that the protocol potentially leaks value at the time of the transaction to change the reward amount, as searchers take advantage of a "bargain" on fees that have accrued to some value above the new payout amount.
  • An adjustment of the payout amount to a higher value could break or adversely impact the MEV bots who provide rewards by arbitraging fee collection. A naive or unlucky searcher could end up executing money losing payouts.