Feature request: support multiple claims by a single address
Right now, the once a user claims, they can't be issued another "voucher" to claim. This is primarily because the mapping of usedClaims relies on an address as it's key usedClaims[address]
One way to support more flexibility here is to instead use a hash as the key. For ex, a voucherHash.
The typehash would need to be updated to include the voucherHash
bytes32 private immutable _CHAIN_CLAIM_TYPEHASH =
keccak256("Claim(address chainedAddress, bytes32 voucherHash)");
During the claim, it can be requested from the implementor to supply this voucherHash, which could then be used as the key. This would provide flexibility to the implementor to support multiple claims by a single address. And it also removes the need to instantiate ChainClaim every time.
function claim(
address issuedAddress,
address destinationAddress,
bytes32 voucherHash,
uint8[2] memory v,
bytes32[2] memory r,
bytes32[2] memory s
) internal returns (bool) {
if (usedVouchers[voucherHash]) {
revert ErrorUsedVoucher();
}
if (!isValidIssuerSig(issuedAddress, voucherHash, v[0], r[0], s[0]))
revert ErrorInvalidIssuerSignature();
if (
!isValidClaimantSig(issuedAddress, destinationAddress, voucherHash, v[1], r[1], s[1])
) revert ErrorInvalidClaimantSignature();
usedVouchers[voucherHash] = true;
return true;
}
I'd be super interested to hear thoughts on this. Happy to send a PR, I have a working version already.