Skip to content

Add view functions get_milestone_status and get_status for off-chain sync in accountability_vault #360

@1nonlypiece

Description

@1nonlypiece

Add view functions get_milestone_status and get_status for off-chain sync in accountability_vault

Description

The backend src/services/eventParser.ts and vault sync rely on reconstructing state from events, but only get_vault exists for direct reads in contracts/accountability_vault/src/lib.rs. Add lightweight read-only get_status (returning VaultStatus) and get_milestone_status(index) (returning verified flag + due_date) so the backend can reconcile state cheaply. Cover both in contracts/accountability_vault/src/test.rs.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Add get_status and get_milestone_status to contracts/accountability_vault/src/lib.rs
  • Return types friendly to scValToNative used in src/services/eventParser.ts
  • Keep functions read-only (no require_auth)
  • Add read-path tests in contracts/accountability_vault/src/test.rs

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/contract-view-functions
  • Implement changes
    • Modify contracts/accountability_vault/src/lib.rs
    • Add tests in contracts/accountability_vault/src/test.rs
    • Document views in contracts/README.md
    • Add index bounds checks
  • Test and commit
    • Run tests, cover edge cases
    • Include test output and notes

Example commit message

feat: add vault status and milestone view functions

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions