More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 1,233 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Public Collect W... | 65148373 | 3 days ago | IN | 0 POL | 0.01201707 | ||||
Public Collect W... | 64918625 | 9 days ago | IN | 0 POL | 0.02103522 | ||||
Public Collect W... | 64885512 | 10 days ago | IN | 0 POL | 0.00854123 | ||||
Public Collect W... | 64885204 | 10 days ago | IN | 0 POL | 0.0117161 | ||||
Public Collect W... | 64878650 | 10 days ago | IN | 0 POL | 0.01903774 | ||||
Public Collect W... | 64878597 | 10 days ago | IN | 0 POL | 0.01844827 | ||||
Public Collect W... | 64878547 | 10 days ago | IN | 0 POL | 0.02073683 | ||||
Public Collect W... | 64877433 | 10 days ago | IN | 0 POL | 0.02035675 | ||||
Public Collect W... | 64872214 | 10 days ago | IN | 0 POL | 0.01610232 | ||||
Public Collect W... | 64868293 | 10 days ago | IN | 0 POL | 0.00869703 | ||||
Public Collect W... | 64848703 | 11 days ago | IN | 0 POL | 0.00651702 | ||||
Public Collect W... | 64848571 | 11 days ago | IN | 0 POL | 0.00703002 | ||||
Public Collect W... | 64844926 | 11 days ago | IN | 0 POL | 0.00651702 | ||||
Public Collect W... | 64844908 | 11 days ago | IN | 0 POL | 0.00703002 | ||||
Public Collect W... | 64838353 | 11 days ago | IN | 0 POL | 0.01855604 | ||||
Public Collect W... | 64838339 | 11 days ago | IN | 0 POL | 0.02075131 | ||||
Public Collect W... | 64787877 | 12 days ago | IN | 0 POL | 0.00875659 | ||||
Public Collect W... | 64758284 | 13 days ago | IN | 0 POL | 0.02958851 | ||||
Public Collect W... | 64695062 | 15 days ago | IN | 0 POL | 0.00936599 | ||||
Public Collect W... | 64693119 | 15 days ago | IN | 0 POL | 0.01485128 | ||||
Public Collect W... | 64693112 | 15 days ago | IN | 0 POL | 0.0142006 | ||||
Public Collect W... | 64693106 | 15 days ago | IN | 0 POL | 0.01347665 | ||||
Public Collect W... | 64693092 | 15 days ago | IN | 0 POL | 0.01580783 | ||||
Public Collect W... | 64687295 | 15 days ago | IN | 0 POL | 0.00703002 | ||||
Public Collect W... | 64680431 | 15 days ago | IN | 0 POL | 0.01520925 |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
PublicActProxy
Compiler Version
v0.8.21+commit.d9974bed
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {Types} from 'contracts/libraries/constants/Types.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {CollectPublicationAction} from 'contracts/modules/act/collect/CollectPublicationAction.sol'; import {BaseProfilePublicationData, IBaseFeeCollectModule} from 'contracts/modules/interfaces/IBaseFeeCollectModule.sol'; import {MetaTxLib} from 'contracts/libraries/MetaTxLib.sol'; /// @title PublicActProxy /// @author LensProtocol /// @notice This contract allows anyone to Act on a publication without holding a profile /// @dev This contract holds a profile (or is a DE of that profile) and acts on behalf of the caller contract PublicActProxy { using SafeERC20 for IERC20; ILensHub public immutable HUB; CollectPublicationAction public immutable COLLECT_PUBLICATION_ACTION; uint[9] private __gap; mapping(address => uint256) private _nonces; // Slot 10 - to match with MetaTxLib/StorageLib constructor(address lensHub, address collectPublicationAction) { HUB = ILensHub(lensHub); COLLECT_PUBLICATION_ACTION = CollectPublicationAction(collectPublicationAction); } /* struct PublicationActionParams { publicationActedProfileId: --- publicationActedId: --- actorProfileId: this contract's profile referrerProfileIds: --- referrerPubIds: --- actionModuleAddress: --- actionModuleData: { collectNftRecipient: who shall receive the NFT collectData: { expectedCurrency: should match what's stored in CollectModule expectedAmount: should match what's stored in CollectModule } } } */ // This contract should be the owner/DE of the publicationActionParams.actorProfileId // This contract should be set as publicationActionParams.transactionExecutor // Correct collectNftRecipient should be passed in the publicationActionParams.actionModuleData // This is pretty simple, but should follow the rules above: function publicFreeAct(Types.PublicationActionParams calldata publicationActionParams) external { HUB.act(publicationActionParams); } // For the paid collect to work, additional steps are required: // Collector should set enough allowance to this contract to pay for collect NFT // Funds will be taken from msg.sender // Funds will be approved from this contract to collectModule found in publication storage function publicCollect(Types.PublicationActionParams calldata publicationActionParams) external { _publicCollect(publicationActionParams, msg.sender); } function publicCollectWithSig( Types.PublicationActionParams calldata publicationActionParams, Types.EIP712Signature calldata signature ) external { MetaTxLib.validateActSignature(signature, publicationActionParams); _publicCollect(publicationActionParams, signature.signer); } function nonces(address signer) public view returns (uint256) { return _nonces[signer]; } function incrementNonce(uint8 increment) external { MetaTxLib.incrementNonce(increment); } function _publicCollect( Types.PublicationActionParams calldata publicationActionParams, address transactionExecutor ) internal { address collectModule = COLLECT_PUBLICATION_ACTION .getCollectData( publicationActionParams.publicationActedProfileId, publicationActionParams.publicationActedId ) .collectModule; BaseProfilePublicationData memory collectData = IBaseFeeCollectModule(collectModule).getBasePublicationData( publicationActionParams.publicationActedProfileId, publicationActionParams.publicationActedId ); if (collectData.amount > 0) { IERC20(collectData.currency).safeTransferFrom(transactionExecutor, address(this), collectData.amount); IERC20(collectData.currency).safeIncreaseAllowance(collectModule, collectData.amount); } HUB.act(publicationActionParams); } function name() external pure returns (string memory) { return 'PublicActProxy'; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; import {Errors} from 'contracts/libraries/constants/Errors.sol'; /** * @title HubRestricted * @author Lens Protocol * * @notice This abstract contract adds a public `HUB` immutable field, as well as an `onlyHub` modifier, * to inherit from contracts that have functions restricted to be only called by the Lens hub. */ abstract contract HubRestricted { address public immutable HUB; modifier onlyHub() { if (msg.sender != HUB) { revert Errors.NotHub(); } _; } constructor(address hub) { HUB = hub; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title ICollectNFT * @author Lens Protocol * * @notice This is the interface for the CollectNFT contract. Which is cloned upon the first collect for any given * publication. */ interface ICollectNFT { /** * @notice 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. * @custom:permissions CollectPublicationAction. * * @param profileId The token ID of the profile in the hub that this Collect NFT points to. * @param pubId The profile publication ID in the hub that this Collect NFT points to. */ function initialize(uint256 profileId, uint256 pubId) external; /** * @notice Mints a collect NFT to the specified address. This can only be called by the hub and is called * upon collection. * @custom:permissions CollectPublicationAction. * * @param to The address to mint the NFT to. * * @return uint256 An integer representing the minted token ID. */ function mint(address to) external returns (uint256); /** * @notice Returns the source publication of this collect NFT. * * @return tuple First is the profile ID, and second is the publication ID. */ function getSourcePublicationPointer() external view returns (uint256, uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title IERC721Burnable * @author Lens Protocol * * @notice Extension of ERC-721 including a function that allows the token to be burned. */ interface IERC721Burnable { /** * @notice Burns an NFT, removing it from circulation and essentially destroying it. * @custom:permission Owner of the NFT. * * @param tokenId The token ID of the token to burn. */ function burn(uint256 tokenId) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title IERC721MetaTx * @author Lens Protocol * * @notice Extension of ERC-721 including meta-tx signatures related functions. */ interface IERC721MetaTx { /** * @notice Returns the current signature nonce of the given signer. * * @param signer The address for which to query the nonce. * * @return uint256 The current nonce of the given signer. */ function nonces(address signer) external view returns (uint256); /** * @notice Returns the EIP-712 domain separator for this contract. * * @return bytes32 The domain separator. */ function getDomainSeparator() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title IERC721Timestamped * @author Lens Protocol * * @notice Extension of ERC-721 including a struct for token data, which contains the owner and the mint timestamp, as * well as their associated getters. */ interface IERC721Timestamped { /** * @notice Returns the mint timestamp associated with a given NFT. * * @param tokenId The token ID of the NFT to query the mint timestamp for. * * @return uint256 Mint timestamp, this is stored as a uint96 but returned as a uint256 to reduce unnecessary * padding. */ function mintTimestampOf(uint256 tokenId) external view returns (uint256); /** * @notice Returns the token data associated with a given NFT. This allows fetching the token owner and * mint timestamp in a single call. * * @param tokenId The token ID of the NFT to query the token data for. * * @return TokenData A struct containing both the owner address and the mint timestamp. */ function tokenDataOf(uint256 tokenId) external view returns (Types.TokenData memory); /** * @notice Returns whether a token with the given token ID exists. * * @param tokenId The token ID of the NFT to check existence for. * * @return bool True if the token exists. */ function exists(uint256 tokenId) external view returns (bool); /** * @notice Returns the amount of tokens in circulation. * * @return uint256 The current total supply of tokens. */ function totalSupply() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import {IERC721Timestamped} from 'contracts/interfaces/IERC721Timestamped.sol'; import {IERC721Burnable} from 'contracts/interfaces/IERC721Burnable.sol'; import {IERC721MetaTx} from 'contracts/interfaces/IERC721MetaTx.sol'; import {IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; interface ILensERC721 is IERC721, IERC721Timestamped, IERC721Burnable, IERC721MetaTx, IERC721Metadata {}
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title ILensGovernable * @author Lens Protocol * * @notice This is the interface for the Lens Protocol main governance functions. */ interface ILensGovernable { /** * @notice Sets the privileged governance role. * @custom:permissions Governance. * * @param newGovernance The new governance address to set. */ function setGovernance(address newGovernance) external; /** * @notice Sets the emergency admin, which is a permissioned role able to set the protocol state. * @custom:permissions Governance. * * @param newEmergencyAdmin The new emergency admin address to set. */ function setEmergencyAdmin(address newEmergencyAdmin) external; /** * @notice Sets the protocol state to either a global pause, a publishing pause or an unpaused state. * @custom:permissions Governance or Emergency Admin. Emergency Admin can only restrict more. * * @param newState The state to set. It can be one of the following: * - Unpaused: The protocol is fully operational. * - PublishingPaused: The protocol is paused for publishing, but it is still operational for others operations. * - Paused: The protocol is paused for all operations. */ function setState(Types.ProtocolState newState) external; /** * @notice Adds or removes a profile creator from the whitelist. * @custom:permissions Governance. * * @param profileCreator The profile creator address to add or remove from the whitelist. * @param whitelist Whether or not the profile creator should be whitelisted. */ function whitelistProfileCreator(address profileCreator, bool whitelist) external; /** * @notice Sets the treasury address. * @custom:permissions Governance * * @param newTreasury The new treasury address to set. */ function setTreasury(address newTreasury) external; /** * @notice Sets the treasury fee. * @custom:permissions Governance * * @param newTreasuryFee The new treasury fee to set. */ function setTreasuryFee(uint16 newTreasuryFee) external; /** * @notice Returns the currently configured governance address. * * @return address The address of the currently configured governance. */ function getGovernance() external view returns (address); /** * @notice Gets the state currently set in the protocol. It could be a global pause, a publishing pause or an * unpaused state. * @custom:permissions Anyone. * * @return Types.ProtocolState The state currently set in the protocol. */ function getState() external view returns (Types.ProtocolState); /** * @notice Returns whether or not a profile creator is whitelisted. * * @param profileCreator The address of the profile creator to check. * * @return bool True if the profile creator is whitelisted, false otherwise. */ function isProfileCreatorWhitelisted(address profileCreator) external view returns (bool); /** * @notice Returns the treasury address. * * @return address The treasury address. */ function getTreasury() external view returns (address); /** * @notice Returns the treasury fee. * * @return uint16 The treasury fee. */ function getTreasuryFee() external view returns (uint16); /** * @notice Returns the treasury address and treasury fee in a single call. * * @return tuple First, the treasury address, second, the treasury fee. */ function getTreasuryData() external view returns (address, uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ILensProtocol} from 'contracts/interfaces/ILensProtocol.sol'; import {ILensGovernable} from 'contracts/interfaces/ILensGovernable.sol'; import {ILensHubEventHooks} from 'contracts/interfaces/ILensHubEventHooks.sol'; import {ILensImplGetters} from 'contracts/interfaces/ILensImplGetters.sol'; import {ILensProfiles} from 'contracts/interfaces/ILensProfiles.sol'; import {ILensVersion} from 'contracts/interfaces/ILensVersion.sol'; interface ILensHub is ILensProfiles, ILensProtocol, ILensGovernable, ILensHubEventHooks, ILensImplGetters, ILensVersion {}
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title ILensHubEventHooks * @author Lens Protocol * * @notice This is the interface for the LensHub contract's event hooks. As we want most of the core events to be * emitted by the LensHub contract, event hooks are needed for core events generated by pheripheral contracts. */ interface ILensHubEventHooks { /** * @dev Helper function to emit an `Unfollowed` event from the hub, to be consumed by indexers to track unfollows. * @custom:permissions FollowNFT of the Profile unfollowed. * * @param unfollowerProfileId The ID of the profile that executed the unfollow. * @param idOfProfileUnfollowed The ID of the profile that was unfollowed. * @param transactionExecutor The address of the account executing the unfollow operation. */ function emitUnfollowedEvent( uint256 unfollowerProfileId, uint256 idOfProfileUnfollowed, address transactionExecutor ) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title ILensImplGetters * @author Lens Protocol * * @notice This is the interface for the LensHub contract's implementation getters. These implementations will be used * for deploying each respective contract for each profile. */ interface ILensImplGetters { /** * @notice Returns the Follow NFT implementation address that is used for all deployed Follow NFTs. * * @return address The Follow NFT implementation address. */ function getFollowNFTImpl() external view returns (address); /** * @notice Returns the Collect NFT implementation address that is used for each new deployed Collect NFT. * @custom:pending-deprecation * * @return address The Collect NFT implementation address. */ function getLegacyCollectNFTImpl() external view returns (address); /** * @notice Returns the address of the registry that stores all modules that are used by the Lens Protocol. * * @return address The address of the Module Registry contract. */ function getModuleRegistry() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ILensERC721} from 'contracts/interfaces/ILensERC721.sol'; interface ILensProfiles is ILensERC721 { /** * @notice DANGER: Triggers disabling the profile protection mechanism for the msg.sender, which will allow * transfers or approvals over profiles held by it. * Disabling the mechanism will have a timelock before it becomes effective, allowing the owner to re-enable * the protection back in case of being under attack. * The protection layer only applies to EOA wallets. */ function DANGER__disableTokenGuardian() external; /** * @notice Enables back the profile protection mechanism for the msg.sender, preventing profile transfers or * approvals (except when revoking them). * The protection layer only applies to EOA wallets. */ function enableTokenGuardian() external; /** * @notice Returns the timestamp at which the Token Guardian will become effectively disabled. * * @param wallet The address to check the timestamp for. * * @return uint256 The timestamp at which the Token Guardian will become effectively disabled. Zero if enabled. */ function getTokenGuardianDisablingTimestamp(address wallet) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title ILensProtocol * @author Lens Protocol * * @notice This is the interface for Lens Protocol's core functions. It contains all the entry points for performing * social operations. */ interface ILensProtocol { /** * @notice Creates a profile with the specified parameters, minting a Profile NFT to the given recipient. * @custom:permissions Any whitelisted profile creator. * * @param createProfileParams A CreateProfileParams struct containing the needed params. */ function createProfile(Types.CreateProfileParams calldata createProfileParams) external returns (uint256); /** * @notice Sets the metadata URI for the given profile. * @custom:permissions Profile Owner or Delegated Executor. * * @param profileId The token ID of the profile to set the metadata URI for. * @param metadataURI The metadata URI to set for the given profile. */ function setProfileMetadataURI(uint256 profileId, string calldata metadataURI) external; /** * @custom:meta-tx setProfileMetadataURI. */ function setProfileMetadataURIWithSig( uint256 profileId, string calldata metadataURI, Types.EIP712Signature calldata signature ) external; /** * @notice Sets the follow module for the given profile. * @custom:permissions Profile Owner or Delegated Executor. * * @param profileId The token ID of the profile to set the follow module for. * @param followModule The follow module to set for the given profile, must be whitelisted. * @param followModuleInitData The data to be passed to the follow module for initialization. */ function setFollowModule(uint256 profileId, address followModule, bytes calldata followModuleInitData) external; /** * @custom:meta-tx setFollowModule. */ function setFollowModuleWithSig( uint256 profileId, address followModule, bytes calldata followModuleInitData, Types.EIP712Signature calldata signature ) external; /** * @notice Changes the delegated executors configuration for the given profile. It allows setting the approvals for * delegated executors in the specified configuration, as well as switching to it. * @custom:permissions Profile Owner. * * @param delegatorProfileId The ID of the profile to which the delegated executor is being changed for. * @param delegatedExecutors The array of delegated executors to set the approval for. * @param approvals The array of booleans indicating the corresponding executor's new approval status. * @param configNumber The number of the configuration where the executor approval state is being set. * @param switchToGivenConfig A boolean indicating if the configuration must be switched to the one with the given * number. */ function changeDelegatedExecutorsConfig( uint256 delegatorProfileId, address[] calldata delegatedExecutors, bool[] calldata approvals, uint64 configNumber, bool switchToGivenConfig ) external; /** * @notice Changes the delegated executors configuration for the given profile under the current configuration. * @custom:permissions Profile Owner. * * @param delegatorProfileId The ID of the profile to which the delegated executor is being changed for. * @param delegatedExecutors The array of delegated executors to set the approval for. * @param approvals The array of booleans indicating the corresponding executor's new approval status. */ function changeDelegatedExecutorsConfig( uint256 delegatorProfileId, address[] calldata delegatedExecutors, bool[] calldata approvals ) external; /** * @custom:meta-tx changeDelegatedExecutorsConfig. */ function changeDelegatedExecutorsConfigWithSig( uint256 delegatorProfileId, address[] calldata delegatedExecutors, bool[] calldata approvals, uint64 configNumber, bool switchToGivenConfig, Types.EIP712Signature calldata signature ) external; /** * @notice Publishes a post. * Post is the most basic publication type, and can be used to publish any kind of content. * Posts can have these types of modules initialized: * - Action modules: any number of publication actions (e.g. collect, tip, etc.) * - Reference module: a module handling the rules when referencing this post (e.g. token-gated comments) * @custom:permissions Profile Owner or Delegated Executor. * * @param postParams A PostParams struct containing the needed parameters. * * @return uint256 An integer representing the post's publication ID. */ function post(Types.PostParams calldata postParams) external returns (uint256); /** * @custom:meta-tx post. */ function postWithSig( Types.PostParams calldata postParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Publishes a comment on the given publication. * Comment is a type of reference publication that points to another publication. * Comments can have these types of modules initialized: * - Action modules: any number of publication actions (e.g. collect, tip, etc.) * - Reference module: a module handling the rules when referencing this comment (e.g. token-gated mirrors) * Comments can have referrers (e.g. publications or profiles that helped to discover the pointed publication). * @custom:permissions Profile Owner or Delegated Executor. * * @param commentParams A CommentParams struct containing the needed parameters. * * @return uint256 An integer representing the comment's publication ID. */ function comment(Types.CommentParams calldata commentParams) external returns (uint256); /** * @custom:meta-tx comment. */ function commentWithSig( Types.CommentParams calldata commentParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Publishes a mirror of the given publication. * Mirror is a type of reference publication that points to another publication but doesn't have content. * Mirrors don't have any modules initialized. * Mirrors can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * You cannot mirror a mirror, comment on a mirror, or quote a mirror. * @custom:permissions Profile Owner or Delegated Executor. * * @param mirrorParams A MirrorParams struct containing the necessary parameters. * * @return uint256 An integer representing the mirror's publication ID. */ function mirror(Types.MirrorParams calldata mirrorParams) external returns (uint256); /** * @custom:meta-tx mirror. */ function mirrorWithSig( Types.MirrorParams calldata mirrorParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Publishes a quote of the given publication. * Quote is a type of reference publication similar to mirror, but it has content and modules. * Quotes can have these types of modules initialized: * - Action modules: any number of publication actions (e.g. collect, tip, etc.) * - Reference module: a module handling the rules when referencing this quote (e.g. token-gated comments on quote) * Quotes can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * Unlike mirrors, you can mirror a quote, comment on a quote, or quote a quote. * @custom:permissions Profile Owner or Delegated Executor. * * @param quoteParams A QuoteParams struct containing the needed parameters. * * @return uint256 An integer representing the quote's publication ID. */ function quote(Types.QuoteParams calldata quoteParams) external returns (uint256); /** * @custom:meta-tx quote. */ function quoteWithSig( Types.QuoteParams calldata quoteParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Follows given profiles, executing each profile's follow module logic (if any). * @custom:permissions Profile Owner or Delegated Executor. * * @dev Both the `idsOfProfilesToFollow`, `followTokenIds`, and `datas` arrays must be of the same length, * regardless if the profiles do not have a follow module set. * * @param followerProfileId The ID of the profile the follows are being executed for. * @param idsOfProfilesToFollow The array of IDs of profiles to follow. * @param followTokenIds The array of follow token IDs to use for each follow (0 if you don't own a follow token). * @param datas The arbitrary data array to pass to the follow module for each profile if needed. * * @return uint256[] An array of follow token IDs representing the follow tokens created for each follow. */ function follow( uint256 followerProfileId, uint256[] calldata idsOfProfilesToFollow, uint256[] calldata followTokenIds, bytes[] calldata datas ) external returns (uint256[] memory); /** * @custom:meta-tx follow. */ function followWithSig( uint256 followerProfileId, uint256[] calldata idsOfProfilesToFollow, uint256[] calldata followTokenIds, bytes[] calldata datas, Types.EIP712Signature calldata signature ) external returns (uint256[] memory); /** * @notice Unfollows given profiles. * @custom:permissions Profile Owner or Delegated Executor. * * @param unfollowerProfileId The ID of the profile the unfollows are being executed for. * @param idsOfProfilesToUnfollow The array of IDs of profiles to unfollow. */ function unfollow(uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow) external; /** * @custom:meta-tx unfollow. */ function unfollowWithSig( uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow, Types.EIP712Signature calldata signature ) external; /** * @notice Sets the block status for the given profiles. Changing a profile's block status to `true` (i.e. blocked), * when will also force them to unfollow. * Blocked profiles cannot perform any actions with the profile that blocked them: they cannot comment or mirror * their publications, they cannot follow them, they cannot collect, tip them, etc. * @custom:permissions Profile Owner or Delegated Executor. * * @dev Both the `idsOfProfilesToSetBlockStatus` and `blockStatus` arrays must be of the same length. * * @param byProfileId The ID of the profile that is blocking/unblocking somebody. * @param idsOfProfilesToSetBlockStatus The array of IDs of profiles to set block status. * @param blockStatus The array of block statuses to use for each (true is blocked). */ function setBlockStatus( uint256 byProfileId, uint256[] calldata idsOfProfilesToSetBlockStatus, bool[] calldata blockStatus ) external; /** * @custom:meta-tx setBlockStatus. */ function setBlockStatusWithSig( uint256 byProfileId, uint256[] calldata idsOfProfilesToSetBlockStatus, bool[] calldata blockStatus, Types.EIP712Signature calldata signature ) external; /** * @notice Collects a given publication via signature with the specified parameters. * Collect can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * @custom:permissions Collector Profile Owner or its Delegated Executor. * @custom:pending-deprecation Collect modules were replaced by PublicationAction Collect modules in V2. This method * is left here for backwards compatibility with posts made in V1 that had Collect modules. * * @param collectParams A CollectParams struct containing the parameters. * * @return uint256 An integer representing the minted token ID. */ function collectLegacy(Types.LegacyCollectParams calldata collectParams) external returns (uint256); /** * @custom:meta-tx collect. * @custom:pending-deprecation */ function collectLegacyWithSig( Types.LegacyCollectParams calldata collectParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Acts on a given publication with the specified parameters. * You can act on a publication except a mirror (if it has at least one action module initialized). * Actions can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * @custom:permissions Actor Profile Owner or its Delegated Executor. * * @param publicationActionParams A PublicationActionParams struct containing the parameters. * * @return bytes Arbitrary data the action module returns. */ function act(Types.PublicationActionParams calldata publicationActionParams) external returns (bytes memory); /** * @custom:meta-tx act. */ function actWithSig( Types.PublicationActionParams calldata publicationActionParams, Types.EIP712Signature calldata signature ) external returns (bytes memory); /** * @dev This function is used to invalidate signatures by incrementing the nonce of the signer. * @param increment The amount to increment the nonce by (max 255). */ function incrementNonce(uint8 increment) external; ///////////////////////////////// /// VIEW FUNCTIONS /// ///////////////////////////////// /** * @notice Returns whether or not `followerProfileId` is following `followedProfileId`. * * @param followerProfileId The ID of the profile whose following state should be queried. * @param followedProfileId The ID of the profile whose followed state should be queried. * * @return bool True if `followerProfileId` is following `followedProfileId`, false otherwise. */ function isFollowing(uint256 followerProfileId, uint256 followedProfileId) external view returns (bool); /** * @notice Returns whether the given address is approved as delegated executor, in the configuration with the given * number, to act on behalf of the given profile. * * @param delegatorProfileId The ID of the profile to check the delegated executor approval for. * @param delegatedExecutor The address to query the delegated executor approval for. * @param configNumber The number of the configuration where the executor approval state is being queried. * * @return bool True if the address is approved as a delegated executor to act on behalf of the profile in the * given configuration, false otherwise. */ function isDelegatedExecutorApproved( uint256 delegatorProfileId, address delegatedExecutor, uint64 configNumber ) external view returns (bool); /** * @notice Returns whether the given address is approved as delegated executor, in the current configuration, to act * on behalf of the given profile. * * @param delegatorProfileId The ID of the profile to check the delegated executor approval for. * @param delegatedExecutor The address to query the delegated executor approval for. * * @return bool True if the address is approved as a delegated executor to act on behalf of the profile in the * current configuration, false otherwise. */ function isDelegatedExecutorApproved( uint256 delegatorProfileId, address delegatedExecutor ) external view returns (bool); /** * @notice Returns the current delegated executor config number for the given profile. * * @param delegatorProfileId The ID of the profile from which the delegated executors config number is being queried * * @return uint256 The current delegated executor configuration number. */ function getDelegatedExecutorsConfigNumber(uint256 delegatorProfileId) external view returns (uint64); /** * @notice Returns the previous used delegated executor config number for the given profile. * * @param delegatorProfileId The ID of the profile from which the delegated executors' previous configuration number * set is being queried. * * @return uint256 The delegated executor configuration number previously set. It will coincide with the current * configuration set if it was never switched from the default one. */ function getDelegatedExecutorsPrevConfigNumber(uint256 delegatorProfileId) external view returns (uint64); /** * @notice Returns the maximum delegated executor config number for the given profile. * This is the maximum config number that was ever used by this profile. * When creating a new clean configuration, you can only use a number that is maxConfigNumber + 1. * * @param delegatorProfileId The ID of the profile from which the delegated executors' maximum configuration number * set is being queried. * * @return uint256 The delegated executor maximum configuration number set. */ function getDelegatedExecutorsMaxConfigNumberSet(uint256 delegatorProfileId) external view returns (uint64); /** * @notice Returns whether `profileId` is blocked by `byProfileId`. * See setBlockStatus() for more information on how blocking works on the platform. * * @param profileId The ID of the profile whose blocked status should be queried. * @param byProfileId The ID of the profile whose blocker status should be queried. * * @return bool True if `profileId` is blocked by `byProfileId`, false otherwise. */ function isBlocked(uint256 profileId, uint256 byProfileId) external view returns (bool); /** * @notice Returns the URI associated with a given publication. * This is used to store the publication's metadata, e.g.: content, images, etc. * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * * @return string The URI associated with a given publication. */ function getContentURI(uint256 profileId, uint256 pubId) external view returns (string memory); /** * @notice Returns the full profile struct associated with a given profile token ID. * * @param profileId The token ID of the profile to query. * * @return Profile The profile struct of the given profile. */ function getProfile(uint256 profileId) external view returns (Types.Profile memory); /** * @notice Returns the full publication struct for a given publication. * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * * @return Publication The publication struct associated with the queried publication. */ function getPublication(uint256 profileId, uint256 pubId) external view returns (Types.PublicationMemory memory); /** * @notice Returns the type of a given publication. * The type can be one of the following (see PublicationType enum): * - Nonexistent * - Post * - Comment * - Mirror * - Quote * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * * @return PublicationType The publication type of the queried publication. */ function getPublicationType(uint256 profileId, uint256 pubId) external view returns (Types.PublicationType); /** * @notice Returns wether a given Action Module is enabled for a given publication. * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * @param module The address of the Action Module to query. * * @return bool True if the Action Module is enabled for the queried publication, false if not. */ function isActionModuleEnabledInPublication( uint256 profileId, uint256 pubId, address module ) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title ILensVersion * @author Lens Protocol * * @notice This is the interface for the LensHub Version getters and emitter. * It allows to emit a LensHub version during an upgrade, and also to get the current version. */ interface ILensVersion { /** * @notice Returns the LensHub current Version. * * @return version The LensHub current Version. */ function getVersion() external view returns (string memory); /** * @notice Returns the LensHub current Git Commit. * * @return gitCommit The LensHub current Git Commit. */ function getGitCommit() external view returns (bytes20); /** * @notice Emits the LensHub current Version. Used in upgradeAndCall(). */ function emitVersion() external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title IPublicationAction * @author Lens Protocol * * @notice This is the standard interface for all Lens-compatible Publication Actions. * Publication action modules allow users to execute actions directly from a publication, like: * - Minting NFTs. * - Collecting a publication. * - Sending funds to the publication author (e.g. tipping). * - Etc. * Referrers are supported, so any publication or profile that references the publication can receive a share from the * publication's action if the action module supports it. */ interface IPublicationActionModule { /** * @notice Initializes the action module for the given publication being published with this Action module. * @custom:permissions LensHub. * * @param profileId The profile ID of the author publishing the content with this Publication Action. * @param pubId The publication ID being published. * @param transactionExecutor The address of the transaction executor (e.g. for any funds to transferFrom). * @param data Arbitrary data passed from the user to be decoded by the Action Module during initialization. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function initializePublicationAction( uint256 profileId, uint256 pubId, address transactionExecutor, bytes calldata data ) external returns (bytes memory); /** * @notice Processes the action for a given publication. This includes the action's logic and any monetary/token * operations. * @custom:permissions LensHub. * * @param processActionParams The parameters needed to execute the publication action. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function processPublicationAction(Types.ProcessActionParams calldata processActionParams) external returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; import {IERC1271} from '@openzeppelin/contracts/interfaces/IERC1271.sol'; import {ILensERC721} from 'contracts/interfaces/ILensERC721.sol'; import {Types} from 'contracts/libraries/constants/Types.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; import {Typehash} from 'contracts/libraries/constants/Typehash.sol'; import {StorageLib} from 'contracts/libraries/StorageLib.sol'; import {Events} from 'contracts/libraries/constants/Events.sol'; /** * @title MetaTxLib * @author Lens Protocol * * NOTE: the functions in this contract operate under the assumption that the passed signer is already validated * to either be the originator or one of their delegated executors. * * @dev User nonces are incremented from this library as well. */ library MetaTxLib { string constant EIP712_DOMAIN_VERSION = '2'; bytes32 constant EIP712_DOMAIN_VERSION_HASH = keccak256(bytes(EIP712_DOMAIN_VERSION)); bytes4 constant EIP1271_MAGIC_VALUE = 0x1626ba7e; /** * @dev We store the domain separator and LensHub Proxy address as constants to save gas. * * keccak256( * abi.encode( * keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), * keccak256('Lens Protocol Profiles'), // Contract Name * keccak256('2'), // Version Hash * 137, // Polygon Chain ID * address(0xDb46d1Dc155634FbC732f92E853b10B288AD5a1d) // Verifying Contract Address - LensHub Address * ) * ); */ bytes32 constant LENS_HUB_CACHED_POLYGON_DOMAIN_SEPARATOR = 0xbf9544cf7d7a0338fc4f071be35409a61e51e9caef559305410ad74e16a05f2d; address constant LENS_HUB_ADDRESS = 0xDb46d1Dc155634FbC732f92E853b10B288AD5a1d; uint256 constant POLYGON_CHAIN_ID = 137; function validateSetProfileMetadataURISignature( Types.EIP712Signature calldata signature, uint256 profileId, string calldata metadataURI ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.SET_PROFILE_METADATA_URI, profileId, _encodeUsingEip712Rules(metadataURI), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateSetFollowModuleSignature( Types.EIP712Signature calldata signature, uint256 profileId, address followModule, bytes calldata followModuleInitData ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.SET_FOLLOW_MODULE, profileId, followModule, _encodeUsingEip712Rules(followModuleInitData), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateChangeDelegatedExecutorsConfigSignature( Types.EIP712Signature calldata signature, uint256 delegatorProfileId, address[] calldata delegatedExecutors, bool[] calldata approvals, uint64 configNumber, bool switchToGivenConfig ) external { address signer = signature.signer; uint256 deadline = signature.deadline; _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.CHANGE_DELEGATED_EXECUTORS_CONFIG, delegatorProfileId, _encodeUsingEip712Rules(delegatedExecutors), _encodeUsingEip712Rules(approvals), configNumber, switchToGivenConfig, _getNonceIncrementAndEmitEvent(signer), deadline ) ) ), signature ); } function validatePostSignature( Types.EIP712Signature calldata signature, Types.PostParams calldata postParams ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.POST, postParams.profileId, _encodeUsingEip712Rules(postParams.contentURI), _encodeUsingEip712Rules(postParams.actionModules), _encodeUsingEip712Rules(postParams.actionModulesInitDatas), postParams.referenceModule, _encodeUsingEip712Rules(postParams.referenceModuleInitData), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateCommentSignature( Types.EIP712Signature calldata signature, Types.CommentParams calldata commentParams ) external { bytes memory encodedAbi = abi.encode( Typehash.COMMENT, commentParams.profileId, _encodeUsingEip712Rules(commentParams.contentURI), commentParams.pointedProfileId, commentParams.pointedPubId, _encodeUsingEip712Rules(commentParams.referrerProfileIds), _encodeUsingEip712Rules(commentParams.referrerPubIds), _encodeUsingEip712Rules(commentParams.referenceModuleData), _encodeUsingEip712Rules(commentParams.actionModules), _encodeUsingEip712Rules(commentParams.actionModulesInitDatas), commentParams.referenceModule, _encodeUsingEip712Rules(commentParams.referenceModuleInitData), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ); _validateRecoveredAddress(_calculateDigest(keccak256(encodedAbi)), signature); } function validateQuoteSignature( Types.EIP712Signature calldata signature, Types.QuoteParams calldata quoteParams ) external { bytes memory encodedAbi = abi.encode( Typehash.QUOTE, quoteParams.profileId, _encodeUsingEip712Rules(quoteParams.contentURI), quoteParams.pointedProfileId, quoteParams.pointedPubId, _encodeUsingEip712Rules(quoteParams.referrerProfileIds), _encodeUsingEip712Rules(quoteParams.referrerPubIds), _encodeUsingEip712Rules(quoteParams.referenceModuleData), _encodeUsingEip712Rules(quoteParams.actionModules), _encodeUsingEip712Rules(quoteParams.actionModulesInitDatas), quoteParams.referenceModule, _encodeUsingEip712Rules(quoteParams.referenceModuleInitData), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ); _validateRecoveredAddress(_calculateDigest(keccak256(encodedAbi)), signature); } function validateMirrorSignature( Types.EIP712Signature calldata signature, Types.MirrorParams calldata mirrorParams ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.MIRROR, mirrorParams.profileId, _encodeUsingEip712Rules(mirrorParams.metadataURI), mirrorParams.pointedProfileId, mirrorParams.pointedPubId, _encodeUsingEip712Rules(mirrorParams.referrerProfileIds), _encodeUsingEip712Rules(mirrorParams.referrerPubIds), _encodeUsingEip712Rules(mirrorParams.referenceModuleData), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateFollowSignature( Types.EIP712Signature calldata signature, uint256 followerProfileId, uint256[] calldata idsOfProfilesToFollow, uint256[] calldata followTokenIds, bytes[] calldata datas ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.FOLLOW, followerProfileId, _encodeUsingEip712Rules(idsOfProfilesToFollow), _encodeUsingEip712Rules(followTokenIds), _encodeUsingEip712Rules(datas), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateUnfollowSignature( Types.EIP712Signature calldata signature, uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.UNFOLLOW, unfollowerProfileId, _encodeUsingEip712Rules(idsOfProfilesToUnfollow), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateSetBlockStatusSignature( Types.EIP712Signature calldata signature, uint256 byProfileId, uint256[] calldata idsOfProfilesToSetBlockStatus, bool[] calldata blockStatus ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.SET_BLOCK_STATUS, byProfileId, _encodeUsingEip712Rules(idsOfProfilesToSetBlockStatus), _encodeUsingEip712Rules(blockStatus), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateLegacyCollectSignature( Types.EIP712Signature calldata signature, Types.LegacyCollectParams calldata collectParams ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.COLLECT_LEGACY, collectParams.publicationCollectedProfileId, collectParams.publicationCollectedId, collectParams.collectorProfileId, collectParams.referrerProfileId, collectParams.referrerPubId, _encodeUsingEip712Rules(collectParams.collectModuleData), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } function validateActSignature( Types.EIP712Signature calldata signature, Types.PublicationActionParams calldata publicationActionParams ) external { _validateRecoveredAddress( _calculateDigest( keccak256( abi.encode( Typehash.ACT, publicationActionParams.publicationActedProfileId, publicationActionParams.publicationActedId, publicationActionParams.actorProfileId, _encodeUsingEip712Rules(publicationActionParams.referrerProfileIds), _encodeUsingEip712Rules(publicationActionParams.referrerPubIds), publicationActionParams.actionModuleAddress, _encodeUsingEip712Rules(publicationActionParams.actionModuleData), _getNonceIncrementAndEmitEvent(signature.signer), signature.deadline ) ) ), signature ); } /// @dev This function is used to invalidate signatures by incrementing the nonce function incrementNonce(uint8 increment) external { uint256 currentNonce = StorageLib.nonces()[msg.sender]; StorageLib.nonces()[msg.sender] = currentNonce + increment; emit Events.NonceUpdated(msg.sender, currentNonce + increment, block.timestamp); } function calculateDomainSeparator() internal view returns (bytes32) { if (address(this) == LENS_HUB_ADDRESS && block.chainid == POLYGON_CHAIN_ID) { return LENS_HUB_CACHED_POLYGON_DOMAIN_SEPARATOR; } return keccak256( abi.encode( Typehash.EIP712_DOMAIN, keccak256(bytes(ILensERC721(address(this)).name())), EIP712_DOMAIN_VERSION_HASH, block.chainid, address(this) ) ); } /** * @dev Wrapper for ecrecover to reduce code size, used in meta-tx specific functions. */ function _validateRecoveredAddress(bytes32 digest, Types.EIP712Signature calldata signature) private view { if (block.timestamp > signature.deadline) revert Errors.SignatureExpired(); // If the expected address is a contract, check the signature there. if (signature.signer.code.length != 0) { bytes memory concatenatedSig = abi.encodePacked(signature.r, signature.s, signature.v); if (IERC1271(signature.signer).isValidSignature(digest, concatenatedSig) != EIP1271_MAGIC_VALUE) { revert Errors.SignatureInvalid(); } } else { address recoveredAddress = ecrecover(digest, signature.v, signature.r, signature.s); if (recoveredAddress == address(0) || recoveredAddress != signature.signer) { revert Errors.SignatureInvalid(); } } } /** * @dev Calculates EIP712 digest based on the current DOMAIN_SEPARATOR. * * @param hashedMessage The message hash from which the digest should be calculated. * * @return bytes32 A 32-byte output representing the EIP712 digest. */ function _calculateDigest(bytes32 hashedMessage) private view returns (bytes32) { return keccak256(abi.encodePacked('\x19\x01', calculateDomainSeparator(), hashedMessage)); } /** * @dev This fetches a signer's current nonce and increments it so it's ready for the next meta-tx. Also emits * the `NonceUpdated` event. * * @param signer The address to get and increment the nonce for. * * @return uint256 The current nonce for the given signer prior to being incremented. */ function _getNonceIncrementAndEmitEvent(address signer) private returns (uint256) { uint256 currentNonce; unchecked { currentNonce = StorageLib.nonces()[signer]++; } emit Events.NonceUpdated(signer, currentNonce + 1, block.timestamp); return currentNonce; } function _encodeUsingEip712Rules(bytes[] memory bytesArray) private pure returns (bytes32) { bytes32[] memory bytesArrayEncodedElements = new bytes32[](bytesArray.length); uint256 i; while (i < bytesArray.length) { // A `bytes` type is encoded as its keccak256 hash. bytesArrayEncodedElements[i] = _encodeUsingEip712Rules(bytesArray[i]); unchecked { ++i; } } // An array is encoded as the keccak256 hash of the concatenation of their encoded elements. return _encodeUsingEip712Rules(bytesArrayEncodedElements); } function _encodeUsingEip712Rules(bool[] memory boolArray) private pure returns (bytes32) { return keccak256(abi.encodePacked(boolArray)); } function _encodeUsingEip712Rules(address[] memory addressArray) private pure returns (bytes32) { return keccak256(abi.encodePacked(addressArray)); } function _encodeUsingEip712Rules(uint256[] memory uint256Array) private pure returns (bytes32) { return keccak256(abi.encodePacked(uint256Array)); } function _encodeUsingEip712Rules(bytes32[] memory bytes32Array) private pure returns (bytes32) { return keccak256(abi.encodePacked(bytes32Array)); } function _encodeUsingEip712Rules(string memory stringValue) private pure returns (bytes32) { return keccak256(bytes(stringValue)); } function _encodeUsingEip712Rules(bytes memory bytesValue) private pure returns (bytes32) { return keccak256(bytesValue); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; import {Types} from 'contracts/libraries/constants/Types.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; library StorageLib { // uint256 constant NAME_SLOT = 0; // uint256 constant SYMBOL_SLOT = 1; uint256 constant TOKEN_DATA_MAPPING_SLOT = 2; // uint256 constant BALANCES_SLOT = 3; // uint256 constant TOKEN_APPROVAL_MAPPING_SLOT = 4; // uint256 constant OPERATOR_APPROVAL_MAPPING_SLOT = 5; // Slot 6 is deprecated in Lens V2. In V1 it was used for ERC-721 Enumerable's `ownedTokens`. // Slot 7 is deprecated in Lens V2. In V1 it was used for ERC-721 Enumerable's `ownedTokensIndex`. // uint256 constant TOTAL_SUPPLY_SLOT = 8; // Slot 9 is deprecated in Lens V2. In V1 it was used for ERC-721 Enumerable's `allTokensIndex`. uint256 constant SIG_NONCES_MAPPING_SLOT = 10; uint256 constant LAST_INITIALIZED_REVISION_SLOT = 11; // VersionedInitializable's `lastInitializedRevision` field. uint256 constant PROTOCOL_STATE_SLOT = 12; uint256 constant PROFILE_CREATOR_WHITELIST_MAPPING_SLOT = 13; // Slot 14 is deprecated in Lens V2. In V1 it was used for the follow module address whitelist. // Slot 15 is deprecated in Lens V2. In V1 it was used for the collect module address whitelist. // Slot 16 is deprecated in Lens V2. In V1 it was used for the reference module address whitelist. // Slot 17 is deprecated in Lens V2. In V1 it was used for the dispatcher address by profile ID. uint256 constant PROFILE_ID_BY_HANDLE_HASH_MAPPING_SLOT = 18; // Deprecated slot, but still needed for V2 migration. uint256 constant PROFILES_MAPPING_SLOT = 19; uint256 constant PUBLICATIONS_MAPPING_SLOT = 20; // Slot 21 is deprecated in Lens V2. In V1 it was used for the default profile ID by address. uint256 constant PROFILE_COUNTER_SLOT = 22; uint256 constant GOVERNANCE_SLOT = 23; uint256 constant EMERGENCY_ADMIN_SLOT = 24; ////////////////////////////////// /// Introduced in Lens V1.3: /// ////////////////////////////////// uint256 constant TOKEN_GUARDIAN_DISABLING_TIMESTAMP_MAPPING_SLOT = 25; ////////////////////////////////// /// Introduced in Lens V2: /// ////////////////////////////////// uint256 constant DELEGATED_EXECUTOR_CONFIG_MAPPING_SLOT = 26; uint256 constant BLOCKED_STATUS_MAPPING_SLOT = 27; uint256 constant PROFILE_ROYALTIES_BPS_SLOT = 28; uint256 constant MIGRATION_ADMINS_WHITELISTED_MAPPING_SLOT = 29; uint256 constant TREASURY_DATA_SLOT = 30; function getPublication( uint256 profileId, uint256 pubId ) internal pure returns (Types.Publication storage _publication) { assembly { mstore(0, profileId) mstore(32, PUBLICATIONS_MAPPING_SLOT) mstore(32, keccak256(0, 64)) mstore(0, pubId) _publication.slot := keccak256(0, 64) } } function getPublicationMemory( uint256 profileId, uint256 pubId ) internal pure returns (Types.PublicationMemory memory) { Types.PublicationMemory storage _publicationStorage; assembly { mstore(0, profileId) mstore(32, PUBLICATIONS_MAPPING_SLOT) mstore(32, keccak256(0, 64)) mstore(0, pubId) _publicationStorage.slot := keccak256(0, 64) } Types.PublicationMemory memory _publicationMemory; _publicationMemory = _publicationStorage; return _publicationMemory; } function getProfile(uint256 profileId) internal pure returns (Types.Profile storage _profiles) { assembly { mstore(0, profileId) mstore(32, PROFILES_MAPPING_SLOT) _profiles.slot := keccak256(0, 64) } } function getDelegatedExecutorsConfig( uint256 delegatorProfileId ) internal pure returns (Types.DelegatedExecutorsConfig storage _delegatedExecutorsConfig) { assembly { mstore(0, delegatorProfileId) mstore(32, DELEGATED_EXECUTOR_CONFIG_MAPPING_SLOT) _delegatedExecutorsConfig.slot := keccak256(0, 64) } } function tokenGuardianDisablingTimestamp() internal pure returns (mapping(address => uint256) storage _tokenGuardianDisablingTimestamp) { assembly { _tokenGuardianDisablingTimestamp.slot := TOKEN_GUARDIAN_DISABLING_TIMESTAMP_MAPPING_SLOT } } function getTokenData(uint256 tokenId) internal pure returns (Types.TokenData storage _tokenData) { assembly { mstore(0, tokenId) mstore(32, TOKEN_DATA_MAPPING_SLOT) _tokenData.slot := keccak256(0, 64) } } function blockedStatus( uint256 blockerProfileId ) internal pure returns (mapping(uint256 => bool) storage _blockedStatus) { assembly { mstore(0, blockerProfileId) mstore(32, BLOCKED_STATUS_MAPPING_SLOT) _blockedStatus.slot := keccak256(0, 64) } } function nonces() internal pure returns (mapping(address => uint256) storage _nonces) { assembly { _nonces.slot := SIG_NONCES_MAPPING_SLOT } } function profileIdByHandleHash() internal pure returns (mapping(bytes32 => uint256) storage _profileIdByHandleHash) { assembly { _profileIdByHandleHash.slot := PROFILE_ID_BY_HANDLE_HASH_MAPPING_SLOT } } function profileCreatorWhitelisted() internal pure returns (mapping(address => bool) storage _profileCreatorWhitelisted) { assembly { _profileCreatorWhitelisted.slot := PROFILE_CREATOR_WHITELIST_MAPPING_SLOT } } function migrationAdminWhitelisted() internal pure returns (mapping(address => bool) storage _migrationAdminWhitelisted) { assembly { _migrationAdminWhitelisted.slot := MIGRATION_ADMINS_WHITELISTED_MAPPING_SLOT } } function getGovernance() internal view returns (address _governance) { assembly { _governance := sload(GOVERNANCE_SLOT) } } function setGovernance(address newGovernance) internal { assembly { sstore(GOVERNANCE_SLOT, newGovernance) } } function getEmergencyAdmin() internal view returns (address _emergencyAdmin) { assembly { _emergencyAdmin := sload(EMERGENCY_ADMIN_SLOT) } } function setEmergencyAdmin(address newEmergencyAdmin) internal { assembly { sstore(EMERGENCY_ADMIN_SLOT, newEmergencyAdmin) } } function getState() internal view returns (Types.ProtocolState _state) { assembly { _state := sload(PROTOCOL_STATE_SLOT) } } function setState(Types.ProtocolState newState) internal { assembly { sstore(PROTOCOL_STATE_SLOT, newState) } } function getLastInitializedRevision() internal view returns (uint256 _lastInitializedRevision) { assembly { _lastInitializedRevision := sload(LAST_INITIALIZED_REVISION_SLOT) } } function setLastInitializedRevision(uint256 newLastInitializedRevision) internal { assembly { sstore(LAST_INITIALIZED_REVISION_SLOT, newLastInitializedRevision) } } function getTreasuryData() internal pure returns (Types.TreasuryData storage _treasuryData) { assembly { _treasuryData.slot := TREASURY_DATA_SLOT } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; library Errors { error CannotInitImplementation(); error Initialized(); error SignatureExpired(); error SignatureInvalid(); error InvalidOwner(); error NotOwnerOrApproved(); error NotHub(); error TokenDoesNotExist(); error NotGovernance(); error NotGovernanceOrEmergencyAdmin(); error EmergencyAdminCanOnlyPauseFurther(); error NotProfileOwner(); error PublicationDoesNotExist(); error CallerNotFollowNFT(); error CallerNotCollectNFT(); // Legacy error ArrayMismatch(); error NotWhitelisted(); error NotRegistered(); error InvalidParameter(); error ExecutorInvalid(); error Blocked(); error SelfBlock(); error NotFollowing(); error SelfFollow(); error InvalidReferrer(); error InvalidPointedPub(); error NonERC721ReceiverImplementer(); error AlreadyEnabled(); // Module Errors error InitParamsInvalid(); error ActionNotAllowed(); error CollectNotAllowed(); // Used in LegacyCollectLib (pending deprecation) // MultiState Errors error Paused(); error PublishingPaused(); // Profile Guardian Errors error GuardianEnabled(); error NotEOA(); error DisablingAlreadyTriggered(); // Migration Errors error NotMigrationAdmin(); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; library Events { /** * @dev Emitted when the NFT contract's name and symbol are set at initialization. * * @param name The NFT name set. * @param symbol The NFT symbol set. * @param timestamp The current block timestamp. */ event BaseInitialized(string name, string symbol, uint256 timestamp); /** * @dev Emitted when the hub state is set. * * @param caller The caller who set the state. * @param prevState The previous protocol state, an enum of either `Paused`, `PublishingPaused` or `Unpaused`. * @param newState The newly set state, an enum of either `Paused`, `PublishingPaused` or `Unpaused`. * @param timestamp The current block timestamp. */ event StateSet( address indexed caller, Types.ProtocolState indexed prevState, Types.ProtocolState indexed newState, uint256 timestamp ); /** * @dev Emitted when the governance address is changed. We emit the caller even though it should be the previous * governance address, as we cannot guarantee this will always be the case due to upgradeability. * * @param caller The caller who set the governance address. * @param prevGovernance The previous governance address. * @param newGovernance The new governance address set. * @param timestamp The current block timestamp. */ event GovernanceSet( address indexed caller, address indexed prevGovernance, address indexed newGovernance, uint256 timestamp ); /** * @dev Emitted when the emergency admin is changed. We emit the caller even though it should be the previous * governance address, as we cannot guarantee this will always be the case due to upgradeability. * * @param caller The caller who set the emergency admin address. * @param oldEmergencyAdmin The previous emergency admin address. * @param newEmergencyAdmin The new emergency admin address set. * @param timestamp The current block timestamp. */ event EmergencyAdminSet( address indexed caller, address indexed oldEmergencyAdmin, address indexed newEmergencyAdmin, uint256 timestamp ); /** * @dev Emitted when a profile creator is added to or removed from the whitelist. * * @param profileCreator The address of the profile creator. * @param whitelisted Whether or not the profile creator is being added to the whitelist. * @param timestamp The current block timestamp. */ event ProfileCreatorWhitelisted(address indexed profileCreator, bool indexed whitelisted, uint256 timestamp); /** * @dev Emitted when a profile is created. * * @param profileId The newly created profile's token ID. * @param creator The profile creator, who created the token with the given profile ID. * @param to The address receiving the profile with the given profile ID. * @param timestamp The current block timestamp. */ event ProfileCreated(uint256 indexed profileId, address indexed creator, address indexed to, uint256 timestamp); /** * @dev Emitted when a delegated executors configuration is changed. * * @param delegatorProfileId The ID of the profile for which the delegated executor was changed. * @param configNumber The number of the configuration where the executor approval state was set. * @param delegatedExecutors The array of delegated executors whose approval was set for. * @param approvals The array of booleans indicating the corresponding executor new approval status. * @param timestamp The current block timestamp. */ event DelegatedExecutorsConfigChanged( uint256 indexed delegatorProfileId, uint256 indexed configNumber, address[] delegatedExecutors, bool[] approvals, uint256 timestamp ); /** * @dev Emitted when a delegated executors configuration is applied. * * @param delegatorProfileId The ID of the profile applying the configuration. * @param configNumber The number of the configuration applied. * @param timestamp The current block timestamp. */ event DelegatedExecutorsConfigApplied( uint256 indexed delegatorProfileId, uint256 indexed configNumber, uint256 timestamp ); /** * @dev Emitted when a profile's follow module is set. * * @param profileId The profile's token ID. * @param followModule The profile's newly set follow module. This CAN be the zero address. * @param followModuleInitData The data passed to the follow module, if any. * @param followModuleReturnData The data returned from the follow module's initialization. This is ABI-encoded * and depends on the follow module chosen. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event FollowModuleSet( uint256 indexed profileId, address followModule, bytes followModuleInitData, bytes followModuleReturnData, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted when a post is successfully published. * * @param postParams The parameters passed to create the post publication. * @param pubId The publication ID assigned to the created post. * @param actionModulesInitReturnDatas The data returned from the action modules' initialization for this given * publication. This is ABI-encoded and depends on the action module chosen. * @param referenceModuleInitReturnData The data returned from the reference module at initialization. This is * ABI-encoded and depends on the reference module chosen. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event PostCreated( Types.PostParams postParams, uint256 indexed pubId, bytes[] actionModulesInitReturnDatas, bytes referenceModuleInitReturnData, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted when a comment is successfully published. * * @param commentParams The parameters passed to create the comment publication. * @param pubId The publication ID assigned to the created comment. * @param referenceModuleReturnData The data returned by the commented publication reference module's * processComment function, if the commented publication has a reference module set. * @param actionModulesInitReturnDatas The data returned from the action modules' initialization for this given * publication. This is ABI-encoded and depends on the action module chosen. * @param referenceModuleInitReturnData The data returned from the reference module at initialization. This is * ABI-encoded and depends on the reference module chosen. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event CommentCreated( Types.CommentParams commentParams, uint256 indexed pubId, bytes referenceModuleReturnData, bytes[] actionModulesInitReturnDatas, bytes referenceModuleInitReturnData, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted when a mirror is successfully published. * * @param mirrorParams The parameters passed to create the mirror publication. * @param pubId The publication ID assigned to the created mirror. * @param referenceModuleReturnData The data returned by the mirrored publication reference module's * processMirror function, if the mirrored publication has a reference module set. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event MirrorCreated( Types.MirrorParams mirrorParams, uint256 indexed pubId, bytes referenceModuleReturnData, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted when a quote is successfully published. * * @param quoteParams The parameters passed to create the quote publication. * @param pubId The publication ID assigned to the created quote. * @param referenceModuleReturnData The data returned by the quoted publication reference module's * processQuote function, if the quoted publication has a reference module set. * @param actionModulesInitReturnDatas The data returned from the action modules' initialization for this given * publication. This is ABI-encoded and depends on the action module chosen. * @param referenceModuleInitReturnData The data returned from the reference module at initialization. This is * ABI-encoded and depends on the reference module chosen. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event QuoteCreated( Types.QuoteParams quoteParams, uint256 indexed pubId, bytes referenceModuleReturnData, bytes[] actionModulesInitReturnDatas, bytes referenceModuleInitReturnData, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted when a followNFT clone is deployed using a lazy deployment pattern. * * @param profileId The token ID of the profile to which this followNFT is associated. * @param followNFT The address of the newly deployed followNFT clone. * @param timestamp The current block timestamp. */ event FollowNFTDeployed(uint256 indexed profileId, address indexed followNFT, uint256 timestamp); /** * @dev Emitted when a collectNFT clone is deployed using a lazy deployment pattern. * * @param profileId The publisher's profile token ID. * @param pubId The publication associated with the newly deployed collectNFT clone's ID. * @param collectNFT The address of the newly deployed collectNFT clone. * @param timestamp The current block timestamp. */ event LegacyCollectNFTDeployed( uint256 indexed profileId, uint256 indexed pubId, address indexed collectNFT, uint256 timestamp ); /** * @dev Emitted upon a successful action. * * @param publicationActionParams The parameters passed to act on a publication. * @param actionModuleReturnData The data returned from the action modules. This is ABI-encoded and the format * depends on the action module chosen. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event Acted( Types.PublicationActionParams publicationActionParams, bytes actionModuleReturnData, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted upon a successful follow operation. * * @param followerProfileId The ID of the profile that executed the follow. * @param idOfProfileFollowed The ID of the profile that was followed. * @param followTokenIdAssigned The ID of the follow token assigned to the follower. * @param followModuleData The data to pass to the follow module, if any. * @param processFollowModuleReturnData The data returned by the followed profile follow module's processFollow * function, if the followed profile has a reference module set. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The timestamp of the follow operation. */ event Followed( uint256 indexed followerProfileId, uint256 idOfProfileFollowed, uint256 followTokenIdAssigned, bytes followModuleData, bytes processFollowModuleReturnData, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted upon a successful unfollow operation. * * @param unfollowerProfileId The ID of the profile that executed the unfollow. * @param idOfProfileUnfollowed The ID of the profile that was unfollowed. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The timestamp of the unfollow operation. */ event Unfollowed( uint256 indexed unfollowerProfileId, uint256 idOfProfileUnfollowed, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted upon a successful block, through a block status setting operation. * * @param byProfileId The ID of the profile that executed the block status change. * @param idOfProfileBlocked The ID of the profile whose block status have been set to blocked. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The timestamp of the block operation. */ event Blocked( uint256 indexed byProfileId, uint256 idOfProfileBlocked, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted upon a successful unblock, through a block status setting operation. * * @param byProfileId The ID of the profile that executed the block status change. * @param idOfProfileUnblocked The ID of the profile whose block status have been set to unblocked. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The timestamp of the unblock operation. */ event Unblocked( uint256 indexed byProfileId, uint256 idOfProfileUnblocked, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted via callback when a collectNFT is transferred. * * @param profileId The token ID of the profile associated with the collectNFT being transferred. * @param pubId The publication ID associated with the collectNFT being transferred. * @param collectNFTId The collectNFT being transferred's token ID. * @param from The address the collectNFT is being transferred from. * @param to The address the collectNFT is being transferred to. * @param timestamp The current block timestamp. */ event CollectNFTTransferred( uint256 indexed profileId, uint256 indexed pubId, uint256 indexed collectNFTId, address from, address to, uint256 timestamp ); /** * @notice Emitted when the treasury address is set. * * @param prevTreasury The previous treasury address. * @param newTreasury The new treasury address set. * @param timestamp The current block timestamp. */ event TreasurySet(address indexed prevTreasury, address indexed newTreasury, uint256 timestamp); /** * @notice Emitted when the treasury fee is set. * * @param prevTreasuryFee The previous treasury fee in BPS. * @param newTreasuryFee The new treasury fee in BPS. * @param timestamp The current block timestamp. */ event TreasuryFeeSet(uint16 indexed prevTreasuryFee, uint16 indexed newTreasuryFee, uint256 timestamp); /** * @dev Emitted when the metadata associated with a profile is set in the `LensPeriphery`. * * @param profileId The profile ID the metadata is set for. * @param metadata The metadata set for the profile and user. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event ProfileMetadataSet( uint256 indexed profileId, string metadata, address transactionExecutor, uint256 timestamp ); /** * @dev Emitted when an address' Profile Guardian state change is triggered. * * @param wallet The address whose Token Guardian state change is being triggered. * @param enabled True if the Token Guardian is being enabled, false if it is being disabled. * @param tokenGuardianDisablingTimestamp The UNIX timestamp when disabling the Token Guardian will take effect, * if disabling it. Zero if the protection is being enabled. * @param timestamp The UNIX timestamp of the change being triggered. */ event TokenGuardianStateChanged( address indexed wallet, bool indexed enabled, uint256 tokenGuardianDisablingTimestamp, uint256 timestamp ); /** * @dev Emitted when a signer's nonce is used and, as a consequence, the next available nonce is updated. * * @param signer The signer whose next available nonce was updated. * @param nonce The next available nonce that can be used to execute a meta-tx successfully. * @param timestamp The UNIX timestamp of the nonce being used. */ event NonceUpdated(address indexed signer, uint256 nonce, uint256 timestamp); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; library Typehash { bytes32 constant ACT = keccak256('Act(uint256 publicationActedProfileId,uint256 publicationActedId,uint256 actorProfileId,uint256[] referrerProfileIds,uint256[] referrerPubIds,address actionModuleAddress,bytes actionModuleData,uint256 nonce,uint256 deadline)'); bytes32 constant CHANGE_DELEGATED_EXECUTORS_CONFIG = keccak256('ChangeDelegatedExecutorsConfig(uint256 delegatorProfileId,address[] delegatedExecutors,bool[] approvals,uint64 configNumber,bool switchToGivenConfig,uint256 nonce,uint256 deadline)'); bytes32 constant COLLECT_LEGACY = keccak256('CollectLegacy(uint256 publicationCollectedProfileId,uint256 publicationCollectedId,uint256 collectorProfileId,uint256 referrerProfileId,uint256 referrerPubId,bytes collectModuleData,uint256 nonce,uint256 deadline)'); bytes32 constant COMMENT = keccak256('Comment(uint256 profileId,string contentURI,uint256 pointedProfileId,uint256 pointedPubId,uint256[] referrerProfileIds,uint256[] referrerPubIds,bytes referenceModuleData,address[] actionModules,bytes[] actionModulesInitDatas,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'); bytes32 constant EIP712_DOMAIN = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'); bytes32 constant FOLLOW = keccak256('Follow(uint256 followerProfileId,uint256[] idsOfProfilesToFollow,uint256[] followTokenIds,bytes[] datas,uint256 nonce,uint256 deadline)'); bytes32 constant MIRROR = keccak256('Mirror(uint256 profileId,string metadataURI,uint256 pointedProfileId,uint256 pointedPubId,uint256[] referrerProfileIds,uint256[] referrerPubIds,bytes referenceModuleData,uint256 nonce,uint256 deadline)'); bytes32 constant POST = keccak256('Post(uint256 profileId,string contentURI,address[] actionModules,bytes[] actionModulesInitDatas,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'); bytes32 constant QUOTE = keccak256('Quote(uint256 profileId,string contentURI,uint256 pointedProfileId,uint256 pointedPubId,uint256[] referrerProfileIds,uint256[] referrerPubIds,bytes referenceModuleData,address[] actionModules,bytes[] actionModulesInitDatas,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)'); bytes32 constant SET_BLOCK_STATUS = keccak256('SetBlockStatus(uint256 byProfileId,uint256[] idsOfProfilesToSetBlockStatus,bool[] blockStatus,uint256 nonce,uint256 deadline)'); bytes32 constant SET_FOLLOW_MODULE = keccak256('SetFollowModule(uint256 profileId,address followModule,bytes followModuleInitData,uint256 nonce,uint256 deadline)'); bytes32 constant SET_PROFILE_METADATA_URI = keccak256('SetProfileMetadataURI(uint256 profileId,string metadataURI,uint256 nonce,uint256 deadline)'); bytes32 constant UNFOLLOW = keccak256('Unfollow(uint256 unfollowerProfileId,uint256[] idsOfProfilesToUnfollow,uint256 nonce,uint256 deadline)'); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title Types * @author Lens Protocol * * @notice A standard library of data types used throughout the Lens Protocol. */ library Types { /** * @notice ERC721Timestamped storage. Contains the owner address and the mint timestamp for every NFT. * * Note: Instead of the owner address in the _tokenOwners private mapping, we now store it in the * _tokenData mapping, alongside the mint timestamp. * * @param owner The token owner. * @param mintTimestamp The mint timestamp. */ struct TokenData { address owner; uint96 mintTimestamp; } /** * @notice A struct containing token follow-related data. * * @param followerProfileId The ID of the profile using the token to follow. * @param originalFollowTimestamp The timestamp of the first follow performed with the token. * @param followTimestamp The timestamp of the current follow, if a profile is using the token to follow. * @param profileIdAllowedToRecover The ID of the profile allowed to recover the follow ID, if any. */ struct FollowData { uint160 followerProfileId; uint48 originalFollowTimestamp; uint48 followTimestamp; uint256 profileIdAllowedToRecover; } /** * @notice An enum containing the different states the protocol can be in, limiting certain actions. * * @param Unpaused The fully unpaused state. * @param PublishingPaused The state where only publication creation functions are paused. * @param Paused The fully paused state. */ enum ProtocolState { Unpaused, PublishingPaused, Paused } /** * @notice An enum specifically used in a helper function to easily retrieve the publication type for integrations. * * @param Nonexistent An indicator showing the queried publication does not exist. * @param Post A standard post, having an URI, action modules and no pointer to another publication. * @param Comment A comment, having an URI, action modules and a pointer to another publication. * @param Mirror A mirror, having a pointer to another publication, but no URI or action modules. * @param Quote A quote, having an URI, action modules, and a pointer to another publication. */ enum PublicationType { Nonexistent, Post, Comment, Mirror, Quote } /** * @notice A struct containing the necessary information to reconstruct an EIP-712 typed data signature. * * @param signer The address of the signer. Specially needed as a parameter to support EIP-1271. * @param v The signature's recovery parameter. * @param r The signature's r parameter. * @param s The signature's s parameter. * @param deadline The signature's deadline. */ struct EIP712Signature { address signer; uint8 v; bytes32 r; bytes32 s; uint256 deadline; } /** * @notice A struct containing profile data. * * @param pubCount The number of publications made to this profile. * @param followModule The address of the current follow module in use by this profile, can be address(0) in none. * @param followNFT The address of the followNFT associated with this profile. It can be address(0) if the * profile has not been followed yet, as the collection is lazy-deployed upon the first follow. * @param __DEPRECATED__handle DEPRECATED in V2: handle slot, was replaced with LensHandles. * @param __DEPRECATED__imageURI DEPRECATED in V2: The URI to be used for the profile image. * @param __DEPRECATED__followNFTURI DEPRECATED in V2: The URI used for the follow NFT image. * @param metadataURI MetadataURI is used to store the profile's metadata, for example: displayed name, description, * interests, etc. */ struct Profile { uint256 pubCount; // offset 0 address followModule; // offset 1 address followNFT; // offset 2 string __DEPRECATED__handle; // offset 3 string __DEPRECATED__imageURI; // offset 4 string __DEPRECATED__followNFTURI; // Deprecated in V2 as we have a common tokenURI for all Follows, offset 5 string metadataURI; // offset 6 } /** * @notice A struct containing publication data. * * @param pointedProfileId The profile token ID to point the publication to. * @param pointedPubId The publication ID to point the publication to. * These are used to implement the "reference" feature of the platform and is used in: * - Mirrors * - Comments * - Quotes * There are (0,0) if the publication is not pointing to any other publication (i.e. the publication is a Post). * @param contentURI The URI to set for the content of publication (can be ipfs, arweave, http, etc). * @param referenceModule Reference module associated with this profile, if any. * @param __DEPRECATED__collectModule Collect module associated with this publication, if any. Deprecated in V2. * @param __DEPRECATED__collectNFT Collect NFT associated with this publication, if any. Deprecated in V2. * @param pubType The type of publication, can be Nonexistent, Post, Comment, Mirror or Quote. * @param rootProfileId The profile ID of the root post (to determine if comments/quotes and mirrors come from it). * Posts, V1 publications and publications rooted in V1 publications don't have it set. * @param rootPubId The publication ID of the root post (to determine if comments/quotes and mirrors come from it). * Posts, V1 publications and publications rooted in V1 publications don't have it set. * @param actionModuleEnabled The action modules enabled in a given publication. */ struct Publication { uint256 pointedProfileId; uint256 pointedPubId; string contentURI; address referenceModule; address __DEPRECATED__collectModule; // Deprecated in V2 address __DEPRECATED__collectNFT; // Deprecated in V2 // Added in Lens V2, so these will be zero for old publications: PublicationType pubType; uint256 rootProfileId; uint256 rootPubId; mapping(address => bool) actionModuleEnabled; } struct PublicationMemory { uint256 pointedProfileId; uint256 pointedPubId; string contentURI; address referenceModule; address __DEPRECATED__collectModule; // Deprecated in V2 address __DEPRECATED__collectNFT; // Deprecated in V2 // Added in Lens V2, so these will be zero for old publications: PublicationType pubType; uint256 rootProfileId; uint256 rootPubId; // bytes32 __ACTION_MODULE_ENABLED_MAPPING; // Mappings are not supported in memory. } /** * @notice A struct containing the parameters required for the `createProfile()` function. * * @param to The address receiving the profile. * @param followModule The follow module to use, can be the zero address. * @param followModuleInitData The follow module initialization data, if any. */ struct CreateProfileParams { address to; address followModule; bytes followModuleInitData; } /** * @notice A struct containing the parameters required for the `post()` function. * * @param profileId The token ID of the profile to publish to. * @param contentURI The URI to set for this new publication. * @param actionModules The action modules to set for this new publication. * @param actionModulesInitDatas The data to pass to the action modules' initialization. * @param referenceModule The reference module to set for the given publication, must be whitelisted. * @param referenceModuleInitData The data to be passed to the reference module for initialization. */ struct PostParams { uint256 profileId; string contentURI; address[] actionModules; bytes[] actionModulesInitDatas; address referenceModule; bytes referenceModuleInitData; } /** * @notice A struct containing the parameters required for the `comment()` function. * * @param profileId The token ID of the profile to publish to. * @param contentURI The URI to set for this new publication. * @param pointedProfileId The profile token ID to point the comment to. * @param pointedPubId The publication ID to point the comment to. * @param referrerProfileId The profile token ID of the publication that referred to the publication being commented on/quoted. * @param referrerPubId The ID of the publication that referred to the publication being commented on/quoted. * @param referenceModuleData The data passed to the reference module. * @param actionModules The action modules to set for this new publication. * @param actionModulesInitDatas The data to pass to the action modules' initialization. * @param referenceModule The reference module to set for the given publication, must be whitelisted. * @param referenceModuleInitData The data to be passed to the reference module for initialization. */ struct CommentParams { uint256 profileId; string contentURI; uint256 pointedProfileId; uint256 pointedPubId; uint256[] referrerProfileIds; uint256[] referrerPubIds; bytes referenceModuleData; address[] actionModules; bytes[] actionModulesInitDatas; address referenceModule; bytes referenceModuleInitData; } /** * @notice A struct containing the parameters required for the `quote()` function. * * @param profileId The token ID of the profile to publish to. * @param contentURI The URI to set for this new publication. * @param pointedProfileId The profile token ID of the publication author that is quoted. * @param pointedPubId The publication ID that is quoted. * @param referrerProfileId The profile token ID of the publication that referred to the publication being commented on/quoted. * @param referrerPubId The ID of the publication that referred to the publication being commented on/quoted. * @param referenceModuleData The data passed to the reference module. * @param actionModules The action modules to set for this new publication. * @param actionModulesInitDatas The data to pass to the action modules' initialization. * @param referenceModule The reference module to set for the given publication, must be whitelisted. * @param referenceModuleInitData The data to be passed to the reference module for initialization. */ struct QuoteParams { uint256 profileId; string contentURI; uint256 pointedProfileId; uint256 pointedPubId; uint256[] referrerProfileIds; uint256[] referrerPubIds; bytes referenceModuleData; address[] actionModules; bytes[] actionModulesInitDatas; address referenceModule; bytes referenceModuleInitData; } /** * @notice A struct containing the parameters required for the `comment()` or `quote()` internal functions. * * @param profileId The token ID of the profile to publish to. * @param contentURI The URI to set for this new publication. * @param pointedProfileId The profile token ID of the publication author that is commented on/quoted. * @param pointedPubId The publication ID that is commented on/quoted. * @param referrerProfileId The profile token ID of the publication that referred to the publication being commented on/quoted. * @param referrerPubId The ID of the publication that referred to the publication being commented on/quoted. * @param referenceModuleData The data passed to the reference module. * @param actionModules The action modules to set for this new publication. * @param actionModulesInitDatas The data to pass to the action modules' initialization. * @param referenceModule The reference module to set for the given publication, must be whitelisted. * @param referenceModuleInitData The data to be passed to the reference module for initialization. */ struct ReferencePubParams { uint256 profileId; string contentURI; uint256 pointedProfileId; uint256 pointedPubId; uint256[] referrerProfileIds; uint256[] referrerPubIds; bytes referenceModuleData; address[] actionModules; bytes[] actionModulesInitDatas; address referenceModule; bytes referenceModuleInitData; } /** * @notice A struct containing the parameters required for the `mirror()` function. * * @param profileId The token ID of the profile to publish to. * @param metadataURI the URI containing metadata attributes to attach to this mirror publication. * @param pointedProfileId The profile token ID to point the mirror to. * @param pointedPubId The publication ID to point the mirror to. * @param referenceModuleData The data passed to the reference module. */ struct MirrorParams { uint256 profileId; string metadataURI; uint256 pointedProfileId; uint256 pointedPubId; uint256[] referrerProfileIds; uint256[] referrerPubIds; bytes referenceModuleData; } /** * Deprecated in V2: Will be removed after some time after upgrading to V2. * @notice A struct containing the parameters required for the legacy `collect()` function. * @dev The referrer can only be a mirror of the publication being collected. * * @param publicationCollectedProfileId The token ID of the profile that published the publication to collect. * @param publicationCollectedId The publication to collect's publication ID. * @param collectorProfileId The collector profile. * @param referrerProfileId The ID of a profile that authored a mirror that helped discovering the collected pub. * @param referrerPubId The ID of the mirror that helped discovering the collected pub. * @param collectModuleData The arbitrary data to pass to the collectModule if needed. */ struct LegacyCollectParams { uint256 publicationCollectedProfileId; uint256 publicationCollectedId; uint256 collectorProfileId; uint256 referrerProfileId; uint256 referrerPubId; bytes collectModuleData; } /** * @notice A struct containing the parameters required for the `action()` function. * * @param publicationActedProfileId The token ID of the profile that published the publication to action. * @param publicationActedId The publication to action's publication ID. * @param actorProfileId The actor profile. * @param referrerProfileId * @param referrerPubId * @param actionModuleAddress * @param actionModuleData The arbitrary data to pass to the actionModule if needed. */ struct PublicationActionParams { uint256 publicationActedProfileId; uint256 publicationActedId; uint256 actorProfileId; uint256[] referrerProfileIds; uint256[] referrerPubIds; address actionModuleAddress; bytes actionModuleData; } struct ProcessActionParams { uint256 publicationActedProfileId; uint256 publicationActedId; uint256 actorProfileId; address actorProfileOwner; address transactionExecutor; uint256[] referrerProfileIds; uint256[] referrerPubIds; Types.PublicationType[] referrerPubTypes; bytes actionModuleData; } struct ProcessCommentParams { uint256 profileId; uint256 pubId; address transactionExecutor; uint256 pointedProfileId; uint256 pointedPubId; uint256[] referrerProfileIds; uint256[] referrerPubIds; Types.PublicationType[] referrerPubTypes; bytes data; } struct ProcessQuoteParams { uint256 profileId; uint256 pubId; address transactionExecutor; uint256 pointedProfileId; uint256 pointedPubId; uint256[] referrerProfileIds; uint256[] referrerPubIds; Types.PublicationType[] referrerPubTypes; bytes data; } struct ProcessMirrorParams { uint256 profileId; uint256 pubId; address transactionExecutor; uint256 pointedProfileId; uint256 pointedPubId; uint256[] referrerProfileIds; uint256[] referrerPubIds; Types.PublicationType[] referrerPubTypes; bytes data; } /** * @notice A struct containing a profile's delegated executors configuration. * * @param isApproved Tells when an address is approved as delegated executor in the given configuration number. * @param configNumber Current configuration number in use. * @param prevConfigNumber Previous configuration number set, before switching to the current one. * @param maxConfigNumberSet Maximum configuration number ever used. */ struct DelegatedExecutorsConfig { mapping(uint256 => mapping(address => bool)) isApproved; // isApproved[configNumber][delegatedExecutor] uint64 configNumber; uint64 prevConfigNumber; uint64 maxConfigNumberSet; } struct TreasuryData { address treasury; uint16 treasuryFeeBPS; } struct MigrationParams { address lensHandlesAddress; address tokenHandleRegistryAddress; address legacyFeeFollowModule; address legacyProfileFollowModule; address newFeeFollowModule; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {ILensModule} from 'contracts/modules/interfaces/ILensModule.sol'; abstract contract LensModule is ILensModule { /// @inheritdoc ILensModule function supportsInterface(bytes4 interfaceID) public pure virtual override returns (bool) { return interfaceID == bytes4(keccak256(abi.encodePacked('LENS_MODULE'))); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {LensModule} from 'contracts/modules/LensModule.sol'; contract LensModuleMetadata is LensModule, Ownable { string public metadataURI; constructor(address owner_) Ownable() { _transferOwnership(owner_); } function setModuleMetadataURI(string memory _metadataURI) external onlyOwner { metadataURI = _metadataURI; } function getModuleMetadataURI() external view returns (string memory) { return metadataURI; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {LensModuleMetadata} from 'contracts/modules/LensModuleMetadata.sol'; contract LensModuleMetadataInitializable is LensModuleMetadata { constructor(address owner_) LensModuleMetadata(owner_) {} function initialize(address moduleOwner) external virtual { if (owner() != address(0) || moduleOwner == address(0)) { revert(); } _transferOwnership(moduleOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {IPublicationActionModule} from 'contracts/interfaces/IPublicationActionModule.sol'; import {ICollectModule} from 'contracts/modules/interfaces/ICollectModule.sol'; import {ICollectNFT} from 'contracts/interfaces/ICollectNFT.sol'; import {Types} from 'contracts/libraries/constants/Types.sol'; import {ModuleTypes} from 'contracts/modules/libraries/constants/ModuleTypes.sol'; import {Clones} from '@openzeppelin/contracts/proxy/Clones.sol'; import {Errors} from 'contracts/modules/constants/Errors.sol'; import {HubRestricted} from 'contracts/base/HubRestricted.sol'; import {ILensModule} from 'contracts/modules/interfaces/ILensModule.sol'; import {LensModuleMetadataInitializable} from 'contracts/modules/LensModuleMetadataInitializable.sol'; /** * @title CollectPublicationAction * @author LensProtocol * @notice An Publication Action module that allows users to collect publications. * @custom:upgradeable Transparent upgradeable proxy without initializer. */ contract CollectPublicationAction is LensModuleMetadataInitializable, HubRestricted, IPublicationActionModule { function supportsInterface(bytes4 interfaceID) public pure override returns (bool) { return interfaceID == type(IPublicationActionModule).interfaceId || super.supportsInterface(interfaceID); } struct CollectData { address collectModule; address collectNFT; } event CollectModuleRegistered(address collectModule, string metadata, uint256 timestamp); /** * @dev Emitted when a collectNFT clone is deployed using a lazy deployment pattern. * * @param profileId The publisher's profile token ID. * @param pubId The publication associated with the newly deployed collectNFT clone's ID. * @param collectNFT The address of the newly deployed collectNFT clone. * @param timestamp The current block timestamp. */ event CollectNFTDeployed( uint256 indexed profileId, uint256 indexed pubId, address indexed collectNFT, uint256 timestamp ); /** * @dev Emitted upon a successful collect action. * * @param collectedProfileId The token ID of the profile that published the collected publication. * @param collectedPubId The ID of the collected publication. * @param collectorProfileId The token ID of the profile that collected the publication. * @param nftRecipient The address that received the collect NFT. * @param collectActionData The custom data passed to the collect module, if any. * @param collectActionResult The data returned from the collect module's collect action. This is ABI-encoded * and depends on the collect module chosen. * @param collectNFT The address of the NFT collection where the minted collect NFT belongs to. * @param tokenId The token ID of the collect NFT that was minted as a collect of the publication. * @param transactionExecutor The address of the account that executed this operation. * @param timestamp The current block timestamp. */ event Collected( uint256 indexed collectedProfileId, uint256 indexed collectedPubId, uint256 indexed collectorProfileId, address nftRecipient, bytes collectActionData, bytes collectActionResult, address collectNFT, uint256 tokenId, address transactionExecutor, uint256 timestamp ); error NotCollectModule(); address public immutable COLLECT_NFT_IMPL; mapping(address collectModule => bool isWhitelisted) internal _collectModuleRegistered; mapping(uint256 profileId => mapping(uint256 pubId => CollectData collectData)) internal _collectDataByPub; constructor( address hub, address collectNFTImpl, address moduleOwner ) HubRestricted(hub) LensModuleMetadataInitializable(moduleOwner) { COLLECT_NFT_IMPL = collectNFTImpl; } function verifyCollectModule(address collectModule) public returns (bool) { registerCollectModule(collectModule); return true; } function registerCollectModule(address collectModule) public returns (bool) { if (_collectModuleRegistered[collectModule]) { return false; } else { if (!ILensModule(collectModule).supportsInterface(type(ICollectModule).interfaceId)) { revert NotCollectModule(); } string memory metadata = ILensModule(collectModule).getModuleMetadataURI(); emit CollectModuleRegistered(collectModule, metadata, block.timestamp); _collectModuleRegistered[collectModule] = true; return true; } } function initializePublicationAction( uint256 profileId, uint256 pubId, address transactionExecutor, bytes calldata data ) external override onlyHub returns (bytes memory) { (address collectModule, bytes memory collectModuleInitData) = abi.decode(data, (address, bytes)); if (_collectDataByPub[profileId][pubId].collectModule != address(0)) { revert Errors.AlreadyInitialized(); } verifyCollectModule(collectModule); _collectDataByPub[profileId][pubId].collectModule = collectModule; ICollectModule(collectModule).initializePublicationCollectModule( profileId, pubId, transactionExecutor, collectModuleInitData ); return ''; } function processPublicationAction( Types.ProcessActionParams calldata processActionParams ) external override onlyHub returns (bytes memory) { address collectModule = _collectDataByPub[processActionParams.publicationActedProfileId][ processActionParams.publicationActedId ].collectModule; if (collectModule == address(0)) { revert Errors.CollectNotAllowed(); } address collectNFT = _getOrDeployCollectNFT({ publicationCollectedProfileId: processActionParams.publicationActedProfileId, publicationCollectedId: processActionParams.publicationActedId, collectNFTImpl: COLLECT_NFT_IMPL }); (address collectNftRecipient, bytes memory collectData) = abi.decode( processActionParams.actionModuleData, (address, bytes) ); uint256 tokenId = ICollectNFT(collectNFT).mint(collectNftRecipient); bytes memory collectActionResult = _processCollect(collectModule, collectData, processActionParams); _emitCollectedEvent( processActionParams, collectNftRecipient, collectData, collectActionResult, collectNFT, tokenId ); return abi.encode(collectNFT, tokenId, collectModule, collectActionResult); } function _emitCollectedEvent( Types.ProcessActionParams calldata processActionParams, address collectNftRecipient, bytes memory collectData, bytes memory collectActionResult, address collectNFT, uint256 tokenId ) private { emit Collected({ collectedProfileId: processActionParams.publicationActedProfileId, collectedPubId: processActionParams.publicationActedId, collectorProfileId: processActionParams.actorProfileId, nftRecipient: collectNftRecipient, collectActionData: collectData, collectActionResult: collectActionResult, collectNFT: collectNFT, tokenId: tokenId, transactionExecutor: processActionParams.transactionExecutor, timestamp: block.timestamp }); } function getCollectData(uint256 profileId, uint256 pubId) external view returns (CollectData memory) { return _collectDataByPub[profileId][pubId]; } function _getOrDeployCollectNFT( uint256 publicationCollectedProfileId, uint256 publicationCollectedId, address collectNFTImpl ) private returns (address) { address collectNFT = _collectDataByPub[publicationCollectedProfileId][publicationCollectedId].collectNFT; if (collectNFT == address(0)) { collectNFT = _deployCollectNFT(publicationCollectedProfileId, publicationCollectedId, collectNFTImpl); _collectDataByPub[publicationCollectedProfileId][publicationCollectedId].collectNFT = collectNFT; } return collectNFT; } function _processCollect( address collectModule, bytes memory collectData, Types.ProcessActionParams calldata processActionParams ) private returns (bytes memory) { return ICollectModule(collectModule).processCollect( ModuleTypes.ProcessCollectParams({ publicationCollectedProfileId: processActionParams.publicationActedProfileId, publicationCollectedId: processActionParams.publicationActedId, collectorProfileId: processActionParams.actorProfileId, collectorProfileOwner: processActionParams.actorProfileOwner, transactionExecutor: processActionParams.transactionExecutor, referrerProfileIds: processActionParams.referrerProfileIds, referrerPubIds: processActionParams.referrerPubIds, referrerPubTypes: processActionParams.referrerPubTypes, data: collectData }) ); } function _deployCollectNFT(uint256 profileId, uint256 pubId, address collectNFTImpl) private returns (address) { address collectNFT = Clones.clone(collectNFTImpl); ICollectNFT(collectNFT).initialize(profileId, pubId); emit CollectNFTDeployed(profileId, pubId, collectNFT, block.timestamp); return collectNFT; } function isCollectModuleRegistered(address collectModule) external view returns (bool) { return _collectModuleRegistered[collectModule]; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; library Errors { error FollowInvalid(); error ModuleDataMismatch(); error NotHub(); error InitParamsInvalid(); error InvalidParams(); error MintLimitExceeded(); error CollectExpired(); error NotActionModule(); error CollectNotAllowed(); error AlreadyInitialized(); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ICollectModule} from 'contracts/modules/interfaces/ICollectModule.sol'; import {ModuleTypes} from 'contracts/modules/libraries/constants/ModuleTypes.sol'; /** * @notice A struct containing the necessary data to execute collect actions on a publication. * * @param amount The collecting cost associated with this publication. 0 for free collect. * @param collectLimit The maximum number of collects for this publication. 0 for no limit. * @param currency The currency associated with this publication. * @param currentCollects The current number of collects for this publication. * @param referralFee The referral fee associated with this publication. * @param followerOnly True if only followers of publisher may collect the post. * @param endTimestamp The end timestamp after which collecting is impossible. 0 for no expiry. * @param recipient Recipient of collect fees. */ struct BaseProfilePublicationData { uint160 amount; uint96 collectLimit; address currency; uint96 currentCollects; address recipient; uint16 referralFee; bool followerOnly; uint72 endTimestamp; } /** * @notice A struct containing the necessary data to initialize this Base Collect Module. * * @param amount The collecting cost associated with this publication. 0 for free collect. * @param collectLimit The maximum number of collects for this publication. 0 for no limit. * @param currency The currency associated with this publication. * @param referralFee The referral fee associated with this publication. * @param followerOnly True if only followers of publisher may collect the post. * @param endTimestamp The end timestamp after which collecting is impossible. 0 for no expiry. * @param recipient Recipient of collect fees. */ struct BaseFeeCollectModuleInitData { uint160 amount; uint96 collectLimit; address currency; uint16 referralFee; bool followerOnly; uint72 endTimestamp; address recipient; } interface IBaseFeeCollectModule is ICollectModule { /** * @notice Returns the Base publication data for a given publication, or an empty struct if that publication was not * initialized with this module. * * @param profileId The token ID of the profile mapped to the publication to query. * @param pubId The publication ID of the publication to query. * * @return The BaseProfilePublicationData struct mapped to that publication. */ function getBasePublicationData( uint256 profileId, uint256 pubId ) external view returns (BaseProfilePublicationData memory); /** * @notice Calculates and returns the collect fee of a publication. * @dev Override this function to use a different formula for the fee. * * @return The collect fee of the specified publication. */ function calculateFee( ModuleTypes.ProcessCollectParams calldata processCollectParams ) external view returns (uint160); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ModuleTypes} from 'contracts/modules/libraries/constants/ModuleTypes.sol'; /** * @title ICollectModule * @author Lens Protocol * * @notice This is the standard interface for all Lens-compatible CollectModules. * Collect modules allow users to execute custom logic upon a collect action over a publication, like: * - Only allow the collect if the collector is following the publication author. * - Only allow the collect if the collector has made a payment to * - Allow any collect but only during the first 24 hours. * - Etc. */ interface ICollectModule { /** * @notice Initializes data for a given publication being published. * @custom:permissions LensHub. * * @param profileId The token ID of the profile publishing the publication. * @param pubId The associated publication's LensHub publication ID. * @param transactionExecutor The owner or an approved delegated executor. * @param data Arbitrary data __passed from the user!__ to be decoded. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function initializePublicationCollectModule( uint256 profileId, uint256 pubId, address transactionExecutor, bytes calldata data ) external returns (bytes memory); /** * @notice Processes a collect action for a given publication. * @custom:permissions LensHub. * * @param processCollectParams The parameters for the collect action. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function processCollect( ModuleTypes.ProcessCollectParams calldata processCollectParams ) external returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol'; interface ILensModule is IERC165 { /// @dev for now we check for keccak('LENS_MODULE'); /// Override this and add the type(IModuleInterface).interfaceId for corresponding module type function supportsInterface(bytes4 interfaceID) external view returns (bool); /// @notice Human-readable description of the module // Can be JSON // Can be contract source code // Can be github link // Can be ipfs with documentation // etc function getModuleMetadataURI() external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title Types * @author Lens Protocol * * @notice A standard library of data types used throughout the Lens Protocol modules. */ library ModuleTypes { struct ProcessCollectParams { uint256 publicationCollectedProfileId; uint256 publicationCollectedId; uint256 collectorProfileId; address collectorProfileOwner; address transactionExecutor; uint256[] referrerProfileIds; uint256[] referrerPubIds; Types.PublicationType[] referrerPubTypes; bytes data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271 { /** * @dev Should return whether the signature provided is valid for the provided data * @param hash Hash of the data to be signed * @param signature Signature byte array associated with _data */ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@ensdomains/=node_modules/@ensdomains/", "@openzeppelin/=lib/openzeppelin-contracts/", "@seadrop/=lib/seadrop/src/", "ERC721A-Upgradeable/=lib/seadrop/lib/ERC721A-Upgradeable/contracts/", "ERC721A/=lib/seadrop/lib/ERC721A/contracts/", "create2-helpers/=lib/seadrop/lib/create2-helpers/", "create2-scripts/=lib/seadrop/lib/create2-helpers/script/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/seadrop/lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat/=node_modules/hardhat/", "murky/=lib/seadrop/lib/murky/src/", "openzeppelin-contracts-upgradeable/=lib/seadrop/lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/seadrop/lib/openzeppelin-contracts/contracts/", "operator-filter-registry/=lib/seadrop/lib/operator-filter-registry/src/", "seadrop/=lib/seadrop/", "solady/=lib/solady/src/", "solmate/=lib/seadrop/lib/solmate/src/", "utility-contracts/=lib/seadrop/lib/utility-contracts/src/" ], "optimizer": { "enabled": true, "runs": 10 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": { "contracts/libraries/MetaTxLib.sol": { "MetaTxLib": "0xf191c489e4ba0f448ea08a5fd27e9c928643f5c7" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"lensHub","type":"address"},{"internalType":"address","name":"collectPublicationAction","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"COLLECT_PUBLICATION_ACTION","outputs":[{"internalType":"contract CollectPublicationAction","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HUB","outputs":[{"internalType":"contract ILensHub","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"increment","type":"uint8"}],"name":"incrementNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"publicationActedProfileId","type":"uint256"},{"internalType":"uint256","name":"publicationActedId","type":"uint256"},{"internalType":"uint256","name":"actorProfileId","type":"uint256"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"address","name":"actionModuleAddress","type":"address"},{"internalType":"bytes","name":"actionModuleData","type":"bytes"}],"internalType":"struct Types.PublicationActionParams","name":"publicationActionParams","type":"tuple"}],"name":"publicCollect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"publicationActedProfileId","type":"uint256"},{"internalType":"uint256","name":"publicationActedId","type":"uint256"},{"internalType":"uint256","name":"actorProfileId","type":"uint256"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"address","name":"actionModuleAddress","type":"address"},{"internalType":"bytes","name":"actionModuleData","type":"bytes"}],"internalType":"struct Types.PublicationActionParams","name":"publicationActionParams","type":"tuple"},{"components":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Types.EIP712Signature","name":"signature","type":"tuple"}],"name":"publicCollectWithSig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"publicationActedProfileId","type":"uint256"},{"internalType":"uint256","name":"publicationActedId","type":"uint256"},{"internalType":"uint256","name":"actorProfileId","type":"uint256"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"address","name":"actionModuleAddress","type":"address"},{"internalType":"bytes","name":"actionModuleData","type":"bytes"}],"internalType":"struct Types.PublicationActionParams","name":"publicationActionParams","type":"tuple"}],"name":"publicFreeAct","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c03461009a57601f610ddb38819003918201601f19168301916001600160401b0383118484101761009f57808492604094855283398101031261009a57610052602061004b836100b5565b92016100b5565b6001600160a01b039182166080521660a052604051610d1190816100ca8239608051818181610258015281816102c90152610822015260a05181818161036401526107810152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361009a5756fe608060408181526004908136101561001657600080fd5b600092833560e01c90816306fdde031461040257508063365ae23a146103935780637a0675911461034f5780637ecebe001461031557806396bb7386146102fc578063a4c52b86146102b4578063c0cc2190146102265763c30f69691461007c57600080fd5b34610208576003199160c0368401126102225780356001600160401b03811161021e5760e081830194823603011261021e5760a036602319011261021e5773f191c489e4ba0f448ea08a5fd27e9c928643f5c792833b1561021a57805163c127a83360e01b8152602435946001600160a01b039491939185871690818803610215578501526044359060ff82168092036102155784806101d58b988996839660248501526064356044850152608435606485015260a435608485015260c060a48501528c3560c4850152602481013560e485015260448101356101048501526101c58d60c461018461017160648601846105c3565b60e06101248b01526101a48a01916105f8565b936101aa61019560848301856105c3565b60c3198b890381016101448d015297916105f8565b956101b760a4830161049b565b16610164890152019061061c565b918584030161018486015261064e565b03915af490811561020c57506101f4575b50506101f191610747565b80f35b6101fd906104e0565b6102085782386101e6565b8280fd5b513d84823e3d90fd5b600080fd5b8580fd5b8480fd5b8380fd5b5082346102b1576102539261023a366104af565b83516362eaecb560e11b8152948592839290830161066f565b0381837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af190811561020c5750610292575080f35b6102ad903d8084833e6102a58183610524565b810190610562565b5080f35b80fd5b8382346102f857816003193601126102f857517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5080fd5b83346102b1576101f161030e366104af565b3390610747565b50903461020857602036600319011261020857356001600160a01b0381169081900361021557828291602094526009845220549051908152f35b8382346102f857816003193601126102f857517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346102085760203660031901126102085782823560ff81168091036102f85773f191c489e4ba0f448ea08a5fd27e9c928643f5c793843b156102085760249084519586938492631b2d711d60e11b84528301525af490811561020c57506103f9575080f35b6101f1906104e0565b92505034610208578260031936011261020857610448925061042382610509565b600e82526d5075626c696341637450726f787960901b6020830152519182918261046f565b0390f35b60005b83811061045f5750506000910152565b818101518382015260200161044f565b6040916020825261048f815180928160208601526020868601910161044c565b601f01601f1916010190565b35906001600160a01b038216820361021557565b6003199060208183011261021557600435916001600160401b038311610215578260e0920301126102155760040190565b6001600160401b0381116104f357604052565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b038211176104f357604052565b601f909101601f19168101906001600160401b038211908210176104f357604052565b6001600160401b0381116104f357601f01601f191660200190565b602081830312610215578051906001600160401b038211610215570181601f8201121561021557805161059481610547565b926105a26040519485610524565b81845260208284010111610215576105c0916020808501910161044c565b90565b9035601e1982360301811215610215570160208101919035906001600160401b038211610215578160051b3603831361021557565b81835290916001600160fb1b0383116102155760209260051b809284830137010190565b9035601e1982360301811215610215570160208101919035906001600160401b03821161021557813603831361021557565b908060209392818452848401376000828201840152601f01601f1916010190565b9060e06105c092602081528235602082015260208301356040820152604083013560608201526106b66106a560608501856105c3565b8460808501526101008401916105f8565b906107036106de6106ca60808701876105c3565b601f19858703810160a087015295916105f8565b946001600160a01b036106f360a0830161049b565b1660c084015260c081019061061c565b9390928286030191015261064e565b51906001600160a01b038216820361021557565b51906001600160601b038216820361021557565b5190811515820361021557565b60018060a01b0381356020808401359160409586519363e833689360e01b8552600494838682015260249180838301526044918a8184818c7f0000000000000000000000000000000000000000000000000000000000000000165afa908115610ab857908991600091610ac3575b505116908a519563fcdd234760e01b8752888701528386015261010080868481855afa958615610ab8576000966109cf575b5050878551169384610874575b505050505050509160009184938361081e96518097819582946362eaecb560e11b8452830161066f565b03927f0000000000000000000000000000000000000000000000000000000000000000165af190811561086a57506108535750565b610867903d806000833e6102a58183610524565b50565b513d6000823e3d90fd5b858b0180518c516323b872dd60e01b8a820152928b168684015230858401526064808401979097529582526001600160401b03959091908a1660a08201878111838210176109bb578b93919284938f926108ce9352610b3b565b5116955116908a5191636eb1769f60e11b835230898401528185840152878385818a5afa9283156109b057600093610981575b50820180921161096d578a5163095ea7b360e01b9781019790975283870152818601528452608084019182118483101761095a5750600094928796949261094c9261081e9952610b3b565b9193948193388080806107f4565b634e487b7160e01b600090815260418652fd5b83601189634e487b7160e01b600052526000fd5b90928882813d83116109a9575b6109988183610524565b810103126102b15750519138610901565b503d61098e565b8c513d6000823e3d90fd5b8660418c634e487b7160e01b600052526000fd5b8181819498933d8311610ab1575b6109e78183610524565b810103126102f8578b519283016001600160401b03811184821017610a9f578c5280518a81168103610208578352610a20888201610726565b88840152610a2f8c8201610712565b8c840152610a3f60608201610726565b6060840152610a5060808201610712565b608084015260a081015161ffff811681036102085760a084015260e090610a7960c0820161073a565b60c08501520151906001600160481b03821682036102b1575060e08201529338806107e7565b634e487b7160e01b835260418a528583fd5b503d6109dd565b8b513d6000823e3d90fd5b9091508b81813d8311610b34575b610adb8183610524565b810103126102f8578b5191828d01906001600160401b03821184831017610b225750888b9392610b18928f52610b1081610712565b845201610712565b88820152386107b5565b634e487b7160e01b815260418b528690fd5b503d610ad1565b60018060a01b031690610bb8604051610b5381610509565b6020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af13d15610c42573d91610b9d83610547565b92610bab6040519485610524565b83523d868885013e610c46565b90815180610bc7575b50505050565b828491810103126102b1575081610bde910161073a565b15610beb57808080610bc1565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6060915b91929015610ca85750815115610c5a575090565b3b15610c635790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610cbb5750805190602001fd5b60405162461bcd60e51b8152908190610cd7906004830161046f565b0390fdfea2646970667358221220f5e36cab336a01e27c13e8eccd1c0922004b35dfdc7dda0ab20a37b0da49a04364736f6c63430008150033000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb
Deployed Bytecode
0x608060408181526004908136101561001657600080fd5b600092833560e01c90816306fdde031461040257508063365ae23a146103935780637a0675911461034f5780637ecebe001461031557806396bb7386146102fc578063a4c52b86146102b4578063c0cc2190146102265763c30f69691461007c57600080fd5b34610208576003199160c0368401126102225780356001600160401b03811161021e5760e081830194823603011261021e5760a036602319011261021e5773f191c489e4ba0f448ea08a5fd27e9c928643f5c792833b1561021a57805163c127a83360e01b8152602435946001600160a01b039491939185871690818803610215578501526044359060ff82168092036102155784806101d58b988996839660248501526064356044850152608435606485015260a435608485015260c060a48501528c3560c4850152602481013560e485015260448101356101048501526101c58d60c461018461017160648601846105c3565b60e06101248b01526101a48a01916105f8565b936101aa61019560848301856105c3565b60c3198b890381016101448d015297916105f8565b956101b760a4830161049b565b16610164890152019061061c565b918584030161018486015261064e565b03915af490811561020c57506101f4575b50506101f191610747565b80f35b6101fd906104e0565b6102085782386101e6565b8280fd5b513d84823e3d90fd5b600080fd5b8580fd5b8480fd5b8380fd5b5082346102b1576102539261023a366104af565b83516362eaecb560e11b8152948592839290830161066f565b0381837f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b03165af190811561020c5750610292575080f35b6102ad903d8084833e6102a58183610524565b810190610562565b5080f35b80fd5b8382346102f857816003193601126102f857517f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b03168152602090f35b5080fd5b83346102b1576101f161030e366104af565b3390610747565b50903461020857602036600319011261020857356001600160a01b0381169081900361021557828291602094526009845220549051908152f35b8382346102f857816003193601126102f857517f0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb6001600160a01b03168152602090f35b50346102085760203660031901126102085782823560ff81168091036102f85773f191c489e4ba0f448ea08a5fd27e9c928643f5c793843b156102085760249084519586938492631b2d711d60e11b84528301525af490811561020c57506103f9575080f35b6101f1906104e0565b92505034610208578260031936011261020857610448925061042382610509565b600e82526d5075626c696341637450726f787960901b6020830152519182918261046f565b0390f35b60005b83811061045f5750506000910152565b818101518382015260200161044f565b6040916020825261048f815180928160208601526020868601910161044c565b601f01601f1916010190565b35906001600160a01b038216820361021557565b6003199060208183011261021557600435916001600160401b038311610215578260e0920301126102155760040190565b6001600160401b0381116104f357604052565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b038211176104f357604052565b601f909101601f19168101906001600160401b038211908210176104f357604052565b6001600160401b0381116104f357601f01601f191660200190565b602081830312610215578051906001600160401b038211610215570181601f8201121561021557805161059481610547565b926105a26040519485610524565b81845260208284010111610215576105c0916020808501910161044c565b90565b9035601e1982360301811215610215570160208101919035906001600160401b038211610215578160051b3603831361021557565b81835290916001600160fb1b0383116102155760209260051b809284830137010190565b9035601e1982360301811215610215570160208101919035906001600160401b03821161021557813603831361021557565b908060209392818452848401376000828201840152601f01601f1916010190565b9060e06105c092602081528235602082015260208301356040820152604083013560608201526106b66106a560608501856105c3565b8460808501526101008401916105f8565b906107036106de6106ca60808701876105c3565b601f19858703810160a087015295916105f8565b946001600160a01b036106f360a0830161049b565b1660c084015260c081019061061c565b9390928286030191015261064e565b51906001600160a01b038216820361021557565b51906001600160601b038216820361021557565b5190811515820361021557565b60018060a01b0381356020808401359160409586519363e833689360e01b8552600494838682015260249180838301526044918a8184818c7f0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb165afa908115610ab857908991600091610ac3575b505116908a519563fcdd234760e01b8752888701528386015261010080868481855afa958615610ab8576000966109cf575b5050878551169384610874575b505050505050509160009184938361081e96518097819582946362eaecb560e11b8452830161066f565b03927f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d165af190811561086a57506108535750565b610867903d806000833e6102a58183610524565b50565b513d6000823e3d90fd5b858b0180518c516323b872dd60e01b8a820152928b168684015230858401526064808401979097529582526001600160401b03959091908a1660a08201878111838210176109bb578b93919284938f926108ce9352610b3b565b5116955116908a5191636eb1769f60e11b835230898401528185840152878385818a5afa9283156109b057600093610981575b50820180921161096d578a5163095ea7b360e01b9781019790975283870152818601528452608084019182118483101761095a5750600094928796949261094c9261081e9952610b3b565b9193948193388080806107f4565b634e487b7160e01b600090815260418652fd5b83601189634e487b7160e01b600052526000fd5b90928882813d83116109a9575b6109988183610524565b810103126102b15750519138610901565b503d61098e565b8c513d6000823e3d90fd5b8660418c634e487b7160e01b600052526000fd5b8181819498933d8311610ab1575b6109e78183610524565b810103126102f8578b519283016001600160401b03811184821017610a9f578c5280518a81168103610208578352610a20888201610726565b88840152610a2f8c8201610712565b8c840152610a3f60608201610726565b6060840152610a5060808201610712565b608084015260a081015161ffff811681036102085760a084015260e090610a7960c0820161073a565b60c08501520151906001600160481b03821682036102b1575060e08201529338806107e7565b634e487b7160e01b835260418a528583fd5b503d6109dd565b8b513d6000823e3d90fd5b9091508b81813d8311610b34575b610adb8183610524565b810103126102f8578b5191828d01906001600160401b03821184831017610b225750888b9392610b18928f52610b1081610712565b845201610712565b88820152386107b5565b634e487b7160e01b815260418b528690fd5b503d610ad1565b60018060a01b031690610bb8604051610b5381610509565b6020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af13d15610c42573d91610b9d83610547565b92610bab6040519485610524565b83523d868885013e610c46565b90815180610bc7575b50505050565b828491810103126102b1575081610bde910161073a565b15610beb57808080610bc1565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6060915b91929015610ca85750815115610c5a575090565b3b15610c635790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610cbb5750805190602001fd5b60405162461bcd60e51b8152908190610cd7906004830161046f565b0390fdfea2646970667358221220f5e36cab336a01e27c13e8eccd1c0922004b35dfdc7dda0ab20a37b0da49a04364736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb
-----Decoded View---------------
Arg [0] : lensHub (address): 0xDb46d1Dc155634FbC732f92E853b10B288AD5a1d
Arg [1] : collectPublicationAction (address): 0x0D90C58cBe787CD70B5Effe94Ce58185D72143fB
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d
Arg [1] : 0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.