Submission · Create an App on Cookie Chain

cookiefill

What a swap on Cookie Chain actually costs you — measured at eight sizes before you sign it, and against what you were promised after it lands.


The number this was built to find

Cookie Chain holds 160 pools and about $7,880 of liquidity in total; 147 of those pools hold under $100. At that depth the cost of a trade is not a rounding error on it — it is it. So the first thing cookiefill reports is the size at which a pool stops being worth trading.

$5.59 largest swap under 1% cost, on the deepest pool on the chain
$1.12 the same figure on most other pools
2,819 bps a $110 swap into TRASHCOIN pays — 28% of the money
TRASHCOIN/COOK, a $646 pool, quoted live on 5 September 2026. Bars are linear and to scale: the cost is invisible, invisible, invisible — and then it is the trade. Green rungs stay under 100 bps.
trade size cost  
$0.110.0 bps
$1.1225.6 bps
$5.59138.7 bps
$11.18280.0 bps
$27.95703.7 bps
$55.901,409.5 bps
$111.802,819.4 bps
$223.615,634.9 bps

How the cost is measured

A trade small enough to leave the pool where it found it pays the fair price. Everything above that pays more, and the gap is the cost. The reference here is the router's own quote at 1,000 COOK, about eleven cents — and it is used only when the router itself reports that this size moved the pool by less than 0.1%.

This is the construction published for Solana as solana-exec-bench, where the reference was the median realized price of trades under $100 in the same minute on the same pair. That needs other people's fills. Cookie Chain has no such flow, so the reference comes from quotes — and the app then measures the fill afterwards to check the quote against what actually settled.

Where it refuses to answer


It runs. Here is the transaction.

The app connects a wallet through the Wallet Standard, has Nightly point itself at Cookie Chain by genesis hash, asks the Cookiebox router to build the swap, hands the unsigned transaction to the wallet, sends it, confirms it, and then reads the confirmed transaction back to price the fill. No key ever reaches the app.

50.002039280 COOK→ 38.714242548 bCOOK
vs the router's promise0 bps
vs an impact-free trade−0.95 bps
network fee0.000005 COOK
Negative is correct, and was predicted before the swap: 50 COOK is smaller than the 1,000 COOK reference, so it should come in slightly cheaper. Confirmed at slot 23,438,162, 78,673 compute units.

471p61hLUPv2GYxW6MEEev3vSRxDj7R1baLMSCWnSbxUg1LKF1iKye5uBdEF2jzn3T8FRoEGDgy6XkWbmgq7bzet

The bug that transaction found

The swap succeeded on chain. The receipt did not — it reported a cost of:

9,999,053,891,180 bps

Neither function was wrong on its own. The curve engine quoted its ladder in whole COOK; the fill engine reads raw transaction balances in base units. The two prices sat 10⁹ apart, and all seventeen unit tests passed anyway, because every one of them stayed inside a single module and every module was consistent with itself.

Crossing them against one real transaction is what caught it. The unit is now declared in the type rather than assumed, and the numbers from that exact transaction are pinned as a regression test. A test that never crosses a module boundary does not test the contract between modules.


Check it without spending anything

Simulation is read-only — it never broadcasts and never moves a balance, so the swap path can be proven with no funds and no private key. Any funded address works as the fee payer the router builds for.

01POST /swap-tx returns the declared shape — HTTP 200
02deserializes as v0, 682 bytes, fee payer = owner, 7 instructions
03runs to completion in the CPAMM program — err: null, 93,717 CU
04output account receives 1,665,411,647 units — exactly the quote, 0.0000 bps
npm test # 18 tests over the two cost engines npm run probe:curve # the live ladder on the deepest pools npm run simulate:swap # build and simulate a swap, no funds needed npm run verify:tx # re-price any confirmed swap with the same engine

Requirements, and where each one is answered

requiredstatusevidence
Built on Cookie Chain (SVM)doneRPC, router and pool data are all Cookie Chain; genesis 9wDaBRDg…EcBB2
Wallet connection, Nightly supporteddoneWallet Standard, plus an explicit network switch by genesis hash
Display connected wallet addressdoneAddress and live COOK balance, read from Cookie Chain
Transaction executiondone471p61hL…q7bzet, confirmed at slot 23,438,162
Transaction confirmation handlingdoneNarrated step by step: build, sign, send, confirm, measure
Error handling and user feedbackdoneThe router's own reason, in plain language, before the click and after it
Analytics, charts or dashboardsdoneThe eight-size cost ladder, and the size ceiling it implies
Uses existing Cookie Chain programsdoneCookiebox aggregator for quotes and swap construction
Deployed and publicly accessibledonecookie-fill.vercel.app, no login, no wallet needed to read
Open source with a READMEdoneMIT, with the method and this bug written up in full
Demo thread on Xdone@Cristiankzk1 — what it does, how to use it, and the route to the bridge

What it does not do

It deploys no program of its own — it composes on top of Cookie Chain's existing ones through the Cookiebox router, which is why the addresses that matter are theirs, not a new one. It quotes only COOK-denominated pairs. And it will not compare your fill against other traders' fills, because on a chain with $7,880 of total liquidity there are not enough of them for that comparison to mean anything. That is stated on the page rather than papered over.