Why a D20DAO Refund Can Become a Credit
Design refund recipients for D20DAO on Arc and Robinhood Chain. Distinguish direct payment, backed credit, withdrawal authority and refund notifications.
A refunded request need not produce a wallet transfer
An application records a request as refunded, but the sponsoring wallet shows no incoming payment. Before treating that as a missing refund, check the fixed refund recipient and whether settlement produced a transfer or a credit. The sponsor, consumer and refund recipient can be different addresses.
D20DAO's current Arc and Robinhood coordinators support refund credits. These are amounts recorded for a recipient to withdraw, separate from its native balance. Arc uses native USDC and Robinhood Chain uses ETH. A credit entry alone does not show that either currency reached a wallet.
Overpayment and expiry follow different paths
Excess request payment is credited directly to the fixed refund address; there is no immediate transfer attempt. That credit can be withdrawn without waiting for the request to finish or expire. Keep it separate from the charged service fee.
For an expired, unfulfilled request, refundRequest uses the charged fee and refund ratio stored with that request. It attempts a native transfer to the fixed recipient and leaves backed credit if the transfer fails. The refundable amount excludes excess already credited. A failed randomness callback after accepted proof belongs to delivery recovery, not this expiry-refund path.
Choose an address that can recover its credit
Suppose a consumer names a treasury contract as refund recipient. The coordinator credits that treasury, even when an external wallet funded the application call. Anyone may trigger an eligible expiry refund, but the caller cannot redirect it or claim the treasury's credit.
If the treasury cannot accept the initial native transfer, it needs an authorized way to invoke credit withdrawal itself. Its human owner cannot withdraw that balance merely by calling the coordinator from another address. Review the recipient contract's outward-call capability before fixing it into a request.
The credit holder selects the withdrawal destination
withdrawRefundCredit takes a recipient address and withdraws all refund credit owned by its caller. The destination must be nonzero and able to receive the native payment. Choosing that destination does not change the original request's refund address or grant access to another address's credit.
Credits aggregate across requests within that coordinator. Withdrawal has no partial-amount or request-ID argument. If its destination rejects payment, the transaction reverts and the credit remains. Use the concrete coordinator ABI when designing a recipient contract; the current ID20VRF consumer interface does not include this withdrawal method.
Reconcile each liability with the actual payment
Record request ID, network, coordinator, refund recipient and the source of each credit. FeeOverpaymentCredited identifies excess credit. For an expiry refund, RequestRefundedTo distinguishes a successful transfer with paid=true from retained credit with paid=false. A successful expiry-refund transfer does not erase earlier overpayment credit.
RefundCreditWithdrawn identifies the credit owner, destination and total amount, without a request ID. Reconcile that aggregate withdrawal against outstanding credits rather than assigning its whole amount to every request. Keep credited, withdrawn and directly paid amounts distinct so one entitlement is not counted twice.
A credit is recovery of the same refund
An eligible refund transaction marks its request refunded whether the native transfer succeeds or leaves credit. Repeating refundRequest cannot create another refund for that request. Likewise, withdrawing the credit settles the recorded obligation; it is not an additional service-fee refund.
The current withdrawal implementation clears the caller's credit before transferring and reverts the transaction if payment fails. Application accounting must also avoid applying the same canonical event twice. Show the remaining credit balance after reconciliation, rather than interpreting a second button press or repeated RPC response as another entitlement.
Notification updates the consumer, not its cash balance
The current public source includes authenticated onRefund(requestId) after the recipient is paid or credited. That zero-value notification goes to the consumer, which may differ from the refund recipient. Its default _onRefund hook does nothing; notification success does not establish an application payout.
Where the deployed implementation supports it, a failed notification can be retried with retryRefundCallback without paying the refund again. Verify that implementation before relying on the optional hook. Installing a newer SDK or finding a method in public source does not upgrade an existing proxy.
Review the recipient and its accounting together
Use these acceptance cases when implementing the recipient. They are review requirements, not executed test results:
- Withdraw excess credit before request completion without treating it as an expiry refund.
- Trigger an eligible refund from another wallet while preserving the fixed recipient.
- Reject an initial transfer, then recover the retained credit through the recipient contract's authorized withdrawal path.
- Fail a withdrawal and preserve credit; reconcile a later aggregate withdrawal only once.
- Where supported, retry refund notification without another payment or duplicate application settlement.