diff --git a/intent_settlement/src/lib.rs b/intent_settlement/src/lib.rs index 71c0018..a45e03b 100644 --- a/intent_settlement/src/lib.rs +++ b/intent_settlement/src/lib.rs @@ -437,13 +437,15 @@ pub struct IntentRecord { /// Destination (always Stellar) pub dst_token: Address, // SAC/SEP-41 token on Stellar - pub min_dst_amount: i128, // minimum acceptable output per fill (floor per partial) + pub min_dst_amount: i128, // minimum acceptable output per fill (#348: per src_portion) pub solver: Option
, // assigned solver pub state: IntentState, pub created_at: u64, - pub deadline: u64, + /// #347: user's original deadline; separate from fill-window deadline which gets reset + pub user_deadline: u64, + pub deadline: u64, // effective deadline (fill window or user deadline) pub filled_at: Option, pub fill_amount: Option, // cumulative dst tokens received across all fills @@ -2163,10 +2165,11 @@ impl IntentSettlement { /// Solver fills the intent by sending dst_token to the user. /// /// Partial fills are supported: `fill_amount` must be > 0 but may be less - /// than `min_dst_amount`. The intent transitions to `PartiallyFilled` after + /// than `min_dst_amount * src_portion / src_amount`. The intent transitions to `PartiallyFilled` after /// each sub-fill and is re-opened so another solver (or the same one) can /// accept and deliver the remainder. Once the cumulative `total_filled` - /// reaches or exceeds `min_dst_amount` the intent transitions to `Filled`. + /// reaches or exceeds `min_dst_amount * src_amount / src_amount` (when src_filled == src_amount), + /// the intent transitions to `Filled`. /// /// The protocol fee is taken on each individual fill so the fee accounting /// stays consistent regardless of how many fills it takes. diff --git a/intent_settlement/src/test.rs b/intent_settlement/src/test.rs index 904a581..c28a844 100644 --- a/intent_settlement/src/test.rs +++ b/intent_settlement/src/test.rs @@ -2212,6 +2212,7 @@ fn two_partial_fills_complete_intent() { // First partial fill: half of MIN_DST. let half = MIN_DST / 2; + let half_src = SRC_AMT / 2; let fee1 = half * 5 / 10_000; ctx.dst_admin().mint(&ctx.solver, &(half + fee1)); c.accept_intent(&ctx.solver, &id); @@ -2228,6 +2229,7 @@ fn two_partial_fills_complete_intent() { // Second fill: the remainder — brings total to MIN_DST. let remainder = MIN_DST - half; + let remainder_src = SRC_AMT - half_src; let fee2 = remainder * 5 / 10_000; ctx.dst_admin().mint(&ctx.solver, &(remainder + fee2)); c.accept_intent(&ctx.solver, &id); @@ -2257,6 +2259,7 @@ fn partial_fill_left_incomplete_past_deadline_can_be_expired() { // Deliver a partial fill (less than MIN_DST). let partial = MIN_DST / 3; + let partial_src = SRC_AMT / 3; let fee = partial * 5 / 10_000; ctx.dst_admin().mint(&ctx.solver, &(partial + fee)); c.accept_intent(&ctx.solver, &id);