Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
Lens Profile Metadata Provider
copy icon
lens-protocol
• version 1.0.0
Utility
Social
Audited

Lens Profile Metadata Provider

Audited

This is a peripheral contract that acts as a source of truth for profile metadata and allows for users to emit an event demonstrating whether or not they explicitly want a follow to be shown.

*Visit desktop site to download or deploy

Version

1.0.0

Recent Use

🍞 0x53f5 downloaded

Last Publish

11/6/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
setProfileMetadataURI(uint256,string) :
This function allows the owner of a profile or the dispatcher to set the metadata URI associated with a profile. The function takes two parameters, a profile ID (uint256) and a metadata string (calldata). It first validates that the caller is either the profile owner or the dispatcher, and then sets the metadata URI associated with the profile. (autogenerated documentation)
setProfileMetadataURIWithSig() :
This function allows a user to set the metadata URI associated with a profile ID on the blockchain. It does this by validating the signature of the user associated with the profile ID, and then calling the _setProfileMetadataURI function to set the metadata URI. The signature is validated by calculating the digest of the data to be signed (the profile ID, the metadata URI, the signature nonce, and the signature deadline) and then comparing it to the recovered address from the signature. If the two match, the signature is valid and the metadata URI is set. (autogenerated documentation)
toggleFollow(uint256[]) :
This function allows a user to follow or unfollow a list of profiles. It takes two parameters, an array of profile IDs and an array of booleans, which indicate whether the user should follow or unfollow each profile. The function then calls the _toggleFollow function, passing in the user's address, the profile IDs, and the enables array. The _toggleFollow function then updates the user's list of followed profiles accordingly. (autogenerated documentation)
toggleFollowWithSig() :
This function allows a user to toggle their follow status for multiple profiles in a single transaction. It takes in a ToggleFollowWithSigData struct containing the profile IDs to toggle, a boolean array indicating whether to enable or disable the follow status for each profile, the signature of the user, and the signature deadline. It then validates the signature using the _validateRecoveredAddress function, and if successful, calls the _toggleFollow function to update the follow status for the specified profiles. (autogenerated documentation)
getProfileMetadataURI(uint256) :
This function retrieves the metadata URI associated with a given profile ID from the _metadataByProfile mapping. It takes in a uint256 profileId as an argument and returns a string memory containing the metadata URI. (autogenerated documentation)
_setProfileMetadataURI(uint256,string) :
This function sets the metadata URI associated with a given profile ID. It stores the metadata URI in the _metadataByProfile mapping and emits an event to signal that the metadata has been set. (autogenerated documentation)
_toggleFollow(address,uint256[]) :
This function is used to toggle the follow status of a given address for a set of profiles. It takes in an address of the follower, an array of profile IDs, and an array of booleans indicating whether the follow status should be enabled or disabled. It first checks that the two arrays are the same length, then it iterates through the profile IDs and checks that the follow NFT exists and that the follower has a balance of the NFT. If all checks pass, it emits an event to indicate that the follow status has been toggled. (autogenerated documentation)
_validateCallerIsProfileOwnerOrDispatcher(uint256) :
This function is used to validate that the caller of a function is either the owner of a profile or the dispatcher associated with that profile. It does this by first checking if the caller is the owner of the profile, as stored in the IERC721Time contract. If not, it then checks if the caller is the dispatcher associated with the profile, as stored in the HUB contract. If neither of these conditions are met, the function reverts with an error. (autogenerated documentation)
_validateRecoveredAddress(bytes32,address) :
This function is used to validate an EIP712 signature. 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 signature. 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-profile-metadata
copy icon

Recent Use

🍞 0x53f5 downloaded

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.