ClankerSniperAuctionV0.sol:IClankerMevModuleinstance running Clanker’s first version of a sniper auction.ClankerSniperUtilV0.sol: Auxiliary helper contract providing an example of how snipers can interact with the auction process.
How It Works
The auction leverages the fact that Base uses priority ordering, meaning transactions with higher gas fees are placed before others. The auction module records the gas price each time the auction resets and uses an inflated version as the “starting” gas price for the auction. The amount of WETH collected as 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 found by querying the contract and can be easily replicated off-chain. The auction payments are split between the token’s reward recipients and the Clanker factory at a 80/20 split. The following auction configuration variables are of importance to snipers:blocksBetweenDeploymentAndFirstAuction: The number of blocks between the pool’s deployment and the first auction.blocksBetweenAuction: The number of blocks between subsequent auctions.maxRounds: The maximum number of auctions that can run per pool.paymentPerGasUnit: The amount of WETH to pay per gas unit above the gas peg for an auction.
ClankerSniperAuctionV0 contract and can be changed by the Clanker team with advanced notice.
The following auction state variables are of importance to snipers and are queryable per PoolId:
round: The current auction round.nextAuctionBlock: The block number at which the next auction will accept bids at.gasPeg: The gas price which the next round of the auction will start at.
ClankerSniperAuctionV0 contract:
Example Auction Iteration
A pool is deployed in block 1 with a base fee of 10 gwei. The first auction round occurs in block 3 with a starting auction gas price of 12 gwei. Three snipers attempt to snipe with the following configurations:- 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
ClankerSniperUtilV0 Contract
TheClankerSniperUtilV0 contract is a shared utility for snipers to bid in auctions and serves as 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, as it is auxiliary to the auction setup itself.
Example Usage
Disclaimer
Clanker reserves the right to upgrade to other auction versions depending on the usage of V0 and to change V0’s configuration. We will give advanced warning of upgrades, but we may toggle how many blocks between auctions are ran and the payment multiplier.Warning on Approving ClankerSniperAuctionV0 to spend WETH
We do NOT recommend approving ClankerSniperAuctionV0 to spend WETH unless you have an auxiliary contract handling the approval that reverts if the bid is not won. For example, if an EOA approves the auction contract to spend WETH, anyone can spend the EOA’s WETH by passing in the EOA’s address as the auctionData parameter to the ClankerSniperAuctionV0::beforeSwap function. We’ve provided the ClankerSniperUtilV0 contract as an example of how to handle this.