Skip to content

feat: add meta-transactions, claim settlement, and payout receivers#24

Open
yongqjn wants to merge 30 commits into
erc-8183:mainfrom
okx:feature/meta-transactions-and-claims
Open

feat: add meta-transactions, claim settlement, and payout receivers#24
yongqjn wants to merge 30 commits into
erc-8183:mainfrom
okx:feature/meta-transactions-and-claims

Conversation

@yongqjn

@yongqjn yongqjn commented May 26, 2026

Copy link
Copy Markdown

Summary

This PR adds three connected ERC-8183 features:

1. Claim settlement lifecycle

Adds cumulative claim settlement while a job is Funded.

  • Providers can file pending claims with submitClaim.

  • Clients can fast-settle cumulative amounts with settleClaim.

  • Clients/evaluators can approve or reject pending provider
    claims.

  • settledAmount tracks gross cumulative payouts so settlement,
    completion, rejection, and refund cannot release more than
    the funded budget.

  • Claim replay protection binds (cumulativeAmount, deliverable,
    optParams).

  • ClaimSubmitted emits optParams so the exact claim preimage
    can be propagated to observers.

2. Meta-transactions / signed authorizations

Adds ERC8183WithAuthorization, an EIP-712 relayed execution
extension.

  • Supports signed variants for actor-authorized flows:
    createJob, setProvider, setBudget, fund, submit, complete,
    reject, claim submit/settle/approve/reject, and payout
    receiver updates.

  • Uses per-signer unordered uint72 nonces packed into a single
    nonce mapping.

  • Supports EOAs and ERC-1271 contract signers.

  • Adds direct cancelAuthorization with a distinct
    AuthorizationCanceled event.

  • FundAuthorization binds expectedToken as well as
    expectedBudget.

3. Provider-managed payout receivers

Adds optional provider-controlled payout routing.

  • Providers can set payoutReceiver while the job is Open.

  • Provider-side net payouts from complete, settleClaim, and
    approveClaim route to the receiver, or to the provider if
    unset.

  • Receivers advertising IDisburser via ERC-165 get
    onDisbursement after transfer.

  • Reverting receiver callbacks roll back the parent payout
    action.

  • Receiver is locked after funding.

Interface and integration changes

Job struct

Appends:

  • settledAmount
  • payoutReceiver

fund ABI

Changed from:

fund(uint256 jobId, uint256 expectedBudget, bytes optParams)

to:

fund(uint256 jobId, address expectedToken, uint256
expectedBudget, bytes optParams)

New core functions

setPayoutReceiver(uint256 jobId, address payoutReceiver)

submitClaim(uint256 jobId, uint256 cumulativeAmount, bytes32
deliverable, bytes optParams)
settleClaim(uint256 jobId, uint256 cumulativeAmount, bytes32
deliverable, bytes optParams)
approveClaim(uint256 jobId, uint256 cumulativeAmount, bytes32
deliverable, bytes optParams)
rejectClaim(uint256 jobId, uint256 cumulativeAmount, bytes32
deliverable, bytes32 reason, bytes optParams)

New authorization extension

Adds ERC8183WithAuthorization with:

  • Authorization
  • CreateJobAuthorizationParams
  • *WithAuthorization entrypoints
  • DOMAIN_SEPARATOR
  • cancelAuthorization

New interface

IDisburser

Event and indexer notes

  • PaymentReleased(jobId, recipient, amount) now emits the
    actual payout recipient, which may be the payout receiver
    instead of the provider.

  • ClaimSubmitted now includes optParams.

  • getJob return ABI changes because Job has appended fields.

  • EIP-712 typehashes changed/added; old signatures for changed
    structs are not reusable.

New events include:

  • PayoutReceiverSet
  • Disbursed
  • Settled
  • ClaimSubmitted
  • ClaimSettled
  • ClaimApproved
  • ClaimRejected
  • AuthorizationUsed
  • AuthorizationCanceled

Validation

Coverage includes:

  • Claim settlement accounting
  • Claim replay protection
  • Receiver routing
  • Disburser callbacks
  • Reentrancy through receiver callbacks
  • Token binding for funding
  • ERC-1271 signer behavior
  • Cross-function authorization replay
  • Settlement fee math
  • Refund isolation

Local verification:

forge test
73 passed, 0 failed

albbm and others added 29 commits May 25, 2026 16:13
…d-authorization'

feat: use packed authorization nonces

See merge request web3-wallet/community/base-contracts!2
…a-transactions-and-claims'

feat: split claim request and settlement paths

See merge request web3-wallet/community/base-contracts!3
Bring eip.md in line with the implementation on this branch:

- Add Claim Settlement as core spec: submitClaim/settleClaim/
  approveClaim/rejectClaim, cumulative settledAmount accounting,
  and claim interaction rules (supersession, refund blocking,
  effects-before-transfers).
- Redefine complete/reject/claimRefund payouts over the unsettled
  remainder (budget - settledAmount).
- Replace the ERC-2771 extension with Signed Authorizations
  (EIP-712 inner signatures, packed unordered nonces, ERC-1271,
  cancelAuthorization) matching ERC8183WithAuthorization.
- Extend hook tables, events, roles, rationale, and security
  considerations for both features.
- Replace the drifted inline reference contract with an interface
  summary pointing at the source.
- Fix pre-existing drift: setBudget is provider-only; Submitted
  expiry refund requires the evaluation grace period; note the
  bidding example's incompatibility with provider-only setBudget.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
createJob enforces ClientCannotBeProvider but the deferred-assignment
path did not, letting a client assign themselves as provider on a
provider-less job and break the role-separation invariant (e.g.
self-dealing jobs feeding reputation systems). Mirror the existing
evaluator-collision check in _setProvider and document the revert
condition in the EIP's setProvider entries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tions-and-claims'

feat: add payout receiver to meta claim flows

See merge request web3-wallet/community/base-contracts!5
@yongqjn yongqjn changed the title Feature/meta transactions and claims feat: add meta-transactions, claim settlement, and payout receivers Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants