From 68809f077ae9239a40409f69257d100c29d6ff23 Mon Sep 17 00:00:00 2001 From: donosonaumczuk Date: Thu, 13 Jul 2023 21:33:58 +0100 Subject: [PATCH] misc: Remove unused imports and some formating Co-authored-by: Victor Naumik --- contracts/LensHub.sol | 121 ++++++++---------- contracts/base/ERC2981CollectionRoyalties.sol | 5 +- contracts/base/LensBaseERC721.sol | 45 +++++-- contracts/base/LensGovernable.sol | 10 +- contracts/interfaces/ILegacyCollectNFT.sol | 7 +- contracts/interfaces/ILegacyFollowModule.sol | 19 ++- contracts/interfaces/ILensGovernable.sol | 7 +- .../interfaces/ILensHubInitializable.sol | 8 +- contracts/interfaces/ILensProtocol.sol | 49 ++++--- .../interfaces/IPublicationActionModule.sol | 6 +- contracts/libraries/ActionLib.sol | 9 +- contracts/libraries/LegacyCollectLib.sol | 2 - contracts/libraries/MetaTxLib.sol | 29 ++--- contracts/libraries/ProfileLib.sol | 6 +- contracts/libraries/PublicationLib.sol | 34 +++-- contracts/libraries/StorageLib.sol | 25 ++-- contracts/libraries/ValidationLib.sol | 8 +- .../token-uris/FollowTokenURILib.sol | 10 +- contracts/misc/LegacyCollectNFT.sol | 18 ++- contracts/misc/ModuleGlobals.sol | 6 +- contracts/misc/ProfileCreationProxy.sol | 17 ++- contracts/misc/access/Governance.sol | 50 ++++---- contracts/misc/access/ProxyAdmin.sol | 8 +- contracts/modules/FeeModuleBase.sol | 6 +- contracts/modules/act/collect/CollectNFT.sol | 18 ++- .../MultirecipientFeeCollectModule.sol | 17 ++- .../act/collect/SimpleFeeCollectModule.sol | 12 +- .../act/collect/base/BaseFeeCollectModule.sol | 29 +++-- .../act/seadrop/LensSeaDropCollection.sol | 20 ++- .../modules/follow/RevertFollowModule.sol | 12 +- .../interfaces/IBaseFeeCollectModule.sol | 8 +- contracts/modules/interfaces/IWMATIC.sol | 2 +- .../modules/libraries/FollowValidationLib.sol | 6 +- .../DegreesOfSeparationReferenceModule.sol | 4 - .../reference/FollowerOnlyReferenceModule.sol | 34 +++-- 35 files changed, 391 insertions(+), 276 deletions(-) diff --git a/contracts/LensHub.sol b/contracts/LensHub.sol index 481bb96..2b29a8d 100644 --- a/contracts/LensHub.sol +++ b/contracts/LensHub.sol @@ -5,15 +5,12 @@ pragma solidity ^0.8.15; // Interfaces import {ILensProtocol} from 'contracts/interfaces/ILensProtocol.sol'; import {IFollowNFT} from 'contracts/interfaces/IFollowNFT.sol'; -// import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; // Constants -import {Events} from 'contracts/libraries/constants/Events.sol'; import {Types} from 'contracts/libraries/constants/Types.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; // Lens Hub Components -import {LensBaseERC721} from 'contracts/base/LensBaseERC721.sol'; import {LensHubStorage} from 'contracts/base/LensHubStorage.sol'; import {LensImplGetters} from 'contracts/base/LensImplGetters.sol'; import {LensGovernable} from 'contracts/base/LensGovernable.sol'; @@ -24,7 +21,6 @@ import {LensHubEventHooks} from 'contracts/base/LensHubEventHooks.sol'; import {ActionLib} from 'contracts/libraries/ActionLib.sol'; import {LegacyCollectLib} from 'contracts/libraries/LegacyCollectLib.sol'; import {FollowLib} from 'contracts/libraries/FollowLib.sol'; -import {GovernanceLib} from 'contracts/libraries/GovernanceLib.sol'; import {MetaTxLib} from 'contracts/libraries/MetaTxLib.sol'; import {ProfileLib} from 'contracts/libraries/ProfileLib.sol'; import {PublicationLib} from 'contracts/libraries/PublicationLib.sol'; @@ -90,9 +86,12 @@ contract LensHub is {} /// @inheritdoc ILensProtocol - function createProfile( - Types.CreateProfileParams calldata createProfileParams - ) external override whenNotPaused returns (uint256) { + function createProfile(Types.CreateProfileParams calldata createProfileParams) + external + override + whenNotPaused + returns (uint256) + { ValidationLib.validateProfileCreatorWhitelisted(msg.sender); unchecked { uint256 profileId = ++_profileCounter; @@ -107,10 +106,12 @@ contract LensHub is /////////////////////////////////////////// /// @inheritdoc ILensProtocol - function setProfileMetadataURI( - uint256 profileId, - string calldata metadataURI - ) external override whenNotPaused onlyProfileOwnerOrDelegatedExecutor(msg.sender, profileId) { + function setProfileMetadataURI(uint256 profileId, string calldata metadataURI) + external + override + whenNotPaused + onlyProfileOwnerOrDelegatedExecutor(msg.sender, profileId) + { ProfileLib.setProfileMetadataURI(profileId, metadataURI); } @@ -196,10 +197,12 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function setProfileImageURI( - uint256 profileId, - string calldata imageURI - ) external override whenNotPaused onlyProfileOwnerOrDelegatedExecutor(msg.sender, profileId) { + function setProfileImageURI(uint256 profileId, string calldata imageURI) + external + override + whenNotPaused + onlyProfileOwnerOrDelegatedExecutor(msg.sender, profileId) + { ProfileLib.setProfileImageURI(profileId, imageURI); } @@ -218,9 +221,7 @@ contract LensHub is //////////////////////////////////////// /// @inheritdoc ILensProtocol - function post( - Types.PostParams calldata postParams - ) + function post(Types.PostParams calldata postParams) external override whenPublishingEnabled @@ -231,10 +232,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function postWithSig( - Types.PostParams calldata postParams, - Types.EIP712Signature calldata signature - ) + function postWithSig(Types.PostParams calldata postParams, Types.EIP712Signature calldata signature) external override whenPublishingEnabled @@ -246,9 +244,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function comment( - Types.CommentParams calldata commentParams - ) + function comment(Types.CommentParams calldata commentParams) external override whenPublishingEnabled @@ -259,10 +255,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function commentWithSig( - Types.CommentParams calldata commentParams, - Types.EIP712Signature calldata signature - ) + function commentWithSig(Types.CommentParams calldata commentParams, Types.EIP712Signature calldata signature) external override whenPublishingEnabled @@ -274,9 +267,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function mirror( - Types.MirrorParams calldata mirrorParams - ) + function mirror(Types.MirrorParams calldata mirrorParams) external override whenPublishingEnabled @@ -287,10 +278,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function mirrorWithSig( - Types.MirrorParams calldata mirrorParams, - Types.EIP712Signature calldata signature - ) + function mirrorWithSig(Types.MirrorParams calldata mirrorParams, Types.EIP712Signature calldata signature) external override whenPublishingEnabled @@ -302,9 +290,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function quote( - Types.QuoteParams calldata quoteParams - ) + function quote(Types.QuoteParams calldata quoteParams) external override whenPublishingEnabled @@ -315,10 +301,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function quoteWithSig( - Types.QuoteParams calldata quoteParams, - Types.EIP712Signature calldata signature - ) + function quoteWithSig(Types.QuoteParams calldata quoteParams, Types.EIP712Signature calldata signature) external override whenPublishingEnabled @@ -382,10 +365,12 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function unfollow( - uint256 unfollowerProfileId, - uint256[] calldata idsOfProfilesToUnfollow - ) external override whenNotPaused onlyProfileOwnerOrDelegatedExecutor(msg.sender, unfollowerProfileId) { + function unfollow(uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow) + external + override + whenNotPaused + onlyProfileOwnerOrDelegatedExecutor(msg.sender, unfollowerProfileId) + { FollowLib.unfollow({ unfollowerProfileId: unfollowerProfileId, idsOfProfilesToUnfollow: idsOfProfilesToUnfollow, @@ -429,9 +414,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function collect( - Types.CollectParams calldata collectParams - ) + function collect(Types.CollectParams calldata collectParams) external override whenNotPaused @@ -448,10 +431,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function collectWithSig( - Types.CollectParams calldata collectParams, - Types.EIP712Signature calldata signature - ) + function collectWithSig(Types.CollectParams calldata collectParams, Types.EIP712Signature calldata signature) external override whenNotPaused @@ -469,9 +449,7 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function act( - Types.PublicationActionParams calldata publicationActionParams - ) + function act(Types.PublicationActionParams calldata publicationActionParams) external override whenNotPaused @@ -526,10 +504,11 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function isDelegatedExecutorApproved( - uint256 delegatorProfileId, - address delegatedExecutor - ) external view returns (bool) { + function isDelegatedExecutorApproved(uint256 delegatorProfileId, address delegatedExecutor) + external + view + returns (bool) + { return ProfileLib.isExecutorApproved(delegatorProfileId, delegatedExecutor); } @@ -565,18 +544,22 @@ contract LensHub is } /// @inheritdoc ILensProtocol - function getPublication( - uint256 profileId, - uint256 pubId - ) external view override returns (Types.Publication memory) { + function getPublication(uint256 profileId, uint256 pubId) + external + view + override + returns (Types.Publication memory) + { return _publications[profileId][pubId]; } /// @inheritdoc ILensProtocol - function getPublicationType( - uint256 profileId, - uint256 pubId - ) external view override returns (Types.PublicationType) { + function getPublicationType(uint256 profileId, uint256 pubId) + external + view + override + returns (Types.PublicationType) + { return PublicationLib.getPublicationType(profileId, pubId); } diff --git a/contracts/base/ERC2981CollectionRoyalties.sol b/contracts/base/ERC2981CollectionRoyalties.sol index 8048306..16f09bf 100644 --- a/contracts/base/ERC2981CollectionRoyalties.sol +++ b/contracts/base/ERC2981CollectionRoyalties.sol @@ -48,7 +48,10 @@ abstract contract ERC2981CollectionRoyalties is IERC2981 { } } - function _getRoyaltyAmount(uint256 /* tokenId */, uint256 salePrice) internal view virtual returns (uint256) { + function _getRoyaltyAmount( + uint256, /* tokenId */ + uint256 salePrice + ) internal view virtual returns (uint256) { return (salePrice * _loadRoyaltiesInBasisPoints()) / BASIS_POINTS; } diff --git a/contracts/base/LensBaseERC721.sol b/contracts/base/LensBaseERC721.sol index ae040b2..464f293 100644 --- a/contracts/base/LensBaseERC721.sol +++ b/contracts/base/LensBaseERC721.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.0; import {Errors} from 'contracts/libraries/constants/Errors.sol'; import {Types} from 'contracts/libraries/constants/Types.sol'; -import {Events} from 'contracts/libraries/constants/Events.sol'; import {MetaTxLib} from 'contracts/libraries/MetaTxLib.sol'; import {ILensERC721} from 'contracts/interfaces/ILensERC721.sol'; import {IERC721Timestamped} from 'contracts/interfaces/IERC721Timestamped.sol'; @@ -216,7 +215,11 @@ abstract contract LensBaseERC721 is ERC165, ILensERC721 { /** * @dev See {IERC721-transferFrom}. */ - function transferFrom(address from, address to, uint256 tokenId) public virtual override { + function transferFrom( + address from, + address to, + uint256 tokenId + ) public virtual override { //solhint-disable-next-line max-line-length if (!_isApprovedOrOwner(msg.sender, tokenId)) { revert Errors.NotOwnerOrApproved(); @@ -228,14 +231,23 @@ abstract contract LensBaseERC721 is ERC165, ILensERC721 { /** * @dev See {IERC721-safeTransferFrom}. */ - function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { + function safeTransferFrom( + address from, + address to, + uint256 tokenId + ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ - function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { + function safeTransferFrom( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) public virtual override { if (!_isApprovedOrOwner(msg.sender, tokenId)) { revert Errors.NotOwnerOrApproved(); } @@ -287,7 +299,12 @@ abstract contract LensBaseERC721 is ERC165, ILensERC721 { * * Emits a {Transfer} event. */ - function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { + function _safeTransfer( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) internal virtual { _transfer(from, to, tokenId); if (!_checkOnERC721Received(from, to, tokenId, _data)) { revert Errors.NonERC721ReceiverImplementer(); @@ -388,7 +405,11 @@ abstract contract LensBaseERC721 is ERC165, ILensERC721 { * * Emits a {Transfer} event. */ - function _transfer(address from, address to, uint256 tokenId) internal virtual { + function _transfer( + address from, + address to, + uint256 tokenId + ) internal virtual { if (ownerOf(tokenId) != from) { revert Errors.InvalidOwner(); } @@ -426,7 +447,11 @@ abstract contract LensBaseERC721 is ERC165, ILensERC721 { * * Emits a {ApprovalForAll} event. */ - function _setOperatorApproval(address owner, address operator, bool approved) internal virtual { + function _setOperatorApproval( + address owner, + address operator, + bool approved + ) internal virtual { _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } @@ -478,5 +503,9 @@ abstract contract LensBaseERC721 is ERC165, ILensERC721 { * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ - function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual {} + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual {} } diff --git a/contracts/base/LensGovernable.sol b/contracts/base/LensGovernable.sol index 511dce0..162d056 100644 --- a/contracts/base/LensGovernable.sol +++ b/contracts/base/LensGovernable.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.15; import {ILensGovernable} from 'contracts/interfaces/ILensGovernable.sol'; -import {Errors} from 'contracts/libraries/constants/Errors.sol'; import {GovernanceLib} from 'contracts/libraries/GovernanceLib.sol'; import {ValidationLib} from 'contracts/libraries/ValidationLib.sol'; import {StorageLib} from 'contracts/libraries/StorageLib.sol'; @@ -95,9 +94,12 @@ abstract contract LensGovernable is ILensGovernable { } /// @inheritdoc ILensGovernable - function getActionModuleWhitelistData( - address actionModule - ) external view override returns (Types.ActionModuleWhitelistData memory) { + function getActionModuleWhitelistData(address actionModule) + external + view + override + returns (Types.ActionModuleWhitelistData memory) + { return StorageLib.actionModuleWhitelistData()[actionModule]; } } diff --git a/contracts/interfaces/ILegacyCollectNFT.sol b/contracts/interfaces/ILegacyCollectNFT.sol index 414a659..e9f8891 100644 --- a/contracts/interfaces/ILegacyCollectNFT.sol +++ b/contracts/interfaces/ILegacyCollectNFT.sol @@ -20,7 +20,12 @@ interface ILegacyCollectNFT { * @param name The name to set for this NFT. * @param symbol The symbol to set for this NFT. */ - function initialize(uint256 profileId, uint256 pubId, string calldata name, string calldata symbol) external; + function initialize( + uint256 profileId, + uint256 pubId, + string calldata name, + string calldata symbol + ) external; /** * @notice Mints a collect NFT to the specified address. diff --git a/contracts/interfaces/ILegacyFollowModule.sol b/contracts/interfaces/ILegacyFollowModule.sol index 4cbcc1f..1ffc3cc 100644 --- a/contracts/interfaces/ILegacyFollowModule.sol +++ b/contracts/interfaces/ILegacyFollowModule.sol @@ -26,7 +26,11 @@ interface ILegacyFollowModule { * @param profileId The token ID of the profile being followed. * @param data Arbitrary data passed by the follower. */ - function processFollow(address follower, uint256 profileId, bytes calldata data) external; + function processFollow( + address follower, + uint256 profileId, + bytes calldata data + ) external; /** * @notice This is a transfer hook that is called upon follow NFT transfer in `beforeTokenTransfer. This can @@ -41,7 +45,12 @@ interface ILegacyFollowModule { * @param to The address receiving the follow NFT. * @param followNFTTokenId The token ID of the follow NFT being transferred. */ - function followModuleTransferHook(uint256 profileId, address from, address to, uint256 followNFTTokenId) external; + function followModuleTransferHook( + uint256 profileId, + address from, + address to, + uint256 followNFTTokenId + ) external; /** * @notice This is a helper function that could be used in conjunction with specific collect modules. @@ -65,5 +74,9 @@ interface ILegacyFollowModule { * * @return true if the given address is following the given profile ID, false otherwise. */ - function isFollowing(uint256 profileId, address follower, uint256 followNFTTokenId) external view returns (bool); + function isFollowing( + uint256 profileId, + address follower, + uint256 followNFTTokenId + ) external view returns (bool); } diff --git a/contracts/interfaces/ILensGovernable.sol b/contracts/interfaces/ILensGovernable.sol index 9989daf..497960d 100644 --- a/contracts/interfaces/ILensGovernable.sol +++ b/contracts/interfaces/ILensGovernable.sol @@ -126,7 +126,8 @@ interface ILensGovernable { * * @return ActionModuleWhitelistData The data containing the ID and whitelist status of the given module. */ - function getActionModuleWhitelistData( - address actionModule - ) external view returns (Types.ActionModuleWhitelistData memory); + function getActionModuleWhitelistData(address actionModule) + external + view + returns (Types.ActionModuleWhitelistData memory); } diff --git a/contracts/interfaces/ILensHubInitializable.sol b/contracts/interfaces/ILensHubInitializable.sol index 35c46cd..486a549 100644 --- a/contracts/interfaces/ILensHubInitializable.sol +++ b/contracts/interfaces/ILensHubInitializable.sol @@ -2,8 +2,6 @@ pragma solidity >=0.6.0; -import {Types} from 'contracts/libraries/constants/Types.sol'; - /** * @title ILensHub * @author Lens Protocol @@ -22,5 +20,9 @@ interface ILensHubInitializable { * @param symbol The symbol of the Profile NFT. * @param newGovernance The governance address to set. */ - function initialize(string calldata name, string calldata symbol, address newGovernance) external; + function initialize( + string calldata name, + string calldata symbol, + address newGovernance + ) external; } diff --git a/contracts/interfaces/ILensProtocol.sol b/contracts/interfaces/ILensProtocol.sol index 7e1c933..aa6aa73 100644 --- a/contracts/interfaces/ILensProtocol.sol +++ b/contracts/interfaces/ILensProtocol.sol @@ -46,7 +46,11 @@ interface ILensProtocol { * @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; + function setFollowModule( + uint256 profileId, + address followModule, + bytes calldata followModuleInitData + ) external; /** * @custom:meta-tx setFollowModule. @@ -139,10 +143,9 @@ interface ILensProtocol { /** * @custom:meta-tx post. */ - function postWithSig( - Types.PostParams calldata postParams, - Types.EIP712Signature calldata signature - ) external returns (uint256); + function postWithSig(Types.PostParams calldata postParams, Types.EIP712Signature calldata signature) + external + returns (uint256); /** * @notice Publishes a comment on the given publication. @@ -162,10 +165,9 @@ interface ILensProtocol { /** * @custom:meta-tx comment. */ - function commentWithSig( - Types.CommentParams calldata commentParams, - Types.EIP712Signature calldata signature - ) external returns (uint256); + function commentWithSig(Types.CommentParams calldata commentParams, Types.EIP712Signature calldata signature) + external + returns (uint256); /** * @notice Publishes a mirror of the given publication. @@ -184,10 +186,9 @@ interface ILensProtocol { /** * @custom:meta-tx mirror. */ - function mirrorWithSig( - Types.MirrorParams calldata mirrorParams, - Types.EIP712Signature calldata signature - ) external returns (uint256); + function mirrorWithSig(Types.MirrorParams calldata mirrorParams, Types.EIP712Signature calldata signature) + external + returns (uint256); /** * @notice Publishes a quote of the given publication. @@ -208,10 +209,9 @@ interface ILensProtocol { /** * @custom:meta-tx quote. */ - function quoteWithSig( - Types.QuoteParams calldata quoteParams, - Types.EIP712Signature calldata signature - ) external returns (uint256); + 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). @@ -309,10 +309,9 @@ interface ILensProtocol { * @custom:meta-tx collect. * @custom:pending-deprecation */ - function collectWithSig( - Types.CollectParams calldata collectParams, - Types.EIP712Signature calldata signature - ) external returns (uint256); + function collectWithSig(Types.CollectParams calldata collectParams, Types.EIP712Signature calldata signature) + external + returns (uint256); /** * @notice Acts on a given publication with the specified parameters. @@ -375,10 +374,10 @@ interface ILensProtocol { * @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); + function isDelegatedExecutorApproved(uint256 delegatorProfileId, address delegatedExecutor) + external + view + returns (bool); /** * @notice Returns the current delegated executor config number for the given profile. diff --git a/contracts/interfaces/IPublicationActionModule.sol b/contracts/interfaces/IPublicationActionModule.sol index a9a076a..31e9a5e 100644 --- a/contracts/interfaces/IPublicationActionModule.sol +++ b/contracts/interfaces/IPublicationActionModule.sol @@ -47,7 +47,7 @@ interface IPublicationActionModule { * @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by * indexers or UIs. */ - function processPublicationAction( - Types.ProcessActionParams calldata processActionParams - ) external returns (bytes memory); + function processPublicationAction(Types.ProcessActionParams calldata processActionParams) + external + returns (bytes memory); } diff --git a/contracts/libraries/ActionLib.sol b/contracts/libraries/ActionLib.sol index f3e34a3..4f76dc0 100644 --- a/contracts/libraries/ActionLib.sol +++ b/contracts/libraries/ActionLib.sol @@ -62,10 +62,11 @@ library ActionLib { return actionModuleReturnData; } - function _isActionEnabled( - Types.Publication storage _publication, - uint256 actionModuleId - ) private view returns (bool) { + function _isActionEnabled(Types.Publication storage _publication, uint256 actionModuleId) + private + view + returns (bool) + { if (actionModuleId == 0) { return false; } diff --git a/contracts/libraries/LegacyCollectLib.sol b/contracts/libraries/LegacyCollectLib.sol index e804836..d67b09d 100644 --- a/contracts/libraries/LegacyCollectLib.sol +++ b/contracts/libraries/LegacyCollectLib.sol @@ -7,12 +7,10 @@ import {Types} from 'contracts/libraries/constants/Types.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; import {Events} from 'contracts/libraries/constants/Events.sol'; import {ICollectNFT} from 'contracts/interfaces/ICollectNFT.sol'; -import {ICollectModule} from 'contracts/interfaces/ICollectModule.sol'; import {ILegacyCollectModule} from 'contracts/interfaces/ILegacyCollectModule.sol'; import {Clones} from '@openzeppelin/contracts/proxy/Clones.sol'; import {Strings} from '@openzeppelin/contracts/utils/Strings.sol'; import {StorageLib} from 'contracts/libraries/StorageLib.sol'; -import {PublicationLib} from 'contracts/libraries/PublicationLib.sol'; /** * @title LegacyCollectLib diff --git a/contracts/libraries/MetaTxLib.sol b/contracts/libraries/MetaTxLib.sol index 13f0166..9316313 100644 --- a/contracts/libraries/MetaTxLib.sol +++ b/contracts/libraries/MetaTxLib.sol @@ -134,10 +134,9 @@ library MetaTxLib { ); } - function validatePostSignature( - Types.EIP712Signature calldata signature, - Types.PostParams calldata postParams - ) external { + function validatePostSignature(Types.EIP712Signature calldata signature, Types.PostParams calldata postParams) + external + { _validateRecoveredAddress( _calculateDigest( keccak256( @@ -188,9 +187,11 @@ library MetaTxLib { uint256 deadline; } - function _abiEncode( - ReferenceParamsForAbiEncode memory referenceParamsForAbiEncode - ) private pure returns (bytes memory) { + function _abiEncode(ReferenceParamsForAbiEncode memory referenceParamsForAbiEncode) + private + pure + returns (bytes memory) + { // This assembly workaround allows us to avoid Stack Too Deep error when encoding all the params of the struct. // We remove the first 32 bytes of the encoded struct, which is the offset of the struct. // The rest of the encoding is the same, so we can just return it. @@ -252,10 +253,9 @@ library MetaTxLib { _validateRecoveredAddress(_calculateDigest(keccak256(encodedAbi)), signature); } - function validateQuoteSignature( - Types.EIP712Signature calldata signature, - Types.QuoteParams calldata quoteParams - ) external { + function validateQuoteSignature(Types.EIP712Signature calldata signature, Types.QuoteParams calldata quoteParams) + external + { bytes32 contentURIHash = keccak256(bytes(quoteParams.contentURI)); bytes32 referenceModuleDataHash = keccak256(quoteParams.referenceModuleData); bytes32 actionModulesInitDataHash = _hashActionModulesInitDatas(quoteParams.actionModulesInitDatas); @@ -283,10 +283,9 @@ library MetaTxLib { _validateRecoveredAddress(_calculateDigest(keccak256(encodedAbi)), signature); } - function validateMirrorSignature( - Types.EIP712Signature calldata signature, - Types.MirrorParams calldata mirrorParams - ) external { + function validateMirrorSignature(Types.EIP712Signature calldata signature, Types.MirrorParams calldata mirrorParams) + external + { _validateRecoveredAddress( _calculateDigest( keccak256( diff --git a/contracts/libraries/ProfileLib.sol b/contracts/libraries/ProfileLib.sol index a3291c2..39da7a4 100644 --- a/contracts/libraries/ProfileLib.sol +++ b/contracts/libraries/ProfileLib.sol @@ -89,7 +89,11 @@ library ProfileLib { * @param followModule The follow module to set for the given profile, if any. * @param followModuleInitData The data to pass to the follow module for profile initialization. */ - function setFollowModule(uint256 profileId, address followModule, bytes calldata followModuleInitData) external { + function setFollowModule( + uint256 profileId, + address followModule, + bytes calldata followModuleInitData + ) external { StorageLib.getProfile(profileId).followModule = followModule; bytes memory followModuleReturnData; if (followModule != address(0)) { diff --git a/contracts/libraries/PublicationLib.sol b/contracts/libraries/PublicationLib.sol index a798533..432ad14 100644 --- a/contracts/libraries/PublicationLib.sol +++ b/contracts/libraries/PublicationLib.sol @@ -60,10 +60,10 @@ library PublicationLib { * * @return uint256 The created publication's pubId. */ - function comment( - Types.CommentParams calldata commentParams, - address transactionExecutor - ) external returns (uint256) { + function comment(Types.CommentParams calldata commentParams, address transactionExecutor) + external + returns (uint256) + { ( uint256 pubIdAssigned, bytes[] memory actionModulesInitReturnDatas, @@ -200,18 +200,22 @@ library PublicationLib { } } - function _asReferencePubParams( - Types.QuoteParams calldata quoteParams - ) private pure returns (Types.ReferencePubParams calldata referencePubParams) { + function _asReferencePubParams(Types.QuoteParams calldata quoteParams) + private + pure + returns (Types.ReferencePubParams calldata referencePubParams) + { // We use assembly to cast the types keeping the params in calldata, as they match the fields. assembly { referencePubParams := quoteParams } } - function _asReferencePubParams( - Types.CommentParams calldata commentParams - ) private pure returns (Types.ReferencePubParams calldata referencePubParams) { + function _asReferencePubParams(Types.CommentParams calldata commentParams) + private + pure + returns (Types.ReferencePubParams calldata referencePubParams) + { // We use assembly to cast the types keeping the params in calldata, as they match the fields. assembly { referencePubParams := commentParams @@ -222,7 +226,15 @@ library PublicationLib { Types.ReferencePubParams calldata referencePubParams, address transactionExecutor, Types.PublicationType referencePubType - ) private returns (uint256, bytes[] memory, bytes memory, Types.PublicationType[] memory) { + ) + private + returns ( + uint256, + bytes[] memory, + bytes memory, + Types.PublicationType[] memory + ) + { ValidationLib.validatePointedPub(referencePubParams.pointedProfileId, referencePubParams.pointedPubId); ValidationLib.validateNotBlocked({ profile: referencePubParams.profileId, diff --git a/contracts/libraries/StorageLib.sol b/contracts/libraries/StorageLib.sol index 5f2e8b2..4cb1a78 100644 --- a/contracts/libraries/StorageLib.sol +++ b/contracts/libraries/StorageLib.sol @@ -46,10 +46,11 @@ library StorageLib { uint256 constant MAX_ACTION_MODULE_ID_SUPPORTED = 255; - function getPublication( - uint256 profileId, - uint256 pubId - ) internal pure returns (Types.Publication storage _publication) { + function getPublication(uint256 profileId, uint256 pubId) + internal + pure + returns (Types.Publication storage _publication) + { assembly { mstore(0, profileId) mstore(32, PUBLICATIONS_MAPPING_SLOT) @@ -67,9 +68,11 @@ library StorageLib { } } - function getDelegatedExecutorsConfig( - uint256 delegatorProfileId - ) internal pure returns (Types.DelegatedExecutorsConfig storage _delegatedExecutorsConfig) { + function getDelegatedExecutorsConfig(uint256 delegatorProfileId) + internal + pure + returns (Types.DelegatedExecutorsConfig storage _delegatedExecutorsConfig) + { assembly { mstore(0, delegatorProfileId) mstore(32, DELEGATED_EXECUTOR_CONFIG_MAPPING_SLOT) @@ -95,9 +98,11 @@ library StorageLib { } } - function blockedStatus( - uint256 blockerProfileId - ) internal pure returns (mapping(uint256 => bool) storage _blockedStatus) { + function blockedStatus(uint256 blockerProfileId) + internal + pure + returns (mapping(uint256 => bool) storage _blockedStatus) + { assembly { mstore(0, blockerProfileId) mstore(32, BLOCKED_STATUS_MAPPING_SLOT) diff --git a/contracts/libraries/ValidationLib.sol b/contracts/libraries/ValidationLib.sol index 5748e98..3204de5 100644 --- a/contracts/libraries/ValidationLib.sol +++ b/contracts/libraries/ValidationLib.sol @@ -39,10 +39,10 @@ library ValidationLib { } } - function validateAddressIsDelegatedExecutor( - address expectedDelegatedExecutor, - uint256 delegatorProfileId - ) internal view { + function validateAddressIsDelegatedExecutor(address expectedDelegatedExecutor, uint256 delegatorProfileId) + internal + view + { if (!ProfileLib.isExecutorApproved(delegatorProfileId, expectedDelegatedExecutor)) { revert Errors.ExecutorInvalid(); } diff --git a/contracts/libraries/token-uris/FollowTokenURILib.sol b/contracts/libraries/token-uris/FollowTokenURILib.sol index 1b6a404..1eeeadd 100644 --- a/contracts/libraries/token-uris/FollowTokenURILib.sol +++ b/contracts/libraries/token-uris/FollowTokenURILib.sol @@ -6,7 +6,6 @@ import {Base64} from '@openzeppelin/contracts/utils/Base64.sol'; import {Strings} from '@openzeppelin/contracts/utils/Strings.sol'; import {TokenURIMainFontLib} from 'contracts/libraries/token-uris/TokenURIMainFontLib.sol'; import {TokenURISecondaryFontLib} from 'contracts/libraries/token-uris/TokenURISecondaryFontLib.sol'; -import {StorageLib} from 'contracts/libraries/StorageLib.sol'; library FollowTokenURILib { using Strings for uint96; @@ -46,10 +45,11 @@ library FollowTokenURILib { ); } - function _getSVGImageBase64Encoded( - string memory followTokenIdAsString, - string memory followedProfileIdAsString - ) private pure returns (string memory) { + function _getSVGImageBase64Encoded(string memory followTokenIdAsString, string memory followedProfileIdAsString) + private + pure + returns (string memory) + { return Base64.encode( abi.encodePacked( diff --git a/contracts/misc/LegacyCollectNFT.sol b/contracts/misc/LegacyCollectNFT.sol index 4b702dc..8df4ff1 100644 --- a/contracts/misc/LegacyCollectNFT.sol +++ b/contracts/misc/LegacyCollectNFT.sol @@ -88,18 +88,26 @@ contract LegacyCollectNFT is LensBaseERC721, ERC2981CollectionRoyalties, ICollec /** * @dev See {IERC165-supportsInterface}. */ - function supportsInterface( - bytes4 interfaceId - ) public view virtual override(ERC2981CollectionRoyalties, LensBaseERC721) returns (bool) { + function supportsInterface(bytes4 interfaceId) + public + view + virtual + override(ERC2981CollectionRoyalties, LensBaseERC721) + returns (bool) + { return ERC2981CollectionRoyalties.supportsInterface(interfaceId) || LensBaseERC721.supportsInterface(interfaceId); } - function _getReceiver(uint256 /* tokenId */) internal view override returns (address) { + function _getReceiver( + uint256 /* tokenId */ + ) internal view override returns (address) { return IERC721(HUB).ownerOf(_profileId); } - function _beforeRoyaltiesSet(uint256 /* royaltiesInBasisPoints */) internal view override { + function _beforeRoyaltiesSet( + uint256 /* royaltiesInBasisPoints */ + ) internal view override { if (IERC721(HUB).ownerOf(_profileId) != msg.sender) { revert Errors.NotProfileOwner(); } diff --git a/contracts/misc/ModuleGlobals.sol b/contracts/misc/ModuleGlobals.sol index c1d4291..c4ae136 100644 --- a/contracts/misc/ModuleGlobals.sol +++ b/contracts/misc/ModuleGlobals.sol @@ -36,7 +36,11 @@ contract ModuleGlobals is IModuleGlobals { * @param treasury The treasury address to direct fees to. * @param treasuryFee The treasury fee in BPS to levy on collects. */ - constructor(address governance, address treasury, uint16 treasuryFee) { + constructor( + address governance, + address treasury, + uint16 treasuryFee + ) { _setGovernance(governance); _setTreasury(treasury); _setTreasuryFee(treasuryFee); diff --git a/contracts/misc/ProfileCreationProxy.sol b/contracts/misc/ProfileCreationProxy.sol index 068fb4f..4e1175f 100644 --- a/contracts/misc/ProfileCreationProxy.sol +++ b/contracts/misc/ProfileCreationProxy.sol @@ -30,16 +30,19 @@ contract ProfileCreationProxy is ImmutableOwnable { TOKEN_HANDLE_REGISTRY = ITokenHandleRegistry(tokenHandleRegistry); } - function proxyCreateProfile( - Types.CreateProfileParams calldata createProfileParams - ) external onlyOwner returns (uint256) { + function proxyCreateProfile(Types.CreateProfileParams calldata createProfileParams) + external + onlyOwner + returns (uint256) + { return ILensHub(LENS_HUB).createProfile(createProfileParams); } - function proxyCreateProfileWithHandle( - Types.CreateProfileParams memory createProfileParams, - string calldata handle - ) external onlyOwner returns (uint256, uint256) { + function proxyCreateProfileWithHandle(Types.CreateProfileParams memory createProfileParams, string calldata handle) + external + onlyOwner + returns (uint256, uint256) + { // We mint the handle & profile to this contract first, then link it to the profile // This will not allow to initialize follow modules that require funds from the msg.sender, // but we assume only simple follow modules should be set during profile creation. diff --git a/contracts/misc/access/Governance.sol b/contracts/misc/access/Governance.sol index de2843e..c83fc7b 100644 --- a/contracts/misc/access/Governance.sol +++ b/contracts/misc/access/Governance.sol @@ -32,48 +32,50 @@ contract Governance is ControllableByContract { /// ONLY GOVERNANCE OWNER OR CONTROLLER CONTRACT /// //////////////////////////////////////////////////////// - function lensHub_whitelistProfileCreator( - address profileCreator, - bool whitelist - ) external onlyOwnerOrControllerContract { + function lensHub_whitelistProfileCreator(address profileCreator, bool whitelist) + external + onlyOwnerOrControllerContract + { LENS_HUB.whitelistProfileCreator(profileCreator, whitelist); } - function lensHub_whitelistFollowModule( - address followModule, - bool whitelist - ) external onlyOwnerOrControllerContract { + function lensHub_whitelistFollowModule(address followModule, bool whitelist) + external + onlyOwnerOrControllerContract + { LENS_HUB.whitelistFollowModule(followModule, whitelist); } - function lensHub_whitelistReferenceModule( - address referenceModule, - bool whitelist - ) external onlyOwnerOrControllerContract { + function lensHub_whitelistReferenceModule(address referenceModule, bool whitelist) + external + onlyOwnerOrControllerContract + { LENS_HUB.whitelistReferenceModule(referenceModule, whitelist); } - function lensHub_whitelistActionModule( - address actionModule, - bool whitelist - ) external onlyOwnerOrControllerContract { + function lensHub_whitelistActionModule(address actionModule, bool whitelist) + external + onlyOwnerOrControllerContract + { LENS_HUB.whitelistActionModule(actionModule, whitelist); } // Interface to the Deprecated LensHub V1 to unwhitelist collect modules - function lensHub_whitelistCollectModule( - address collectModule, - bool whitelist - ) external onlyOwnerOrControllerContract { + function lensHub_whitelistCollectModule(address collectModule, bool whitelist) + external + onlyOwnerOrControllerContract + { ILensHub_V1(address(LENS_HUB)).whitelistCollectModule(collectModule, whitelist); } // This allows the governance to call anything on behalf of itself. // And also allows the Upgradable contract to call anything, except the LensHub with Governance permissions. - function executeAsGovernance( - address target, - bytes calldata data - ) external payable onlyOwnerOrControllerContract returns (bytes memory) { + function executeAsGovernance(address target, bytes calldata data) + external + payable + onlyOwnerOrControllerContract + returns (bytes memory) + { if (msg.sender == controllerContract && target == address(LENS_HUB)) { revert Unauthorized(); } diff --git a/contracts/misc/access/ProxyAdmin.sol b/contracts/misc/access/ProxyAdmin.sol index e3371ac..e1a3529 100644 --- a/contracts/misc/access/ProxyAdmin.sol +++ b/contracts/misc/access/ProxyAdmin.sol @@ -44,10 +44,10 @@ contract ProxyAdmin is ControllableByContract { delete controllerContract; } - function proxy_upgradeAndCall( - address newImplementation, - bytes calldata data - ) external onlyOwnerOrControllerContract { + function proxy_upgradeAndCall(address newImplementation, bytes calldata data) + external + onlyOwnerOrControllerContract + { previousImplementation = LENS_HUB_PROXY.implementation(); LENS_HUB_PROXY.upgradeToAndCall(newImplementation, data); delete controllerContract; diff --git a/contracts/modules/FeeModuleBase.sol b/contracts/modules/FeeModuleBase.sol index 3445c21..75374fd 100644 --- a/contracts/modules/FeeModuleBase.sol +++ b/contracts/modules/FeeModuleBase.sol @@ -29,7 +29,11 @@ abstract contract FeeModuleBase { return MODULE_GLOBALS.getTreasuryData(); } - function _validateDataIsExpected(bytes calldata data, address currency, uint256 amount) internal pure { + 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(); diff --git a/contracts/modules/act/collect/CollectNFT.sol b/contracts/modules/act/collect/CollectNFT.sol index ae867ac..3491cef 100644 --- a/contracts/modules/act/collect/CollectNFT.sol +++ b/contracts/modules/act/collect/CollectNFT.sol @@ -87,18 +87,26 @@ contract CollectNFT is LensBaseERC721, ERC2981CollectionRoyalties, ActionRestric /** * @dev See {IERC165-supportsInterface}. */ - function supportsInterface( - bytes4 interfaceId - ) public view virtual override(ERC2981CollectionRoyalties, LensBaseERC721) returns (bool) { + function supportsInterface(bytes4 interfaceId) + public + view + virtual + override(ERC2981CollectionRoyalties, LensBaseERC721) + returns (bool) + { return ERC2981CollectionRoyalties.supportsInterface(interfaceId) || LensBaseERC721.supportsInterface(interfaceId); } - function _getReceiver(uint256 /* tokenId */) internal view override returns (address) { + function _getReceiver( + uint256 /* tokenId */ + ) internal view override returns (address) { return IERC721(HUB).ownerOf(_profileId); } - function _beforeRoyaltiesSet(uint256 /* royaltiesInBasisPoints */) internal view override { + function _beforeRoyaltiesSet( + uint256 /* royaltiesInBasisPoints */ + ) internal view override { if (IERC721(HUB).ownerOf(_profileId) != msg.sender) { revert Errors.NotProfileOwner(); } diff --git a/contracts/modules/act/collect/MultirecipientFeeCollectModule.sol b/contracts/modules/act/collect/MultirecipientFeeCollectModule.sol index ca0845c..ceba655 100644 --- a/contracts/modules/act/collect/MultirecipientFeeCollectModule.sol +++ b/contracts/modules/act/collect/MultirecipientFeeCollectModule.sol @@ -88,7 +88,7 @@ contract MultirecipientFeeCollectModule is BaseFeeCollectModule { function initializePublicationCollectModule( uint256 profileId, uint256 pubId, - address /* transactionExecutor */, + address, /* transactionExecutor */ bytes calldata data ) external override onlyActionModule returns (bytes memory) { MultirecipientFeeCollectModuleInitData memory initData = abi.decode( @@ -122,7 +122,11 @@ contract MultirecipientFeeCollectModule is BaseFeeCollectModule { * @param profileId The profile ID who is publishing the publication. * @param pubId The associated publication's LensHub publication ID. */ - function _validateAndStoreRecipients(RecipientData[] memory recipients, uint256 profileId, uint256 pubId) internal { + function _validateAndStoreRecipients( + RecipientData[] memory recipients, + uint256 profileId, + uint256 pubId + ) internal { uint256 len = recipients.length; // Check number of recipients is supported @@ -201,10 +205,11 @@ contract MultirecipientFeeCollectModule is BaseFeeCollectModule { * * @return The BaseProfilePublicationData struct mapped to that publication. */ - function getPublicationData( - uint256 profileId, - uint256 pubId - ) external view returns (MultirecipientFeeCollectProfilePublicationData memory) { + function getPublicationData(uint256 profileId, uint256 pubId) + external + view + returns (MultirecipientFeeCollectProfilePublicationData memory) + { BaseProfilePublicationData memory baseData = getBasePublicationData(profileId, pubId); RecipientData[] memory recipients = _recipientsByPublicationByProfile[profileId][pubId]; diff --git a/contracts/modules/act/collect/SimpleFeeCollectModule.sol b/contracts/modules/act/collect/SimpleFeeCollectModule.sol index 7c13808..38ff5a6 100644 --- a/contracts/modules/act/collect/SimpleFeeCollectModule.sol +++ b/contracts/modules/act/collect/SimpleFeeCollectModule.sol @@ -39,7 +39,7 @@ contract SimpleFeeCollectModule is BaseFeeCollectModule { function initializePublicationCollectModule( uint256 profileId, uint256 pubId, - address /* transactionExecutor */, + address, /* transactionExecutor */ bytes calldata data ) external override onlyActionModule returns (bytes memory) { BaseFeeCollectModuleInitData memory baseInitData = abi.decode(data, (BaseFeeCollectModuleInitData)); @@ -57,10 +57,12 @@ contract SimpleFeeCollectModule is BaseFeeCollectModule { * * @return The BaseProfilePublicationData struct mapped to that publication. */ - function getPublicationData( - uint256 profileId, - uint256 pubId - ) external view virtual returns (BaseProfilePublicationData memory) { + function getPublicationData(uint256 profileId, uint256 pubId) + external + view + virtual + returns (BaseProfilePublicationData memory) + { return getBasePublicationData(profileId, pubId); } } diff --git a/contracts/modules/act/collect/base/BaseFeeCollectModule.sol b/contracts/modules/act/collect/base/BaseFeeCollectModule.sol index 6604136..1151622 100644 --- a/contracts/modules/act/collect/base/BaseFeeCollectModule.sol +++ b/contracts/modules/act/collect/base/BaseFeeCollectModule.sol @@ -6,7 +6,6 @@ import {Errors} from 'contracts/modules/constants/Errors.sol'; import {FeeModuleBase} from 'contracts/modules/FeeModuleBase.sol'; import {ICollectModule} from 'contracts/interfaces/ICollectModule.sol'; import {ActionRestricted} from 'contracts/modules/ActionRestricted.sol'; -import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {Types} from 'contracts/libraries/constants/Types.sol'; @@ -52,9 +51,12 @@ abstract contract BaseFeeCollectModule is FeeModuleBase, ActionRestricted, IBase * * @param processCollectParams Collect action parameters (see Types.ProcessCollectParams struct) */ - function processCollect( - Types.ProcessCollectParams calldata processCollectParams - ) external virtual onlyActionModule returns (bytes memory) { + function processCollect(Types.ProcessCollectParams calldata processCollectParams) + external + virtual + onlyActionModule + returns (bytes memory) + { _validateAndStoreCollect(processCollectParams); if (processCollectParams.referrerProfileIds.length == 0) { @@ -66,17 +68,22 @@ abstract contract BaseFeeCollectModule is FeeModuleBase, ActionRestricted, IBase } /// @inheritdoc IBaseFeeCollectModule - function getBasePublicationData( - uint256 profileId, - uint256 pubId - ) public view virtual returns (BaseProfilePublicationData memory) { + function getBasePublicationData(uint256 profileId, uint256 pubId) + public + view + virtual + returns (BaseProfilePublicationData memory) + { return _dataByPublicationByProfile[profileId][pubId]; } /// @inheritdoc IBaseFeeCollectModule - function calculateFee( - Types.ProcessCollectParams calldata processCollectParams - ) public view virtual returns (uint160) { + function calculateFee(Types.ProcessCollectParams calldata processCollectParams) + public + view + virtual + returns (uint160) + { return _dataByPublicationByProfile[processCollectParams.publicationCollectedProfileId][ processCollectParams.publicationCollectedId diff --git a/contracts/modules/act/seadrop/LensSeaDropCollection.sol b/contracts/modules/act/seadrop/LensSeaDropCollection.sol index 88ebc94..2e69121 100644 --- a/contracts/modules/act/seadrop/LensSeaDropCollection.sol +++ b/contracts/modules/act/seadrop/LensSeaDropCollection.sol @@ -27,7 +27,11 @@ contract LensSeaDropCollection is ERC721SeaDropCloneable { _; } - constructor(address seaDropActionModule, address moduleGlobals, address defaultSeaDrop) { + constructor( + address seaDropActionModule, + address moduleGlobals, + address defaultSeaDrop + ) { SEADROP_ACTION_MODULE = seaDropActionModule; MODULE_GLOBALS = IModuleGlobals(moduleGlobals); DEFAULT_SEADROP = defaultSeaDrop; @@ -52,10 +56,10 @@ contract LensSeaDropCollection is ERC721SeaDropCloneable { _transferOwnership(owner); } - function _validateInitializationData( - address[] calldata allowedSeaDrops, - MultiConfigureStruct calldata config - ) internal view { + function _validateInitializationData(address[] calldata allowedSeaDrops, MultiConfigureStruct calldata config) + internal + view + { // Makes sure that the default used SeaDrop is allowed as the first element of the array. if (allowedSeaDrops.length == 0 || allowedSeaDrops[0] != DEFAULT_SEADROP) { revert InvalidParams(); @@ -145,7 +149,11 @@ contract LensSeaDropCollection is ERC721SeaDropCloneable { * @param payer The payer to update. * @param allowed Whether the payer is allowed. */ - function updatePayer(address seaDropImpl, address payer, bool allowed) external virtual override { + function updatePayer( + address seaDropImpl, + address payer, + bool allowed + ) external virtual override { // We only enforce the SeaDropMintPublicationAction to be enabled as a payer when using the default SeaDrop. if (seaDropImpl == DEFAULT_SEADROP && !allowed && payer == SEADROP_ACTION_MODULE) { revert InvalidParams(); diff --git a/contracts/modules/follow/RevertFollowModule.sol b/contracts/modules/follow/RevertFollowModule.sol index c5b3b8a..6c1027a 100644 --- a/contracts/modules/follow/RevertFollowModule.sol +++ b/contracts/modules/follow/RevertFollowModule.sol @@ -14,8 +14,8 @@ import {IFollowModule} from 'contracts/interfaces/IFollowModule.sol'; contract RevertFollowModule is IFollowModule { /// @inheritdoc IFollowModule function initializeFollowModule( - uint256 /* profileId */, - address /* transactionExecutor */, + uint256, /* profileId */ + address, /* transactionExecutor */ bytes calldata /* data */ ) external pure override returns (bytes memory) { return ''; @@ -26,10 +26,10 @@ contract RevertFollowModule is IFollowModule { * @notice Processes a follow by rejecting it, reverting the transaction. Parameters are ignored. */ function processFollow( - uint256 /* followerProfileId */, - uint256 /* followTokenId */, - address /* transactionExecutor */, - uint256 /* profileId */, + uint256, /* followerProfileId */ + uint256, /* followTokenId */ + address, /* transactionExecutor */ + uint256, /* profileId */ bytes calldata /* data */ ) external pure override returns (bytes memory) { revert Errors.FollowInvalid(); diff --git a/contracts/modules/interfaces/IBaseFeeCollectModule.sol b/contracts/modules/interfaces/IBaseFeeCollectModule.sol index c442046..935151a 100644 --- a/contracts/modules/interfaces/IBaseFeeCollectModule.sol +++ b/contracts/modules/interfaces/IBaseFeeCollectModule.sol @@ -58,10 +58,10 @@ interface IBaseFeeCollectModule is ICollectModule { * * @return The BaseProfilePublicationData struct mapped to that publication. */ - function getBasePublicationData( - uint256 profileId, - uint256 pubId - ) external view returns (BaseProfilePublicationData memory); + function getBasePublicationData(uint256 profileId, uint256 pubId) + external + view + returns (BaseProfilePublicationData memory); /** * @notice Calculates and returns the collect fee of a publication. diff --git a/contracts/modules/interfaces/IWMATIC.sol b/contracts/modules/interfaces/IWMATIC.sol index 8c6cbbd..d6ab4a5 100644 --- a/contracts/modules/interfaces/IWMATIC.sol +++ b/contracts/modules/interfaces/IWMATIC.sol @@ -5,7 +5,7 @@ pragma solidity >=0.6.0; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; interface IWMATIC is IERC20 { - function withdraw(uint amountToUnwrap) external; + function withdraw(uint256 amountToUnwrap) external; function deposit() external payable; } diff --git a/contracts/modules/libraries/FollowValidationLib.sol b/contracts/modules/libraries/FollowValidationLib.sol index 64eb339..7738789 100644 --- a/contracts/modules/libraries/FollowValidationLib.sol +++ b/contracts/modules/libraries/FollowValidationLib.sol @@ -12,7 +12,11 @@ import {Errors} from 'contracts/libraries/constants/Errors.sol'; * @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 { + function validateIsFollowing( + address hub, + uint256 followerProfileId, + uint256 followedProfileId + ) internal view { if (!ILensHub(hub).isFollowing(followerProfileId, followedProfileId)) { revert Errors.NotFollowing(); } diff --git a/contracts/modules/reference/DegreesOfSeparationReferenceModule.sol b/contracts/modules/reference/DegreesOfSeparationReferenceModule.sol index 42d40b4..1451627 100644 --- a/contracts/modules/reference/DegreesOfSeparationReferenceModule.sol +++ b/contracts/modules/reference/DegreesOfSeparationReferenceModule.sol @@ -3,11 +3,7 @@ pragma solidity ^0.8.19; import {Types} from 'contracts/libraries/constants/Types.sol'; -import {EIP712} from '@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol'; import {Errors} from 'contracts/libraries/constants/Errors.sol'; -import {Events} from 'contracts/libraries/constants/Events.sol'; -import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; -import {IFollowModule} from 'contracts/interfaces/IFollowModule.sol'; import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {IERC721Timestamped} from 'contracts/interfaces/IERC721Timestamped.sol'; import {IReferenceModule} from 'contracts/interfaces/IReferenceModule.sol'; diff --git a/contracts/modules/reference/FollowerOnlyReferenceModule.sol b/contracts/modules/reference/FollowerOnlyReferenceModule.sol index 9f67d23..f6966ba 100644 --- a/contracts/modules/reference/FollowerOnlyReferenceModule.sol +++ b/contracts/modules/reference/FollowerOnlyReferenceModule.sol @@ -5,7 +5,6 @@ pragma solidity ^0.8.10; import {IReferenceModule} from 'contracts/interfaces/IReferenceModule.sol'; import {HubRestricted} from 'contracts/base/HubRestricted.sol'; import {Types} from 'contracts/libraries/constants/Types.sol'; -import {ILensHub} from 'contracts/interfaces/ILensHub.sol'; import {FollowValidationLib} from 'contracts/modules/libraries/FollowValidationLib.sol'; /** @@ -24,9 +23,9 @@ contract FollowerOnlyReferenceModule is HubRestricted, IReferenceModule { * @dev There is nothing needed at initialization. */ function initializeReferenceModule( - uint256 /* profileId */, - uint256 /* pubId */, - address /* transactionExecutor */, + uint256, /* profileId */ + uint256, /* pubId */ + address, /* transactionExecutor */ bytes calldata /* data */ ) external pure returns (bytes memory) { return ''; @@ -37,9 +36,12 @@ contract FollowerOnlyReferenceModule is HubRestricted, IReferenceModule { * * @dev Validates that the commenting profile's owner is a follower. */ - function processComment( - Types.ProcessCommentParams calldata processCommentParams - ) external view override returns (bytes memory) { + function processComment(Types.ProcessCommentParams calldata processCommentParams) + external + view + override + returns (bytes memory) + { FollowValidationLib.validateIsFollowing({ hub: HUB, followerProfileId: processCommentParams.profileId, @@ -53,9 +55,12 @@ contract FollowerOnlyReferenceModule is HubRestricted, IReferenceModule { * * @dev Validates that the quoting profile's owner is a follower. */ - function processQuote( - Types.ProcessQuoteParams calldata processQuoteParams - ) external view override returns (bytes memory) { + function processQuote(Types.ProcessQuoteParams calldata processQuoteParams) + external + view + override + returns (bytes memory) + { FollowValidationLib.validateIsFollowing({ hub: HUB, followerProfileId: processQuoteParams.profileId, @@ -69,9 +74,12 @@ contract FollowerOnlyReferenceModule is HubRestricted, IReferenceModule { * * @dev Validates that the mirroring profile's owner is a follower. */ - function processMirror( - Types.ProcessMirrorParams calldata processMirrorParams - ) external view override returns (bytes memory) { + function processMirror(Types.ProcessMirrorParams calldata processMirrorParams) + external + view + override + returns (bytes memory) + { FollowValidationLib.validateIsFollowing({ hub: HUB, followerProfileId: processMirrorParams.profileId,