Skip to content

refactor: extract write_funding_close_snapshot_if_absent helper #502

Description

@sweet-baddy

Summary

The FundingCloseSnapshot write block was duplicated in escrow/src/lib.rs — once in fund_impl (open→funded transition) and again in partial_settle. Both constructed the same struct with total_principal, funding_target, ledger timestamp and sequence, gated by !has(&DataKey::FundingCloseSnapshot). Divergence between the two copies was a latent correctness risk for the pro-rata denominator.

Fix

Extracted a single private helper write_funding_close_snapshot_if_absent(&env, &escrow) called from both sites. No behavior change — write-once immutability and identical field values are preserved.

Commit

sweet-baddy/Liquifact-contracts@f0bb2d3

PR

Branch: refactor/funding-close-snapshot-helper

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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