Skip to content

Remove bot whitelist — make hook permissionless#5

Open
ztsalexey wants to merge 6 commits into
stagingfrom
remove-whitelist
Open

Remove bot whitelist — make hook permissionless#5
ztsalexey wants to merge 6 commits into
stagingfrom
remove-whitelist

Conversation

@ztsalexey

Copy link
Copy Markdown
Contributor

Summary

  • Contract: Remove allowedBots mapping, onlyWhitelisted modifier, addBot/removeBot functions, and the whitelist gate in beforeSwap. Any address can now post orders and trigger P2P matching.
  • Backend: Remove ensureWhitelisted() function and its calls in postP2POrder/executeP2PSwap. Remove allowedBots/addBot from the hook ABI.
  • Tests: Remove 7 whitelist-specific tests and setUp whitelisting. All 27 remaining tests pass.
  • Docs/Scripts: Update READMEs, .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 build compiles cleanly
  • forge test -vvv — all 27 tests pass
  • Verify on staging that bots can post orders without prior whitelisting
  • Confirm existing orders and swaps still work end-to-end

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant