LitAccessControl

Git Source

Author: Lens Protocol

This contract enables additional access control for encrypted publications on Lens by reporting whether an address owns or has control over a given profile.

State Variables

LENS_HUB

address internal immutable LENS_HUB;

COLLECT_PUB_ACTION

address internal immutable COLLECT_PUB_ACTION;

Functions

constructor

constructor(address lensHub, address collectPubAction);

hasAccess

Function used to check whether an address is the Owner or Delegated Executor of a profile.

function hasAccess(address requestorAddress, uint256 profileId, bytes memory) external view returns (bool);

Parameters

NameTypeDescription
requestorAddressaddressThe address to check ownership over a profile.
profileIduint256The ID of the profile being checked for ownership. param data Optional data parameter, which may be used in future upgrades.
<none>bytes

Returns

NameTypeDescription
<none>boolBoolean indicating whether address owns the profile or not.

isFollowing

Function used to check whether followerProfileId is following profileId and requestor is Owner/Delegated Executor of followerProfileId.

function isFollowing(address requestorAddress, uint256 profileId, uint256 followerProfileId, bytes memory)
    external
    view
    returns (bool);

Parameters

NameTypeDescription
requestorAddressaddressThe address to check ownership over a profile.
profileIduint256The ID of the profile being followed.
followerProfileIduint256The ID of the following profile. param data Optional data parameter, which may be used in future upgrades.
<none>bytes

hasCollected

Function used to check whether an address owns or has collected the publication.

function hasCollected(
    address requestorAddress,
    uint256 publisherId,
    uint256 pubId,
    uint256 collectorProfileId,
    bytes memory
) external view returns (bool);

Parameters

NameTypeDescription
requestorAddressaddressThe address to check if it owns the collect NFT of the publication.
publisherIduint256ID of the profile who is the publisher of the publication.
pubIduint256ID of the publication.
collectorProfileIduint256ID of the collector profile (optional, will check if the profile owner owns the NFT) param data Optional data parameter, which may be used in future upgrades.
<none>bytes

Returns

NameTypeDescription
<none>boolBoolean indicating whether address owns the collect NFT of the publication or not.

_isOwnerOrDelegatedExecutor

Internal function used to check whether an address is the Owner or DelegatedExecutor of a profile.

function _isOwnerOrDelegatedExecutor(address requestorAddress, uint256 profileId) internal view returns (bool);

Parameters

NameTypeDescription
requestorAddressaddressThe address to check ownership over a profile.
profileIduint256The ID of the profile being checked for ownership.

Returns

NameTypeDescription
<none>boolBoolean indicating whether address owns the profile or is DelegatedExecutor of it.