misc: Meta-tx messages renamed to avoid 'WithSig' suffix

This commit is contained in:
donosonaumczuk
2023-02-21 15:53:28 +00:00
parent adf8a07514
commit cfcf9da498
4 changed files with 45 additions and 54 deletions

View File

@@ -27,7 +27,7 @@ abstract contract LensNFTBase is ERC721Enumerable, ILensNFTBase {
keccak256(
'PermitForAll(address owner,address operator,bool approved,uint256 nonce,uint256 deadline)'
);
bytes32 internal constant BURN_WITH_SIG_TYPEHASH =
bytes32 internal constant BURN_TYPEHASH =
keccak256('BurnWithSig(uint256 tokenId,uint256 nonce,uint256 deadline)');
bytes32 internal constant EIP712_DOMAIN_TYPEHASH =
keccak256(
@@ -129,14 +129,7 @@ abstract contract LensNFTBase is ERC721Enumerable, ILensNFTBase {
unchecked {
MetaTxHelpers._validateRecoveredAddress(
_calculateDigest(
keccak256(
abi.encode(
BURN_WITH_SIG_TYPEHASH,
tokenId,
sigNonces[owner]++,
sig.deadline
)
)
keccak256(abi.encode(BURN_TYPEHASH, tokenId, sigNonces[owner]++, sig.deadline))
),
owner,
sig

View File

@@ -74,50 +74,48 @@ bytes32 constant PERMIT_TYPEHASH = keccak256(
bytes32 constant PERMIT_FOR_ALL_TYPEHASH = keccak256(
'PermitForAll(address owner,address operator,bool approved,uint256 nonce,uint256 deadline)'
);
bytes32 constant BURN_WITH_SIG_TYPEHASH = keccak256(
'BurnWithSig(uint256 tokenId,uint256 nonce,uint256 deadline)'
);
bytes32 constant BURN_TYPEHASH = keccak256('Burn(uint256 tokenId,uint256 nonce,uint256 deadline)');
bytes32 constant EIP712_DOMAIN_TYPEHASH = keccak256(
'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'
);
bytes32 constant SET_FOLLOW_MODULE_WITH_SIG_TYPEHASH = keccak256(
'SetFollowModuleWithSig(uint256 profileId,address followModule,bytes followModuleInitData,uint256 nonce,uint256 deadline)'
bytes32 constant SET_FOLLOW_MODULE_TYPEHASH = keccak256(
'SetFollowModule(uint256 profileId,address followModule,bytes followModuleInitData,uint256 nonce,uint256 deadline)'
);
bytes32 constant SET_FOLLOW_NFT_URI_WITH_SIG_TYPEHASH = keccak256(
'SetFollowNFTURIWithSig(uint256 profileId,string followNFTURI,uint256 nonce,uint256 deadline)'
bytes32 constant SET_FOLLOW_NFT_URI_TYPEHASH = keccak256(
'SetFollowNFTURI(uint256 profileId,string followNFTURI,uint256 nonce,uint256 deadline)'
);
bytes32 constant CHANGE_DELEGATED_EXECUTORS_CONFIG_WITH_SIG_TYPEHASH = keccak256(
'ChangeDelegatedExecutorsConfigWithSig(uint256 delegatorProfileId,address[] executors,bool[] approvals,uint64 configNumber,bool switchToGivenConfig,uint256 nonce,uint256 deadline)'
bytes32 constant CHANGE_DELEGATED_EXECUTORS_CONFIG_TYPEHASH = keccak256(
'ChangeDelegatedExecutorsConfig(uint256 delegatorProfileId,address[] executors,bool[] approvals,uint64 configNumber,bool switchToGivenConfig,uint256 nonce,uint256 deadline)'
);
bytes32 constant SET_PROFILE_IMAGE_URI_WITH_SIG_TYPEHASH = keccak256(
'SetProfileImageURIWithSig(uint256 profileId,string imageURI,uint256 nonce,uint256 deadline)'
bytes32 constant SET_PROFILE_IMAGE_URI_TYPEHASH = keccak256(
'SetProfileImageURI(uint256 profileId,string imageURI,uint256 nonce,uint256 deadline)'
);
bytes32 constant POST_WITH_SIG_TYPEHASH = keccak256(
'PostWithSig(uint256 profileId,string contentURI,address collectModule,bytes collectModuleInitData,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'
bytes32 constant POST_TYPEHASH = keccak256(
'Post(uint256 profileId,string contentURI,address collectModule,bytes collectModuleInitData,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'
);
bytes32 constant COMMENT_WITH_SIG_TYPEHASH = keccak256(
'CommentWithSig(uint256 profileId,string contentURI,uint256 pointedProfileId,uint256 pointedPubId,uint256 referrerProfileId,uint256 referrerPubId,bytes referenceModuleData,address collectModule,bytes collectModuleInitData,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'
bytes32 constant COMMENT_TYPEHASH = keccak256(
'Comment(uint256 profileId,string contentURI,uint256 pointedProfileId,uint256 pointedPubId,uint256 referrerProfileId,uint256 referrerPubId,bytes referenceModuleData,address collectModule,bytes collectModuleInitData,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'
);
bytes32 constant MIRROR_WITH_SIG_TYPEHASH = keccak256(
'MirrorWithSig(uint256 profileId,uint256 pointedProfileId,uint256 pointedPubId,uint256 referrerProfileId,uint256 referrerPubId,bytes referenceModuleData,uint256 nonce,uint256 deadline)'
bytes32 constant MIRROR_TYPEHASH = keccak256(
'Mirror(uint256 profileId,uint256 pointedProfileId,uint256 pointedPubId,uint256 referrerProfileId,uint256 referrerPubId,bytes referenceModuleData,uint256 nonce,uint256 deadline)'
);
bytes32 constant QUOTE_WITH_SIG_TYPEHASH = keccak256(
'QuoteWithSig(uint256 profileId,string contentURI,uint256 pointedProfileId,uint256 pointedPubId,uint256 referrerProfileId,uint256 referrerPubId,bytes referenceModuleData,address collectModule,bytes collectModuleInitData,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'
bytes32 constant QUOTE_TYPEHASH = keccak256(
'Quote(uint256 profileId,string contentURI,uint256 pointedProfileId,uint256 pointedPubId,uint256 referrerProfileId,uint256 referrerPubId,bytes referenceModuleData,address collectModule,bytes collectModuleInitData,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'
);
bytes32 constant FOLLOW_WITH_SIG_TYPEHASH = keccak256(
'FollowWithSig(uint256 followerProfileId,uint256[] idsOfProfilesToFollow,uint256[] followTokenIds,bytes[] datas,uint256 nonce,uint256 deadline)'
bytes32 constant FOLLOW_TYPEHASH = keccak256(
'Follow(uint256 followerProfileId,uint256[] idsOfProfilesToFollow,uint256[] followTokenIds,bytes[] datas,uint256 nonce,uint256 deadline)'
);
bytes32 constant UNFOLLOW_WITH_SIG_TYPEHASH = keccak256(
'UnfollowWithSig(uint256 unfollowerProfileId,uint256[] idsOfProfilesToUnfollow,uint256 nonce,uint256 deadline)'
bytes32 constant UNFOLLOW_TYPEHASH = keccak256(
'Unfollow(uint256 unfollowerProfileId,uint256[] idsOfProfilesToUnfollow,uint256 nonce,uint256 deadline)'
);
bytes32 constant SET_BLOCK_STATUS_WITH_SIG_TYPEHASH = keccak256(
'SetBlockStatusWithSig(uint256 byProfileId,uint256[] idsOfProfilesToSetBlockStatus,bool[] blockStatus,uint256 nonce,uint256 deadline)'
bytes32 constant SET_BLOCK_STATUS_TYPEHASH = keccak256(
'SetBlockStatus(uint256 byProfileId,uint256[] idsOfProfilesToSetBlockStatus,bool[] blockStatus,uint256 nonce,uint256 deadline)'
);
bytes32 constant COLLECT_WITH_SIG_TYPEHASH = keccak256(
'CollectWithSig(uint256 publicationCollectedProfileId,uint256 publicationCollectedId,uint256 collectorProfileId,uint256 referrerProfileId,uint256 referrerPubId,bytes collectModuleData,uint256 nonce,uint256 deadline)'
bytes32 constant COLLECT_TYPEHASH = keccak256(
'Collect(uint256 publicationCollectedProfileId,uint256 publicationCollectedId,uint256 collectorProfileId,uint256 referrerProfileId,uint256 referrerPubId,bytes collectModuleData,uint256 nonce,uint256 deadline)'
);
bytes32 constant SET_PROFILE_METADATA_URI_WITH_SIG_TYPEHASH = keccak256(
'SetProfileMetadataURIWithSig(uint256 profileId,string metadata,uint256 nonce,uint256 deadline)'
bytes32 constant SET_PROFILE_METADATA_URI_TYPEHASH = keccak256(
'SetProfileMetadataURI(uint256 profileId,string metadata,uint256 nonce,uint256 deadline)'
);
bytes4 constant EIP1271_MAGIC_VALUE = 0x1626ba7e;

View File

@@ -88,7 +88,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
SET_PROFILE_METADATA_URI_WITH_SIG_TYPEHASH,
SET_PROFILE_METADATA_URI_TYPEHASH,
profileId,
keccak256(bytes(metadataURI)),
_sigNonces(signature.signer),
@@ -111,7 +111,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
SET_FOLLOW_MODULE_WITH_SIG_TYPEHASH,
SET_FOLLOW_MODULE_TYPEHASH,
profileId,
followModule,
keccak256(followModuleInitData),
@@ -139,7 +139,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
CHANGE_DELEGATED_EXECUTORS_CONFIG_WITH_SIG_TYPEHASH,
CHANGE_DELEGATED_EXECUTORS_CONFIG_TYPEHASH,
delegatorProfileId,
abi.encodePacked(executors),
abi.encodePacked(approvals),
@@ -164,7 +164,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
SET_PROFILE_IMAGE_URI_WITH_SIG_TYPEHASH,
SET_PROFILE_IMAGE_URI_TYPEHASH,
profileId,
keccak256(bytes(imageURI)),
_sigNonces(signature.signer),
@@ -186,7 +186,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
SET_FOLLOW_NFT_URI_WITH_SIG_TYPEHASH,
SET_FOLLOW_NFT_URI_TYPEHASH,
profileId,
keccak256(bytes(followNFTURI)),
_sigNonces(signature.signer),
@@ -207,7 +207,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
POST_WITH_SIG_TYPEHASH,
POST_TYPEHASH,
postParams.profileId,
keccak256(bytes(postParams.contentURI)),
postParams.collectModule,
@@ -234,7 +234,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
COMMENT_WITH_SIG_TYPEHASH,
COMMENT_TYPEHASH,
commentParams.profileId,
keccak256(bytes(commentParams.contentURI)),
commentParams.pointedProfileId,
@@ -265,7 +265,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
COMMENT_WITH_SIG_TYPEHASH,
COMMENT_TYPEHASH,
quoteParams.profileId,
keccak256(bytes(quoteParams.contentURI)),
quoteParams.pointedProfileId,
@@ -294,7 +294,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
MIRROR_WITH_SIG_TYPEHASH,
MIRROR_TYPEHASH,
mirrorParams.profileId,
mirrorParams.pointedProfileId,
mirrorParams.pointedPubId,
@@ -318,7 +318,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
BURN_WITH_SIG_TYPEHASH,
BURN_TYPEHASH,
tokenId,
_sigNonces(signature.signer),
signature.deadline
@@ -352,7 +352,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
FOLLOW_WITH_SIG_TYPEHASH,
FOLLOW_TYPEHASH,
followerProfileId,
keccak256(abi.encodePacked(idsOfProfilesToFollow)),
keccak256(abi.encodePacked(followTokenIds)),
@@ -376,7 +376,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
UNFOLLOW_WITH_SIG_TYPEHASH,
UNFOLLOW_TYPEHASH,
unfollowerProfileId,
keccak256(abi.encodePacked(idsOfProfilesToUnfollow)),
_sigNonces(signature.signer),
@@ -399,7 +399,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
SET_BLOCK_STATUS_WITH_SIG_TYPEHASH,
SET_BLOCK_STATUS_TYPEHASH,
byProfileId,
keccak256(abi.encodePacked(idsOfProfilesToSetBlockStatus)),
keccak256(abi.encodePacked(blockStatus)),
@@ -421,7 +421,7 @@ library MetaTxHelpers {
_calculateDigest(
keccak256(
abi.encode(
COLLECT_WITH_SIG_TYPEHASH,
COLLECT_TYPEHASH,
collectParams.publicationCollectedProfileId,
collectParams.publicationCollectedId,
collectParams.collectorProfileId,

View File

@@ -23,7 +23,7 @@ contract LensPeriphery {
keccak256(
'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'
);
bytes32 internal constant TOGGLE_FOLLOW_WITH_SIG_TYPEHASH =
bytes32 internal constant TOGGLE_FOLLOW_TYPEHASH =
keccak256(
'ToggleFollowWithSig(uint256[] profileIds,bool[] enables,uint256 nonce,uint256 deadline)'
);
@@ -62,7 +62,7 @@ contract LensPeriphery {
_calculateDigest(
keccak256(
abi.encode(
TOGGLE_FOLLOW_WITH_SIG_TYPEHASH,
TOGGLE_FOLLOW_TYPEHASH,
keccak256(abi.encodePacked(vars.profileIds)),
keccak256(abi.encodePacked(vars.enables)),
sigNonces[vars.follower]++,