Skip to content

sql mod - #106

Open
Benjtalkshow wants to merge 2 commits into
boundlessfi:testnetfrom
Benjtalkshow:testnet
Open

sql mod#106
Benjtalkshow wants to merge 2 commits into
boundlessfi:testnetfrom
Benjtalkshow:testnet

Conversation

@Benjtalkshow

@Benjtalkshow Benjtalkshow commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Documentation

    • Updated Dune analytics queries to recognize decoded event names in lowercase snake_case.
    • Clarified event field mappings, payout timing, and participant calculations.
    • Improved crowdfunding contribution reporting by limiting results to crowdfunding events.
  • Tests

    • Updated event-decoding validation to reflect the current event-name format.

Benjtalkshow and others added 2 commits July 29, 2026 01:18
…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
@almanax-ai

almanax-ai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Quota reached

Your plan allows 300 CI/CD file units per month. You've used 299 and this scan would add 10 more (total: 309).

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Updated Dune SQL queries and decoding documentation to use snake_case event names. Crowdfunding contributions now join funds_added events to Crowdfunding event_created records, and the decode test reflects the updated naming.

Changes

Dune query event alignment

Layer / File(s) Summary
Decoded event naming and TVL queries
docs/dune-queries/01_tvl_current.sql, docs/dune-queries/02_tvl_over_time.sql, docs/dune-queries/03_bounties_funded.sql
TVL and bounty filters and documentation now use snake_case decoded event names.
Payout and participant analytics
docs/dune-queries/04_total_payouts.sql, docs/dune-queries/05_unique_participants.sql, docs/dune-queries/06_event_outcomes.sql, docs/dune-queries/07_avg_size_and_ttp.sql, docs/dune-queries/08_payout_by_token.sql
Payout, participant, outcome, time-to-payout, and token queries use updated event names and identifier mappings.
Crowdfunding isolation and decode validation
docs/dune-queries/09_crowdfunding_contributions.sql, docs/dune-queries/10_event_created_decode_test.sql
Crowdfunding contributions are scoped through Crowdfunding event records, and decode expectations use snake_case names.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: 0xdevcollins

Poem

I’m a rabbit with queries to tune,
Chasing snake_case across Dune.
Crowdfunding paths join,
Decode tests now align,
And events bloom under the moon.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to describe the change and could apply to many unrelated SQL edits. Replace it with a concise title that states the main change, such as updating SQL queries for snake_case event names.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b12a976 and df9405b.

📒 Files selected for processing (10)
  • docs/dune-queries/01_tvl_current.sql
  • docs/dune-queries/02_tvl_over_time.sql
  • docs/dune-queries/03_bounties_funded.sql
  • docs/dune-queries/04_total_payouts.sql
  • docs/dune-queries/05_unique_participants.sql
  • docs/dune-queries/06_event_outcomes.sql
  • docs/dune-queries/07_avg_size_and_ttp.sql
  • docs/dune-queries/08_payout_by_token.sql
  • docs/dune-queries/09_crowdfunding_contributions.sql
  • docs/dune-queries/10_event_created_decode_test.sql

Comment on lines +6 to +7
-- event name -> topics_decoded '$[0].symbol' (snake_case: #[contractevent]
-- lowercases the struct name, e.g. EventCreated -> event_created)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 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
 SELECT

As 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.

Suggested change
-- 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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant