From 0b72843c9c211c60368f99c8cb83d1be10aef245 Mon Sep 17 00:00:00 2001 From: Olowodarey Date: Thu, 27 Aug 2026 10:53:36 +0100 Subject: [PATCH] feat: configurable grace period before late-delivery penalty accrual starts --- contracts/chainsetttle/src/constants.rs | 9 +++++++++ contracts/chainsetttle/src/lib.rs | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/contracts/chainsetttle/src/constants.rs b/contracts/chainsetttle/src/constants.rs index 69a9aad..77095a3 100644 --- a/contracts/chainsetttle/src/constants.rs +++ b/contracts/chainsetttle/src/constants.rs @@ -39,3 +39,12 @@ pub const DEFAULT_EMERGENCY_FREEZE_SUPERMAJORITY_BPS: u32 = 8_000; /// dispute bond (#391) when the admin has not set a stricter cap via /// `set_max_dispute_bond_bps`. 2000 = 20% of shipment value. pub const DEFAULT_MAX_DISPUTE_BOND_BPS: u32 = 2_000; + +/// Default supplier onboarding stake amount (can be configured by admin). +pub const DEFAULT_SUPPLIER_STAKE: i128 = 1_000_000; + +/// Number of dispute losses before supplier stake is slashed (default 3). +pub const DEFAULT_DISPUTE_LOSS_THRESHOLD: u32 = 3; + +/// Percentage of stake slashed per dispute loss (default 33.33% = 3333 bps). +pub const DEFAULT_SLASH_PERCENTAGE_BPS: u32 = 3_333; diff --git a/contracts/chainsetttle/src/lib.rs b/contracts/chainsetttle/src/lib.rs index e6b6001..6f1f87d 100644 --- a/contracts/chainsetttle/src/lib.rs +++ b/contracts/chainsetttle/src/lib.rs @@ -228,6 +228,11 @@ pub struct Shipment { /// Empty = not set (`None`). One entry = the reason. /// (`Option` is not supported by Soroban `#[contracttype]`.) pub cancellation_reason: Vec, + + // ── New features ─────────────────────────────────────────── + /// Configurable grace period (in ledgers) before late-delivery penalty accrual starts. + /// When set > 0, penalties only start counting from (deadline + grace_period_ledgers). + pub grace_period_ledgers: u32, } /// Cancellation policy stored separately (keeps Shipment within the contracttype field limit). @@ -401,6 +406,10 @@ pub struct ShipmentOptions { /// Optional jurisdiction/regulatory category (e.g. "US", "EU_MIFID") for /// off-chain compliance filtering. Immutable after creation. None = untagged. pub jurisdiction: Option, + + // ── New features ─────────────────────────────────────────── + /// Configurable grace period (in ledgers) before late-delivery penalty accrual starts. + pub grace_period_ledgers: u32, } /// Configuration for time-decayed dispute bonds. @@ -1165,6 +1174,16 @@ pub enum DataKeyExt2 { /// Active fee waiver granted to a partner address: (waiver_bps, expires_at /// unix timestamp; 0 = no expiry). FeeWaiver(Address), + + // ── New Features ────────────────────────────────────────────────────── + /// KYC attestation hash for buyer addresses (32-byte hash). + BuyerKycHash(Address), + /// KYC attestation hash for supplier addresses (32-byte hash). + SupplierKycHash(Address), + /// Supplier onboarding stake amount locked (slashed on repeated disputes). + SupplierStake(Address), + /// Dispute loss count for slashing calculation (reset on successful periods). + SupplierDisputeLossCount(Address), } /// Partial joint-confirmation progress for a high-value shipment's milestone (#367).