sql mod - #106
Conversation
…eries Soroban #[contractevent] emits snake_case topic symbols (event_created, winner_paid, funds_added, ...), not the PascalCase struct names these queries filtered on. Verified against live mainnet data: every query returned 0 rows until the names were corrected. Also: - 04/07: fix the payout-model comments — the contract pushes payment inside select_winners; there is no separate claim step, so time-to-payout is creation -> selection, not claim latency - 05: count hackathon submitters (open-submission pillar) as builders, not only applicants - 09: actually isolate crowdfunding contributions by joining funds_added to Crowdfunding-pillar events (was summing all add_funds) - 06: correct the id/event_id note — event_cancelled carries id
…ent-names fix(dune): correct event-name casing in dashboard queries
Quota reachedYour plan allows 300 CI/CD file units per month. You've used 299 and this scan would add 10 more (total: 309). |
📝 WalkthroughWalkthroughUpdated Dune SQL queries and decoding documentation to use snake_case event names. Crowdfunding contributions now join ChangesDune query event alignment
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/dune-queries/01_tvl_current.sql`:
- Around line 6-7: Update the documentation wording describing #[contractevent]
in docs/dune-queries/01_tvl_current.sql lines 6-7 and
docs/dune-queries/10_event_created_decode_test.sql lines 6-8: replace the claim
that it lowercases struct names with wording that it converts struct names to
snake_case, preserving the EventCreated to event_created example.
In `@docs/dune-queries/05_unique_participants.sql`:
- Line 28: Remove the redundant “Builders” banner comment immediately preceding
the UNION in the unique participants query, leaving the query and the existing
rationale comments unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 63bcc7f3-4bf8-4305-be59-a941c68f60e8
📒 Files selected for processing (10)
docs/dune-queries/01_tvl_current.sqldocs/dune-queries/02_tvl_over_time.sqldocs/dune-queries/03_bounties_funded.sqldocs/dune-queries/04_total_payouts.sqldocs/dune-queries/05_unique_participants.sqldocs/dune-queries/06_event_outcomes.sqldocs/dune-queries/07_avg_size_and_ttp.sqldocs/dune-queries/08_payout_by_token.sqldocs/dune-queries/09_crowdfunding_contributions.sqldocs/dune-queries/10_event_created_decode_test.sql
| -- event name -> topics_decoded '$[0].symbol' (snake_case: #[contractevent] | ||
| -- lowercases the struct name, e.g. EventCreated -> event_created) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Describe this as snake_case conversion, not lowercasing.
Lowercasing EventCreated yields eventcreated; the underscore requires snake_case conversion.
docs/dune-queries/01_tvl_current.sql#L6-L7: replace “lowercases the struct name” with “converts the struct name to snake_case.”docs/dune-queries/10_event_created_decode_test.sql#L6-L8: make the same wording correction.
📍 Affects 2 files
docs/dune-queries/01_tvl_current.sql#L6-L7(this comment)docs/dune-queries/10_event_created_decode_test.sql#L6-L8
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/dune-queries/01_tvl_current.sql` around lines 6 - 7, Update the
documentation wording describing #[contractevent] in
docs/dune-queries/01_tvl_current.sql lines 6-7 and
docs/dune-queries/10_event_created_decode_test.sql lines 6-8: replace the claim
that it lowercases struct names with wording that it converts struct names to
snake_case, preserving the EventCreated to event_created example.
| IN ('applied', 'submitted', 'winner_paid', 'milestone_claimed', 'event_created') | ||
| ) | ||
| -- Builders: applied to or received a payout from any event | ||
| -- Builders: applied to, submitted to, or received a payout from any event |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the redundant builders banner.
It restates the following UNION; lines 4-11 already preserve the non-obvious participation rationale.
Proposed fix
--- Builders: applied to, submitted to, or received a payout from any event
SELECTAs per coding guidelines, “Comment sparingly” and “Do not narrate code behavior.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| -- Builders: applied to, submitted to, or received a payout from any event |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/dune-queries/05_unique_participants.sql` at line 28, Remove the
redundant “Builders” banner comment immediately preceding the UNION in the
unique participants query, leaving the query and the existing rationale comments
unchanged.
Source: Coding guidelines
Summary by CodeRabbit
Documentation
Tests