Composer
Draft the rules. Read the hook.
Switch modules on, set their numbers, and watch the permission bits, the callback list and the worst-case take update as you go. Everything here runs in your browser; nothing is signed or sent.
Rule set
TOKEN / ETH · Uniswap v4 · 1% fee · 0 modules
Hook permission bits
BI beforeInitialize · BS beforeSwap · AS afterSwap · ASΔ afterSwapReturnDelta
Where each rule runs
- ·
Pool opens
Untouched.
- ·
Liquidity in
Untouched.
- ·
Before swap
Untouched.
- v4
v4 swap math
Concentrated-liquidity math in the PoolManager. No rule runs inside it.
- ·
After swap
Untouched.
- ·
Liquidity out
Untouched.
What a trader reads
- 1% LP fee on every swap, all of it to liquidity in range.
Most a trade can give up
- Buy
- 1%
- Sell
- 1%
- Opening buy
- 1%
Play a buy
| LP fee | 1.00% | 0.00500 ETH |
| Rules and fees | 1.00% | 0.00500 ETH |
Before price impact. Size-scaled fees assume opening liquidity equal to the valuation set on the right.
Callbacks this hook needs
- beforeInitializeInitRuns before the pool's starting price is set. Can refuse to open the pool or check who opens it.
- beforeSwapSwapRuns before every swap, can override the LP fee. Fees can change per trade. Check the fee range.
- afterSwapSwapRuns after every swap with the final amounts. Reacts to trades: burns, pots, reward accounting.
- afterSwapReturnDeltaDeltaLets afterSwap take a cut of the output. The hook can change what you receive. Taxes and burns live here.
Checks
- No rules yet. This pool would be a plain v4 pool paying a 1% fee to LPs.
Generated config
{
"name": "Untitled rule set",
"chainId": 4663,
"poolKey": {
"currency0": "ETH (address(0))",
"currency1": "<token>",
"fee": 10000,
"tickSpacing": 200,
"hooks": "<RuleCraftHook address ending in mask 0x20c4>"
},
"permissions": {
"beforeInitialize": true,
"afterInitialize": false,
"beforeAddLiquidity": false,
"afterAddLiquidity": false,
"beforeRemoveLiquidity": false,
"afterRemoveLiquidity": false,
"beforeSwap": true,
"afterSwap": true,
"beforeDonate": false,
"afterDonate": false,
"beforeSwapReturnDelta": false,
"afterSwapReturnDelta": true,
"afterAddLiquidityReturnDelta": false,
"afterRemoveLiquidityReturnDelta": false
},
"modules": [],
"royaltyPctOfAddOns": 5,
"protocolSharePctOfAddOns": 10,
"maxTakePct": {
"buy": 1,
"sell": 1,
"buyDuringGuard": 1
},
"frozenAtCreation": true
}Risk read
Light rules
score 10 / 100 · higher means the rules can move a trade further from a plain pool
- Hook permissions10/354 of 14 callbacks enabled.
- Steady take per buy0/25Up to 1% of a buy goes to fees and rules (1% is the plain LP fee).
- Opening window0/15No extra charge at opening.
- Fee movement0/10Fee is fixed for the life of the pool.
- LP exits0/10Every LP can leave at any time.
- Unreleased code0/5Only on-chain modules.
A heuristic read of permissions and settings. It is not an audit and does not check the code itself.
Next
Name the rule set above to publish it.
Pick at least one rule module.
The launch form checks everything again before anything is signed.