ILensProtocol

Git Source

Author: Lens Protocol

This is the interface for Lens Protocol's core functions. It contains all the entry points for performing social operations.

Functions

createProfile

Creates a profile with the specified parameters, minting a Profile NFT to the given recipient.

function createProfile(Types.CreateProfileParams calldata createProfileParams) external returns (uint256);

Parameters

NameTypeDescription
createProfileParamsTypes.CreateProfileParamsA CreateProfileParams struct containing the needed params.

setProfileMetadataURI

Sets the metadata URI for the given profile.

function setProfileMetadataURI(uint256 profileId, string calldata metadataURI) external;

Parameters

NameTypeDescription
profileIduint256The token ID of the profile to set the metadata URI for.
metadataURIstringThe metadata URI to set for the given profile.

setProfileMetadataURIWithSig

function setProfileMetadataURIWithSig(
    uint256 profileId,
    string calldata metadataURI,
    Types.EIP712Signature calldata signature
) external;

setFollowModule

Sets the follow module for the given profile.

function setFollowModule(uint256 profileId, address followModule, bytes calldata followModuleInitData) external;

Parameters

NameTypeDescription
profileIduint256The token ID of the profile to set the follow module for.
followModuleaddressThe follow module to set for the given profile, must be whitelisted.
followModuleInitDatabytesThe data to be passed to the follow module for initialization.

setFollowModuleWithSig

function setFollowModuleWithSig(
    uint256 profileId,
    address followModule,
    bytes calldata followModuleInitData,
    Types.EIP712Signature calldata signature
) external;

changeDelegatedExecutorsConfig

Changes the delegated executors configuration for the given profile. It allows setting the approvals for delegated executors in the specified configuration, as well as switching to it.

function changeDelegatedExecutorsConfig(
    uint256 delegatorProfileId,
    address[] calldata delegatedExecutors,
    bool[] calldata approvals,
    uint64 configNumber,
    bool switchToGivenConfig
) external;

Parameters

NameTypeDescription
delegatorProfileIduint256The ID of the profile to which the delegated executor is being changed for.
delegatedExecutorsaddress[]The array of delegated executors to set the approval for.
approvalsbool[]The array of booleans indicating the corresponding executor's new approval status.
configNumberuint64The number of the configuration where the executor approval state is being set.
switchToGivenConfigboolA boolean indicating if the configuration must be switched to the one with the given number.

changeDelegatedExecutorsConfig

Changes the delegated executors configuration for the given profile under the current configuration.

function changeDelegatedExecutorsConfig(
    uint256 delegatorProfileId,
    address[] calldata delegatedExecutors,
    bool[] calldata approvals
) external;

Parameters

NameTypeDescription
delegatorProfileIduint256The ID of the profile to which the delegated executor is being changed for.
delegatedExecutorsaddress[]The array of delegated executors to set the approval for.
approvalsbool[]The array of booleans indicating the corresponding executor's new approval status.

changeDelegatedExecutorsConfigWithSig

function changeDelegatedExecutorsConfigWithSig(
    uint256 delegatorProfileId,
    address[] calldata delegatedExecutors,
    bool[] calldata approvals,
    uint64 configNumber,
    bool switchToGivenConfig,
    Types.EIP712Signature calldata signature
) external;

post

Publishes a post. Post is the most basic publication type, and can be used to publish any kind of content. Posts can have these types of modules initialized:

  • Action modules: any number of publication actions (e.g. collect, tip, etc.)
  • Reference module: a module handling the rules when referencing this post (e.g. token-gated comments)
function post(Types.PostParams calldata postParams) external returns (uint256);

Parameters

NameTypeDescription
postParamsTypes.PostParamsA PostParams struct containing the needed parameters.

Returns

NameTypeDescription
<none>uint256uint256 An integer representing the post's publication ID.

postWithSig

function postWithSig(Types.PostParams calldata postParams, Types.EIP712Signature calldata signature)
    external
    returns (uint256);

comment

