Remove bot whitelist — make hook permissionless#5
Open
ztsalexey wants to merge 6 commits into
Open
Conversation
Remove the allowedBots mapping, onlyWhitelisted modifier, addBot/removeBot admin functions, and the whitelist check in beforeSwap. The hook is now permissionless — any address can post orders and trigger P2P matching.
Drop test_addBot, test_removeBot, test_postOrder_revert_notWhitelisted, test_beforeSwap_nonWhitelisted_fallsThrough, and the setUp addBot calls. All 27 remaining tests pass.
Remove the ensureWhitelisted function, its calls in postP2POrder and executeP2PSwap, and the allowedBots/addBot ABI entries. The contract no longer requires whitelisting so the backend no longer needs to auto-whitelist bots before P2P actions.
Remove whitelist references from READMEs, .env.example, and deployment scripts. The hook is now permissionless so addBot calls and whitelist setup steps are no longer needed.
Move SimpleSwapRouter from inline in TestP2PMainnet.s.sol to src/SimpleSwapRouter.sol so it can be imported and reused.
…less bot Previously a failed createBotWallet call was silently caught and the bot was registered without a wallet. Now the endpoint returns a 500 error so the caller knows the operation failed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
allowedBotsmapping,onlyWhitelistedmodifier,addBot/removeBotfunctions, and the whitelist gate inbeforeSwap. Any address can now post orders and trigger P2P matching.ensureWhitelisted()function and its calls inpostP2POrder/executeP2PSwap. RemoveallowedBots/addBotfrom the hook ABI..env.example, and deployment scripts to reflect the permissionless design.Why
The bot whitelist added unnecessary friction — every new bot required an admin transaction before it could trade. By removing it, the hook becomes fully permissionless: any address can post P2P orders and swap, matching the open nature of Uniswap v4 pools.
The admin role is preserved for future governance needs (two-step transfer still works), but it no longer gates access to trading.
Test plan
forge buildcompiles cleanlyforge test -vvv— all 27 tests pass