misc: Transaction executor added as event param

This commit is contained in:
donosonaumczuk
2023-08-22 18:17:12 +01:00
parent 8726afa216
commit 393f78fe9d
18 changed files with 199 additions and 66 deletions

View File

@@ -91,7 +91,8 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
_followWithUnwrappedTokenFromBurnedProfile({
followerProfileId: followerProfileId,
followTokenId: followTokenId,
currentFollowerProfileId: currentFollowerProfileId
currentFollowerProfileId: currentFollowerProfileId,
transactionExecutor: transactionExecutor
});
}
@@ -132,7 +133,7 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
function removeFollower(uint256 followTokenId) external override {
address followTokenOwner = ownerOf(followTokenId);
if (followTokenOwner == msg.sender || isApprovedForAll(followTokenOwner, msg.sender)) {
_unfollowIfHasFollower(followTokenId);
_unfollowIfHasFollower(followTokenId, msg.sender);
} else {
revert DoesNotHavePermissions();
}
@@ -254,7 +255,7 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
}
function burn(uint256 followTokenId) public override {
_unfollowIfHasFollower(followTokenId);
_unfollowIfHasFollower(followTokenId, msg.sender);
super.burn(followTokenId);
}
@@ -334,7 +335,8 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
_replaceFollower({
currentFollowerProfileId: _followDataByFollowTokenId[followTokenId].followerProfileId,
newFollowerProfileId: followerProfileId,
followTokenId: followTokenId
followTokenId: followTokenId,
transactionExecutor: transactionExecutor
});
return followTokenId;
}
@@ -342,7 +344,8 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
function _followWithUnwrappedTokenFromBurnedProfile(
uint256 followerProfileId,
uint256 followTokenId,
uint256 currentFollowerProfileId
uint256 currentFollowerProfileId,
address transactionExecutor
) internal returns (uint256) {
if (IERC721Timestamped(HUB).exists(currentFollowerProfileId)) {
revert DoesNotHavePermissions();
@@ -350,7 +353,8 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
_replaceFollower({
currentFollowerProfileId: currentFollowerProfileId,
newFollowerProfileId: followerProfileId,
followTokenId: followTokenId
followTokenId: followTokenId,
transactionExecutor: transactionExecutor
});
return followTokenId;
}
@@ -369,12 +373,13 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
function _replaceFollower(
uint256 currentFollowerProfileId,
uint256 newFollowerProfileId,
uint256 followTokenId
uint256 followTokenId,
address transactionExecutor
) internal {
if (currentFollowerProfileId != 0) {
// As it has a follower, unfollow first, removing the current follower.
delete _followTokenIdByFollowerProfileId[currentFollowerProfileId];
ILensHub(HUB).emitUnfollowedEvent(currentFollowerProfileId, _followedProfileId);
ILensHub(HUB).emitUnfollowedEvent(currentFollowerProfileId, _followedProfileId, transactionExecutor);
} else {
unchecked {
_followerCount++;
@@ -406,11 +411,11 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
}
}
function _unfollowIfHasFollower(uint256 followTokenId) internal {
function _unfollowIfHasFollower(uint256 followTokenId, address transactionExecutor) internal {
uint256 followerProfileId = _followDataByFollowTokenId[followTokenId].followerProfileId;
if (followerProfileId != 0) {
_unfollow(followerProfileId, followTokenId);
ILensHub(HUB).emitUnfollowedEvent(followerProfileId, _followedProfileId);
ILensHub(HUB).emitUnfollowedEvent(followerProfileId, _followedProfileId, transactionExecutor);
}
}

View File

@@ -102,7 +102,7 @@ contract LensHub is
whenNotPaused
onlyProfileOwnerOrDelegatedExecutor(msg.sender, profileId)
{
ProfileLib.setProfileMetadataURI(profileId, metadataURI);
ProfileLib.setProfileMetadataURI(profileId, metadataURI, msg.sender);
}
/// @inheritdoc ILensProtocol
@@ -112,7 +112,7 @@ contract LensHub is
Types.EIP712Signature calldata signature
) external override whenNotPaused onlyProfileOwnerOrDelegatedExecutor(signature.signer, profileId) {
MetaTxLib.validateSetProfileMetadataURISignature(signature, profileId, metadataURI);
ProfileLib.setProfileMetadataURI(profileId, metadataURI);
ProfileLib.setProfileMetadataURI(profileId, metadataURI, signature.signer);
}
/// @inheritdoc ILensProtocol
@@ -369,7 +369,7 @@ contract LensHub is
uint256[] calldata idsOfProfilesToSetBlockStatus,
bool[] calldata blockStatus
) external override whenNotPaused onlyProfileOwnerOrDelegatedExecutor(msg.sender, byProfileId) {
return ProfileLib.setBlockStatus(byProfileId, idsOfProfilesToSetBlockStatus, blockStatus);
return ProfileLib.setBlockStatus(byProfileId, idsOfProfilesToSetBlockStatus, blockStatus, msg.sender);
}
/// @inheritdoc ILensProtocol
@@ -380,7 +380,7 @@ contract LensHub is
Types.EIP712Signature calldata signature
) external override whenNotPaused onlyProfileOwnerOrDelegatedExecutor(signature.signer, byProfileId) {
MetaTxLib.validateSetBlockStatusSignature(signature, byProfileId, idsOfProfilesToSetBlockStatus, blockStatus);
return ProfileLib.setBlockStatus(byProfileId, idsOfProfilesToSetBlockStatus, blockStatus);
return ProfileLib.setBlockStatus(byProfileId, idsOfProfilesToSetBlockStatus, blockStatus, signature.signer);
}
/// @inheritdoc ILensProtocol

