Skip to content

Audit and consolidate .unwrap_or patterns #119

Description

@nanaf6203-bit

Problem Statement
The codebase has unwrap_or, unwrap_or_else, and unwrap strewn
across the file — some fire panic_with_error, others silently
default to 0 or false. There's no shared helper.

Why it matters
Silent defaults are dangerous. .unwrap_or(0) on a balance is
distinguishable from "balance genuinely zero" only by checking the
key.

Acceptance Criteria

  • All unwrap_or(0) on persistent storage reads replaced by explicit
    get::<_, i128> checks that distinguish "missing" from "zero".
  • All unwrap_or(false) on Paused distinguished from "key missing
    vs key unset".

Files/Modules Affected

  • src/lib.rs
  • src/test.rs

Difficulty Medium. Estimated Effort S.

Labels
area:code-quality, area:smart-contract-safety,
priority:medium


Imported from docs/open-issues-draft.md as draft issue #59 (commit 7becd4b). Original draft-order cross-references in this body have been remapped to current GitHub issue numbers at import time.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions