mirror of
https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
synced 2026-11-02 06:16:10 +00:00
letsbonk.fun and StonkFun now share one LaunchLab implementation that prices from real reserves, trades any quote mint, spends exactly the buy amount, and accounts for the curve fee and Token-2022 transfer fees. Cleanup harvests withheld fees before closing an account. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
3.4 KiB
3.4 KiB
Cookbook conventions
Rules for adding or changing a script under cookbook/.
cookbook/README.md is the reader-facing index.
What belongs here
- One script, one action. Duplication across scripts is the accepted cost —
don't factor shared helpers out of them.
pumpfun_instructions.pyandsolana_transaction_status.pyare the two exceptions and the list is closed. Buy and sell never share a file. The create-and-buy scripts are the only two-action ones, and they come in a_txv0and a_txv1form: the Solana transaction version changes whether the launch is atomic, so it is the script that changes, not a flag. - Every script runs on its own:
uv run cookbook/<path>, reading.env. No bot config, no import fromsrc/. Anything that needs the bot goes intools/; anything that asserts a past bug stays fixed goes intests/regression/. - Directories are single lowercase words under a platform directory:
listen,read,trade,graduation,decode. - Files are
<protocol>_<verb>_<noun>[_<variant>].py, all snake_case. The protocol repeats what the directory says, on purpose — a basename is what shows up in an editor tab, a grep hit or a docs link.- protocol:
pumpfun,pumpswap,letsbonk,stonkfun,solana,anchor - verb:
buy,sell,create,snipe,listen,watch,read,derive,decode,check,capture,find - noun:
token,price,curve,pool,balances,transaction,migrations - variant: what the reader is choosing between —
exact_in/exact_out, a transport, ortxv0/txv1for the Solana transaction version - Don't put the pump instruction version in a basename. The cookbook ships
one form of each action, so
_v2tells the reader nothing and reads as a Solana transaction version, which is a different thing entirely. Name the instruction in the docstring instead. The retired path islegacy/. - the two non-runnable helpers take no verb, because they do nothing
- protocol:
- RPC and service names lowercase into one token, never camelCase:
blocksubscribe,logsubscribe,programsubscribe,getaccountinfo,gettransaction. - Anything not specific to a launchpad belongs under
solana/, notpumpfun/. - Input is a command-line argument, never a constant you edit. Every script
builds an
ArgumentParserinmain(): required values are positionals, tunables are--options, and anything the caller varies per run is one of them.DEFAULT_*constants are the only place a literal belongs.- A placeholder is not a default:
Pubkey.from_string("...")raises at import, so the script dies before printing its own usage. - Don't read config from environment variables either —
.envis for endpoints and keys, not for trade parameters no usage line mentions. sys.argvnever appears at module level. The nine listeners take no input and are exempt; they are listed in the verifier.
- A placeholder is not a default:
- Fixtures are
raw_<what>_from_<method>.json, next to the script that reads them. - Cite a URL only after checking it resolves.
uv run tests/regression/verify_documentation_links.py --livefetches every URL in the repo. - A script that spends says so on the first line of its docstring, and the
cookbook README marks it. The name is not a safety signal: every
*_buy_*,*_sell_*,*_create_*and*_snipe_*script submits real transactions.