[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108664":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":8,"language":10,"languages":8,"totalLinesOfCode":8,"stars":11,"forks":12,"watchers":13,"openIssues":12,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":8,"rankLanguage":8,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":8,"pushedAt":21,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":14,"starSnapshotCount":14,"syncStatus":25,"lastSyncTime":26,"discoverSource":27},108664,"cca-bid-planner","cocoa-butter\u002Fcca-bid-planner","cocoa-butter",null,"https:\u002F\u002Fcca-bid-planner.vercel.app","TypeScript",27,1,100,0,37.9,"MIT License",false,"main",true,[],"2026-11-19 21:07:11","2026-11-22 08:22:04","# cca-bid-planner\n\nRead-only bid planner for Uniswap Continuous Clearing Auctions (CCA). Give it an auction, a budget and a demand assumption, and it returns a bid schedule, with expected fill, average price, worst case and refund exposure for each scenario.\n\n**Website and planner: [cca-bid-planner.vercel.app](https:\u002F\u002Fcca-bid-planner.vercel.app)** · [Docs](https:\u002F\u002Fcca-bid-planner.vercel.app\u002Fdocs) · [Changelog](CHANGELOG.md)\n\n[![ci](https:\u002F\u002Fgithub.com\u002Fcocoa-butter\u002Fcca-bid-planner\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fcocoa-butter\u002Fcca-bid-planner\u002Factions\u002Fworkflows\u002Fci.yml)\n[![license: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg)](LICENSE)\n![node](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fnode-%3E%3D22-brightgreen)\n\n![Demo: the planner page switching between flat, top-weighted and bottom-weighted schedules](docs\u002Fassets\u002Fdemo.gif)\n\nCCA is a uniform-price auction run in continuous time. The obvious strategy, one bid at your maximum price, works against you here:\n\n- It fills at whatever the market clears at.\n- It is outbid the moment demand passes your cap.\n- It tells you nothing about how much of your budget comes back as a refund.\n\nThe right ladder depends on how much demand you expect from other bidders. Nobody publishes that number, so this tool makes you state it as an assumption and shows what happens under it.\n\nIt never holds keys and never signs anything. The `calldata` command encodes `submitBid` arguments for you to review and send with your own wallet.\n\n## Install\n\n```sh\n# run without installing\nnpx github:cocoa-butter\u002Fcca-bid-planner --help\n\n# or install the command\nnpm install -g github:cocoa-butter\u002Fcca-bid-planner\ncca-bid-planner --help\n```\n\nNot yet published to the npm registry. Installing from GitHub builds the package on install.\n\nRequires Node 22 or later. viem is the only runtime dependency.\n\n## Commands\n\n| Command    | What it does                                                                                                              |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------- |\n| `list`     | Lists live and upcoming auctions on a chain (`--all` adds ended ones).                                                    |\n| `inspect`  | Reads parameters and live state and prints a risk report. Every figure is labelled. `--save file.json` stores a snapshot. |\n| `plan`     | Builds a bid schedule for `--budget` and `--max-price`, then simulates it under four demand scenarios.                    |\n| `simulate` | Replays a given schedule (`--bid price:amount` or `--schedule plan.json`) against one scenario.                           |\n| `calldata` | Emits `submitBid` calldata, with `prevTickPrice` hints and Permit2 or msg.value notes.                                    |\n| `verify`   | Runs parameter sanity checks. Exit code 3 means a critical check failed.                                                  |\n\nSupported chains are `robinhood`, `ethereum`, `base`, `unichain` and `arbitrum`. Commands take one of:\n\n- `--chain \u003Cname> --auction \u003Caddress>` (public RPC)\n- `--rpc \u003Curl> --auction \u003Caddress>`\n- `--snapshot \u003Cfile>`\n\nAdd `--json` for machine-readable output.\n\n### `inspect`\n\n```sh\ncca-bid-planner list --chain robinhood\ncca-bid-planner inspect --chain robinhood --auction 0x... --save slop.json\n```\n\n```\nParameters and state\n  [obs] floor price                        0.00889 USDC\u002FSLOP\n  [obs] required currency raised           400,000 USDC\n  [der] full sale at floor raises          400,050 USDC\n  [obs] clearing price (last checkpoint)   0.00889 USDC\u002FSLOP\n  [der] clearing price (checkpointed now)  0.00889 USDC\u002FSLOP\n  [der] graduated (now)                    false\n  [der] supply released                    21.00% (schedule says 21.00%)\n  ...\nRisk checks\n  [WARN] Final block sells a significant share\n         last block releases 0.5% of supply (threshold used here: 1%). A thin final block\n         makes the final price, which seeds the pool, easy to manipulate.\n  [ ?  ] Checks this tool cannot do\n         Not checkable from the auction contract: honeypot or fee-on-transfer token\n         behaviour, the liquidity-launcher positionRecipient, ...\n```\n\n`[obs]` means read from chain, `[der]` means computed with protocol math, and `[asm]` means the figure depends on an assumption.\n\nThe samples here use `test\u002Ffixtures\u002Fdemo-snapshot.json`. It is a **synthetic** auction built from illustrative $SLOP figures (unverified) (floor 0.00889 USDC, 45M supply, 400k USDC minimum raise), with invented prior bids. It is not a chain read.\n\n### `plan`\n\n```sh\ncca-bid-planner plan --snapshot slop.json --budget 25000 --max-price 0.02196\n```\n\n```\nBid schedule (send in this order)\n  #  max price            amount      maxPriceQ96       prevTickPriceQ96\n  1  0.0089789 USDC\u002FSLOP  5,000 USDC  711381748399318   704338364751800\n  2  0.0121793 USDC\u002FSLOP  5,000 USDC  964943559709966   950856792414930\n  3  0.0154686 USDC\u002FSLOP  5,000 USDC  1225548754668132  1211461987373096\n  4  0.018669 USDC\u002FSLOP   5,000 USDC  1479110565978780  1472067182331262\n  5  0.0219583 USDC\u002FSLOP  5,000 USDC  1739715760936946  1535457635158924\n\nScenarios [asm]: other bidders add X currency, spread across prices up to the ceiling\n  scenario  external demand        tokens               spent               avg price             refund              final clearing        graduates\n  none      0 USDC                 0 SLOP               0 USDC              -                     25,000 USDC         0.00889 USDC\u002FSLOP     NO\n  low       273,287.451369 USDC    1,421,331.7004 SLOP  16,816.735564 USDC  0.01183168 USDC\u002FSLOP  8,183.264436 USDC   0.0152019 USDC\u002FSLOP   yes\n  base      546,574.902738 USDC    994,049.5286 SLOP    13,339.344169 USDC  0.01341919 USDC\u002FSLOP  11,660.655831 USDC  0.0197358 USDC\u002FSLOP   yes\n  high      1,093,149.805476 USDC  536,408.5832 SLOP    7,336.591938 USDC   0.01367725 USDC\u002FSLOP  17,663.408062 USDC  0.02484385 USDC\u002FSLOP  yes\n```\n\nOptions:\n\n- `--levels n`: number of price levels. Default 5.\n- `--weighting flat|top|bottom|auto`: how the budget is spread across the levels.\n- `--demand X`: your assumption about external demand. Without it, `X` is the demand that would lift clearing to your cap.\n- `--demand-ceiling`: highest price other bidders are assumed to pay.\n- `--arrival early|flat|late`: when the external demand arrives.\n\n`plan --json` output can be fed straight to `simulate --schedule` and `calldata --schedule`.\n\n### `simulate` and `calldata`\n\n```sh\ncca-bid-planner simulate --snapshot slop.json --bid 0.012:10000 --bid 0.018:15000 --demand 300000\ncca-bid-planner plan --snapshot slop.json --budget 25000 --max-price 0.02196 --json > plan.json\ncca-bid-planner calldata --snapshot slop.json --schedule plan.json --owner 0xYourAddress\n```\n\n### Website\n\n[cca-bid-planner.vercel.app\u002Fapp](https:\u002F\u002Fcca-bid-planner.vercel.app\u002Fapp) runs the same planner in your browser. It reads an auction directly from a public RPC, so nothing goes through a server. You can also paste a snapshot from `inspect --save`.\n\nThe query string holds the inputs, so a plan can be shared as a link:\n\n```\n\u002Fapp?chain=8453&auction=0x...&budget=40000&maxPrice=0.018&demand=300000\n```\n\nBuild and preview the site locally with `npm run dev:site`.\n\n### Library\n\n```ts\nimport { readSnapshot, clientFor, plan, toPriceQ96, toRaw } from 'cca-bid-planner';\n\nconst { snapshot } = await readSnapshot(clientFor(rpcUrl), auction);\nconst result = plan(snapshot, {\n  budget: toRaw('25000', snapshot.currency.decimals),\n  maxPrice: toPriceQ96('0.02196', snapshot.token.decimals, snapshot.currency.decimals),\n});\n```\n\nThe pure core, which has no I\u002FO, is also exported as `cca-bid-planner\u002Fcore`.\n\n## How the math works\n\nThe simulator is a bigint port of the contract's checkpoint, clearing-price and fill accounting, with the contract's rounding. `test\u002Fdifferential.test.ts` replays random auctions on the real `ContinuousClearingAuction` (v2.1.0) with Foundry and compares the results. Across 300 auctions and 2,405 bids, every fill, refund, clearing price and raise is equal to the wei.\n\n[docs\u002FMATH.md](docs\u002FMATH.md) has the formulas with worked examples. [docs\u002FRISKS.md](docs\u002FRISKS.md) maps each bidder risk to the check that covers it. [docs\u002FABI.md](docs\u002FABI.md) records where the ABI came from.\n\n## What this cannot tell you\n\n- **The demand forecast is an assumption.** Every expected fill and price is conditional on it and is labelled `[asm]`. This is a scenario calculator, not a price oracle.\n- **Auctions can fail to graduate.** If `currencyRaised` never reaches `requiredCurrencyRaised`, every bid is refunded in full and no tokens are sold. The `none` scenario usually shows this.\n- **Exits are restricted.**\n  - Nothing can be exited before the auction graduates.\n  - A bid that is filled, or sits at the final clearing price, can only exit after the end block.\n  - An outbid bid can exit early, but only once the auction has graduated.\n- **Clearing can move before your transaction lands.** A bid at or below the clearing price at inclusion reverts.\n- **Not checkable from the auction contract:**\n  - honeypot or fee-on-transfer tokens\n  - the liquidity-launcher `positionRecipient`\n  - whether the floor price is fair\n\n## Out of scope\n\n- Signing, key management and transaction submission.\n- Price prediction.\n- Non-CCA auctions.\n- Fee-on-transfer tokens and tokens with fewer than 6 decimals, which are unsupported upstream.\n- Portfolios spanning several auctions.\n\n## Credits\n\nThe Continuous Clearing Auction mechanism and contracts are by Uniswap Labs:\n\n- Contracts: [Uniswap\u002Fcontinuous-clearing-auction](https:\u002F\u002Fgithub.com\u002FUniswap\u002Fcontinuous-clearing-auction) (MIT). This tool pins `v2.1.0`.\n- Whitepaper: [docs\u002Fassets\u002Fwhitepaper.pdf](https:\u002F\u002Fgithub.com\u002FUniswap\u002Fcontinuous-clearing-auction\u002Fblob\u002Fmain\u002Fdocs\u002Fassets\u002Fwhitepaper.pdf) in that repository.\n- Uniswap docs: [Continuous Clearing Auction](https:\u002F\u002Fdocs.uniswap.org\u002Fcontracts\u002Fliquidity-launchpad\u002FCCA).\n\nWhat comes from the protocol:\n\n- the ABI\n- the constants\n- the arithmetic that `src\u002Fcore\u002Fengine.ts` ports\n\nWhat this project adds:\n\n- the planner (ladders, weighting and scenarios)\n- the simulator harness and the differential test against the real contract\n- the risk report and its labelling\n- the CLI and the demo page\n\nThis project is not affiliated with or endorsed by Uniswap Labs. See [NOTICE](NOTICE) and [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).\n\n## Contributing\n\nIssues and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) and the [code of conduct](CODE_OF_CONDUCT.md). Report security issues privately, as described in [SECURITY.md](SECURITY.md).\n\n## License\n\n[MIT](LICENSE)\n","这是一个面向 Uniswap 连续清算拍卖（CCA）的只读出价规划工具，帮助用户在统一价格、连续时间拍卖机制下制定最优阶梯式出价策略。核心功能包括：基于预算与需求假设生成多种出价曲线（如平价、顶部加权、底部加权），模拟不同竞标需求场景下的预期成交比例、平均成交价、最差情况及退款风险，并生成可审计的 `submitBid` calldata。项目采用 TypeScript 编写，依赖轻量（仅 viem），不接触私钥，纯前端计算。适用于参与 Uniswap CCA 的链上交易者、做市商及 DeFi 策略开发者进行事前出价建模与风险评估。",2,"2026-11-24 04:34:54","CREATED_QUERY"]