Concepts
Life of a purchase
A purchase with a window takes its tokens out of the pool and holds them with your ETH. Whatever happens next, the tokens and the ETH each go back where they belong.
Opening: a hole in the pool#
The hook takes out of the pool exactly the tokens a swap of your ETH would buy now: the next steps of liquidity past the price, whole, then part of the following one. It holds them with your ETH. Neither is in the pool any more.
That leaves a hole in the pool's liquidity where your tokens were, and the hole does two things while it is open:
- A buyer crosses it for free and pays the price after it, as if your purchase had happened. Nobody can buy your tokens from under you, and nobody gets them at your price.
- A seller cannot reach your ETH, because it is not in the pool. Selling into the pool pays out of the ETH that is there, never out of a window's.
The step of liquidity the price sits in is left alone, so a window gets at most one step, 0.1% of price, fewer tokens than a swap of the same ETH would.
Closing#
Undo
Only you, and only before the expiry. Every wei of the ETH comes back to you in the same transaction, and the tokens go back into the pool.
Keep now, or the window runs out
You can keep it at any time; once it has run out, anyone can, and the tokens still only go to you. The tokens land in your wallet and your ETH goes into the pool.
Then the premium
Either way, the premium then buys tokens from the pool, and they are burned.
Where things go back#
The pool keeps trading while your window is open, so by the time it closes the price may sit on either side of the hole. A Uniswap position holds tokens above the price and ETH below it, never the other way round, so where things can go depends on where the price is:
| The price has not passed the hole | The price has gone past it | |
|---|---|---|
| Undo: the tokens | Back into the hole, exactly as they were | Back into the pool just past the price, where the next buyer takes them first |
| Keep: the ETH | Into the pool just below the price, as support for sellers | Into the hole: the pool is exactly as after a plain buy |
What it costs#
A window moves liquidity in and out of the pool, which costs more gas than a swap. Roughly, on mainnet: about 410k gas to open one, 160k to undo, 300k to 460k to keep. A plain swap through the pool costs what any Uniswap swap costs. accept and cancel are paid by whoever sends them.