Overview
POL Balance
0 POL
POL Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract contains unverified libraries: ActionLib, GovernanceLib
Contract Name:
DegreesOfSeparationReferenceModule
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 {Types} from 'contracts/libraries/constants/Types.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {IERC721Timestamped} from 'contracts/interfaces/IERC721Timestamped.sol'; import {IReferenceModule} from 'contracts/interfaces/IReferenceModule.sol'; import {HubRestricted} from 'contracts/base/HubRestricted.sol'; import {FollowValidationLib} from 'contracts/modules/libraries/FollowValidationLib.sol'; import {LensModuleMetadata} from 'contracts/modules/LensModuleMetadata.sol'; /** * @notice Struct representing the module configuration for certain publication. * * @param setUp Indicates if the publication was set up to use this module, to then allow updating params. * @param commentsRestricted Indicates if the comment operation is restricted or open to everyone. * @param quotesRestricted Indicates if the quote operation is restricted or open to everyone. * @param mirrorsRestricted Indicates if the mirror operation is restricted or open to everyone. * @param degreesOfSeparation The max degrees of separation allowed for restricted operations. * @param sourceProfile The ID of the profile from where the follower path should be started. Usually it will match the * `originalAuthorProfile`. * @param originalAuthorProfile Original author of the Post or Quote when the degrees restriction was first applied. */ struct ModuleConfig { bool setUp; bool commentsRestricted; bool quotesRestricted; bool mirrorsRestricted; uint8 degreesOfSeparation; uint96 sourceProfile; uint96 originalAuthorProfile; } /** * @title DegreesOfSeparationReferenceModule * @author Lens Protocol * * @notice This reference module allows to set a degree of separation `n`, and then allows to quote/comment/mirror * only to profiles that are at most at `n` degrees of separation from the source profile, which is expected to be set * as the author of the root publication. */ contract DegreesOfSeparationReferenceModule is LensModuleMetadata, HubRestricted, IReferenceModule { function supportsInterface(bytes4 interfaceID) public pure override returns (bool) { return interfaceID == type(IReferenceModule).interfaceId || super.supportsInterface(interfaceID); } error InvalidDegreesOfSeparation(); error OperationDisabled(); error ProfilePathExceedsDegreesOfSeparation(); error NotInheritingPointedPubConfig(); /** * @dev Because of the "Six degrees of separation" theory, in the long term, setting up 5, 6 or more degrees of * separation will be almost equivalent to turning off the restriction. * If we also take into account the gas cost of performing the validations on-chain, and the cost of off-chain * computation of the path, makes sense to only support up to 2 degrees of separation. */ uint8 public constant MAX_DEGREES_OF_SEPARATION = 2; mapping(uint256 profileId => mapping(uint256 pubId => ModuleConfig config)) internal _moduleConfig; constructor(address hub, address moduleOwner) HubRestricted(hub) LensModuleMetadata(moduleOwner) {} /** * @inheritdoc IReferenceModule * * @dev The `data` param should have ABI-encoded the following information: * - bool commentsRestricted: Indicates if the comment operation is restricted or open to everyone. * - bool quotesRestricted: Indicates if the quote operation is restricted or open to everyone. * - bool mirrorsRestricted: Indicates if the mirror operation is restricted or open to everyone. * - uint8 degreesOfSeparation: The max degrees of separation allowed for restricted operations. * - uint96 sourceProfile: The ID of the profile from where the follower path should be started. Expected to be set * as the author of the root publication. */ function initializeReferenceModule( uint256 profileId, uint256 pubId, address /* transactionExecutor */, bytes calldata data ) external override onlyHub returns (bytes memory) { ( bool commentsRestricted, bool quotesRestricted, bool mirrorsRestricted, uint8 degreesOfSeparation, uint96 sourceProfile ) = abi.decode(data, (bool, bool, bool, uint8, uint96)); if (degreesOfSeparation > MAX_DEGREES_OF_SEPARATION) { revert InvalidDegreesOfSeparation(); } if (!IERC721Timestamped(HUB).exists(sourceProfile)) { revert Errors.TokenDoesNotExist(); } uint96 originalAuthorProfile; Types.PublicationMemory memory pub = ILensHub(HUB).getPublication(profileId, pubId); if (pub.pubType == Types.PublicationType.Comment) { ModuleConfig memory parentConfig = _moduleConfig[pub.pointedProfileId][pub.pointedPubId]; if (!parentConfig.setUp) { // Comments cannot restrict degrees of separation, unless the pointed publication has it enabled too. revert OperationDisabled(); } originalAuthorProfile = parentConfig.originalAuthorProfile; } else { originalAuthorProfile = uint96(profileId); } _moduleConfig[profileId][pubId] = ModuleConfig( true, commentsRestricted, quotesRestricted, mirrorsRestricted, degreesOfSeparation, sourceProfile, originalAuthorProfile ); return data; } /** * @inheritdoc IReferenceModule * * @dev It will apply the degrees of separation restriction if the publication has `commentsRestricted` enabled. * The param `processCommentParams.data` has ABI-encoded the array of profile IDs representing the follower path * between the source profile and the profile authoring the comment. * In addition, if comments were restricted, inheritance of commenting restrictions will be enforced. */ function processComment( Types.ProcessCommentParams calldata processCommentParams ) external view override onlyHub returns (bytes memory) { ModuleConfig memory config = _moduleConfig[processCommentParams.pointedProfileId][ processCommentParams.pointedPubId ]; if (config.commentsRestricted) { _validateDegreesOfSeparationRestriction({ sourceProfile: config.sourceProfile, originalAuthorProfile: config.originalAuthorProfile, profileId: processCommentParams.profileId, degreesOfSeparation: config.degreesOfSeparation, profilePath: abi.decode(processCommentParams.data, (uint256[])) }); _validateCommentInheritedConfigFromPointedPub({ pointedPubConfig: config, newCommentPubConfig: _moduleConfig[processCommentParams.profileId][processCommentParams.pubId] }); } return ''; } /** * @inheritdoc IReferenceModule * * @dev It will apply the degrees of separation restriction if the publication has `quotesRestricted` enabled. * The param `processQuoteParams.data` has ABI-encoded the array of profile IDs representing the follower path * between the source profile and the profile authoring the quote. */ function processQuote( Types.ProcessQuoteParams calldata processQuoteParams ) external view override onlyHub returns (bytes memory) { ModuleConfig memory config = _moduleConfig[processQuoteParams.pointedProfileId][ processQuoteParams.pointedPubId ]; if (config.quotesRestricted) { _validateDegreesOfSeparationRestriction({ sourceProfile: config.sourceProfile, originalAuthorProfile: config.originalAuthorProfile, profileId: processQuoteParams.profileId, degreesOfSeparation: config.degreesOfSeparation, profilePath: abi.decode(processQuoteParams.data, (uint256[])) }); } return ''; } /** * @inheritdoc IReferenceModule * * @dev It will apply the degrees of separation restriction if the publication has `mirrorsRestricted` enabled. * The param `processMirrorParams.data` has ABI-encoded the array of profile IDs representing the follower path * between the source profile and the profile authoring the mirror. */ function processMirror( Types.ProcessMirrorParams calldata processMirrorParams ) external view override onlyHub returns (bytes memory) { ModuleConfig memory config = _moduleConfig[processMirrorParams.pointedProfileId][ processMirrorParams.pointedPubId ]; if (config.mirrorsRestricted) { _validateDegreesOfSeparationRestriction({ sourceProfile: config.sourceProfile, originalAuthorProfile: config.originalAuthorProfile, profileId: processMirrorParams.profileId, degreesOfSeparation: config.degreesOfSeparation, profilePath: abi.decode(processMirrorParams.data, (uint256[])) }); } return ''; } /** * @notice Gets the module configuration for the given publication. * * @param profileId The token ID of the profile publishing the publication. * @param pubId The associated publication's LensHub publication ID. * * @return ModuleConfig The module configuration set for the given publication. */ function getModuleConfig(uint256 profileId, uint256 pubId) external view returns (ModuleConfig memory) { return _moduleConfig[profileId][pubId]; } /** * @dev The data has encoded an array of integers, each integer is a profile ID, the whole array represents a path * of `n` profiles. * * Let's define `X --> Y` as `The owner of X is following Y`. Then, being `path[i]` the i-th profile in the path, * the following condition must be met for a given path of `n` profiles: * * sourceProfile --> path[0] --> path[1] --> path[2] --> ... --> path[n-2] --> path[n-1] --> profileId * * @param sourceProfile The ID of the profile from where the follower path should be started. Most likely to be the * root publication's author. * @param profileId The ID of the publication being published's author. * @param degreesOfSeparation The degrees of separations configured for the given publication. * @param profilePath The array of profile IDs representing the follower path between the source profile and the * profile authoring the new publication (it could be a comment, a quote or a mirror of the pointed one). */ function _validateDegreesOfSeparationRestriction( uint256 sourceProfile, uint256 originalAuthorProfile, uint256 profileId, uint8 degreesOfSeparation, uint256[] memory profilePath ) internal view { // Unrestricted if the profile authoring the publication is the source or the original author profile. if (profileId == sourceProfile || profileId == originalAuthorProfile) { return; } // Here we only have cases where the source profile is not the same as the profile authoring the new publication. if (degreesOfSeparation == 0) { // If `degreesOfSeparation` was set to zero, only `sourceProfile` is allowed to interact. revert OperationDisabled(); } else if (profilePath.length > degreesOfSeparation - 1) { revert ProfilePathExceedsDegreesOfSeparation(); } if (profilePath.length > 0) { // Checks that the source profile follows the first profile in the path. // In the previous notation: sourceProfile --> path[0] FollowValidationLib.validateIsFollowing({ hub: HUB, followerProfileId: sourceProfile, followedProfileId: profilePath[0] }); // Checks each profile owner in the path is following the profile coming next, according the order. // In the previous notaiton: path[0] --> path[1] --> path[2] --> ... --> path[n-2] --> path[n-1] uint256 i; while (i < profilePath.length - 1) { FollowValidationLib.validateIsFollowing({ hub: HUB, followerProfileId: profilePath[i], followedProfileId: profilePath[i + 1] }); unchecked { ++i; } } // Checks that the last profile in the path follows the profile authoring the new publication. // In the previous notation: path[n-1] --> profileId FollowValidationLib.validateIsFollowing({ hub: HUB, followerProfileId: profilePath[i], followedProfileId: profileId }); } else { // Checks that the source profile follows the profile authoring the new publication. // In the previous notation: sourceProfile --> profileId FollowValidationLib.validateIsFollowing({ hub: HUB, followerProfileId: sourceProfile, followedProfileId: profileId }); } } /** * @notice Validates that the comment configuration is inherited from pointed publication. * * @param pointedPubConfig The pointed publication's degrees of separation module configuration. * @param newCommentPubConfig The comment being processed's degrees of separation module configuration. */ function _validateCommentInheritedConfigFromPointedPub( ModuleConfig memory pointedPubConfig, ModuleConfig memory newCommentPubConfig ) internal pure { // We only care about inheritance of the comment restrictions. if ( !newCommentPubConfig.setUp || !newCommentPubConfig.commentsRestricted || newCommentPubConfig.sourceProfile != pointedPubConfig.sourceProfile || newCommentPubConfig.degreesOfSeparation != pointedPubConfig.degreesOfSeparation ) { revert NotInheritingPointedPubConfig(); } } }
// 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 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 IReferenceModule * @author Lens Protocol * * @notice This is the standard interface for all Lens-compatible ReferenceModules. * Reference modules allow executing some action when a publication is referenced, like: * - Rewards for mirroring/commenting/quoting a publication. * - Token-gated comments/mirrors/quotes of a publication. * - Etc. */ interface IReferenceModule { /** * @notice Initializes data for the given publication being published with this Reference module. * @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 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 Reference 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 initializeReferenceModule( uint256 profileId, uint256 pubId, address transactionExecutor, bytes calldata data ) external returns (bytes memory); /** * @notice Processes a comment being published. This includes any module logic like transferring tokens, * checking for conditions (e.g. token-gated), etc. * @custom:permissions LensHub. * * @param processCommentParams The parameters for processing a comment. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function processComment(Types.ProcessCommentParams calldata processCommentParams) external returns (bytes memory); /** * @notice Processes a quote being published. This includes any module logic like transferring tokens, * checking for conditions (e.g. token-gated), etc. * @custom:permissions LensHub * * @param processQuoteParams The parameters for processing a quote. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function processQuote(Types.ProcessQuoteParams calldata processQuoteParams) external returns (bytes memory); /** * @notice Processes a mirror being published. This includes any module logic like transferring tokens, * checking for conditions (e.g. token-gated), etc. * @custom:permissions LensHub * * @param processMirrorParams The parameters for processing a mirror. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function processMirror(Types.ProcessMirrorParams calldata processMirrorParams) external returns (bytes memory); }
// 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; /** * @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.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.8.19; import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; /** * @title FollowValidationLib * @author Lens Protocol * * @notice A library contract that verifies that a user is following another user and reverts if not. */ library FollowValidationLib { function validateIsFollowing(address hub, uint256 followerProfileId, uint256 followedProfileId) internal view { if (!ILensHub(hub).isFollowing(followerProfileId, followedProfileId)) { revert Errors.NotFollowing(); } } function validateIsFollowingOrSelf( address hub, uint256 followerProfileId, uint256 followedProfileId ) internal view { // We treat following yourself is always true if (followerProfileId == followedProfileId) { return; } validateIsFollowing(hub, followerProfileId, followedProfileId); } }
// 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 (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 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/ActionLib.sol": { "ActionLib": "0x7990dac84e3241fe314b980bba1466ac08715c4f" }, "contracts/libraries/FollowLib.sol": { "FollowLib": "0xe280cb21fb36b6b2d584428b809a6b822a5c2260" }, "contracts/libraries/GovernanceLib.sol": { "GovernanceLib": "0x5268512d20bf7653cf6d54b7c485ae3fbc658451" }, "contracts/libraries/LegacyCollectLib.sol": { "LegacyCollectLib": "0x5f0f24377c00f1517b4de496cf49eec8beb4ecb4" }, "contracts/libraries/MetaTxLib.sol": { "MetaTxLib": "0xf191c489e4ba0f448ea08a5fd27e9c928643f5c7" }, "contracts/libraries/MigrationLib.sol": { "MigrationLib": "0x0deced9ac3833b687d69d4eac6655f0f1279acee" }, "contracts/libraries/ProfileLib.sol": { "ProfileLib": "0x3fce2475a92c185f9634f5638f6b33306d77bb10" }, "contracts/libraries/PublicationLib.sol": { "PublicationLib": "0x90654f24a2c164a4da8f763ac8bc032d3d083a1b" }, "contracts/libraries/ValidationLib.sol": { "ValidationLib": "0x9cafd24d2851d9eb56e5a8fd394ab2ac0ef99849" }, "contracts/libraries/token-uris/FollowTokenURILib.sol": { "FollowTokenURILib": "0xc58f0e2a361e35c08619ef5f6122dc15180d783e" }, "contracts/libraries/token-uris/HandleTokenURILib.sol": { "HandleTokenURILib": "0x0e20f112689c7894ab8142108574e45d2650f529" }, "contracts/libraries/token-uris/ProfileTokenURILib.sol": { "ProfileTokenURILib": "0xf167835e74eecfe4bc571701d34fd38f4b61a830" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"hub","type":"address"},{"internalType":"address","name":"moduleOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidDegreesOfSeparation","type":"error"},{"inputs":[],"name":"NotFollowing","type":"error"},{"inputs":[],"name":"NotHub","type":"error"},{"inputs":[],"name":"NotInheritingPointedPubConfig","type":"error"},{"inputs":[],"name":"OperationDisabled","type":"error"},{"inputs":[],"name":"ProfilePathExceedsDegreesOfSeparation","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"HUB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DEGREES_OF_SEPARATION","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"}],"name":"getModuleConfig","outputs":[{"components":[{"internalType":"bool","name":"setUp","type":"bool"},{"internalType":"bool","name":"commentsRestricted","type":"bool"},{"internalType":"bool","name":"quotesRestricted","type":"bool"},{"internalType":"bool","name":"mirrorsRestricted","type":"bool"},{"internalType":"uint8","name":"degreesOfSeparation","type":"uint8"},{"internalType":"uint96","name":"sourceProfile","type":"uint96"},{"internalType":"uint96","name":"originalAuthorProfile","type":"uint96"}],"internalType":"struct ModuleConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getModuleMetadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"initializeReferenceModule","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"metadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"},{"internalType":"address","name":"transactionExecutor","type":"address"},{"internalType":"uint256","name":"pointedProfileId","type":"uint256"},{"internalType":"uint256","name":"pointedPubId","type":"uint256"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"enum Types.PublicationType[]","name":"referrerPubTypes","type":"uint8[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Types.ProcessCommentParams","name":"processCommentParams","type":"tuple"}],"name":"processComment","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"},{"internalType":"address","name":"transactionExecutor","type":"address"},{"internalType":"uint256","name":"pointedProfileId","type":"uint256"},{"internalType":"uint256","name":"pointedPubId","type":"uint256"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"enum Types.PublicationType[]","name":"referrerPubTypes","type":"uint8[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Types.ProcessMirrorParams","name":"processMirrorParams","type":"tuple"}],"name":"processMirror","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"},{"internalType":"address","name":"transactionExecutor","type":"address"},{"internalType":"uint256","name":"pointedProfileId","type":"uint256"},{"internalType":"uint256","name":"pointedPubId","type":"uint256"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"enum Types.PublicationType[]","name":"referrerPubTypes","type":"uint8[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Types.ProcessQuoteParams","name":"processQuoteParams","type":"tuple"}],"name":"processQuote","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_metadataURI","type":"string"}],"name":"setModuleMetadataURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0346100b857601f6200156038819003918201601f19168301916001600160401b038311848410176100bd5780849260409485528339810103126100b857610064610056602061004f846100d3565b93016100d3565b61005f336100e7565b6100e7565b60805260405161143190816200012f82396080518181816101d601528181610281015281816102e101528181610744015281816107f301528181610a6601528181610c4f0152818161121301526112c90152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100b857565b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714610e255750806303ee438c146106f657806317e91e3814610c3f5780631d86c58414610b345780634985ec1214610a56578063681591c114610908578063684816ba146107e3578063715018a61461079c5780638da5cb5b14610773578063a4c52b861461072e578063af6c13fa14610712578063ce90d52e146106f6578063ee299f5d1461016f5763f2fde38b146100b957600080fd5b3461016a57602036600319011261016a576004356001600160a01b038181169182900361016a576100e8611383565b8115610116576000548260018060a01b0319821617600055166000805160206113dc833981519152600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b600080fd5b3461016a57608036600319011261016a576001600160a01b036044358181160361016a57606435906001600160401b03821161016a573660238301121561016a576001600160401b0360048301351161016a578160040135820136602482011161016a57817f00000000000000000000000000000000000000000000000000000000000000001633036106e4578260a091031261016a57610212602483016110b3565b9161021f604482016110b3565b61022b606483016110b3565b9360848301359460ff8616860361016a5760a4840135946001600160601b038616860361016a57600260ff8816116106d257604051634f558e7960e01b81526001600160601b03871660048201526020816024817f000000000000000000000000000000000000000000000000000000000000000086165afa908115610685576000916106a3575b501561069157600060449160405192838092637385ebc960e01b8252600435600483015260243560248301527f0000000000000000000000000000000000000000000000000000000000000000165afa90811561068557600091610525575b5060c0810151600581101561050f576002036104f15780516000526002602052602060406000209101516000526020526040600020946040519561035587610eee565b549560c060ff881615918215815260ff8960081c161515602082015260ff8960101c161515604082015260ff8960181c161515606082015260ff8960201c16608082015260018060601b038960281c1660a0820152019660018060601b039060881c1687526104df5794516104db966104c7966001600160601b03909216925b604051956103e287610eee565b6001875260208701951515865260408701901515815260608701911515825260ff608088019316835260a087019360018060601b0316845260c087019460018060601b03168552600435600052600260205260406000206024356000526020526040600020965115159560ff63ff00000062ff000061ff008b549451151560081b169451151560101b169451151560181b16948160201b905160201b1695600160281b600160881b03905160281b1696600160881b600160e81b03905160881b1697169062ffffff60e81b16171717171717179055369060248160040135910161107c565b60405191829160208352602083019061100a565b0390f35b60405163016cfbc160e71b8152600490fd5b506104db956104c7956004356001600160601b0316929091906103d5565b634e487b7160e01b600052602160045260246000fd5b3d9150816000823e6105378282610f24565b602081838101031261016a578051906001600160401b03821161016a57610120828201848301031261016a57604051926001600160401b0361012085019081119085111761066f5761012084016040908152828401805186526020808201519087015201516001600160401b03811161016a57818301601f828686010101121561016a578084840101516105ca81611061565b926105d86040519485610f24565b8184528401602082848888010101011161016a57610600916020808501918787010101610fe7565b60408401526106136060838301016110d8565b60608401526106266080838301016110d8565b608084015261063960a0838301016110d8565b60a084015260c08282010151600581101561016a5760c08401520160e08181015190830152610100908101519082015287610312565b634e487b7160e01b600052604160045260246000fd5b6040513d6000823e3d90fd5b60405163677510db60e11b8152600490fd5b6106c5915060203d6020116106cb575b6106bd8183610f24565b8101906110c0565b886102b3565b503d6106b3565b604051634829bddd60e01b8152600490fd5b6040516313bd2e8360e31b8152600490fd5b3461016a57600036600319011261016a576104db6104c7610f47565b3461016a57600036600319011261016a57602060405160028152f35b3461016a57600036600319011261016a576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b3461016a57600036600319011261016a576000546040516001600160a01b039091168152602090f35b3461016a57600036600319011261016a576107b5611383565b600080546001600160a01b0319811682556001600160a01b03166000805160206113dc8339815191528280a3005b3461016a576107f13661102f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036106e457606081013560005260c06020916002835260406000206080820135600052835260406000206040519061085382610eee565b5460ff81161515825260ff8160081c1615158583015260ff8160101c16151580604084015260ff8260181c161515606084015260ff82871c169283608082015260018060601b03808460281c16938460a084015260881c1695869101526108da575b604051856108c282610f09565b600082526104db60405192828493845283019061100a565b6108ff936108f76108ef6101008601866110ec565b81019061111e565b9335916111c4565b818080806108b5565b3461016a5760208060031936011261016a576001600160401b039060043582811161016a573660238201121561016a5761094c90369060248160040135910161107c565b91610955611383565b825190811161066f5760019161096b8354610eb4565b601f8111610a0d575b5080601f83116001146109ad57508192936000926109a2575b5050600019600383901b1c191690821b179055005b01519050838061098d565b90601f198316948460005282600020926000905b8782106109f6575050838596106109dd575b505050811b019055005b015160001960f88460031b161c191690558380806109d3565b8087859682949686015181550195019301906109c1565b8360005281600020601f840160051c810191838510610a4c575b601f0160051c019084905b828110610a40575050610974565b60008155018490610a32565b9091508190610a27565b3461016a57610a643661102f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036106e457606081013560005260c060209160028352604060002060808201356000528352604060002060405190610ac682610eee565b5460ff81161515825260ff8160081c1615158583015260ff8160101c161515604083015260ff8160181c16151580606084015260ff82871c169283608082015260018060601b03808460281c16938460a084015260881c1695869101526108da57604051856108c282610f09565b3461016a57604036600319011261016a5760e0604051610b5381610eee565b60008152600060c060209282848201528260408201528260608201528260808201528260a08201520152600435600052600281526040600020602435600052815260406000209060405191610ba783610eee565b5460ff80821615159384815283810191808460081c161515835260408201818560101c161515815260608301828660181c161515815260808401918387891c16835260018060601b039788968760c060a0890198828c60281c168a52019960881c1689526040519a8b52511515908a01525115156040890152511515606088015251166080860152511660a0840152511660c0820152f35b3461016a57610c4d3661102f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036106e45760608101356000526020906002825260406000206080820135600052825260406000209060405191610cae83610eee565b549160ff9081841615158152818460081c161515928386830152828560101c1615156040830152828560181c161515606083015260c08386881c16608084019381855260018060601b0396878960281c16918860a082019a848c5260881c169485910152610d24575b604051896108c282610f09565b610d439184358094610d3d6108ef6101008901896110ec565b936111c4565b60005260028652856040600020910135600052855260406000209260405193610d6b85610eee565b54908382161595861596878752858460081c16159081158a890152868560101c1615156040890152868560181c161515606089015286858b1c169788608082015260c085808860281c16978860a085015260881c1691015297610e1d575b508615610e0f575b5050508315610e01575b505050610def578180808080808080610d17565b60405163025ae57760e41b8152600490fd5b511614159050828080610ddb565b511614159350858080610dd1565b965088610dc9565b3461016a57602036600319011261016a576001600160e01b03196004358181169081900361016a5763d80d7bcd60e01b8114918215610e6c575b6020836040519015158152f35b6a4c454e535f4d4f44554c4560a81b60208501908152600b8552604085019492935090916001600160401b0385118186101761066f5760209460405251902016148280610e5f565b90600182811c92168015610ee4575b6020831014610ece57565b634e487b7160e01b600052602260045260246000fd5b91607f1691610ec3565b60e081019081106001600160401b0382111761066f57604052565b602081019081106001600160401b0382111761066f57604052565b601f909101601f19168101906001600160401b0382119082101761066f57604052565b60405190600082600191825492610f5d84610eb4565b908184526020948181169081600014610fc75750600114610f89575b5050610f8792500383610f24565b565b600081815285812095935091905b818310610faf575050610f8793508201013880610f79565b85548884018501529485019487945091830191610f97565b915050610f8794925060ff191682840152151560051b8201013880610f79565b60005b838110610ffa5750506000910152565b8181015183820152602001610fea565b9060209161102381518092818552858086019101610fe7565b601f01601f1916010190565b6003199060208183011261016a57600435916001600160401b03831161016a57826101209203011261016a5760040190565b6001600160401b03811161066f57601f01601f191660200190565b92919261108882611061565b916110966040519384610f24565b82948184528183011161016a578281602093846000960137010152565b3590811515820361016a57565b9081602091031261016a5751801515810361016a5790565b51906001600160a01b038216820361016a57565b903590601e198136030182121561016a57018035906001600160401b03821161016a5760200191813603831361016a57565b90602090818382031261016a576001600160401b039280359084821161016a570181601f8201121561016a57803593841161066f578360051b906040519461116885840187610f24565b8552838086019282010192831161016a578301905b82821061118b575050505090565b8135815290830190830161117d565b80518210156111ae5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b9290949194838614908115611306575b506112ff5760ff16806111f35760405163016cfbc160e71b8152600490fd5b8351906000190160ff81116112925760ff16106112ed578251156112c0577f0000000000000000000000000000000000000000000000000000000000000000918351156111ae5760208401516112499184611310565b60005b83516000198101908111611292578110156112a85761126b818561119a565b51600182018092116112925761128d90611285838761119a565b519085611310565b61124c565b634e487b7160e01b600052601160045260246000fd5b6112b990610f87949593929561119a565b5190611310565b9290610f8792507f0000000000000000000000000000000000000000000000000000000000000000611310565b60405163ec26e61b60e01b8152600490fd5b5092505050565b90508514386111d4565b91604460209260405194859384926347720ebb60e01b84526004840152602483015260018060a01b03165afa90811561068557600091611365575b501561135357565b6040516322d9eef360e21b8152600490fd5b61137d915060203d81116106cb576106bd8183610f24565b3861134b565b6000546001600160a01b0316330361139757565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a264697066735822122084a46800917d1ef2afdd46f0aa340d75dba068444f88fb4694f76d4c57e6585f64736f6c63430008150033000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
Deployed Bytecode
0x608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714610e255750806303ee438c146106f657806317e91e3814610c3f5780631d86c58414610b345780634985ec1214610a56578063681591c114610908578063684816ba146107e3578063715018a61461079c5780638da5cb5b14610773578063a4c52b861461072e578063af6c13fa14610712578063ce90d52e146106f6578063ee299f5d1461016f5763f2fde38b146100b957600080fd5b3461016a57602036600319011261016a576004356001600160a01b038181169182900361016a576100e8611383565b8115610116576000548260018060a01b0319821617600055166000805160206113dc833981519152600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b600080fd5b3461016a57608036600319011261016a576001600160a01b036044358181160361016a57606435906001600160401b03821161016a573660238301121561016a576001600160401b0360048301351161016a578160040135820136602482011161016a57817f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d1633036106e4578260a091031261016a57610212602483016110b3565b9161021f604482016110b3565b61022b606483016110b3565b9360848301359460ff8616860361016a5760a4840135946001600160601b038616860361016a57600260ff8816116106d257604051634f558e7960e01b81526001600160601b03871660048201526020816024817f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d86165afa908115610685576000916106a3575b501561069157600060449160405192838092637385ebc960e01b8252600435600483015260243560248301527f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d165afa90811561068557600091610525575b5060c0810151600581101561050f576002036104f15780516000526002602052602060406000209101516000526020526040600020946040519561035587610eee565b549560c060ff881615918215815260ff8960081c161515602082015260ff8960101c161515604082015260ff8960181c161515606082015260ff8960201c16608082015260018060601b038960281c1660a0820152019660018060601b039060881c1687526104df5794516104db966104c7966001600160601b03909216925b604051956103e287610eee565b6001875260208701951515865260408701901515815260608701911515825260ff608088019316835260a087019360018060601b0316845260c087019460018060601b03168552600435600052600260205260406000206024356000526020526040600020965115159560ff63ff00000062ff000061ff008b549451151560081b169451151560101b169451151560181b16948160201b905160201b1695600160281b600160881b03905160281b1696600160881b600160e81b03905160881b1697169062ffffff60e81b16171717171717179055369060248160040135910161107c565b60405191829160208352602083019061100a565b0390f35b60405163016cfbc160e71b8152600490fd5b506104db956104c7956004356001600160601b0316929091906103d5565b634e487b7160e01b600052602160045260246000fd5b3d9150816000823e6105378282610f24565b602081838101031261016a578051906001600160401b03821161016a57610120828201848301031261016a57604051926001600160401b0361012085019081119085111761066f5761012084016040908152828401805186526020808201519087015201516001600160401b03811161016a57818301601f828686010101121561016a578084840101516105ca81611061565b926105d86040519485610f24565b8184528401602082848888010101011161016a57610600916020808501918787010101610fe7565b60408401526106136060838301016110d8565b60608401526106266080838301016110d8565b608084015261063960a0838301016110d8565b60a084015260c08282010151600581101561016a5760c08401520160e08181015190830152610100908101519082015287610312565b634e487b7160e01b600052604160045260246000fd5b6040513d6000823e3d90fd5b60405163677510db60e11b8152600490fd5b6106c5915060203d6020116106cb575b6106bd8183610f24565b8101906110c0565b886102b3565b503d6106b3565b604051634829bddd60e01b8152600490fd5b6040516313bd2e8360e31b8152600490fd5b3461016a57600036600319011261016a576104db6104c7610f47565b3461016a57600036600319011261016a57602060405160028152f35b3461016a57600036600319011261016a576040517f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b03168152602090f35b3461016a57600036600319011261016a576000546040516001600160a01b039091168152602090f35b3461016a57600036600319011261016a576107b5611383565b600080546001600160a01b0319811682556001600160a01b03166000805160206113dc8339815191528280a3005b3461016a576107f13661102f565b7f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b031633036106e457606081013560005260c06020916002835260406000206080820135600052835260406000206040519061085382610eee565b5460ff81161515825260ff8160081c1615158583015260ff8160101c16151580604084015260ff8260181c161515606084015260ff82871c169283608082015260018060601b03808460281c16938460a084015260881c1695869101526108da575b604051856108c282610f09565b600082526104db60405192828493845283019061100a565b6108ff936108f76108ef6101008601866110ec565b81019061111e565b9335916111c4565b818080806108b5565b3461016a5760208060031936011261016a576001600160401b039060043582811161016a573660238201121561016a5761094c90369060248160040135910161107c565b91610955611383565b825190811161066f5760019161096b8354610eb4565b601f8111610a0d575b5080601f83116001146109ad57508192936000926109a2575b5050600019600383901b1c191690821b179055005b01519050838061098d565b90601f198316948460005282600020926000905b8782106109f6575050838596106109dd575b505050811b019055005b015160001960f88460031b161c191690558380806109d3565b8087859682949686015181550195019301906109c1565b8360005281600020601f840160051c810191838510610a4c575b601f0160051c019084905b828110610a40575050610974565b60008155018490610a32565b9091508190610a27565b3461016a57610a643661102f565b7f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b031633036106e457606081013560005260c060209160028352604060002060808201356000528352604060002060405190610ac682610eee565b5460ff81161515825260ff8160081c1615158583015260ff8160101c161515604083015260ff8160181c16151580606084015260ff82871c169283608082015260018060601b03808460281c16938460a084015260881c1695869101526108da57604051856108c282610f09565b3461016a57604036600319011261016a5760e0604051610b5381610eee565b60008152600060c060209282848201528260408201528260608201528260808201528260a08201520152600435600052600281526040600020602435600052815260406000209060405191610ba783610eee565b5460ff80821615159384815283810191808460081c161515835260408201818560101c161515815260608301828660181c161515815260808401918387891c16835260018060601b039788968760c060a0890198828c60281c168a52019960881c1689526040519a8b52511515908a01525115156040890152511515606088015251166080860152511660a0840152511660c0820152f35b3461016a57610c4d3661102f565b7f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b031633036106e45760608101356000526020906002825260406000206080820135600052825260406000209060405191610cae83610eee565b549160ff9081841615158152818460081c161515928386830152828560101c1615156040830152828560181c161515606083015260c08386881c16608084019381855260018060601b0396878960281c16918860a082019a848c5260881c169485910152610d24575b604051896108c282610f09565b610d439184358094610d3d6108ef6101008901896110ec565b936111c4565b60005260028652856040600020910135600052855260406000209260405193610d6b85610eee565b54908382161595861596878752858460081c16159081158a890152868560101c1615156040890152868560181c161515606089015286858b1c169788608082015260c085808860281c16978860a085015260881c1691015297610e1d575b508615610e0f575b5050508315610e01575b505050610def578180808080808080610d17565b60405163025ae57760e41b8152600490fd5b511614159050828080610ddb565b511614159350858080610dd1565b965088610dc9565b3461016a57602036600319011261016a576001600160e01b03196004358181169081900361016a5763d80d7bcd60e01b8114918215610e6c575b6020836040519015158152f35b6a4c454e535f4d4f44554c4560a81b60208501908152600b8552604085019492935090916001600160401b0385118186101761066f5760209460405251902016148280610e5f565b90600182811c92168015610ee4575b6020831014610ece57565b634e487b7160e01b600052602260045260246000fd5b91607f1691610ec3565b60e081019081106001600160401b0382111761066f57604052565b602081019081106001600160401b0382111761066f57604052565b601f909101601f19168101906001600160401b0382119082101761066f57604052565b60405190600082600191825492610f5d84610eb4565b908184526020948181169081600014610fc75750600114610f89575b5050610f8792500383610f24565b565b600081815285812095935091905b818310610faf575050610f8793508201013880610f79565b85548884018501529485019487945091830191610f97565b915050610f8794925060ff191682840152151560051b8201013880610f79565b60005b838110610ffa5750506000910152565b8181015183820152602001610fea565b9060209161102381518092818552858086019101610fe7565b601f01601f1916010190565b6003199060208183011261016a57600435916001600160401b03831161016a57826101209203011261016a5760040190565b6001600160401b03811161066f57601f01601f191660200190565b92919261108882611061565b916110966040519384610f24565b82948184528183011161016a578281602093846000960137010152565b3590811515820361016a57565b9081602091031261016a5751801515810361016a5790565b51906001600160a01b038216820361016a57565b903590601e198136030182121561016a57018035906001600160401b03821161016a5760200191813603831361016a57565b90602090818382031261016a576001600160401b039280359084821161016a570181601f8201121561016a57803593841161066f578360051b906040519461116885840187610f24565b8552838086019282010192831161016a578301905b82821061118b575050505090565b8135815290830190830161117d565b80518210156111ae5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b9290949194838614908115611306575b506112ff5760ff16806111f35760405163016cfbc160e71b8152600490fd5b8351906000190160ff81116112925760ff16106112ed578251156112c0577f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d918351156111ae5760208401516112499184611310565b60005b83516000198101908111611292578110156112a85761126b818561119a565b51600182018092116112925761128d90611285838761119a565b519085611310565b61124c565b634e487b7160e01b600052601160045260246000fd5b6112b990610f87949593929561119a565b5190611310565b9290610f8792507f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d611310565b60405163ec26e61b60e01b8152600490fd5b5092505050565b90508514386111d4565b91604460209260405194859384926347720ebb60e01b84526004840152602483015260018060a01b03165afa90811561068557600091611365575b501561135357565b6040516322d9eef360e21b8152600490fd5b61137d915060203d81116106cb576106bd8183610f24565b3861134b565b6000546001600160a01b0316330361139757565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a264697066735822122084a46800917d1ef2afdd46f0aa340d75dba068444f88fb4694f76d4c57e6585f64736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
-----Decoded View---------------
Arg [0] : hub (address): 0xDb46d1Dc155634FbC732f92E853b10B288AD5a1d
Arg [1] : moduleOwner (address): 0xf94b90BbEee30996019bABD12cEcdDCcf68331DE
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d
Arg [1] : 000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.