mirror of
https://github.com/lens-protocol/core.git
synced 2026-04-22 03:02:03 -04:00
feat: only can follow if not blocked validation added
This commit is contained in:
@@ -59,6 +59,7 @@ library Errors {
|
||||
error NotWhitelisted();
|
||||
error InvalidParameter();
|
||||
error ExecutorInvalid();
|
||||
error Blocked();
|
||||
|
||||
// Module Errors
|
||||
error InitParamsInvalid();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user