Skip to content

core: add overflow-safe arithmetic across all contracts #20

@EmeditWeb

Description

@EmeditWeb

Problem

Multiple contracts perform arithmetic on i128 amounts
without overflow checks. A carefully crafted large
loan amount or share calculation could overflow.

What To Build

  1. Create safe_math module in each contract
  2. Replace all +, -, * operations on financial values

Files To Touch

All 5 contract lib.rs and errors.rs files

Acceptance Criteria

  • All financial arithmetic uses checked ops
  • Overflow returns typed error not panic
  • Underflow returns typed error not panic
  • Tests with extreme values pass safely

Mandatory Checks Before PR

  • cargo build passes
  • All tests pass
  • PR references this issue

Metadata

Metadata

Assignees

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