Skip to content

feat: add SafetyNetViewer read-only companion contract#75

Open
Tranquil-Flow wants to merge 1 commit intodevfrom
11-frontend-view-methods
Open

feat: add SafetyNetViewer read-only companion contract#75
Tranquil-Flow wants to merge 1 commit intodevfrom
11-frontend-view-methods

Conversation

@Tranquil-Flow
Copy link
Copy Markdown

Summary

Creates a read-only SafetyNetViewer companion contract that aggregates data the frontend needs into single calls, reducing RPC round-trips.

New Files

  • src/interfaces/ISafetyNetViewer.sol — 3 structs + 3 view function signatures
  • src/contracts/SafetyNetViewer.sol — read-only contract, constructor takes SafetyNet address
  • test/unit/SafetyNetViewer.t.sol — 9 tests

View Functions

  • getMemberEpochStatus(id, member) → hasDeposited, duesRemaining, smallWithdrawsUsed, withdrawableBalance, currentEpoch
  • getPoolLiquidity(id) → totalBalance, memberCount, activeMemberCount
  • getMemberDashboard(id, member) → combines epoch status + pool liquidity + member's safety net IDs

Testing

9 new tests covering all three functions across deposit states. All 106 tests pass.

Closes #11

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.

Add view methods aggregating all frontend data

1 participant