Skip to main content

Execution and Counter-Offers

This chapter describes how buyers interact with active marketplace offers. A buyer can either accept an offer under the seller's published terms or submit a counter-offer with negotiated price or volume terms. In both cases, the Core Payment Service starts its work only after a marketplace deal exists or a counter-offer has been accepted.

Business Flow

  1. Direct Offer Execution:

    • A Buyer browses the marketplace and finds an active offer.
    • If the buyer accepts the published price, amount, lot size, and expiry terms, they execute the offer directly.
    • The direct execution is performed on-chain through the marketplace contract, represented in the current contract interface as InterestDiscovery.acceptOffer(offerId, amount).
    • The marketplace creates a deal for the accepted amount and emits DealCreated with deal type OFFER.
    • The deal then enters the purchase payment flow handled by the Core Payment Service.
  2. Counter-Offers (Negotiation):

    • If the buyer wants to negotiate, they submit a counter-offer against an existing offer.
    • A counter-offer is always linked to the original offerId; it cannot exist as a standalone marketplace order.
    • The counter-offer is created on-chain through InterestDiscovery.createCounterOffer(counterOffer).
    • The on-chain CounterOfferInput contains:
      • offerId: original offer being negotiated,
      • expiry: counter-offer expiry timestamp,
      • amount: amount the buyer wants to purchase,
      • unitPrice: buyer's proposed unit price.
    • The marketplace creates a deal with type COUNTER_OFFER, awaiting the seller's decision.
    • The seller can accept or reject the proposal through InterestDiscovery.resolveCounterOffer(dealId, accepted).
  3. Deal Finalization:

    • A directly accepted offer becomes a purchase deal immediately after acceptOffer.
    • A counter-offer becomes a purchase deal only if the seller resolves it with accepted = true.
    • Rejected or expired counter-offers do not enter the payment process.
    • Accepted deals continue to payment settlement, where the Core Payment Service creates the local bond purchase payment, coordinates buyer and seller payments with the PSP, marks buyer payment on-chain through resolvePayment(dealId, true), and finalizes settlement through settleDeal(dealId).

Sequence Diagram