misc: SPDX License set in each file

Co-authored-by: Victor Naumik <vicnaum@gmail.com>
This commit is contained in:
donosonaumczuk
2023-03-23 20:39:25 +00:00
parent a39eb80058
commit bf42fecab5
37 changed files with 76 additions and 73 deletions

View File

@@ -208,10 +208,8 @@ contract SeaDropMintPublicationAction is VersionedInitializable, HubRestricted,
function rescaleFees(uint256 profileId, uint256 pubId) public { function rescaleFees(uint256 profileId, uint256 pubId) public {
uint16 lensTreasuryFeeBps = MODULE_GLOBALS.getTreasuryFee(); uint16 lensTreasuryFeeBps = MODULE_GLOBALS.getTreasuryFee();
PublicDrop memory publicDrop = SEADROP.getPublicDrop( PublicDrop memory publicDrop = SEADROP.getPublicDrop(_collectionDataByPub[0][pubId].nftCollectionAddress);
_collectionDataByPub[profileId][pubId].nftCollectionAddress _rescaleFees(0, pubId, lensTreasuryFeeBps, publicDrop);
);
_rescaleFees(profileId, pubId, lensTreasuryFeeBps, publicDrop);
} }
function _rescaleFees( function _rescaleFees(

View File

@@ -66,7 +66,7 @@ library ActionLib {
return actionModuleReturnData; return actionModuleReturnData;
} }
function _isActionAllowed(Types.Publication storage _publication, uint256 actionId) internal view returns (bool) { function _isActionAllowed(Types.Publication storage _publication, uint256 actionId) private view returns (bool) {
uint256 actionIdBitmapMask = 1 << (actionId - 1); uint256 actionIdBitmapMask = 1 << (actionId - 1);
return actionIdBitmapMask & _publication.actionModulesBitmap != 0; return actionIdBitmapMask & _publication.actionModulesBitmap != 0;
} }

View File

@@ -65,4 +65,25 @@ library GovernanceLib {
emit Events.StateSet(msg.sender, prevState, newState, block.timestamp); emit Events.StateSet(msg.sender, prevState, newState, block.timestamp);
return prevState; return prevState;
} }
function whitelistProfileCreator(address profileCreator, bool whitelist) external {
StorageLib.profileCreatorWhitelisted()[profileCreator] = whitelist;
emit Events.ProfileCreatorWhitelisted(profileCreator, whitelist, block.timestamp);
}
function whitelistFollowModule(address followModule, bool whitelist) external {
StorageLib.followModuleWhitelisted()[followModule] = whitelist;
emit Events.FollowModuleWhitelisted(followModule, whitelist, block.timestamp);
}
function whitelistReferenceModule(address referenceModule, bool whitelist) external {
StorageLib.referenceModuleWhitelisted()[referenceModule] = whitelist;
emit Events.ReferenceModuleWhitelisted(referenceModule, whitelist, block.timestamp);
}
function whitelistActionModuleId(address actionModule, uint256 whitelistId) external {
StorageLib.actionModuleWhitelistedId()[actionModule] = whitelistId;
StorageLib.actionModuleById()[whitelistId] = actionModule;
emit Events.ActionModuleWhitelistedId(actionModule, whitelistId, block.timestamp);
}
} }

View File

