MultirecipientFeeCollectModule

Git Source

Inherits: BaseFeeCollectModule

Author: Lens Protocol

This is a simple Lens CollectModule implementation, allowing customization of time to collect, number of collects, splitting collect fee across multiple recipients, and whether only followers can collect. It is charging a fee for collect and distributing it among (one or up to five) Receivers, Referral, Treasury.

State Variables

_recipientsByPublicationByProfile

mapping(uint256 => mapping(uint256 => RecipientData[])) internal _recipientsByPublicationByProfile;

Functions

constructor

constructor(address hub, address actionModule) BaseFeeCollectModule(hub, actionModule);

initializePublicationCollectModule

Initializes data for a given publication being published.

function initializePublicationCollectModule(uint256 profileId, uint256 pubId, address, bytes calldata data)
    external
    override
    onlyActionModule
    returns (bytes memory);

Parameters

NameTypeDescription
profileIduint256The token ID of the profile publishing the publication.
pubIduint256The associated publication's LensHub publication ID.
<none>address
databytesArbitrary data passed from the user! to be decoded.

Returns

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

_validateAndStoreRecipients

Validates the recipients array and stores them to (a separate from Base) storage.

function _validateAndStoreRecipients(RecipientData[] memory recipients, uint256 profileId, uint256 pubId) internal;

Parameters

NameTypeDescription
recipientsRecipientData[]An array of recipients
profileIduint256The profile ID who is publishing the publication.
pubIduint256The associated publication's LensHub publication ID.

_transferToRecipients

Transfers the fee to multiple recipients.

function _transferToRecipients(
    Types.ProcessCollectParams calldata processCollectParams,
    address currency,
    uint256 amount
) internal override;

Parameters

NameTypeDescription
processCollectParamsTypes.ProcessCollectParamsParameters of the collect
currencyaddressCurrency of the transaction
amountuint256Amount to transfer to recipient(-s)

getPublicationData

Returns the publication data for a given publication, or an empty struct if that publication was not initialized with this module.

function getPublicationData(uint256 profileId, uint256 pubId)
    external
    view
    returns (MultirecipientFeeCollectProfilePublicationData memory);

Parameters

NameTypeDescription
profileIduint256The token ID of the profile mapped to the publication to query.
pubIduint256The publication ID of the publication to query.

Returns

NameTypeDescription
<none>MultirecipientFeeCollectProfilePublicationDataThe BaseProfilePublicationData struct mapped to that publication.