📌 Description
src/routes/orgAnalytics.ts exposes basic org analytics but has no endpoint
that reports slash rate (fraction of vaults that ended in slash_on_miss)
and capital-at-risk (USDC currently locked in active vaults) for an
organization. These are the two numbers an operator needs to gauge protocol
health for their org.
This issue adds a dedicated analytics endpoint computing both metrics with
date-range filtering.
Goal: give org operators a slash-rate and capital-at-risk view filtered by
a date range, derived from persisted analytics storage.
🎯 Requirements and Context
- Must be org-scoped and tenant-isolated.
- Date-range boundaries must be handled in UTC (reuse
src/utils/timestamps.ts).
- Slash rate must exclude in-flight vaults from the denominator correctly.
- Capital-at-risk must reflect net staked amounts, not gross.
🛠️ Suggested Execution
1. Fork the repo and create a branch
git checkout -b feature/org-slash-rate-analytics
2. Implement changes
- Add
GET /api/orgs/:orgId/analytics/risk to src/routes/orgAnalytics.ts.
- Add aggregation to
src/services/analytics.service.ts.
- Document the metric definitions in
docs/analytics-metrics.md.
3. Test and commit
- Add
src/tests/orgAnalytics.risk.test.ts run with bun test.
- Cover edge cases: zero vaults, all-active (denominator), date boundary
inclusivity, and cross-org isolation.
Example commit message
feat: org slash-rate and capital-at-risk analytics endpoint
✅ Guidelines
- Minimum 95% test coverage on the new/changed lines.
- Clear, reviewer-friendly documentation.
- No regressions on existing analytics endpoints.
- Timeframe: 96 hours.
🏷️ Labels
type-feature · area-backend · type-testing · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN
💬 Community & Support
- Join the Disciplr contributor Discord to coordinate, ask questions, and get
unblocked fast: https://discord.gg/xvNAvMJf
- Please introduce yourself in the channel before you start so we can avoid
duplicate work, pair you with a reviewer, and get your PR merged quickly.
- Maintainers actively triage this channel and aim for fast, clear, respectful
reviews — reach out any time you're blocked.
📌 Description
src/routes/orgAnalytics.tsexposes basic org analytics but has no endpointthat reports slash rate (fraction of vaults that ended in
slash_on_miss)and capital-at-risk (USDC currently locked in active vaults) for an
organization. These are the two numbers an operator needs to gauge protocol
health for their org.
This issue adds a dedicated analytics endpoint computing both metrics with
date-range filtering.
🎯 Requirements and Context
src/utils/timestamps.ts).🛠️ Suggested Execution
1. Fork the repo and create a branch
2. Implement changes
GET /api/orgs/:orgId/analytics/risktosrc/routes/orgAnalytics.ts.src/services/analytics.service.ts.docs/analytics-metrics.md.3. Test and commit
src/tests/orgAnalytics.risk.test.tsrun withbun test.inclusivity, and cross-org isolation.
Example commit message
✅ Guidelines
🏷️ Labels
type-feature·area-backend·type-testing·MAYBE REWARDED·GRANTFOX OSS·OFFICIAL CAMPAIGN💬 Community & Support
unblocked fast: https://discord.gg/xvNAvMJf
duplicate work, pair you with a reviewer, and get your PR merged quickly.
reviews — reach out any time you're blocked.