relevant tag icon
Lens NFT Base
copy icon
lens-protocol
• version 1.0.0
Abstract
NFT
ERC721
Audited

Lens NFT Base

Audited

This is an abstract base contract to be inherited by other Lens Protocol NFTs, it includes the slightly modified ERC721Enumerable, which itself inherits from the ERC721Time- -which adds an internal operator approval setter, stores the mint timestamp for each token, and replaces the constructor with an initializer.

*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(string,string) :
This function is used to initialize an ERC721Time contract. It takes two parameters, a name and a symbol, which are both passed in as calldata. It then calls the __ERC721_Init function from the ERC721Time contract to set the name and symbol of the contract. Finally, it emits an event to indicate that the contract has been initialized. (autogenerated documentation)
permit(address,uint256) :
This function allows a token owner to approve a spender to transfer a specific token. It does this by validating the signature of the owner using the EIP712 standard, and then calling the _approve function to approve the spender. The signature is calculated using the keccak256 hash of the PERMIT_TYPEHASH, spender, tokenId, sigNonces[owner]++, and sig.deadline. (autogenerated documentation)
permitForAll(address,address,bool) :
This function allows an owner to set an operator's approval status for all of the owner's assets. It does this by validating the signature of the owner, calculating a digest of the owner, operator, approval status, signature nonce, and signature deadline, and then setting the operator's approval status. (autogenerated documentation)
getDomainSeparator() :
This function returns the domain separator for the contract. The domain separator is a 32-byte value that is used to identify the contract and its associated data. It is calculated by hashing the contract address, the chain ID, and the salt value. This ensures that the domain separator is unique to the contract and its associated data. (autogenerated documentation)
burn(uint256) :
This function burns a token with the given tokenId. It first checks if the sender is either the owner or an approved address for the token. If not, it reverts the transaction. If the sender is either the owner or an approved address, the token is burned. (autogenerated documentation)
burnWithSig(uint256) :
This function allows the owner of a token to burn it using an EIP712 signature. It first checks that the owner of the token is the same as the address recovered from the signature. It then calculates a digest using the tokenId, the signature nonce, and the signature deadline. Finally, it calls the _burn() function to burn the token. (autogenerated documentation)
_validateRecoveredAddress(bytes32,address) :
This function is used to validate a signature against a given address. It takes a digest, an expected address, and an EIP712 signature as parameters. It first checks if the signature has expired by comparing the deadline to the current block timestamp. It then uses the ecrecover function to recover the address from the digest, signature, and parameters. If the recovered address is 0 or does not match the expected address, the function reverts. (autogenerated documentation)
_calculateDomainSeparator() :
This function calculates the domain separator for the EIP712 signature scheme. It does this by taking the EIP712 domain typehash, the name of the contract, the EIP712 revision hash, the chain ID, and the address of the contract, and then hashing them together using the keccak256 algorithm. This produces a unique domain separator that can be used to verify the authenticity of a signature. (autogenerated documentation)
_calculateDigest(bytes32) :
This function calculates a digest of a given hashed message. It does this by using the keccak256 hashing algorithm to combine the '\x19\x01' prefix with the domain separator and the hashed message. The domain separator is calculated using the _calculateDomainSeparator() function. The result of the keccak256 hashing is returned as the digest. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i lens-nft-base
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.