Repository navigation
Conversation
Contributor
|
Hey @mijinummi, two CI checks are failing:
Please fix both and push an update. |
Contributor
Author
|
Alright sir @Sendi0011 , on it |
Contributor
|
Superseded by #270 — adopted into org repo, test moved to subgraph/tests/, lint and test placement failures fixed. Thanks @mijinummi for the original implementation! |
Sendi0011
added a commit
that referenced
this pull request
Sep 15, 2026
#241) (#270) * feat(analytics): build protocol-wide analytics dashboard * feat(analytics): adopt protocol analytics dashboard (#241) and fix lint + test placement Adopts mijinummi's protocol analytics dashboard (API route + Dashboard component) and the subgraph scaffolding (The Graph protocol indexer). Fixes two CI failures: 1. frontend/__tests__/pool.test.ts imported matchstick-as (a subgraph test framework not in frontend's deps) — moved to subgraph/tests/pool.test.ts where Graph projects expect matchstick tests to live. This also removes it from vitest's test roots (__tests__/). 2. prefer-const (5) and no-explicit-any (1) lint errors in pool.test.ts and route.ts fixed; route.ts error: any replaced with instanceof Error check. 3. Prettier run on route.ts and Dashboard.tsx. --------- Co-authored-by: mijinummi <tech.md.auwal@gmail.com> Co-authored-by: Sendi0011 <sendi0011@users.noreply.github.com>
Sendi0011
added a commit
that referenced
this pull request
Oct 16, 2026
* feat(analytics): build protocol-wide analytics dashboard * feat(analytics): adopt protocol analytics dashboard (#241) and fix lint + test placement Adopts mijinummi's protocol analytics dashboard (API route + Dashboard component) and the subgraph scaffolding (The Graph protocol indexer). Fixes two CI failures: 1. frontend/__tests__/pool.test.ts imported matchstick-as (a subgraph test framework not in frontend's deps) — moved to subgraph/tests/pool.test.ts where Graph projects expect matchstick tests to live. This also removes it from vitest's test roots (__tests__/). 2. prefer-const (5) and no-explicit-any (1) lint errors in pool.test.ts and route.ts fixed; route.ts error: any replaced with instanceof Error check. 3. Prettier run on route.ts and Dashboard.tsx. * docs: add yield allocation design spec Specifies a vault-agnostic adapter interface, a test mock vault, pool-side shared accounting with a liquidity buffer, and a governance flow that reuses the existing Custom proposal type so no enum or stored-proposal schema changes. Documents custody, share-value, and illiquidity risks. * feat(contract): add vault adapter interface for yield allocation Introduces the jointsave-yield-vault crate with the VaultAdapter trait (deposit, withdraw, share_price, max_redeemable, total_shares, total_assets), a shared VaultError enum, yield-allocation events, and the SHARE_SCALE / liquidity-buffer constants. The pool will depend only on this interface, so any vault implementation can be plugged in. * feat(contract): add mock yield vault for tests Implements MockVault as a self-contained VaultAdapter: 1:1 first deposit, live share price from its token balance, floor-rounded withdrawals, and a set_locked_assets admin control to simulate illiquidity deterministically. Includes unit tests and a CI wasm build step. * feat(contract): route yield allocation proposals through governance Extends the Custom proposal dispatcher: a Custom proposal carrying an 'action' parameter (alloc/dealloc) is forwarded via CPI to the pool's apply_yield_allocation / apply_yield_deallocation entrypoints, using the existing i128 param encoding and a strkey vault parameter. Proposals without an 'action' parameter keep the previous behaviour, so the closed ProposalType enum and stored proposal schema are unchanged. Adds mock-pool tests. * feat(contract): allocate idle pot capital into a yield vault Adds apply_yield_allocation (admin or governance only) which moves idle capital into a vault implementing the adapter, tracks the pool's shares and cost basis, and enforces a configurable liquidity buffer (default 20%) so the pot always keeps enough liquid for withdrawals. Adds set_yield_buffer and read-only views. The yield-vault mock is feature-gated so it is not linked into the pool's wasm. * feat(contract): add vault de-allocation and buffer-safe withdrawals Adds apply_yield_deallocation (admin, governance, or any member) which redeems shares and degrades gracefully to a partial recovery when the vault is illiquid, removing proportional cost basis. Withdrawals now pull the shortfall back from the vault automatically and only revert with a clear 'vault illiquid' error when the pot is genuinely short, so member funds are never trapped. Adds set_yield_locked emergency mode. * feat(contract): realise and distribute vault yield pro-rata Adds sync_yield (admin, governance, or any member) which values the pool's vault position at the live share price, credits any gain to members pro-rata by principal balance using floor division, and advances the cost basis by exactly what was credited so the rounding remainder stays in the pot as still-unrealised yield. Adds yield_position and unrealised_yield views. * test(contract): add yield allocation edge-case tests Covers illiquidity (partial de-allocation, locked vaults, withdraw panic path), buffer enforcement (zero buffer), rounding and zero-amount rejections, paused pool behavior, and the governance Custom dispatch paths (double-vote/unauthorized already covered). All existing and new tests pass. * feat(frontend): add yield allocation bindings and hooks Extends useJointSaveContracts with fetchYieldAllocationState and hooks to apply allocation, deallocate, sync yield, set buffer, and set lock on the flexible pool. Mirrors existing contract interaction patterns with loading state and proper argument encoding. * feat(frontend): add yield allocation service layer and data hook Adds framework-free helpers (buffer/max-allocatable/share-price/unrealised gain) mirroring the contract invariants with unit tests, plus useYieldAllocation which loads the on-chain position and exposes apply/deallocate/sync/buffer/lock actions that refetch after each mutation. * feat(frontend): create yield allocation proposals Extends the create-proposal dialog with an Allocate/De-allocate option for flexible pools that encodes a Custom governance proposal carrying action, vault and amount parameters (16-byte BE i128), matching the contract's dispatch_custom routing. Adds pure param-encoding helpers with unit tests and en/es copy. * feat(frontend): show yield allocation details in voting UI Parses proposal parameters out of the on-chain map and renders the decoded action, amount and vault on each yield proposal card so members know what they are voting on. Unifies the duplicate GovernanceProposal types onto lib/governance as a single source of truth and adds decode/format helpers with unit tests. * feat(frontend): extend yield dashboard with vault allocation Adds a vault-allocation section to the flexible-pool yield dashboard showing the position value, unrealised yield, share price, liquidity buffer and available-to-allocate, plus controls to allocate, de-allocate, sync yield and toggle the vault lock. Reuses the useYieldAllocation hook with loading/error/ empty states and adds en/es copy. * feat(frontend): surface illiquidity states in withdraw flow Adds an in-UI banner for flexible pools when the yield vault is locked with allocated shares, warns about withdrawal limits, and updates the withdraw hint to reflect automatic on-chain de-allocation from vaults. Fetches yield state to detect illiquidity. * test(frontend): add yield dashboard and vote card tests Add manual-mock exports for the yield allocation hooks so the group-actions component test can render the extended withdraw flow, and cover the vault allocation dashboard section plus the yield proposal details in the voting UI. * docs: document vault-backed yield allocation Add a threat model for the vault-backed yield feature, document the mock vault and its deployment in the smart-contract README, extend deploy.sh to build/upload/deploy/initialize the mock vault and record its wasm hash and contract id, and reference the feature from the root README. * test(contract): silence clippy unused-variable warnings The CI clippy job runs with --all-targets, which lints test code too and rejected two bindings that are only used for their side effects in the yield allocation edge-case tests. --------- Co-authored-by: mijinummi <tech.md.auwal@gmail.com> Co-authored-by: Sendi0011 <sendi0011@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
[Feature] Build a Protocol-Wide Analytics Dashboard #204
Summary
Closes #204
Implemented a protocol-wide analytics dashboard that provides a centralized view of key protocol metrics, including Total Value Locked (TVL), active pools, member growth, and transaction volume.
The dashboard is designed to give users and protocol stakeholders a clear overview of protocol activity and growth through concise metrics and visual analytics.
What Was Implemented
📊 Protocol Metrics
📈 Analytics Dashboard
Technical Implementation
Testing & Validation
The implementation has been:
Expected Outcome
This feature provides a single, protocol-wide view of important growth and activity indicators, making it easier to:
Related Issue
Closes/Addresses #204 — [Feature] Build a protocol-wide analytics dashboard showing TVL, active pools, member growth, and transaction volume.
Status
Complete and ready for review.