Skip to content

Dead/duplicate interest-rate and storage-accessor code in logic.rs and storage.rs #331

Description

@abayomicornelius

Area

Project Registry / Code Quality

Complexity

Easy

File(s)

project_registry/src/logic.rs:61-75 (calculate_interest_rate), project_registry/src/storage.rs:4-35 (all six functions), vs. project_registry/src/lib.rs:1214-1218 (compute_rate)

Problem

logic::calculate_interest_rate implements the same rate formula as the private compute_rate in lib.rs, but with an added underflow guard that compute_rate lacks. A grep shows calculate_interest_rate is never called from lib.rs — it's defined but dead. Similarly, storage.rs's read_project/write_project/read_proposal/write_proposal/read_whitelist/write_whitelist are never referenced from lib.rs, which inlines env.storage() calls directly everywhere instead. Both modules are effectively dead abstractions that have drifted from what the contract actually does, risking a future storage/rate change being made in the "live" copy in lib.rs but not mirrored.

Scope

In:

  • Either delete the unused functions, or refactor lib.rs to actually call through storage.rs/logic.rs.

Out:

  • Any behavior change to the rate formula itself.

Acceptance Criteria

  • No unused public functions remain in logic.rs/storage.rs, either because they're deleted or because lib.rs now calls them
  • compute_rate and calculate_interest_rate are unified into one implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programcontractSmart contract logic and designgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions