relevant tag icon
Lens Publication NFT
copy icon
lens-protocol
• version 1.0.0
Social
Protocol
NFT
ERC721
Audited

Lens Publication NFT

Audited

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.

*Visit desktop site to download or deploy

Version

1.0.0

Last Publish

11/6/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
initialize(uint256,uint256,string,string) :
This function is used to initialize the CollectNFT contract. It sets the _royaltyBasisPoints to 1000, sets the _profileId and _pubId to the values passed in as parameters, and calls the _initialize function from the parent contract to set the name and symbol. Finally, it emits an event to indicate that the contract has been initialized. (autogenerated documentation)
mint(address) :
This function mints a new token and assigns it to the address specified in the 'to' parameter. It does this by incrementing the _tokenIdCounter variable, and then calling the _mint() function with the address and tokenId as parameters. (autogenerated documentation)
getSourcePublicationPointer() :
This function is an override of the getSourcePublicationPointer() function in the Ethereum blockchain. It returns a tuple containing two uint256 values, which represent the profile ID and the publication ID of the source publication. This allows users to access the source publication associated with a particular profile. (autogenerated documentation)
tokenURI(uint256) :
This function is used to retrieve the URI of a token with a given tokenId. It first checks if the token exists by calling the _exists() function. If the token does exist, it then calls the getContentURI() function from the ILensHub contract, passing in the _profileId and _pubId as parameters. This function returns the URI of the token as a string. (autogenerated documentation)
setRoyalty(uint256) :
This function allows the owner of a profile to set the royalty basis points for their profile. The function takes in a uint256 value as an argument, which represents the royalty basis points. If the msg.sender is the owner of the profile, the function will check if the royalty basis points are greater than the maximum allowed basis points. If not, the function will set the royalty basis points to the value passed in as an argument. If the msg.sender is not the owner of the profile, the function will revert with an error. (autogenerated documentation)
royaltyInfo(uint256,uint256) :
This function returns the address of the owner of a given tokenId and the amount of royalty that is due to the owner based on the sale price of the token. The royalty is calculated by multiplying the sale price by the royalty basis points (which is a percentage) and then dividing by the total number of basis points (100). (autogenerated documentation)
supportsInterface(bytes4) :
This function is used to determine whether a given contract supports a specific interface. It takes in a bytes4 interfaceId as an argument and returns a boolean value indicating whether the contract supports the interface. The function first checks if the interfaceId matches the INTERFACE_ID_ERC2981, and if it does, it returns true. If not, it calls the super.supportsInterface() function to check if the contract supports the interface. If it does, it returns true, otherwise it returns false. (autogenerated documentation)
_beforeTokenTransfer(address,address,uint256) :
This function is an internal override of the _beforeTokenTransfer function in the ERC721 contract. It is used to emit an event when a token transfer is about to occur. It takes in the address of the sender, the address of the recipient, and the token ID of the token being transferred. It then calls the super function and emits a CollectNFTTransferEvent with the profile ID, public ID, token ID, sender address, and recipient address. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i lens-publication-nft
copy icon

Last Publish

11/6/2022

Version

1.0.0

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.