Overview
- Type: Singleton (one per network)
- Deployment: Direct deployment (no factory)
- Purpose: Track refund request lifecycle
Request Types
- In-Escrow Refunds
- Post-Escrow Refunds
Who can request: Payer, Receiver, OR ArbiterTypical flow:
- Payer suspects fraud, requests refund
- Arbiter investigates
- Arbiter approves or denies request
- If approved, arbiter calls
operator.refundInEscrow()
- Buyer remorse
- Seller fraud
- Payment error
Request Status States
Key Methods
requestRefund()
Creates a new refund request.paymentInfo- Payment info structamount- Amount being requested for refundnonce- Record index (from PaymentIndexRecorder) identifying which charge/action
Each refund request is keyed by
(paymentInfoHash, nonce) where nonce is the record index. This allows multiple refund requests per payment (one per charge/action).updateStatus()
Approve or deny a refund request.paymentInfo- Payment info structnonce- Record index identifying which refund requestnewStatus- The new status (ApprovedorDenied)
REFUND_IN_ESCROW_CONDITION can also approve/deny.
Valid transitions:
Pending->ApprovedPending->Denied
cancelRefundRequest()
Payer cancels their own request.paymentInfo- Payment info structnonce- Record index identifying which refund request
Pending->Cancelled
Usage Example
RefundRequest is advisory only. Approval does not automatically execute refunds - the authorized party must call the operator’s refund function.
