write
The rule, in words. Every swap judged as you type.
One line per rule. A line without when always applies and is the pool’s standing fee. Lines run top to bottom: the last fee wins, takes add up, one refusal stops the swap.
the rule
4 lines, 170 bytes. Asking the chain…
ways to say it
- fee 0.3%
- when selling in the first 10 minutes: fee 10%
- when a buy is bigger than 2 eth: refuse
- when sell and it moves the price more than 3%: take 2% to lps
- when price down 20% and sell: fee 5%
- when hour >= 22: take 0.5% to 0x…
- when age > 7 days and buy: take 1% to lps
read back from the bytes
- 1fee 1%
- 2when sell and age < 10 min: fee 10%
- 3when buy and size > 2 ETH: refuse
- 4when sell and impact > 3%: take 2% to lps
0x01040001000000271000000000000000000000000000000000000000000200000000000000000001010100000000000002580100000186a000000000000000000000000000000000000000000200000000000000000000040200000000001e848001010000000000000000000000000000000000000000000000000200000000000000000001050200000000000001280102000000c80000000000000000000000000000000000000000
Try the rule
judged by the contract’s own code- Nothing dropped yet.
Every swap is judged by the same code the contract runs. Impact is estimated against a pool that holds 100 ETH of depth.
bind it to a pool
A pool is ether against your token, with a dynamic fee and this hook. Its id exists before it does, so the rule is written first and the pool is opened under it. Whoever writes first is the author until it opens; after that the rule is fixed.
Rules: 4. The hook is at 0x0181…90c4.