Skip to content

Add PumpSwap BuyExactQuoteIn trades - #9834

Merged
jeff-dude merged 12 commits into
mainfrom
robin/CUR2-1699-pumpfun-buy
Aug 26, 2026
Merged

Add PumpSwap BuyExactQuoteIn trades#9834
jeff-dude merged 12 commits into
mainfrom
robin/CUR2-1699-pumpfun-buy

Conversation

@0xRobin

@0xRobin 0xRobin commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Adds PumpSwap BuyExactQuoteIn trades to the existing pumpswap_solana_base_trades_backfill path, sourced from BuyEvent. BuyExactQuoteIn (0xc62e1552b4d9e870) is present on-chain in raw instruction data but is not decoded into pump_amm_call_buy; the emitted BuyEvent carries the actual amounts.

The model anti-joins existing pump_amm_call_buy rows to avoid double-counting legacy Buy coverage while preserving the existing call-backed trade path.

Impact

Since 2025-11-01, this covers an additional 208,873,603 PumpSwap trades and $11.24B in volume.

That is a +42.05% trade-count uplift and +37.42% USD-volume uplift over current same-period PumpSwap coverage. Relative to current all-time PumpSwap coverage, it adds +16.83% more trades and +11.85% more USD volume.

CUR2-1699

@github-actions github-actions Bot added the WIP work in progress label Jun 26, 2026
@cursor

cursor Bot commented Jun 26, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Trade amounts and dedup logic for new event-only buys affect DEX trade metrics; the unrelated removal of jupiter_evt_swapsevent from sources could break Jupiter models if that change ships as-is.

Overview
Extends PumpSwap staging to ingest buy swaps that only appear in decoded events, not in pump_amm_call_buy, so trades aren’t dropped when call decoding is missing.

pumpswap_solana_stg_decoded_swaps now carries a quote_amount (null on existing buy/sell call rows). A new branch unions pump_amm_evt_buyevent rows joined to Pump AMM instruction_calls (program id + instruction discriminator) and anti-joins matching buy calls on tx, instruction index, pool, and base amount so call-backed history stays unchanged.

pumpswap_solana_base_trades_backfill still derives quote size from token transfers when quote_amount is null; when it’s set (event-only buys), it skips transfer matching and uses the event’s quote_amount_in because quote flow is split across pool and fee accounts.

Registers pump_amm_evt_buyevent as a dbt source and updates the staging model description. The diff also drops jupiter_evt_swapsevent from _sources.yml, which is unrelated to PumpSwap and may affect models that still reference that source.

Reviewed by Cursor Bugbot for commit 774a9a1. Configure here.

@github-actions github-actions Bot added the dbt: solana covers the Solana dbt subproject label Jun 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Instruction join omits inner index
    • Added COALESCE(i.inner_instruction_index, 0) = COALESCE(e.evt_inner_instruction_index, 0) to the instruction_calls join so each BuyEvent matches exactly one CPI invocation.
  • ✅ Fixed: Missing instruction_calls prefix predicate
    • Added executing_account_prefix = 'pA' to the instruction_calls join for partition pruning, matching sibling PumpSwap models.

Create PR

Or push these changes by commenting:

@cursor push 6e66369adb
Preview (6e66369adb)
diff --git a/dbt_subprojects/solana/models/_sector/dex/pumpswap/staging/pumpswap_solana_stg_decoded_swaps.sql b/dbt_subprojects/solana/models/_sector/dex/pumpswap/staging/pumpswap_solana_stg_decoded_swaps.sql
--- a/dbt_subprojects/solana/models/_sector/dex/pumpswap/staging/pumpswap_solana_stg_decoded_swaps.sql
+++ b/dbt_subprojects/solana/models/_sector/dex/pumpswap/staging/pumpswap_solana_stg_decoded_swaps.sql
@@ -96,7 +96,9 @@
         ON i.block_date = e.evt_block_date
         AND i.tx_id = e.evt_tx_id
         AND i.outer_instruction_index = e.evt_outer_instruction_index
+        AND COALESCE(i.inner_instruction_index, 0) = COALESCE(e.evt_inner_instruction_index, 0)
         AND i.executing_account = 'pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA'
+        AND i.executing_account_prefix = 'pA'
         AND bytearray_substring(i.data, 1, 8) = 0xc62e1552b4d9e870
         AND i.tx_success
     LEFT JOIN {{ source('pumpdotfun_solana', 'pump_amm_call_buy') }} c

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 774a9a1. Configure here.

@0xRobin 0xRobin changed the title Add PumpSwap event-only buy swaps Add PumpSwap BuyExactQuoteIn trades Jun 30, 2026
@0xRobin
0xRobin force-pushed the robin/CUR2-1699-pumpfun-buy branch from c7aca88 to 43a90d4 Compare June 30, 2026 09:28
@0xRobin
0xRobin marked this pull request as ready for review June 30, 2026 09:49
@github-actions github-actions Bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Jun 30, 2026

@jeff-dude jeff-dude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proactive approval with revert needed
{# TEMP CI scope: revert begin to protocol_begin before merge. #}

this one will take awhile to run on deploy

@jeff-dude jeff-dude added ready-for-merging and removed ready-for-review this PR development is complete, please review labels Jun 30, 2026
@jeff-dude
jeff-dude merged commit 82a436a into main Aug 26, 2026
8 of 10 checks passed
@jeff-dude
jeff-dude deleted the robin/CUR2-1699-pumpfun-buy branch August 26, 2026 14:57
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dbt: solana covers the Solana dbt subproject ready-for-merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants