Skip to Content
How It WorksBuying & Fills

Buying & Fills

Paying

Buyers never send funds to a wallet — they call the PaymentCollector on a supported payment chain:

  • buy(address sethRecipient) — pay with the chain’s native coin. The collector converts the amount to USD using the chain’s Chainlink native/USD feed (with a staleness check).
  • buyWithToken(address token, uint256 amount, address sethRecipient) — pay with an allowed stablecoin (USDC / USDT / DAI), valued at $1. Requires a prior approve().

Either way the collector computes the SETH owed and emits:

event SethPurchased( address indexed buyer, address indexed sethRecipient, address token, // address(0) for native uint256 amountPaid, uint256 usdPaid, uint256 sethAmount, uint256 buyPriceUsd );

The amount of SETH is sethAmount = usdPaid * 1e18 / buyPriceUsd. See Pricing & Tiers for the buy price.

Matching a purchase

When the indexer sees a SethPurchased event it:

  1. De-duplicates it with an idempotency key of chainId:txHash:buyer:recipient, so the same purchase is never processed twice (reorg-safe).
  2. Records the buyer order and payment receipt.
  3. Fills the requested SETH from the seller queue in strict FIFO, locking the open orders it touches so concurrent buys can’t double-sell the same SETH.
  4. Fills any remainder from the house reserve (recorded as a house_fill).
  5. Enqueues an asynchronous delivery job.

Delivery

A delivery worker calls the vault’s sendSeth on Sepolia to transfer the SETH to the buyer’s sethRecipient. Delivery is not instant — it happens once the backend processes the job and the Sepolia transaction confirms. Your buyer order records how much came fromQueue vs fromHouse, and the delivery transaction hash once it lands.

Buyer order states:

StateMeaning
DeliveringMatched; SETH delivery in flight on Sepolia.
DeliveredSETH sent to your Sepolia address.

The USD cost is requestedSeth × buyPrice. The exact native amount for a given SETH quantity is computed on-chain by the collector’s nativeAmountForSeth() at execution time, so your final native cost is always the live, on-chain figure.

Last updated on