Index / Permissioned Pools
product · MIT · last updated 2026-08-27
Permissioned Pools
Per-currency allowlist enforced on swap and add-liquidity via permissions adapters.
PermissionedHooks is Uniswap v4-periphery production code. Pools must include at least one verified IPermissionsAdapter currency; beforeInitialize rejects unverified adapters. beforeSwap and beforeAddLiquidity call the adapter to authorize msgSender() reported by registered wrapper contracts. afterSwap emits a router-compatible Swap event for indexers. Use Uniswap's permissioned pool stack — do not reimplement KYC here. Excerpt shows permissions and initialize gate. Full file at the permalink. Listing is not an audit.
Permission bits
These bits must match the deployed address. Confirm on-chain before you route.
beforeInitializebeforeAddLiquiditybeforeSwapafterSwap
Solidity
Excerpt from src/permissioned-pools/PermissionedHooks.sol. Production hook. Study the callbacks, do not paste it as your factory. Not an audit.
// SPDX-License-Identifier: MIT
function getHookPermissions() public pure override returns (Hooks.Permissions memory permissions) {
permissions.beforeInitialize = true;
permissions.beforeSwap = true;
permissions.afterSwap = true;
permissions.beforeAddLiquidity = true;
}
function _beforeInitialize(address, PoolKey calldata key, uint160) internal view override returns (bytes4) {
address currency0 = Currency.unwrap(key.currency0);
address currency1 = Currency.unwrap(key.currency1);
bool currency0IsAdapter = PERMISSIONS_ADAPTER_FACTORY.permissionsAdapterOf(currency0) != address(0);
bool currency1IsAdapter = PERMISSIONS_ADAPTER_FACTORY.permissionsAdapterOf(currency1) != address(0);
// requires at least one verified adapter; rejects unverified adapter currencies
}Spec
| Kind | product |
|---|---|
| Status | production |
| License | MIT |
| Source | https://github.com/Uniswap/v4-hooks-public |
| Categories | ComplianceWrappers |
| Properties | Vanilla swap |
| Chains | Ethereum |
| Docs | https://docs.uniswap.org/contracts/v4/overview |
FAQ
Can I paste this into production? The snippet is an excerpt. Use the full file at the source URL, match flags to the address, and treat this page as a map, not a guarantee.
How do I build this safely? Start with secure v4 hooks and the OpenZeppelin hooks guide.