Add optional funding target to escrow (#144) - #190
Open
laurentketterle-hub wants to merge 1 commit into
Open
Conversation
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>
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #144.
Adds an optional
target: Option<i128>tofund(), stored on theEscrowrecord and read-only thereafter. It is informational only — it does not block
contributefrom pushingamountpast it and does not changerelease/refundbehavior — 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: addtarget: Option<i128>toEscrow.contracts/escrow/src/lib.rs: accept and storetargetinfund(); document it.contracts/escrow/src/test.rs: passNoneat every existingfundcall site,and add
test_fund_stores_optional_target_and_contribute_past_itcovering:Some(target)round-trips throughget_escrow,contributepast the target growsamountbut never mutatestarget,Noneis the default.README.md+docs/escrow-crowdfunding-design.md: reflect the new field.Notes
targetis set once atfund()and never mutated, so itcan't drift from what the original sponsor declared.
targetis informational, no new error variants are needed and thepayout path (
release/refund) is untouched.Verification
cargo fmt --check— cleancargo clippy -p mergefi-escrow --all-targets -- -D warnings— cleancargo test -p mergefi-escrow— 37 passed, 0 failed