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
Summary
The
FundingCloseSnapshotwrite block was duplicated inescrow/src/lib.rs— once infund_impl(open→funded transition) and again inpartial_settle. Both constructed the same struct withtotal_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