misc: Lens V1 collect operation renamed to Legacy Collect everywhere

Co-authored-by: Victor Naumik <vicnaum@gmail.com>
This commit is contained in:
donosonaumczuk
2023-09-07 19:20:22 +01:00
parent c06a2d2f95
commit f5dc0cda07
16 changed files with 102 additions and 142 deletions

View File

@@ -66,13 +66,13 @@ contract LensHub is
constructor(
address moduleGlobals,
address followNFTImpl,
address collectNFTImpl, // We still pass the deprecated CollectNFTImpl for legacy Collects to work
address legacyCollectNFTImpl, // We still pass the deprecated CollectNFTImpl for legacy Collects to work
uint256 tokenGuardianCooldown,
Types.MigrationParams memory migrationParams
)
LensV2Migration(migrationParams)
LensProfiles(moduleGlobals, tokenGuardianCooldown)
LensImplGetters(followNFTImpl, collectNFTImpl)
LensImplGetters(followNFTImpl, legacyCollectNFTImpl)
{}
/// @inheritdoc ILensProtocol
@@ -397,8 +397,8 @@ contract LensHub is
}
/// @inheritdoc ILensProtocol
function collect(
Types.CollectParams calldata collectParams
function collectLegacy(
Types.LegacyCollectParams calldata collectParams
)
external
override
@@ -411,13 +411,13 @@ contract LensHub is
collectParams: collectParams,
transactionExecutor: msg.sender,
collectorProfileOwner: ownerOf(collectParams.collectorProfileId),
collectNFTImpl: this.getCollectNFTImpl()
collectNFTImpl: this.getLegacyCollectNFTImpl()
});
}
/// @inheritdoc ILensProtocol
function collectWithSig(
Types.CollectParams calldata collectParams,
function collectLegacyWithSig(
Types.LegacyCollectParams calldata collectParams,
Types.EIP712Signature calldata signature
)
external
@@ -432,7 +432,7 @@ contract LensHub is
collectParams: collectParams,
transactionExecutor: signature.signer,
collectorProfileOwner: ownerOf(collectParams.collectorProfileId),
collectNFTImpl: this.getCollectNFTImpl()
collectNFTImpl: this.getLegacyCollectNFTImpl()
});
}

View File

@@ -19,7 +19,7 @@ contract LensImplGetters is ILensImplGetters {
}
/// @inheritdoc ILensImplGetters
function getCollectNFTImpl() external view override returns (address) {
function getLegacyCollectNFTImpl() external view override returns (address) {
return __LEGACY__COLLECT_NFT_IMPL; // LEGACY support: Used only for compatibility with V1 collectible posts.
}
}

View File

@@ -23,5 +23,5 @@ interface ILensImplGetters {
*
* @return address The Collect NFT implementation address.
*/
function getCollectNFTImpl() external view returns (address);
function getLegacyCollectNFTImpl() external view returns (address);
}

View File

