Skip to main content
ClankerSniperAuctionV0 is a MEV module that lets snipers bid for the right to make the next swap on a freshly deployed pool, with the proceeds going mostly to the token’s reward recipients.

Overview

At deployment, up to 5 auctions can run per pool, one every 2 blocks. If an auction block passes without any valid bids, the auction is disabled and normal swaps can go through. The original design doc is on HackMD. These contracts are part of the setup:

How it works

The auction relies on Base using priority ordering, which places transactions with higher gas fees first. Each time the auction resets, the module records the gas price and uses an inflated version as the auction’s starting gas price. The WETH payment is a multiple of the difference between the winning transaction’s gas price and the inflated gas price. The inflated gas price, next auction block and current auction round can be read from the contract and are easy to replicate off-chain. Auction payments are split 80/20 between the token’s reward recipients and the Clanker factory.

Auction configuration

These auction configuration variables matter to snipers: All of these can be queried on the ClankerSniperAuctionV0 contract, and the Clanker team can change them with advance notice.

Auction state

These auction state variables matter to snipers and can be queried per PoolId:

Auction events

These events matter to snipers and are emitted by the ClankerSniperAuctionV0 contract:

Example auction round

A pool is deployed in block 1 with a base fee of 10 gwei. The first auction round happens in block 3 with a starting auction gas price of 12 gwei. Three snipers try to snipe:
  • Sniper A sets their transaction gas price to 13 gwei, approves a WETH payment of 0.0001 ether and lands in block 3.
  • Sniper B sets their transaction gas price to 15 gwei, approves a WETH payment of 0.0003 ether and lands in block 3.
  • Sniper C sets their transaction gas price to 17 gwei, approves a WETH payment of 0.0005 ether and lands in block 4.
Result: Sniper B wins, because Sniper C landed in the wrong block. The auction module uses block 3’s actual gas price of 11 gwei to set round 2’s starting gas price to 13 gwei, with bids accepted in block 5. The first auction parameters set by the Clanker team put 2 blocks between deployment and the first auction, and 2 blocks between subsequent auctions. These may change as Clanker gathers more data on the auction’s performance.

ClankerSniperUtilV0 contract

The ClankerSniperUtilV0 contract is a shared utility for snipers to bid in auctions, and a user-facing example of how bidding works. It handles approval spending, round management and encoding the auction swap’s hook data. Snipers are welcome to rewrite and redeploy the utility themselves, since it’s auxiliary to the auction.

Example usage

Approving ClankerSniperAuctionV0 to spend WETH

Clanker does not recommend approving ClankerSniperAuctionV0 to spend WETH unless an auxiliary contract handles the approval and reverts if the bid doesn’t win. For example, if an EOA approves the auction contract to spend WETH, anyone can spend that EOA’s WETH by passing the EOA’s address as the auctionData parameter to ClankerSniperAuctionV0::beforeSwap. The ClankerSniperUtilV0 contract shows how to handle this safely.

Disclaimer

Clanker reserves the right to upgrade to other auction versions depending on how V0 is used, and to change V0’s configuration. Clanker gives advance warning of upgrades, but may change the number of blocks between auctions and the payment multiplier.