Skip to content

CUR2-2025: exclude non-circulating owner wallets from Solana USDC supply#9682

Open
alicecha wants to merge 3 commits into
mainfrom
alice/cur2-2025-usdc-solana-non-circulating-owners
Open

CUR2-2025: exclude non-circulating owner wallets from Solana USDC supply#9682
alicecha wants to merge 3 commits into
mainfrom
alice/cur2-2025-usdc-solana-non-circulating-owners

Conversation

@alicecha
Copy link
Copy Markdown
Contributor

@alicecha alicecha commented May 18, 2026

Summary

  • Adds a parallel owner-keyed non-circulating inventory list (stablecoins_solana_{core,extended}_non_circulating_inventory_owners) alongside the existing token-account-keyed list. Any token account whose owner appears in the list is treated as non-circulating in stablecoins_solana_{core,extended}_balances.
  • Seeds the core list with three USDC owner wallets that DefiLlama and usdc.cool treat as non-circulating but Dune currently counts:
    • 7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE — Circle treasury
    • 41zCUJsKk6cMB94DDtm99qWmyMZfp4GkAhhuz4xTwePu
    • 42qwJUTbKf3D8ULfWadUSjnHf6pkJ4H1VjCcfSKHvDTN
  • Brings Solana USDC circulating supply in line with DefiLlama ($8.17b) and usdc.cool ($7.96b); current Dune value as of 2026-04-15 was $9.26b.

Why a separate owner list (vs. extending the existing token-account list)

The existing _inventory_accounts list keys on SPL token accounts, but the addresses above are owner wallets that hold non-circulating inventory across multiple token accounts (current and future). Resolving them to a fixed set of token accounts would be brittle. The new _inventory_owners list joins on from_owner / to_owner in the balances macro, so it covers all of an owner's token accounts automatically.

Linear: https://linear.app/dune/issue/CUR2-2025/review-and-fix-usdc-supply-on-solana

Test plan

  • Slim CI passes (uniqueness, not_null, accepted_values on new owners models)
  • After merge: re-run the issue's balance comparison query and confirm Solana USDC circulating supply on 2026-04-15 lands near DefiLlama (~$8.17b)

🤖 Generated with Claude Code

…ablecoin balances

Adds a parallel non-circulating inventory list keyed on owner_address (vs. the
existing token_account keyed list) so we can exclude wallets that hold balances
across multiple token accounts. Seeds it with the USDC Circle treasury and the
two additional owners DefiLlama treats as non-circulating, bringing Dune's
Solana USDC circulating supply in line with DefiLlama and usdc.cool.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented May 18, 2026

PR Summary

Medium Risk
Changes Solana stablecoin circulating-balance calculations by adding owner-address-based exclusions, which will shift reported supply metrics (notably USDC) and could affect downstream dashboards if the curated owner list is wrong.

Overview
Updates the stablecoins_svm_balances macro to exclude transfers involving non-circulating inventory owners (in addition to the existing token-account exclusion list) by joining on from_owner/to_owner and filtering them out.

Adds two new static helper models, stablecoins_solana_{core,extended}_non_circulating_inventory_owners, with schema/tests; the core model is seeded with three USDC owner wallets (Circle treasury + DefiLlama exclusions), while the extended list is currently empty.

Reviewed by Cursor Bugbot for commit 3868f43. Configure here.

@github-actions github-actions Bot marked this pull request as draft May 18, 2026 14:13
@github-actions github-actions Bot added WIP work in progress dbt: solana covers the Solana dbt subproject labels May 18, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Added where excluded silently drops premint account exclusions
    • Removed the where excluded filter from account-level exclusions so all premint token accounts remain excluded regardless of owner-list coverage.

Create PR

Or push these changes by commenting:

@cursor push 4b6d7373c2
Preview (4b6d7373c2)
diff --git a/dbt_subprojects/solana/macros/stablecoins/stablecoins_svm_balances.sql b/dbt_subprojects/solana/macros/stablecoins/stablecoins_svm_balances.sql
--- a/dbt_subprojects/solana/macros/stablecoins/stablecoins_svm_balances.sql
+++ b/dbt_subprojects/solana/macros/stablecoins/stablecoins_svm_balances.sql
@@ -17,7 +17,6 @@
     token_mint_address,
     token_account
   from {{ non_circulating_inventory_accounts_relation }}
-  where excluded
 ),
 
 non_circulating_inventory_owners as (

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 3868f43. Configure here.

alicecha and others added 2 commits May 20, 2026 10:58
The seed model marked official_circle_premint rows with excluded=false, so the
6 USDC premint accounts (~$190M as of 2026-05) leaked into circulating supply
even though they're tracked in the non-circulating inventory list. Expand the
excluded truthy set to cover both legacy_inventory and official_circle_premint;
the latter is non-circulating by Circle's own definition (per the Gateway
pre-mint blog referenced in the file).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ages

Replaces 4 split models (core+extended × accounts+owners) with 2 chain-level
lists (accounts + owners). The exclusion set is the same regardless of which
lineage a stablecoin lives in, so duplicating the seed across core/extended
added boilerplate without any benefit. The macro now refs the single chain-level
relation; the inner join against tokens_solana_spl_stablecoins_{core,extended}
is dropped (the inline VALUES are already constrained to known mints, and the
macro's join against the relevant transfers feed handles lineage filtering).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@alicecha alicecha marked this pull request as ready for review May 20, 2026 11:49
@github-actions github-actions Bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels May 20, 2026
@alicecha alicecha requested a review from a team May 20, 2026 12:43
@jeff-dude
Copy link
Copy Markdown
Member

looks like this new addition and left join lookup on balances really expanded incremental run time? unless this was always slow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dbt: solana covers the Solana dbt subproject ready-for-review this PR development is complete, please review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants