Chapter 11
Security
This chapter exists so that nobody has to guess. It states what review this code has had and, at greater length, what it has not.
What has been done
- A small surface on purpose. Four contracts, no proxies, no upgrade path, no admin withdrawal. Most classes of exploit are absent because the function that would be exploited does not exist.
- Unit tests and invariant tests over every contract, run against Uniswap V2 compiled from source rather than a stand-in. The invariants are checked after each step of randomised sequences: supply only falls, the fall equals what the vault destroyed, no address but the burn address holds liquidity, and the pool never empties.
- Reentrancy discipline. The vault's single external function follows checks-effects-interactions and holds a guard across the router call.
- Static analysis over the contract set, with the findings triaged rather than silenced.
What has not
There is also no bug bounty running yet, no formal verification of any component, no static analysis, and no insurance fund. A bug in the vault would be permanent, because there is nothing to upgrade and nobody who can pause it — the same property that makes it trustworthy makes a mistake unrecoverable.
The off-chain surface
That is a design choice with a cost: there is no operator who can pause anything, fix a mistake, or make a wronged user whole. Read /docs/risks with that in mind.
Keys and control
There is no admin key over any contract here, because there is no function for one to call. No contract has an owner. Nothing is upgradeable. The deploy key that created the factory has no power over it afterwards, and there is no keeper key because the buyback is permissionless.