feat: Timestamp added to (Un)Blocked events and small fix

This commit is contained in:
donosonaumczuk
2023-01-03 19:00:49 -03:00
parent f5136ae7a7
commit ad21f366f4
2 changed files with 16 additions and 13 deletions

View File

@@ -338,14 +338,14 @@ library Events {
* @param idOfProfileFollowed The ID of the profile that was followed.
* @param followTokenIdAssigned The ID of the follow token assigned to the follower.
* @param followModuleData The data to passed to the follow module, if any.
* @param followTimestamp The timestamp of the follow operation.
* @param timestamp The timestamp of the follow operation.
*/
event Followed(
uint256 indexed followerProfileId,
uint256 idOfProfileFollowed,
uint256 followTokenIdAssigned,
bytes followModuleData,
uint256 followTimestamp
uint256 timestamp
);
/**
@@ -353,12 +353,12 @@ library Events {
*
* @param unfollowerProfileId The ID of the profile that executed the unfollow.
* @param idOfProfileUnfollowed The ID of the profile that was unfollowed.
* @param unfollowTimestamp The timestamp of the unfollow operation.
* @param timestamp The timestamp of the unfollow operation.
*/
event Unfollowed(
uint256 indexed unfollowerProfileId,
uint256 idOfProfileUnfollowed,
uint256 unfollowTimestamp
uint256 timestamp
);
/**
@@ -366,16 +366,18 @@ library Events {
*
* @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 timestamp The timestamp of the block operation.
*/
event Blocked(uint256 indexed byProfileId, uint256 idOfProfileBlocked);
event Blocked(uint256 indexed byProfileId, uint256 idOfProfileBlocked, 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 timestamp The timestamp of the unblock operation.
*/
event Unblocked(uint256 indexed byProfileId, uint256 idOfProfileUnblocked);
event Unblocked(uint256 indexed byProfileId, uint256 idOfProfileUnblocked, uint256 timestamp);
/**
* @dev Emitted via callback when a followNFT is transferred.

View File

@@ -139,24 +139,25 @@ library InteractionHelpers {
}
uint256 i;
uint256 idOfProfileToSetBlockStatus;
bool blocked;
bool setToBlocked;
while (i < idsOfProfilesToSetBlockStatus.length) {
idOfProfileToSetBlockStatus = idsOfProfilesToSetBlockStatus[i];
_validateProfileExists(idOfProfileToSetBlockStatus);
if (followNFT != address(0) && (blocked = blockStatus[i])) {
setToBlocked = blockStatus[i];
if (followNFT != address(0) && setToBlocked) {
IFollowNFT(followNFT).block(idOfProfileToSetBlockStatus);
}
// Stores the block status.
// i.e. `_blockStatusByProfileIdByBlockeeProfileId[byProfileId][idOfProfileToSetBlockStatus] = blocked;`
// i.e. `_blockStatusByProfileIdByBlockeeProfileId[byProfileId][idOfProfileToSetBlockStatus] = setToBlocked;`
assembly {
mstore(0, idOfProfileToSetBlockStatus)
mstore(32, blockStatusByProfileSlot)
sstore(keccak256(0, 64), blocked)
sstore(keccak256(0, 64), setToBlocked)
}
if (blocked) {
emit Events.Blocked(byProfileId, idOfProfileToSetBlockStatus);
if (setToBlocked) {
emit Events.Blocked(byProfileId, idOfProfileToSetBlockStatus, block.timestamp);
} else {
emit Events.Unblocked(byProfileId, idOfProfileToSetBlockStatus);
emit Events.Unblocked(byProfileId, idOfProfileToSetBlockStatus, block.timestamp);
}
unchecked {
++i;