Publishes a comment on the given publication. Comment is a type of reference publication that points to another publication. Comments can have these types of modules initialized:

  • Action modules: any number of publication actions (e.g. collect, tip, etc.)
  • Reference module: a module handling the rules when referencing this comment (e.g. token-gated mirrors) Comments can have referrers (e.g. publications or profiles that allowed to discover the pointed publication).
function comment(Types.CommentParams calldata commentParams) external returns (uint256);

Parameters

NameTypeDescription
commentParamsTypes.CommentParamsA CommentParams struct containing the needed parameters.

Returns

NameTypeDescription
<none>uint256uint256 An integer representing the comment's publication ID.

commentWithSig

function commentWithSig(Types.CommentParams calldata commentParams, Types.EIP712Signature calldata signature)
    external
    returns (uint256);

mirror

Publishes a mirror of the given publication. Mirror is a type of reference publication that points to another publication but doesn't have content. Mirrors don't have any modules initialized. Mirrors can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). You cannot mirror a mirror, comment on a mirror, or quote a mirror.

function mirror(Types.MirrorParams calldata mirrorParams) external returns (uint256);

Parameters

NameTypeDescription
mirrorParamsTypes.MirrorParamsA MirrorParams struct containing the necessary parameters.

Returns

NameTypeDescription
<none>uint256uint256 An integer representing the mirror's publication ID.

mirrorWithSig

function mirrorWithSig(Types.MirrorParams calldata mirrorParams, Types.EIP712Signature calldata signature)
    external
    returns (uint256);

quote

Publishes a quote of the given publication. Quote is a type of reference publication similar to mirror, but it has content and modules. Quotes can have these types of modules initialized:

  • Action modules: any number of publication actions (e.g. collect, tip, etc.)
  • Reference module: a module handling the rules when referencing this quote (e.g. token-gated comments on quote) Quotes can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). Unlike mirrors, you can mirror a quote, comment on a quote, or quote a quote.
function quote(Types.QuoteParams calldata quoteParams) external returns (uint256);

Parameters

NameTypeDescription
quoteParamsTypes.QuoteParamsA QuoteParams struct containing the needed parameters.

Returns

NameTypeDescription
<none>uint256uint256 An integer representing the quote's publication ID.

quoteWithSig

function quoteWithSig(Types.QuoteParams calldata quoteParams, Types.EIP712Signature calldata signature)
    external
    returns (uint256);

follow

Follows given profiles, executing each profile's follow module logic (if any).

Both the idsOfProfilesToFollow, followTokenIds, and datas arrays must be of the same length, regardless if the profiles do not have a follow module set.

function follow(
    uint256 followerProfileId,
    uint256[] calldata idsOfProfilesToFollow,
    uint256[] calldata followTokenIds,
    bytes[] calldata datas
) external returns (uint256[] memory);

Parameters

