From f5dc0cda078e98d5eff4f0b64813e2e0962fcf09 Mon Sep 17 00:00:00 2001 From: donosonaumczuk Date: Thu, 7 Sep 2023 19:20:22 +0100 Subject: [PATCH] misc: Lens V1 collect operation renamed to Legacy Collect everywhere Co-authored-by: Victor Naumik --- contracts/LensHub.sol | 16 +++--- contracts/base/LensImplGetters.sol | 2 +- contracts/interfaces/ILensImplGetters.sol | 2 +- contracts/interfaces/ILensProtocol.sol | 51 ++++++++++--------- contracts/libraries/LegacyCollectLib.sol | 4 +- contracts/libraries/MetaTxLib.sol | 4 +- contracts/libraries/constants/Events.sol | 32 +----------- contracts/libraries/constants/Typehash.sol | 2 +- contracts/libraries/constants/Types.sol | 2 +- foundry-scripts/DeployUpgrade.s.sol | 2 +- test/LegacyCollectNFTTest.t.sol | 8 +-- test/LegacyCollectTest.t.sol | 50 +++++++----------- test/LensHubEventHooksTest.t.sol | 10 ++-- test/base/TestSetup.t.sol | 16 +++--- test/fork/UpgradeForkTest.t.sol | 13 +++-- .../act/CollectPublicationAction.t.sol | 30 ++++++++--- 16 files changed, 102 insertions(+), 142 deletions(-) diff --git a/contracts/LensHub.sol b/contracts/LensHub.sol index d1e9c68..d22e365 100644 --- a/contracts/LensHub.sol +++ b/contracts/LensHub.sol @@ -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() }); } diff --git a/contracts/base/LensImplGetters.sol b/contracts/base/LensImplGetters.sol index fbf5f31..9c3922f 100644 --- a/contracts/base/LensImplGetters.sol +++ b/contracts/base/LensImplGetters.sol @@ -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. } } diff --git a/contracts/interfaces/ILensImplGetters.sol b/contracts/interfaces/ILensImplGetters.sol index cde9d66..346ac31 100644 --- a/contracts/interfaces/ILensImplGetters.sol +++ b/contracts/interfaces/ILensImplGetters.sol @@ -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); } diff --git a/contracts/interfaces/ILensProtocol.sol b/contracts/interfaces/ILensProtocol.sol index 38b98a1..151ad26 100644 --- a/contracts/interfaces/ILensProtocol.sol +++ b/contracts/interfaces/ILensProtocol.sol @@ -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. diff --git a/contracts/libraries/LegacyCollectLib.sol b/contracts/libraries/LegacyCollectLib.sol index d67b09d..25ac493 100644 --- a/contracts/libraries/LegacyCollectLib.sol +++ b/contracts/libraries/LegacyCollectLib.sol @@ -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; } diff --git a/contracts/libraries/MetaTxLib.sol b/contracts/libraries/MetaTxLib.sol index 122f9e0..7b38c4e 100644 --- a/contracts/libraries/MetaTxLib.sol +++ b/contracts/libraries/MetaTxLib.sol @@ -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, diff --git a/contracts/libraries/constants/Events.sol b/contracts/libraries/constants/Events.sol index e696037..2587d28 100644 --- a/contracts/libraries/constants/Events.sol +++ b/contracts/libraries/constants/Events.sol @@ -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. * diff --git a/contracts/libraries/constants/Typehash.sol b/contracts/libraries/constants/Typehash.sol index dee3e99..62f2f3d 100644 --- a/contracts/libraries/constants/Typehash.sol +++ b/contracts/libraries/constants/Typehash.sol @@ -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)'); diff --git a/contracts/libraries/constants/Types.sol b/contracts/libraries/constants/Types.sol index 8805be8..bc99888 100644 --- a/contracts/libraries/constants/Types.sol +++ b/contracts/libraries/constants/Types.sol @@ -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; diff --git a/foundry-scripts/DeployUpgrade.s.sol b/foundry-scripts/DeployUpgrade.s.sol index 6ae220c..40b56f6 100644 --- a/foundry-scripts/DeployUpgrade.s.sol +++ b/foundry-scripts/DeployUpgrade.s.sol @@ -26,7 +26,7 @@ contract DeployUpgradeScript is Script { LensHub hub = LensHub(hubProxyAddr); address followNFTAddress = hub.getFollowNFTImpl(); - address collectNFTAddress = hub.getCollectNFTImpl(); + address collectNFTAddress = hub.getLegacyCollectNFTImpl(); uint256 deployerNonce = vm.getNonce(deployer); diff --git a/test/LegacyCollectNFTTest.t.sol b/test/LegacyCollectNFTTest.t.sol index 5a64ec6..11f30c7 100644 --- a/test/LegacyCollectNFTTest.t.sol +++ b/test/LegacyCollectNFTTest.t.sol @@ -14,7 +14,7 @@ contract LegacyCollectNFTTest is BaseTest, LensBaseERC721Test { // Prevents being counted in Foundry Coverage } - Types.CollectParams defaultCollectParams; + Types.LegacyCollectParams defaultCollectParams; address mockDeprecatedCollectModule; LegacyCollectNFT collectNFT; address collectNFTImpl; @@ -32,7 +32,7 @@ contract LegacyCollectNFTTest is BaseTest, LensBaseERC721Test { _toLegacyV1Pub(defaultAccount.profileId, defaultPubId, address(0), mockDeprecatedCollectModule); - defaultCollectParams = Types.CollectParams({ + defaultCollectParams = Types.LegacyCollectParams({ publicationCollectedProfileId: defaultAccount.profileId, publicationCollectedId: defaultPubId, collectorProfileId: defaultAccount.profileId, @@ -42,7 +42,7 @@ contract LegacyCollectNFTTest is BaseTest, LensBaseERC721Test { }); vm.prank(defaultAccount.owner); - firstCollectTokenId = hub.collect(defaultCollectParams); + firstCollectTokenId = hub.collectLegacy(defaultCollectParams); collectNFT = LegacyCollectNFT( hub.getPublication(defaultAccount.profileId, defaultPubId).__DEPRECATED__collectNFT @@ -53,7 +53,7 @@ contract LegacyCollectNFTTest is BaseTest, LensBaseERC721Test { vm.assume(!_isLensHubProxyAdmin(to)); defaultCollectParams.collectorProfileId = _createProfile(to); vm.prank(to); - uint256 tokenId = hub.collect(defaultCollectParams); + uint256 tokenId = hub.collectLegacy(defaultCollectParams); return tokenId; } diff --git a/test/LegacyCollectTest.t.sol b/test/LegacyCollectTest.t.sol index 4fbb7bb..105668f 100644 --- a/test/LegacyCollectTest.t.sol +++ b/test/LegacyCollectTest.t.sol @@ -12,23 +12,13 @@ import {ReferralSystemTest} from 'test/ReferralSystem.t.sol'; contract LegacyCollectTest is BaseTest, ReferralSystemTest { using Strings for uint256; uint256 pubId; - Types.CollectParams defaultCollectParams; + Types.LegacyCollectParams defaultCollectParams; TestAccount blockedProfile; bool skipTest; event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); - event CollectedLegacy( - uint256 indexed publicationCollectedProfileId, - uint256 indexed publicationCollectedId, - address transactionExecutor, - uint256 referrerProfileId, - uint256 referrerPubId, - bytes collectModuleData, - uint256 timestamp - ); - function setUp() public virtual override(BaseTest, ReferralSystemTest) { ReferralSystemTest.setUp(); @@ -40,7 +30,7 @@ contract LegacyCollectTest is BaseTest, ReferralSystemTest { _toLegacyV1Pub(defaultAccount.profileId, pubId, address(0), address(mockDeprecatedCollectModule)); - defaultCollectParams = Types.CollectParams({ + defaultCollectParams = Types.LegacyCollectParams({ publicationCollectedProfileId: defaultAccount.profileId, publicationCollectedId: pubId, collectorProfileId: defaultAccount.profileId, @@ -226,7 +216,7 @@ contract LegacyCollectTest is BaseTest, ReferralSystemTest { address predictedCollectNFT = computeCreateAddress(address(hub), vm.getNonce(address(hub))); vm.expectEmit(true, true, true, true, address(hub)); - emit Events.CollectNFTDeployed(defaultAccount.profileId, pubId, predictedCollectNFT, block.timestamp); + emit Events.LegacyCollectNFTDeployed(defaultAccount.profileId, pubId, predictedCollectNFT, block.timestamp); vm.expectCall( predictedCollectNFT, @@ -262,7 +252,7 @@ contract LegacyCollectTest is BaseTest, ReferralSystemTest { emit Transfer(address(0), hub.ownerOf(defaultCollectParams.collectorProfileId), 1); vm.expectEmit(true, true, true, true, address(hub)); - emit CollectedLegacy({ + emit LegacyCollectLib.CollectedLegacy({ publicationCollectedProfileId: defaultCollectParams.publicationCollectedProfileId, publicationCollectedId: defaultCollectParams.publicationCollectedId, transactionExecutor: defaultAccount.owner, @@ -300,7 +290,7 @@ contract LegacyCollectTest is BaseTest, ReferralSystemTest { emit Transfer(address(0), hub.ownerOf(defaultCollectParams.collectorProfileId), collectTokenId + 1); vm.expectEmit(true, true, true, true, address(hub)); - emit CollectedLegacy({ + emit LegacyCollectLib.CollectedLegacy({ publicationCollectedProfileId: defaultCollectParams.publicationCollectedProfileId, publicationCollectedId: defaultCollectParams.publicationCollectedId, transactionExecutor: defaultAccount.owner, @@ -314,9 +304,9 @@ contract LegacyCollectTest is BaseTest, ReferralSystemTest { assertEq(secondCollectTokenId, collectTokenId + 1); } - function _collect(uint256 pk, Types.CollectParams memory collectParams) internal virtual returns (uint256) { + function _collect(uint256 pk, Types.LegacyCollectParams memory collectParams) internal virtual returns (uint256) { vm.prank(vm.addr(pk)); - return hub.collect(collectParams); + return hub.collectLegacy(collectParams); } function _referralSystem_PrepareOperation( @@ -340,7 +330,7 @@ contract LegacyCollectTest is BaseTest, ReferralSystemTest { function _referralSystem_ExpectRevertsIfNeeded( TestPublication memory target, - uint256[] memory, /* referrerProfileIds */ + uint256[] memory /* referrerProfileIds */, uint256[] memory /* referrerPubIds */ ) internal virtual override returns (bool) { if (skipTest) { @@ -425,16 +415,14 @@ contract LegacyCollectMetaTxTest is LegacyCollectTest, MetaTxNegatives { _refreshCachedNonces(); } - function _collect(uint256 pk, Types.CollectParams memory collectParams) - internal - virtual - override - returns (uint256) - { + function _collect( + uint256 pk, + Types.LegacyCollectParams memory collectParams + ) internal virtual override returns (uint256) { address signer = vm.addr(pk); return - hub.collectWithSig( + hub.collectLegacyWithSig( collectParams, _getSigStruct({ pKey: pk, @@ -448,12 +436,8 @@ contract LegacyCollectMetaTxTest is LegacyCollectTest, MetaTxNegatives { ); } - function _executeMetaTx( - uint256 signerPk, - uint256 nonce, - uint256 deadline - ) internal virtual override { - hub.collectWithSig( + function _executeMetaTx(uint256 signerPk, uint256 nonce, uint256 deadline) internal virtual override { + hub.collectLegacyWithSig( defaultCollectParams, _getSigStruct({ signer: vm.addr(_getDefaultMetaTxSignerPk()), @@ -473,7 +457,7 @@ contract LegacyCollectMetaTxTest is LegacyCollectTest, MetaTxNegatives { } function _calculateCollectWithSigDigest( - Types.CollectParams memory collectParams, + Types.LegacyCollectParams memory collectParams, uint256 nonce, uint256 deadline ) internal view returns (bytes32) { @@ -481,7 +465,7 @@ contract LegacyCollectMetaTxTest is LegacyCollectTest, MetaTxNegatives { _calculateDigest( keccak256( abi.encode( - Typehash.LEGACY_COLLECT, + Typehash.COLLECT_LEGACY, collectParams.publicationCollectedProfileId, collectParams.publicationCollectedId, collectParams.collectorProfileId, diff --git a/test/LensHubEventHooksTest.t.sol b/test/LensHubEventHooksTest.t.sol index c62e87c..483c403 100644 --- a/test/LensHubEventHooksTest.t.sol +++ b/test/LensHubEventHooksTest.t.sol @@ -34,7 +34,7 @@ contract LensHubEventHooksTest is BaseTest { _toLegacyV1Pub(defaultAccount.profileId, defaultPubId, address(0), address(mockDeprecatedCollectModule)); - Types.CollectParams memory defaultCollectParams = Types.CollectParams({ + Types.LegacyCollectParams memory defaultCollectParams = Types.LegacyCollectParams({ publicationCollectedProfileId: defaultAccount.profileId, publicationCollectedId: defaultPubId, collectorProfileId: defaultAccount.profileId, @@ -44,7 +44,7 @@ contract LensHubEventHooksTest is BaseTest { }); vm.prank(defaultAccount.owner); - hub.collect(defaultCollectParams); + hub.collectLegacy(defaultCollectParams); } function testCannot_EmitUnfollowedEvent_ifNotFollowNFTOfFollowedProfile( @@ -73,11 +73,7 @@ contract LensHubEventHooksTest is BaseTest { hub.emitUnfollowedEvent(follower.profileId, defaultAccount.profileId, transactionExecutor); } - function testEmitCollectNFTTransferEvent_ForRealThisTime( - uint256 collectNFTId, - address from, - address to - ) public { + function testEmitCollectNFTTransferEvent_ForRealThisTime(uint256 collectNFTId, address from, address to) public { address collectNFT = hub.getPublication(defaultAccount.profileId, defaultPubId).__DEPRECATED__collectNFT; vm.expectEmit(true, true, true, true, address(hub)); diff --git a/test/base/TestSetup.t.sol b/test/base/TestSetup.t.sol index ae81403..156c9a7 100644 --- a/test/base/TestSetup.t.sol +++ b/test/base/TestSetup.t.sol @@ -80,11 +80,7 @@ interface IOldHub { function follow(uint256[] calldata profileIds, bytes[] calldata datas) external returns (uint256[] memory); - function collect( - uint256 profileId, - uint256 pubId, - bytes calldata data - ) external returns (uint256); + function collect(uint256 profileId, uint256 pubId, bytes calldata data) external returns (uint256); function post(OldPostData calldata vars) external returns (uint256); @@ -114,7 +110,7 @@ contract TestSetup is Test, ContractAddressesLoaderDeployer, ArrayHelpers { console.log('Hub:', address(hub)); address followNFTAddr = hub.getFollowNFTImpl(); - address legacyCollectNFTAddr = hub.getCollectNFTImpl(); + address legacyCollectNFTAddr = hub.getLegacyCollectNFTImpl(); address hubImplAddr = address(uint160(uint256(vm.load(hubProxyAddr, PROXY_IMPLEMENTATION_STORAGE_SLOT)))); console.log('Found hubImplAddr:', hubImplAddr); @@ -452,10 +448,10 @@ contract TestSetup is Test, ContractAddressesLoaderDeployer, ArrayHelpers { return _loadAccountAs({accountLabel: accountLabel, requireCustomProfileOnFork: false}); } - function _loadAccountAs(string memory accountLabel, bool requireCustomProfileOnFork) - internal - returns (TestAccount memory) - { + function _loadAccountAs( + string memory accountLabel, + bool requireCustomProfileOnFork + ) internal returns (TestAccount memory) { // We derive a new account from the given label. (address accountOwner, uint256 accountOwnerPk) = makeAddrAndKey(accountLabel); uint256 accountProfileId; diff --git a/test/fork/UpgradeForkTest.t.sol b/test/fork/UpgradeForkTest.t.sol index 25c5483..b076a14 100644 --- a/test/fork/UpgradeForkTest.t.sol +++ b/test/fork/UpgradeForkTest.t.sol @@ -85,11 +85,10 @@ contract UpgradeForkTest is BaseTest { freeCollectModule = findModuleHelper(collectModules, 'FreeCollectModule').addy; } - function findModuleHelper(Module[] memory modules, string memory moduleNameToFind) - internal - pure - returns (Module memory) - { + function findModuleHelper( + Module[] memory modules, + string memory moduleNameToFind + ) internal pure returns (Module memory) { for (uint256 i = 0; i < modules.length; i++) { if (LibString.eq(modules[i].name, moduleNameToFind)) { return modules[i]; @@ -763,8 +762,8 @@ contract UpgradeForkTest is BaseTest { // V2 profile collects from V1 profile // Profile3: Collect#2 on Profile2.Post#2 vm.prank(profileThree.owner); - collect2 = hub.collect( - Types.CollectParams({ + collect2 = hub.collectLegacy( + Types.LegacyCollectParams({ publicationCollectedProfileId: profileTwo.profileId, publicationCollectedId: post2, collectorProfileId: profileThree.profileId, diff --git a/test/modules/act/CollectPublicationAction.t.sol b/test/modules/act/CollectPublicationAction.t.sol index 05c845d..c9db073 100644 --- a/test/modules/act/CollectPublicationAction.t.sol +++ b/test/modules/act/CollectPublicationAction.t.sol @@ -19,6 +19,24 @@ contract CollectPublicationActionTest is BaseTest { event CollectModuleWhitelisted(address collectModule, bool whitelist, uint256 timestamp); event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); + event CollectNFTDeployed( + uint256 indexed profileId, + uint256 indexed pubId, + address indexed collectNFT, + uint256 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 + ); function setUp() public override { super.setUp(); @@ -178,11 +196,7 @@ contract CollectPublicationActionTest is BaseTest { ); } - function testInitializePublicationAction( - uint256 profileId, - uint256 pubId, - address transactionExecutor - ) public { + function testInitializePublicationAction(uint256 profileId, uint256 pubId, address transactionExecutor) public { vm.assume(profileId != 0); vm.assume(pubId != 0); vm.assume(transactionExecutor != address(0)); @@ -247,13 +261,13 @@ contract CollectPublicationActionTest is BaseTest { address collectNFT = computeCreateAddress(address(collectPublicationAction), contractNonce); vm.expectEmit(true, true, true, true, address(collectPublicationAction)); - emit Events.CollectNFTDeployed(profileId, pubId, collectNFT, block.timestamp); + emit CollectNFTDeployed(profileId, pubId, collectNFT, block.timestamp); vm.expectEmit(true, true, true, true, address(collectNFT)); emit Transfer({from: address(0), to: collectNftRecipient, tokenId: 1}); vm.expectEmit(true, true, true, true, address(collectPublicationAction)); - emit Events.Collected({ + emit Collected({ collectedProfileId: processActionParams.publicationActedProfileId, collectedPubId: processActionParams.publicationActedId, collectorProfileId: processActionParams.actorProfileId, @@ -334,7 +348,7 @@ contract CollectPublicationActionTest is BaseTest { emit Transfer({from: address(0), to: collectNftRecipient, tokenId: 2}); vm.expectEmit(true, true, true, true, address(collectPublicationAction)); - emit Events.Collected({ + emit Collected({ collectedProfileId: processActionParams.publicationActedProfileId, collectedPubId: processActionParams.publicationActedId, collectorProfileId: processActionParams.actorProfileId,