More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
FeeFollowModule
Compiler Version
v0.8.21+commit.d9974bed
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IFollowModule} from 'contracts/interfaces/IFollowModule.sol'; import {Errors} from 'contracts/modules/constants/Errors.sol'; import {FeeModuleBase} from 'contracts/modules/FeeModuleBase.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {HubRestricted} from 'contracts/base/HubRestricted.sol'; import {LensModuleMetadata} from 'contracts/modules/LensModuleMetadata.sol'; /** * @notice A struct containing the necessary data to execute follow actions on a given profile. * * @param currency The currency associated with this profile. * @param amount The following cost associated with this profile. * @param recipient The recipient address associated with this profile. */ struct FeeConfig { address currency; uint256 amount; address recipient; } /** * @title FeeFollowModule * @author Lens Protocol * * @notice This follow module charges a fee for every follow. */ contract FeeFollowModule is LensModuleMetadata, FeeModuleBase, HubRestricted, IFollowModule { function supportsInterface(bytes4 interfaceID) public pure override returns (bool) { return interfaceID == type(IFollowModule).interfaceId || super.supportsInterface(interfaceID); } using SafeERC20 for IERC20; mapping(uint256 profileId => FeeConfig config) internal _feeConfig; constructor( address hub, address moduleRegistry, address moduleOwner ) FeeModuleBase(hub, moduleRegistry) HubRestricted(hub) LensModuleMetadata(moduleOwner) {} /** * @inheritdoc IFollowModule * @param data The arbitrary data parameter, decoded into: * - address currency: The currency address, must be internally whitelisted. * - uint256 amount: The currency total amount to charge. * - address recipient: The custom recipient address to direct earnings to. */ function initializeFollowModule( uint256 profileId, address /* transactionExecutor */, bytes calldata data ) external override onlyHub returns (bytes memory) { FeeConfig memory feeConfig = abi.decode(data, (FeeConfig)); // We allow address(0) to allow burning the currency. But the token has to support transfers to address(0). // // We don't introduce the upper limit to the amount, even though it might overflow if the amount * treasuryFee // during processFollow. But this is a safe behavior, and a case that should never happen, because amounts close // to type(uint256).max don't make any sense from the economic standpoint. if (feeConfig.amount == 0) { if (feeConfig.currency != address(0)) { revert Errors.InitParamsInvalid(); } } else { _verifyErc20Currency(feeConfig.currency); } _feeConfig[profileId] = feeConfig; return ''; } /** * @inheritdoc IFollowModule * @notice Processes a follow by charging a fee. */ function processFollow( uint256 /* followerProfileId */, uint256 followTokenId, address transactionExecutor, uint256 targetProfileId, bytes calldata data ) external override onlyHub returns (bytes memory) { // We charge only when performing a fresh follow. if (followTokenId == 0) { uint256 amount = _feeConfig[targetProfileId].amount; address currency = _feeConfig[targetProfileId].currency; _validateDataIsExpected(data, currency, amount); if (amount == 0 || currency == address(0)) { // If the amount is zero, we don't charge anything. return ''; } (address treasury, uint16 treasuryFee) = _treasuryData(); address recipient = _feeConfig[targetProfileId].recipient; uint256 treasuryAmount = (amount * treasuryFee) / BPS_MAX; uint256 adjustedAmount = amount - treasuryAmount; IERC20(currency).safeTransferFrom(transactionExecutor, recipient, adjustedAmount); if (treasuryAmount > 0) { IERC20(currency).safeTransferFrom(transactionExecutor, treasury, treasuryAmount); } } else { // If following with a follow token, we validate the amount is zero. (, uint256 decodedAmount) = abi.decode(data, (address, uint256)); if (decodedAmount != 0) { revert Errors.InvalidParams(); } } return ''; } /** * @notice Returns fee configuration for a given profile. * * @param profileId The token ID of the profile to query. * * @return FeeConfig The FeeConfig struct mapped to that profile. */ function getFeeConfig(uint256 profileId) external view returns (FeeConfig memory) { return _feeConfig[profileId]; } }
// 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; /** * @title IFollowModule * @author Lens Protocol * * @notice This is the standard interface for all Lens-compatible Follow Modules. * These are responsible for processing the follow actions and can be used to implement any kind of follow logic. * For example: * - Token-gated follows (e.g. a user must hold a certain amount of a token to follow a profile). * - Paid follows (e.g. a user must pay a certain amount of a token to follow a profile). * - Rewarding users for following a profile. * - Etc. */ interface IFollowModule { /** * @notice Initializes a follow module for a given Lens profile. * @custom:permissions LensHub. * * @param profileId The Profile ID to initialize this follow module for. * @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 Follow Module during initialization. * * @return bytes The encoded data to be emitted from the hub. */ function initializeFollowModule( uint256 profileId, address transactionExecutor, bytes calldata data ) external returns (bytes memory); /** * @notice Processes a given follow. * @custom:permissions LensHub. * * @param followerProfileId The Profile ID of the follower's profile. * @param followTokenId The Follow Token ID that is being used to follow. Zero if we are processing a new fresh * follow, in this case, the follow ID assigned can be queried from the Follow NFT collection if needed. * @param transactionExecutor The address of the transaction executor (e.g. for any funds to transferFrom). * @param targetProfileId The token ID of the profile being followed. * @param data Arbitrary data passed by the follower. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function processFollow( uint256 followerProfileId, uint256 followTokenId, address transactionExecutor, uint256 targetProfileId, bytes calldata data ) external returns (bytes memory); }
// 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.8.15; interface IModuleRegistry { enum ModuleType { __, // Just to avoid 0 as valid ModuleType PUBLICATION_ACTION_MODULE, REFERENCE_MODULE, FOLLOW_MODULE } // Modules functions function verifyModule(address moduleAddress, uint256 moduleType) external returns (bool); function registerModule(address moduleAddress, uint256 moduleType) external returns (bool); function getModuleTypes(address moduleAddress) external view returns (uint256); function isModuleRegistered(address moduleAddress) external view returns (bool); function isModuleRegisteredAs(address moduleAddress, uint256 moduleType) external view returns (bool); // Currencies functions function verifyErc20Currency(address currencyAddress) external returns (bool); function registerErc20Currency(address currencyAddress) external returns (bool); function isErc20CurrencyRegistered(address currencyAddress) external view returns (bool); }
// 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.10; import {Errors} from 'contracts/modules/constants/Errors.sol'; import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {IModuleRegistry} from 'contracts/interfaces/IModuleRegistry.sol'; /** * @title FeeModuleBase * @author Lens Protocol * * @notice This is an abstract contract to be inherited from by modules that require basic fee functionality. * It contains getters for module globals parameters as well as a validation function to check expected data. */ abstract contract FeeModuleBase { uint16 internal constant BPS_MAX = 10000; ILensHub private immutable HUB; IModuleRegistry public immutable MODULE_REGISTRY; constructor(address hub, address moduleRegistry) { HUB = ILensHub(hub); MODULE_REGISTRY = IModuleRegistry(moduleRegistry); } function _verifyErc20Currency(address currency) internal { if (currency != address(0)) { MODULE_REGISTRY.verifyErc20Currency(currency); } } function _treasuryData() internal view returns (address, uint16) { return HUB.getTreasuryData(); } function _validateDataIsExpected(bytes calldata data, address currency, uint256 amount) internal pure { (address decodedCurrency, uint256 decodedAmount) = abi.decode(data, (address, uint256)); if (decodedAmount != amount || decodedCurrency != currency) { revert Errors.ModuleDataMismatch(); } } }
// 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; library Errors { error FollowInvalid(); error ModuleDataMismatch(); error NotHub(); error InitParamsInvalid(); error InvalidParams(); error MintLimitExceeded(); error CollectExpired(); error NotActionModule(); error CollectNotAllowed(); error AlreadyInitialized(); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {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 // 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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@ensdomains/=node_modules/@ensdomains/", "@openzeppelin/=lib/openzeppelin-contracts/", "@seadrop/=lib/seadrop/src/", "ERC721A-Upgradeable/=lib/seadrop/lib/ERC721A-Upgradeable/contracts/", "ERC721A/=lib/seadrop/lib/ERC721A/contracts/", "create2-helpers/=lib/seadrop/lib/create2-helpers/", "create2-scripts/=lib/seadrop/lib/create2-helpers/script/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/seadrop/lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat/=node_modules/hardhat/", "murky/=lib/seadrop/lib/murky/src/", "openzeppelin-contracts-upgradeable/=lib/seadrop/lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/seadrop/lib/openzeppelin-contracts/contracts/", "operator-filter-registry/=lib/seadrop/lib/operator-filter-registry/src/", "seadrop/=lib/seadrop/", "solady/=lib/solady/src/", "solmate/=lib/seadrop/lib/solmate/src/", "utility-contracts/=lib/seadrop/lib/utility-contracts/src/" ], "optimizer": { "enabled": true, "runs": 10 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"hub","type":"address"},{"internalType":"address","name":"moduleRegistry","type":"address"},{"internalType":"address","name":"moduleOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InitParamsInvalid","type":"error"},{"inputs":[],"name":"InvalidParams","type":"error"},{"inputs":[],"name":"ModuleDataMismatch","type":"error"},{"inputs":[],"name":"NotHub","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":"MODULE_REGISTRY","outputs":[{"internalType":"contract IModuleRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"profileId","type":"uint256"}],"name":"getFeeConfig","outputs":[{"components":[{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct FeeConfig","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":"address","name":"","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"initializeFollowModule","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":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"followTokenId","type":"uint256"},{"internalType":"address","name":"transactionExecutor","type":"address"},{"internalType":"uint256","name":"targetProfileId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"processFollow","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","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
60e0346100c457601f610fb138819003918201601f19168301916001600160401b038311848410176100c9578084926060946040528339810103126100c457610047816100df565b90610071610063604061005c602085016100df565b93016100df565b61006c336100f3565b6100f3565b6001600160a01b038281166080521660a05260c052604051610e76908161013b823960805181610a51015260a0518181816102070152610419015260c05181818160f10152818161045c01526105000152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100c457565b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe60806040908082526004918236101561001757600080fd5b600091823560e01c90816301ffc9a71461071e5750806303ee438c14610354578063681591c114610595578063715018a61461054d5780638a19dde1146104b25780638da5cb5b1461048b578063a4c52b8614610448578063b95ddb5214610405578063c8b7cdb514610384578063ce90d52e14610354578063f2fde38b1461029b5763fa11df62146100a957600080fd5b34610297576060366003190112610297576001600160a01b039060243582811603610293576044356001600160401b03811161027f576100ec9036908601610974565b8391937f000000000000000000000000000000000000000000000000000000000000000016330361028357836060918101031261027f5781519261012f846107d6565b6101388161095b565b91828552602094858301359361015586888401958787520161095b565b828701908152946101d35750818151166101c3576002906101bf9697985b35895281885282868a209151169360018060a01b0319948583541617825551600182015501925116908254161790558051936101ae85610822565b845251928284938452830190610900565b0390f35b84516348be0eb360e01b81528890fd5b969790968216806101ed575b506101bf9596600291610173565b855190633f8ecfd360e21b82528282015286816024818c877f0000000000000000000000000000000000000000000000000000000000000000165af1801561027557916101bf979891600293610248575b50915096956101df565b610267908a3d8c1161026e575b61025f818361083d565b8101906109a1565b503861023e565b503d610255565b86513d8b823e3d90fd5b8380fd5b82516313bd2e8360e31b81528690fd5b8280fd5b5080fd5b50829034610293576020366003190112610293576001600160a01b03823581811693919290849003610350576102cf610be4565b83156102fe57505082546001600160a01b031981168317845516600080516020610e218339815191528380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8480fd5b50346102975781600319360112610297576101bf90610371610860565b9051918291602083526020830190610900565b508234610293576020366003190112610293578282916060948380516103a9816107d6565b82815282602082015201523581526002602052209080516103c9816107d6565b60018060a01b03908184541693848252838360026001840154936020860194855201541692019182528351948552516020850152511690820152f35b5034610297578160031936011261029757517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5034610297578160031936011261029757517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5034610297578160031936011261029757905490516001600160a01b039091168152602090f35b50903461054a5760a036600319011261054a576001600160a01b039060443590828216820361054a57608435906001600160401b03821161054a57506104fb9036908601610974565b9490927f000000000000000000000000000000000000000000000000000000000000000016330361053c575092610371916101bf94606435906024356109df565b83516313bd2e8360e31b8152fd5b80fd5b823461054a578060031936011261054a57610566610be4565b80546001600160a01b03198116825581906001600160a01b0316600080516020610e218339815191528280a380f35b5091346102975760209081600319360112610293576001600160401b0390803582811161035057366023820112156103505780820135906105e16105d883610940565b9751978861083d565b818752366024838301011161071a578186926024879301838a013787010152610608610be4565b8451918211610707575060019161061f835461079c565b601f81116106c1575b5080601f83116001146106625750839482939492610657575b5050600019600383901b1c191690821b17905580f35b015190503880610641565b90601f198316958486528286209286905b8882106106aa5750508385969710610691575b505050811b01905580f35b015160001960f88460031b161c19169055388080610686565b808785968294968601518155019501930190610673565b838552818520601f840160051c8101918385106106fd575b601f0160051c019084905b8281106106f2575050610628565b8681550184906106e4565b90915081906106d9565b634e487b7160e01b845260419052602483fd5b8580fd5b929390503461027f57602036600319011261027f573563ffffffff60e01b8082168092036103505760209450637008028360e01b8214938415610767575b505050519015158152f35b9091929350848101906a4c454e535f4d4f44554c4560a81b8252600b815261078e81610807565b51902016149038808061075c565b90600182811c921680156107cc575b60208310146107b657565b634e487b7160e01b600052602260045260246000fd5b91607f16916107ab565b606081019081106001600160401b038211176107f157604052565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b038211176107f157604052565b602081019081106001600160401b038211176107f157604052565b601f909101601f19168101906001600160401b038211908210176107f157604052565b604051906000826001918254926108768461079c565b9081845260209481811690816000146108e057506001146108a2575b50506108a09250038361083d565b565b600081815285812095935091905b8183106108c85750506108a093508201013880610892565b855488840185015294850194879450918301916108b0565b9150506108a094925060ff191682840152151560051b8201013880610892565b919082519283825260005b84811061092c575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161090b565b6001600160401b0381116107f157601f01601f191660200190565b35906001600160a01b038216820361096f57565b600080fd5b9181601f8401121561096f578235916001600160401b03831161096f576020838186019501011161096f57565b9081602091031261096f5751801515810361096f5790565b919082604091031261096f5781356001600160a01b038116810361096f57916020013590565b929392610bbc576000928284526002602052604092610a1a848620600181015493849160018060a01b039384809254169a8b938101906109b9565b9390931492831593610baf575b505050610b9e57821590818015610b96575b610b7e5785516398f965d160e01b81529580876004817f000000000000000000000000000000000000000000000000000000000000000086165afa938415610b745788978995610b1e575b5061ffff92916002918a5281602052892001541692169081840291848304141715610b0a57612710900494858303928311610af6575090610ac6918387610c3c565b82610ae4575b505050505b604051610add81610822565b6000815290565b610aed93610c3c565b38808080610acc565b634e487b7160e01b81526011600452602490fd5b634e487b7160e01b86526011600452602486fd5b975093508087813d8111610b6d575b610b37818361083d565b81010312610b69578651968288168803610b6557602001519661ffff88168803610b6557969361ffff610a84565b8880fd5b8780fd5b503d610b2d565b81513d8a823e3d90fd5b50505050509091505190610b9182610822565b815290565b508715610a39565b84516346308bd560e01b8152600490fd5b1614159050878238610a27565b505090610bcb918101906109b9565b905015610ad157604051635435b28960e11b8152600490fd5b6000546001600160a01b03163303610bf857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6040516323b872dd60e01b60208083019182526001600160a01b039485166024840152948416604483015260648083019690965294815292939260a081019290916001600160401b038411838510176107f157610d03946000928392866040521693610ca786610807565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152519082855af13d15610d7f573d91610ce783610940565b92610cf5604051948561083d565b83523d60008785013e610d83565b80519081610d1057505050565b8280610d209383010191016109a1565b15610d285750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6060915b91929015610de55750815115610d97575090565b3b15610da05790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610df85750805190602001fd5b60405162461bcd60e51b815260206004820152908190610e1c906024830190610900565b0390fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a264697066735822122078d473aee18adad6ad4f957987e810e281aea73c8edad7ee1eaac904288649bc64736f6c63430008150033000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff9000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
Deployed Bytecode
0x60806040908082526004918236101561001757600080fd5b600091823560e01c90816301ffc9a71461071e5750806303ee438c14610354578063681591c114610595578063715018a61461054d5780638a19dde1146104b25780638da5cb5b1461048b578063a4c52b8614610448578063b95ddb5214610405578063c8b7cdb514610384578063ce90d52e14610354578063f2fde38b1461029b5763fa11df62146100a957600080fd5b34610297576060366003190112610297576001600160a01b039060243582811603610293576044356001600160401b03811161027f576100ec9036908601610974565b8391937f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d16330361028357836060918101031261027f5781519261012f846107d6565b6101388161095b565b91828552602094858301359361015586888401958787520161095b565b828701908152946101d35750818151166101c3576002906101bf9697985b35895281885282868a209151169360018060a01b0319948583541617825551600182015501925116908254161790558051936101ae85610822565b845251928284938452830190610900565b0390f35b84516348be0eb360e01b81528890fd5b969790968216806101ed575b506101bf9596600291610173565b855190633f8ecfd360e21b82528282015286816024818c877f0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff9165af1801561027557916101bf979891600293610248575b50915096956101df565b610267908a3d8c1161026e575b61025f818361083d565b8101906109a1565b503861023e565b503d610255565b86513d8b823e3d90fd5b8380fd5b82516313bd2e8360e31b81528690fd5b8280fd5b5080fd5b50829034610293576020366003190112610293576001600160a01b03823581811693919290849003610350576102cf610be4565b83156102fe57505082546001600160a01b031981168317845516600080516020610e218339815191528380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8480fd5b50346102975781600319360112610297576101bf90610371610860565b9051918291602083526020830190610900565b508234610293576020366003190112610293578282916060948380516103a9816107d6565b82815282602082015201523581526002602052209080516103c9816107d6565b60018060a01b03908184541693848252838360026001840154936020860194855201541692019182528351948552516020850152511690820152f35b5034610297578160031936011261029757517f0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff96001600160a01b03168152602090f35b5034610297578160031936011261029757517f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b03168152602090f35b5034610297578160031936011261029757905490516001600160a01b039091168152602090f35b50903461054a5760a036600319011261054a576001600160a01b039060443590828216820361054a57608435906001600160401b03821161054a57506104fb9036908601610974565b9490927f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d16330361053c575092610371916101bf94606435906024356109df565b83516313bd2e8360e31b8152fd5b80fd5b823461054a578060031936011261054a57610566610be4565b80546001600160a01b03198116825581906001600160a01b0316600080516020610e218339815191528280a380f35b5091346102975760209081600319360112610293576001600160401b0390803582811161035057366023820112156103505780820135906105e16105d883610940565b9751978861083d565b818752366024838301011161071a578186926024879301838a013787010152610608610be4565b8451918211610707575060019161061f835461079c565b601f81116106c1575b5080601f83116001146106625750839482939492610657575b5050600019600383901b1c191690821b17905580f35b015190503880610641565b90601f198316958486528286209286905b8882106106aa5750508385969710610691575b505050811b01905580f35b015160001960f88460031b161c19169055388080610686565b808785968294968601518155019501930190610673565b838552818520601f840160051c8101918385106106fd575b601f0160051c019084905b8281106106f2575050610628565b8681550184906106e4565b90915081906106d9565b634e487b7160e01b845260419052602483fd5b8580fd5b929390503461027f57602036600319011261027f573563ffffffff60e01b8082168092036103505760209450637008028360e01b8214938415610767575b505050519015158152f35b9091929350848101906a4c454e535f4d4f44554c4560a81b8252600b815261078e81610807565b51902016149038808061075c565b90600182811c921680156107cc575b60208310146107b657565b634e487b7160e01b600052602260045260246000fd5b91607f16916107ab565b606081019081106001600160401b038211176107f157604052565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b038211176107f157604052565b602081019081106001600160401b038211176107f157604052565b601f909101601f19168101906001600160401b038211908210176107f157604052565b604051906000826001918254926108768461079c565b9081845260209481811690816000146108e057506001146108a2575b50506108a09250038361083d565b565b600081815285812095935091905b8183106108c85750506108a093508201013880610892565b855488840185015294850194879450918301916108b0565b9150506108a094925060ff191682840152151560051b8201013880610892565b919082519283825260005b84811061092c575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161090b565b6001600160401b0381116107f157601f01601f191660200190565b35906001600160a01b038216820361096f57565b600080fd5b9181601f8401121561096f578235916001600160401b03831161096f576020838186019501011161096f57565b9081602091031261096f5751801515810361096f5790565b919082604091031261096f5781356001600160a01b038116810361096f57916020013590565b929392610bbc576000928284526002602052604092610a1a848620600181015493849160018060a01b039384809254169a8b938101906109b9565b9390931492831593610baf575b505050610b9e57821590818015610b96575b610b7e5785516398f965d160e01b81529580876004817f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d86165afa938415610b745788978995610b1e575b5061ffff92916002918a5281602052892001541692169081840291848304141715610b0a57612710900494858303928311610af6575090610ac6918387610c3c565b82610ae4575b505050505b604051610add81610822565b6000815290565b610aed93610c3c565b38808080610acc565b634e487b7160e01b81526011600452602490fd5b634e487b7160e01b86526011600452602486fd5b975093508087813d8111610b6d575b610b37818361083d565b81010312610b69578651968288168803610b6557602001519661ffff88168803610b6557969361ffff610a84565b8880fd5b8780fd5b503d610b2d565b81513d8a823e3d90fd5b50505050509091505190610b9182610822565b815290565b508715610a39565b84516346308bd560e01b8152600490fd5b1614159050878238610a27565b505090610bcb918101906109b9565b905015610ad157604051635435b28960e11b8152600490fd5b6000546001600160a01b03163303610bf857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6040516323b872dd60e01b60208083019182526001600160a01b039485166024840152948416604483015260648083019690965294815292939260a081019290916001600160401b038411838510176107f157610d03946000928392866040521693610ca786610807565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152519082855af13d15610d7f573d91610ce783610940565b92610cf5604051948561083d565b83523d60008785013e610d83565b80519081610d1057505050565b8280610d209383010191016109a1565b15610d285750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6060915b91929015610de55750815115610d97575090565b3b15610da05790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610df85750805190602001fd5b60405162461bcd60e51b815260206004820152908190610e1c906024830190610900565b0390fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a264697066735822122078d473aee18adad6ad4f957987e810e281aea73c8edad7ee1eaac904288649bc64736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff9000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
-----Decoded View---------------
Arg [0] : hub (address): 0xDb46d1Dc155634FbC732f92E853b10B288AD5a1d
Arg [1] : moduleRegistry (address): 0x1eD5983F0c883B96f7C35528a1e22EEA67DE3Ff9
Arg [2] : moduleOwner (address): 0xf94b90BbEee30996019bABD12cEcdDCcf68331DE
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d
Arg [1] : 0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff9
Arg [2] : 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.