ERC-8017 · Draft · ERC · 2025-08-31
ERC-8017: Payout Race
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 ifaddress(0), else one ERC-20);desiredAsset: what buyers pay (ETH ifaddress(0), else one ERC-20);requiredPayment: fixed price, adjustable by an admin;paymentSink: where payments go (treasury, splitter, burn).
Rules:
- Payout and desired asset cannot both be ETH, and neither may change after initialization.
purchase(to)reads the payout balance at entry, reverts if it is zero, collects exactlyrequiredPayment(asmsg.valuefor ETH, ortransferFrom(msg.sender, paymentSink, requiredPayment)for ERC-20), then sends the full captured balance totoand emitsPurchased.- Admin setters for
requiredPaymentandpaymentSinkmust be access-controlled and emitPaymentConfigUpdated.
Optional extras: purchaseWithPermit using ERC-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):
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
requiredPaymentis 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 ownership is used in the reference. The spec's reference contract has a small naming typo (
payoutTokeninreceive) and should not be deployed as-is.