mirror of
https://github.com/lens-protocol/core.git
synced 2026-04-22 03:02:03 -04:00
fix: Fixed most of the warnings
This commit is contained in:
@@ -88,11 +88,15 @@ contract CollectNFT is LensNFTBase, ERC2981CollectionRoyalties, ICollectNFT {
|
||||
ERC721Enumerable.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();
|
||||
}
|
||||
|
||||
@@ -440,11 +440,15 @@ contract FollowNFT is HubRestricted, LensNFTBase, ERC2981CollectionRoyalties, IF
|
||||
ILensHub(HUB).emitFollowNFTTransferEvent(_followedProfileId, followTokenId, from, to);
|
||||
}
|
||||
|
||||
function _getReceiver(uint256 followTokenId) internal view override returns (address) {
|
||||
function _getReceiver(
|
||||
uint256 /* followTokenId */
|
||||
) internal view override returns (address) {
|
||||
return IERC721(HUB).ownerOf(_followedProfileId);
|
||||
}
|
||||
|
||||
function _beforeRoyaltiesSet(uint256 royaltiesInBasisPoints) internal view override {
|
||||
function _beforeRoyaltiesSet(
|
||||
uint256 /* royaltiesInBasisPoints */
|
||||
) internal view override {
|
||||
if (IERC721(HUB).ownerOf(_followedProfileId) != msg.sender) {
|
||||
revert Errors.NotProfileOwner();
|
||||
}
|
||||
|
||||
@@ -52,12 +52,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,12 @@ abstract contract ERC721Time is Context, ERC165, IERC721Time, IERC721Metadata {
|
||||
/**
|
||||
* @dev Initializes the ERC721 name and symbol.
|
||||
*
|
||||
* @param name The name to set.
|
||||
* @param symbol The symbol to set.
|
||||
* @param name_ The name to set.
|
||||
* @param symbol_ The symbol to set.
|
||||
*/
|
||||
function __ERC721_Init(string calldata name, string calldata symbol) internal {
|
||||
_name = name;
|
||||
_symbol = symbol;
|
||||
function __ERC721_Init(string calldata name_, string calldata symbol_) internal {
|
||||
_name = name_;
|
||||
_symbol = symbol_;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -209,16 +209,16 @@ library GeneralHelpers {
|
||||
}
|
||||
|
||||
function isExecutorApproved(address onBehalfOf, address executor) internal view returns (bool) {
|
||||
bool isExecutorApproved;
|
||||
bool _isExecutorApproved;
|
||||
assembly {
|
||||
mstore(0, onBehalfOf)
|
||||
mstore(32, DELEGATED_EXECUTOR_APPROVAL_MAPPING_SLOT)
|
||||
mstore(32, keccak256(0, 64))
|
||||
mstore(0, executor)
|
||||
let slot := keccak256(0, 64)
|
||||
isExecutorApproved := sload(slot)
|
||||
_isExecutorApproved := sload(slot)
|
||||
}
|
||||
return isExecutorApproved;
|
||||
return _isExecutorApproved;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,8 @@ import {IFollowModule} from '../interfaces/IFollowModule.sol';
|
||||
*/
|
||||
contract MockFollowModule is IFollowModule {
|
||||
function initializeFollowModule(
|
||||
uint256 profileId,
|
||||
address executor,
|
||||
uint256, /* profileId */
|
||||
address, /* executor */
|
||||
bytes calldata data
|
||||
) external pure override returns (bytes memory) {
|
||||
uint256 number = abi.decode(data, (uint256));
|
||||
|
||||
@@ -11,18 +11,18 @@ contract MockFollowModuleWithRevertFlag is IFollowModule {
|
||||
error MockFollowModuleReverted();
|
||||
|
||||
function initializeFollowModule(
|
||||
uint256 profileId,
|
||||
address executor,
|
||||
bytes calldata data
|
||||
uint256, /* profileId */
|
||||
address, /* executor */
|
||||
bytes calldata /* data */
|
||||
) external pure override returns (bytes memory) {
|
||||
return new bytes(0);
|
||||
}
|
||||
|
||||
function processFollow(
|
||||
uint256 followerProfileId,
|
||||
uint256 followTokenId,
|
||||
address executor,
|
||||
uint256 profileId,
|
||||
uint256, /* followerProfileId */
|
||||
uint256, /* followTokenId */
|
||||
address, /* executor */
|
||||
uint256, /* profileId */
|
||||
bytes calldata data
|
||||
) external pure override {
|
||||
if (abi.decode(data, (bool))) {
|
||||
|
||||
@@ -124,7 +124,7 @@ contract FollowTest is BaseTest {
|
||||
vm.assume(executor != followerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
|
||||
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
assertFalse(followNFT.exists(followTokenId));
|
||||
|
||||
vm.expectRevert(Errors.ExecutorInvalid.selector);
|
||||
@@ -148,7 +148,7 @@ contract FollowTest is BaseTest {
|
||||
vm.assume(executor != followerProfileOwner);
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
|
||||
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
|
||||
vm.prank(alreadyFollowingProfileOwner);
|
||||
followNFT.wrap(followTokenId);
|
||||
|
||||
@@ -487,7 +487,7 @@ contract FollowMetaTxTest is FollowTest, MetaTxNegatives {
|
||||
bytes[] memory datas,
|
||||
uint256 nonce,
|
||||
uint256 deadline
|
||||
) internal returns (bytes32) {
|
||||
) internal view returns (bytes32) {
|
||||
bytes32[] memory dataHashes = new bytes32[](datas.length);
|
||||
for (uint256 i = 0; i < datas.length; ) {
|
||||
dataHashes[i] = keccak256(datas[i]);
|
||||
|
||||
@@ -83,7 +83,7 @@ contract SetFollowModuleTest is BaseTest, SignatureHelpers, SigSetup {
|
||||
vm.prank(profileOwner);
|
||||
hub.setDelegatedExecutorApproval(otherSigner, true);
|
||||
|
||||
address mockFollowModule = address(new MockFollowModule());
|
||||
mockFollowModule = address(new MockFollowModule());
|
||||
vm.prank(governance);
|
||||
hub.whitelistFollowModule(mockFollowModule, true);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ contract UnfollowTest is BaseTest {
|
||||
vm.assume(!hub.isDelegatedExecutorApproved(unfollowerProfileOwner, executor));
|
||||
vm.assume(!followNFT.isApprovedForAll(unfollowerProfileOwner, executor));
|
||||
|
||||
uint256 followTokenId = followNFT.getFollowTokenId(unfollowerProfileId);
|
||||
followTokenId = followNFT.getFollowTokenId(unfollowerProfileId);
|
||||
vm.prank(unfollowerProfileOwner);
|
||||
followNFT.wrap(followTokenId);
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ contract TestSetup is Test, ForkManagement {
|
||||
if (bytes(forkEnv).length > 0) {
|
||||
fork = true;
|
||||
console.log('\n\n Testing using %s fork', forkEnv);
|
||||
json = loadJson();
|
||||
loadJson();
|
||||
|
||||
network = getNetwork(json, forkEnv);
|
||||
network = getNetwork();
|
||||
|
||||
if (isEnvSet('FORK_BLOCK')) {
|
||||
forkBlockNumber = vm.envUint('FORK_BLOCK');
|
||||
@@ -92,7 +92,7 @@ contract TestSetup is Test, ForkManagement {
|
||||
console.log('Fork Block number:', forkBlockNumber);
|
||||
}
|
||||
|
||||
checkNetworkParams(json, forkEnv);
|
||||
checkNetworkParams();
|
||||
|
||||
loadBaseAddresses(forkEnv);
|
||||
} else {
|
||||
|
||||
@@ -17,30 +17,23 @@ contract ForkManagement is Script {
|
||||
_;
|
||||
}
|
||||
|
||||
function loadJson() internal returns (string memory) {
|
||||
function loadJson() internal {
|
||||
string memory root = vm.projectRoot();
|
||||
string memory path = string.concat(root, '/addresses.json');
|
||||
string memory json = vm.readFile(path);
|
||||
return json;
|
||||
json = vm.readFile(path);
|
||||
}
|
||||
|
||||
function checkNetworkParams(string memory json, string memory targetEnv)
|
||||
internal
|
||||
returns (string memory network, uint256 chainId)
|
||||
{
|
||||
network = json.readString(string.concat('.', targetEnv, '.network'));
|
||||
chainId = json.readUint(string.concat('.', targetEnv, '.chainId'));
|
||||
function checkNetworkParams() internal returns (uint256 chainId) {
|
||||
network = json.readString(string.concat('.', forkEnv, '.network'));
|
||||
chainId = json.readUint(string.concat('.', forkEnv, '.chainId'));
|
||||
|
||||
console.log('\nTarget environment:', targetEnv);
|
||||
console.log('\nTarget environment:', forkEnv);
|
||||
console.log('Network:', network);
|
||||
if (block.chainid != chainId) revert('Wrong chainId');
|
||||
console.log('ChainId:', chainId);
|
||||
}
|
||||
|
||||
function getNetwork(string memory json, string memory targetEnv)
|
||||
internal
|
||||
returns (string memory)
|
||||
{
|
||||
return json.readString(string.concat('.', targetEnv, '.network'));
|
||||
function getNetwork() internal returns (string memory) {
|
||||
return json.readString(string.concat('.', forkEnv, '.network'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import 'forge-std/Test.sol';
|
||||
import 'contracts/libraries/DataTypes.sol';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user