FeeFollowModule

Git Source

Inherits: FeeModuleBase, HubRestricted, IFollowModule

Author: Lens Protocol

This follow module charges a fee for every follow.

State Variables

_feeConfig

mapping(uint256 profileId => FeeConfig config) internal _feeConfig;

Functions

constructor

constructor(address hub) FeeModuleBase(hub) HubRestricted(hub);

initializeFollowModule

Initializes a follow module for a given Lens profile.

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

Parameters

NameTypeDescription
profileIduint256The Profile ID to initialize this follow module for.
<none>address
databytesThe arbitrary data parameter, decoded into: - address currency: The currency address, must be internally whitelisted. - uint256 amount: The currency total amount to charge. - address recipient: The custom recipient address to direct earnings to.

Returns

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

processFollow

Processes a follow by charging a fee.

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

Parameters

NameTypeDescription
<none>uint256
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.

getFeeConfig

Returns fee configuration for a given profile.

function getFeeConfig(uint256 profileId) external view returns (FeeConfig memory);

Parameters

NameTypeDescription
profileIduint256The token ID of the profile to query.

Returns

NameTypeDescription
<none>FeeConfigFeeConfig The FeeConfig struct mapped to that profile.