Concept · 09
Repo Pools
Every repo can launch its own tradeable token paired in a Uniswap v4 pool with a custom hook that captures protocol fees for the repo treasury, enforces a soft floor from real cash flow, and exposes a TWAP oracle the credit and insurance system reads.
The bet
Most of the protocol works without traders. Treasuries fill from streams. Splits move value between wallets. Credit, insurance, sleeper pool — none of it needs an order book to function. Repo Pools add the market layer on top.
The pitch: let every repo become its own programmable market. A maintainer launches a token paired against USDC in a Uniswap v4 pool. A custom hook governs everything that happens in that pool — and routes value back to the repo's treasury automatically.
We couldn't ship this on v3-era AMMs because doing it well needed:
- An ERC-20 per repo.
- A market for it that wouldn't immediately get sniped.
- A price oracle resistant to manipulation.
- A way to capture protocol fees for the repo treasury (not just LPs).
- Defense against pump-and-dump.
v4 hooks solve all five in one contract.
What the hook does
RepoPoolHook (one contract serving every repo's USDC/REPO pool)
beforeInitialize → only the repo owner can launch their pool
beforeSwap → progressive launch fees (5% → 0.3% over 30 days, anti-snipe)
beforeSwap → enforce soft floor priced off TTM MRR
(you can't crash a repo's token below its cash-flow value)
afterSwap → carve X bps of fee value, forward to RepoVault.deposit()
(the repo treasury earns from every trade in its own token)
TWAP oracle → becomes THE price feed for CreditLine LTV + InsurancePool premiums
(replaces stars/forks as the "what is this repo worth" signal)
One hook contract, every repo's pool.
What it replaces
| Before | With Repo Pools |
|---|---|
| Protocol fee on private repos | Swap fees on the repo's own market — maintainer earns from trades. |
| Stars × commit-frequency heuristic for credit pricing | On-chain TWAP from the repo's pool is the price oracle. |
| Manual repo valuation in lender pool curve | Lender pool reads TWAP directly. Continuous, transparent. |
| Sponsorships requested case-by-case | Buy the repo's token. Same effect; market-priced. |
What it does NOT do
- It does not make repos memecoins. A token only matters if its hook captures protocol fees and feeds the oracle. The economic gravity is in the hook logic, not the ticker.
- It does not require any repo to launch a token. Pools are opt-in. The other primitives work without them.
- It does not make credit or insurance dependent on the pool existing. The TWAP becomes one signal among several; the lending curve still reads MRR + score + churn.
Why v4, specifically
v4 hooks let one contract serve infinite pools and intercept every swap with custom logic. Three things only v4 makes clean:
- Fee redirection.
afterSwapcan return an additional delta that carves a slice off the LP fee and sends it elsewhere — in our case,RepoVault.deposit(repoId, USDC, slice). No router middleware. - Custom AMM behavior on launch.
beforeSwapcan return aBeforeSwapDeltato enforce time-decaying fees, blocklists, or floors without writing our own AMM. - Native TWAP exposure. The pool's spot + time-weighted prices are first-class reads. The credit and insurance systems can subscribe directly.
We can't ship this on v3 without writing our own AMM. v4 ships the substrate.
Risks worth being clear about
- Hook upgradeability is hard. Permissions are encoded in the hook address. Upgrading means redeploying at a new salt-mined address and migrating liquidity. Hooks are designed as immutable from day one or carefully proxied.
- Hooks have novel attack surface. Reentrancy through the singleton, fee-capture griefing,
BeforeSwapDeltaabuse. The audit category is real and budgeted separately.
Related
- Balance sheet — the repo entity Repo Pools deposit into.
- Collateral lending — reads the TWAP as the canonical fair-value oracle.
- Tokenomics — fee schedule that Repo Pools augment.
