From 1d7f917ffed0e093eb80f37e32378e178e11be22 Mon Sep 17 00:00:00 2001 From: 0age <37939117+0age@users.noreply.github.com> Date: Sun, 3 Nov 2024 07:57:51 -0800 Subject: [PATCH] pull logic from ClaimProcessorLogic into ClaimProcessorLib --- snapshots/TheCompactTest.json | 38 +- src/lib/ClaimProcessorLib.sol | 501 +++++++++++++++++++++++++- src/lib/ClaimProcessorLogic.sol | 606 ++++---------------------------- 3 files changed, 588 insertions(+), 557 deletions(-) diff --git a/snapshots/TheCompactTest.json b/snapshots/TheCompactTest.json index a7013bf..c95050d 100644 --- a/snapshots/TheCompactTest.json +++ b/snapshots/TheCompactTest.json @@ -1,17 +1,17 @@ { "basicTransfer": "56850", "basicWithdrawal": "59816", - "batchClaim": "111801", - "batchClaimRegisteredWithDeposit": "111801", - "batchClaimRegisteredWithDepositWithWitness": "112666", - "batchClaimWithWitness": "112660", + "batchClaim": "111810", + "batchClaimRegisteredWithDeposit": "111810", + "batchClaimRegisteredWithDepositWithWitness": "112675", + "batchClaimWithWitness": "112669", "batchDepositAndRegisterViaPermit2": "221877", "batchDepositAndRegisterWithWitnessViaPermit2": "221855", "batchTransfer": "81520", "batchWithdrawal": "99951", - "claim": "56805", - "claimAndWithdraw": "73104", - "claimWithWitness": "59450", + "claim": "56817", + "claimAndWithdraw": "73116", + "claimWithWitness": "59462", "depositAndRegisterViaPermit2": "124247", "depositBatchSingleERC20": "67868", "depositBatchSingleNative": "28171", @@ -22,21 +22,21 @@ "depositERC20ViaPermit2AndURI": "98289", "depositETHAndURI": "26754", "depositETHBasic": "28391", - "qualifiedBatchClaim": "113339", - "qualifiedBatchClaimWithWitness": "112876", - "qualifiedClaim": "60226", - "qualifiedClaimWithWitness": "58915", - "qualifiedSplitBatchClaim": "140913", - "qualifiedSplitBatchClaimWithWitness": "140978", - "qualifiedSplitClaim": "86542", - "qualifiedSplitClaimWithWitness": "87019", + "qualifiedBatchClaim": "113348", + "qualifiedBatchClaimWithWitness": "112885", + "qualifiedClaim": "60238", + "qualifiedClaimWithWitness": "58927", + "qualifiedSplitBatchClaim": "140922", + "qualifiedSplitBatchClaimWithWitness": "140987", + "qualifiedSplitClaim": "86554", + "qualifiedSplitClaimWithWitness": "87031", "register": "25379", - "splitBatchClaim": "140255", - "splitBatchClaimWithWitness": "140322", + "splitBatchClaim": "140264", + "splitBatchClaimWithWitness": "140331", "splitBatchTransfer": "110587", "splitBatchWithdrawal": "139819", - "splitClaim": "86263", - "splitClaimWithWitness": "85924", + "splitClaim": "86275", + "splitClaimWithWitness": "85936", "splitTransfer": "82732", "splitWithdrawal": "93702" } \ No newline at end of file diff --git a/src/lib/ClaimProcessorLib.sol b/src/lib/ClaimProcessorLib.sol index b95980e..7c5808f 100644 --- a/src/lib/ClaimProcessorLib.sol +++ b/src/lib/ClaimProcessorLib.sol @@ -2,11 +2,14 @@ pragma solidity ^0.8.27; import { COMPACT_TYPEHASH, BATCH_COMPACT_TYPEHASH, MULTICHAIN_COMPACT_TYPEHASH } from "../types/EIP712Types.sol"; -import { SplitComponent } from "../types/Components.sol"; +import { SplitComponent, BatchClaimComponent, SplitBatchClaimComponent } from "../types/Components.sol"; import { Scope } from "../types/Scope.sol"; import { EfficiencyLib } from "./EfficiencyLib.sol"; +import { EventLib } from "./EventLib.sol"; import { IdLib } from "./IdLib.sol"; +import { RegistrationLib } from "./RegistrationLib.sol"; +import { ValidityLib } from "./ValidityLib.sol"; /** * @title ClaimProcessorLib @@ -15,8 +18,17 @@ import { IdLib } from "./IdLib.sol"; */ library ClaimProcessorLib { using ClaimProcessorLib for uint256; + using ClaimProcessorLib for bytes32; + using ClaimProcessorLib for SplitComponent[]; using EfficiencyLib for bool; + using EfficiencyLib for uint256; + using EfficiencyLib for bytes32; + using EventLib for address; using IdLib for uint256; + using ValidityLib for uint256; + using ValidityLib for uint96; + using ValidityLib for bytes32; + using RegistrationLib for address; /** * @notice Internal function for verifying and processing split components. Ensures that the @@ -139,4 +151,491 @@ library ClaimProcessorLib { function allocationExceededOrScopeNotMultichain(uint256 allocatedAmount, uint256 amount, uint256 id, bytes32 sponsorDomainSeparator) internal pure returns (bool) { return (allocatedAmount < amount).or(id.scopeNotMultichain(sponsorDomainSeparator)); } + + /** + * @notice Internal function for validating claim execution parameters. Extracts and validates + * signatures from calldata, checks expiration, verifies allocator registration, consumes the + * nonce, derives the domain separator, and validates both the sponsor authorization (either + * through direct registration or a provided signature or EIP-1271 call) and the (potentially + * qualified) allocator authorization. Finally, emits a Claim event. + * @param messageHash The EIP-712 hash of the claim message. + * @param allocatorId The unique identifier for the allocator mediating the claim. + * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. + * @param calldataPointer Pointer to the location of the associated struct in calldata. + * @param domainSeparator The local domain separator. + * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. + * @param typehash The EIP-712 typehash used for the claim message. + * @return sponsor The extracted address of the claim sponsor. + */ + function validate(bytes32 messageHash, uint96 allocatorId, bytes32 qualificationMessageHash, uint256 calldataPointer, bytes32 domainSeparator, bytes32 sponsorDomainSeparator, bytes32 typehash) + internal + returns (address sponsor) + { + // Declare variables for signatures and parameters that will be extracted from calldata. + bytes calldata allocatorSignature; + bytes calldata sponsorSignature; + uint256 nonce; + uint256 expires; + + assembly ("memory-safe") { + // Extract allocator signature from calldata using offset stored at calldataPointer. + let allocatorSignaturePtr := add(calldataPointer, calldataload(calldataPointer)) + allocatorSignature.offset := add(0x20, allocatorSignaturePtr) + allocatorSignature.length := calldataload(allocatorSignaturePtr) + + // Extract sponsor signature from calldata using offset stored at calldataPointer + 0x20. + let sponsorSignaturePtr := add(calldataPointer, calldataload(add(calldataPointer, 0x20))) + sponsorSignature.offset := add(0x20, sponsorSignaturePtr) + sponsorSignature.length := calldataload(sponsorSignaturePtr) + + // Extract sponsor address, sanitizing upper 96 bits. + sponsor := shr(96, shl(96, calldataload(add(calldataPointer, 0x40)))) + + // Extract nonce and expiration timestamp. + nonce := calldataload(add(calldataPointer, 0x60)) + expires := calldataload(add(calldataPointer, 0x80)) + } + + // Ensure that the claim hasn't expired. + expires.later(); + + // Retrieve allocator address and consume nonce, ensuring it has not already been consumed. + address allocator = allocatorId.fromRegisteredAllocatorIdWithConsumed(nonce); + + assembly ("memory-safe") { + // Swap domain separator for provided sponsorDomainSeparator if a nonzero value was supplied. + sponsorDomainSeparator := add(sponsorDomainSeparator, mul(iszero(sponsorDomainSeparator), domainSeparator)) + } + + // Validate sponsor authorization through either ECDSA, EIP-1271, or direct registration. + if ((sponsorDomainSeparator != domainSeparator).or(sponsorSignature.length != 0) || sponsor.hasNoActiveRegistration(messageHash, typehash)) { + messageHash.signedBy(sponsor, sponsorSignature, sponsorDomainSeparator); + } + + // Validate allocator authorization against qualification message. + qualificationMessageHash.signedBy(allocator, allocatorSignature, domainSeparator); + + // Emit claim event. + sponsor.emitClaim(messageHash, allocator); + } + + /** + * @notice Private function for processing qualified claims with potentially exogenous + * sponsor signatures. Extracts claim parameters from calldata, validates the scope, + * ensures the claimed amount is within the allocated amount, validates the claim, + * and executes either a release of ERC6909 tokens or a withdrawal of underlying tokens. + * @param messageHash The EIP-712 hash of the claim message. + * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. + * @param calldataPointer Pointer to the location of the associated struct in calldata. + * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. + * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. + * @param typehash The EIP-712 typehash used for the claim message. + * @param domainSeparator The local domain separator. + * @param operation Function pointer to either _release or _withdraw for executing the claim. + * @return Whether the claim was successfully processed. + */ + function processClaimWithQualificationAndSponsorDomain( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomainSeparator, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + // Declare variables for parameters that will be extracted from calldata. + uint256 id; + uint256 allocatedAmount; + address claimant; + uint256 amount; + + assembly ("memory-safe") { + // Calculate pointer to claim parameters using provided offset. + let calldataPointerWithOffset := add(calldataPointer, offsetToId) + + // Extract resource lock id, allocated amount, claimant address, and claim amount. + id := calldataload(calldataPointerWithOffset) + allocatedAmount := calldataload(add(calldataPointerWithOffset, 0x20)) + claimant := shr(96, shl(96, calldataload(add(calldataPointerWithOffset, 0x40)))) + amount := calldataload(add(calldataPointerWithOffset, 0x60)) + } + + // Verify the resource lock scope is compatible with the provided domain separator. + sponsorDomainSeparator.ensureValidScope(id); + + // Ensure the claimed amount does not exceed the allocated amount. + amount.withinAllocated(allocatedAmount); + + // Validate the claim and execute the specified operation (either release or withdraw). + return operation(validate(messageHash, id.toAllocatorId(), qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash), claimant, id, amount); + } + + /** + * @notice Private function for processing qualified split claims with potentially exogenous + * sponsor signatures. Extracts claim parameters from calldata, validates the claim, + * validates the scope, and executes either releases of ERC6909 tokens or withdrawals of + * underlying tokens to multiple recipients. + * @param messageHash The EIP-712 hash of the claim message. + * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. + * @param calldataPointer Pointer to the location of the associated struct in calldata. + * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. + * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. + * @param typehash The EIP-712 typehash used for the claim message. + * @param domainSeparator The local domain separator. + * @param operation Function pointer to either _release or _withdraw for executing the claim. + * @return Whether the split claim was successfully processed. + */ + function processSplitClaimWithQualificationAndSponsorDomain( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomainSeparator, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + // Declare variables for parameters that will be extracted from calldata. + uint256 id; + uint256 allocatedAmount; + SplitComponent[] calldata components; + + assembly ("memory-safe") { + // Calculate pointer to claim parameters using provided offset. + let calldataPointerWithOffset := add(calldataPointer, offsetToId) + + // Extract resource lock id and allocated amount. + id := calldataload(calldataPointerWithOffset) + allocatedAmount := calldataload(add(calldataPointerWithOffset, 0x20)) + + // Extract array of split components containing claimant addresses and amounts. + let componentsPtr := add(calldataPointer, calldataload(add(calldataPointerWithOffset, 0x40))) + components.offset := add(0x20, componentsPtr) + components.length := calldataload(componentsPtr) + } + + // Validate the claim and extract the sponsor address. + address sponsor = validate(messageHash, id.toAllocatorId(), qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash); + + // Verify the resource lock scope is compatible with the provided domain separator. + sponsorDomainSeparator.ensureValidScope(id); + + // Process each split component, verifying total amount and executing operations. + return components.verifyAndProcessSplitComponents(sponsor, id, allocatedAmount, operation); + } + + /** + * @notice Private function for processing qualified batch claims with potentially exogenous + * sponsor signatures. Extracts batch claim parameters from calldata, validates the claim, + * executes operations, and performs optimized validation of allocator consistency, amounts, + * and scopes. If any validation fails, all operations are reverted after explicitly + * identifying the specific validation failures. + * @param messageHash The EIP-712 hash of the claim message. + * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. + * @param calldataPointer Pointer to the location of the associated struct in calldata. + * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. + * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. + * @param typehash The EIP-712 typehash used for the claim message. + * @param domainSeparator The local domain separator. + * @param operation Function pointer to either _release or _withdraw for executing the claim. + * @return Whether the batch claim was successfully processed. + */ + function processBatchClaimWithQualificationAndSponsorDomain( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomainSeparator, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + // Declare variables for parameters that will be extracted from calldata. + BatchClaimComponent[] calldata claims; + address claimant; + + assembly ("memory-safe") { + // Calculate pointer to claim parameters using provided offset. + let calldataPointerWithOffset := add(calldataPointer, offsetToId) + + // Extract array of batch claim components and claimant address. + let claimsPtr := add(calldataPointer, calldataload(calldataPointerWithOffset)) + claims.offset := add(0x20, claimsPtr) + claims.length := calldataload(claimsPtr) + claimant := calldataload(add(calldataPointerWithOffset, 0x20)) + } + + // Extract allocator id from first claim for validation. + uint96 firstAllocatorId = claims[0].id.toAllocatorId(); + + // Validate the claim and extract the sponsor address. + address sponsor = validate(messageHash, firstAllocatorId, qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash); + + // Revert if the batch is empty. + uint256 totalClaims = claims.length; + assembly ("memory-safe") { + if iszero(totalClaims) { + // revert InvalidBatchAllocation() + mstore(0, 0x3a03d3bb) + revert(0x1c, 0x04) + } + } + + // Process first claim and initialize error tracking. + // NOTE: many of the bounds checks on these array accesses can be skipped as an optimization + BatchClaimComponent calldata component = claims[0]; + uint256 id = component.id; + uint256 amount = component.amount; + uint256 errorBuffer = component.allocatedAmount.allocationExceededOrScopeNotMultichain(amount, id, sponsorDomainSeparator).asUint256(); + + // Execute transfer or withdrawal for first claim. + operation(sponsor, claimant, id, amount); + + unchecked { + // Process remaining claims while accumulating potential errors. + for (uint256 i = 1; i < totalClaims; ++i) { + component = claims[i]; + id = component.id; + amount = component.amount; + errorBuffer |= (id.toAllocatorId() != firstAllocatorId).or(component.allocatedAmount.allocationExceededOrScopeNotMultichain(amount, id, sponsorDomainSeparator)).asUint256(); + + operation(sponsor, claimant, id, amount); + } + + // If any errors occurred, identify specific failures and revert. + if (errorBuffer.asBool()) { + for (uint256 i = 0; i < totalClaims; ++i) { + component = claims[i]; + component.amount.withinAllocated(component.allocatedAmount); + id = component.id; + sponsorDomainSeparator.ensureValidScope(component.id); + } + + assembly ("memory-safe") { + // revert InvalidBatchAllocation() + mstore(0, 0x3a03d3bb) + revert(0x1c, 0x04) + } + } + } + + return true; + } + + /** + * @notice Private function for processing qualified split batch claims with potentially + * exogenous sponsor signatures. Extracts split batch claim parameters from calldata, + * validates the claim, and executes split operations for each resource lock. Uses optimized + * validation of allocator consistency and scopes, with explicit validation on failure to + * identify specific issues. Each resource lock can be split among multiple recipients. + * @param messageHash The EIP-712 hash of the claim message. + * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. + * @param calldataPointer Pointer to the location of the associated struct in calldata. + * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. + * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. + * @param typehash The EIP-712 typehash used for the claim message. + * @param domainSeparator The local domain separator. + * @param operation Function pointer to either _release or _withdraw for executing the claim. + * @return Whether the split batch claim was successfully processed. + */ + function processSplitBatchClaimWithQualificationAndSponsorDomain( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomainSeparator, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + // Declare variable for SplitBatchClaimComponent array that will be extracted from calldata. + SplitBatchClaimComponent[] calldata claims; + + assembly ("memory-safe") { + // Extract array of split batch claim components. + let claimsPtr := add(calldataPointer, calldataload(add(calldataPointer, offsetToId))) + claims.offset := add(0x20, claimsPtr) + claims.length := calldataload(claimsPtr) + } + + // Extract allocator id from first claim for validation. + uint96 firstAllocatorId = claims[0].id.toAllocatorId(); + + // Validate the claim and extract the sponsor address. + address sponsor = validate(messageHash, firstAllocatorId, qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash); + + // Initialize tracking variables. + uint256 totalClaims = claims.length; + uint256 errorBuffer = (totalClaims == 0).asUint256(); + uint256 id; + + unchecked { + // Process each claim component while accumulating potential errors. + for (uint256 i = 0; i < totalClaims; ++i) { + SplitBatchClaimComponent calldata claimComponent = claims[i]; + id = claimComponent.id; + errorBuffer |= (id.toAllocatorId() != firstAllocatorId).or(id.scopeNotMultichain(sponsorDomainSeparator)).asUint256(); + + // Process each split component, verifying total amount and executing operations. + claimComponent.portions.verifyAndProcessSplitComponents(sponsor, id, claimComponent.allocatedAmount, operation); + } + + // If any errors occurred, identify specific scope failures and revert. + if (errorBuffer.asBool()) { + for (uint256 i = 0; i < totalClaims; ++i) { + sponsorDomainSeparator.ensureValidScope(claims[i].id); + } + + assembly ("memory-safe") { + // revert InvalidBatchAllocation() + mstore(0, 0x3a03d3bb) + revert(0x1c, 0x04) + } + } + } + + return true; + } + + function processSimpleClaim( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processSimpleSplitClaim( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processSplitClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processSimpleBatchClaim( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processBatchClaimWithQualification( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processBatchClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processSimpleSplitBatchClaim( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processSplitBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processSplitBatchClaimWithQualification( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return + processSplitBatchClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processClaimWithSponsorDomain( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomain, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); + } + + function processClaimWithQualification( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processSplitClaimWithQualification( + bytes32 messageHash, + bytes32 qualificationMessageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processSplitClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); + } + + function processSplitClaimWithSponsorDomain( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomain, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processSplitClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); + } + + function processBatchClaimWithSponsorDomain( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomain, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); + } + + function processSplitBatchClaimWithSponsorDomain( + bytes32 messageHash, + uint256 calldataPointer, + uint256 offsetToId, + bytes32 sponsorDomain, + bytes32 typehash, + bytes32 domainSeparator, + function(address, address, uint256, uint256) internal returns (bool) operation + ) internal returns (bool) { + return processSplitBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); + } } diff --git a/src/lib/ClaimProcessorLogic.sol b/src/lib/ClaimProcessorLogic.sol index 8d4ea39..27ece04 100644 --- a/src/lib/ClaimProcessorLogic.sol +++ b/src/lib/ClaimProcessorLogic.sol @@ -140,17 +140,21 @@ contract ClaimProcessorLogic is SharedLogic { ///// 1. Claims ///// function _processBasicClaim(BasicClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleClaim.usingBasicClaim()(claimPayload.toClaimHash(), claimPayload, uint256(0xa0).asStubborn(), uint256(0).asStubborn().typehashes(), _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleClaim.usingBasicClaim()( + claimPayload.toClaimHash(), claimPayload, uint256(0xa0).asStubborn(), uint256(0).asStubborn().typehashes(), _domainSeparator(), operation + ); } function _processQualifiedClaim(QualifiedClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processClaimWithQualification.usingQualifiedClaim()(messageHash, qualificationMessageHash, claimPayload, 0xe0, uint256(0).asStubborn().typehashes(), _domainSeparator(), operation); + return ClaimProcessorLib.processClaimWithQualification.usingQualifiedClaim()( + messageHash, qualificationMessageHash, claimPayload, 0xe0, uint256(0).asStubborn().typehashes(), _domainSeparator(), operation + ); } function _processClaimWithWitness(ClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleClaim.usingClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleClaim.usingClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); } function _processQualifiedClaimWithWitness(QualifiedClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -158,23 +162,23 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processClaimWithQualification.usingQualifiedClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processClaimWithQualification.usingQualifiedClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation); } function _processSplitClaim(SplitClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleSplitClaim.usingSplitClaim()(claimPayload.toClaimHash(), claimPayload, 0xa0, uint256(0).asStubborn().typehashes(), _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleSplitClaim.usingSplitClaim()(claimPayload.toClaimHash(), claimPayload, 0xa0, uint256(0).asStubborn().typehashes(), _domainSeparator(), operation); } function _processQualifiedSplitClaim(QualifiedSplitClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processSplitClaimWithQualification.usingQualifiedSplitClaim()( + return ClaimProcessorLib.processSplitClaimWithQualification.usingQualifiedSplitClaim()( messageHash, qualificationMessageHash, claimPayload, 0xe0, uint256(0).asStubborn().typehashes(), _domainSeparator(), operation ); } function _processSplitClaimWithWitness(SplitClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleSplitClaim.usingSplitClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleSplitClaim.usingSplitClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); } function _processQualifiedSplitClaimWithWitness(QualifiedSplitClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -182,24 +186,26 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitClaimWithQualification.usingQualifiedSplitClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSplitClaimWithQualification.usingQualifiedSplitClaimWithWitness()( + messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation + ); } ///// 2. Batch Claims ///// function _processBatchClaim(BatchClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleBatchClaim.usingBatchClaim()(claimPayload.toClaimHash(), claimPayload, 0xa0, uint256(1).asStubborn().typehashes(), _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleBatchClaim.usingBatchClaim()(claimPayload.toClaimHash(), claimPayload, 0xa0, uint256(1).asStubborn().typehashes(), _domainSeparator(), operation); } function _processQualifiedBatchClaim(QualifiedBatchClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processBatchClaimWithQualification.usingQualifiedBatchClaim()( + return ClaimProcessorLib.processBatchClaimWithQualification.usingQualifiedBatchClaim()( messageHash, qualificationMessageHash, claimPayload, 0xe0, uint256(1).asStubborn().typehashes(), _domainSeparator(), operation ); } function _processBatchClaimWithWitness(BatchClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleBatchClaim.usingBatchClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleBatchClaim.usingBatchClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); } function _processQualifiedBatchClaimWithWitness(QualifiedBatchClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -207,16 +213,19 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processBatchClaimWithQualification.usingQualifiedBatchClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processBatchClaimWithQualification.usingQualifiedBatchClaimWithWitness()( + messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation + ); } function _processSplitBatchClaim(SplitBatchClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleSplitBatchClaim.usingSplitBatchClaim()(claimPayload.toClaimHash(), claimPayload, 0xa0, uint256(1).asStubborn().typehashes(), _domainSeparator(), operation); + return + ClaimProcessorLib.processSimpleSplitBatchClaim.usingSplitBatchClaim()(claimPayload.toClaimHash(), claimPayload, 0xa0, uint256(1).asStubborn().typehashes(), _domainSeparator(), operation); } function _processQualifiedSplitBatchClaim(QualifiedSplitBatchClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processSplitBatchClaimWithQualification.usingQualifiedSplitBatchClaim()( + return ClaimProcessorLib.processSplitBatchClaimWithQualification.usingQualifiedSplitBatchClaim()( messageHash, qualificationMessageHash, claimPayload, 0xe0, uint256(1).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -226,7 +235,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleSplitBatchClaim.usingSplitBatchClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleSplitBatchClaim.usingSplitBatchClaimWithWitness()(messageHash, claimPayload, 0xe0, typehash, _domainSeparator(), operation); } function _processQualifiedSplitBatchClaimWithWitness(QualifiedSplitBatchClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -234,17 +243,19 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitBatchClaimWithQualification.usingQualifiedSplitBatchClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSplitBatchClaimWithQualification.usingQualifiedSplitBatchClaimWithWitness()( + messageHash, qualificationMessageHash, claimPayload, 0x120, typehash, _domainSeparator(), operation + ); } ///// 3. Multichain Claims ///// function _processMultichainClaim(MultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleClaim.usingMultichainClaim()(claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleClaim.usingMultichainClaim()(claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation); } function _processQualifiedMultichainClaim(QualifiedMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processClaimWithQualification.usingQualifiedMultichainClaim()( + return ClaimProcessorLib.processClaimWithQualification.usingQualifiedMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x100, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -254,7 +265,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleClaim.usingMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleClaim.usingMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); } function _processQualifiedMultichainClaimWithWitness(QualifiedMultichainClaimWithWitness calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -262,11 +273,14 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processClaimWithQualification.usingQualifiedMultichainClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x140, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processClaimWithQualification.usingQualifiedMultichainClaimWithWitness()( + messageHash, qualificationMessageHash, claimPayload, 0x140, typehash, _domainSeparator(), operation + ); } function _processSplitMultichainClaim(SplitMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleSplitClaim.usingSplitMultichainClaim()(claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation); + return + ClaimProcessorLib.processSimpleSplitClaim.usingSplitMultichainClaim()(claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation); } function _processQualifiedSplitMultichainClaim(QualifiedSplitMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -274,7 +288,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processSplitClaimWithQualification.usingQualifiedSplitMultichainClaim()( + return ClaimProcessorLib.processSplitClaimWithQualification.usingQualifiedSplitMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x100, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -284,7 +298,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleSplitClaim.usingSplitMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleSplitClaim.usingSplitMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); } function _processQualifiedSplitMultichainClaimWithWitness( @@ -292,12 +306,15 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitClaimWithQualification.usingQualifiedSplitMultichainClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x140, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSplitClaimWithQualification.usingQualifiedSplitMultichainClaimWithWitness()( + messageHash, qualificationMessageHash, claimPayload, 0x140, typehash, _domainSeparator(), operation + ); } ///// 4. Batch Multichain Claims ///// function _processBatchMultichainClaim(BatchMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleBatchClaim.usingBatchMultichainClaim()(claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation); + return + ClaimProcessorLib.processSimpleBatchClaim.usingBatchMultichainClaim()(claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation); } function _processQualifiedBatchMultichainClaim(QualifiedBatchMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -305,7 +322,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processBatchClaimWithQualification.usingQualifiedBatchMultichainClaim()( + return ClaimProcessorLib.processBatchClaimWithQualification.usingQualifiedBatchMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x100, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -315,7 +332,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleBatchClaim.usingBatchMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleBatchClaim.usingBatchMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); } function _processQualifiedBatchMultichainClaimWithWitness( @@ -323,14 +340,18 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processBatchClaimWithQualification.usingQualifiedBatchMultichainClaimWithWitness()(messageHash, qualificationMessageHash, claimPayload, 0x140, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processBatchClaimWithQualification.usingQualifiedBatchMultichainClaimWithWitness()( + messageHash, qualificationMessageHash, claimPayload, 0x140, typehash, _domainSeparator(), operation + ); } function _processSplitBatchMultichainClaim(SplitBatchMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processSimpleSplitBatchClaim.usingSplitBatchMultichainClaim()(claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleSplitBatchClaim.usingSplitBatchMultichainClaim()( + claimPayload.toClaimHash(), claimPayload, 0xc0, uint256(2).asStubborn().typehashes(), _domainSeparator(), operation + ); } function _processQualifiedSplitBatchMultichainClaim(QualifiedSplitBatchMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) @@ -338,7 +359,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processSplitBatchClaimWithQualification.usingQualifiedSplitBatchMultichainClaim()( + return ClaimProcessorLib.processSplitBatchClaimWithQualification.usingQualifiedSplitBatchMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x100, uint256(1).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -348,7 +369,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSimpleSplitBatchClaim.usingSplitBatchMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); + return ClaimProcessorLib.processSimpleSplitBatchClaim.usingSplitBatchMultichainClaimWithWitness()(messageHash, claimPayload, 0x100, typehash, _domainSeparator(), operation); } function _processQualifiedSplitBatchMultichainClaimWithWitness( @@ -356,14 +377,14 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitBatchClaimWithQualification.usingQualifiedSplitBatchMultichainClaimWithWitness()( + return ClaimProcessorLib.processSplitBatchClaimWithQualification.usingQualifiedSplitBatchMultichainClaimWithWitness()( messageHash, qualificationMessageHash, claimPayload, 0x140, typehash, _domainSeparator(), operation ); } ///// 5. Exogenous Multichain Claims ///// function _processExogenousMultichainClaim(ExogenousMultichainClaim calldata claimPayload, function(address, address, uint256, uint256) internal returns (bool) operation) internal returns (bool) { - return _processClaimWithSponsorDomain.usingExogenousMultichainClaim()( + return ClaimProcessorLib.processClaimWithSponsorDomain.usingExogenousMultichainClaim()( claimPayload.toClaimHash(), claimPayload, 0x100, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -373,7 +394,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedMultichainClaim()( + return ClaimProcessorLib.processClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -383,7 +404,7 @@ contract ClaimProcessorLogic is SharedLogic { returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processClaimWithSponsorDomain.usingExogenousMultichainClaimWithWitness()( + return ClaimProcessorLib.processClaimWithSponsorDomain.usingExogenousMultichainClaimWithWitness()( messageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } @@ -393,7 +414,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedMultichainClaimWithWitness()( + return ClaimProcessorLib.processClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedMultichainClaimWithWitness()( messageHash, qualificationMessageHash, claimPayload, 0x180, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } @@ -402,7 +423,7 @@ contract ClaimProcessorLogic is SharedLogic { internal returns (bool) { - return _processSplitClaimWithSponsorDomain.usingExogenousSplitMultichainClaim()( + return ClaimProcessorLib.processSplitClaimWithSponsorDomain.usingExogenousSplitMultichainClaim()( claimPayload.toClaimHash(), claimPayload, 0x100, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -412,7 +433,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processSplitClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitMultichainClaim()( + return ClaimProcessorLib.processSplitClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -422,7 +443,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitClaimWithSponsorDomain.usingExogenousSplitMultichainClaimWithWitness()( + return ClaimProcessorLib.processSplitClaimWithSponsorDomain.usingExogenousSplitMultichainClaimWithWitness()( messageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } @@ -432,7 +453,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitMultichainClaimWithWitness()( + return ClaimProcessorLib.processSplitClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitMultichainClaimWithWitness()( messageHash, qualificationMessageHash, claimPayload, 0x180, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } @@ -442,7 +463,7 @@ contract ClaimProcessorLogic is SharedLogic { internal returns (bool) { - return _processBatchClaimWithSponsorDomain.usingExogenousBatchMultichainClaim()( + return ClaimProcessorLib.processBatchClaimWithSponsorDomain.usingExogenousBatchMultichainClaim()( claimPayload.toClaimHash(), claimPayload, 0x100, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -452,7 +473,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedBatchMultichainClaim()( + return ClaimProcessorLib.processBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedBatchMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -462,7 +483,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processBatchClaimWithSponsorDomain.usingExogenousBatchMultichainClaimWithWitness()( + return ClaimProcessorLib.processBatchClaimWithSponsorDomain.usingExogenousBatchMultichainClaimWithWitness()( messageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } @@ -472,7 +493,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedBatchMultichainClaimWithWitness()( + return ClaimProcessorLib.processBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedBatchMultichainClaimWithWitness()( messageHash, qualificationMessageHash, claimPayload, 0x180, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } @@ -481,7 +502,7 @@ contract ClaimProcessorLogic is SharedLogic { internal returns (bool) { - return _processSplitBatchClaimWithSponsorDomain.usingExogenousSplitBatchMultichainClaim()( + return ClaimProcessorLib.processSplitBatchClaimWithSponsorDomain.usingExogenousSplitBatchMultichainClaim()( claimPayload.toClaimHash(), claimPayload, 0x100, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -491,7 +512,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash) = claimPayload.toMessageHashes(); - return _processSplitBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitBatchMultichainClaim()( + return ClaimProcessorLib.processSplitBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitBatchMultichainClaim()( messageHash, qualificationMessageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), uint256(2).asStubborn().typehashes(), _domainSeparator(), operation ); } @@ -501,7 +522,7 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitBatchClaimWithSponsorDomain.usingExogenousSplitBatchMultichainClaimWithWitness()( + return ClaimProcessorLib.processSplitBatchClaimWithSponsorDomain.usingExogenousSplitBatchMultichainClaimWithWitness()( messageHash, claimPayload, 0x140, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } @@ -511,497 +532,8 @@ contract ClaimProcessorLogic is SharedLogic { function(address, address, uint256, uint256) internal returns (bool) operation ) internal returns (bool) { (bytes32 messageHash, bytes32 qualificationMessageHash, bytes32 typehash) = claimPayload.toMessageHashes(); - return _processSplitBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitBatchMultichainClaimWithWitness()( + return ClaimProcessorLib.processSplitBatchClaimWithQualificationAndSponsorDomain.usingExogenousQualifiedSplitBatchMultichainClaimWithWitness()( messageHash, qualificationMessageHash, claimPayload, 0x180, claimPayload.notarizedChainId.toNotarizedDomainSeparator(), typehash, _domainSeparator(), operation ); } - - ///// 7. Private helper functions ///// - - /** - * @notice Internal function for validating claim execution parameters. Extracts and validates - * signatures from calldata, checks expiration, verifies allocator registration, consumes the - * nonce, derives the domain separator, and validates both the sponsor authorization (either - * through direct registration or a provided signature or EIP-1271 call) and the (potentially - * qualified) allocator authorization. Finally, emits a Claim event. - * @param allocatorId The unique identifier for the allocator mediating the claim. - * @param messageHash The EIP-712 hash of the claim message. - * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. - * @param calldataPointer Pointer to the location of the associated struct in calldata. - * @param domainSeparator The local domain separator. - * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. - * @param typehash The EIP-712 typehash used for the claim message. - * @return sponsor The extracted address of the claim sponsor. - */ - function _validate(uint96 allocatorId, bytes32 messageHash, bytes32 qualificationMessageHash, uint256 calldataPointer, bytes32 domainSeparator, bytes32 sponsorDomainSeparator, bytes32 typehash) - private - returns (address sponsor) - { - // Declare variables for signatures and parameters that will be extracted from calldata. - bytes calldata allocatorSignature; - bytes calldata sponsorSignature; - uint256 nonce; - uint256 expires; - - assembly ("memory-safe") { - // Extract allocator signature from calldata using offset stored at calldataPointer. - let allocatorSignaturePtr := add(calldataPointer, calldataload(calldataPointer)) - allocatorSignature.offset := add(0x20, allocatorSignaturePtr) - allocatorSignature.length := calldataload(allocatorSignaturePtr) - - // Extract sponsor signature from calldata using offset stored at calldataPointer + 0x20. - let sponsorSignaturePtr := add(calldataPointer, calldataload(add(calldataPointer, 0x20))) - sponsorSignature.offset := add(0x20, sponsorSignaturePtr) - sponsorSignature.length := calldataload(sponsorSignaturePtr) - - // Extract sponsor address, sanitizing upper 96 bits. - sponsor := shr(96, shl(96, calldataload(add(calldataPointer, 0x40)))) - - // Extract nonce and expiration timestamp. - nonce := calldataload(add(calldataPointer, 0x60)) - expires := calldataload(add(calldataPointer, 0x80)) - } - - // Ensure that the claim hasn't expired. - expires.later(); - - // Retrieve allocator address and consume nonce, ensuring it has not already been consumed. - address allocator = allocatorId.fromRegisteredAllocatorIdWithConsumed(nonce); - - assembly ("memory-safe") { - // Swap domain separator for provided sponsorDomainSeparator if a nonzero value was supplied. - sponsorDomainSeparator := add(sponsorDomainSeparator, mul(iszero(sponsorDomainSeparator), domainSeparator)) - } - - // Validate sponsor authorization through either ECDSA, EIP-1271, or direct registration. - if ((sponsorDomainSeparator != domainSeparator).or(sponsorSignature.length != 0) || sponsor.hasNoActiveRegistration(messageHash, typehash)) { - messageHash.signedBy(sponsor, sponsorSignature, sponsorDomainSeparator); - } - - // Validate allocator authorization against qualification message. - qualificationMessageHash.signedBy(allocator, allocatorSignature, domainSeparator); - - // Emit claim event. - sponsor.emitClaim(messageHash, allocator); - } - - /** - * @notice Private function for processing qualified claims with potentially exogenous - * sponsor signatures. Extracts claim parameters from calldata, validates the scope, - * ensures the claimed amount is within the allocated amount, validates the claim, - * and executes either a release of ERC6909 tokens or a withdrawal of underlying tokens. - * @param messageHash The EIP-712 hash of the claim message. - * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. - * @param calldataPointer Pointer to the location of the associated struct in calldata. - * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. - * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. - * @param typehash The EIP-712 typehash used for the claim message. - * @param domainSeparator The local domain separator. - * @param operation Function pointer to either _release or _withdraw for executing the claim. - * @return Whether the claim was successfully processed. - */ - function _processClaimWithQualificationAndSponsorDomain( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomainSeparator, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - // Declare variables for parameters that will be extracted from calldata. - uint256 id; - uint256 allocatedAmount; - address claimant; - uint256 amount; - - assembly ("memory-safe") { - // Calculate pointer to claim parameters using provided offset. - let calldataPointerWithOffset := add(calldataPointer, offsetToId) - - // Extract resource lock id, allocated amount, claimant address, and claim amount. - id := calldataload(calldataPointerWithOffset) - allocatedAmount := calldataload(add(calldataPointerWithOffset, 0x20)) - claimant := shr(96, shl(96, calldataload(add(calldataPointerWithOffset, 0x40)))) - amount := calldataload(add(calldataPointerWithOffset, 0x60)) - } - - // Verify the resource lock scope is compatible with the provided domain separator. - sponsorDomainSeparator.ensureValidScope(id); - - // Ensure the claimed amount does not exceed the allocated amount. - amount.withinAllocated(allocatedAmount); - - // Validate the claim and execute the specified operation (either release or withdraw). - return operation(_validate(id.toAllocatorId(), messageHash, qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash), claimant, id, amount); - } - - /** - * @notice Private function for processing qualified split claims with potentially exogenous - * sponsor signatures. Extracts claim parameters from calldata, validates the claim, - * validates the scope, and executes either releases of ERC6909 tokens or withdrawals of - * underlying tokens to multiple recipients. - * @param messageHash The EIP-712 hash of the claim message. - * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. - * @param calldataPointer Pointer to the location of the associated struct in calldata. - * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. - * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. - * @param typehash The EIP-712 typehash used for the claim message. - * @param domainSeparator The local domain separator. - * @param operation Function pointer to either _release or _withdraw for executing the claim. - * @return Whether the split claim was successfully processed. - */ - function _processSplitClaimWithQualificationAndSponsorDomain( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomainSeparator, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - // Declare variables for parameters that will be extracted from calldata. - uint256 id; - uint256 allocatedAmount; - SplitComponent[] calldata components; - - assembly ("memory-safe") { - // Calculate pointer to claim parameters using provided offset. - let calldataPointerWithOffset := add(calldataPointer, offsetToId) - - // Extract resource lock id and allocated amount. - id := calldataload(calldataPointerWithOffset) - allocatedAmount := calldataload(add(calldataPointerWithOffset, 0x20)) - - // Extract array of split components containing claimant addresses and amounts. - let componentsPtr := add(calldataPointer, calldataload(add(calldataPointerWithOffset, 0x40))) - components.offset := add(0x20, componentsPtr) - components.length := calldataload(componentsPtr) - } - - // Validate the claim and extract the sponsor address. - address sponsor = _validate(id.toAllocatorId(), messageHash, qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash); - - // Verify the resource lock scope is compatible with the provided domain separator. - sponsorDomainSeparator.ensureValidScope(id); - - // Process each split component, verifying total amount and executing operations. - return components.verifyAndProcessSplitComponents(sponsor, id, allocatedAmount, operation); - } - - /** - * @notice Private function for processing qualified batch claims with potentially exogenous - * sponsor signatures. Extracts batch claim parameters from calldata, validates the claim, - * executes operations, and performs optimized validation of allocator consistency, amounts, - * and scopes. If any validation fails, all operations are reverted after explicitly - * identifying the specific validation failures. - * @param messageHash The EIP-712 hash of the claim message. - * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. - * @param calldataPointer Pointer to the location of the associated struct in calldata. - * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. - * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. - * @param typehash The EIP-712 typehash used for the claim message. - * @param domainSeparator The local domain separator. - * @param operation Function pointer to either _release or _withdraw for executing the claim. - * @return Whether the batch claim was successfully processed. - */ - function _processBatchClaimWithQualificationAndSponsorDomain( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomainSeparator, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - // Declare variables for parameters that will be extracted from calldata. - BatchClaimComponent[] calldata claims; - address claimant; - - assembly ("memory-safe") { - // Calculate pointer to claim parameters using provided offset. - let calldataPointerWithOffset := add(calldataPointer, offsetToId) - - // Extract array of batch claim components and claimant address. - let claimsPtr := add(calldataPointer, calldataload(calldataPointerWithOffset)) - claims.offset := add(0x20, claimsPtr) - claims.length := calldataload(claimsPtr) - claimant := calldataload(add(calldataPointerWithOffset, 0x20)) - } - - // Extract allocator id from first claim for validation. - uint96 firstAllocatorId = claims[0].id.toAllocatorId(); - - // Validate the claim and extract the sponsor address. - address sponsor = _validate(firstAllocatorId, messageHash, qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash); - - // Revert if the batch is empty. - uint256 totalClaims = claims.length; - assembly ("memory-safe") { - if iszero(totalClaims) { - // revert InvalidBatchAllocation() - mstore(0, 0x3a03d3bb) - revert(0x1c, 0x04) - } - } - - // Process first claim and initialize error tracking. - // NOTE: many of the bounds checks on these array accesses can be skipped as an optimization - BatchClaimComponent calldata component = claims[0]; - uint256 id = component.id; - uint256 amount = component.amount; - uint256 errorBuffer = component.allocatedAmount.allocationExceededOrScopeNotMultichain(amount, id, sponsorDomainSeparator).asUint256(); - - // Execute transfer or withdrawal for first claim. - operation(sponsor, claimant, id, amount); - - unchecked { - // Process remaining claims while accumulating potential errors. - for (uint256 i = 1; i < totalClaims; ++i) { - component = claims[i]; - id = component.id; - amount = component.amount; - errorBuffer |= (id.toAllocatorId() != firstAllocatorId).or(component.allocatedAmount.allocationExceededOrScopeNotMultichain(amount, id, sponsorDomainSeparator)).asUint256(); - - operation(sponsor, claimant, id, amount); - } - - // If any errors occurred, identify specific failures and revert. - if (errorBuffer.asBool()) { - for (uint256 i = 0; i < totalClaims; ++i) { - component = claims[i]; - component.amount.withinAllocated(component.allocatedAmount); - id = component.id; - sponsorDomainSeparator.ensureValidScope(component.id); - } - - assembly ("memory-safe") { - // revert InvalidBatchAllocation() - mstore(0, 0x3a03d3bb) - revert(0x1c, 0x04) - } - } - } - - return true; - } - - /** - * @notice Private function for processing qualified split batch claims with potentially - * exogenous sponsor signatures. Extracts split batch claim parameters from calldata, - * validates the claim, and executes split operations for each resource lock. Uses optimized - * validation of allocator consistency and scopes, with explicit validation on failure to - * identify specific issues. Each resource lock can be split among multiple recipients. - * @param messageHash The EIP-712 hash of the claim message. - * @param qualificationMessageHash The EIP-712 hash of the allocator's qualification message. - * @param calldataPointer Pointer to the location of the associated struct in calldata. - * @param offsetToId Offset to segment of calldata where relevant claim parameters begin. - * @param sponsorDomainSeparator The domain separator for the sponsor's signature, or zero for non-exogenous claims. - * @param typehash The EIP-712 typehash used for the claim message. - * @param domainSeparator The local domain separator. - * @param operation Function pointer to either _release or _withdraw for executing the claim. - * @return Whether the split batch claim was successfully processed. - */ - function _processSplitBatchClaimWithQualificationAndSponsorDomain( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomainSeparator, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - // Declare variable for SplitBatchClaimComponent array that will be extracted from calldata. - SplitBatchClaimComponent[] calldata claims; - - assembly ("memory-safe") { - // Extract array of split batch claim components. - let claimsPtr := add(calldataPointer, calldataload(add(calldataPointer, offsetToId))) - claims.offset := add(0x20, claimsPtr) - claims.length := calldataload(claimsPtr) - } - - // Extract allocator id from first claim for validation. - uint96 firstAllocatorId = claims[0].id.toAllocatorId(); - - // Validate the claim and extract the sponsor address. - address sponsor = _validate(firstAllocatorId, messageHash, qualificationMessageHash, calldataPointer, domainSeparator, sponsorDomainSeparator, typehash); - - // Initialize tracking variables. - uint256 totalClaims = claims.length; - uint256 errorBuffer = (totalClaims == 0).asUint256(); - uint256 id; - - unchecked { - // Process each claim component while accumulating potential errors. - for (uint256 i = 0; i < totalClaims; ++i) { - SplitBatchClaimComponent calldata claimComponent = claims[i]; - id = claimComponent.id; - errorBuffer |= (id.toAllocatorId() != firstAllocatorId).or(id.scopeNotMultichain(sponsorDomainSeparator)).asUint256(); - - // Process each split component, verifying total amount and executing operations. - claimComponent.portions.verifyAndProcessSplitComponents(sponsor, id, claimComponent.allocatedAmount, operation); - } - - // If any errors occurred, identify specific scope failures and revert. - if (errorBuffer.asBool()) { - for (uint256 i = 0; i < totalClaims; ++i) { - sponsorDomainSeparator.ensureValidScope(claims[i].id); - } - - assembly ("memory-safe") { - // revert InvalidBatchAllocation() - mstore(0, 0x3a03d3bb) - revert(0x1c, 0x04) - } - } - } - - return true; - } - - function _processSimpleClaim( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processSimpleSplitClaim( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processSplitClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processSimpleBatchClaim( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processBatchClaimWithQualification( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processBatchClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processSimpleSplitBatchClaim( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processSplitBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processSplitBatchClaimWithQualification( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return - _processSplitBatchClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processClaimWithSponsorDomain( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomain, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); - } - - function _processClaimWithQualification( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processSplitClaimWithQualification( - bytes32 messageHash, - bytes32 qualificationMessageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processSplitClaimWithQualificationAndSponsorDomain(messageHash, qualificationMessageHash, calldataPointer, offsetToId, bytes32(0).asStubborn(), typehash, domainSeparator, operation); - } - - function _processSplitClaimWithSponsorDomain( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomain, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processSplitClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); - } - - function _processBatchClaimWithSponsorDomain( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomain, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); - } - - function _processSplitBatchClaimWithSponsorDomain( - bytes32 messageHash, - uint256 calldataPointer, - uint256 offsetToId, - bytes32 sponsorDomain, - bytes32 typehash, - bytes32 domainSeparator, - function(address, address, uint256, uint256) internal returns (bool) operation - ) private returns (bool) { - return _processSplitBatchClaimWithQualificationAndSponsorDomain(messageHash, messageHash, calldataPointer, offsetToId, sponsorDomain, typehash, domainSeparator, operation); - } }