View File

@@ -9,12 +9,16 @@ import {Events} from 'contracts/libraries/constants/Events.sol';
abstract contract LensHubEventHooks is ILensHubEventHooks {
/// @inheritdoc ILensHubEventHooks
function emitUnfollowedEvent(uint256 unfollowerProfileId, uint256 idOfProfileUnfollowed) external override {
function emitUnfollowedEvent(
uint256 unfollowerProfileId,
uint256 idOfProfileUnfollowed,
address transactionExecutor
) external override {
address expectedFollowNFT = StorageLib.getProfile(idOfProfileUnfollowed).followNFT;
if (msg.sender != expectedFollowNFT) {
revert Errors.CallerNotFollowNFT();
}
emit Events.Unfollowed(unfollowerProfileId, idOfProfileUnfollowed, block.timestamp);
emit Events.Unfollowed(unfollowerProfileId, idOfProfileUnfollowed, transactionExecutor, block.timestamp);
}
//////////////////////////////////////

View File

@@ -16,6 +16,11 @@ interface ILensHubEventHooks {
*
* @param unfollowerProfileId The ID of the profile that executed the unfollow.
* @param idOfProfileUnfollowed The ID of the profile that was unfollowed.
* @param transactionExecutor The address of the account executing the unfollow operation.
*/
function emitUnfollowedEvent(uint256 unfollowerProfileId, uint256 idOfProfileUnfollowed) external;
function emitUnfollowedEvent(
uint256 unfollowerProfileId,
uint256 idOfProfileUnfollowed,
address transactionExecutor
) external;
}

View File

@@ -57,7 +57,7 @@ library ActionLib {
actionModuleData: publicationActionParams.actionModuleData
})
);
emit Events.Acted(publicationActionParams, actionModuleReturnData, block.timestamp);
emit Events.Acted(publicationActionParams, actionModuleReturnData, transactionExecutor, block.timestamp);
return actionModuleReturnData;
}

View File

