feat: only can follow if not blocked validation added

This commit is contained in:
donosonaumczuk
2022-11-23 22:31:14 +00:00
parent a767973fbd
commit 6449933b3f
2 changed files with 18 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ library Errors {
error NotWhitelisted();
error InvalidParameter();
error ExecutorInvalid();
error Blocked();
// Module Errors
error InitParamsInvalid();

View File

@@ -51,6 +51,8 @@ library InteractionHelpers {
for (uint256 i = 0; i < profileIds.length; ) {
_validateProfileExists(profileIds[i]);
_validateNotBlocked(follower, profileIds[i]);
followIdsAssigned[i] = _follow(
follower,
followerOwner,
@@ -363,4 +365,19 @@ library InteractionHelpers {
if (GeneralHelpers.unsafeOwnerOf(profileId) == address(0))
revert Errors.TokenDoesNotExist();
}
function _validateNotBlocked(uint256 profile, uint256 byProfile) private view {
bool isBlocked;
assembly {
mstore(0, byProfile)
mstore(32, BLOCK_STATUS_MAPPING_SLOT)
let blockStatusByProfileSlot := keccak256(0, 64)
mstore(0, profile)
mstore(32, blockStatusByProfileSlot)
isBlocked := sload(keccak256(0, 64))
}
if (isBlocked) {
revert Errors.Blocked();
}
}
}