Trade a Liqio coin without the site: a direct Uniswap v4 swap with the pool key, or the router with a route; plus prices, launching and claiming from your own code.
Every Liqio coin is an ordinary Uniswap v4 pool on HyperEVM. You can swap in it through the PoolManager, through Uniswap's own routers or any aggregator that supports v4 on HyperEVM, or through the Liqio router, which adds the HYPE leg for stock- and USDC-paired coins. Addresses are on Contract addresses.
Pass the key to whatever executes v4 swaps for you (the Universal Router, a position manager's swap helper, or your own unlock callback). zeroForOne = false pays the pair and receives coins (a buy); zeroForOne = true pays coins and receives the pair (a sell). The hook needs no hook data; a swap sent without it is attributed to tx.origin and earns no referral. The hook fee is taken from the pair side automatically and shows up as a smaller output or a larger input than the pool math alone would give; quote with that in mind, or use feeBpsNow(coin, isBuy) on the hook. Three rules apply: a buy in the launch block reverts, a buy over a running max-wallet cap reverts, and sells are never blocked.
// minimal direct swap inside your IUnlockCallback.unlockCallback
BalanceDelta d = poolManager.swap(
key,
SwapParams({
zeroForOne: false, // buy
amountSpecified: -int256(pairIn), // exact input
sqrtPriceLimitX96: TickMath.MAX_SQRT_PRICE - 1
}),
""
);
// settle currency1 (the pair) and take currency0 (the coin) as usual
The router trades in HYPE and handles the conversion to and from the pair. Its buy and sell take a route (empty for a HYPE pair, otherwise an ABI-encoded list of hops from WHYPE to the pair) and a referrer (zero for none). A sell walks the same route backwards.
// HYPE pair: no route; referrer = address(0) for none
router.buy{value: 10 ether}(coin, "", minCoinOut, referrer); // 10 HYPE
// stock pair, for example wNVDAx (PRJX 1% pool against WHYPE)
// Hop is the router's struct: (uint8 dex, address pool, PoolKey key)
Hop[] memory hops = new Hop[](1);
hops[0] = Hop({dex: 2, pool: 0x4bc0C3C0947d968043762149EAa51aBbF35C2687, key: emptyKey}); // WHYPE -> wNVDAx
bytes memory route = abi.encode(hops);
router.buy{value: 10 ether}(coin, route, minCoinOut, referrer);
// a quote for the HYPE leg (eth_call only): always reverts with QuoteResult(uint256 pairOut)
router.quoteEthToPair{value: 10 ether}(pair, route);
// sell: approve the router first (the coin supports permit)
coin.approve(address(router), amount);
router.sell(coin, amount, route, minEthOut, referrer);
The hop list for each pair the site uses is in its configuration file and on Contract addresses. dex 1 is a Uniswap v2 pair, 2 a Uniswap v3 pool or a v3 fork (PRJX), 3 a Uniswap v4 key, 4 an Algebra pool (KittenSwap); at most four hops. Wallets that already hold the pair token, and every pair with no route (wMUx, wSKHYx, wQQQx), use buyWithPair(coin, pairIn, minCoinOut, referrer) and sellForPair(coin, amountIn, minPairOut, referrer). The router holds nothing between calls and always sends the output to msg.sender. A referrer binds to the sender once, on their first referred trade; cashback and referral rewards are claimed with hook.claimRewards(pairs).
Read slot0 of the pool from the PoolManager and convert:
// off-chain, with any JSON-RPC client
slot = keccak256(abi.encodePacked(poolId, uint256(6)))
s0 = poolManager.extsload(slot) // bytes32
sqrtPriceX96 = uint256(s0) & ((1 << 160) - 1)
liquidity = uint256(poolManager.extsload(slot + 3)) & ((1 << 128) - 1)
priceInPair = (sqrtPriceX96 / 2**96) ** 2 // pair base units per coin base unit
priceUsd = priceInPair * factory.pairUsdPrice(pair) / 1e18
marketCapUsd = priceUsd * 1_000_000_000
pairUsdPrice is USD with 18 decimals per 1e18 base units of the pair, so the formula holds for a 6-decimal pair such as USDC too (its pairUsdPrice is 1e30). On-chain, use Uniswap's StateLibrary (getSlot0(poolId), getLiquidity(poolId)) or the StateView contract, and FullMath.mulDiv for the square. For a quote, apply the hook fee to the pair side: on an exact-input buy the pool receives pairIn × (1 − fee); on an exact-input sell you receive pairOut × (1 − fee).
// LaunchParams, Genes and StageParam are the factory's and hook's structs
LaunchParams memory p = LaunchParams({
name: "Example", symbol: "EXMPL",
metadataURI: '{"description":"...","image":"data:image/webp;base64,...","website":"https://..."}',
pair: wNVDAx, // address(0) for HYPE
minPairOut: 0,
capPreset: 0, // index into factory.capPresets()
genes: Genes({
feeMode: 0, feeBps: 100, // 1% flat
snipeBps: 2000, snipeBlocks: 600, // 20% decaying over 600 blocks (about 10 minutes), or 0 / 0
buybackShareBps: 2000, divShareBps: 2500, // 20% buyback and 25% holder rewards, or 0
maxWalletBps: 200, maxWalletSecs: 3600, // 2% of the supply per wallet for an hour, or 0 / 0
buybackThreshold: 1e18 // a burn each time the pot holds 1 pair token
}),
stages: new StageParam[](0)
});
(address coin, bytes32 poolId) = factory.launch{value: devBuyHype}(p, salt, route, "");
route is the same hop list the router uses for that pair (empty for HYPE); it is only used when HYPE is sent. The last argument, peers, must be empty. salt is any value: the factory hashes it with your address and the token deployer derives the final CREATE2 salt from that, so tokenDeployer.predict(keccak256(abi.encode(you, salt)), pair, divShareBps != 0) gives the coin address before you send. The launch reverts BadGenes for any setting outside the bounds on Limits and validation, and NoPrice for a pair that is not in the oracle's list, which is fixed at deployment.
hook.payCreator(coin); // anyone: pays the creator's share to the creator
factory.claimCreatorFees(coin); // creator: the same, and it resets the takeover clock
hook.pushPlatform(tokens); // anyone: pays the platform's share to the fee recipient
hook.pushDividends(coin); // anyone: moves the rewards pot to the coin
coin.claimDividends(); // holder: claims their share (rewards variant only)
coin.withdrawableDividends(holder); // view
hook.buybackBurn(coin); // anyone: spends the buyback pot now, whatever the threshold
hook.claimRewards(pairs); // trader or referrer: cashback and referral rewards per pair asset
Fork HyperEVM (chain id 999, RPC https://rpc.hyperliquid.xyz/evm) at or after the deployment block and call the deployed contracts directly; the sources compile with Solidity 0.8.26. A fork carries the routing pools but not HyperCore's oracle precompile: a plain fork answers the call at 0x0000000000000000000000000000000000000807 with empty data, so the oracle reverts NoPrice and a launch fails. Place a mock at that address (the repository's tests do this with hardhat_setCode) and set the prices you want when you test launches off-chain. For a HYPE pair nothing beyond WHYPE is needed to trade.