feat: add meta-transactions, claim settlement, and payout receivers#24
Open
yongqjn wants to merge 30 commits into
Open
feat: add meta-transactions, claim settlement, and payout receivers#24yongqjn wants to merge 30 commits into
yongqjn wants to merge 30 commits into
Conversation
…d-authorization' feat: use packed authorization nonces See merge request web3-wallet/community/base-contracts!2
# Conflicts: # test/ERC8183.test.js
…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>
…-transactions-and-claims
…tions-and-claims' feat: add payout receiver to meta claim flows See merge request web3-wallet/community/base-contracts!5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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:
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:
Validation
Coverage includes:
Local verification:
forge test
73 passed, 0 failed