mirror of
https://github.com/lens-protocol/core.git
synced 2026-04-22 03:02:03 -04:00
fix: Removed two last warnings
This commit is contained in:
@@ -19,9 +19,9 @@ contract FollowTest is BaseTest {
|
||||
address targetProfileOwner;
|
||||
uint256 targetProfileId;
|
||||
|
||||
uint256 constant followerProfileOwnerPk = 0x7357;
|
||||
address followerProfileOwner;
|
||||
uint256 followerProfileId;
|
||||
uint256 constant testFollowerProfileOwnerPk = 0x7357;
|
||||
address testFollowerProfileOwner;
|
||||
uint256 testFollowerProfileId;
|
||||
|
||||
uint256 constant alreadyFollowingProfileOwnerPk = 0xF01108;
|
||||
address alreadyFollowingProfileOwner;
|
||||
@@ -39,8 +39,8 @@ contract FollowTest is BaseTest {
|
||||
targetProfileOwner = vm.addr(targetProfileOwnerPk);
|
||||
targetProfileId = _createProfile(targetProfileOwner);
|
||||
|
||||
followerProfileOwner = vm.addr(followerProfileOwnerPk);
|
||||
followerProfileId = _createProfile(followerProfileOwner);
|
||||
testFollowerProfileOwner = vm.addr(testFollowerProfileOwnerPk);
|
||||
testFollowerProfileId = _createProfile(testFollowerProfileOwner);
|
||||
|
||||
alreadyFollowingProfileOwner = vm.addr(alreadyFollowingProfileOwnerPk);
|
||||
alreadyFollowingProfileId = _createProfile(alreadyFollowingProfileOwner);
|
||||
@@ -70,9 +70,9 @@ contract FollowTest is BaseTest {
|
||||
vm.expectRevert(Errors.Paused.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('')
|
||||
@@ -81,14 +81,18 @@ contract FollowTest is BaseTest {
|
||||
|
||||
function testCannotFollowIfBlocked() public {
|
||||
vm.prank(targetProfileOwner);
|
||||
hub.setBlockStatus(targetProfileId, _toUint256Array(followerProfileId), _toBoolArray(true));
|
||||
hub.setBlockStatus(
|
||||
targetProfileId,
|
||||
_toUint256Array(testFollowerProfileId),
|
||||
_toBoolArray(true)
|
||||
);
|
||||
|
||||
vm.expectRevert(Errors.Blocked.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('')
|
||||
@@ -101,15 +105,15 @@ contract FollowTest is BaseTest {
|
||||
executorPk = bound(executorPk, 1, ISSECP256K1_CURVE_ORDER - 1);
|
||||
address executor = vm.addr(executorPk);
|
||||
vm.assume(executor != address(0));
|
||||
vm.assume(executor != followerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
|
||||
vm.assume(executor != testFollowerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(testFollowerProfileOwner, executor));
|
||||
|
||||
vm.expectRevert(Errors.ExecutorInvalid.selector);
|
||||
|
||||
_follow({
|
||||
pk: executorPk,
|
||||
isFollowerProfileOwner: false,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('', '')
|
||||
@@ -122,8 +126,8 @@ contract FollowTest is BaseTest {
|
||||
executorPk = bound(executorPk, 1, ISSECP256K1_CURVE_ORDER - 1);
|
||||
address executor = vm.addr(executorPk);
|
||||
vm.assume(executor != address(0));
|
||||
vm.assume(executor != followerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
|
||||
vm.assume(executor != testFollowerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(testFollowerProfileOwner, executor));
|
||||
|
||||
followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
assertFalse(followNFT.exists(followTokenId));
|
||||
@@ -133,7 +137,7 @@ contract FollowTest is BaseTest {
|
||||
_follow({
|
||||
pk: executorPk,
|
||||
isFollowerProfileOwner: false,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(followTokenId),
|
||||
datas: _toBytesArray('', '')
|
||||
@@ -146,8 +150,8 @@ contract FollowTest is BaseTest {
|
||||
executorPk = bound(executorPk, 1, ISSECP256K1_CURVE_ORDER - 1);
|
||||
address executor = vm.addr(executorPk);
|
||||
vm.assume(executor != address(0));
|
||||
vm.assume(executor != followerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
|
||||
vm.assume(executor != testFollowerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(testFollowerProfileOwner, executor));
|
||||
|
||||
followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
vm.prank(alreadyFollowingProfileOwner);
|
||||
@@ -158,7 +162,7 @@ contract FollowTest is BaseTest {
|
||||
_follow({
|
||||
pk: executorPk,
|
||||
isFollowerProfileOwner: false,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(followTokenId),
|
||||
datas: _toBytesArray('', '')
|
||||
@@ -169,9 +173,9 @@ contract FollowTest is BaseTest {
|
||||
vm.expectRevert(Errors.ArrayMismatch.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId, alreadyFollowingProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('', '')
|
||||
@@ -184,9 +188,9 @@ contract FollowTest is BaseTest {
|
||||
vm.expectRevert(Errors.ArrayMismatch.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('', '')
|
||||
@@ -194,15 +198,15 @@ contract FollowTest is BaseTest {
|
||||
}
|
||||
|
||||
function testCannotFollowIfFollowerProfileDoesNotExist() public {
|
||||
vm.prank(followerProfileOwner);
|
||||
hub.burn(followerProfileId);
|
||||
vm.prank(testFollowerProfileOwner);
|
||||
hub.burn(testFollowerProfileId);
|
||||
|
||||
vm.expectRevert(Errors.TokenDoesNotExist.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('')
|
||||
@@ -213,9 +217,9 @@ contract FollowTest is BaseTest {
|
||||
vm.expectRevert(Errors.TokenDoesNotExist.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(0),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('')
|
||||
@@ -229,9 +233,9 @@ contract FollowTest is BaseTest {
|
||||
vm.expectRevert(Errors.TokenDoesNotExist.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray('')
|
||||
@@ -260,9 +264,9 @@ contract FollowTest is BaseTest {
|
||||
vm.expectRevert(MockFollowModuleWithRevertFlag.MockFollowModuleReverted.selector);
|
||||
|
||||
_follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray(abi.encode(revertWhileProcessingFollow))
|
||||
@@ -294,7 +298,7 @@ contract FollowTest is BaseTest {
|
||||
|
||||
vm.expectEmit(true, false, false, true, address(hub));
|
||||
emit Events.Followed(
|
||||
followerProfileId,
|
||||
testFollowerProfileId,
|
||||
targetProfileId,
|
||||
expectedFollowTokenIdAssigned,
|
||||
followModuleData,
|
||||
@@ -305,7 +309,7 @@ contract FollowTest is BaseTest {
|
||||
targetFollowNFTAddress,
|
||||
abi.encodeCall(
|
||||
followNFT.follow,
|
||||
(followerProfileId, followerProfileOwner, MINT_NEW_TOKEN)
|
||||
(testFollowerProfileId, testFollowerProfileOwner, MINT_NEW_TOKEN)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -314,9 +318,9 @@ contract FollowTest is BaseTest {
|
||||
abi.encodeCall(
|
||||
IFollowModule.processFollow,
|
||||
(
|
||||
followerProfileId,
|
||||
testFollowerProfileId,
|
||||
MINT_NEW_TOKEN,
|
||||
followerProfileOwner,
|
||||
testFollowerProfileOwner,
|
||||
targetProfileId,
|
||||
followModuleData
|
||||
)
|
||||
@@ -324,9 +328,9 @@ contract FollowTest is BaseTest {
|
||||
);
|
||||
|
||||
uint256[] memory assignedFollowTokenIds = _follow({
|
||||
pk: followerProfileOwnerPk,
|
||||
pk: testFollowerProfileOwnerPk,
|
||||
isFollowerProfileOwner: true,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray(followModuleData)
|
||||
@@ -334,7 +338,7 @@ contract FollowTest is BaseTest {
|
||||
|
||||
assertEq(assignedFollowTokenIds.length, 1);
|
||||
assertEq(assignedFollowTokenIds[0], expectedFollowTokenIdAssigned);
|
||||
assertTrue(hub.isFollowing(followerProfileId, targetProfileId));
|
||||
assertTrue(hub.isFollowing(testFollowerProfileId, targetProfileId));
|
||||
}
|
||||
|
||||
function testFollowAsFollowerApprovedDelegatedExecutor(uint256 approvedDelegatedExecutorPk)
|
||||
@@ -347,9 +351,9 @@ contract FollowTest is BaseTest {
|
||||
);
|
||||
address approvedDelegatedExecutor = vm.addr(approvedDelegatedExecutorPk);
|
||||
vm.assume(approvedDelegatedExecutor != address(0));
|
||||
vm.assume(approvedDelegatedExecutor != followerProfileOwner);
|
||||
vm.assume(approvedDelegatedExecutor != testFollowerProfileOwner);
|
||||
|
||||
vm.prank(followerProfileOwner);
|
||||
vm.prank(testFollowerProfileOwner);
|
||||
hub.setDelegatedExecutorApproval(approvedDelegatedExecutor, true);
|
||||
|
||||
vm.prank(targetProfileOwner);
|
||||
@@ -361,7 +365,7 @@ contract FollowTest is BaseTest {
|
||||
|
||||
vm.expectEmit(true, false, false, true, address(hub));
|
||||
emit Events.Followed(
|
||||
followerProfileId,
|
||||
testFollowerProfileId,
|
||||
targetProfileId,
|
||||
expectedFollowTokenIdAssigned,
|
||||
followModuleData,
|
||||
@@ -372,7 +376,7 @@ contract FollowTest is BaseTest {
|
||||
targetFollowNFTAddress,
|
||||
abi.encodeCall(
|
||||
followNFT.follow,
|
||||
(followerProfileId, approvedDelegatedExecutor, MINT_NEW_TOKEN)
|
||||
(testFollowerProfileId, approvedDelegatedExecutor, MINT_NEW_TOKEN)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -381,7 +385,7 @@ contract FollowTest is BaseTest {
|
||||
abi.encodeCall(
|
||||
IFollowModule.processFollow,
|
||||
(
|
||||
followerProfileId,
|
||||
testFollowerProfileId,
|
||||
MINT_NEW_TOKEN,
|
||||
approvedDelegatedExecutor,
|
||||
targetProfileId,
|
||||
@@ -393,7 +397,7 @@ contract FollowTest is BaseTest {
|
||||
uint256[] memory assignedFollowTokenIds = _follow({
|
||||
pk: approvedDelegatedExecutorPk,
|
||||
isFollowerProfileOwner: false,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray(followModuleData)
|
||||
@@ -401,7 +405,7 @@ contract FollowTest is BaseTest {
|
||||
|
||||
assertEq(assignedFollowTokenIds.length, 1);
|
||||
assertEq(assignedFollowTokenIds[0], expectedFollowTokenIdAssigned);
|
||||
assertTrue(hub.isFollowing(followerProfileId, targetProfileId));
|
||||
assertTrue(hub.isFollowing(testFollowerProfileId, targetProfileId));
|
||||
}
|
||||
|
||||
function _follow(
|
||||
@@ -432,7 +436,7 @@ contract FollowMetaTxTest is FollowTest, MetaTxNegatives {
|
||||
FollowTest.setUp();
|
||||
MetaTxNegatives.setUp();
|
||||
|
||||
cachedNonceByAddress[followerProfileOwner] = _getSigNonce(followerProfileOwner);
|
||||
cachedNonceByAddress[testFollowerProfileOwner] = _getSigNonce(testFollowerProfileOwner);
|
||||
cachedNonceByAddress[alreadyFollowingProfileOwner] = _getSigNonce(
|
||||
alreadyFollowingProfileOwner
|
||||
);
|
||||
@@ -471,7 +475,7 @@ contract FollowMetaTxTest is FollowTest, MetaTxNegatives {
|
||||
_getSignedData({
|
||||
signerPk: signerPk,
|
||||
delegatedSigner: PROFILE_OWNER,
|
||||
followerProfileId: followerProfileId,
|
||||
followerProfileId: testFollowerProfileId,
|
||||
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
|
||||
followTokenIds: _toUint256Array(MINT_NEW_TOKEN),
|
||||
datas: _toBytesArray(''),
|
||||
@@ -482,7 +486,7 @@ contract FollowMetaTxTest is FollowTest, MetaTxNegatives {
|
||||
}
|
||||
|
||||
function _getDefaultMetaTxSignerPk() internal virtual override returns (uint256) {
|
||||
return followerProfileOwnerPk;
|
||||
return testFollowerProfileOwnerPk;
|
||||
}
|
||||
|
||||
function _calculateFollowWithSigDigest(
|
||||
@@ -549,7 +553,7 @@ contract FollowMetaTxTest is FollowTest, MetaTxNegatives {
|
||||
}
|
||||
|
||||
function _refreshCachedNonces() internal override {
|
||||
cachedNonceByAddress[followerProfileOwner] = _getSigNonce(followerProfileOwner);
|
||||
cachedNonceByAddress[testFollowerProfileOwner] = _getSigNonce(testFollowerProfileOwner);
|
||||
cachedNonceByAddress[alreadyFollowingProfileOwner] = _getSigNonce(
|
||||
alreadyFollowingProfileOwner
|
||||
);
|
||||
|
||||
@@ -14,9 +14,9 @@ contract UnfollowTest is BaseTest {
|
||||
uint256 constant nonFollowingProfileOwnerPk = 0x7357;
|
||||
address nonFollowingProfileOwner;
|
||||
uint256 nonFollowingProfileId;
|
||||
uint256 constant unfollowerProfileOwnerPk = 0xF01108;
|
||||
address unfollowerProfileOwner;
|
||||
uint256 unfollowerProfileId;
|
||||
uint256 constant testUnfollowerProfileOwnerPk = 0xF01108;
|
||||
address testUnfollowerProfileOwner;
|
||||
uint256 testUnfollowerProfileId;
|
||||
address targetFollowNFT;
|
||||
uint256 followTokenId;
|
||||
|
||||
@@ -26,11 +26,11 @@ contract UnfollowTest is BaseTest {
|
||||
targetProfileId = _createProfile(targetProfileOwner);
|
||||
nonFollowingProfileOwner = vm.addr(nonFollowingProfileOwnerPk);
|
||||
nonFollowingProfileId = _createProfile(nonFollowingProfileOwner);
|
||||
unfollowerProfileOwner = vm.addr(unfollowerProfileOwnerPk);
|
||||
unfollowerProfileId = _createProfile(unfollowerProfileOwner);
|
||||
testUnfollowerProfileOwner = vm.addr(testUnfollowerProfileOwnerPk);
|
||||
testUnfollowerProfileId = _createProfile(testUnfollowerProfileOwner);
|
||||
followTokenId = _follow(
|
||||
unfollowerProfileOwner,
|
||||
unfollowerProfileId,
|
||||
testUnfollowerProfileOwner,
|
||||
testUnfollowerProfileId,
|
||||
targetProfileId,
|
||||
0,
|
||||
''
|
||||
@@ -51,23 +51,23 @@ contract UnfollowTest is BaseTest {
|
||||
vm.expectRevert(Errors.Paused.selector);
|
||||
|
||||
_unfollow({
|
||||
pk: unfollowerProfileOwnerPk,
|
||||
pk: testUnfollowerProfileOwnerPk,
|
||||
isUnfollowerProfileOwner: true,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(targetProfileId)
|
||||
});
|
||||
}
|
||||
|
||||
function testCannotUnfollowIfUnfollowerProfileDoesNotExist() public {
|
||||
vm.prank(unfollowerProfileOwner);
|
||||
hub.burn(unfollowerProfileId);
|
||||
vm.prank(testUnfollowerProfileOwner);
|
||||
hub.burn(testUnfollowerProfileId);
|
||||
|
||||
vm.expectRevert(Errors.TokenDoesNotExist.selector);
|
||||
|
||||
_unfollow({
|
||||
pk: unfollowerProfileOwnerPk,
|
||||
pk: testUnfollowerProfileOwnerPk,
|
||||
isUnfollowerProfileOwner: true,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(targetProfileId)
|
||||
});
|
||||
}
|
||||
@@ -77,19 +77,19 @@ contract UnfollowTest is BaseTest {
|
||||
{
|
||||
vm.assume(!hub.exists(unexistentProfileId));
|
||||
|
||||
assertTrue(hub.isFollowing(unfollowerProfileId, targetProfileId));
|
||||
assertTrue(hub.isFollowing(testUnfollowerProfileId, targetProfileId));
|
||||
|
||||
vm.expectRevert(Errors.TokenDoesNotExist.selector);
|
||||
|
||||
_unfollow({
|
||||
pk: unfollowerProfileOwnerPk,
|
||||
pk: testUnfollowerProfileOwnerPk,
|
||||
isUnfollowerProfileOwner: true,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(targetProfileId, unexistentProfileId)
|
||||
});
|
||||
|
||||
// Asserts that the unfollow operation has been completely reverted after one of the unfollow's failed.
|
||||
assertTrue(hub.isFollowing(unfollowerProfileId, targetProfileId));
|
||||
assertTrue(hub.isFollowing(testUnfollowerProfileId, targetProfileId));
|
||||
}
|
||||
|
||||
function testCannotUnfollowIfTheProfileHasNeverBeenFollowedBefore() public {
|
||||
@@ -98,9 +98,9 @@ contract UnfollowTest is BaseTest {
|
||||
vm.expectRevert(Errors.NotFollowing.selector);
|
||||
|
||||
_unfollow({
|
||||
pk: unfollowerProfileOwnerPk,
|
||||
pk: testUnfollowerProfileOwnerPk,
|
||||
isUnfollowerProfileOwner: true,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(hasNeverBeenFollowedProfileId)
|
||||
});
|
||||
}
|
||||
@@ -123,12 +123,12 @@ contract UnfollowTest is BaseTest {
|
||||
115792089237316195423570985008687907852837564279074904382605163141518161494337 - 1
|
||||
);
|
||||
address executor = vm.addr(executorPk);
|
||||
vm.assume(executor != unfollowerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(unfollowerProfileOwner, executor));
|
||||
vm.assume(!followNFT.isApprovedForAll(unfollowerProfileOwner, executor));
|
||||
vm.assume(executor != testUnfollowerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(testUnfollowerProfileOwner, executor));
|
||||
vm.assume(!followNFT.isApprovedForAll(testUnfollowerProfileOwner, executor));
|
||||
|
||||
followTokenId = followNFT.getFollowTokenId(unfollowerProfileId);
|
||||
vm.prank(unfollowerProfileOwner);
|
||||
followTokenId = followNFT.getFollowTokenId(testUnfollowerProfileId);
|
||||
vm.prank(testUnfollowerProfileOwner);
|
||||
followNFT.wrap(followTokenId);
|
||||
|
||||
vm.expectRevert(Errors.ExecutorInvalid.selector);
|
||||
@@ -136,7 +136,7 @@ contract UnfollowTest is BaseTest {
|
||||
_unfollow({
|
||||
pk: executorPk,
|
||||
isUnfollowerProfileOwner: false,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(targetProfileId)
|
||||
});
|
||||
}
|
||||
@@ -147,21 +147,24 @@ contract UnfollowTest is BaseTest {
|
||||
|
||||
function testUnfollowAsUnfollowerOwner() public {
|
||||
vm.expectEmit(true, false, false, true, address(hub));
|
||||
emit Events.Unfollowed(unfollowerProfileId, targetProfileId, block.timestamp);
|
||||
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, block.timestamp);
|
||||
|
||||
vm.expectCall(
|
||||
targetFollowNFT,
|
||||
abi.encodeCall(followNFT.unfollow, (unfollowerProfileId, unfollowerProfileOwner))
|
||||
abi.encodeCall(
|
||||
followNFT.unfollow,
|
||||
(testUnfollowerProfileId, testUnfollowerProfileOwner)
|
||||
)
|
||||
);
|
||||
|
||||
_unfollow({
|
||||
pk: unfollowerProfileOwnerPk,
|
||||
pk: testUnfollowerProfileOwnerPk,
|
||||
isUnfollowerProfileOwner: true,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(targetProfileId)
|
||||
});
|
||||
|
||||
assertFalse(hub.isFollowing(unfollowerProfileId, targetProfileId));
|
||||
assertFalse(hub.isFollowing(testUnfollowerProfileId, targetProfileId));
|
||||
}
|
||||
|
||||
function testUnfollowAsUnfollowerApprovedDelegatedExecutor(uint256 approvedDelegatedExecutorPk)
|
||||
@@ -174,27 +177,27 @@ contract UnfollowTest is BaseTest {
|
||||
);
|
||||
address approvedDelegatedExecutor = vm.addr(approvedDelegatedExecutorPk);
|
||||
vm.assume(approvedDelegatedExecutor != address(0));
|
||||
vm.assume(approvedDelegatedExecutor != unfollowerProfileOwner);
|
||||
vm.assume(approvedDelegatedExecutor != testUnfollowerProfileOwner);
|
||||
|
||||
vm.prank(unfollowerProfileOwner);
|
||||
vm.prank(testUnfollowerProfileOwner);
|
||||
hub.setDelegatedExecutorApproval(approvedDelegatedExecutor, true);
|
||||
|
||||
vm.expectEmit(true, false, false, true, address(hub));
|
||||
emit Events.Unfollowed(unfollowerProfileId, targetProfileId, block.timestamp);
|
||||
emit Events.Unfollowed(testUnfollowerProfileId, targetProfileId, block.timestamp);
|
||||
|
||||
vm.expectCall(
|
||||
targetFollowNFT,
|
||||
abi.encodeCall(followNFT.unfollow, (unfollowerProfileId, approvedDelegatedExecutor))
|
||||
abi.encodeCall(followNFT.unfollow, (testUnfollowerProfileId, approvedDelegatedExecutor))
|
||||
);
|
||||
|
||||
_unfollow({
|
||||
pk: approvedDelegatedExecutorPk,
|
||||
isUnfollowerProfileOwner: false,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(targetProfileId)
|
||||
});
|
||||
|
||||
assertFalse(hub.isFollowing(unfollowerProfileId, targetProfileId));
|
||||
assertFalse(hub.isFollowing(testUnfollowerProfileId, targetProfileId));
|
||||
}
|
||||
|
||||
function _unfollow(
|
||||
@@ -220,7 +223,7 @@ contract UnfollowMetaTxTest is UnfollowTest, MetaTxNegatives {
|
||||
MetaTxNegatives.setUp();
|
||||
|
||||
cachedNonceByAddress[nonFollowingProfileOwner] = _getSigNonce(nonFollowingProfileOwner);
|
||||
cachedNonceByAddress[unfollowerProfileOwner] = _getSigNonce(unfollowerProfileOwner);
|
||||
cachedNonceByAddress[testUnfollowerProfileOwner] = _getSigNonce(testUnfollowerProfileOwner);
|
||||
}
|
||||
|
||||
function _unfollow(
|
||||
@@ -252,7 +255,7 @@ contract UnfollowMetaTxTest is UnfollowTest, MetaTxNegatives {
|
||||
_getSignedData({
|
||||
signerPk: signerPk,
|
||||
delegatedSigner: PROFILE_OWNER,
|
||||
unfollowerProfileId: unfollowerProfileId,
|
||||
unfollowerProfileId: testUnfollowerProfileId,
|
||||
idsOfProfilesToUnfollow: _toUint256Array(targetProfileId),
|
||||
nonce: nonce,
|
||||
deadline: deadline
|
||||
@@ -261,7 +264,7 @@ contract UnfollowMetaTxTest is UnfollowTest, MetaTxNegatives {
|
||||
}
|
||||
|
||||
function _getDefaultMetaTxSignerPk() internal virtual override returns (uint256) {
|
||||
return unfollowerProfileOwnerPk;
|
||||
return testUnfollowerProfileOwnerPk;
|
||||
}
|
||||
|
||||
function _calculateUnfollowWithSigDigest(
|
||||
|
||||
Reference in New Issue
Block a user