Skip to content

[vault-contract] Replace .expect() with custom errors in critical paths #25

@Villarley

Description

@Villarley

Based on SECURITY_AUDIT_VAULT_CONTRACT-V1.0.0.md (finding F-04).

Severity: High

Summary

Replace the 14 .expect() calls with ok_or(ContractError::XxxNotFound)? in functions that return Result.

Acceptance criteria

  • Add ContractError variants for missing storage keys (e.g. EnabledNotFound, RoiPercentageNotFound, etc.)
  • Replace .expect() in claim, availability_for_exchange with proper error propagation
  • Document or refactor getters that assume initialized state
  • Tests pass
  • Scout no longer reports unsafe expect at lines 142, 152, 158, 173

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions