The DevBuy extension lets the deployer buy tokens atomically in the same transaction as deployment. The buy cannot be front-run, because no transaction can be inserted between pool creation and the buy.
How it works
- Deployer sends ETH with the
deployToken()call - Factory creates the pool and the LP locker adds initial liquidity
- DevBuy extension immediately swaps the sent ETH for the new token
- Purchased tokens are sent to the deployer's address
Because pool creation and the buy occur in the same transaction, MEV bots cannot sandwich or front-run the purchase.
Configuration
The extension data encodes the buy parameters:
// extensionData for DevBuy
bytes extensionData = abi.encode(
pairedTokenPoolKey, // PoolKey for WETH->paired swap (zeroed for WETH pairs)
pairedTokenAmountOutMinimum, // Min paired-token out (slippage protection)
recipient // Address to receive purchased tokens
);