feat: isFollowing removed from follow module

This commit is contained in:
donosonaumczuk
2022-11-25 14:19:12 +00:00
parent fc5061ec55
commit f0d91b7630
2 changed files with 2 additions and 32 deletions

View File

@@ -2,7 +2,7 @@
pragma solidity 0.8.15;
import {IFollowModule} from '../../interfaces/IFollowModule.sol';
import {IFollowModuleLegacy} from '../../interfaces/IFollowModuleLegacy.sol';
import {ILensHub} from '../../interfaces/ILensHub.sol';
import {Errors} from '../../libraries/Errors.sol';
import {Events} from '../../libraries/Events.sol';
@@ -33,7 +33,7 @@ abstract contract FollowValidationModuleBase is ModuleBase {
address followModule = ILensHub(HUB).getFollowModule(profileId);
bool isFollowing;
if (followModule != address(0)) {
isFollowing = IFollowModule(followModule).isFollowing(0, profileId, user, 0);
isFollowing = IFollowModuleLegacy(followModule).isFollowing(0, profileId, user, 0);
} else {
address followNFT = ILensHub(HUB).getFollowNFT(profileId);
isFollowing = followNFT != address(0) && IERC721(followNFT).balanceOf(user) != 0;

View File

@@ -41,34 +41,4 @@ interface IFollowModule {
uint256 profileId,
bytes calldata data
) external;
/**
* @notice This is a helper function that could be used in conjunction with specific collect modules.
*
* NOTE: This function IS meant to replace a check on follower NFT ownership.
*
* NOTE: It is assumed that not all collect modules are aware of the token ID to pass. In these cases,
* this should receive a `followNFTTokenId` of 0, which is impossible regardless.
*
* One example of a use case for this would be a subscription-based following system:
* 1. The collect module:
* - Decodes a follower NFT token ID from user-passed data.
* - Fetches the follow module from the hub.
* - Calls `isFollowing` passing the profile ID, follower & follower token ID and checks it returned true.
* 2. The follow module:
* - Validates the subscription status for that given NFT, reverting on an invalid subscription.
*
* @param followerProfileId The LensHub profile token ID of the follower's profile (currently unused, preemptive interface upgrade).
* @param profileId The token ID of the profile to validate the follow for.
* @param follower The follower address to validate the follow for.
* @param followNFTTokenId The followNFT token ID to validate the follow for.
*
* @return true if the given address is following the given profile ID, false otherwise.
*/
function isFollowing(
uint256 followerProfileId,
uint256 profileId,
address follower,
uint256 followNFTTokenId
) external view returns (bool);
}