mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-10 22:58:08 -05:00
misc: Remove unused imports and some formating
Co-authored-by: Victor Naumik <vicnaum@gmail.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user