Reference
Contract reference
Two contracts: KolanHook, the Uniswap v4 hook that holds the liquidity and the windows, and KolanToken, the token it deploys. Neither has an owner or an upgrade path.
Addresses#
On Ethereum. Each address opens on etherscan.io.
| Contract | Address |
|---|---|
KolanHook | 0x0136feCf49E0217BFd2D9551E8e7b05f174Ba8eC |
KolanToken | 0x2CADc4F2660Bb77a118b0e74fC9E48E935b3a1bF |
Parameters#
Fixed in the hook's constructor, for good.
| Name | Shipped value | Meaning |
|---|---|---|
TAX_BPS | 100 | The tax on the ETH side of every swap and window, in basis points. Ceiling 500 |
REFERENCE_PREMIUM | 0.05 ETH | The premium that buys BASE_WINDOW |
BASE_WINDOW | 6 hours | |
MIN_WINDOW | 30 minutes | The shortest window; a premium too small for it is refused |
MAX_WINDOW | 7 days | The longest; premium past it is refunded |
MAX_PREMIUM_BPS | 3000 | The most a premium may be, of the ETH a purchase spends |
DEV | Receives the tax, in ETH | |
TOKEN | The token, its whole supply minted to the hook |
Buying and closing#
buy(address recipient, uint256 premium, uint256 minTokens, uint256 deadline) payable returns (uint256 id, uint256 tokens)Opens a window for
recipient. The value pays the ETH to spend, 1% tax on it, the premium, and a 1,000 wei rounding allowance; whatever is not used is refunded. Reverts with TooFewTokens under minTokens.cancel(uint256 id)the owner, before expiryUndoes the window: every wei of its ETH back to the owner, the tokens back into the pool, the premium spent buying tokens back to burn.
accept(uint256 id)the owner at any time, anyone after expiryKeeps the window: the tokens to the owner, the ETH into the pool, the premium spent buying tokens back to burn.
claimDev() returns (uint256 amount)anyonePays the tax owed to
DEV, in ETH.launch(int24 tick) payablethe launcher, onceOpens the pool at
tick and puts the whole supply in it. Nobody else can open a pool on this hook.Views#
quote(uint256 eth) view returns (uint256 tokens, uint256 cost)What a window spending
eth would take out of the pool now, and what it would cost.windowFor(uint256 premium) view returns (uint256)Seconds a premium buys, before the floor and the ceiling.
windows(uint256 id) view returns (address owner, uint40 expiry, uint8 cuts, uint96 eth, uint96 tokens, uint64 premium)A window still held. A closed window reads as zero.
cutsOf(uint256 id) view returns (Cut[])Where a window's tokens came from: the ranges it took out of the pool.
held() view returns (uint128 eth, uint128 tokens)ETH (with premiums) and tokens held for every open window.
segments(int24 lower) view / hint() viewThe hook's positions, as a chain in tick order, and where it last changed.
poolKey() view / poolId() view / devOwed() view / windowCount() viewThe pool, and the counters.
Events#
event Launched(PoolId indexed id, int24 tick, uint128 liquidity, uint256 tokens);
event Taxed(address indexed payer, uint256 fee);
event DevPaid(address indexed dev, uint256 amount);
event WindowOpened(uint256 indexed id, address indexed owner, uint256 eth, uint256 tokens,
uint256 premium, uint256 expiry, int24 lower, int24 upper);
event WindowClosed(uint256 indexed id, address indexed owner, bool kept, bool backInPlace, uint256 burned);Errors a buyer can meet#
| Error | Meaning |
|---|---|
TooFewTokens | The price moved past your tolerance |
TooLate | The transaction waited past its deadline |
PremiumTooLow | The premium buys less than MIN_WINDOW |
PremiumTooHigh | The premium is more than MAX_PREMIUM_BPS of what the purchase spends |
NothingToBuy | The amount is too small to take anything out of the pool |
WindowExpired | Undo after the expiry: the window can only be kept now |
WindowStillOpen | Someone other than the owner tried to keep a window still running |
NotOwner | Someone other than the owner tried to undo |
KolanToken#
A plain ERC-20 with a fixed supply, minted once to the hook in its constructor. Nothing can mint more; anyone can burn their own, which is how premiums burn what they buy back.