Start
Flags glossary
Reading the address
A v4 hook's permissions are written in the last 14 bits of its own address. The PoolManager only calls the hook at the moments whose bit is set, so nobody can hide a permission: the address says it. The Pons hook 0xe5e702641ea86f4ae6cc3cdaed2b886f976be044 ends in f044:
13beforeInitialize
12afterInitialize
11beforeAddLiquidity
10afterAddLiquidity
9beforeRemoveLiquidity
8afterRemoveLiquidity
7beforeSwap
6afterSwap
5beforeDonate
4afterDonate
3beforeSwapReturnsDelta
2afterSwapReturnsDelta
1afterAddLiquidityReturnsDelta
0afterRemoveLiquidityReturnsDelta
All 14 flags
| Bit | Flag | In plain words |
|---|---|---|
| 13 | beforeInitialize | Runs code when a pool is created. Called once, when someone creates a pool with this hook. |
| 12 | afterInitialize | Runs code after a pool is created. Called once, right after a pool with this hook is created. |
| 11 | beforeAddLiquidity | Can block people from adding liquidity. Called before each deposit into the pool. |
| 10 | afterAddLiquidity | Runs code after liquidity is added. Called after each deposit into the pool. |
| 9 | beforeRemoveLiquidity | Can block LPs from withdrawing. Called before each withdrawal. It can revert, which stops liquidity providers from leaving. |
| 8 | afterRemoveLiquidity | Runs code after liquidity is removed. Called after each withdrawal. |
| 7 | beforeSwap | Runs code before your swap and can block it. The hook is called before every swap. It can revert, which makes your swap fail. |
| 6 | afterSwap | Runs code after your swap and can block it. The hook is called after every swap. It can revert, which undoes your swap. |
| 5 | beforeDonate | Runs code before a donation to the pool. Donations are tips paid to the pool's LPs. |
| 4 | afterDonate | Runs code after a donation to the pool. Donations are tips paid to the pool's LPs. |
| 3 | beforeSwapReturnsDelta | Can change the price you get. Before your swap runs, the hook can take or add tokens, so the amount you get is set by its code as well as the pool. |
| 2 | afterSwapReturnsDelta | Can take a fee from your output. After the pool fills your swap, the hook can keep part of what you were about to receive. |
| 1 | afterAddLiquidityReturnsDelta | Can take a cut when LPs deposit. The hook can change the amounts a liquidity provider pays in. |
| 0 | afterRemoveLiquidityReturnsDelta | Can take a cut when LPs withdraw. The hook can change the amounts a liquidity provider gets back. |
Properties
- Upgradeable: the EIP-1967 implementation slot or beacon slot is set, so the code behind the address can change.
- Dynamic fee: the pool's fee field is 0x800000, so the hook sets the LP fee swap by swap.
- Swap access: from the registry, none, governance, allowlist, temporal or other. Anything but none means some swaps are refused.
- Custom swap data: the hook expects hook data from its own front end; a plain router call reverts.
Unlisted