feat: add SUI USDC stablecoin transfer model#9521
Closed
Evan-Kim2028 wants to merge 3 commits intoduneanalytics:mainfrom
Closed
feat: add SUI USDC stablecoin transfer model#9521Evan-Kim2028 wants to merge 3 commits intoduneanalytics:mainfrom
Evan-Kim2028 wants to merge 3 commits intoduneanalytics:mainfrom
Conversation
Redesign of duneanalytics#9308 with three clean sources: - Direct sends from sui.objects Created objects - Mints from Circle treasury::Mint events - Burns from Circle treasury::Burn events Key fix: burns must use events because Deleted objects lose their coin_type on Sui. The duneanalytics#9308 approach silently produces $0 burn volume. Verified against duneanalytics#9308 for Apr 1, 2026: - direct_send: 6,472 rows / $36.4M (exact match) - mint: 188 rows / $9.6M (exact match) - burn: 293 rows / $5.1M (duneanalytics#9308 produces 0 rows)
…9308 Drop the ownership_transfers CTE — matching duneanalytics#9496's reconciliation logic requires their full model chain. Keep the focused contribution: 1. Event-based burns (the only working approach) 2. Event-based mints (verified exact match) 3. Credit-side direct sends (same as duneanalytics#9308)
…t mints/burns - Restores day_rows/anchors/calc/enriched/filtered from duneanalytics#9308 for full direct_send + transfer_with_balance_change coverage - Event-based mints: captures all 188 treasury::Mint events (merged model misses 38 mints/$4.89M due to tx_net_delta filter) - Event-based burns: captures 293 treasury::Burn events/$5.1M (merged model produces $0 — Deleted objects lose coin_type) - Verified exact parity: 6,472 direct_sends + 18 ownership transfers match merged model to the cent
Contributor
|
@Evan-Kim2028 thanks for the feedback here, much appreciated! I incorporated it into PR #9517, so I’m closing this one in favor of that updated version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhancement to #9308 that fixes Circle CCTP burn tracking and improves mint completeness using event-based amounts from
sui.events.Keeps #9308's object pipeline for direct sends and ownership transfers. Replaces object-based mint/burn detection with
treasury::Mintandtreasury::Burnevent JSON payloads.Circle CCTP Event Details
Contract and event types
0xecf47609d7da919ea98e7fd04f6e0648a0a79b337aaad373fa37aac8febf19c8treasurytreasury::Mint<0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC>0xecf47609d7da919ea98e7fd04f6e0648a0a79b337aaad373fa37aac8febf19c8treasurytreasury::Burn<0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC>USDC coin type:
0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDCEvent JSON payloads
Mint — contains amount and recipient:
{"amount": "826829", "mint_cap": "0xee9b9de94793bab42232dbdb82a8e090bb2e1eb192ef498e421b7e9390555918", "recipient": "0x39bb1dfbe50fbafa713369a6203ab56705fcbfc98cc6473f28ac57503479844b"}Burn — contains amount (coins are destroyed, no recipient):
{"amount": "13846570", "mint_cap": "0xee9b9de94793bab42232dbdb82a8e090bb2e1eb192ef498e421b7e9390555918"}How to query these events on Dune
Two fixes
1. Burns: $5.1M/day recovered (was $0)
Deleted objects on Sui lose their
coin_typefield. #9308 filterssui.objects WHERE coin_type = USDC AND object_status = 'Deleted'— this returns zero rows. Burn amounts only exist in thetreasury::Burnevent JSON.2. Mints: 38 additional events/$4.89M per day
The merged #9496 model's
supply_signalsonly flags mints wheretx_net_delta > 0, missing mint transactions that also have other balance changes. Event-based approach captures alltreasury::Mintevents.Supply reconciliation (full history verification)
Cumulative mints minus burns from events should equal current USDC circulating supply. Tested across the full history from USDC launch (2024-09-18) through Apr 2, 2026:
treasury::Minteventstreasury::BurneventsThe event-based net supply ($379.3M) lands squarely between Allium's Apr 1 and Apr 2 daily snapshots. The small discrepancy is consistent with intraday supply changes — Dune events include full-day activity while Allium snapshots at a fixed time.
Every USDC on Sui was minted via
treasury::Mintand burned viatreasury::Burn. The cumulative event sum reconciles to the actual circulating supply.Dune query ID:
6942011(supply reconciliation)Transfer parity verification (Apr 1, 2026)
object_created)Direct sends and ownership transfers use the same anchor pipeline as #9308 — exact parity. Mint event amounts verified 188:188 exact match against Created object
coin_balance(zero discrepancy).Dune query ID:
6942000(transfer parity)Architecture
Object pipeline from #9308 for transfer detection:
Then 4 output categories (credit-side, 1 row per transfer):
direct_sends— Created objects wheretx_sender != receiverownership_transfers— Mutated objects whereprev_owner != receiverandbalance_delta > 0mints—treasury::Mintevent JSON amount + recipientburns—treasury::Burnevent JSON amountScope
Test plan
unique_combination_of_columnstest on(block_date, unique_key)