diff --git a/.prettierrc b/.prettierrc index 0d67a64..897820b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,16 +4,17 @@ "trailingComma": "all", "tabWidth": 2, "printWidth": 80, + "plugins": ["prettier-plugin-solidity"], "overrides": [ { "files": "*.sol", "options": { + "parser": "solidity-parse", "printWidth": 80, "tabWidth": 4, "useTabs": false, "singleQuote": false, - "bracketSpacing": false, - "explicitTypes": "always" + "bracketSpacing": false } } ] diff --git a/contracts/ERC721CM.sol b/contracts/ERC721CM.sol index a8980bd..a2011aa 100644 --- a/contracts/ERC721CM.sol +++ b/contracts/ERC721CM.sol @@ -236,11 +236,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { * * New supply cannot be larger than the old. */ - function setMaxMintableSupply(uint256 maxMintableSupply) - external - virtual - onlyOwner - { + function setMaxMintableSupply( + uint256 maxMintableSupply + ) external virtual onlyOwner { if (maxMintableSupply > _maxMintableSupply) { revert CannotIncreaseMaxMintableSupply(); } @@ -258,10 +256,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { /** * @dev Sets global wallet limit. */ - function setGlobalWalletLimit(uint256 globalWalletLimit) - external - onlyOwner - { + function setGlobalWalletLimit( + uint256 globalWalletLimit + ) external onlyOwner { if (globalWalletLimit > _maxMintableSupply) revert GlobalWalletLimitOverflow(); _globalWalletLimit = globalWalletLimit; @@ -271,29 +268,18 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { /** * @dev Returns number of minted token for a given address. */ - function totalMintedByAddress(address a) - external - view - virtual - override - returns (uint256) - { + function totalMintedByAddress( + address a + ) external view virtual override returns (uint256) { return _numberMinted(a); } /** * @dev Returns info for one stage specified by index (starting from 0). */ - function getStageInfo(uint256 index) - external - view - override - returns ( - MintStageInfo memory, - uint32, - uint256 - ) - { + function getStageInfo( + uint256 index + ) external view override returns (MintStageInfo memory, uint32, uint256) { if (index >= _mintStages.length) { revert("InvalidStage"); } @@ -470,11 +456,10 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { * NOTE: This function bypasses validations thus only available for owner. * This is typically used for owner to pre-mint or mint the remaining of the supply. */ - function ownerMint(uint32 qty, address to) - external - onlyOwner - hasSupply(qty) - { + function ownerMint( + uint32 qty, + address to + ) external onlyOwner hasSupply(qty) { _safeMint(to, qty); } @@ -525,12 +510,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { /** * @dev Returns token URI for a given token id. */ - function tokenURI(uint256 tokenId) - public - view - override(ERC721A, IERC721A) - returns (string memory) - { + function tokenURI( + uint256 tokenId + ) public view override(ERC721A, IERC721A) returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _currentBaseURI; @@ -604,11 +586,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { /** * @dev Returns the current active stage based on timestamp. */ - function getActiveStageFromTimestamp(uint64 timestamp) - public - view - returns (uint256) - { + function getActiveStageFromTimestamp( + uint64 timestamp + ) public view returns (uint256) { for (uint256 i = 0; i < _mintStages.length; i++) { if ( timestamp >= _mintStages[i].startTimeUnixSeconds && @@ -631,10 +611,10 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { /** * @dev Validates the start timestamp is before end timestamp. Used when updating stages. */ - function _assertValidStartAndEndTimestamp(uint64 start, uint64 end) - internal - pure - { + function _assertValidStartAndEndTimestamp( + uint64 start, + uint64 end + ) internal pure { if (start >= end) revert InvalidStartAndEndTimestamp(); } diff --git a/contracts/ERC721CMBasicRoyalties.sol b/contracts/ERC721CMBasicRoyalties.sol index 91bcbef..0c301c6 100644 --- a/contracts/ERC721CMBasicRoyalties.sol +++ b/contracts/ERC721CMBasicRoyalties.sol @@ -34,7 +34,9 @@ contract ERC721CMBasicRoyalties is ERC721CM, BasicRoyalties { BasicRoyalties(royaltyReceiver, royaltyFeeNumerator) {} - function supportsInterface(bytes4 interfaceId) + function supportsInterface( + bytes4 interfaceId + ) public view virtual diff --git a/contracts/ERC721CMRoyalties.sol b/contracts/ERC721CMRoyalties.sol index 8f12b19..9830b17 100644 --- a/contracts/ERC721CMRoyalties.sol +++ b/contracts/ERC721CMRoyalties.sol @@ -34,7 +34,9 @@ contract ERC721CMRoyalties is ERC721CM, UpdatableRoyalties { UpdatableRoyalties(royaltyReceiver, royaltyFeeNumerator) {} - function supportsInterface(bytes4 interfaceId) + function supportsInterface( + bytes4 interfaceId + ) public view virtual diff --git a/contracts/ERC721M.sol b/contracts/ERC721M.sol index 9468e62..e2bea9b 100644 --- a/contracts/ERC721M.sol +++ b/contracts/ERC721M.sol @@ -232,11 +232,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { * * New supply cannot be larger than the old. */ - function setMaxMintableSupply(uint256 maxMintableSupply) - external - virtual - onlyOwner - { + function setMaxMintableSupply( + uint256 maxMintableSupply + ) external virtual onlyOwner { if (maxMintableSupply > _maxMintableSupply) { revert CannotIncreaseMaxMintableSupply(); } @@ -254,10 +252,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { /** * @dev Sets global wallet limit. */ - function setGlobalWalletLimit(uint256 globalWalletLimit) - external - onlyOwner - { + function setGlobalWalletLimit( + uint256 globalWalletLimit + ) external onlyOwner { if (globalWalletLimit > _maxMintableSupply) revert GlobalWalletLimitOverflow(); _globalWalletLimit = globalWalletLimit; @@ -267,29 +264,18 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { /** * @dev Returns number of minted token for a given address. */ - function totalMintedByAddress(address a) - external - view - virtual - override - returns (uint256) - { + function totalMintedByAddress( + address a + ) external view virtual override returns (uint256) { return _numberMinted(a); } /** * @dev Returns info for one stage specified by index (starting from 0). */ - function getStageInfo(uint256 index) - external - view - override - returns ( - MintStageInfo memory, - uint32, - uint256 - ) - { + function getStageInfo( + uint256 index + ) external view override returns (MintStageInfo memory, uint32, uint256) { if (index >= _mintStages.length) { revert("InvalidStage"); } @@ -466,11 +452,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { * NOTE: This function bypasses validations thus only available for owner. * This is typically used for owner to pre-mint or mint the remaining of the supply. */ - function ownerMint(uint32 qty, address to) - external - onlyOwner - hasSupply(qty) - { + function ownerMint( + uint32 qty, + address to + ) external onlyOwner hasSupply(qty) { _safeMint(to, qty); } @@ -521,12 +506,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { /** * @dev Returns token URI for a given token id. */ - function tokenURI(uint256 tokenId) - public - view - override(ERC721A, IERC721A) - returns (string memory) - { + function tokenURI( + uint256 tokenId + ) public view override(ERC721A, IERC721A) returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _currentBaseURI; @@ -586,11 +568,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { /** * @dev Returns the current active stage based on timestamp. */ - function getActiveStageFromTimestamp(uint64 timestamp) - public - view - returns (uint256) - { + function getActiveStageFromTimestamp( + uint64 timestamp + ) public view returns (uint256) { for (uint256 i = 0; i < _mintStages.length; i++) { if ( timestamp >= _mintStages[i].startTimeUnixSeconds && @@ -613,10 +593,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { /** * @dev Validates the start timestamp is before end timestamp. Used when updating stages. */ - function _assertValidStartAndEndTimestamp(uint64 start, uint64 end) - internal - pure - { + function _assertValidStartAndEndTimestamp( + uint64 start, + uint64 end + ) internal pure { if (start >= end) revert InvalidStartAndEndTimestamp(); } diff --git a/contracts/ERC721MAutoApprover.sol b/contracts/ERC721MAutoApprover.sol index 4008127..5e344c7 100644 --- a/contracts/ERC721MAutoApprover.sol +++ b/contracts/ERC721MAutoApprover.sol @@ -56,10 +56,9 @@ contract ERC721MAutoApprover is ERC721M { return _autoApproveAddress; } - function setAutoApproveAddress(address autoApproveAddress) - external - onlyOwner - { + function setAutoApproveAddress( + address autoApproveAddress + ) external onlyOwner { _autoApproveAddress = autoApproveAddress; emit SetAutoApproveAddress(autoApproveAddress); } diff --git a/contracts/ERC721MIncreasableSupply.sol b/contracts/ERC721MIncreasableSupply.sol index 00b60b9..0aecb54 100644 --- a/contracts/ERC721MIncreasableSupply.sol +++ b/contracts/ERC721MIncreasableSupply.sol @@ -54,11 +54,9 @@ contract ERC721MIncreasableSupply is ERC721M { * * New supply cannot be larger than the old, unless _canIncreaseMaxMintableSupply is true. */ - function setMaxMintableSupply(uint256 maxMintableSupply) - external - override - onlyOwner - { + function setMaxMintableSupply( + uint256 maxMintableSupply + ) external override onlyOwner { if ( !_canIncreaseMaxMintableSupply && maxMintableSupply > _maxMintableSupply diff --git a/contracts/ERC721MOperatorFiltererAutoApprover.sol b/contracts/ERC721MOperatorFiltererAutoApprover.sol index abef74a..67a63c9 100644 --- a/contracts/ERC721MOperatorFiltererAutoApprover.sol +++ b/contracts/ERC721MOperatorFiltererAutoApprover.sol @@ -56,10 +56,9 @@ contract ERC721MOperatorFiltererAutoApprover is ERC721MOperatorFilterer { return _autoApproveAddress; } - function setAutoApproveAddress(address autoApproveAddress) - external - onlyOwner - { + function setAutoApproveAddress( + address autoApproveAddress + ) external onlyOwner { _autoApproveAddress = autoApproveAddress; emit SetAutoApproveAddress(autoApproveAddress); } diff --git a/contracts/IERC721M.sol b/contracts/IERC721M.sol index 96942c1..4b7b21b 100644 --- a/contracts/IERC721M.sol +++ b/contracts/IERC721M.sol @@ -67,12 +67,7 @@ interface IERC721M is IERC721AQueryable { function totalMintedByAddress(address a) external view returns (uint256); - function getStageInfo(uint256 index) - external - view - returns ( - MintStageInfo memory, - uint32, - uint256 - ); + function getStageInfo( + uint256 index + ) external view returns (MintStageInfo memory, uint32, uint256); } diff --git a/contracts/auctions/BucketAuction.sol b/contracts/auctions/BucketAuction.sol index 1729bde..f062d2a 100644 --- a/contracts/auctions/BucketAuction.sol +++ b/contracts/auctions/BucketAuction.sol @@ -101,15 +101,10 @@ contract BucketAuction is IBucketAuction, ERC721M { return _userData[user]; } - function getUserDataPage(uint256 limit, uint256 offset) - external - view - returns ( - User[] memory, - address[] memory, - uint256 total - ) - { + function getUserDataPage( + uint256 limit, + uint256 offset + ) external view returns (User[] memory, address[] memory, uint256 total) { uint256 numUsers = _users.length(); uint256 pageSize = limit; if (pageSize > numUsers - offset) { @@ -147,10 +142,10 @@ contract BucketAuction is IBucketAuction, ERC721M { * @param startTime set to unix timestamp for the auction start time. * @param endTime set to unix timestamp for the auction end time. */ - function setStartAndEndTimeUnixSeconds(uint64 startTime, uint64 endTime) - external - onlyOwner - { + function setStartAndEndTimeUnixSeconds( + uint64 startTime, + uint64 endTime + ) external onlyOwner { if (_price != 0) revert PriceHasBeenSet(); if (endTime <= startTime) revert InvalidStartAndEndTimestamp(); @@ -184,10 +179,9 @@ contract BucketAuction is IBucketAuction, ERC721M { * @dev set this price in wei, not eth! * @param minimumContributionInWei new price, set in wei */ - function setMinimumContribution(uint256 minimumContributionInWei) - external - onlyOwner - { + function setMinimumContribution( + uint256 minimumContributionInWei + ) external onlyOwner { _minimumContributionInWei = minimumContributionInWei; emit SetMinimumContribution(minimumContributionInWei); } @@ -212,10 +206,10 @@ contract BucketAuction is IBucketAuction, ERC721M { * @param to address to mint tokens to. * @param numberOfTokens number of tokens to mint. */ - function _internalMint(address to, uint256 numberOfTokens) - internal - hasSupply(numberOfTokens) - { + function _internalMint( + address to, + uint256 numberOfTokens + ) internal hasSupply(numberOfTokens) { _safeMint(to, numberOfTokens); if (!_firstTokenSent && numberOfTokens > 0) _firstTokenSent = true; } @@ -361,10 +355,9 @@ contract BucketAuction is IBucketAuction, ERC721M { * @notice send refunds and tokens to a batch of addresses. * @param addresses array of addresses to send tokens to. */ - function sendTokensAndRefundBatch(address[] calldata addresses) - external - onlyOwner - { + function sendTokensAndRefundBatch( + address[] calldata addresses + ) external onlyOwner { for (uint256 i; i < addresses.length; i++) { sendTokensAndRefund(addresses[i]); } diff --git a/contracts/auctions/DutchAuction.sol b/contracts/auctions/DutchAuction.sol index 79d8638..f37d124 100644 --- a/contracts/auctions/DutchAuction.sol +++ b/contracts/auctions/DutchAuction.sol @@ -137,13 +137,9 @@ contract DutchAuction is IDutchAuction, ERC721M { return config.endAmountInWei; } - function bid(uint32 qty) - external - payable - nonReentrant - hasSupply(qty) - validTime - { + function bid( + uint32 qty + ) external payable nonReentrant hasSupply(qty) validTime { uint256 price = getCurrentPriceInWei(); if (msg.value < qty * price) revert NotEnoughValue(); diff --git a/contracts/creator-token-standards/CreatorTokenBase.sol b/contracts/creator-token-standards/CreatorTokenBase.sol index d2cb957..248ecf4 100644 --- a/contracts/creator-token-standards/CreatorTokenBase.sol +++ b/contracts/creator-token-standards/CreatorTokenBase.sol @@ -256,12 +256,9 @@ abstract contract CreatorTokenBase is * @notice Checks if an operator is whitelisted for this token contract. * @param operator The address of the operator to check. */ - function isOperatorWhitelisted(address operator) - public - view - override - returns (bool) - { + function isOperatorWhitelisted( + address operator + ) public view override returns (bool) { if (address(transferValidator) != address(0)) { return transferValidator.isOperatorWhitelisted( @@ -279,12 +276,9 @@ abstract contract CreatorTokenBase is * @notice Checks if a contract receiver is permitted for this token contract. * @param receiver The address of the receiver to check. */ - function isContractReceiverPermitted(address receiver) - public - view - override - returns (bool) - { + function isContractReceiverPermitted( + address receiver + ) public view override returns (bool) { if (address(transferValidator) != address(0)) { return transferValidator.isContractReceiverPermitted( @@ -348,7 +342,7 @@ abstract contract CreatorTokenBase is address caller, address from, address to, - uint256, /*tokenId*/ + uint256 /*tokenId*/, uint256 /*value*/ ) internal virtual override { if (address(transferValidator) != address(0)) { diff --git a/contracts/creator-token-standards/ERC721ACQueryable.sol b/contracts/creator-token-standards/ERC721ACQueryable.sol index cfdb586..cfb13c4 100644 --- a/contracts/creator-token-standards/ERC721ACQueryable.sol +++ b/contracts/creator-token-standards/ERC721ACQueryable.sol @@ -8,18 +8,14 @@ import "erc721a/contracts/extensions/ERC721AQueryable.sol"; * @title ERC721ACQueryable */ abstract contract ERC721ACQueryable is ERC721AQueryable, CreatorTokenBase { - constructor(string memory name_, string memory symbol_) - CreatorTokenBase() - ERC721A(name_, symbol_) - {} + constructor( + string memory name_, + string memory symbol_ + ) CreatorTokenBase() ERC721A(name_, symbol_) {} - function supportsInterface(bytes4 interfaceId) - public - view - virtual - override(ERC721A, IERC721A) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(ERC721A, IERC721A) returns (bool) { return interfaceId == type(ICreatorToken).interfaceId || ERC721A.supportsInterface(interfaceId); diff --git a/contracts/mocks/MockLayerZeroEndpoint.sol b/contracts/mocks/MockLayerZeroEndpoint.sol index 74beeb8..a74e451 100644 --- a/contracts/mocks/MockLayerZeroEndpoint.sol +++ b/contracts/mocks/MockLayerZeroEndpoint.sol @@ -27,19 +27,17 @@ contract MockLayerZeroEndpoint is ILayerZeroEndpoint { // do nothing } - function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) - external - view - returns (uint64) - { + function getInboundNonce( + uint16 _srcChainId, + bytes calldata _srcAddress + ) external view returns (uint64) { return 0; } - function getOutboundNonce(uint16 _dstChainId, address _srcAddress) - external - view - returns (uint64) - { + function getOutboundNonce( + uint16 _dstChainId, + address _srcAddress + ) external view returns (uint64) { return 0; } @@ -65,27 +63,22 @@ contract MockLayerZeroEndpoint is ILayerZeroEndpoint { // do nothing } - function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) - external - view - returns (bool) - { + function hasStoredPayload( + uint16 _srcChainId, + bytes calldata _srcAddress + ) external view returns (bool) { return false; } - function getSendLibraryAddress(address _userApplication) - external - view - returns (address) - { + function getSendLibraryAddress( + address _userApplication + ) external view returns (address) { return address(0); } - function getReceiveLibraryAddress(address _userApplication) - external - view - returns (address) - { + function getReceiveLibraryAddress( + address _userApplication + ) external view returns (address) { return address(0); } @@ -106,19 +99,15 @@ contract MockLayerZeroEndpoint is ILayerZeroEndpoint { return ""; } - function getSendVersion(address _userApplication) - external - view - returns (uint16) - { + function getSendVersion( + address _userApplication + ) external view returns (uint16) { return 0; } - function getReceiveVersion(address _userApplication) - external - view - returns (uint16) - { + function getReceiveVersion( + address _userApplication + ) external view returns (uint16) { return 0; } @@ -139,9 +128,10 @@ contract MockLayerZeroEndpoint is ILayerZeroEndpoint { // do nothing } - function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) - external - { + function forceResumeReceive( + uint16 _srcChainId, + bytes calldata _srcAddress + ) external { // do nothing } } diff --git a/contracts/mocks/TestStaking.sol b/contracts/mocks/TestStaking.sol index 0623ef6..6f58f80 100644 --- a/contracts/mocks/TestStaking.sol +++ b/contracts/mocks/TestStaking.sol @@ -13,11 +13,10 @@ contract TestStaking { _nft = IERC721A(nft); } - function isStaked(address staker, uint256 tokenId) - public - view - returns (bool) - { + function isStaked( + address staker, + uint256 tokenId + ) public view returns (bool) { return _stakers[staker].contains(tokenId); } diff --git a/contracts/onft/ERC721MLite.sol b/contracts/onft/ERC721MLite.sol index d9d21b6..51c11bb 100644 --- a/contracts/onft/ERC721MLite.sol +++ b/contracts/onft/ERC721MLite.sol @@ -198,11 +198,9 @@ contract ERC721MLite is /** * @dev Sets maximum mintable supply. */ - function setMaxMintableSupply(uint256 maxMintableSupply) - external - virtual - onlyOwner - { + function setMaxMintableSupply( + uint256 maxMintableSupply + ) external virtual onlyOwner { if (maxMintableSupply > _maxMintableSupply) { revert CannotIncreaseMaxMintableSupply(); } @@ -221,29 +219,18 @@ contract ERC721MLite is /** * @dev Returns number of minted token for a given address. */ - function totalMintedByAddress(address a) - external - view - virtual - override - returns (uint256) - { + function totalMintedByAddress( + address a + ) external view virtual override returns (uint256) { return _numberMinted(a); } /** * @dev Returns info for one stage specified by index (starting from 0). */ - function getStageInfo(uint256 index) - external - view - override - returns ( - MintStageInfo memory, - uint32, - uint256 - ) - { + function getStageInfo( + uint256 index + ) external view override returns (MintStageInfo memory, uint32, uint256) { if (index >= _mintStages.length) { revert("InvalidStage"); } @@ -323,11 +310,10 @@ contract ERC721MLite is * NOTE: This function bypasses validations thus only available for owner. * This is typically used for owner to pre-mint or mint the remaining of the supply. */ - function ownerMint(uint32 qty, address to) - external - onlyOwner - hasSupply(qty) - { + function ownerMint( + uint32 qty, + address to + ) external onlyOwner hasSupply(qty) { _safeMint(to, qty); } @@ -352,12 +338,9 @@ contract ERC721MLite is /** * @dev Returns token URI for a given token id. */ - function tokenURI(uint256 tokenId) - public - view - override(ERC721A, IERC721A) - returns (string memory) - { + function tokenURI( + uint256 tokenId + ) public view override(ERC721A, IERC721A) returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _currentBaseURI; @@ -417,11 +400,9 @@ contract ERC721MLite is /** * @dev Returns the current active stage based on timestamp. */ - function getActiveStageFromTimestamp(uint64 timestamp) - public - view - returns (uint256) - { + function getActiveStageFromTimestamp( + uint64 timestamp + ) public view returns (uint256) { for (uint256 i = 0; i < _mintStages.length; i++) { if ( timestamp >= _mintStages[i].startTimeUnixSeconds && @@ -444,10 +425,10 @@ contract ERC721MLite is /** * @dev Validates the start timestamp is before end timestamp. Used when updating stages. */ - function _assertValidStartAndEndTimestamp(uint64 start, uint64 end) - internal - pure - { + function _assertValidStartAndEndTimestamp( + uint64 start, + uint64 end + ) internal pure { if (start >= end) revert InvalidStartAndEndTimestamp(); } diff --git a/contracts/onft/ERC721MOnft.sol b/contracts/onft/ERC721MOnft.sol index c64c75b..2304dfc 100644 --- a/contracts/onft/ERC721MOnft.sol +++ b/contracts/onft/ERC721MOnft.sol @@ -48,7 +48,9 @@ contract ERC721MOnft is ERC721MLite, ONFT721CoreLite, ERC721A__IERC721Receiver { return Ownable.owner(); } - function supportsInterface(bytes4 interfaceId) + function supportsInterface( + bytes4 interfaceId + ) public view virtual @@ -92,12 +94,10 @@ contract ERC721MOnft is ERC721MLite, ONFT721CoreLite, ERC721A__IERC721Receiver { return ERC721A__IERC721Receiver.onERC721Received.selector; } - function _isApprovedOrOwner(address spender, uint256 tokenId) - internal - view - virtual - returns (bool) - { + function _isApprovedOrOwner( + address spender, + uint256 tokenId + ) internal view virtual returns (bool) { address owner = ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || diff --git a/contracts/onft/LzAppLite.sol b/contracts/onft/LzAppLite.sol index b511772..13cf306 100644 --- a/contracts/onft/LzAppLite.sol +++ b/contracts/onft/LzAppLite.sol @@ -103,23 +103,19 @@ abstract contract LzAppLite is require(providedGasLimit >= minGasLimit, "gas limit too low"); } - function _getGasLimit(bytes memory _adapterParams) - internal - pure - virtual - returns (uint256 gasLimit) - { + function _getGasLimit( + bytes memory _adapterParams + ) internal pure virtual returns (uint256 gasLimit) { require(_adapterParams.length >= 34, "invalid adapterParams"); assembly { gasLimit := mload(add(_adapterParams, 34)) } } - function _checkPayloadSize(uint16 _dstChainId, uint256 _payloadSize) - internal - view - virtual - { + function _checkPayloadSize( + uint16 _dstChainId, + uint256 _payloadSize + ) internal view virtual { uint256 payloadSizeLimit = payloadSizeLimitLookup[_dstChainId]; if (payloadSizeLimit == 0) { // use default if not set @@ -146,20 +142,19 @@ abstract contract LzAppLite is lzEndpoint.setReceiveVersion(_version); } - function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) - external - override - onlyOwner - { + function forceResumeReceive( + uint16 _srcChainId, + bytes calldata _srcAddress + ) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication - function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) - external - onlyOwner - { + function setTrustedRemote( + uint16 _remoteChainId, + bytes calldata _path + ) external onlyOwner { trustedRemoteLookup[_remoteChainId] = _path; emit SetTrustedRemote(_remoteChainId, _path); } @@ -180,10 +175,10 @@ abstract contract LzAppLite is } // if the size is 0, it means default size limit - function setPayloadSizeLimit(uint16 _dstChainId, uint256 _size) - external - onlyOwner - { + function setPayloadSizeLimit( + uint16 _dstChainId, + uint256 _size + ) external onlyOwner { payloadSizeLimitLookup[_dstChainId] = _size; } } diff --git a/contracts/onft/ONFT721CoreLite.sol b/contracts/onft/ONFT721CoreLite.sol index cb00fa7..35bb93f 100644 --- a/contracts/onft/ONFT721CoreLite.sol +++ b/contracts/onft/ONFT721CoreLite.sol @@ -27,9 +27,10 @@ abstract contract ONFT721CoreLite is mapping(uint16 => uint256) public dstChainIdToTransferGas; // per transfer amount of gas required to mint/transfer on the dst mapping(bytes32 => StoredCredit) public storedCredits; - constructor(uint256 _minGasToTransferAndStore, address _lzEndpoint) - NonblockingLzAppLite(_lzEndpoint) - { + constructor( + uint256 _minGasToTransferAndStore, + address _lzEndpoint + ) NonblockingLzAppLite(_lzEndpoint) { require( _minGasToTransferAndStore > 0, "minGasToTransferAndStore must be > 0" @@ -37,13 +38,9 @@ abstract contract ONFT721CoreLite is minGasToTransferAndStore = _minGasToTransferAndStore; } - function supportsInterface(bytes4 interfaceId) - public - view - virtual - override(ERC165, IERC165) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId); @@ -167,7 +164,7 @@ abstract contract ONFT721CoreLite is function _nonblockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, - uint64, /*_nonce*/ + uint64 /*_nonce*/, bytes memory _payload ) internal virtual override { // decode and load the toAddress @@ -258,10 +255,9 @@ abstract contract ONFT721CoreLite is return i; } - function setMinGasToTransferAndStore(uint256 _minGasToTransferAndStore) - external - onlyOwner - { + function setMinGasToTransferAndStore( + uint256 _minGasToTransferAndStore + ) external onlyOwner { require(_minGasToTransferAndStore > 0, "must be > 0"); minGasToTransferAndStore = _minGasToTransferAndStore; emit SetMinGasToTransferAndStore(_minGasToTransferAndStore); @@ -300,11 +296,9 @@ abstract contract ONFT721CoreLite is uint256 _tokenId ) internal virtual; - function _toSingletonArray(uint256 element) - internal - pure - returns (uint256[] memory) - { + function _toSingletonArray( + uint256 element + ) internal pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; diff --git a/contracts/onft/ONFT721Lite.sol b/contracts/onft/ONFT721Lite.sol index 04678b6..f504a68 100644 --- a/contracts/onft/ONFT721Lite.sol +++ b/contracts/onft/ONFT721Lite.sol @@ -21,7 +21,9 @@ contract ONFT721Lite is ONFT721CoreLite, ERC721, IONFT721 { address _lzEndpoint ) ERC721(_name, _symbol) ONFT721CoreLite(_minGasToTransfer, _lzEndpoint) {} - function supportsInterface(bytes4 interfaceId) + function supportsInterface( + bytes4 interfaceId + ) public view virtual @@ -80,12 +82,9 @@ contract ONFT721Lite is ONFT721CoreLite, ERC721, IONFT721 { /** * @dev Returns token URI for a given token id. */ - function tokenURI(uint256 tokenId) - public - view - override - returns (string memory) - { + function tokenURI( + uint256 tokenId + ) public view override returns (string memory) { require(_exists(tokenId), "token not exist"); string memory baseURI = _currentBaseURI; @@ -104,12 +103,9 @@ contract ONFT721Lite is ONFT721CoreLite, ERC721, IONFT721 { /** * @dev Converts a uint256 to its ASCII string decimal representation. */ - function _toString(uint256 value) - internal - pure - virtual - returns (string memory str) - { + function _toString( + uint256 value + ) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. diff --git a/contracts/royalties/UpdatableRoyalties.sol b/contracts/royalties/UpdatableRoyalties.sol index 5b43762..2bc6f33 100644 --- a/contracts/royalties/UpdatableRoyalties.sol +++ b/contracts/royalties/UpdatableRoyalties.sol @@ -19,10 +19,10 @@ abstract contract UpdatableRoyalties is ERC2981, Ownable { _setDefaultRoyalty(receiver, feeNumerator); } - function setDefaultRoyalty(address receiver, uint96 feeNumerator) - public - onlyOwner - { + function setDefaultRoyalty( + address receiver, + uint96 feeNumerator + ) public onlyOwner { super._setDefaultRoyalty(receiver, feeNumerator); emit DefaultRoyaltySet(receiver, feeNumerator); } diff --git a/package.json b/package.json index c309f05..acbcd2d 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "prettier --write scripts cosign-server test hardhat.config.ts" ], "*.sol": [ - "prettier --write contracts" + "prettier --write --plugin=prettier-plugin-solidity contracts" ] } }