Concepts
Prices and solvency
The price is Uniswap's. What Kolan adds is where the liquidity sits, and the promise that every window can be paid back.
The opening#
At launch the hook puts the whole supply into one position that runs from the opening price to the highest price Uniswap can express. A range above the price holds tokens only, so the pool opens with tokens and no ETH, at a $10,000 market cap: one million tokens at $0.01 each, converted to ETH with Chainlink's price as the launch is signed.
From there it trades as a constant product: the more is bought, the higher the price, and every buyer's ETH stays in the pool as the support the next seller sells into.
currency0 ETH
currency1 the token
fee 0 // the 1% tax is the hook's, in ETH
tickSpacing 10 // prices move in steps of 0.1%
hooks KolanHookThe price with windows open#
A window takes its tokens out of the pool without moving the price, and leaves a hole. The pool's price is then the price sellers meet; a buyer crosses the hole for free and pays the price after it. The quote on screen is what a buyer actually pays.
Solvency#
- The hook keeps a count of the ETH and tokens it holds for windows (
held), and every window operation checks it still holds at least that much. - A window's ETH never enters the pool while it is open, so no swap can spend it. Undoing pays it back from where it sits.
- The hook's record of its positions is checked against the pool's own state after every step of the invariant tests.
- Rounding works against the person acting, by a few wei: a window's opening pays its own, its closing takes it from the premium.