mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-10 14:48:15 -05:00
Merge branch 'development' into fix/v2-small-fixes
This commit is contained in:
@@ -108,30 +108,18 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
|
||||
}
|
||||
|
||||
/// @inheritdoc IFollowNFT
|
||||
function unfollow(uint256 unfollowerProfileId, address transactionExecutor) external override onlyHub {
|
||||
function unfollow(uint256 unfollowerProfileId) external override onlyHub {
|
||||
uint256 followTokenId = _followTokenIdByFollowerProfileId[unfollowerProfileId];
|
||||
if (followTokenId == 0) {
|
||||
revert NotFollowing();
|
||||
}
|
||||
address followTokenOwner = _unsafeOwnerOf(followTokenId);
|
||||
// LensHub already validated that this action can only be performed by the unfollower profile's owner or one of
|
||||
// his approved delegated executors.
|
||||
_unfollow({unfollower: unfollowerProfileId, followTokenId: followTokenId});
|
||||
if (followTokenOwner == address(0)) {
|
||||
// Follow token is unwrapped.
|
||||
// Unfollowing and allowing recovery.
|
||||
_unfollow({unfollower: unfollowerProfileId, followTokenId: followTokenId});
|
||||
// Follow token was unwrapped, allowing recovery.
|
||||
_followDataByFollowTokenId[followTokenId].profileIdAllowedToRecover = unfollowerProfileId;
|
||||
} else {
|
||||
// Follow token is wrapped.
|
||||
address unfollowerProfileOwner = IERC721(HUB).ownerOf(unfollowerProfileId);
|
||||
// Follower profile owner or its approved delegated executor must hold the token or be approved-for-all.
|
||||
if (
|
||||
(transactionExecutor != unfollowerProfileOwner) &&
|
||||
!ILensHub(HUB).isDelegatedExecutorApproved(unfollowerProfileId, transactionExecutor) &&
|
||||
!_isApprovedOrOwner(unfollowerProfileOwner, followTokenId) &&
|
||||
!_isApprovedOrOwner(transactionExecutor, followTokenId)
|
||||
) {
|
||||
revert DoesNotHavePermissions();
|
||||
}
|
||||
_unfollow({unfollower: unfollowerProfileId, followTokenId: followTokenId});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,8 +137,8 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
|
||||
if (!IERC721Timestamped(HUB).exists(followerProfileId)) {
|
||||
revert Errors.TokenDoesNotExist();
|
||||
}
|
||||
address followTokenOwner = _unsafeOwnerOf(followTokenId);
|
||||
if (followTokenOwner == address(0)) {
|
||||
// `followTokenId` allowed to be zero as a way to clear the approval.
|
||||
if (followTokenId != 0 && _unsafeOwnerOf(followTokenId) == address(0)) {
|
||||
revert OnlyWrappedFollowTokens();
|
||||
}
|
||||
if (_isApprovedOrOwner(msg.sender, followTokenId)) {
|
||||
@@ -268,13 +256,9 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
|
||||
/**
|
||||
* @dev See {IERC165-supportsInterface}.
|
||||
*/
|
||||
function supportsInterface(bytes4 interfaceId)
|
||||
public
|
||||
view
|
||||
virtual
|
||||
override(LensBaseERC721, ERC2981CollectionRoyalties)
|
||||
returns (bool)
|
||||
{
|
||||
function supportsInterface(
|
||||
bytes4 interfaceId
|
||||
) public view virtual override(LensBaseERC721, ERC2981CollectionRoyalties) returns (bool) {
|
||||
return
|
||||
LensBaseERC721.supportsInterface(interfaceId) || ERC2981CollectionRoyalties.supportsInterface(interfaceId);
|
||||
}
|
||||
@@ -392,11 +376,7 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
|
||||
_baseFollow({followerProfileId: newFollowerProfileId, followTokenId: followTokenId, isOriginalFollow: false});
|
||||
}
|
||||
|
||||
function _baseFollow(
|
||||
uint256 followerProfileId,
|
||||
uint256 followTokenId,
|
||||
bool isOriginalFollow
|
||||
) internal {
|
||||
function _baseFollow(uint256 followerProfileId, uint256 followTokenId, bool isOriginalFollow) internal {
|
||||
_followTokenIdByFollowerProfileId[followerProfileId] = followTokenId;
|
||||
_followDataByFollowTokenId[followTokenId].followerProfileId = uint160(followerProfileId);
|
||||
_followDataByFollowTokenId[followTokenId].followTimestamp = uint48(block.timestamp);
|
||||
@@ -442,11 +422,7 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
|
||||
/**
|
||||
* @dev Upon transfers, we clear follow approvals and emit the transfer event in the hub.
|
||||
*/
|
||||
function _beforeTokenTransfer(
|
||||
address from,
|
||||
address to,
|
||||
uint256 followTokenId
|
||||
) internal override whenNotPaused {
|
||||
function _beforeTokenTransfer(address from, address to, uint256 followTokenId) internal override whenNotPaused {
|
||||
if (from != address(0)) {
|
||||
// It is cleared on unwrappings and transfers, and it can not be set on unwrapped tokens.
|
||||
// As a consequence, there is no need to clear it on wrappings.
|
||||
@@ -455,18 +431,14 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
|
||||
super._beforeTokenTransfer(from, to, followTokenId);
|
||||
}
|
||||
|
||||
function _getReceiver(
|
||||
uint256 /* followTokenId */
|
||||
) internal view override returns (address) {
|
||||
function _getReceiver(uint256 /* followTokenId */) internal view override returns (address) {
|
||||
if (!ILensHub(HUB).exists(_followedProfileId)) {
|
||||
return address(0);
|
||||
}
|
||||
return IERC721(HUB).ownerOf(_followedProfileId);
|
||||
}
|
||||
|
||||
function _beforeRoyaltiesSet(
|
||||
uint256 /* royaltiesInBasisPoints */
|
||||
) internal view override {
|
||||
function _beforeRoyaltiesSet(uint256 /* royaltiesInBasisPoints */) internal view override {
|
||||
if (IERC721(HUB).ownerOf(_followedProfileId) != msg.sender) {
|
||||
revert Errors.NotProfileOwner();
|
||||
}
|
||||
|
||||
@@ -54,9 +54,8 @@ interface IFollowNFT {
|
||||
* @custom:permissions LensHub.
|
||||
*
|
||||
* @param unfollowerProfileId The ID of the profile that is performing the unfollow operation.
|
||||
* @param transactionExecutor The address of the transaction executor (e.g. for any funds to transferFrom).
|
||||
*/
|
||||
function unfollow(uint256 unfollowerProfileId, address transactionExecutor) external;
|
||||
function unfollow(uint256 unfollowerProfileId) external;
|
||||
|
||||
/**
|
||||
* @notice Removes the follower from the given follow NFT.
|
||||
|
||||
@@ -72,10 +72,7 @@ library FollowLib {
|
||||
revert Errors.NotFollowing();
|
||||
}
|
||||
|
||||
IFollowNFT(followNFT).unfollow({
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
transactionExecutor: transactionExecutor
|
||||
});
|
||||
IFollowNFT(followNFT).unfollow(unfollowerProfileId);
|
||||
|
||||
emit Events.Unfollowed(unfollowerProfileId, idOfProfileToUnfollow, transactionExecutor, block.timestamp);
|
||||
|
||||
|
||||
@@ -32,16 +32,6 @@ library PublicationLib {
|
||||
_post.contentURI = postParams.contentURI;
|
||||
_post.pubType = Types.PublicationType.Post;
|
||||
|
||||
bytes[] memory actionModulesReturnDatas = _initPubActionModules(
|
||||
InitActionModuleParams(
|
||||
postParams.profileId,
|
||||
transactionExecutor,
|
||||
pubIdAssigned,
|
||||
postParams.actionModules,
|
||||
postParams.actionModulesInitDatas
|
||||
)
|
||||
);
|
||||
|
||||
bytes memory referenceModuleReturnData = _initPubReferenceModule(
|
||||
InitReferenceModuleParams(
|
||||
postParams.profileId,
|
||||
@@ -52,6 +42,16 @@ library PublicationLib {
|
||||
)
|
||||
);
|
||||
|
||||
bytes[] memory actionModulesReturnDatas = _initPubActionModules(
|
||||
InitActionModuleParams(
|
||||
postParams.profileId,
|
||||
transactionExecutor,
|
||||
pubIdAssigned,
|
||||
postParams.actionModules,
|
||||
postParams.actionModulesInitDatas
|
||||
)
|
||||
);
|
||||
|
||||
emit Events.PostCreated(
|
||||
postParams,
|
||||
pubIdAssigned,
|
||||
@@ -266,16 +266,6 @@ library PublicationLib {
|
||||
ValidationLib.validateNotBlocked({profile: referencePubParams.profileId, byProfile: rootProfileId});
|
||||
}
|
||||
|
||||
bytes[] memory actionModulesReturnDatas = _initPubActionModules(
|
||||
InitActionModuleParams(
|
||||
referencePubParams.profileId,
|
||||
transactionExecutor,
|
||||
pubIdAssigned,
|
||||
referencePubParams.actionModules,
|
||||
referencePubParams.actionModulesInitDatas
|
||||
)
|
||||
);
|
||||
|
||||
bytes memory referenceModuleReturnData = _initPubReferenceModule(
|
||||
InitReferenceModuleParams(
|
||||
referencePubParams.profileId,
|
||||
@@ -286,6 +276,16 @@ library PublicationLib {
|
||||
)
|
||||
);
|
||||
|
||||
bytes[] memory actionModulesReturnDatas = _initPubActionModules(
|
||||
InitActionModuleParams(
|
||||
referencePubParams.profileId,
|
||||
transactionExecutor,
|
||||
pubIdAssigned,
|
||||
referencePubParams.actionModules,
|
||||
referencePubParams.actionModulesInitDatas
|
||||
)
|
||||
);
|
||||
|
||||
return (pubIdAssigned, actionModulesReturnDatas, referenceModuleReturnData, referrerPubTypes);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ contract FollowerOnlyReferenceModule is HubRestricted, IReferenceModule {
|
||||
* @dev There is nothing needed at initialization.
|
||||
*/
|
||||
function initializeReferenceModule(
|
||||
uint256, /* profileId */
|
||||
uint256, /* pubId */
|
||||
address, /* transactionExecutor */
|
||||
uint256 /* profileId */,
|
||||
uint256 /* pubId */,
|
||||
address /* transactionExecutor */,
|
||||
bytes calldata /* data */
|
||||
) external pure returns (bytes memory) {
|
||||
return '';
|
||||
@@ -34,57 +34,55 @@ contract FollowerOnlyReferenceModule is HubRestricted, IReferenceModule {
|
||||
/**
|
||||
* @inheritdoc IReferenceModule
|
||||
*
|
||||
* @dev Validates that the commenting profile's owner is a follower.
|
||||
* @dev Validates that the commenting profile is the original author or a follower of it.
|
||||
*/
|
||||
function processComment(Types.ProcessCommentParams calldata processCommentParams)
|
||||
external
|
||||
view
|
||||
override
|
||||
returns (bytes memory)
|
||||
{
|
||||
FollowValidationLib.validateIsFollowing({
|
||||
hub: HUB,
|
||||
followerProfileId: processCommentParams.profileId,
|
||||
followedProfileId: processCommentParams.pointedProfileId
|
||||
});
|
||||
return '';
|
||||
function processComment(
|
||||
Types.ProcessCommentParams calldata processCommentParams
|
||||
) external view override returns (bytes memory) {
|
||||
return
|
||||
_performFollowerOnlyCheck({
|
||||
followerProfileId: processCommentParams.profileId,
|
||||
followedProfileId: processCommentParams.pointedProfileId
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc IReferenceModule
|
||||
*
|
||||
* @dev Validates that the quoting profile's owner is a follower.
|
||||
* @dev Validates that the quoting profile is the original author or a follower of it.
|
||||
*/
|
||||
function processQuote(Types.ProcessQuoteParams calldata processQuoteParams)
|
||||
external
|
||||
view
|
||||
override
|
||||
returns (bytes memory)
|
||||
{
|
||||
FollowValidationLib.validateIsFollowing({
|
||||
hub: HUB,
|
||||
followerProfileId: processQuoteParams.profileId,
|
||||
followedProfileId: processQuoteParams.pointedProfileId
|
||||
});
|
||||
return '';
|
||||
function processQuote(
|
||||
Types.ProcessQuoteParams calldata processQuoteParams
|
||||
) external view override returns (bytes memory) {
|
||||
return
|
||||
_performFollowerOnlyCheck({
|
||||
followerProfileId: processQuoteParams.profileId,
|
||||
followedProfileId: processQuoteParams.pointedProfileId
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc IReferenceModule
|
||||
*
|
||||
* @dev Validates that the mirroring profile's owner is a follower.
|
||||
* @dev Validates that the mirroring profile is the original author or a follower of it.
|
||||
*/
|
||||
function processMirror(Types.ProcessMirrorParams calldata processMirrorParams)
|
||||
external
|
||||
view
|
||||
override
|
||||
returns (bytes memory)
|
||||
{
|
||||
FollowValidationLib.validateIsFollowing({
|
||||
hub: HUB,
|
||||
followerProfileId: processMirrorParams.profileId,
|
||||
followedProfileId: processMirrorParams.pointedProfileId
|
||||
});
|
||||
function processMirror(
|
||||
Types.ProcessMirrorParams calldata processMirrorParams
|
||||
) external view override returns (bytes memory) {
|
||||
return
|
||||
_performFollowerOnlyCheck({
|
||||
followerProfileId: processMirrorParams.profileId,
|
||||
followedProfileId: processMirrorParams.pointedProfileId
|
||||
});
|
||||
}
|
||||
|
||||
function _performFollowerOnlyCheck(
|
||||
uint256 followerProfileId,
|
||||
uint256 followedProfileId
|
||||
) internal view returns (bytes memory) {
|
||||
if (followerProfileId != followedProfileId) {
|
||||
FollowValidationLib.validateIsFollowing(HUB, followerProfileId, followedProfileId);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ contract TokenGatedReferenceModule is HubRestricted, IReferenceModule {
|
||||
) internal view returns (uint256) {
|
||||
GateParams memory gateParams = _gateParams[pointedProfileId][pointedPubId];
|
||||
uint256 balance = IToken(gateParams.tokenAddress).balanceOf(IERC721(HUB).ownerOf(profileId));
|
||||
if (balance < gateParams.minThreshold) {
|
||||
if (profileId != pointedProfileId && balance < gateParams.minThreshold) {
|
||||
revert NotEnoughBalance();
|
||||
}
|
||||
return balance;
|
||||
|
||||
@@ -631,10 +631,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followerCountBefore = followNFT.getFollowerCount();
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getFollowerCount(), followerCountBefore - 1);
|
||||
|
||||
@@ -830,10 +827,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
|
||||
vm.prank(address(hub));
|
||||
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
@@ -867,10 +861,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
vm.prank(sender);
|
||||
|
||||
vm.expectRevert(Errors.NotHub.selector);
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
}
|
||||
|
||||
function testCannotUnfollowIfNotAlreadyFollowing() public {
|
||||
@@ -879,7 +870,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
vm.prank(address(hub));
|
||||
|
||||
vm.expectRevert(IFollowNFT.NotFollowing.selector);
|
||||
followNFT.unfollow({unfollowerProfileId: followerProfileId, transactionExecutor: followerProfileOwner});
|
||||
followNFT.unfollow({unfollowerProfileId: followerProfileId});
|
||||
}
|
||||
|
||||
// TODO: Move to positives, because now it's possible to unfollow even if the token is wrapped and not owned.
|
||||
@@ -899,10 +890,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
followNFT.transferFrom(alreadyFollowingProfileOwner, unrelatedAddress, followTokenId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
}
|
||||
|
||||
function testCannotRemoveFollowerOnWrappedIfNotHolder(address unrelatedAddress) public {
|
||||
@@ -935,10 +923,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
|
||||
vm.prank(address(hub));
|
||||
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.getFollowerProfileId(alreadyFollowingProfileId), 0);
|
||||
@@ -958,10 +943,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
|
||||
vm.prank(address(hub));
|
||||
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: executorAsApprovedDelegatee
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.getFollowerProfileId(alreadyFollowingProfileId), 0);
|
||||
@@ -981,7 +963,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
|
||||
vm.prank(address(hub));
|
||||
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId, transactionExecutor: followTokenOwner});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.getFollowerProfileId(alreadyFollowingProfileId), 0);
|
||||
@@ -1001,7 +983,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
|
||||
vm.prank(address(hub));
|
||||
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId, transactionExecutor: approvedForAll});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.getFollowerProfileId(alreadyFollowingProfileId), 0);
|
||||
@@ -1013,10 +995,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
|
||||
vm.prank(address(hub));
|
||||
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.getFollowerProfileId(alreadyFollowingProfileId), 0);
|
||||
@@ -1033,10 +1012,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
|
||||
vm.prank(address(hub));
|
||||
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: executorAsApprovedDelegatee
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.getFollowerProfileId(alreadyFollowingProfileId), 0);
|
||||
@@ -1101,10 +1077,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1127,10 +1100,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1200,10 +1170,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1223,10 +1190,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1298,10 +1262,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1326,10 +1287,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1401,10 +1359,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1426,10 +1381,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertEq(followNFT.getProfileIdAllowedToRecover(followTokenId), alreadyFollowingProfileId);
|
||||
|
||||
@@ -1462,10 +1414,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
followNFT.wrap(followTokenId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
vm.expectRevert(IFollowNFT.NotFollowing.selector);
|
||||
vm.prank(alreadyFollowingProfileOwner);
|
||||
@@ -1644,10 +1593,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
followNFT.wrap(followTokenId);
|
||||
|
||||
vm.prank(address(hub));
|
||||
followNFT.unfollow({
|
||||
unfollowerProfileId: alreadyFollowingProfileId,
|
||||
transactionExecutor: alreadyFollowingProfileOwner
|
||||
});
|
||||
followNFT.unfollow({unfollowerProfileId: alreadyFollowingProfileId});
|
||||
|
||||
assertFalse(followNFT.isFollowing(alreadyFollowingProfileId));
|
||||
assertEq(followNFT.ownerOf(followTokenId), alreadyFollowingProfileOwner);
|
||||
@@ -1697,6 +1643,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
}
|
||||
|
||||
function testCannotApproveFollowForUnexistentFollowToken(uint256 unexistentFollowTokenId) public {
|
||||
vm.assume(unexistentFollowTokenId != 0);
|
||||
vm.assume(!followNFT.exists(unexistentFollowTokenId));
|
||||
vm.assume(followNFT.getFollowerProfileId(unexistentFollowTokenId) == 0);
|
||||
|
||||
|
||||
@@ -144,11 +144,7 @@ contract UnfollowTest is BaseTest {
|
||||
vm.expectEmit(true, false, false, true, address(hub));
|
||||
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, testUnfollowerProfileOwner, block.timestamp);
|
||||
|
||||
vm.expectCall(
|
||||
targetFollowNFT,
|
||||
abi.encodeCall(followNFT.unfollow, (testUnfollowerProfileId, testUnfollowerProfileOwner)),
|
||||
1
|
||||
);
|
||||
vm.expectCall(targetFollowNFT, abi.encodeCall(followNFT.unfollow, (testUnfollowerProfileId)), 1);
|
||||
|
||||
_unfollow({
|
||||
pk: testUnfollowerProfileOwnerPk,
|
||||
@@ -175,11 +171,7 @@ contract UnfollowTest is BaseTest {
|
||||
vm.expectEmit(true, false, false, true, address(hub));
|
||||
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, approvedDelegatedExecutor, block.timestamp);
|
||||
|
||||
vm.expectCall(
|
||||
targetFollowNFT,
|
||||
abi.encodeCall(followNFT.unfollow, (testUnfollowerProfileId, approvedDelegatedExecutor)),
|
||||
1
|
||||
);
|
||||
vm.expectCall(targetFollowNFT, abi.encodeCall(followNFT.unfollow, (testUnfollowerProfileId)), 1);
|
||||
|
||||
_unfollow({
|
||||
pk: approvedDelegatedExecutorPk,
|
||||
|
||||
@@ -192,6 +192,7 @@ contract TokenGatedReferenceModule_ERC20_Gated is TokenGatedReferenceModuleBase
|
||||
) public {
|
||||
assertEq(currency.balanceOf(address(defaultAccount.owner)), 0);
|
||||
|
||||
vm.assume(publisherProfileId != profileId);
|
||||
_initialize(publisherProfileId, publisherPubId, minThreshold);
|
||||
|
||||
vm.expectRevert(TokenGatedReferenceModule.NotEnoughBalance.selector);
|
||||
@@ -218,6 +219,7 @@ contract TokenGatedReferenceModule_ERC20_Gated is TokenGatedReferenceModuleBase
|
||||
) public {
|
||||
assertEq(currency.balanceOf(address(defaultAccount.owner)), 0);
|
||||
|
||||
vm.assume(publisherProfileId != profileId);
|
||||
_initialize(publisherProfileId, publisherPubId, minThreshold);
|
||||
|
||||
vm.expectRevert(TokenGatedReferenceModule.NotEnoughBalance.selector);
|
||||
@@ -243,6 +245,7 @@ contract TokenGatedReferenceModule_ERC20_Gated is TokenGatedReferenceModuleBase
|
||||
) public {
|
||||
assertEq(currency.balanceOf(address(defaultAccount.owner)), 0);
|
||||
|
||||
vm.assume(publisherProfileId != profileId);
|
||||
_initialize(publisherProfileId, publisherPubId, minThreshold);
|
||||
|
||||
vm.expectRevert(TokenGatedReferenceModule.NotEnoughBalance.selector);
|
||||
@@ -360,6 +363,7 @@ contract TokenGatedReferenceModule_ERC721_Gated is TokenGatedReferenceModuleBase
|
||||
function testCannotProcessComment_IfNotEnoughBalance(uint256 publisherProfileId, uint256 publisherPubId) public {
|
||||
assertEq(nft.balanceOf(address(defaultAccount.owner)), 0);
|
||||
|
||||
vm.assume(publisherProfileId != profileId);
|
||||
_initialize(publisherProfileId, publisherPubId);
|
||||
|
||||
vm.expectRevert(TokenGatedReferenceModule.NotEnoughBalance.selector);
|
||||
@@ -381,6 +385,7 @@ contract TokenGatedReferenceModule_ERC721_Gated is TokenGatedReferenceModuleBase
|
||||
function testCannotProcessMirror_IfNotEnoughBalance(uint256 publisherProfileId, uint256 publisherPubId) public {
|
||||
assertEq(nft.balanceOf(address(defaultAccount.owner)), 0);
|
||||
|
||||
vm.assume(publisherProfileId != profileId);
|
||||
_initialize(publisherProfileId, publisherPubId);
|
||||
|
||||
vm.expectRevert(TokenGatedReferenceModule.NotEnoughBalance.selector);
|
||||
@@ -402,6 +407,7 @@ contract TokenGatedReferenceModule_ERC721_Gated is TokenGatedReferenceModuleBase
|
||||
function testCannotProcessQuote_IfNotEnoughBalance(uint256 publisherProfileId, uint256 publisherPubId) public {
|
||||
assertEq(nft.balanceOf(address(defaultAccount.owner)), 0);
|
||||
|
||||
vm.assume(publisherProfileId != profileId);
|
||||
_initialize(publisherProfileId, publisherPubId);
|
||||
|
||||
vm.expectRevert(TokenGatedReferenceModule.NotEnoughBalance.selector);
|
||||
|
||||
Reference in New Issue
Block a user