Set the start price
Convert a start market cap or price to an initialTick.
Each pool starts at its own initialTick. The tick is the start price in raw quote per raw token. Use the same
tick whether the token is currency0 or currency1 in the pool. The launchpad converts it.
From a market cap
The supply is 1,000,000,000 tokens with 18 decimals. To start at a market cap M in whole quote units:
price = M / 1,000,000,000 whole quote per whole token
rawPrice = price × 10 ^ (quoteDecimals − 18) raw quote per raw token
tick = ln(rawPrice) / ln(1.0001)Then round the tick to a multiple of 200:
const TICK_SPACING = 200;
const TOTAL_SUPPLY = 1_000_000_000;
/**
* Start tick for a starting market cap, in whole units of the quote.
*/
export function startTick({
marketCap,
quoteDecimals,
}: {
marketCap: number; // In whole quote units
quoteDecimals: number;
}) {
// Whole quote per whole token, then raw quote per raw token
const price = marketCap / TOTAL_SUPPLY;
const rawPrice = price * 10 ** (quoteDecimals - 18);
const tick = Math.log(rawPrice) / Math.log(1.0001);
return Math.round(tick / TICK_SPACING) * TICK_SPACING;
}
startTick({ marketCap: 10, quoteDecimals: 18 }); // -184200: 10 ETH
startTick({ marketCap: 33_000, quoteDecimals: 6 }); // -379600: $33,000 in USDCFrom a tick back to a market cap
export function startMarketCap({
tick,
quoteDecimals,
}: {
tick: number;
quoteDecimals: number;
}) {
return 1.0001 ** tick * 10 ** (18 - quoteDecimals) * 1_000_000_000;
}
startMarketCap({ tick: -184_200, quoteDecimals: 18 }); // 10.016Limits
- The tick must be a multiple of
200. - The tick must be at least
-887200and less than887200. - A high tick gives a narrow position range. If the range is too narrow for the pool's supply,
PoolManagerreverts withTickLiquidityOverflow.
Pools with different quotes
The launchpad does not compare the prices of different pools. Give each pool the same start market cap, in the same currency. For example, if 1 ETH is $3,300, a 10 ETH market cap in the ETH pool matches a $33,000 market cap in the USDC pool.