Skip to content

Add optional funding target to escrow (#144) - #190

Open
laurentketterle-hub wants to merge 1 commit into
MergeFi:mainfrom
laurentketterle-hub:feat/escrow-funding-target-144
Open

Add optional funding target to escrow (#144)#190
laurentketterle-hub wants to merge 1 commit into
MergeFi:mainfrom
laurentketterle-hub:feat/escrow-funding-target-144

Conversation

@laurentketterle-hub

Copy link
Copy Markdown

Closes #144.

Adds an optional target: Option<i128> to fund(), stored on the Escrow
record and read-only thereafter. It is informational only — it does not block
contribute from pushing amount past it and does not change
release/refund behavior — but it gives sponsor-facing UI an on-chain
"raised X of target Y" number instead of one tracked off-chain that can drift
from on-chain truth.

Changes

  • contracts/escrow/src/types.rs: add target: Option<i128> to Escrow.
  • contracts/escrow/src/lib.rs: accept and store target in fund(); document it.
  • contracts/escrow/src/test.rs: pass None at every existing fund call site,
    and add test_fund_stores_optional_target_and_contribute_past_it covering:
    • Some(target) round-trips through get_escrow,
    • contribute past the target grows amount but never mutates target,
    • None is the default.
  • README.md + docs/escrow-crowdfunding-design.md: reflect the new field.

Notes

  • No setter is added: target is set once at fund() and never mutated, so it
    can't drift from what the original sponsor declared.
  • Because target is informational, no new error variants are needed and the
    payout path (release/refund) is untouched.

Verification

  • cargo fmt --check — clean
  • cargo clippy -p mergefi-escrow --all-targets -- -D warnings — clean
  • cargo test -p mergefi-escrow — 37 passed, 0 failed

Add an optional `target: Option<i128>` to `fund()`, stored on `Escrow`
and read-only thereafter. Purely informational: it does not block
`contribute` from pushing `amount` past it and does not change
`release`/`refund` behavior, but it gives sponsor-facing UI an on-chain
"raised X of target Y" number instead of one tracked off-chain that can
drift from on-chain truth.

- types.rs: add `target: Option<i128>` field to `Escrow`.
- lib.rs: accept and store `target` in `fund()`; document it.
- test.rs: pass `None` at every existing `fund` call site and add a test
  covering target round-tripping (Some and None) plus contributing past it.
- README + docs/escrow-crowdfunding-design.md: reflect the new field.

Signed-off-by: laurentketterle-hub <270474301+laurentketterle-hub@users.noreply.github.com>
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

@laurentketterle-hub is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an optional funding-target/goal amount to escrow, now that crowdfunding exists

1 participant