Reputation:1

`collectModuleInitData` in lens protocol

In [Lens](https://www.lens.dev/garden) if I want to create a publication, I need the following inputs: ```javascript uint256 profileId; string contentURI; address collectModule; bytes collectModuleInitData; address referenceModule; bytes referenceModuleInitData; ``` - profileId: Your profile ID. - You can find this by calling `getProfileByHandle` on the main contract. For example `patrickalphac.lens` returns `34460` - contentURI: This will be your content URI, like what you see for an NFT. [For example](ipfs://QmSoEgRJX3o4t8MzBYKyGa3v1WwgqyPswU14FDPoDjn85u). - collectModule: The address of the collection contract you want. I want my stuff to be free to collect, so I'll use `0x23b9467334bEb345aAa6fd1545538F3d54436e96`. - collectModuleInitData: ?? - referenceModule: The module (contract) that governs who can reference your content. For example `0x0000000000000000000000000000000000000000`. (Meaning anyone can reference) - referenceModuleInitData: ?? How do we know what data we would need to pass? What function is going to be called on the `collectModule`? There are some functions in the collect module contract: ```javascript /** * @dev There is nothing needed at initialization. */ function initializePublicationCollectModule( uint256 profileId, uint256 pubId, bytes calldata data ) external override onlyHub returns (bytes memory) { bool followerOnly = abi.decode(data, (bool)); if (followerOnly) _followerOnlyByPublicationByProfile[profileId][pubId] = true; return data; } /** * @dev Processes a collect by: * 1. Ensuring the collector is a follower, if needed */ function processCollect( uint256 referrerProfileId, address collector, uint256 profileId, uint256 pubId, bytes calldata data ) external view override { if (_followerOnlyByPublicationByProfile[profileId][pubId]) _checkFollowValidity(profileId, collector); } ``` Am I having the data be for one of these function?

    Answers 2

    Each module will have their own requirements on what data you need to pass. For each function like: ```javascript function initializePublicationCollectModule( uint256 profileId, uint256 pubId, bytes calldata data ) ``` The `data` field is where your data will go. For the default free collect module, you need to pass a true value (0x00...1) for it to work.

      Reputation:0

      As far as I can tell, it is for *initializePublicationCollectModule* function call. Posts are created with [post](https://github.com/lens-protocol/core/blob/2c843f827d9614bf633e989facd877301d97ce8b/contracts/core/LensHub.sol#L354) function of *LensHub* contract. This function calls into *PublishingLogic* contract's function [createPost](https://github.com/lens-protocol/core/blob/2c843f827d9614bf633e989facd877301d97ce8b/contracts/libraries/PublishingLogic.sol#L126). From there it calls [_initPubCollectModule](https://github.com/lens-protocol/core/blob/2c843f827d9614bf633e989facd877301d97ce8b/contracts/libraries/PublishingLogic.sol#L302) where you can see the call to *initializePublicationCollectModule*.