NameTypeDescription
followerProfileIduint256The ID of the profile the follows are being executed for.
idsOfProfilesToFollowuint256[]The array of IDs of profiles to follow.
followTokenIdsuint256[]The array of follow token IDs to use for each follow (0 if you don't own a follow token).
datasbytes[]The arbitrary data array to pass to the follow module for each profile if needed.

Returns

NameTypeDescription
<none>uint256[]uint256[] An array of follow token IDs representing the follow tokens created for each follow.

followWithSig

function followWithSig(
    uint256 followerProfileId,
    uint256[] calldata idsOfProfilesToFollow,
    uint256[] calldata followTokenIds,
    bytes[] calldata datas,
    Types.EIP712Signature calldata signature
) external returns (uint256[] memory);

unfollow

Unfollows given profiles.

function unfollow(uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow) external;

Parameters

NameTypeDescription
unfollowerProfileIduint256The ID of the profile the unfollows are being executed for.
idsOfProfilesToUnfollowuint256[]The array of IDs of profiles to unfollow.

unfollowWithSig

function unfollowWithSig(
    uint256 unfollowerProfileId,
    uint256[] calldata idsOfProfilesToUnfollow,
    Types.EIP712Signature calldata signature
) external;

setBlockStatus

Sets the block status for the given profiles. Changing a profile's block status to true (i.e. blocked), when will also force them to unfollow. Blocked profiles cannot perform any actions with the profile that blocked them: they cannot comment or mirror their publications, they cannot follow them, they cannot collect, tip them, etc.

Both the idsOfProfilesToSetBlockStatus and blockStatus arrays must be of the same length.

function setBlockStatus(
    uint256 byProfileId,
    uint256[] calldata idsOfProfilesToSetBlockStatus,
    bool[] calldata blockStatus
) external;

Parameters

NameTypeDescription
byProfileIduint256The ID of the profile that is blocking/unblocking somebody.
idsOfProfilesToSetBlockStatusuint256[]The array of IDs of profiles to set block status.
blockStatusbool[]The array of block statuses to use for each (true is blocked).

setBlockStatusWithSig

function setBlockStatusWithSig(
    uint256 byProfileId,
    uint256[] calldata idsOfProfilesToSetBlockStatus,
    bool[] calldata blockStatus,
    Types.EIP712Signature calldata signature
) external;

collectLegacy

Collects a given publication via signature with the specified parameters. Collect can have referrers (e.g. publications or profiles that allowed to discover the pointed publication).

function collectLegacy(Types.LegacyCollectParams calldata collectParams) external returns (uint256);

Parameters

NameTypeDescription
collectParamsTypes.LegacyCollectParamsA CollectParams struct containing the parameters.

Returns

NameTypeDescription
<none>uint256uint256 An integer representing the minted token ID.

collectLegacyWithSig

function collectLegacyWithSig(
    Types.LegacyCollectParams calldata collectParams,
    Types.EIP712Signature calldata signature
) external returns (uint256);

act

Acts on a given publication with the specified parameters. You can act on a publication except a mirror (if it has at least one action module initialized). Actions can have referrers (e.g. publications or profiles that allowed to discover the pointed publication).

function act(Types.PublicationActionParams calldata publicationActionParams) external returns (bytes memory);

Parameters

NameTypeDescription
publicationActionParamsTypes.PublicationActionParamsA PublicationActionParams struct containing the parameters.

Returns

NameTypeDescription
<none>bytesbytes Arbitrary data the action module returns.

actWithSig

function actWithSig(
    Types.PublicationActionParams calldata publicationActionParams,
    Types.EIP712Signature calldata signature
) external returns (bytes memory);

isFollowing

VIEW FUNCTIONS ///

Returns whether or not followerProfileId is following followedProfileId.

function isFollowing(uint256 followerProfileId, uint256 followedProfileId) external view returns (bool);

Parameters

NameTypeDescription
followerProfileIduint256The ID of the profile whose following state should be queried.
followedProfileIduint256The ID of the profile whose followed state should be queried.

Returns

NameTypeDescription
<none>boolbool True if followerProfileId is following followedProfileId, false otherwise.

isDelegatedExecutorApproved

Returns whether the given address is approved as delegated executor, in the configuration with the given number, to act on behalf of the given profile.

function isDelegatedExecutorApproved(uint256 delegatorProfileId, address delegatedExecutor, uint64 configNumber)
    external
    view
    returns (bool);

Parameters

NameTypeDescription
delegatorProfileIduint256The ID of the profile to check the delegated executor approval for.
delegatedExecutoraddressThe address to query the delegated executor approval for.
configNumberuint64The number of the configuration where the executor approval state is being queried.

Returns

NameTypeDescription
<none>boolbool True if the address is approved as a delegated executor to act on behalf of the profile in the given configuration, false otherwise.

isDelegatedExecutorApproved

Returns whether the given address is approved as delegated executor, in the current configuration, to act on behalf of the given profile.

function isDelegatedExecutorApproved(uint256 delegatorProfileId, address delegatedExecutor)
    external
    view
    returns (bool);

Parameters

NameTypeDescription
delegatorProfileIduint256The ID of the profile to check the delegated executor approval for.
delegatedExecutoraddressThe address to query the delegated executor approval for.

Returns

NameTypeDescription
<none>boolbool True if the address is approved as a delegated executor to act on behalf of the profile in the current configuration, false otherwise.

getDelegatedExecutorsConfigNumber

Returns the current delegated executor config number for the given profile.

function getDelegatedExecutorsConfigNumber(uint256 delegatorProfileId) external view returns (uint64);

Parameters

NameTypeDescription
delegatorProfileIduint256The ID of the profile from which the delegated executors config number is being queried

Returns

NameTypeDescription
<none>uint64uint256 The current delegated executor configuration number.

getDelegatedExecutorsPrevConfigNumber

Returns the previous used delegated executor config number for the given profile.

function getDelegatedExecutorsPrevConfigNumber(uint256 delegatorProfileId) external view returns (uint64);

Parameters

NameTypeDescription
delegatorProfileIduint256The ID of the profile from which the delegated executors' previous configuration number set is being queried.

Returns

NameTypeDescription
<none>uint64uint256 The delegated executor configuration number previously set. It will coincide with the current configuration set if it was never switched from the default one.

getDelegatedExecutorsMaxConfigNumberSet

Returns the maximum delegated executor config number for the given profile. This is the maximum config number that was ever used by this profile. When creating a new clean configuration, you can only use a number that is maxConfigNumber + 1.

function getDelegatedExecutorsMaxConfigNumberSet(uint256 delegatorProfileId) external view returns (uint64);

Parameters

NameTypeDescription
delegatorProfileIduint256The ID of the profile from which the delegated executors' maximum configuration number set is being queried.

Returns

NameTypeDescription
<none>uint64uint256 The delegated executor maximum configuration number set.

isBlocked

Returns whether profileId is blocked by byProfileId. See setBlockStatus() for more information on how blocking works on the platform.

function isBlocked(uint256 profileId, uint256 byProfileId) external view returns (bool);

Parameters

NameTypeDescription
profileIduint256The ID of the profile whose blocked status should be queried.
byProfileIduint256The ID of the profile whose blocker status should be queried.

Returns

NameTypeDescription
<none>boolbool True if profileId is blocked by byProfileId, false otherwise.

getContentURI

Returns the URI associated with a given publication. This is used to store the publication's metadata, e.g.: content, images, etc.

function getContentURI(uint256 profileId, uint256 pubId) external view returns (string memory);

Parameters

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

Returns

NameTypeDescription
<none>stringstring The URI associated with a given publication.

getProfile

Returns the full profile struct associated with a given profile token ID.

function getProfile(uint256 profileId) external view returns (Types.Profile memory);

Parameters

NameTypeDescription
profileIduint256The token ID of the profile to query.

Returns

NameTypeDescription
<none>Types.ProfileProfile The profile struct of the given profile.

getPublication

Returns the full publication struct for a given publication.

function getPublication(uint256 profileId, uint256 pubId) external view returns (Types.PublicationMemory memory);

Parameters

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

Returns

NameTypeDescription
<none>Types.PublicationMemoryPublication The publication struct associated with the queried publication.

getPublicationType

Returns the type of a given publication. The type can be one of the following (see PublicationType enum):

  • Nonexistent
  • Post
  • Comment
  • Mirror
  • Quote
function getPublicationType(uint256 profileId, uint256 pubId) external view returns (Types.PublicationType);

Parameters

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

Returns

NameTypeDescription
<none>Types.PublicationTypePublicationType The publication type of the queried publication.

isActionModuleEnabledInPublication

Returns wether a given Action Module is enabled for a given publication.

function isActionModuleEnabledInPublication(uint256 profileId, uint256 pubId, address module)
    external
    view
    returns (bool);

Parameters

NameTypeDescription
profileIduint256The token ID of the profile that published the publication to query.
pubIduint256The publication ID of the publication to query.
moduleaddressThe address of the Action Module to query.

Returns

NameTypeDescription
<none>boolbool True if the Action Module is enabled for the queried publication, false if not.