@@ -46,11 +46,7 @@ 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.
@@ -125,9 +121,10 @@ 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.
@@ -147,9 +144,10 @@ 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.
@@ -168,9 +166,10 @@ 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.
@@ -191,9 +190,10 @@ 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).
@@ -285,15 +285,16 @@ interface ILensProtocol {
*
* @return uint256 An integer representing the minted token ID.
*/
function collect(Types.CollectParams calldata collectParams) external returns (uint256);
function collectLegacy(Types.LegacyCollectParams calldata collectParams) external returns (uint256);
/**
* @custom:meta-tx collect.
* @custom:pending-deprecation
*/
function collectWithSig(Types.CollectParams calldata collectParams, Types.EIP712Signature calldata signature)
external
returns (uint256);
function collectLegacyWithSig(
Types.LegacyCollectParams calldata collectParams,
Types.EIP712Signature calldata signature
) external returns (uint256);
/**
* @notice Acts on a given publication with the specified parameters.
@@ -356,10 +357,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.

View File

@@ -43,7 +43,7 @@ library LegacyCollectLib {
);
function collect(
Types.CollectParams calldata collectParams,
Types.LegacyCollectParams calldata collectParams,
address transactionExecutor,
address collectorProfileOwner,
address collectNFTImpl
@@ -139,7 +139,7 @@ library LegacyCollectLib {
address collectNFT = Clones.clone(collectNFTImpl);
ICollectNFT(collectNFT).initialize(profileId, pubId);
emit Events.CollectNFTDeployed(profileId, pubId, collectNFT, block.timestamp);
emit Events.LegacyCollectNFTDeployed(profileId, pubId, collectNFT, block.timestamp);
return collectNFT;
}

View File

@@ -281,13 +281,13 @@ library MetaTxLib {
function validateLegacyCollectSignature(
Types.EIP712Signature calldata signature,
Types.CollectParams calldata collectParams
Types.LegacyCollectParams calldata collectParams
) external {
_validateRecoveredAddress(
_calculateDigest(
keccak256(
abi.encode(
Typehash.LEGACY_COLLECT,
Typehash.COLLECT_LEGACY,
collectParams.publicationCollectedProfileId,
collectParams.publicationCollectedId,
collectParams.collectorProfileId,

View File

@@ -256,7 +256,6 @@ library Events {
* @param timestamp The current block timestamp.
*/
event FollowNFTDeployed(uint256 indexed profileId, address indexed followNFT, uint256 timestamp);
/**
* @dev Emitted when a collectNFT clone is deployed using a lazy deployment pattern.
*
@@ -265,41 +264,12 @@ library Events {
* @param collectNFT The address of the newly deployed collectNFT clone.
* @param timestamp The current block timestamp.
*/
event CollectNFTDeployed(
event LegacyCollectNFTDeployed(
uint256 indexed profileId,
uint256 indexed pubId,
address indexed collectNFT,
uint256 timestamp
);
/**
* @dev Emitted upon a successful collect action.
*
* @param collectedProfileId The token ID of the profile that published the collected publication.
* @param collectedPubId The ID of the collected publication.
* @param collectorProfileId The token ID of the profile that collected the publication.
* @param nftRecipient The address that received the collect NFT.
* @param collectActionData The custom data passed to the collect module, if any.
* @param collectActionResult The data returned from the collect module's collect action. This is ABI-encoded
* and depends on the collect module chosen.
* @param collectNFT The address of the NFT collection where the minted collect NFT belongs to.
* @param tokenId The token ID of the collect NFT that was minted as a collect of the publication.
* @param transactionExecutor The address of the account that executed this operation.
* @param timestamp The current block timestamp.
*/
event Collected(
uint256 indexed collectedProfileId,
uint256 indexed collectedPubId,
uint256 indexed collectorProfileId,
address nftRecipient,
bytes collectActionData,
bytes collectActionResult,
address collectNFT,
uint256 tokenId,
address transactionExecutor,
uint256 timestamp
);
/**
* @dev Emitted upon a successful action.
*

View File

@@ -8,7 +8,7 @@ library Typehash {
bytes32 constant CHANGE_DELEGATED_EXECUTORS_CONFIG = keccak256('ChangeDelegatedExecutorsConfig(uint256 delegatorProfileId,address[] delegatedExecutors,bool[] approvals,uint64 configNumber,bool switchToGivenConfig,uint256 nonce,uint256 deadline)');
bytes32 constant LEGACY_COLLECT = keccak256('Collect(uint256 publicationCollectedProfileId,uint256 publicationCollectedId,uint256 collectorProfileId,uint256 referrerProfileId,uint256 referrerPubId,bytes collectModuleData,uint256 nonce,uint256 deadline)');
bytes32 constant COLLECT_LEGACY = keccak256('CollectLegacy(uint256 publicationCollectedProfileId,uint256 publicationCollectedId,uint256 collectorProfileId,uint256 referrerProfileId,uint256 referrerPubId,bytes collectModuleData,uint256 nonce,uint256 deadline)');
bytes32 constant COMMENT = keccak256('Comment(uint256 profileId,string contentURI,uint256 pointedProfileId,uint256 pointedPubId,uint256[] referrerProfileIds,uint256[] referrerPubIds,bytes referenceModuleData,address[] actionModules,bytes[] actionModulesInitDatas,address referenceModule,bytes referenceModuleInitData,uint256 nonce,uint256 deadline)');

View File

@@ -298,7 +298,7 @@ library Types {
* @param referrerPubId The ID of the mirror that helped discovering the collected pub.
* @param collectModuleData The arbitrary data to pass to the collectModule if needed.
*/
struct CollectParams {
struct LegacyCollectParams {
uint256 publicationCollectedProfileId;
uint256 publicationCollectedId;
uint256 collectorProfileId;