---
eip: 8017
label: ERC-8017
title: Payout Race
status: Draft
type: Standards Track
category: ERC
created: 2025-08-31
requires: 20
official: https://eips.ethereum.org/EIPS/eip-8017
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8017.md
canonical: https://eips.huatuo.xyz/eip-8017/
lang: en
tldr: "A draft minimal interface for a 'payout race': a contract that accumulates one asset and hands its entire balance to the first caller who pays a fixed price in another asset, useful for revenue buybacks."
tags: [defi, auction, buyback, erc20, erc]
---

# ERC-8017: Payout Race

> Minimal ERC for a single-asset payout bucket that vends its entire balance for a fixed payment amount.

**TL;DR:** A draft minimal interface for a 'payout race': a contract that accumulates one asset and hands its entire balance to the first caller who pays a fixed price in another asset, useful for revenue buybacks.

## What problem does it solve?

Protocols often need to keep converting a stream of income (fees, revenue) into another asset: buying back their own token, building a reserve, funding incentives. Routing that through an AMM exposes them to slippage, pool liquidity and fees; running continuous on-chain auctions is complex and gas-heavy.

ERC-8017 standardises a simpler primitive inspired by the Uniswap Foundation's Unistaker proposal. Value flows into a **bucket**. Anyone may pay a fixed **required payment** to take the **whole** bucket. As the bucket grows, it eventually becomes profitable to buy, so searchers compete to be first, which works somewhat like a Dutch auction.

## How it works

Each contract is configured with:

- `payoutAsset`: what the bucket holds (ETH if `address(0)`, else one ERC-20);
- `desiredAsset`: what buyers pay (ETH if `address(0)`, else one ERC-20);
- `requiredPayment`: fixed price, adjustable by an admin;
- `paymentSink`: where payments go (treasury, splitter, burn).

Rules:

1. Payout and desired asset **cannot both be ETH**, and neither may change after initialization.
2. `purchase(to)` reads the payout balance **at entry**, reverts if it is zero, collects exactly `requiredPayment` (as `msg.value` for ETH, or `transferFrom(msg.sender, paymentSink, requiredPayment)` for ERC-20), then sends the full captured balance to `to` and emits `Purchased`.
3. Admin setters for `requiredPayment` and `paymentSink` must be access-controlled and emit `PaymentConfigUpdated`.

Optional extras: `purchaseWithPermit` using [ERC-2612](/eip-2612/), and an admin `rescue` for assets other than the payout asset.

## Sample code

A searcher checking whether a race is worth winning, then buying (ethers v6):

```ts
import { Contract, ZeroAddress } from "ethers";

const race = new Contract(RACE, [
  "function payoutAsset() view returns (address)",
  "function desiredAsset() view returns (address)",
  "function requiredPayment() view returns (uint256)",
  "function purchase(address to) payable returns (uint256)",
], signer);

const [payout, desired, price] = await Promise.all([
  race.payoutAsset(), race.desiredAsset(), race.requiredPayment(),
]);
const bucket = payout === ZeroAddress
  ? await provider.getBalance(RACE)
  : await new Contract(payout, ["function balanceOf(address) view returns (uint256)"], provider)
      .balanceOf(RACE);

if (isProfitable(bucket, price)) {            // your own pricing logic
  if (desired === ZeroAddress) {
    await race.purchase(myAddress, { value: price });
  } else {
    // approve `price` of `desired` to RACE first (or use a permit helper)
    await race.purchase(myAddress);
  }
}
```

## Things to know

- **Status: Draft.**
- Works best when value trickles in. A large single deposit can push the bucket well past the price and hand the surplus to whoever buys first. If the payout asset rises in value relative to the payment asset, purchases may stall.
- Changing `requiredPayment` is risky: lowering it can give an instant bargain to searchers; raising it can strand bots. The spec suggests timelocks, announcement windows, cooldowns or TWAP-based adjustments.
- Anything sent to the contract in the payout asset, including unsolicited transfers, goes out with the next payout.
- Buyers race in the mempool, so expect MEV competition. The interface has no slippage parameter; a buyer cannot specify a minimum payout amount.
- Access control is left open; [EIP-173](/eip-173/) ownership is used in the reference. The spec's reference contract has a small naming typo (`payoutToken` in `receive`) and should not be deployed as-is.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-8017
