CollectNFT

Git Source

Inherits: LensBaseERC721, ERC2981CollectionRoyalties, ActionRestricted, ICollectNFT

Author: Lens Protocol

This is the NFT contract that is minted upon collecting a given publication. It is cloned upon the first collect for a given publication, and the token URI points to the original publication's contentURI.

This is the CollectNFT for Lens V2, it differs from LegacyCollectNFT that it's restricted to be called by an action module instead of LensHub.

State Variables

HUB

address public immutable HUB;

_profileId

uint256 internal _profileId;

_pubId

uint256 internal _pubId;

_tokenIdCounter

uint256 internal _tokenIdCounter;

_initialized

bool private _initialized;

_royaltiesInBasisPoints

uint256 internal _royaltiesInBasisPoints;

Functions

constructor

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

initialize

Initializes the collect NFT, setting the feed as the privileged minter, storing the collected publication pointer and initializing the name and symbol in the LensNFTBase contract.

function initialize(uint256 profileId, uint256 pubId) external override;

Parameters

NameTypeDescription
profileIduint256The token ID of the profile in the hub that this Collect NFT points to.
pubIduint256The profile publication ID in the hub that this Collect NFT points to.

mint

Mints a collect NFT to the specified address. This can only be called by the hub and is called upon collection.

function mint(address to) external override onlyActionModule returns (uint256);

Parameters

NameTypeDescription
toaddressThe address to mint the NFT to.

Returns

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

getSourcePublicationPointer

Returns the source publication of this collect NFT.

function getSourcePublicationPointer() external view override returns (uint256, uint256);

Returns

NameTypeDescription
<none>uint256tuple First is the profile ID, and second is the publication ID.
<none>uint256

tokenURI

function tokenURI(uint256 tokenId) public view override returns (string memory);

name

See {IERC721Metadata-name}.

function name() public view override returns (string memory);

symbol

See {IERC721Metadata-symbol}.

function symbol() public pure override returns (string memory);

supportsInterface

See {IERC165-supportsInterface}.

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC2981CollectionRoyalties, LensBaseERC721)
    returns (bool);

_getReceiver

function _getReceiver(uint256) internal view override returns (address);

_beforeRoyaltiesSet

function _beforeRoyaltiesSet(uint256) internal view override;

_getRoyaltiesInBasisPointsSlot

function _getRoyaltiesInBasisPointsSlot() internal pure override returns (uint256);