@@ -180,7 +180,7 @@ library MetaTxLib {
} }
// TODO: Check if this is how you do encoding of bytes[] array in ERC721 // TODO: Check if this is how you do encoding of bytes[] array in ERC721
function _prepareActionModulesInitDatas(bytes[] memory actionModulesInitDatas) internal pure returns (bytes32) { function _prepareActionModulesInitDatas(bytes[] memory actionModulesInitDatas) private pure returns (bytes32) {
bytes32[] memory actionModulesInitDatasBytes = new bytes32[](actionModulesInitDatas.length); bytes32[] memory actionModulesInitDatasBytes = new bytes32[](actionModulesInitDatas.length);
for (uint256 i = 0; i < actionModulesInitDatas.length; i++) { for (uint256 i = 0; i < actionModulesInitDatas.length; i++) {
actionModulesInitDatasBytes[i] = keccak256(abi.encode(actionModulesInitDatas[i])); actionModulesInitDatasBytes[i] = keccak256(abi.encode(actionModulesInitDatas[i]));
@@ -206,9 +206,9 @@ library MetaTxLib {
uint256 deadline; uint256 deadline;
} }
function abiEncode( function _abiEncode(
ReferenceParamsForAbiEncode memory referenceParamsForAbiEncode ReferenceParamsForAbiEncode memory referenceParamsForAbiEncode
) internal pure returns (bytes memory) { ) private pure returns (bytes memory) {
return return
abi.encode( abi.encode(
referenceParamsForAbiEncode.typehash, referenceParamsForAbiEncode.typehash,
@@ -238,7 +238,7 @@ library MetaTxLib {
bytes32 referenceModuleInitDataHash = keccak256(commentParams.referenceModuleInitData); bytes32 referenceModuleInitDataHash = keccak256(commentParams.referenceModuleInitData);
uint256 nonce = _getAndIncrementNonce(signature.signer); uint256 nonce = _getAndIncrementNonce(signature.signer);
uint256 deadline = signature.deadline; uint256 deadline = signature.deadline;
bytes memory encodedAbi = abiEncode( bytes memory encodedAbi = _abiEncode(
ReferenceParamsForAbiEncode( ReferenceParamsForAbiEncode(
Typehash.COMMENT, Typehash.COMMENT,
commentParams.profileId, commentParams.profileId,
@@ -269,7 +269,7 @@ library MetaTxLib {
bytes32 referenceModuleInitDataHash = keccak256(quoteParams.referenceModuleInitData); bytes32 referenceModuleInitDataHash = keccak256(quoteParams.referenceModuleInitData);
uint256 nonce = _getAndIncrementNonce(signature.signer); uint256 nonce = _getAndIncrementNonce(signature.signer);
uint256 deadline = signature.deadline; uint256 deadline = signature.deadline;
bytes memory encodedAbi = abiEncode( bytes memory encodedAbi = _abiEncode(
ReferenceParamsForAbiEncode( ReferenceParamsForAbiEncode(
Typehash.QUOTE, Typehash.QUOTE,
quoteParams.profileId, quoteParams.profileId,
@@ -494,7 +494,7 @@ library MetaTxLib {
/** /**
* @dev Wrapper for ecrecover to reduce code size, used in meta-tx specific functions. * @dev Wrapper for ecrecover to reduce code size, used in meta-tx specific functions.
*/ */
function _validateRecoveredAddress(bytes32 digest, Types.EIP712Signature calldata signature) internal view { function _validateRecoveredAddress(bytes32 digest, Types.EIP712Signature calldata signature) private view {
if (signature.deadline < block.timestamp) revert Errors.SignatureExpired(); if (signature.deadline < block.timestamp) revert Errors.SignatureExpired();
// If the expected address is a contract, check the signature there. // If the expected address is a contract, check the signature there.
if (signature.signer.code.length != 0) { if (signature.signer.code.length != 0) {

View File

@@ -13,7 +13,7 @@ import {IFollowNFT} from 'contracts/interfaces/IFollowNFT.sol';
library ProfileLib { library ProfileLib {
uint16 constant MAX_PROFILE_IMAGE_URI_LENGTH = 6000; uint16 constant MAX_PROFILE_IMAGE_URI_LENGTH = 6000;
function ownerOf(uint256 profileId) external view returns (address) { function ownerOf(uint256 profileId) internal view returns (address) {
address profileOwner = StorageLib.getTokenData(profileId).owner; address profileOwner = StorageLib.getTokenData(profileId).owner;
if (profileOwner == address(0)) { if (profileOwner == address(0)) {
revert Errors.TokenDoesNotExist(); revert Errors.TokenDoesNotExist();

View File

@@ -69,11 +69,10 @@ library ProfileTokenURILib {
* *
* @return string The profile token image as a base64-encoded SVG. * @return string The profile token image as a base64-encoded SVG.
*/ */
function _getSVGImageBase64Encoded(string memory handleWithAtSymbol, string memory imageURI) function _getSVGImageBase64Encoded(
internal string memory handleWithAtSymbol,
pure string memory imageURI
returns (string memory) ) private pure returns (string memory) {
{
return return
Base64.encode( Base64.encode(
abi.encodePacked( abi.encodePacked(
@@ -98,7 +97,7 @@ library ProfileTokenURILib {
* *
* @return string The fragment of the SVG token's image correspondending to the profile picture. * @return string The fragment of the SVG token's image correspondending to the profile picture.
*/ */
function _getSVGProfilePicture(string memory imageURI) internal pure returns (string memory) { function _getSVGProfilePicture(string memory imageURI) private pure returns (string memory) {
if (_shouldUseCustomPicture(imageURI)) { if (_shouldUseCustomPicture(imageURI)) {
return return
string( string(
@@ -125,7 +124,7 @@ library ProfileTokenURILib {
* @param handleLength The profile's handle length. * @param handleLength The profile's handle length.
* @return uint256 The font size. * @return uint256 The font size.
*/ */
function _handleLengthToFontSize(uint256 handleLength) internal pure returns (uint256) { function _handleLengthToFontSize(uint256 handleLength) private pure returns (uint256) {
return return
handleLength <= MAX_HANDLE_LENGTH_WITH_DEFAULT_FONT_SIZE handleLength <= MAX_HANDLE_LENGTH_WITH_DEFAULT_FONT_SIZE
? DEFAULT_FONT_SIZE ? DEFAULT_FONT_SIZE
@@ -142,7 +141,7 @@ library ProfileTokenURILib {
* *
* @return bool A boolean indicating whether custom profile picture should be used or not. * @return bool A boolean indicating whether custom profile picture should be used or not.
*/ */
function _shouldUseCustomPicture(string memory imageURI) internal pure returns (bool) { function _shouldUseCustomPicture(string memory imageURI) private pure returns (bool) {
bytes memory imageURIBytes = bytes(imageURI); bytes memory imageURIBytes = bytes(imageURI);
if (imageURIBytes.length == 0) { if (imageURIBytes.length == 0) {
return false; return false;

View File

@@ -1,4 +1,3 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'forge-std/Script.sol'; import 'forge-std/Script.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
uint256 constant FIRST_PROFILE_ID = 1; uint256 constant FIRST_PROFILE_ID = 1;

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
// File modified from https://github.com/transmissions11/solmate/blob/main/src/test/ERC721.t.sol // License should stay as `AGPL-3.0-only` as it was modified from:
// https://github.com/transmissions11/solmate/blob/main/src/test/ERC721.t.sol
pragma solidity ^0.8.15; pragma solidity ^0.8.15;
import 'forge-std/Test.sol'; import 'forge-std/Test.sol';
@@ -29,23 +30,13 @@ contract ERC721Recipient is IERC721Receiver {
} }
contract RevertingERC721Recipient is IERC721Receiver { contract RevertingERC721Recipient is IERC721Receiver {
function onERC721Received( function onERC721Received(address, address, uint256, bytes calldata) public virtual override returns (bytes4) {
address,
address,
uint256,
bytes calldata
) public virtual override returns (bytes4) {
revert(string(abi.encodePacked(IERC721Receiver.onERC721Received.selector))); revert(string(abi.encodePacked(IERC721Receiver.onERC721Received.selector)));
} }
} }
contract WrongReturnDataERC721Recipient is IERC721Receiver { contract WrongReturnDataERC721Recipient is IERC721Receiver {
function onERC721Received( function onERC721Received(address, address, uint256, bytes calldata) public virtual override returns (bytes4) {
address,
address,
uint256,
bytes calldata
) public virtual override returns (bytes4) {
return 0xCAFEBEEF; return 0xCAFEBEEF;
} }
} }

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';
@@ -18,11 +18,7 @@ abstract contract MetaTxNegatives is BaseTest {
// Functions to mandatorily override. // Functions to mandatorily override.
function _executeMetaTx( function _executeMetaTx(uint256 signerPk, uint256 nonce, uint256 deadline) internal virtual;
uint256 signerPk,
uint256 nonce,
uint256 deadline
) internal virtual;
function _getDefaultMetaTxSignerPk() internal virtual returns (uint256); function _getDefaultMetaTxSignerPk() internal virtual returns (uint256);

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';
@@ -280,11 +280,7 @@ contract SetBlockStatusMetaTxTest is SetBlockStatusTest, MetaTxNegatives {
}); });
} }
function _executeMetaTx( function _executeMetaTx(uint256 signerPk, uint256 nonce, uint256 deadline) internal override {
uint256 signerPk,
uint256 nonce,
uint256 deadline
) internal override {
hub.setBlockStatusWithSig({ hub.setBlockStatusWithSig({
byProfileId: statusSetterProfileId, byProfileId: statusSetterProfileId,
idsOfProfilesToSetBlockStatus: _toUint256Array(blockeeProfileId), idsOfProfilesToSetBlockStatus: _toUint256Array(blockeeProfileId),

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/BaseTest.t.sol'; import 'test/foundry/base/BaseTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/TestSetup.t.sol'; import 'test/foundry/base/TestSetup.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'forge-std/Test.sol'; import 'forge-std/Test.sol';

View File

@@ -1,5 +1,5 @@
// This test should upgrade the forked Polygon deployment, and run a series of tests. // This test should upgrade the forked Polygon deployment, and run a series of tests.
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
contract ArrayHelpers { contract ArrayHelpers {

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/base/TestSetup.t.sol'; import 'test/foundry/base/TestSetup.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'forge-std/Script.sol'; import 'forge-std/Script.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'forge-std/Test.sol'; import 'forge-std/Test.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'contracts/libraries/constants/Types.sol'; import 'contracts/libraries/constants/Types.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'test/foundry/FollowNFTTest.t.sol'; import 'test/foundry/FollowNFTTest.t.sol';

View File

@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: MIT
pragma solidity ^0.8.13; pragma solidity ^0.8.13;
import 'forge-std/Test.sol'; import 'forge-std/Test.sol';
@@ -75,6 +75,9 @@ contract MigrationsTest is Test, ForkManagement {
address lensHandlesAddress = computeCreateAddress(deployer, 0); address lensHandlesAddress = computeCreateAddress(deployer, 0);
address tokenHandleRegistryAddress = computeCreateAddress(deployer, 1); address tokenHandleRegistryAddress = computeCreateAddress(deployer, 1);
console.log('lensHandlesAddress:', lensHandlesAddress);
console.log('tokenHandleRegistryAddress:', tokenHandleRegistryAddress);
vm.startPrank(deployer); vm.startPrank(deployer);
lensHandles = new LensHandles(owner, address(hub)); lensHandles = new LensHandles(owner, address(hub));