IFollowModule

Git Source

Author: Lens Protocol

This is the standard interface for all Lens-compatible Follow Modules. These are responsible for processing the follow actions and can be used to implement any kind of follow logic. For example:

  • Token-gated follows (e.g. a user must hold a certain amount of a token to follow a profile).
  • Paid follows (e.g. a user must pay a certain amount of a token to follow a profile).
  • Rewarding users for following a profile.
  • Etc.

Functions

initializeFollowModule

Initializes a follow module for a given Lens profile.

function initializeFollowModule(uint256 profileId, address transactionExecutor, bytes calldata data)
    external
    returns (bytes memory);

Parameters

NameTypeDescription
profileIduint256The Profile ID to initialize this follow module for.
transactionExecutoraddressThe address of the transaction executor (e.g. for any funds to transferFrom).
databytesArbitrary data passed from the user to be decoded by the Follow Module during initialization.

Returns

NameTypeDescription
<none>bytesbytes The encoded data to be emitted from the hub.

processFollow

Processes a given follow.

function processFollow(
    uint256 followerProfileId,
    uint256 followTokenId,
    address transactionExecutor,
    uint256 targetProfileId,
    bytes calldata data
) external returns (bytes memory);

Parameters

NameTypeDescription
followerProfileIduint256The Profile ID of the follower's profile.
followTokenIduint256The Follow Token ID that is being used to follow. Zero if we are processing a new fresh follow, in this case, the follow ID assigned can be queried from the Follow NFT collection if needed.
transactionExecutoraddressThe address of the transaction executor (e.g. for any funds to transferFrom).
targetProfileIduint256The token ID of the profile being followed.
databytesArbitrary data passed by the follower.

Returns

NameTypeDescription
<none>bytesbytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by indexers or UIs.