mirror of
https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
synced 2026-11-02 06:16:10 +00:00
pumpswap_buy_token and pumpswap_sell_token failed on every pool that did not graduate from a pump.fun bonding curve, with BuybackFeeRecipientNotAuthorized (6053). The scripts always sent the pool-v2 account. That account belongs only to a canonical pool; the buyback fee recipient and its quote ATA are always the last two accounts and are read positionally, so on a non-canonical pool pool-v2 shifted them by one and the program read the pool-v2 PDA as the recipient. Pool.coin_creator is the discriminator, set for canonical pools and left at Pubkey::default() otherwise. The IDL cannot answer this: it lists 23 accounts for buy against 25-26 on chain, 21 for sell against 23-26, and it is byte-identical to upstream. Upstream's BREAKING_FEE_RECIPIENT.md has the rule, in a qualifier that is easy to read past: the pair goes after pool-v2 "for coins that graduate from bonding curve", and is required either way. Fixing that exposed a second bug the first had been hiding. Both scripts hardcoded TOKEN_DECIMALS = 6, "standard for most pump.fun tokens" — true for every graduated coin, and wrong for the non-canonical pools, which routinely carry 9. Out by a factor of 1000, the quote and the slippage floor scale together, so the sell reverted ExceededSlippage (6004) rather than merely mispricing: Left: 2990, Right: 1500000. get_mint_info now returns the token program and the decimals from the one account read that was already happening, and raises instead of defaulting. Verified on mainnet. Simulation across 10 pools: 5 non-canonical that all failed 6053 before, 4 canonical that must not regress, and the pool from the original report. Then real round trips on both kinds — a 9-decimal non-canonical pool and a 6-decimal Token-2022 canonical one — buy and sell landed in each, wallet returned to SOL. verify_pumpswap_account_layout guards both bugs; checked against the pre-fix code first, where it fails 4 of 4. Suite is 21/21. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>