@@ -72,7 +72,7 @@ library FollowLib {
transactionExecutor: transactionExecutor
});
emit Events.Unfollowed(unfollowerProfileId, idOfProfileToUnfollow, block.timestamp);
emit Events.Unfollowed(unfollowerProfileId, idOfProfileToUnfollow, transactionExecutor, block.timestamp);
unchecked {
++i;
@@ -110,30 +110,56 @@ library FollowLib {
_profileToFollow.followNFT = followNFT;
}
uint256 followTokenIdAssigned = IFollowNFT(followNFT).follow({
followerProfileId: followerProfileId,
transactionExecutor: transactionExecutor,
followTokenId: followTokenId
return
_processFollow(
ProcessFollowParams({
followNFT: followNFT,
followerProfileId: followerProfileId,
transactionExecutor: transactionExecutor,
idOfProfileToFollow: idOfProfileToFollow,
followTokenId: followTokenId,
followModule: _profileToFollow.followModule,
followModuleData: followModuleData
})
);
}
// Struct defined for the sole purpose of avoiding 'stack too deep' error.
struct ProcessFollowParams {
address followNFT;
uint256 followerProfileId;
address transactionExecutor;
uint256 idOfProfileToFollow;
uint256 followTokenId;
address followModule;
bytes followModuleData;
}
function _processFollow(ProcessFollowParams memory processFollowParams) private returns (uint256) {
uint256 followTokenIdAssigned = IFollowNFT(processFollowParams.followNFT).follow({
followerProfileId: processFollowParams.followerProfileId,
transactionExecutor: processFollowParams.transactionExecutor,
followTokenId: processFollowParams.followTokenId
});
bytes memory processFollowModuleReturnData;
address followModule = _profileToFollow.followModule;
if (followModule != address(0)) {
processFollowModuleReturnData = IFollowModule(followModule).processFollow(
followerProfileId,
followTokenId,
transactionExecutor,
idOfProfileToFollow,
followModuleData
if (processFollowParams.followModule != address(0)) {
processFollowModuleReturnData = IFollowModule(processFollowParams.followModule).processFollow(
processFollowParams.followerProfileId,
processFollowParams.followTokenId,
processFollowParams.transactionExecutor,
processFollowParams.idOfProfileToFollow,
processFollowParams.followModuleData
);
}
emit Events.Followed(
followerProfileId,
idOfProfileToFollow,
processFollowParams.followerProfileId,
processFollowParams.idOfProfileToFollow,
followTokenIdAssigned,
followModuleData,
processFollowParams.followModuleData,
processFollowModuleReturnData,
processFollowParams.transactionExecutor,
block.timestamp
);

View File

@@ -174,6 +174,7 @@ library MigrationLib {
followTokenIdAssigned: followTokenId,
followModuleData: '',
processFollowModuleReturnData: '',
transactionExecutor: address(0), // For migrations, we use this special value as transaction executor.
timestamp: mintTimestamp // The only case where this won't match block.timestamp is during the migration
});
}
@@ -197,7 +198,7 @@ library MigrationLib {
).getProfileData(profileIds[i]);
IFollowModule(newFeeFollowModule).initializeFollowModule({
profileId: profileIds[i],
transactionExecutor: msg.sender,
transactionExecutor: msg.sender, // TODO: Review
data: abi.encode(
feeFollowModuleData.currency,
feeFollowModuleData.amount,

View File

@@ -54,9 +54,13 @@ library ProfileLib {
_setFollowModule(profileId, followModule, followModuleInitData);
}
function setProfileMetadataURI(uint256 profileId, string calldata metadataURI) external {
function setProfileMetadataURI(
uint256 profileId,
string calldata metadataURI,
address transactionExecutor
) external {
StorageLib.getProfile(profileId).metadataURI = metadataURI;
emit Events.ProfileMetadataSet(profileId, metadataURI, block.timestamp);
emit Events.ProfileMetadataSet(profileId, metadataURI, transactionExecutor, block.timestamp);
}
function _initFollowModule(
@@ -72,7 +76,8 @@ library ProfileLib {
function setBlockStatus(
uint256 byProfileId,
uint256[] calldata idsOfProfilesToSetBlockStatus,
bool[] calldata blockStatus
bool[] calldata blockStatus,
address transactionExecutor
) external {
if (idsOfProfilesToSetBlockStatus.length != blockStatus.length) {
revert Errors.ArrayMismatch();
@@ -92,14 +97,19 @@ library ProfileLib {
if (followNFT != address(0) && blockedStatus) {
bool hasUnfollowed = IFollowNFT(followNFT).processBlock(idOfProfileToSetBlockStatus);
if (hasUnfollowed) {
emit Events.Unfollowed(idOfProfileToSetBlockStatus, byProfileId, block.timestamp);
emit Events.Unfollowed(
idOfProfileToSetBlockStatus,
byProfileId,
transactionExecutor,
block.timestamp
);
}
}
_blockedStatus[idOfProfileToSetBlockStatus] = blockedStatus;
if (blockedStatus) {
emit Events.Blocked(byProfileId, idOfProfileToSetBlockStatus, block.timestamp);
emit Events.Blocked(byProfileId, idOfProfileToSetBlockStatus, transactionExecutor, block.timestamp);
} else {
emit Events.Unblocked(byProfileId, idOfProfileToSetBlockStatus, block.timestamp);
emit Events.Unblocked(byProfileId, idOfProfileToSetBlockStatus, transactionExecutor, block.timestamp);
}
unchecked {
++i;

View File

@@ -47,6 +47,7 @@ library PublicationLib {
pubIdAssigned,
actionModulesReturnDatas,
referenceModuleReturnData,
transactionExecutor,
block.timestamp
);
@@ -87,6 +88,7 @@ library PublicationLib {
referenceModuleReturnData,
actionModulesInitReturnDatas,
referenceModuleInitReturnData,
transactionExecutor,
block.timestamp
);
@@ -125,7 +127,13 @@ library PublicationLib {
referrerPubTypes
);
emit Events.MirrorCreated(mirrorParams, pubIdAssigned, referenceModuleReturnData, block.timestamp);
emit Events.MirrorCreated(
mirrorParams,
pubIdAssigned,
referenceModuleReturnData,
transactionExecutor,
block.timestamp
);
return pubIdAssigned;
}
@@ -161,6 +169,7 @@ library PublicationLib {
referenceModuleReturnData,
actionModulesReturnDatas,
referenceModuleInitReturnData,
transactionExecutor,
block.timestamp
);

View File

@@ -168,6 +168,7 @@ library Events {
* publication. This is ABI-encoded and depends on the action module chosen.
* @param referenceModuleInitReturnData The data returned from the reference module at initialization. This is
* ABI-encoded and depends on the reference module chosen.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event PostCreated(
@@ -175,6 +176,7 @@ library Events {
uint256 indexed pubId,
bytes[] actionModulesInitReturnDatas,
bytes referenceModuleInitReturnData,
address transactionExecutor,
uint256 timestamp
);
@@ -189,6 +191,7 @@ library Events {
* publication. This is ABI-encoded and depends on the action module chosen.
* @param referenceModuleInitReturnData The data returned from the reference module at initialization. This is
* ABI-encoded and depends on the reference module chosen.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event CommentCreated(
@@ -197,6 +200,7 @@ library Events {
bytes referenceModuleReturnData,
bytes[] actionModulesInitReturnDatas,
bytes referenceModuleInitReturnData,
address transactionExecutor,
uint256 timestamp
);
@@ -207,12 +211,14 @@ library Events {
* @param pubId The publication ID assigned to the created mirror.
* @param referenceModuleReturnData The data returned by the mirrored publication reference module's
* processMirror function, if the mirrored publication has a reference module set.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event MirrorCreated(
Types.MirrorParams mirrorParams,
uint256 indexed pubId,
bytes referenceModuleReturnData,
address transactionExecutor,
uint256 timestamp
);
@@ -227,6 +233,7 @@ library Events {
* publication. This is ABI-encoded and depends on the action module chosen.
* @param referenceModuleInitReturnData The data returned from the reference module at initialization. This is
* ABI-encoded and depends on the reference module chosen.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event QuoteCreated(
@@ -235,6 +242,7 @@ library Events {
bytes referenceModuleReturnData,
bytes[] actionModulesInitReturnDatas,
bytes referenceModuleInitReturnData,
address transactionExecutor,
uint256 timestamp
);
@@ -271,6 +279,7 @@ library Events {
* @param tokenId The token ID of the collect NFT that was minted as a collect of the publication.
* @param collectActionResult The data returned from the collect module's collect action. This is ABI-encoded
* and depends on the collect module chosen.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event Collected(
@@ -279,6 +288,7 @@ library Events {
address collectNFT,
uint256 tokenId,
bytes collectActionResult,
address transactionExecutor,
uint256 timestamp
);
@@ -288,9 +298,15 @@ library Events {
* @param publicationActionParams The parameters passed to act on a publication.
* @param actionModuleReturnData The data returned from the action modules. This is ABI-encoded and the format
* depends on the action module chosen.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event Acted(Types.PublicationActionParams publicationActionParams, bytes actionModuleReturnData, uint256 timestamp);
event Acted(
Types.PublicationActionParams publicationActionParams,
bytes actionModuleReturnData,
address transactionExecutor,
uint256 timestamp
);
/**
* @dev Emitted upon a successful follow operation.
@@ -301,6 +317,7 @@ library Events {
* @param followModuleData The data to passed to the follow module, if any.
* @param processFollowModuleReturnData The data returned by the followed profile follow module's processFollow
* function, if the followed profile has a reference module set.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The timestamp of the follow operation.
*/
event Followed(
@@ -309,6 +326,7 @@ library Events {
uint256 followTokenIdAssigned,
bytes followModuleData,
bytes processFollowModuleReturnData,
address transactionExecutor,
uint256 timestamp
);
@@ -317,27 +335,45 @@ library Events {
*
* @param unfollowerProfileId The ID of the profile that executed the unfollow.
* @param idOfProfileUnfollowed The ID of the profile that was unfollowed.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The timestamp of the unfollow operation.
*/
event Unfollowed(uint256 indexed unfollowerProfileId, uint256 idOfProfileUnfollowed, uint256 timestamp);
event Unfollowed(
uint256 indexed unfollowerProfileId,
uint256 idOfProfileUnfollowed,
address transactionExecutor,
uint256 timestamp
);
/**
* @dev Emitted upon a successful block, through a block status setting operation.
*
* @param byProfileId The ID of the profile that executed the block status change.
* @param idOfProfileBlocked The ID of the profile whose block status have been set to blocked.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The timestamp of the block operation.
*/
event Blocked(uint256 indexed byProfileId, uint256 idOfProfileBlocked, uint256 timestamp);
event Blocked(
uint256 indexed byProfileId,
uint256 idOfProfileBlocked,
address transactionExecutor,
uint256 timestamp
);
/**
* @dev Emitted upon a successful unblock, through a block status setting operation.
*
* @param byProfileId The ID of the profile that executed the block status change.
* @param idOfProfileUnblocked The ID of the profile whose block status have been set to unblocked.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The timestamp of the unblock operation.
*/
event Unblocked(uint256 indexed byProfileId, uint256 idOfProfileUnblocked, uint256 timestamp);
event Unblocked(
uint256 indexed byProfileId,
uint256 idOfProfileUnblocked,
address transactionExecutor,
uint256 timestamp
);
/**
* @dev Emitted via callback when a collectNFT is transferred.
@@ -405,9 +441,15 @@ library Events {
*
* @param profileId The profile ID the metadata is set for.
* @param metadata The metadata set for the profile and user.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event ProfileMetadataSet(uint256 indexed profileId, string metadata, uint256 timestamp);
event ProfileMetadataSet(
uint256 indexed profileId,
string metadata,
address transactionExecutor,
uint256 timestamp
);
/**
* @dev Emitted when an address' Profile Guardian state change is triggered.

View File

@@ -83,6 +83,7 @@ contract CollectPublicationAction is HubRestricted, IPublicationActionModule {
collectNFT: collectNFT,
tokenId: tokenId,
collectActionResult: collectActionResult,
transactionExecutor: processActionParams.transactionExecutor,
timestamp: block.timestamp
});

View File

@@ -103,7 +103,7 @@ contract ActTest is ReferralSystemTest {
function testAct() public {
vm.expectEmit(true, true, true, true, address(hub));
emit Events.Acted(actionParams, abi.encode(true), block.timestamp);
emit Events.Acted(actionParams, abi.encode(true), actor.owner, block.timestamp);
Types.ProcessActionParams memory processActionParams = Types.ProcessActionParams({
publicationActedProfileId: actionParams.publicationActedProfileId,

View File

@@ -289,6 +289,7 @@ contract FollowTest is BaseTest {
expectedFollowTokenIdAssigned,
followModuleData,
'',
testFollowerProfileOwner,
block.timestamp
);
@@ -347,6 +348,7 @@ contract FollowTest is BaseTest {
expectedFollowTokenIdAssigned,
followModuleData,
'',
approvedDelegatedExecutor,
block.timestamp
);

View File

@@ -47,7 +47,10 @@ contract LensHubEventHooksTest is BaseTest {
hub.collect(defaultCollectParams);
}
function testCannot_EmitUnfollowedEvent_ifNotFollowNFTOfFollowedProfile(address randomAddress) public {
function testCannot_EmitUnfollowedEvent_ifNotFollowNFTOfFollowedProfile(
address randomAddress,
address transactionExecutor
) public {
vm.assume(randomAddress != address(0));
address followNFT = hub.getProfile(defaultAccount.profileId).followNFT;
vm.assume(randomAddress != followNFT);
@@ -57,20 +60,24 @@ contract LensHubEventHooksTest is BaseTest {
vm.expectRevert(Errors.CallerNotFollowNFT.selector);
vm.prank(randomAddress);
hub.emitUnfollowedEvent(follower.profileId, defaultAccount.profileId);
hub.emitUnfollowedEvent(follower.profileId, defaultAccount.profileId, transactionExecutor);
}
function testEmitUnfollowedEvent_ifFollowNFTOfFollowedProfile() public {
function testEmitUnfollowedEvent_ifFollowNFTOfFollowedProfile(address transactionExecutor) public {
address followNFT = hub.getProfile(defaultAccount.profileId).followNFT;
vm.expectEmit(true, true, true, true, address(hub));
emit Events.Unfollowed(follower.profileId, defaultAccount.profileId, block.timestamp);
emit Events.Unfollowed(follower.profileId, defaultAccount.profileId, transactionExecutor, block.timestamp);
vm.prank(followNFT);
hub.emitUnfollowedEvent(follower.profileId, defaultAccount.profileId);
hub.emitUnfollowedEvent(follower.profileId, defaultAccount.profileId, transactionExecutor);
}
function testEmitCollectNFTTransferEvent_ForRealThisTime(uint256 collectNFTId, address from, address to) public {
function testEmitCollectNFTTransferEvent_ForRealThisTime(
uint256 collectNFTId,
address from,
address to
) public {
address collectNFT = hub.getPublication(defaultAccount.profileId, defaultPubId).__DEPRECATED__collectNFT;
vm.expectEmit(true, true, true, true, address(hub));

View File

@@ -10,7 +10,11 @@ contract ProfileMetadataURITest is BaseTest {
super.setUp();
}
function _setProfileMetadataURI(uint256 pk, uint256 profileId, string memory metadataURI) internal virtual {
function _setProfileMetadataURI(
uint256 pk,
uint256 profileId,
string memory metadataURI
) internal virtual {
vm.prank(vm.addr(pk));
hub.setProfileMetadataURI(profileId, metadataURI);
}
@@ -48,6 +52,7 @@ contract ProfileMetadataURITest is BaseTest {
emit Events.ProfileMetadataSet({
profileId: defaultAccount.profileId,
metadata: MOCK_URI,
transactionExecutor: delegatedExecutor,
timestamp: block.timestamp
});
_setProfileMetadataURI({pk: delegatedExecutorPk, profileId: defaultAccount.profileId, metadataURI: MOCK_URI});
@@ -61,6 +66,7 @@ contract ProfileMetadataURITest is BaseTest {
emit Events.ProfileMetadataSet({
profileId: defaultAccount.profileId,
metadata: MOCK_URI,
transactionExecutor: defaultAccount.owner,
timestamp: block.timestamp
});
_setProfileMetadataURI({
@@ -110,7 +116,11 @@ contract ProfileMetadataURITest_MetaTx is ProfileMetadataURITest, MetaTxNegative
});
}
function _executeMetaTx(uint256 signerPk, uint256 nonce, uint256 deadline) internal virtual override {
function _executeMetaTx(
uint256 signerPk,
uint256 nonce,
uint256 deadline
) internal virtual override {
bytes32 digest = _getSetProfileMetadataURITypedDataHash(defaultAccount.profileId, MOCK_URI, nonce, deadline);
hub.setProfileMetadataURIWithSig({

View File

@@ -148,10 +148,10 @@ contract SetBlockStatusTest is BaseTest {
assertFalse(hub.isBlocked(anotherBlockeeProfileId, statusSetterProfileId));
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, block.timestamp);
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, statusSetterProfileOwner, block.timestamp);
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Blocked(statusSetterProfileId, anotherBlockeeProfileId, block.timestamp);
emit Events.Blocked(statusSetterProfileId, anotherBlockeeProfileId, statusSetterProfileOwner, block.timestamp);
vm.expectCall(followNFTAddress, abi.encodeCall(followNFT.processBlock, (blockeeProfileId)), 2);
vm.expectCall(followNFTAddress, abi.encodeCall(followNFT.processBlock, (anotherBlockeeProfileId)), 1);
@@ -169,10 +169,15 @@ contract SetBlockStatusTest is BaseTest {
_refreshCachedNonces();
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, block.timestamp);
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, statusSetterProfileOwner, block.timestamp);
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Unblocked(statusSetterProfileId, anotherBlockeeProfileId, block.timestamp);
emit Events.Unblocked(
statusSetterProfileId,
anotherBlockeeProfileId,
statusSetterProfileOwner,
block.timestamp
);
_setBlockStatus({
pk: statusSetterProfileOwnerPk,
@@ -189,10 +194,10 @@ contract SetBlockStatusTest is BaseTest {
assertTrue(hub.isFollowing(blockeeProfileId, statusSetterProfileId));
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Unfollowed(blockeeProfileId, statusSetterProfileId, block.timestamp);
emit Events.Unfollowed(blockeeProfileId, statusSetterProfileId, statusSetterProfileOwner, block.timestamp);
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, block.timestamp);
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, statusSetterProfileOwner, block.timestamp);
vm.expectCall(followNFTAddress, abi.encodeCall(followNFT.processBlock, (blockeeProfileId)), 1);
@@ -216,7 +221,7 @@ contract SetBlockStatusTest is BaseTest {
assertEq(hub.getProfile(statusSetterProfileId).followNFT, address(0));
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, block.timestamp);
emit Events.Blocked(statusSetterProfileId, blockeeProfileId, statusSetterProfileOwner, block.timestamp);
_setBlockStatus({
pk: statusSetterProfileOwnerPk,

View File

@@ -142,7 +142,7 @@ contract UnfollowTest is BaseTest {
function testUnfollowAsUnfollowerOwner() public {
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, block.timestamp);
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, testUnfollowerProfileOwner, block.timestamp);
vm.expectCall(
targetFollowNFT,
@@ -173,7 +173,7 @@ contract UnfollowTest is BaseTest {
});
vm.expectEmit(true, false, false, true, address(hub));
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, block.timestamp);
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, approvedDelegatedExecutor, block.timestamp);
vm.expectCall(
targetFollowNFT,

View File

@@ -178,7 +178,11 @@ contract CollectPublicationActionTest is BaseTest {
);
}
function testInitializePublicationAction(uint256 profileId, uint256 pubId, address transactionExecutor) public {
function testInitializePublicationAction(
uint256 profileId,
uint256 pubId,
address transactionExecutor
) public {
vm.assume(profileId != 0);
vm.assume(pubId != 0);
vm.assume(transactionExecutor != address(0));
@@ -253,6 +257,7 @@ contract CollectPublicationActionTest is BaseTest {
collectNFT: collectNFT,
tokenId: 1,
collectActionResult: abi.encode(true),
transactionExecutor: transactionExecutor,
timestamp: block.timestamp
});
@@ -326,6 +331,7 @@ contract CollectPublicationActionTest is BaseTest {
collectNFT: collectNFT,
tokenId: 2,
collectActionResult: abi.encode(true),
transactionExecutor: transactionExecutor,
timestamp: block.timestamp
});