mirror of
https://github.com/lens-protocol/core.git
synced 2026-04-22 03:02:03 -04:00
feat: validateNotBlocked moved to GeneralHelpers
This commit is contained in:
@@ -229,4 +229,19 @@ library GeneralHelpers {
|
||||
}
|
||||
return originator;
|
||||
}
|
||||
|
||||
function validateNotBlocked(uint256 profile, uint256 byProfile) internal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ library InteractionHelpers {
|
||||
while (i < idsOfProfilesToFollow.length) {
|
||||
_validateProfileExists(idsOfProfilesToFollow[i]);
|
||||
|
||||
_validateNotBlocked(followerProfileId, idsOfProfilesToFollow[i]);
|
||||
GeneralHelpers.validateNotBlocked(followerProfileId, idsOfProfilesToFollow[i]);
|
||||
|
||||
if (followerProfileId == idsOfProfilesToFollow[i]) {
|
||||
revert Errors.SelfFollow();
|
||||
@@ -420,19 +420,4 @@ 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