Polygon Sponsored slots available. Book your slot here!
More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Renounce Ownersh... | 56160750 | 239 days ago | IN | 0 POL | 0.0035376 |
Loading...
Loading
This contract contains unverified libraries: ActionLib, GovernanceLib
Contract Name:
SimpleFeeCollectModule
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 {BaseFeeCollectModule} from 'contracts/modules/act/collect/base/BaseFeeCollectModule.sol'; import {BaseFeeCollectModuleInitData, BaseProfilePublicationData} from 'contracts/modules/interfaces/IBaseFeeCollectModule.sol'; import {ICollectModule} from 'contracts/modules/interfaces/ICollectModule.sol'; import {LensModuleMetadata} from 'contracts/modules/LensModuleMetadata.sol'; import {LensModule} from 'contracts/modules/LensModule.sol'; /** * @title SimpleFeeCollectModule * @author Lens Protocol * * @notice This is a simple Lens CollectModule implementation, allowing customization of time to collect, * number of collects and whether only followers can collect. * * You can build your own collect modules by inheriting from BaseFeeCollectModule and adding your * functionality along with getPublicationData function. */ contract SimpleFeeCollectModule is BaseFeeCollectModule, LensModuleMetadata { constructor( address hub, address actionModule, address moduleRegistry, address moduleOwner ) BaseFeeCollectModule(hub, actionModule, moduleRegistry) LensModuleMetadata(moduleOwner) {} /** * @inheritdoc ICollectModule * @notice This collect module levies a fee on collects and supports referrals. Thus, we need to decode data. * @param data The arbitrary data parameter, decoded into BaseFeeCollectModuleInitData struct: * amount: The collecting cost associated with this publication. 0 for free collect. * collectLimit: The maximum number of collects for this publication. 0 for no limit. * currency: The currency associated with this publication. * referralFee: The referral fee associated with this publication. * followerOnly: True if only followers of publisher may collect the post. * endTimestamp: The end timestamp after which collecting is impossible. 0 for no expiry. * recipient: Recipient of collect fees. * * @return An abi encoded bytes parameter, which is the same as the passed data parameter. */ function initializePublicationCollectModule( uint256 profileId, uint256 pubId, address /* transactionExecutor */, bytes calldata data ) external override onlyActionModule returns (bytes memory) { BaseFeeCollectModuleInitData memory baseInitData = abi.decode(data, (BaseFeeCollectModuleInitData)); _validateBaseInitData(baseInitData); _storeBasePublicationCollectParameters(profileId, pubId, baseInitData); return ''; } /** * @notice Returns the publication data for a given publication, or an empty struct if that publication was not * initialized with this module. * * @param profileId The token ID of the profile mapped to the publication to query. * @param pubId The publication ID of the publication to query. * * @return The BaseProfilePublicationData struct mapped to that publication. */ function getPublicationData( uint256 profileId, uint256 pubId ) external view virtual returns (BaseProfilePublicationData memory) { return getBasePublicationData(profileId, pubId); } function supportsInterface( bytes4 interfaceID ) public pure override(BaseFeeCollectModule, LensModule) returns (bool) { return BaseFeeCollectModule.supportsInterface(interfaceID) || LensModule.supportsInterface(interfaceID); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title IERC721Burnable * @author Lens Protocol * * @notice Extension of ERC-721 including a function that allows the token to be burned. */ interface IERC721Burnable { /** * @notice Burns an NFT, removing it from circulation and essentially destroying it. * @custom:permission Owner of the NFT. * * @param tokenId The token ID of the token to burn. */ function burn(uint256 tokenId) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title IERC721MetaTx * @author Lens Protocol * * @notice Extension of ERC-721 including meta-tx signatures related functions. */ interface IERC721MetaTx { /** * @notice Returns the current signature nonce of the given signer. * * @param signer The address for which to query the nonce. * * @return uint256 The current nonce of the given signer. */ function nonces(address signer) external view returns (uint256); /** * @notice Returns the EIP-712 domain separator for this contract. * * @return bytes32 The domain separator. */ function getDomainSeparator() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title IERC721Timestamped * @author Lens Protocol * * @notice Extension of ERC-721 including a struct for token data, which contains the owner and the mint timestamp, as * well as their associated getters. */ interface IERC721Timestamped { /** * @notice Returns the mint timestamp associated with a given NFT. * * @param tokenId The token ID of the NFT to query the mint timestamp for. * * @return uint256 Mint timestamp, this is stored as a uint96 but returned as a uint256 to reduce unnecessary * padding. */ function mintTimestampOf(uint256 tokenId) external view returns (uint256); /** * @notice Returns the token data associated with a given NFT. This allows fetching the token owner and * mint timestamp in a single call. * * @param tokenId The token ID of the NFT to query the token data for. * * @return TokenData A struct containing both the owner address and the mint timestamp. */ function tokenDataOf(uint256 tokenId) external view returns (Types.TokenData memory); /** * @notice Returns whether a token with the given token ID exists. * * @param tokenId The token ID of the NFT to check existence for. * * @return bool True if the token exists. */ function exists(uint256 tokenId) external view returns (bool); /** * @notice Returns the amount of tokens in circulation. * * @return uint256 The current total supply of tokens. */ function totalSupply() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import {IERC721Timestamped} from 'contracts/interfaces/IERC721Timestamped.sol'; import {IERC721Burnable} from 'contracts/interfaces/IERC721Burnable.sol'; import {IERC721MetaTx} from 'contracts/interfaces/IERC721MetaTx.sol'; import {IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; interface ILensERC721 is IERC721, IERC721Timestamped, IERC721Burnable, IERC721MetaTx, IERC721Metadata {}
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title ILensGovernable * @author Lens Protocol * * @notice This is the interface for the Lens Protocol main governance functions. */ interface ILensGovernable { /** * @notice Sets the privileged governance role. * @custom:permissions Governance. * * @param newGovernance The new governance address to set. */ function setGovernance(address newGovernance) external; /** * @notice Sets the emergency admin, which is a permissioned role able to set the protocol state. * @custom:permissions Governance. * * @param newEmergencyAdmin The new emergency admin address to set. */ function setEmergencyAdmin(address newEmergencyAdmin) external; /** * @notice Sets the protocol state to either a global pause, a publishing pause or an unpaused state. * @custom:permissions Governance or Emergency Admin. Emergency Admin can only restrict more. * * @param newState The state to set. It can be one of the following: * - Unpaused: The protocol is fully operational. * - PublishingPaused: The protocol is paused for publishing, but it is still operational for others operations. * - Paused: The protocol is paused for all operations. */ function setState(Types.ProtocolState newState) external; /** * @notice Adds or removes a profile creator from the whitelist. * @custom:permissions Governance. * * @param profileCreator The profile creator address to add or remove from the whitelist. * @param whitelist Whether or not the profile creator should be whitelisted. */ function whitelistProfileCreator(address profileCreator, bool whitelist) external; /** * @notice Sets the treasury address. * @custom:permissions Governance * * @param newTreasury The new treasury address to set. */ function setTreasury(address newTreasury) external; /** * @notice Sets the treasury fee. * @custom:permissions Governance * * @param newTreasuryFee The new treasury fee to set. */ function setTreasuryFee(uint16 newTreasuryFee) external; /** * @notice Returns the currently configured governance address. * * @return address The address of the currently configured governance. */ function getGovernance() external view returns (address); /** * @notice Gets the state currently set in the protocol. It could be a global pause, a publishing pause or an * unpaused state. * @custom:permissions Anyone. * * @return Types.ProtocolState The state currently set in the protocol. */ function getState() external view returns (Types.ProtocolState); /** * @notice Returns whether or not a profile creator is whitelisted. * * @param profileCreator The address of the profile creator to check. * * @return bool True if the profile creator is whitelisted, false otherwise. */ function isProfileCreatorWhitelisted(address profileCreator) external view returns (bool); /** * @notice Returns the treasury address. * * @return address The treasury address. */ function getTreasury() external view returns (address); /** * @notice Returns the treasury fee. * * @return uint16 The treasury fee. */ function getTreasuryFee() external view returns (uint16); /** * @notice Returns the treasury address and treasury fee in a single call. * * @return tuple First, the treasury address, second, the treasury fee. */ function getTreasuryData() external view returns (address, uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ILensProtocol} from 'contracts/interfaces/ILensProtocol.sol'; import {ILensGovernable} from 'contracts/interfaces/ILensGovernable.sol'; import {ILensHubEventHooks} from 'contracts/interfaces/ILensHubEventHooks.sol'; import {ILensImplGetters} from 'contracts/interfaces/ILensImplGetters.sol'; import {ILensProfiles} from 'contracts/interfaces/ILensProfiles.sol'; import {ILensVersion} from 'contracts/interfaces/ILensVersion.sol'; interface ILensHub is ILensProfiles, ILensProtocol, ILensGovernable, ILensHubEventHooks, ILensImplGetters, ILensVersion {}
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title ILensHubEventHooks * @author Lens Protocol * * @notice This is the interface for the LensHub contract's event hooks. As we want most of the core events to be * emitted by the LensHub contract, event hooks are needed for core events generated by pheripheral contracts. */ interface ILensHubEventHooks { /** * @dev Helper function to emit an `Unfollowed` event from the hub, to be consumed by indexers to track unfollows. * @custom:permissions FollowNFT of the Profile unfollowed. * * @param unfollowerProfileId The ID of the profile that executed the unfollow. * @param idOfProfileUnfollowed The ID of the profile that was unfollowed. * @param transactionExecutor The address of the account executing the unfollow operation. */ function emitUnfollowedEvent( uint256 unfollowerProfileId, uint256 idOfProfileUnfollowed, address transactionExecutor ) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title ILensImplGetters * @author Lens Protocol * * @notice This is the interface for the LensHub contract's implementation getters. These implementations will be used * for deploying each respective contract for each profile. */ interface ILensImplGetters { /** * @notice Returns the Follow NFT implementation address that is used for all deployed Follow NFTs. * * @return address The Follow NFT implementation address. */ function getFollowNFTImpl() external view returns (address); /** * @notice Returns the Collect NFT implementation address that is used for each new deployed Collect NFT. * @custom:pending-deprecation * * @return address The Collect NFT implementation address. */ function getLegacyCollectNFTImpl() external view returns (address); /** * @notice Returns the address of the registry that stores all modules that are used by the Lens Protocol. * * @return address The address of the Module Registry contract. */ function getModuleRegistry() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ILensERC721} from 'contracts/interfaces/ILensERC721.sol'; interface ILensProfiles is ILensERC721 { /** * @notice DANGER: Triggers disabling the profile protection mechanism for the msg.sender, which will allow * transfers or approvals over profiles held by it. * Disabling the mechanism will have a timelock before it becomes effective, allowing the owner to re-enable * the protection back in case of being under attack. * The protection layer only applies to EOA wallets. */ function DANGER__disableTokenGuardian() external; /** * @notice Enables back the profile protection mechanism for the msg.sender, preventing profile transfers or * approvals (except when revoking them). * The protection layer only applies to EOA wallets. */ function enableTokenGuardian() external; /** * @notice Returns the timestamp at which the Token Guardian will become effectively disabled. * * @param wallet The address to check the timestamp for. * * @return uint256 The timestamp at which the Token Guardian will become effectively disabled. Zero if enabled. */ function getTokenGuardianDisablingTimestamp(address wallet) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title ILensProtocol * @author Lens Protocol * * @notice This is the interface for Lens Protocol's core functions. It contains all the entry points for performing * social operations. */ interface ILensProtocol { /** * @notice Creates a profile with the specified parameters, minting a Profile NFT to the given recipient. * @custom:permissions Any whitelisted profile creator. * * @param createProfileParams A CreateProfileParams struct containing the needed params. */ function createProfile(Types.CreateProfileParams calldata createProfileParams) external returns (uint256); /** * @notice Sets the metadata URI for the given profile. * @custom:permissions Profile Owner or Delegated Executor. * * @param profileId The token ID of the profile to set the metadata URI for. * @param metadataURI The metadata URI to set for the given profile. */ function setProfileMetadataURI(uint256 profileId, string calldata metadataURI) external; /** * @custom:meta-tx setProfileMetadataURI. */ function setProfileMetadataURIWithSig( uint256 profileId, string calldata metadataURI, Types.EIP712Signature calldata signature ) external; /** * @notice Sets the follow module for the given profile. * @custom:permissions Profile Owner or Delegated Executor. * * @param profileId The token ID of the profile to set the follow module for. * @param followModule The follow module to set for the given profile, must be whitelisted. * @param followModuleInitData The data to be passed to the follow module for initialization. */ function setFollowModule(uint256 profileId, address followModule, bytes calldata followModuleInitData) external; /** * @custom:meta-tx setFollowModule. */ function setFollowModuleWithSig( uint256 profileId, address followModule, bytes calldata followModuleInitData, Types.EIP712Signature calldata signature ) external; /** * @notice Changes the delegated executors configuration for the given profile. It allows setting the approvals for * delegated executors in the specified configuration, as well as switching to it. * @custom:permissions Profile Owner. * * @param delegatorProfileId The ID of the profile to which the delegated executor is being changed for. * @param delegatedExecutors The array of delegated executors to set the approval for. * @param approvals The array of booleans indicating the corresponding executor's new approval status. * @param configNumber The number of the configuration where the executor approval state is being set. * @param switchToGivenConfig A boolean indicating if the configuration must be switched to the one with the given * number. */ function changeDelegatedExecutorsConfig( uint256 delegatorProfileId, address[] calldata delegatedExecutors, bool[] calldata approvals, uint64 configNumber, bool switchToGivenConfig ) external; /** * @notice Changes the delegated executors configuration for the given profile under the current configuration. * @custom:permissions Profile Owner. * * @param delegatorProfileId The ID of the profile to which the delegated executor is being changed for. * @param delegatedExecutors The array of delegated executors to set the approval for. * @param approvals The array of booleans indicating the corresponding executor's new approval status. */ function changeDelegatedExecutorsConfig( uint256 delegatorProfileId, address[] calldata delegatedExecutors, bool[] calldata approvals ) external; /** * @custom:meta-tx changeDelegatedExecutorsConfig. */ function changeDelegatedExecutorsConfigWithSig( uint256 delegatorProfileId, address[] calldata delegatedExecutors, bool[] calldata approvals, uint64 configNumber, bool switchToGivenConfig, Types.EIP712Signature calldata signature ) external; /** * @notice Publishes a post. * Post is the most basic publication type, and can be used to publish any kind of content. * Posts can have these types of modules initialized: * - Action modules: any number of publication actions (e.g. collect, tip, etc.) * - Reference module: a module handling the rules when referencing this post (e.g. token-gated comments) * @custom:permissions Profile Owner or Delegated Executor. * * @param postParams A PostParams struct containing the needed parameters. * * @return uint256 An integer representing the post's publication ID. */ function post(Types.PostParams calldata postParams) external returns (uint256); /** * @custom:meta-tx post. */ function postWithSig( Types.PostParams calldata postParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Publishes a comment on the given publication. * Comment is a type of reference publication that points to another publication. * Comments can have these types of modules initialized: * - Action modules: any number of publication actions (e.g. collect, tip, etc.) * - Reference module: a module handling the rules when referencing this comment (e.g. token-gated mirrors) * Comments can have referrers (e.g. publications or profiles that helped to discover the pointed publication). * @custom:permissions Profile Owner or Delegated Executor. * * @param commentParams A CommentParams struct containing the needed parameters. * * @return uint256 An integer representing the comment's publication ID. */ function comment(Types.CommentParams calldata commentParams) external returns (uint256); /** * @custom:meta-tx comment. */ function commentWithSig( Types.CommentParams calldata commentParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Publishes a mirror of the given publication. * Mirror is a type of reference publication that points to another publication but doesn't have content. * Mirrors don't have any modules initialized. * Mirrors can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * You cannot mirror a mirror, comment on a mirror, or quote a mirror. * @custom:permissions Profile Owner or Delegated Executor. * * @param mirrorParams A MirrorParams struct containing the necessary parameters. * * @return uint256 An integer representing the mirror's publication ID. */ function mirror(Types.MirrorParams calldata mirrorParams) external returns (uint256); /** * @custom:meta-tx mirror. */ function mirrorWithSig( Types.MirrorParams calldata mirrorParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Publishes a quote of the given publication. * Quote is a type of reference publication similar to mirror, but it has content and modules. * Quotes can have these types of modules initialized: * - Action modules: any number of publication actions (e.g. collect, tip, etc.) * - Reference module: a module handling the rules when referencing this quote (e.g. token-gated comments on quote) * Quotes can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * Unlike mirrors, you can mirror a quote, comment on a quote, or quote a quote. * @custom:permissions Profile Owner or Delegated Executor. * * @param quoteParams A QuoteParams struct containing the needed parameters. * * @return uint256 An integer representing the quote's publication ID. */ function quote(Types.QuoteParams calldata quoteParams) external returns (uint256); /** * @custom:meta-tx quote. */ function quoteWithSig( Types.QuoteParams calldata quoteParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Follows given profiles, executing each profile's follow module logic (if any). * @custom:permissions Profile Owner or Delegated Executor. * * @dev Both the `idsOfProfilesToFollow`, `followTokenIds`, and `datas` arrays must be of the same length, * regardless if the profiles do not have a follow module set. * * @param followerProfileId The ID of the profile the follows are being executed for. * @param idsOfProfilesToFollow The array of IDs of profiles to follow. * @param followTokenIds The array of follow token IDs to use for each follow (0 if you don't own a follow token). * @param datas The arbitrary data array to pass to the follow module for each profile if needed. * * @return uint256[] An array of follow token IDs representing the follow tokens created for each follow. */ function follow( uint256 followerProfileId, uint256[] calldata idsOfProfilesToFollow, uint256[] calldata followTokenIds, bytes[] calldata datas ) external returns (uint256[] memory); /** * @custom:meta-tx follow. */ function followWithSig( uint256 followerProfileId, uint256[] calldata idsOfProfilesToFollow, uint256[] calldata followTokenIds, bytes[] calldata datas, Types.EIP712Signature calldata signature ) external returns (uint256[] memory); /** * @notice Unfollows given profiles. * @custom:permissions Profile Owner or Delegated Executor. * * @param unfollowerProfileId The ID of the profile the unfollows are being executed for. * @param idsOfProfilesToUnfollow The array of IDs of profiles to unfollow. */ function unfollow(uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow) external; /** * @custom:meta-tx unfollow. */ function unfollowWithSig( uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow, Types.EIP712Signature calldata signature ) external; /** * @notice Sets the block status for the given profiles. Changing a profile's block status to `true` (i.e. blocked), * when will also force them to unfollow. * Blocked profiles cannot perform any actions with the profile that blocked them: they cannot comment or mirror * their publications, they cannot follow them, they cannot collect, tip them, etc. * @custom:permissions Profile Owner or Delegated Executor. * * @dev Both the `idsOfProfilesToSetBlockStatus` and `blockStatus` arrays must be of the same length. * * @param byProfileId The ID of the profile that is blocking/unblocking somebody. * @param idsOfProfilesToSetBlockStatus The array of IDs of profiles to set block status. * @param blockStatus The array of block statuses to use for each (true is blocked). */ function setBlockStatus( uint256 byProfileId, uint256[] calldata idsOfProfilesToSetBlockStatus, bool[] calldata blockStatus ) external; /** * @custom:meta-tx setBlockStatus. */ function setBlockStatusWithSig( uint256 byProfileId, uint256[] calldata idsOfProfilesToSetBlockStatus, bool[] calldata blockStatus, Types.EIP712Signature calldata signature ) external; /** * @notice Collects a given publication via signature with the specified parameters. * Collect can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * @custom:permissions Collector Profile Owner or its Delegated Executor. * @custom:pending-deprecation Collect modules were replaced by PublicationAction Collect modules in V2. This method * is left here for backwards compatibility with posts made in V1 that had Collect modules. * * @param collectParams A CollectParams struct containing the parameters. * * @return uint256 An integer representing the minted token ID. */ function collectLegacy(Types.LegacyCollectParams calldata collectParams) external returns (uint256); /** * @custom:meta-tx collect. * @custom:pending-deprecation */ function collectLegacyWithSig( Types.LegacyCollectParams calldata collectParams, Types.EIP712Signature calldata signature ) external returns (uint256); /** * @notice Acts on a given publication with the specified parameters. * You can act on a publication except a mirror (if it has at least one action module initialized). * Actions can have referrers (e.g. publications or profiles that allowed to discover the pointed publication). * @custom:permissions Actor Profile Owner or its Delegated Executor. * * @param publicationActionParams A PublicationActionParams struct containing the parameters. * * @return bytes Arbitrary data the action module returns. */ function act(Types.PublicationActionParams calldata publicationActionParams) external returns (bytes memory); /** * @custom:meta-tx act. */ function actWithSig( Types.PublicationActionParams calldata publicationActionParams, Types.EIP712Signature calldata signature ) external returns (bytes memory); /** * @dev This function is used to invalidate signatures by incrementing the nonce of the signer. * @param increment The amount to increment the nonce by (max 255). */ function incrementNonce(uint8 increment) external; ///////////////////////////////// /// VIEW FUNCTIONS /// ///////////////////////////////// /** * @notice Returns whether or not `followerProfileId` is following `followedProfileId`. * * @param followerProfileId The ID of the profile whose following state should be queried. * @param followedProfileId The ID of the profile whose followed state should be queried. * * @return bool True if `followerProfileId` is following `followedProfileId`, false otherwise. */ function isFollowing(uint256 followerProfileId, uint256 followedProfileId) external view returns (bool); /** * @notice Returns whether the given address is approved as delegated executor, in the configuration with the given * number, to act on behalf of the given profile. * * @param delegatorProfileId The ID of the profile to check the delegated executor approval for. * @param delegatedExecutor The address to query the delegated executor approval for. * @param configNumber The number of the configuration where the executor approval state is being queried. * * @return bool True if the address is approved as a delegated executor to act on behalf of the profile in the * given configuration, false otherwise. */ function isDelegatedExecutorApproved( uint256 delegatorProfileId, address delegatedExecutor, uint64 configNumber ) external view returns (bool); /** * @notice Returns whether the given address is approved as delegated executor, in the current configuration, to act * on behalf of the given profile. * * @param delegatorProfileId The ID of the profile to check the delegated executor approval for. * @param delegatedExecutor The address to query the delegated executor approval for. * * @return bool True if the address is approved as a delegated executor to act on behalf of the profile in the * current configuration, false otherwise. */ function isDelegatedExecutorApproved( uint256 delegatorProfileId, address delegatedExecutor ) external view returns (bool); /** * @notice Returns the current delegated executor config number for the given profile. * * @param delegatorProfileId The ID of the profile from which the delegated executors config number is being queried * * @return uint256 The current delegated executor configuration number. */ function getDelegatedExecutorsConfigNumber(uint256 delegatorProfileId) external view returns (uint64); /** * @notice Returns the previous used delegated executor config number for the given profile. * * @param delegatorProfileId The ID of the profile from which the delegated executors' previous configuration number * set is being queried. * * @return uint256 The delegated executor configuration number previously set. It will coincide with the current * configuration set if it was never switched from the default one. */ function getDelegatedExecutorsPrevConfigNumber(uint256 delegatorProfileId) external view returns (uint64); /** * @notice Returns the maximum delegated executor config number for the given profile. * This is the maximum config number that was ever used by this profile. * When creating a new clean configuration, you can only use a number that is maxConfigNumber + 1. * * @param delegatorProfileId The ID of the profile from which the delegated executors' maximum configuration number * set is being queried. * * @return uint256 The delegated executor maximum configuration number set. */ function getDelegatedExecutorsMaxConfigNumberSet(uint256 delegatorProfileId) external view returns (uint64); /** * @notice Returns whether `profileId` is blocked by `byProfileId`. * See setBlockStatus() for more information on how blocking works on the platform. * * @param profileId The ID of the profile whose blocked status should be queried. * @param byProfileId The ID of the profile whose blocker status should be queried. * * @return bool True if `profileId` is blocked by `byProfileId`, false otherwise. */ function isBlocked(uint256 profileId, uint256 byProfileId) external view returns (bool); /** * @notice Returns the URI associated with a given publication. * This is used to store the publication's metadata, e.g.: content, images, etc. * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * * @return string The URI associated with a given publication. */ function getContentURI(uint256 profileId, uint256 pubId) external view returns (string memory); /** * @notice Returns the full profile struct associated with a given profile token ID. * * @param profileId The token ID of the profile to query. * * @return Profile The profile struct of the given profile. */ function getProfile(uint256 profileId) external view returns (Types.Profile memory); /** * @notice Returns the full publication struct for a given publication. * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * * @return Publication The publication struct associated with the queried publication. */ function getPublication(uint256 profileId, uint256 pubId) external view returns (Types.PublicationMemory memory); /** * @notice Returns the type of a given publication. * The type can be one of the following (see PublicationType enum): * - Nonexistent * - Post * - Comment * - Mirror * - Quote * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * * @return PublicationType The publication type of the queried publication. */ function getPublicationType(uint256 profileId, uint256 pubId) external view returns (Types.PublicationType); /** * @notice Returns wether a given Action Module is enabled for a given publication. * * @param profileId The token ID of the profile that published the publication to query. * @param pubId The publication ID of the publication to query. * @param module The address of the Action Module to query. * * @return bool True if the Action Module is enabled for the queried publication, false if not. */ function isActionModuleEnabledInPublication( uint256 profileId, uint256 pubId, address module ) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @title ILensVersion * @author Lens Protocol * * @notice This is the interface for the LensHub Version getters and emitter. * It allows to emit a LensHub version during an upgrade, and also to get the current version. */ interface ILensVersion { /** * @notice Returns the LensHub current Version. * * @return version The LensHub current Version. */ function getVersion() external view returns (string memory); /** * @notice Returns the LensHub current Git Commit. * * @return gitCommit The LensHub current Git Commit. */ function getGitCommit() external view returns (bytes20); /** * @notice Emits the LensHub current Version. Used in upgradeAndCall(). */ function emitVersion() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.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.15; import {Errors} from 'contracts/modules/constants/Errors.sol'; /** * @title ActionRestricted * @author Lens Protocol * * @notice This abstract contract adds a public `ACTION_MODULE` immutable field, and `onlyActionModule` modifier, * to inherit from contracts that have functions restricted to be only called by the Action Modules. */ abstract contract ActionRestricted { address public immutable ACTION_MODULE; modifier onlyActionModule() { if (msg.sender != ACTION_MODULE) { revert Errors.NotActionModule(); } _; } constructor(address actionModule) { ACTION_MODULE = actionModule; } }
// 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.8.10; import {Errors} from 'contracts/modules/constants/Errors.sol'; import {FeeModuleBase} from 'contracts/modules/FeeModuleBase.sol'; import {ICollectModule} from 'contracts/modules/interfaces/ICollectModule.sol'; import {ActionRestricted} from 'contracts/modules/ActionRestricted.sol'; import {ModuleTypes} from 'contracts/modules/libraries/constants/ModuleTypes.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import {FollowValidationLib} from 'contracts/modules/libraries/FollowValidationLib.sol'; import {BaseFeeCollectModuleInitData, BaseProfilePublicationData, IBaseFeeCollectModule} from 'contracts/modules/interfaces/IBaseFeeCollectModule.sol'; /** * @title BaseFeeCollectModule * @author Lens Protocol * * @notice This is base Lens CollectModule implementation, allowing customization of time to collect, number of collects * and Followers-only restriction. Charges a fee for collect and distributing it among Receiver/Referrals/Treasury. * @dev Here we use "Base" terminology to anything that represents this base functionality (base structs, * base functions, base storage). Other collect modules can be built on top of the "Base" by inheriting from this * contract and overriding functions. * This contract is marked "abstract" as it requires you to implement initializePublicationCollectModule and * getPublicationData functions when you inherit from it. See SimpleFeeCollectModule as an example implementation. */ abstract contract BaseFeeCollectModule is FeeModuleBase, ActionRestricted, IBaseFeeCollectModule { using SafeERC20 for IERC20; address immutable HUB; mapping(uint256 => mapping(uint256 => BaseProfilePublicationData)) internal _dataByPublicationByProfile; constructor( address hub, address actionModule, address moduleRegistry ) ActionRestricted(actionModule) FeeModuleBase(hub, moduleRegistry) { HUB = hub; } function supportsInterface(bytes4 interfaceID) public pure virtual returns (bool) { return interfaceID == type(ICollectModule).interfaceId; } /** * @inheritdoc ICollectModule * @notice Processes a collect by: * 1. Validating that collect action meets all needed criteria * 2. Processing the collect action either with or without referral * * @param processCollectParams Collect action parameters (see ModuleTypes.ProcessCollectParams struct) */ function processCollect( ModuleTypes.ProcessCollectParams calldata processCollectParams ) external virtual onlyActionModule returns (bytes memory) { _validateAndStoreCollect(processCollectParams); if (processCollectParams.referrerProfileIds.length == 0) { _processCollect(processCollectParams); } else { _processCollectWithReferral(processCollectParams); } return ''; } /// @inheritdoc IBaseFeeCollectModule function getBasePublicationData( uint256 profileId, uint256 pubId ) public view virtual returns (BaseProfilePublicationData memory) { return _dataByPublicationByProfile[profileId][pubId]; } /// @inheritdoc IBaseFeeCollectModule function calculateFee( ModuleTypes.ProcessCollectParams calldata processCollectParams ) public view virtual returns (uint160) { return _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].amount; } /** * @dev Validates the Base parameters like: * 1) Is the currency whitelisted * 2) Is the referralFee in valid range * 3) Is the end of collects timestamp in valid range * * This should be called during initializePublicationCollectModule() * * @param baseInitData Module initialization data (see BaseFeeCollectModuleInitData struct) */ function _validateBaseInitData(BaseFeeCollectModuleInitData memory baseInitData) internal virtual { if ( (baseInitData.amount == 0 && baseInitData.currency != address(0)) || (baseInitData.amount != 0 && baseInitData.currency == address(0)) || baseInitData.referralFee > BPS_MAX || (baseInitData.endTimestamp != 0 && baseInitData.endTimestamp < block.timestamp) ) { revert Errors.InitParamsInvalid(); } _verifyErc20Currency(baseInitData.currency); } /** * @dev Stores the initial module parameters * * This should be called during initializePublicationCollectModule() * * @param profileId The token ID of the profile publishing the publication. * @param pubId The publication ID. * @param baseInitData Module initialization data (see BaseFeeCollectModuleInitData struct) */ function _storeBasePublicationCollectParameters( uint256 profileId, uint256 pubId, BaseFeeCollectModuleInitData memory baseInitData ) internal virtual { _dataByPublicationByProfile[profileId][pubId].amount = baseInitData.amount; _dataByPublicationByProfile[profileId][pubId].collectLimit = baseInitData.collectLimit; _dataByPublicationByProfile[profileId][pubId].currency = baseInitData.currency; _dataByPublicationByProfile[profileId][pubId].recipient = baseInitData.recipient; _dataByPublicationByProfile[profileId][pubId].referralFee = baseInitData.referralFee; _dataByPublicationByProfile[profileId][pubId].followerOnly = baseInitData.followerOnly; _dataByPublicationByProfile[profileId][pubId].endTimestamp = baseInitData.endTimestamp; } /** * @dev Validates the collect action by checking that: * 1) the collector is a follower (if enabled) * 2) the number of collects after the action doesn't surpass the collect limit (if enabled) * 3) the current block timestamp doesn't surpass the end timestamp (if enabled) * * This should be called during processCollect() */ function _validateAndStoreCollect(ModuleTypes.ProcessCollectParams calldata processCollectParams) internal virtual { uint96 collectsAfter = ++_dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].currentCollects; if ( _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].followerOnly ) { FollowValidationLib.validateIsFollowingOrSelf({ hub: HUB, followerProfileId: processCollectParams.collectorProfileId, followedProfileId: processCollectParams.publicationCollectedProfileId }); } uint256 endTimestamp = _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].endTimestamp; uint256 collectLimit = _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].collectLimit; if (collectLimit != 0 && collectsAfter > collectLimit) { revert Errors.MintLimitExceeded(); } if (endTimestamp != 0 && block.timestamp > endTimestamp) { revert Errors.CollectExpired(); } } /** * @dev Internal processing of a collect: * 1. Calculation of fees * 2. Validation that fees are what collector expected * 3. Transfer of fees to recipient(-s) and treasury * * @param processCollectParams Parameters of the collect */ function _processCollect(ModuleTypes.ProcessCollectParams calldata processCollectParams) internal virtual { uint256 amount = calculateFee(processCollectParams); address currency = _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].currency; _validateDataIsExpected(processCollectParams.data, currency, amount); (address treasury, uint16 treasuryFee) = _treasuryData(); uint256 treasuryAmount = (amount * treasuryFee) / BPS_MAX; if (treasuryAmount > 0) { IERC20(currency).safeTransferFrom(processCollectParams.transactionExecutor, treasury, treasuryAmount); } // Send amount after treasury cut, to all recipients _transferToRecipients(processCollectParams, currency, amount - treasuryAmount); } /** * @dev Internal processing of a collect with a referrals (if any). * * Same as _processCollect, but also includes transfer to referrals (if any): * 1. Calculation of fees * 2. Validation that fees are what collector expected * 3. Transfer of fees to treasury, referrals (if any) and recipients * * @param processCollectParams Parameters of the collect */ function _processCollectWithReferral( ModuleTypes.ProcessCollectParams calldata processCollectParams ) internal virtual { uint256 amount = calculateFee(processCollectParams); address currency = _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].currency; _validateDataIsExpected(processCollectParams.data, currency, amount); (address treasury, uint16 treasuryFee) = _treasuryData(); uint256 treasuryAmount = (amount * treasuryFee) / BPS_MAX; if (treasuryAmount > 0) { IERC20(currency).safeTransferFrom(processCollectParams.transactionExecutor, treasury, treasuryAmount); } uint256 amountAfterReferrals = _transferToReferrals(processCollectParams, currency, amount - treasuryAmount); _transferToRecipients(processCollectParams, currency, amountAfterReferrals); } /** * @dev Tranfers the fee to recipient(-s) * * Override this to add additional functionality (e.g. multiple recipients) * * @param processCollectParams Parameters of the collect * @param currency Currency of the transaction * @param amount Amount to transfer to recipient(-s) */ function _transferToRecipients( ModuleTypes.ProcessCollectParams calldata processCollectParams, address currency, uint256 amount ) internal virtual { address recipient = _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].recipient; if (amount > 0) { IERC20(currency).safeTransferFrom(processCollectParams.transactionExecutor, recipient, amount); } } /** * @dev Tranfers the part of fee to referral(-s) * * Override this to add additional functionality (e.g. different amounts to different referrals, etc) * * @param processCollectParams Parameters of the collect * @param currency Currency of the transaction * @param amount Amount of the fee after subtracting the Treasury part. */ function _transferToReferrals( ModuleTypes.ProcessCollectParams calldata processCollectParams, address currency, uint256 amount ) internal virtual returns (uint256) { uint256 referralFee = _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId ].referralFee; uint256 totalReferralsAmount; if (referralFee != 0) { // The reason we levy the referral fee on the adjusted amount is so that referral fees // don't bypass the treasury fee, in essence referrals pay their fair share to the treasury. totalReferralsAmount = (amount * referralFee) / BPS_MAX; uint256 numberOfReferrals = processCollectParams.referrerProfileIds.length; uint256 amountPerReferral = totalReferralsAmount / numberOfReferrals; if (amountPerReferral > 0) { uint256 i; while (i < numberOfReferrals) { address referralRecipient = IERC721(HUB).ownerOf(processCollectParams.referrerProfileIds[i]); // Send referral fee in ERC20 tokens IERC20(currency).safeTransferFrom( processCollectParams.transactionExecutor, referralRecipient, amountPerReferral ); unchecked { ++i; } } } } return amount - totalReferralsAmount; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; library Errors { error FollowInvalid(); error ModuleDataMismatch(); error NotHub(); error InitParamsInvalid(); error InvalidParams(); error MintLimitExceeded(); error CollectExpired(); error NotActionModule(); error CollectNotAllowed(); error AlreadyInitialized(); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ICollectModule} from 'contracts/modules/interfaces/ICollectModule.sol'; import {ModuleTypes} from 'contracts/modules/libraries/constants/ModuleTypes.sol'; /** * @notice A struct containing the necessary data to execute collect actions on a publication. * * @param amount The collecting cost associated with this publication. 0 for free collect. * @param collectLimit The maximum number of collects for this publication. 0 for no limit. * @param currency The currency associated with this publication. * @param currentCollects The current number of collects for this publication. * @param referralFee The referral fee associated with this publication. * @param followerOnly True if only followers of publisher may collect the post. * @param endTimestamp The end timestamp after which collecting is impossible. 0 for no expiry. * @param recipient Recipient of collect fees. */ struct BaseProfilePublicationData { uint160 amount; uint96 collectLimit; address currency; uint96 currentCollects; address recipient; uint16 referralFee; bool followerOnly; uint72 endTimestamp; } /** * @notice A struct containing the necessary data to initialize this Base Collect Module. * * @param amount The collecting cost associated with this publication. 0 for free collect. * @param collectLimit The maximum number of collects for this publication. 0 for no limit. * @param currency The currency associated with this publication. * @param referralFee The referral fee associated with this publication. * @param followerOnly True if only followers of publisher may collect the post. * @param endTimestamp The end timestamp after which collecting is impossible. 0 for no expiry. * @param recipient Recipient of collect fees. */ struct BaseFeeCollectModuleInitData { uint160 amount; uint96 collectLimit; address currency; uint16 referralFee; bool followerOnly; uint72 endTimestamp; address recipient; } interface IBaseFeeCollectModule is ICollectModule { /** * @notice Returns the Base publication data for a given publication, or an empty struct if that publication was not * initialized with this module. * * @param profileId The token ID of the profile mapped to the publication to query. * @param pubId The publication ID of the publication to query. * * @return The BaseProfilePublicationData struct mapped to that publication. */ function getBasePublicationData( uint256 profileId, uint256 pubId ) external view returns (BaseProfilePublicationData memory); /** * @notice Calculates and returns the collect fee of a publication. * @dev Override this function to use a different formula for the fee. * * @return The collect fee of the specified publication. */ function calculateFee( ModuleTypes.ProcessCollectParams calldata processCollectParams ) external view returns (uint160); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {ModuleTypes} from 'contracts/modules/libraries/constants/ModuleTypes.sol'; /** * @title ICollectModule * @author Lens Protocol * * @notice This is the standard interface for all Lens-compatible CollectModules. * Collect modules allow users to execute custom logic upon a collect action over a publication, like: * - Only allow the collect if the collector is following the publication author. * - Only allow the collect if the collector has made a payment to * - Allow any collect but only during the first 24 hours. * - Etc. */ interface ICollectModule { /** * @notice Initializes data for a given publication being published. * @custom:permissions LensHub. * * @param profileId The token ID of the profile publishing the publication. * @param pubId The associated publication's LensHub publication ID. * @param transactionExecutor The owner or an approved delegated executor. * @param data Arbitrary data __passed from the user!__ to be decoded. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function initializePublicationCollectModule( uint256 profileId, uint256 pubId, address transactionExecutor, bytes calldata data ) external returns (bytes memory); /** * @notice Processes a collect action for a given publication. * @custom:permissions LensHub. * * @param processCollectParams The parameters for the collect action. * * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ function processCollect( ModuleTypes.ProcessCollectParams calldata processCollectParams ) external returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol'; interface ILensModule is IERC165 { /// @dev for now we check for keccak('LENS_MODULE'); /// Override this and add the type(IModuleInterface).interfaceId for corresponding module type function supportsInterface(bytes4 interfaceID) external view returns (bool); /// @notice Human-readable description of the module // Can be JSON // Can be contract source code // Can be github link // Can be ipfs with documentation // etc function getModuleMetadataURI() external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; /** * @title FollowValidationLib * @author Lens Protocol * * @notice A library contract that verifies that a user is following another user and reverts if not. */ library FollowValidationLib { function validateIsFollowing(address hub, uint256 followerProfileId, uint256 followedProfileId) internal view { if (!ILensHub(hub).isFollowing(followerProfileId, followedProfileId)) { revert Errors.NotFollowing(); } } function validateIsFollowingOrSelf( address hub, uint256 followerProfileId, uint256 followedProfileId ) internal view { // We treat following yourself is always true if (followerProfileId == followedProfileId) { return; } validateIsFollowing(hub, followerProfileId, followedProfileId); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import {Types} from 'contracts/libraries/constants/Types.sol'; /** * @title Types * @author Lens Protocol * * @notice A standard library of data types used throughout the Lens Protocol modules. */ library ModuleTypes { struct ProcessCollectParams { uint256 publicationCollectedProfileId; uint256 publicationCollectedId; uint256 collectorProfileId; address collectorProfileOwner; address transactionExecutor; uint256[] referrerProfileIds; uint256[] referrerPubIds; Types.PublicationType[] referrerPubTypes; bytes data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@ensdomains/=node_modules/@ensdomains/", "@openzeppelin/=lib/openzeppelin-contracts/", "@seadrop/=lib/seadrop/src/", "ERC721A-Upgradeable/=lib/seadrop/lib/ERC721A-Upgradeable/contracts/", "ERC721A/=lib/seadrop/lib/ERC721A/contracts/", "create2-helpers/=lib/seadrop/lib/create2-helpers/", "create2-scripts/=lib/seadrop/lib/create2-helpers/script/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/seadrop/lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat/=node_modules/hardhat/", "murky/=lib/seadrop/lib/murky/src/", "openzeppelin-contracts-upgradeable/=lib/seadrop/lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/seadrop/lib/openzeppelin-contracts/contracts/", "operator-filter-registry/=lib/seadrop/lib/operator-filter-registry/src/", "seadrop/=lib/seadrop/", "solady/=lib/solady/src/", "solmate/=lib/seadrop/lib/solmate/src/", "utility-contracts/=lib/seadrop/lib/utility-contracts/src/" ], "optimizer": { "enabled": true, "runs": 10 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": { "contracts/libraries/ActionLib.sol": { "ActionLib": "0x7990dac84e3241fe314b980bba1466ac08715c4f" }, "contracts/libraries/FollowLib.sol": { "FollowLib": "0xe280cb21fb36b6b2d584428b809a6b822a5c2260" }, "contracts/libraries/GovernanceLib.sol": { "GovernanceLib": "0x5268512d20bf7653cf6d54b7c485ae3fbc658451" }, "contracts/libraries/LegacyCollectLib.sol": { "LegacyCollectLib": "0x5f0f24377c00f1517b4de496cf49eec8beb4ecb4" }, "contracts/libraries/MetaTxLib.sol": { "MetaTxLib": "0xf191c489e4ba0f448ea08a5fd27e9c928643f5c7" }, "contracts/libraries/MigrationLib.sol": { "MigrationLib": "0x0deced9ac3833b687d69d4eac6655f0f1279acee" }, "contracts/libraries/ProfileLib.sol": { "ProfileLib": "0x3fce2475a92c185f9634f5638f6b33306d77bb10" }, "contracts/libraries/PublicationLib.sol": { "PublicationLib": "0x90654f24a2c164a4da8f763ac8bc032d3d083a1b" }, "contracts/libraries/ValidationLib.sol": { "ValidationLib": "0x9cafd24d2851d9eb56e5a8fd394ab2ac0ef99849" }, "contracts/libraries/token-uris/FollowTokenURILib.sol": { "FollowTokenURILib": "0xc58f0e2a361e35c08619ef5f6122dc15180d783e" }, "contracts/libraries/token-uris/HandleTokenURILib.sol": { "HandleTokenURILib": "0x0e20f112689c7894ab8142108574e45d2650f529" }, "contracts/libraries/token-uris/ProfileTokenURILib.sol": { "ProfileTokenURILib": "0xf167835e74eecfe4bc571701d34fd38f4b61a830" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"hub","type":"address"},{"internalType":"address","name":"actionModule","type":"address"},{"internalType":"address","name":"moduleRegistry","type":"address"},{"internalType":"address","name":"moduleOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CollectExpired","type":"error"},{"inputs":[],"name":"InitParamsInvalid","type":"error"},{"inputs":[],"name":"MintLimitExceeded","type":"error"},{"inputs":[],"name":"ModuleDataMismatch","type":"error"},{"inputs":[],"name":"NotActionModule","type":"error"},{"inputs":[],"name":"NotFollowing","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":"ACTION_MODULE","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":[{"components":[{"internalType":"uint256","name":"publicationCollectedProfileId","type":"uint256"},{"internalType":"uint256","name":"publicationCollectedId","type":"uint256"},{"internalType":"uint256","name":"collectorProfileId","type":"uint256"},{"internalType":"address","name":"collectorProfileOwner","type":"address"},{"internalType":"address","name":"transactionExecutor","type":"address"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"enum Types.PublicationType[]","name":"referrerPubTypes","type":"uint8[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ModuleTypes.ProcessCollectParams","name":"processCollectParams","type":"tuple"}],"name":"calculateFee","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"}],"name":"getBasePublicationData","outputs":[{"components":[{"internalType":"uint160","name":"amount","type":"uint160"},{"internalType":"uint96","name":"collectLimit","type":"uint96"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint96","name":"currentCollects","type":"uint96"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"referralFee","type":"uint16"},{"internalType":"bool","name":"followerOnly","type":"bool"},{"internalType":"uint72","name":"endTimestamp","type":"uint72"}],"internalType":"struct BaseProfilePublicationData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getModuleMetadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"}],"name":"getPublicationData","outputs":[{"components":[{"internalType":"uint160","name":"amount","type":"uint160"},{"internalType":"uint96","name":"collectLimit","type":"uint96"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint96","name":"currentCollects","type":"uint96"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"referralFee","type":"uint16"},{"internalType":"bool","name":"followerOnly","type":"bool"},{"internalType":"uint72","name":"endTimestamp","type":"uint72"}],"internalType":"struct BaseProfilePublicationData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"profileId","type":"uint256"},{"internalType":"uint256","name":"pubId","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"initializePublicationCollectModule","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"metadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"publicationCollectedProfileId","type":"uint256"},{"internalType":"uint256","name":"publicationCollectedId","type":"uint256"},{"internalType":"uint256","name":"collectorProfileId","type":"uint256"},{"internalType":"address","name":"collectorProfileOwner","type":"address"},{"internalType":"address","name":"transactionExecutor","type":"address"},{"internalType":"uint256[]","name":"referrerProfileIds","type":"uint256[]"},{"internalType":"uint256[]","name":"referrerPubIds","type":"uint256[]"},{"internalType":"enum Types.PublicationType[]","name":"referrerPubTypes","type":"uint8[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ModuleTypes.ProcessCollectParams","name":"processCollectParams","type":"tuple"}],"name":"processCollect","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
61010034620000f857601f6200181b38819003918201601f19168301916001600160401b03831184841017620000fd57808492608094604052833981010312620000f8578062000053620000a89262000113565b620000616020830162000113565b6200007d6060620000756040860162000113565b940162000113565b6001600160a01b0383811660805290931660a05260c05260e052620000a23362000128565b62000128565b6040516116a9908162000172823960805181611237015260a051818181610292015261059d015260c0518181816103250152818161076f0152610d59015260e0518181816109ee0152610b4e0152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620000f857565b600180546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a356fe608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a714610d885750816303ee438c1461024c578163397a2a8814610d445781633f50389214610d1e578163681591c114610b985781636fb7166114610752578163715018a6146107045781638da5cb5b146106db57816391027b53146102c1578163b95ddb521461027d578163ce90d52e1461024c578163f2fde38b1461018c57508063f8d7758c146101615763fcdd2347146100bf57600080fd5b3461015d57610159906100da6100d436610fb0565b9061109f565b90519182918291909160e061010082019360018060a01b03808251168452602082015160018060601b0380911660208601528160408401511660408601526060830151166060850152608082015116608084015261ffff60a08201511660a084015260c0810151151560c08401528160018060481b0391015116910152565b0390f35b5080fd5b503461015d5760209061017b61017636610fe6565b61112d565b90516001600160a01b039091168152f35b91905034610248576020366003190112610248576001600160a01b03823581811693919290849003610244576101c0611417565b83156101f2575050600180546001600160a01b031981168417909155166000805160206116548339815191528380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8480fd5b8280fd5b50503461015d578160031936011261015d576101599061026a610ece565b9051918291602083526020830190610f70565b50503461015d578160031936011261015d57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b905034610248576080366003190112610248576001600160a01b03918135602435604435858116036106d7576001600160401b03946064358681116106bf57366023820112156106bf57808601358781116106d35781013660248201116106d357827f00000000000000000000000000000000000000000000000000000000000000001633036106c3578160e09103126106bf5784519660e08801908111888210176106ac578552602481013595828716968781036106a85788526001600160601b039260448301359084821682036106a457602098898b019283526103a960648601611018565b95898c019b878d5260848701359561ffff8716988988036106a0576060830197885260a4890135988915158a0361069b5760808401998a5260c48101359a6001600160481b038c1691828d036106945760e461040c9160a088019e8f5201611018565b9660c086019788521592888480610688575b8515610665575b5050508215610659575b50811561063d575b5061062f57908e9291858f511680610585575b50508c9d92856101599e9461049e8f948f908f90978560019951169c838852878b528888208389528b528888208a8060a01b03199e8f8254161790555116918652858952868620908652885285852061116d565b5116938c8252818152828220908c835252200190848254161790555116868b528a8a52878b20868c528a526002888c20019182541617905551848952888852858920848a5288526002868a20019081549061ffff60a01b9060a01b169061ffff60a01b191617905551151583885287875284882083895287526002858920019081549060ff60b01b9060b01b169060ff60b01b19161790555191865285855282862090865284526002828620019081549060018060b81b03199060b81b169060018060b81b031617905580519361057485610e90565b845251928284938452830190610f70565b8d51633f8ecfd360e21b8152918201528d81602481877f00000000000000000000000000000000000000000000000000000000000000008b165af18015610625578e9f6101599f95928f948f908f90978b60019961049e9582986105f8575b5098505097505050509f5081949e5061044a565b610617908d803d1061061e575b61060f8183610eab565b810190611155565b50386105e4565b503d610605565b8d513d86823e3d90fd5b8b516348be0eb360e01b8152fd5b80151591508161064f575b5038610437565b9050421138610648565b6127101091503861042f565b909192945015918261067d575b505091388881610425565b161590508738610672565b8282161515955061041e565b5050508f80fd5b508f80fd5b8f80fd5b8a80fd5b8980fd5b634e487b7160e01b895260418752602489fd5b8780fd5b8551632fc56e1160e21b81528790fd5b8880fd5b8580fd5b50503461015d578160031936011261015d5760015490516001600160a01b039091168152602090f35b833461074f578060031936011261074f5761071d611417565b600180546001600160a01b0319811690915581906001600160a01b03166000805160206116548339815191528280a380f35b80fd5b8391503461015d5761076336610fe6565b6001600160a01b0393907f000000000000000000000000000000000000000000000000000000000000000085163303610b8a57803580855260208581528386208184013580885290825284872060019081018054939791936001600160601b03919060a01c828114610b7757856107dc9101809261116d565b858a52898952878a20848b52895260ff6002898c20015460b01c16610b44575b858a52898952878a20848b5289526002888b20015460b81c91868b528a8a52888b20858c528a52888b205460a01c908115159283610b38575b505050610b29578015159081610b1f575b50610b115760a08501610859818761106a565b1515905061090557505061ffff888594936108d693610159999a9b6108806108dc9961112d565b16958c528b8b52888c20908c528a52878b20015416926108af81856108a9610100890189611190565b906112cc565b6127106108c66108bd611220565b909416836111c2565b049182806108e8575b50506111ff565b9161132a565b80519361057485610e90565b6108fe916108f8608089016111eb565b8761146f565b8a826108cf565b90919392896109138761112d565b16848a52898952878a20868b5289528a82898c200154169561093e82886108a96101008c018c611190565b61096e610949611220565b938a61271061095d61ffff809816846111c2565b04809381610af4575b5050506111ff565b958b528a8a52888b20908b5289526002888b20015460a01c1699899a806109ae575b5050505050906108d66101599596976109a994936111ff565b6108dc565b612710919293949b506109c190866111c2565b04996109cd848861106a565b8095915015610ae157848c0491826109e6575b50610990565b6080890195937f000000000000000000000000000000000000000000000000000000000000000016918c5b858110610a1f5750506109e0565b610a29828c61106a565b821015610ace578c51906331a9108f60e11b82528260051b0135848201528d81602481885afa908115610ac2578f9187918a949391610a7f575b5090610a79918d610a738d6111eb565b9061146f565b01610a11565b92935050508d81813d8311610abb575b610a998183610eab565b81010312610ab75790610a7986610ab08a9461120c565b9091610a63565b8e80fd5b503d610a8f565b8f8e51903d90823e3d90fd5b634e487b7160e01b8f526032845260248ffd5b634e487b7160e01b8b526012825260248bfd5b610b036080610b0994016111eb565b8d61146f565b8a8238610966565b85516304cd703960e51b8152fd5b905042118a610846565b508551635b21dfd360e11b8152fd5b161190508b8080610835565b610b7286898901357f0000000000000000000000000000000000000000000000000000000000000000611387565b6107fc565b634e487b7160e01b8b526011845260248bfd5b5051632fc56e1160e21b8152fd5b8391503461015d57602080600319360112610248576001600160401b039180358381116102445736602382011215610244578082013590610be4610bdb83610fcb565b97519788610eab565b81875236602483830101116106d7578186926024869301838a013787010152610c0b611417565b8451928311610d0b5750610c20600254610e09565b601f8111610cc7575b5080601f8311600114610c6457508293829392610c59575b50508160011b916000199060031b1c19161760025580f35b015190508380610c41565b90601f19831694600285528285209285905b878210610caf575050836001959610610c96575b505050811b0160025580f35b015160001960f88460031b161c19169055838080610c8a565b80600185968294968601518155019501930190610c76565b60028452818420601f840160051c810191838510610d01575b601f0160051c01905b818110610cf65750610c29565b848155600101610ce9565b9091508190610ce0565b634e487b7160e01b845260419052602483fd5b50503461015d57610159906100da610d3536610fb0565b90610d3e61102c565b5061109f565b50503461015d578160031936011261015d57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b92915034610e05576020366003190112610e05573563ffffffff60e01b8082168092036102445760209450637f5ab69960e11b8214938415610dd0575b505050519015158152f35b9091929350848101906a4c454e535f4d4f44554c4560a81b8252600b8152610df781610e75565b519020161490388080610dc5565b8380fd5b90600182811c92168015610e39575b6020831014610e2357565b634e487b7160e01b600052602260045260246000fd5b91607f1691610e18565b61010081019081106001600160401b03821117610e5f57604052565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b03821117610e5f57604052565b602081019081106001600160401b03821117610e5f57604052565b601f909101601f19168101906001600160401b03821190821017610e5f57604052565b6040519060008260025491610ee283610e09565b808352602093600190818116908115610f505750600114610f0e575b5050610f0c92500383610eab565b565b90939150600260005281600020936000915b818310610f38575050610f0c93508201013880610efe565b85548884018501529485019487945091830191610f20565b915050610f0c94925060ff191682840152151560051b8201013880610efe565b919082519283825260005b848110610f9c575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201610f7b565b6040906003190112610fc6576004359060243590565b600080fd5b6001600160401b038111610e5f57601f01601f191660200190565b60031990602081830112610fc657600435916001600160401b038311610fc6578261012092030112610fc65760040190565b35906001600160a01b0382168203610fc657565b6040519061103982610e43565b8160e06000918281528260208201528260408201528260608201528260808201528260a08201528260c08201520152565b903590601e1981360301821215610fc657018035906001600160401b038211610fc657602001918160051b36038313610fc657565b6110a761102c565b5060005260006020526040600020906000526020526040600020604051906110ce82610e43565b600281549160018060a01b0392838116855260a01c60208501526001810154838116604086015260a01c60608501520154908116608083015261ffff8160a01c1660a083015260ff8160b01c16151560c083015260b81c60e082015290565b803560009081526020818152604080832093820135835292905220546001600160a01b031690565b90816020910312610fc657518015158103610fc65790565b80546001600160a01b031660a09290921b6001600160a01b031916919091179055565b903590601e1981360301821215610fc657018035906001600160401b038211610fc657602001918136038313610fc657565b818102929181159184041417156111d557565b634e487b7160e01b600052601160045260246000fd5b356001600160a01b0381168103610fc65790565b919082039182116111d557565b51906001600160a01b0382168203610fc657565b604080516398f965d160e01b8152919080836004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9283156112c1576000918294611278575b50509190565b9080929450813d83116112ba575b6112908183610eab565b810103126102485760206112a38261120c565b9101519261ffff8416840361074f57503880611272565b503d611286565b50513d6000823e3d90fd5b908160409194939481010312610fc6576001600160a01b03813581811693919290849003610fc65760200135149283159361131d575b50505061130b57565b6040516346308bd560e01b8152600490fd5b1614159050388080611302565b9190823560005260006020526040600020602084013560005260205260018060a01b039081600260406000200154169183611367575b5050505050565b611376608061137d96016111eb565b911661146f565b3880808080611360565b91808214611412576040516347720ebb60e01b81526004810192909252602482015290602090829060449082906001600160a01b03165afa908115611406576000916113e8575b50156113d657565b6040516322d9eef360e21b8152600490fd5b611400915060203d811161061e5761060f8183610eab565b386113ce565b6040513d6000823e3d90fd5b505050565b6001546001600160a01b0316330361142b57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6040516323b872dd60e01b60208083019182526001600160a01b039485166024840152948416604483015260648083019690965294815292939260a081019290916001600160401b03841183851017610e5f576115369460009283928660405216936114da86610e75565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152519082855af13d156115b2573d9161151a83610fcb565b926115286040519485610eab565b83523d60008785013e6115b6565b8051908161154357505050565b8280611553938301019101611155565b1561155b5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6060915b9192901561161857508151156115ca575090565b3b156115d35790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82519091501561162b5750805190602001fd5b60405162461bcd60e51b81526020600482015290819061164f906024830190610f70565b0390fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a264697066735822122037f5a5929134a6d4ca9453f625b880057bf48e8e4744ad9c9af6cdd1a0ac552864736f6c63430008150033000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff9000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
Deployed Bytecode
0x608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a714610d885750816303ee438c1461024c578163397a2a8814610d445781633f50389214610d1e578163681591c114610b985781636fb7166114610752578163715018a6146107045781638da5cb5b146106db57816391027b53146102c1578163b95ddb521461027d578163ce90d52e1461024c578163f2fde38b1461018c57508063f8d7758c146101615763fcdd2347146100bf57600080fd5b3461015d57610159906100da6100d436610fb0565b9061109f565b90519182918291909160e061010082019360018060a01b03808251168452602082015160018060601b0380911660208601528160408401511660408601526060830151166060850152608082015116608084015261ffff60a08201511660a084015260c0810151151560c08401528160018060481b0391015116910152565b0390f35b5080fd5b503461015d5760209061017b61017636610fe6565b61112d565b90516001600160a01b039091168152f35b91905034610248576020366003190112610248576001600160a01b03823581811693919290849003610244576101c0611417565b83156101f2575050600180546001600160a01b031981168417909155166000805160206116548339815191528380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8480fd5b8280fd5b50503461015d578160031936011261015d576101599061026a610ece565b9051918291602083526020830190610f70565b50503461015d578160031936011261015d57517f0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff96001600160a01b03168152602090f35b905034610248576080366003190112610248576001600160a01b03918135602435604435858116036106d7576001600160401b03946064358681116106bf57366023820112156106bf57808601358781116106d35781013660248201116106d357827f0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb1633036106c3578160e09103126106bf5784519660e08801908111888210176106ac578552602481013595828716968781036106a85788526001600160601b039260448301359084821682036106a457602098898b019283526103a960648601611018565b95898c019b878d5260848701359561ffff8716988988036106a0576060830197885260a4890135988915158a0361069b5760808401998a5260c48101359a6001600160481b038c1691828d036106945760e461040c9160a088019e8f5201611018565b9660c086019788521592888480610688575b8515610665575b5050508215610659575b50811561063d575b5061062f57908e9291858f511680610585575b50508c9d92856101599e9461049e8f948f908f90978560019951169c838852878b528888208389528b528888208a8060a01b03199e8f8254161790555116918652858952868620908652885285852061116d565b5116938c8252818152828220908c835252200190848254161790555116868b528a8a52878b20868c528a526002888c20019182541617905551848952888852858920848a5288526002868a20019081549061ffff60a01b9060a01b169061ffff60a01b191617905551151583885287875284882083895287526002858920019081549060ff60b01b9060b01b169060ff60b01b19161790555191865285855282862090865284526002828620019081549060018060b81b03199060b81b169060018060b81b031617905580519361057485610e90565b845251928284938452830190610f70565b8d51633f8ecfd360e21b8152918201528d81602481877f0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff98b165af18015610625578e9f6101599f95928f948f908f90978b60019961049e9582986105f8575b5098505097505050509f5081949e5061044a565b610617908d803d1061061e575b61060f8183610eab565b810190611155565b50386105e4565b503d610605565b8d513d86823e3d90fd5b8b516348be0eb360e01b8152fd5b80151591508161064f575b5038610437565b9050421138610648565b6127101091503861042f565b909192945015918261067d575b505091388881610425565b161590508738610672565b8282161515955061041e565b5050508f80fd5b508f80fd5b8f80fd5b8a80fd5b8980fd5b634e487b7160e01b895260418752602489fd5b8780fd5b8551632fc56e1160e21b81528790fd5b8880fd5b8580fd5b50503461015d578160031936011261015d5760015490516001600160a01b039091168152602090f35b833461074f578060031936011261074f5761071d611417565b600180546001600160a01b0319811690915581906001600160a01b03166000805160206116548339815191528280a380f35b80fd5b8391503461015d5761076336610fe6565b6001600160a01b0393907f0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb85163303610b8a57803580855260208581528386208184013580885290825284872060019081018054939791936001600160601b03919060a01c828114610b7757856107dc9101809261116d565b858a52898952878a20848b52895260ff6002898c20015460b01c16610b44575b858a52898952878a20848b5289526002888b20015460b81c91868b528a8a52888b20858c528a52888b205460a01c908115159283610b38575b505050610b29578015159081610b1f575b50610b115760a08501610859818761106a565b1515905061090557505061ffff888594936108d693610159999a9b6108806108dc9961112d565b16958c528b8b52888c20908c528a52878b20015416926108af81856108a9610100890189611190565b906112cc565b6127106108c66108bd611220565b909416836111c2565b049182806108e8575b50506111ff565b9161132a565b80519361057485610e90565b6108fe916108f8608089016111eb565b8761146f565b8a826108cf565b90919392896109138761112d565b16848a52898952878a20868b5289528a82898c200154169561093e82886108a96101008c018c611190565b61096e610949611220565b938a61271061095d61ffff809816846111c2565b04809381610af4575b5050506111ff565b958b528a8a52888b20908b5289526002888b20015460a01c1699899a806109ae575b5050505050906108d66101599596976109a994936111ff565b6108dc565b612710919293949b506109c190866111c2565b04996109cd848861106a565b8095915015610ae157848c0491826109e6575b50610990565b6080890195937f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d16918c5b858110610a1f5750506109e0565b610a29828c61106a565b821015610ace578c51906331a9108f60e11b82528260051b0135848201528d81602481885afa908115610ac2578f9187918a949391610a7f575b5090610a79918d610a738d6111eb565b9061146f565b01610a11565b92935050508d81813d8311610abb575b610a998183610eab565b81010312610ab75790610a7986610ab08a9461120c565b9091610a63565b8e80fd5b503d610a8f565b8f8e51903d90823e3d90fd5b634e487b7160e01b8f526032845260248ffd5b634e487b7160e01b8b526012825260248bfd5b610b036080610b0994016111eb565b8d61146f565b8a8238610966565b85516304cd703960e51b8152fd5b905042118a610846565b508551635b21dfd360e11b8152fd5b161190508b8080610835565b610b7286898901357f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d611387565b6107fc565b634e487b7160e01b8b526011845260248bfd5b5051632fc56e1160e21b8152fd5b8391503461015d57602080600319360112610248576001600160401b039180358381116102445736602382011215610244578082013590610be4610bdb83610fcb565b97519788610eab565b81875236602483830101116106d7578186926024869301838a013787010152610c0b611417565b8451928311610d0b5750610c20600254610e09565b601f8111610cc7575b5080601f8311600114610c6457508293829392610c59575b50508160011b916000199060031b1c19161760025580f35b015190508380610c41565b90601f19831694600285528285209285905b878210610caf575050836001959610610c96575b505050811b0160025580f35b015160001960f88460031b161c19169055838080610c8a565b80600185968294968601518155019501930190610c76565b60028452818420601f840160051c810191838510610d01575b601f0160051c01905b818110610cf65750610c29565b848155600101610ce9565b9091508190610ce0565b634e487b7160e01b845260419052602483fd5b50503461015d57610159906100da610d3536610fb0565b90610d3e61102c565b5061109f565b50503461015d578160031936011261015d57517f0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb6001600160a01b03168152602090f35b92915034610e05576020366003190112610e05573563ffffffff60e01b8082168092036102445760209450637f5ab69960e11b8214938415610dd0575b505050519015158152f35b9091929350848101906a4c454e535f4d4f44554c4560a81b8252600b8152610df781610e75565b519020161490388080610dc5565b8380fd5b90600182811c92168015610e39575b6020831014610e2357565b634e487b7160e01b600052602260045260246000fd5b91607f1691610e18565b61010081019081106001600160401b03821117610e5f57604052565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b03821117610e5f57604052565b602081019081106001600160401b03821117610e5f57604052565b601f909101601f19168101906001600160401b03821190821017610e5f57604052565b6040519060008260025491610ee283610e09565b808352602093600190818116908115610f505750600114610f0e575b5050610f0c92500383610eab565b565b90939150600260005281600020936000915b818310610f38575050610f0c93508201013880610efe565b85548884018501529485019487945091830191610f20565b915050610f0c94925060ff191682840152151560051b8201013880610efe565b919082519283825260005b848110610f9c575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201610f7b565b6040906003190112610fc6576004359060243590565b600080fd5b6001600160401b038111610e5f57601f01601f191660200190565b60031990602081830112610fc657600435916001600160401b038311610fc6578261012092030112610fc65760040190565b35906001600160a01b0382168203610fc657565b6040519061103982610e43565b8160e06000918281528260208201528260408201528260608201528260808201528260a08201528260c08201520152565b903590601e1981360301821215610fc657018035906001600160401b038211610fc657602001918160051b36038313610fc657565b6110a761102c565b5060005260006020526040600020906000526020526040600020604051906110ce82610e43565b600281549160018060a01b0392838116855260a01c60208501526001810154838116604086015260a01c60608501520154908116608083015261ffff8160a01c1660a083015260ff8160b01c16151560c083015260b81c60e082015290565b803560009081526020818152604080832093820135835292905220546001600160a01b031690565b90816020910312610fc657518015158103610fc65790565b80546001600160a01b031660a09290921b6001600160a01b031916919091179055565b903590601e1981360301821215610fc657018035906001600160401b038211610fc657602001918136038313610fc657565b818102929181159184041417156111d557565b634e487b7160e01b600052601160045260246000fd5b356001600160a01b0381168103610fc65790565b919082039182116111d557565b51906001600160a01b0382168203610fc657565b604080516398f965d160e01b8152919080836004817f000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d6001600160a01b03165afa9283156112c1576000918294611278575b50509190565b9080929450813d83116112ba575b6112908183610eab565b810103126102485760206112a38261120c565b9101519261ffff8416840361074f57503880611272565b503d611286565b50513d6000823e3d90fd5b908160409194939481010312610fc6576001600160a01b03813581811693919290849003610fc65760200135149283159361131d575b50505061130b57565b6040516346308bd560e01b8152600490fd5b1614159050388080611302565b9190823560005260006020526040600020602084013560005260205260018060a01b039081600260406000200154169183611367575b5050505050565b611376608061137d96016111eb565b911661146f565b3880808080611360565b91808214611412576040516347720ebb60e01b81526004810192909252602482015290602090829060449082906001600160a01b03165afa908115611406576000916113e8575b50156113d657565b6040516322d9eef360e21b8152600490fd5b611400915060203d811161061e5761060f8183610eab565b386113ce565b6040513d6000823e3d90fd5b505050565b6001546001600160a01b0316330361142b57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6040516323b872dd60e01b60208083019182526001600160a01b039485166024840152948416604483015260648083019690965294815292939260a081019290916001600160401b03841183851017610e5f576115369460009283928660405216936114da86610e75565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c0820152519082855af13d156115b2573d9161151a83610fcb565b926115286040519485610eab565b83523d60008785013e6115b6565b8051908161154357505050565b8280611553938301019101611155565b1561155b5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6060915b9192901561161857508151156115ca575090565b3b156115d35790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82519091501561162b5750805190602001fd5b60405162461bcd60e51b81526020600482015290819061164f906024830190610f70565b0390fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a264697066735822122037f5a5929134a6d4ca9453f625b880057bf48e8e4744ad9c9af6cdd1a0ac552864736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff9000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
-----Decoded View---------------
Arg [0] : hub (address): 0xDb46d1Dc155634FbC732f92E853b10B288AD5a1d
Arg [1] : actionModule (address): 0x0D90C58cBe787CD70B5Effe94Ce58185D72143fB
Arg [2] : moduleRegistry (address): 0x1eD5983F0c883B96f7C35528a1e22EEA67DE3Ff9
Arg [3] : moduleOwner (address): 0xf94b90BbEee30996019bABD12cEcdDCcf68331DE
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000db46d1dc155634fbc732f92e853b10b288ad5a1d
Arg [1] : 0000000000000000000000000d90c58cbe787cd70b5effe94ce58185d72143fb
Arg [2] : 0000000000000000000000001ed5983f0c883b96f7c35528a1e22eea67de3ff9
Arg [3] : 000000000000000000000000f94b90bbeee30996019babd12cecddccf68331de
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | 100.00% | $0.042815 | 300 | $12.84 |
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.