diff --git a/.prettierrc b/.prettierrc index f91ad7ee614..923a710a6ad 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,8 +6,7 @@ "files": "*.sol", "options": { "singleQuote": false, - "printWidth": 120, - "explicitTypes": "always" + "printWidth": 120 } } ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 369c65db10e..d95b7993408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased + * Reformatted codebase with latest version of Prettier Solidity. ([#3898](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3898)) * `ReentrancyGuard`: Add a `_reentrancyGuardEntered` function to expose the guard status. ([#3714](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3714)) * `ERC20Votes`: optimize by using unchecked arithmetic. ([#3748](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3748)) * `Initializable`: optimize `_disableInitializers` by using `!=` instead of `<`. ([#3787](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3787)) diff --git a/contracts/crosschain/polygon/CrossChainEnabledPolygonChild.sol b/contracts/crosschain/polygon/CrossChainEnabledPolygonChild.sol index 3918bfe25d8..fa099483499 100644 --- a/contracts/crosschain/polygon/CrossChainEnabledPolygonChild.sol +++ b/contracts/crosschain/polygon/CrossChainEnabledPolygonChild.sol @@ -59,7 +59,7 @@ abstract contract CrossChainEnabledPolygonChild is IFxMessageProcessor, CrossCha * then security could be compromised. */ function processMessageFromRoot( - uint256, /* stateId */ + uint256 /* stateId */, address rootMessageSender, bytes calldata data ) external override nonReentrant { diff --git a/contracts/finance/VestingWallet.sol b/contracts/finance/VestingWallet.sol index 0feac4ac6ab..fe67eb54ff6 100644 --- a/contracts/finance/VestingWallet.sol +++ b/contracts/finance/VestingWallet.sol @@ -29,11 +29,7 @@ contract VestingWallet is Context { /** * @dev Set the beneficiary, start timestamp and vesting duration of the vesting wallet. */ - constructor( - address beneficiaryAddress, - uint64 startTimestamp, - uint64 durationSeconds - ) payable { + constructor(address beneficiaryAddress, uint64 startTimestamp, uint64 durationSeconds) payable { require(beneficiaryAddress != address(0), "VestingWallet: beneficiary is zero address"); _beneficiary = beneficiaryAddress; _start = startTimestamp; diff --git a/contracts/governance/Governor.sol b/contracts/governance/Governor.sol index 84b3128ff0c..8235fb5ecb1 100644 --- a/contracts/governance/Governor.sol +++ b/contracts/governance/Governor.sol @@ -314,7 +314,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive * @dev Internal execution mechanism. Can be overridden to implement different execution mechanism */ function _execute( - uint256, /* proposalId */ + uint256 /* proposalId */, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, @@ -331,9 +331,9 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive * @dev Hook before execution is triggered. */ function _beforeExecute( - uint256, /* proposalId */ + uint256 /* proposalId */, address[] memory targets, - uint256[] memory, /* values */ + uint256[] memory /* values */, bytes[] memory calldatas, bytes32 /*descriptionHash*/ ) internal virtual { @@ -350,10 +350,10 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive * @dev Hook after execution is triggered. */ function _afterExecute( - uint256, /* proposalId */ - address[] memory, /* targets */ - uint256[] memory, /* values */ - bytes[] memory, /* calldatas */ + uint256 /* proposalId */, + address[] memory /* targets */, + uint256[] memory /* values */, + bytes[] memory /* calldatas */, bytes32 /*descriptionHash*/ ) internal virtual { if (_executor() != address(this)) { @@ -540,11 +540,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive * in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake. * Note that if the executor is simply the governor itself, use of `relay` is redundant. */ - function relay( - address target, - uint256 value, - bytes calldata data - ) external payable virtual onlyGovernance { + function relay(address target, uint256 value, bytes calldata data) external payable virtual onlyGovernance { (bool success, bytes memory returndata) = target.call{value: value}(data); Address.verifyCallResult(success, returndata, "Governor: relay reverted without message"); } @@ -560,12 +556,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive /** * @dev See {IERC721Receiver-onERC721Received}. */ - function onERC721Received( - address, - address, - uint256, - bytes memory - ) public virtual override returns (bytes4) { + function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } diff --git a/contracts/governance/TimelockController.sol b/contracts/governance/TimelockController.sol index ef932792b7d..da7143499c7 100644 --- a/contracts/governance/TimelockController.sol +++ b/contracts/governance/TimelockController.sol @@ -74,12 +74,7 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver * administration through timelocked proposals. Previous versions of this contract would assign * this admin to the deployer automatically and should be renounced as well. */ - constructor( - uint256 minDelay, - address[] memory proposers, - address[] memory executors, - address admin - ) { + constructor(uint256 minDelay, address[] memory proposers, address[] memory executors, address admin) { _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE); _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE); _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE); @@ -342,11 +337,7 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver /** * @dev Execute an operation's call. */ - function _execute( - address target, - uint256 value, - bytes calldata data - ) internal virtual { + function _execute(address target, uint256 value, bytes calldata data) internal virtual { (bool success, ) = target.call{value: value}(data); require(success, "TimelockController: underlying transaction reverted"); } @@ -386,12 +377,7 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver /** * @dev See {IERC721Receiver-onERC721Received}. */ - function onERC721Received( - address, - address, - uint256, - bytes memory - ) public virtual override returns (bytes4) { + function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } diff --git a/contracts/governance/compatibility/GovernorCompatibilityBravo.sol b/contracts/governance/compatibility/GovernorCompatibilityBravo.sol index 8d96be7d676..8d74742c5bb 100644 --- a/contracts/governance/compatibility/GovernorCompatibilityBravo.sol +++ b/contracts/governance/compatibility/GovernorCompatibilityBravo.sol @@ -118,11 +118,10 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp /** * @dev Encodes calldatas with optional function signature. */ - function _encodeCalldata(string[] memory signatures, bytes[] memory calldatas) - private - pure - returns (bytes[] memory) - { + function _encodeCalldata( + string[] memory signatures, + bytes[] memory calldatas + ) private pure returns (bytes[] memory) { bytes[] memory fullcalldatas = new bytes[](calldatas.length); for (uint256 i = 0; i < signatures.length; ++i) { @@ -163,7 +162,9 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp /** * @dev See {IGovernorCompatibilityBravo-proposals}. */ - function proposals(uint256 proposalId) + function proposals( + uint256 proposalId + ) public view virtual @@ -200,7 +201,9 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp /** * @dev See {IGovernorCompatibilityBravo-getActions}. */ - function getActions(uint256 proposalId) + function getActions( + uint256 proposalId + ) public view virtual diff --git a/contracts/governance/compatibility/IGovernorCompatibilityBravo.sol b/contracts/governance/compatibility/IGovernorCompatibilityBravo.sol index 83e4e1ae9c0..d1ec0337d00 100644 --- a/contracts/governance/compatibility/IGovernorCompatibilityBravo.sol +++ b/contracts/governance/compatibility/IGovernorCompatibilityBravo.sol @@ -50,7 +50,9 @@ abstract contract IGovernorCompatibilityBravo is IGovernor { /** * @dev Part of the Governor Bravo's interface: _"The official record of all proposals ever proposed"_. */ - function proposals(uint256) + function proposals( + uint256 + ) public view virtual @@ -96,7 +98,9 @@ abstract contract IGovernorCompatibilityBravo is IGovernor { /** * @dev Part of the Governor Bravo's interface: _"Gets actions of a proposal"_. */ - function getActions(uint256 proposalId) + function getActions( + uint256 proposalId + ) public view virtual diff --git a/contracts/governance/extensions/GovernorCountingSimple.sol b/contracts/governance/extensions/GovernorCountingSimple.sol index 5611fc6692c..f3eea9d7fa4 100644 --- a/contracts/governance/extensions/GovernorCountingSimple.sol +++ b/contracts/governance/extensions/GovernorCountingSimple.sol @@ -47,16 +47,9 @@ abstract contract GovernorCountingSimple is Governor { /** * @dev Accessor to the internal vote counts. */ - function proposalVotes(uint256 proposalId) - public - view - virtual - returns ( - uint256 againstVotes, - uint256 forVotes, - uint256 abstainVotes - ) - { + function proposalVotes( + uint256 proposalId + ) public view virtual returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes) { ProposalVote storage proposalVote = _proposalVotes[proposalId]; return (proposalVote.againstVotes, proposalVote.forVotes, proposalVote.abstainVotes); } diff --git a/contracts/governance/extensions/GovernorSettings.sol b/contracts/governance/extensions/GovernorSettings.sol index a3187c6e16e..527f41cd8a8 100644 --- a/contracts/governance/extensions/GovernorSettings.sol +++ b/contracts/governance/extensions/GovernorSettings.sol @@ -22,11 +22,7 @@ abstract contract GovernorSettings is Governor { /** * @dev Initialize the governance parameters. */ - constructor( - uint256 initialVotingDelay, - uint256 initialVotingPeriod, - uint256 initialProposalThreshold - ) { + constructor(uint256 initialVotingDelay, uint256 initialVotingPeriod, uint256 initialProposalThreshold) { _setVotingDelay(initialVotingDelay); _setVotingPeriod(initialVotingPeriod); _setProposalThreshold(initialProposalThreshold); diff --git a/contracts/governance/extensions/GovernorTimelockControl.sol b/contracts/governance/extensions/GovernorTimelockControl.sol index aaeaf940926..6aa2556abf1 100644 --- a/contracts/governance/extensions/GovernorTimelockControl.sol +++ b/contracts/governance/extensions/GovernorTimelockControl.sol @@ -110,7 +110,7 @@ abstract contract GovernorTimelockControl is IGovernorTimelock, Governor { * @dev Overridden execute function that run the already queued proposal through the timelock. */ function _execute( - uint256, /* proposalId */ + uint256 /* proposalId */, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, diff --git a/contracts/governance/utils/IVotes.sol b/contracts/governance/utils/IVotes.sol index 6317d7752e0..0bef3f92079 100644 --- a/contracts/governance/utils/IVotes.sol +++ b/contracts/governance/utils/IVotes.sol @@ -50,12 +50,5 @@ interface IVotes { /** * @dev Delegates votes from signer to `delegatee`. */ - function delegateBySig( - address delegatee, - uint256 nonce, - uint256 expiry, - uint8 v, - bytes32 r, - bytes32 s - ) external; + function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external; } diff --git a/contracts/governance/utils/Votes.sol b/contracts/governance/utils/Votes.sol index ba7c2b3fedd..2eecf32c652 100644 --- a/contracts/governance/utils/Votes.sol +++ b/contracts/governance/utils/Votes.sol @@ -136,11 +136,7 @@ abstract contract Votes is IVotes, Context, EIP712 { * @dev Transfers, mints, or burns voting units. To register a mint, `from` should be zero. To register a burn, `to` * should be zero. Total supply of voting units will be adjusted with mints and burns. */ - function _transferVotingUnits( - address from, - address to, - uint256 amount - ) internal virtual { + function _transferVotingUnits(address from, address to, uint256 amount) internal virtual { if (from == address(0)) { _totalCheckpoints.push(_add, amount); } @@ -153,11 +149,7 @@ abstract contract Votes is IVotes, Context, EIP712 { /** * @dev Moves delegated votes from one delegate to another. */ - function _moveDelegateVotes( - address from, - address to, - uint256 amount - ) private { + function _moveDelegateVotes(address from, address to, uint256 amount) private { if (from != to && amount > 0) { if (from != address(0)) { (uint256 oldValue, uint256 newValue) = _delegateCheckpoints[from].push(_subtract, amount); diff --git a/contracts/interfaces/IERC1363.sol b/contracts/interfaces/IERC1363.sol index 5fad104c223..1a8dc79f438 100644 --- a/contracts/interfaces/IERC1363.sol +++ b/contracts/interfaces/IERC1363.sol @@ -38,11 +38,7 @@ interface IERC1363 is IERC165, IERC20 { * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ - function transferAndCall( - address to, - uint256 value, - bytes memory data - ) external returns (bool); + function transferAndCall(address to, uint256 value, bytes memory data) external returns (bool); /** * @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver @@ -51,11 +47,7 @@ interface IERC1363 is IERC165, IERC20 { * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ - function transferFromAndCall( - address from, - address to, - uint256 value - ) external returns (bool); + function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver @@ -65,12 +57,7 @@ interface IERC1363 is IERC165, IERC20 { * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ - function transferFromAndCall( - address from, - address to, - uint256 value, - bytes memory data - ) external returns (bool); + function transferFromAndCall(address from, address to, uint256 value, bytes memory data) external returns (bool); /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender @@ -87,9 +74,5 @@ interface IERC1363 is IERC165, IERC20 { * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format, sent in call to `spender` */ - function approveAndCall( - address spender, - uint256 value, - bytes memory data - ) external returns (bool); + function approveAndCall(address spender, uint256 value, bytes memory data) external returns (bool); } diff --git a/contracts/interfaces/IERC1363Spender.sol b/contracts/interfaces/IERC1363Spender.sol index 48f6fd56d6d..28775e1406b 100644 --- a/contracts/interfaces/IERC1363Spender.sol +++ b/contracts/interfaces/IERC1363Spender.sol @@ -22,9 +22,5 @@ interface IERC1363Spender { * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` * unless throwing */ - function onApprovalReceived( - address owner, - uint256 value, - bytes memory data - ) external returns (bytes4); + function onApprovalReceived(address owner, uint256 value, bytes memory data) external returns (bytes4); } diff --git a/contracts/interfaces/IERC2981.sol b/contracts/interfaces/IERC2981.sol index 6b0558169ea..1c9448a9147 100644 --- a/contracts/interfaces/IERC2981.sol +++ b/contracts/interfaces/IERC2981.sol @@ -18,8 +18,8 @@ interface IERC2981 is IERC165 { * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ - function royaltyInfo(uint256 tokenId, uint256 salePrice) - external - view - returns (address receiver, uint256 royaltyAmount); + function royaltyInfo( + uint256 tokenId, + uint256 salePrice + ) external view returns (address receiver, uint256 royaltyAmount); } diff --git a/contracts/interfaces/IERC4626.sol b/contracts/interfaces/IERC4626.sol index f7c5397a0fa..08e5de7176b 100644 --- a/contracts/interfaces/IERC4626.sol +++ b/contracts/interfaces/IERC4626.sol @@ -187,11 +187,7 @@ interface IERC4626 is IERC20, IERC20Metadata { * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ - function withdraw( - uint256 assets, - address receiver, - address owner - ) external returns (uint256 shares); + function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, @@ -232,9 +228,5 @@ interface IERC4626 is IERC20, IERC20Metadata { * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ - function redeem( - uint256 shares, - address receiver, - address owner - ) external returns (uint256 assets); + function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); } diff --git a/contracts/metatx/MinimalForwarder.sol b/contracts/metatx/MinimalForwarder.sol index bb49c794dbb..9298ae6751c 100644 --- a/contracts/metatx/MinimalForwarder.sol +++ b/contracts/metatx/MinimalForwarder.sol @@ -44,11 +44,10 @@ contract MinimalForwarder is EIP712 { return _nonces[req.from] == req.nonce && signer == req.from; } - function execute(ForwardRequest calldata req, bytes calldata signature) - public - payable - returns (bool, bytes memory) - { + function execute( + ForwardRequest calldata req, + bytes calldata signature + ) public payable returns (bool, bytes memory) { require(verify(req, signature), "MinimalForwarder: signature does not match request"); _nonces[req.from] = req.nonce + 1; diff --git a/contracts/mocks/AddressImpl.sol b/contracts/mocks/AddressImpl.sol index 702093c7337..b06bec37284 100644 --- a/contracts/mocks/AddressImpl.sol +++ b/contracts/mocks/AddressImpl.sol @@ -22,11 +22,7 @@ contract AddressImpl { emit CallReturnValue(abi.decode(returnData, (string))); } - function functionCallWithValue( - address target, - bytes calldata data, - uint256 value - ) external payable { + function functionCallWithValue(address target, bytes calldata data, uint256 value) external payable { bytes memory returnData = Address.functionCallWithValue(target, data, value); emit CallReturnValue(abi.decode(returnData, (string))); } diff --git a/contracts/mocks/CheckpointsMock.sol b/contracts/mocks/CheckpointsMock.sol index f1dadabaf7d..874a1d1f213 100644 --- a/contracts/mocks/CheckpointsMock.sol +++ b/contracts/mocks/CheckpointsMock.sol @@ -14,15 +14,7 @@ contract CheckpointsMock { return _totalCheckpoints.latest(); } - function latestCheckpoint() - public - view - returns ( - bool, - uint256, - uint256 - ) - { + function latestCheckpoint() public view returns (bool, uint256, uint256) { return _totalCheckpoints.latestCheckpoint(); } @@ -52,15 +44,7 @@ contract Checkpoints224Mock { return _totalCheckpoints.latest(); } - function latestCheckpoint() - public - view - returns ( - bool, - uint32, - uint224 - ) - { + function latestCheckpoint() public view returns (bool, uint32, uint224) { return _totalCheckpoints.latestCheckpoint(); } @@ -90,15 +74,7 @@ contract Checkpoints160Mock { return _totalCheckpoints.latest(); } - function latestCheckpoint() - public - view - returns ( - bool, - uint96, - uint160 - ) - { + function latestCheckpoint() public view returns (bool, uint96, uint160) { return _totalCheckpoints.latestCheckpoint(); } diff --git a/contracts/mocks/ClonesMock.sol b/contracts/mocks/ClonesMock.sol index 3719b0a7835..c65d30cc3b0 100644 --- a/contracts/mocks/ClonesMock.sol +++ b/contracts/mocks/ClonesMock.sol @@ -15,11 +15,7 @@ contract ClonesMock { _initAndEmit(implementation.clone(), initdata); } - function cloneDeterministic( - address implementation, - bytes32 salt, - bytes calldata initdata - ) public payable { + function cloneDeterministic(address implementation, bytes32 salt, bytes calldata initdata) public payable { _initAndEmit(implementation.cloneDeterministic(salt), initdata); } diff --git a/contracts/mocks/ContextMock.sol b/contracts/mocks/ContextMock.sol index f17af38a49a..7759f350639 100644 --- a/contracts/mocks/ContextMock.sol +++ b/contracts/mocks/ContextMock.sol @@ -23,11 +23,7 @@ contract ContextMockCaller { context.msgSender(); } - function callData( - ContextMock context, - uint256 integerValue, - string memory stringValue - ) public { + function callData(ContextMock context, uint256 integerValue, string memory stringValue) public { context.msgData(integerValue, stringValue); } } diff --git a/contracts/mocks/Create2Impl.sol b/contracts/mocks/Create2Impl.sol index 070ad3671c5..6b2f4b712e5 100644 --- a/contracts/mocks/Create2Impl.sol +++ b/contracts/mocks/Create2Impl.sol @@ -6,11 +6,7 @@ import "../utils/Create2.sol"; import "../utils/introspection/ERC1820Implementer.sol"; contract Create2Impl { - function deploy( - uint256 value, - bytes32 salt, - bytes memory code - ) public { + function deploy(uint256 value, bytes32 salt, bytes memory code) public { Create2.deploy(value, salt, code); } diff --git a/contracts/mocks/DummyImplementation.sol b/contracts/mocks/DummyImplementation.sol index d8651340d1b..ddcca660439 100644 --- a/contracts/mocks/DummyImplementation.sol +++ b/contracts/mocks/DummyImplementation.sol @@ -27,11 +27,7 @@ contract DummyImplementation { value = _value; } - function initialize( - uint256 _value, - string memory _text, - uint256[] memory _values - ) public { + function initialize(uint256 _value, string memory _text, uint256[] memory _values) public { value = _value; text = _text; values = _values; diff --git a/contracts/mocks/ECDSAMock.sol b/contracts/mocks/ECDSAMock.sol index 97bd46669a6..cfc37d26ea6 100644 --- a/contracts/mocks/ECDSAMock.sol +++ b/contracts/mocks/ECDSAMock.sol @@ -13,21 +13,12 @@ contract ECDSAMock { } // solhint-disable-next-line func-name-mixedcase - function recover_v_r_s( - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s - ) public pure returns (address) { + function recover_v_r_s(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public pure returns (address) { return hash.recover(v, r, s); } // solhint-disable-next-line func-name-mixedcase - function recover_r_vs( - bytes32 hash, - bytes32 r, - bytes32 vs - ) public pure returns (address) { + function recover_r_vs(bytes32 hash, bytes32 r, bytes32 vs) public pure returns (address) { return hash.recover(r, vs); } diff --git a/contracts/mocks/EIP712External.sol b/contracts/mocks/EIP712External.sol index 93f77d54946..bc5b1269f7c 100644 --- a/contracts/mocks/EIP712External.sol +++ b/contracts/mocks/EIP712External.sol @@ -12,12 +12,7 @@ contract EIP712External is EIP712 { return _domainSeparatorV4(); } - function verify( - bytes memory signature, - address signer, - address mailTo, - string memory mailContents - ) external view { + function verify(bytes memory signature, address signer, address mailTo, string memory mailContents) external view { bytes32 digest = _hashTypedDataV4( keccak256(abi.encode(keccak256("Mail(address to,string contents)"), mailTo, keccak256(bytes(mailContents)))) ); diff --git a/contracts/mocks/ERC1155BurnableMock.sol b/contracts/mocks/ERC1155BurnableMock.sol index 62138f28da6..3334523cf74 100644 --- a/contracts/mocks/ERC1155BurnableMock.sol +++ b/contracts/mocks/ERC1155BurnableMock.sol @@ -7,12 +7,7 @@ import "../token/ERC1155/extensions/ERC1155Burnable.sol"; contract ERC1155BurnableMock is ERC1155Burnable { constructor(string memory uri) ERC1155(uri) {} - function mint( - address to, - uint256 id, - uint256 value, - bytes memory data - ) public { + function mint(address to, uint256 id, uint256 value, bytes memory data) public { _mint(to, id, value, data); } } diff --git a/contracts/mocks/ERC1155Mock.sol b/contracts/mocks/ERC1155Mock.sol index 0518ac26c17..6bfc86ceaf3 100644 --- a/contracts/mocks/ERC1155Mock.sol +++ b/contracts/mocks/ERC1155Mock.sol @@ -15,37 +15,19 @@ contract ERC1155Mock is ERC1155 { _setURI(newuri); } - function mint( - address to, - uint256 id, - uint256 value, - bytes memory data - ) public { + function mint(address to, uint256 id, uint256 value, bytes memory data) public { _mint(to, id, value, data); } - function mintBatch( - address to, - uint256[] memory ids, - uint256[] memory values, - bytes memory data - ) public { + function mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) public { _mintBatch(to, ids, values, data); } - function burn( - address owner, - uint256 id, - uint256 value - ) public { + function burn(address owner, uint256 id, uint256 value) public { _burn(owner, id, value); } - function burnBatch( - address owner, - uint256[] memory ids, - uint256[] memory values - ) public { + function burnBatch(address owner, uint256[] memory ids, uint256[] memory values) public { _burnBatch(owner, ids, values); } } diff --git a/contracts/mocks/ERC1155ReceiverMock.sol b/contracts/mocks/ERC1155ReceiverMock.sol index 6443a56c7ae..b2d505c0a86 100644 --- a/contracts/mocks/ERC1155ReceiverMock.sol +++ b/contracts/mocks/ERC1155ReceiverMock.sol @@ -14,12 +14,7 @@ contract ERC1155ReceiverMock is ERC165, IERC1155Receiver { event Received(address operator, address from, uint256 id, uint256 value, bytes data, uint256 gas); event BatchReceived(address operator, address from, uint256[] ids, uint256[] values, bytes data, uint256 gas); - constructor( - bytes4 recRetval, - bool recReverts, - bytes4 batRetval, - bool batReverts - ) { + constructor(bytes4 recRetval, bool recReverts, bytes4 batRetval, bool batReverts) { _recRetval = recRetval; _recReverts = recReverts; _batRetval = batRetval; diff --git a/contracts/mocks/ERC20CappedMock.sol b/contracts/mocks/ERC20CappedMock.sol index edb36f20531..e69aadfdf30 100644 --- a/contracts/mocks/ERC20CappedMock.sol +++ b/contracts/mocks/ERC20CappedMock.sol @@ -5,11 +5,7 @@ pragma solidity ^0.8.0; import "../token/ERC20/extensions/ERC20Capped.sol"; contract ERC20CappedMock is ERC20Capped { - constructor( - string memory name, - string memory symbol, - uint256 cap - ) ERC20(name, symbol) ERC20Capped(cap) {} + constructor(string memory name, string memory symbol, uint256 cap) ERC20(name, symbol) ERC20Capped(cap) {} function mint(address to, uint256 tokenId) public { _mint(to, tokenId); diff --git a/contracts/mocks/ERC20DecimalsMock.sol b/contracts/mocks/ERC20DecimalsMock.sol index 3721f6c393b..7677e9dd1d1 100644 --- a/contracts/mocks/ERC20DecimalsMock.sol +++ b/contracts/mocks/ERC20DecimalsMock.sol @@ -7,11 +7,7 @@ import "../token/ERC20/ERC20.sol"; contract ERC20DecimalsMock is ERC20 { uint8 private immutable _decimals; - constructor( - string memory name_, - string memory symbol_, - uint8 decimals_ - ) ERC20(name_, symbol_) { + constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) { _decimals = decimals_; } diff --git a/contracts/mocks/ERC20Mock.sol b/contracts/mocks/ERC20Mock.sol index fd7f991baf0..16ffad19fe5 100644 --- a/contracts/mocks/ERC20Mock.sol +++ b/contracts/mocks/ERC20Mock.sol @@ -23,19 +23,11 @@ contract ERC20Mock is ERC20 { _burn(account, amount); } - function transferInternal( - address from, - address to, - uint256 value - ) public { + function transferInternal(address from, address to, uint256 value) public { _transfer(from, to, value); } - function approveInternal( - address owner, - address spender, - uint256 value - ) public { + function approveInternal(address owner, address spender, uint256 value) public { _approve(owner, spender, value); } } diff --git a/contracts/mocks/ERC3156FlashBorrowerMock.sol b/contracts/mocks/ERC3156FlashBorrowerMock.sol index 288a278fb80..6a4410fcb1d 100644 --- a/contracts/mocks/ERC3156FlashBorrowerMock.sol +++ b/contracts/mocks/ERC3156FlashBorrowerMock.sol @@ -28,7 +28,7 @@ contract ERC3156FlashBorrowerMock is IERC3156FlashBorrower { } function onFlashLoan( - address, /*initiator*/ + address /*initiator*/, address token, uint256 amount, uint256 fee, diff --git a/contracts/mocks/ERC4626Mock.sol b/contracts/mocks/ERC4626Mock.sol index 4f80b4bd75b..9c13346f059 100644 --- a/contracts/mocks/ERC4626Mock.sol +++ b/contracts/mocks/ERC4626Mock.sol @@ -5,11 +5,7 @@ pragma solidity ^0.8.0; import "../token/ERC20/extensions/ERC4626.sol"; contract ERC4626Mock is ERC4626 { - constructor( - IERC20Metadata asset, - string memory name, - string memory symbol - ) ERC20(name, symbol) ERC4626(asset) {} + constructor(IERC20Metadata asset, string memory name, string memory symbol) ERC20(name, symbol) ERC4626(asset) {} function mockMint(address account, uint256 amount) public { _mint(account, amount); @@ -38,23 +34,17 @@ contract ERC4626DecimalMock is ERC4626Mock { return _decimals; } - function _initialConvertToShares(uint256 assets, Math.Rounding rounding) - internal - view - virtual - override - returns (uint256 shares) - { - return assets.mulDiv(10**decimals(), 10**super.decimals(), rounding); + function _initialConvertToShares( + uint256 assets, + Math.Rounding rounding + ) internal view virtual override returns (uint256 shares) { + return assets.mulDiv(10 ** decimals(), 10 ** super.decimals(), rounding); } - function _initialConvertToAssets(uint256 shares, Math.Rounding rounding) - internal - view - virtual - override - returns (uint256 assets) - { - return shares.mulDiv(10**super.decimals(), 10**decimals(), rounding); + function _initialConvertToAssets( + uint256 shares, + Math.Rounding rounding + ) internal view virtual override returns (uint256 assets) { + return shares.mulDiv(10 ** super.decimals(), 10 ** decimals(), rounding); } } diff --git a/contracts/mocks/ERC721BurnableMock.sol b/contracts/mocks/ERC721BurnableMock.sol index b30dbf53dfb..ecf42768182 100644 --- a/contracts/mocks/ERC721BurnableMock.sol +++ b/contracts/mocks/ERC721BurnableMock.sol @@ -19,11 +19,7 @@ contract ERC721BurnableMock is ERC721Burnable { _safeMint(to, tokenId); } - function safeMint( - address to, - uint256 tokenId, - bytes memory _data - ) public { + function safeMint(address to, uint256 tokenId, bytes memory _data) public { _safeMint(to, tokenId, _data); } } diff --git a/contracts/mocks/ERC721ConsecutiveEnumerableMock.sol b/contracts/mocks/ERC721ConsecutiveEnumerableMock.sol index cde3bd86cff..f4f5c5832be 100644 --- a/contracts/mocks/ERC721ConsecutiveEnumerableMock.sol +++ b/contracts/mocks/ERC721ConsecutiveEnumerableMock.sol @@ -17,13 +17,9 @@ contract ERC721ConsecutiveEnumerableMock is ERC721Consecutive, ERC721Enumerable } } - function supportsInterface(bytes4 interfaceId) - public - view - virtual - override(ERC721, ERC721Enumerable) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } diff --git a/contracts/mocks/ERC721EnumerableMock.sol b/contracts/mocks/ERC721EnumerableMock.sol index a747925e69d..b7ea94ee3f2 100644 --- a/contracts/mocks/ERC721EnumerableMock.sol +++ b/contracts/mocks/ERC721EnumerableMock.sol @@ -37,11 +37,7 @@ contract ERC721EnumerableMock is ERC721Enumerable { _safeMint(to, tokenId); } - function safeMint( - address to, - uint256 tokenId, - bytes memory _data - ) public { + function safeMint(address to, uint256 tokenId, bytes memory _data) public { _safeMint(to, tokenId, _data); } diff --git a/contracts/mocks/ERC721Mock.sol b/contracts/mocks/ERC721Mock.sol index 74a09233469..a3bc839ae7b 100644 --- a/contracts/mocks/ERC721Mock.sol +++ b/contracts/mocks/ERC721Mock.sol @@ -27,11 +27,7 @@ contract ERC721Mock is ERC721 { _safeMint(to, tokenId); } - function safeMint( - address to, - uint256 tokenId, - bytes memory _data - ) public { + function safeMint(address to, uint256 tokenId, bytes memory _data) public { _safeMint(to, tokenId, _data); } diff --git a/contracts/mocks/ERC721PausableMock.sol b/contracts/mocks/ERC721PausableMock.sol index 8d8e818fb17..753842e902b 100644 --- a/contracts/mocks/ERC721PausableMock.sol +++ b/contracts/mocks/ERC721PausableMock.sol @@ -31,11 +31,7 @@ contract ERC721PausableMock is ERC721Pausable { _safeMint(to, tokenId); } - function safeMint( - address to, - uint256 tokenId, - bytes memory _data - ) public { + function safeMint(address to, uint256 tokenId, bytes memory _data) public { _safeMint(to, tokenId, _data); } diff --git a/contracts/mocks/ERC721RoyaltyMock.sol b/contracts/mocks/ERC721RoyaltyMock.sol index 83a9074e2c1..6f19d5248d2 100644 --- a/contracts/mocks/ERC721RoyaltyMock.sol +++ b/contracts/mocks/ERC721RoyaltyMock.sol @@ -7,11 +7,7 @@ import "../token/ERC721/extensions/ERC721Royalty.sol"; contract ERC721RoyaltyMock is ERC721Royalty { constructor(string memory name, string memory symbol) ERC721(name, symbol) {} - function setTokenRoyalty( - uint256 tokenId, - address recipient, - uint96 fraction - ) public { + function setTokenRoyalty(uint256 tokenId, address recipient, uint96 fraction) public { _setTokenRoyalty(tokenId, recipient, fraction); } diff --git a/contracts/mocks/ERC721URIStorageMock.sol b/contracts/mocks/ERC721URIStorageMock.sol index 60f9f7b7c1a..4bb26b1ada7 100644 --- a/contracts/mocks/ERC721URIStorageMock.sol +++ b/contracts/mocks/ERC721URIStorageMock.sol @@ -41,11 +41,7 @@ contract ERC721URIStorageMock is ERC721URIStorage { _safeMint(to, tokenId); } - function safeMint( - address to, - uint256 tokenId, - bytes memory _data - ) public { + function safeMint(address to, uint256 tokenId, bytes memory _data) public { _safeMint(to, tokenId, _data); } diff --git a/contracts/mocks/ERC777Mock.sol b/contracts/mocks/ERC777Mock.sol index f8a3b67849d..59c00b30756 100644 --- a/contracts/mocks/ERC777Mock.sol +++ b/contracts/mocks/ERC777Mock.sol @@ -18,12 +18,7 @@ contract ERC777Mock is Context, ERC777 { _mint(initialHolder, initialBalance, "", ""); } - function mintInternal( - address to, - uint256 amount, - bytes memory userData, - bytes memory operatorData - ) public { + function mintInternal(address to, uint256 amount, bytes memory userData, bytes memory operatorData) public { _mint(to, amount, userData, operatorData); } @@ -37,20 +32,11 @@ contract ERC777Mock is Context, ERC777 { _mint(to, amount, userData, operatorData, requireReceptionAck); } - function approveInternal( - address holder, - address spender, - uint256 value - ) public { + function approveInternal(address holder, address spender, uint256 value) public { _approve(holder, spender, value); } - function _beforeTokenTransfer( - address, - address, - address, - uint256 - ) internal override { + function _beforeTokenTransfer(address, address, address, uint256) internal override { emit BeforeTokenTransfer(); } } diff --git a/contracts/mocks/ERC777SenderRecipientMock.sol b/contracts/mocks/ERC777SenderRecipientMock.sol index 169912f699b..8e8c749ceda 100644 --- a/contracts/mocks/ERC777SenderRecipientMock.sol +++ b/contracts/mocks/ERC777SenderRecipientMock.sol @@ -141,21 +141,12 @@ contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient, _shouldRevertReceive = shouldRevert; } - function send( - IERC777 token, - address to, - uint256 amount, - bytes memory data - ) public { + function send(IERC777 token, address to, uint256 amount, bytes memory data) public { // This is 777's send function, not the Solidity send function token.send(to, amount, data); // solhint-disable-line check-send-result } - function burn( - IERC777 token, - uint256 amount, - bytes memory data - ) public { + function burn(IERC777 token, uint256 amount, bytes memory data) public { token.burn(amount, data); } } diff --git a/contracts/mocks/GovernorCompatibilityBravoMock.sol b/contracts/mocks/GovernorCompatibilityBravoMock.sol index 1ef0f94b92e..d3b4f707d16 100644 --- a/contracts/mocks/GovernorCompatibilityBravoMock.sol +++ b/contracts/mocks/GovernorCompatibilityBravoMock.sol @@ -27,12 +27,9 @@ contract GovernorCompatibilityBravoMock is GovernorVotesComp(token_) {} - function supportsInterface(bytes4 interfaceId) - public - view - override(IERC165, Governor, GovernorTimelockCompound) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view override(IERC165, Governor, GovernorTimelockCompound) returns (bool) { return super.supportsInterface(interfaceId); } @@ -40,21 +37,15 @@ contract GovernorCompatibilityBravoMock is return 0; } - function state(uint256 proposalId) - public - view - override(IGovernor, Governor, GovernorTimelockCompound) - returns (ProposalState) - { + function state( + uint256 proposalId + ) public view override(IGovernor, Governor, GovernorTimelockCompound) returns (ProposalState) { return super.state(proposalId); } - function proposalEta(uint256 proposalId) - public - view - override(IGovernorTimelock, GovernorTimelockCompound) - returns (uint256) - { + function proposalEta( + uint256 proposalId + ) public view override(IGovernorTimelock, GovernorTimelockCompound) returns (uint256) { return super.proposalEta(proposalId); } diff --git a/contracts/mocks/GovernorPreventLateQuorumMock.sol b/contracts/mocks/GovernorPreventLateQuorumMock.sol index d868ab22b62..b6b5e761970 100644 --- a/contracts/mocks/GovernorPreventLateQuorumMock.sol +++ b/contracts/mocks/GovernorPreventLateQuorumMock.sol @@ -35,12 +35,9 @@ contract GovernorPreventLateQuorumMock is return _quorum; } - function proposalDeadline(uint256 proposalId) - public - view - override(Governor, GovernorPreventLateQuorum) - returns (uint256) - { + function proposalDeadline( + uint256 proposalId + ) public view override(Governor, GovernorPreventLateQuorum) returns (uint256) { return super.proposalDeadline(proposalId); } diff --git a/contracts/mocks/GovernorTimelockCompoundMock.sol b/contracts/mocks/GovernorTimelockCompoundMock.sol index becc72a06ef..75a2f3c144c 100644 --- a/contracts/mocks/GovernorTimelockCompoundMock.sol +++ b/contracts/mocks/GovernorTimelockCompoundMock.sol @@ -28,21 +28,15 @@ contract GovernorTimelockCompoundMock is GovernorVotesQuorumFraction(quorumNumerator_) {} - function supportsInterface(bytes4 interfaceId) - public - view - override(Governor, GovernorTimelockCompound) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view override(Governor, GovernorTimelockCompound) returns (bool) { return super.supportsInterface(interfaceId); } - function quorum(uint256 blockNumber) - public - view - override(IGovernor, GovernorVotesQuorumFraction) - returns (uint256) - { + function quorum( + uint256 blockNumber + ) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) { return super.quorum(blockNumber); } @@ -58,12 +52,9 @@ contract GovernorTimelockCompoundMock is /** * Overriding nightmare */ - function state(uint256 proposalId) - public - view - override(Governor, GovernorTimelockCompound) - returns (ProposalState) - { + function state( + uint256 proposalId + ) public view override(Governor, GovernorTimelockCompound) returns (ProposalState) { return super.state(proposalId); } diff --git a/contracts/mocks/GovernorTimelockControlMock.sol b/contracts/mocks/GovernorTimelockControlMock.sol index ca412d1ca60..671a1e0ea03 100644 --- a/contracts/mocks/GovernorTimelockControlMock.sol +++ b/contracts/mocks/GovernorTimelockControlMock.sol @@ -28,21 +28,15 @@ contract GovernorTimelockControlMock is GovernorVotesQuorumFraction(quorumNumerator_) {} - function supportsInterface(bytes4 interfaceId) - public - view - override(Governor, GovernorTimelockControl) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view override(Governor, GovernorTimelockControl) returns (bool) { return super.supportsInterface(interfaceId); } - function quorum(uint256 blockNumber) - public - view - override(IGovernor, GovernorVotesQuorumFraction) - returns (uint256) - { + function quorum( + uint256 blockNumber + ) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) { return super.quorum(blockNumber); } diff --git a/contracts/mocks/MathMock.sol b/contracts/mocks/MathMock.sol index c6b1e872318..be935f91dee 100644 --- a/contracts/mocks/MathMock.sol +++ b/contracts/mocks/MathMock.sol @@ -21,12 +21,7 @@ contract MathMock { return Math.ceilDiv(a, b); } - function mulDiv( - uint256 a, - uint256 b, - uint256 denominator, - Math.Rounding direction - ) public pure returns (uint256) { + function mulDiv(uint256 a, uint256 b, uint256 denominator, Math.Rounding direction) public pure returns (uint256) { return Math.mulDiv(a, b, denominator, direction); } diff --git a/contracts/mocks/MerkleProofWrapper.sol b/contracts/mocks/MerkleProofWrapper.sol index b74459dc890..60741e41c03 100644 --- a/contracts/mocks/MerkleProofWrapper.sol +++ b/contracts/mocks/MerkleProofWrapper.sol @@ -5,19 +5,11 @@ pragma solidity ^0.8.0; import "../utils/cryptography/MerkleProof.sol"; contract MerkleProofWrapper { - function verify( - bytes32[] memory proof, - bytes32 root, - bytes32 leaf - ) public pure returns (bool) { + function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) public pure returns (bool) { return MerkleProof.verify(proof, root, leaf); } - function verifyCalldata( - bytes32[] calldata proof, - bytes32 root, - bytes32 leaf - ) public pure returns (bool) { + function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) public pure returns (bool) { return MerkleProof.verifyCalldata(proof, root, leaf); } diff --git a/contracts/mocks/MultipleInheritanceInitializableMocks.sol b/contracts/mocks/MultipleInheritanceInitializableMocks.sol index f6d6440654f..b8cf9d9d5d3 100644 --- a/contracts/mocks/MultipleInheritanceInitializableMocks.sol +++ b/contracts/mocks/MultipleInheritanceInitializableMocks.sol @@ -108,12 +108,7 @@ contract SampleFather is Initializable, SampleGramps { contract SampleChild is Initializable, SampleMother, SampleFather { uint256 public child; - function initialize( - uint256 _mother, - string memory _gramps, - uint256 _father, - uint256 _child - ) public initializer { + function initialize(uint256 _mother, string memory _gramps, uint256 _father, uint256 _child) public initializer { __SampleChild_init(_mother, _gramps, _father, _child); } diff --git a/contracts/mocks/SafeERC20Helper.sol b/contracts/mocks/SafeERC20Helper.sol index 98fdc644490..237e32041c4 100644 --- a/contracts/mocks/SafeERC20Helper.sol +++ b/contracts/mocks/SafeERC20Helper.sol @@ -19,11 +19,7 @@ contract ERC20ReturnFalseMock is Context { return false; } - function transferFrom( - address, - address, - uint256 - ) public returns (bool) { + function transferFrom(address, address, uint256) public returns (bool) { _dummy = 0; return false; } @@ -51,11 +47,7 @@ contract ERC20ReturnTrueMock is Context { return true; } - function transferFrom( - address, - address, - uint256 - ) public returns (bool) { + function transferFrom(address, address, uint256) public returns (bool) { _dummy = 0; return true; } @@ -85,11 +77,7 @@ contract ERC20NoReturnMock is Context { _dummy = 0; } - function transferFrom( - address, - address, - uint256 - ) public { + function transferFrom(address, address, uint256) public { _dummy = 0; } diff --git a/contracts/mocks/SafeMathMock.sol b/contracts/mocks/SafeMathMock.sol index 3d1f4727ee5..ef504e3ab90 100644 --- a/contracts/mocks/SafeMathMock.sol +++ b/contracts/mocks/SafeMathMock.sol @@ -47,27 +47,15 @@ contract SafeMathMock { return SafeMath.mod(a, b); } - function subWithMessage( - uint256 a, - uint256 b, - string memory errorMessage - ) public pure returns (uint256) { + function subWithMessage(uint256 a, uint256 b, string memory errorMessage) public pure returns (uint256) { return SafeMath.sub(a, b, errorMessage); } - function divWithMessage( - uint256 a, - uint256 b, - string memory errorMessage - ) public pure returns (uint256) { + function divWithMessage(uint256 a, uint256 b, string memory errorMessage) public pure returns (uint256) { return SafeMath.div(a, b, errorMessage); } - function modWithMessage( - uint256 a, - uint256 b, - string memory errorMessage - ) public pure returns (uint256) { + function modWithMessage(uint256 a, uint256 b, string memory errorMessage) public pure returns (uint256) { return SafeMath.mod(a, b, errorMessage); } diff --git a/contracts/mocks/SignatureCheckerMock.sol b/contracts/mocks/SignatureCheckerMock.sol index 3b399c1aeaa..5671540ec4a 100644 --- a/contracts/mocks/SignatureCheckerMock.sol +++ b/contracts/mocks/SignatureCheckerMock.sol @@ -7,11 +7,7 @@ import "../utils/cryptography/SignatureChecker.sol"; contract SignatureCheckerMock { using SignatureChecker for address; - function isValidSignatureNow( - address signer, - bytes32 hash, - bytes memory signature - ) public view returns (bool) { + function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) public view returns (bool) { return signer.isValidSignatureNow(hash, signature); } } diff --git a/contracts/mocks/UUPS/UUPSLegacy.sol b/contracts/mocks/UUPS/UUPSLegacy.sol index e03fa862da3..7a3002889bf 100644 --- a/contracts/mocks/UUPS/UUPSLegacy.sol +++ b/contracts/mocks/UUPS/UUPSLegacy.sol @@ -17,11 +17,7 @@ contract UUPSUpgradeableLegacyMock is UUPSUpgradeableMock { StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } - function _upgradeToAndCallSecureLegacyV1( - address newImplementation, - bytes memory data, - bool forceCall - ) internal { + function _upgradeToAndCallSecureLegacyV1(address newImplementation, bytes memory data, bool forceCall) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call diff --git a/contracts/mocks/crosschain/bridges.sol b/contracts/mocks/crosschain/bridges.sol index 35c7f4c0625..41baffed805 100644 --- a/contracts/mocks/crosschain/bridges.sol +++ b/contracts/mocks/crosschain/bridges.sol @@ -12,11 +12,7 @@ abstract contract BaseRelayMock { address internal _currentSender; - function relayAs( - address target, - bytes calldata data, - address sender - ) external virtual { + function relayAs(address target, bytes calldata data, address sender) external virtual { address previousSender = _currentSender; _currentSender = sender; @@ -92,11 +88,7 @@ contract BridgeOptimismMock is BaseRelayMock { * Polygon */ contract BridgePolygonChildMock is BaseRelayMock { - function relayAs( - address target, - bytes calldata data, - address sender - ) external override { + function relayAs(address target, bytes calldata data, address sender) external override { IFxMessageProcessor(target).processMessageFromRoot(0, sender, data); } } diff --git a/contracts/mocks/wizard/MyGovernor1.sol b/contracts/mocks/wizard/MyGovernor1.sol index a80d8400c5e..37ecfd57d8b 100644 --- a/contracts/mocks/wizard/MyGovernor1.sol +++ b/contracts/mocks/wizard/MyGovernor1.sol @@ -14,12 +14,10 @@ contract MyGovernor1 is GovernorVotesQuorumFraction, GovernorCountingSimple { - constructor(IVotes _token, TimelockController _timelock) - Governor("MyGovernor") - GovernorVotes(_token) - GovernorVotesQuorumFraction(4) - GovernorTimelockControl(_timelock) - {} + constructor( + IVotes _token, + TimelockController _timelock + ) Governor("MyGovernor") GovernorVotes(_token) GovernorVotesQuorumFraction(4) GovernorTimelockControl(_timelock) {} function votingDelay() public pure override returns (uint256) { return 1; // 1 block @@ -31,12 +29,9 @@ contract MyGovernor1 is // The following functions are overrides required by Solidity. - function quorum(uint256 blockNumber) - public - view - override(IGovernor, GovernorVotesQuorumFraction) - returns (uint256) - { + function quorum( + uint256 blockNumber + ) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) { return super.quorum(blockNumber); } @@ -76,12 +71,9 @@ contract MyGovernor1 is return super._executor(); } - function supportsInterface(bytes4 interfaceId) - public - view - override(Governor, GovernorTimelockControl) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view override(Governor, GovernorTimelockControl) returns (bool) { return super.supportsInterface(interfaceId); } } diff --git a/contracts/mocks/wizard/MyGovernor2.sol b/contracts/mocks/wizard/MyGovernor2.sol index 34c608c5cc2..1472b67d588 100644 --- a/contracts/mocks/wizard/MyGovernor2.sol +++ b/contracts/mocks/wizard/MyGovernor2.sol @@ -16,12 +16,10 @@ contract MyGovernor2 is GovernorVotesQuorumFraction, GovernorCountingSimple { - constructor(IVotes _token, TimelockController _timelock) - Governor("MyGovernor") - GovernorVotes(_token) - GovernorVotesQuorumFraction(4) - GovernorTimelockControl(_timelock) - {} + constructor( + IVotes _token, + TimelockController _timelock + ) Governor("MyGovernor") GovernorVotes(_token) GovernorVotesQuorumFraction(4) GovernorTimelockControl(_timelock) {} function votingDelay() public pure override returns (uint256) { return 1; // 1 block @@ -37,12 +35,9 @@ contract MyGovernor2 is // The following functions are overrides required by Solidity. - function quorum(uint256 blockNumber) - public - view - override(IGovernor, GovernorVotesQuorumFraction) - returns (uint256) - { + function quorum( + uint256 blockNumber + ) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) { return super.quorum(blockNumber); } @@ -82,12 +77,9 @@ contract MyGovernor2 is return super._executor(); } - function supportsInterface(bytes4 interfaceId) - public - view - override(Governor, GovernorTimelockControl) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view override(Governor, GovernorTimelockControl) returns (bool) { return super.supportsInterface(interfaceId); } } diff --git a/contracts/mocks/wizard/MyGovernor3.sol b/contracts/mocks/wizard/MyGovernor3.sol index 70e4e87f046..320342290a5 100644 --- a/contracts/mocks/wizard/MyGovernor3.sol +++ b/contracts/mocks/wizard/MyGovernor3.sol @@ -14,12 +14,10 @@ contract MyGovernor is GovernorVotes, GovernorVotesQuorumFraction { - constructor(IVotes _token, TimelockController _timelock) - Governor("MyGovernor") - GovernorVotes(_token) - GovernorVotesQuorumFraction(4) - GovernorTimelockControl(_timelock) - {} + constructor( + IVotes _token, + TimelockController _timelock + ) Governor("MyGovernor") GovernorVotes(_token) GovernorVotesQuorumFraction(4) GovernorTimelockControl(_timelock) {} function votingDelay() public pure override returns (uint256) { return 1; // 1 block @@ -35,21 +33,15 @@ contract MyGovernor is // The following functions are overrides required by Solidity. - function quorum(uint256 blockNumber) - public - view - override(IGovernor, GovernorVotesQuorumFraction) - returns (uint256) - { + function quorum( + uint256 blockNumber + ) public view override(IGovernor, GovernorVotesQuorumFraction) returns (uint256) { return super.quorum(blockNumber); } - function state(uint256 proposalId) - public - view - override(Governor, IGovernor, GovernorTimelockControl) - returns (ProposalState) - { + function state( + uint256 proposalId + ) public view override(Governor, IGovernor, GovernorTimelockControl) returns (ProposalState) { return super.state(proposalId); } @@ -85,12 +77,9 @@ contract MyGovernor is return super._executor(); } - function supportsInterface(bytes4 interfaceId) - public - view - override(Governor, IERC165, GovernorTimelockControl) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view override(Governor, IERC165, GovernorTimelockControl) returns (bool) { return super.supportsInterface(interfaceId); } } diff --git a/contracts/proxy/Clones.sol b/contracts/proxy/Clones.sol index 93ea0cec77e..712519892ef 100644 --- a/contracts/proxy/Clones.sol +++ b/contracts/proxy/Clones.sol @@ -79,11 +79,10 @@ library Clones { /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ - function predictDeterministicAddress(address implementation, bytes32 salt) - internal - view - returns (address predicted) - { + function predictDeterministicAddress( + address implementation, + bytes32 salt + ) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } } diff --git a/contracts/proxy/ERC1967/ERC1967Upgrade.sol b/contracts/proxy/ERC1967/ERC1967Upgrade.sol index 77fbdd16565..0f32d4d2307 100644 --- a/contracts/proxy/ERC1967/ERC1967Upgrade.sol +++ b/contracts/proxy/ERC1967/ERC1967Upgrade.sol @@ -62,11 +62,7 @@ abstract contract ERC1967Upgrade { * * Emits an {Upgraded} event. */ - function _upgradeToAndCall( - address newImplementation, - bytes memory data, - bool forceCall - ) internal { + function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); @@ -78,11 +74,7 @@ abstract contract ERC1967Upgrade { * * Emits an {Upgraded} event. */ - function _upgradeToAndCallUUPS( - address newImplementation, - bytes memory data, - bool forceCall - ) internal { + function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. @@ -171,11 +163,7 @@ abstract contract ERC1967Upgrade { * * Emits a {BeaconUpgraded} event. */ - function _upgradeBeaconToAndCall( - address newBeacon, - bytes memory data, - bool forceCall - ) internal { + function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { diff --git a/contracts/proxy/transparent/TransparentUpgradeableProxy.sol b/contracts/proxy/transparent/TransparentUpgradeableProxy.sol index 4de85075ac1..3685360e76e 100644 --- a/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +++ b/contracts/proxy/transparent/TransparentUpgradeableProxy.sol @@ -31,11 +31,7 @@ contract TransparentUpgradeableProxy is ERC1967Proxy { * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. */ - constructor( - address _logic, - address admin_, - bytes memory _data - ) payable ERC1967Proxy(_logic, _data) { + constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) { _changeAdmin(admin_); } diff --git a/contracts/token/ERC1155/ERC1155.sol b/contracts/token/ERC1155/ERC1155.sol index e33faf80cb4..b20b711d505 100644 --- a/contracts/token/ERC1155/ERC1155.sol +++ b/contracts/token/ERC1155/ERC1155.sol @@ -79,13 +79,10 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { * * - `accounts` and `ids` must have the same length. */ - function balanceOfBatch(address[] memory accounts, uint256[] memory ids) - public - view - virtual - override - returns (uint256[] memory) - { + function balanceOfBatch( + address[] memory accounts, + uint256[] memory ids + ) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); @@ -263,12 +260,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ - function _mint( - address to, - uint256 id, - uint256 amount, - bytes memory data - ) internal virtual { + function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); @@ -330,11 +322,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ - function _burn( - address from, - uint256 id, - uint256 amount - ) internal virtual { + function _burn(address from, uint256 id, uint256 amount) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); @@ -363,11 +351,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { * * - `ids` and `amounts` must have the same length. */ - function _burnBatch( - address from, - uint256[] memory ids, - uint256[] memory amounts - ) internal virtual { + function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); @@ -396,11 +380,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { * * Emits an {ApprovalForAll} event. */ - function _setApprovalForAll( - address owner, - address operator, - bool approved - ) internal virtual { + function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); diff --git a/contracts/token/ERC1155/IERC1155.sol b/contracts/token/ERC1155/IERC1155.sol index 05f74dc4f32..eae0b7029f6 100644 --- a/contracts/token/ERC1155/IERC1155.sol +++ b/contracts/token/ERC1155/IERC1155.sol @@ -60,10 +60,10 @@ interface IERC1155 is IERC165 { * * - `accounts` and `ids` must have the same length. */ - function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) - external - view - returns (uint256[] memory); + function balanceOfBatch( + address[] calldata accounts, + uint256[] calldata ids + ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, @@ -96,13 +96,7 @@ interface IERC1155 is IERC165 { * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ - function safeTransferFrom( - address from, - address to, - uint256 id, - uint256 amount, - bytes calldata data - ) external; + function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. diff --git a/contracts/token/ERC1155/extensions/ERC1155Burnable.sol b/contracts/token/ERC1155/extensions/ERC1155Burnable.sol index cfaa2359dbd..cc81957a7fe 100644 --- a/contracts/token/ERC1155/extensions/ERC1155Burnable.sol +++ b/contracts/token/ERC1155/extensions/ERC1155Burnable.sol @@ -12,11 +12,7 @@ import "../ERC1155.sol"; * _Available since v3.1._ */ abstract contract ERC1155Burnable is ERC1155 { - function burn( - address account, - uint256 id, - uint256 value - ) public virtual { + function burn(address account, uint256 id, uint256 value) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not token owner or approved" @@ -25,11 +21,7 @@ abstract contract ERC1155Burnable is ERC1155 { _burn(account, id, value); } - function burnBatch( - address account, - uint256[] memory ids, - uint256[] memory values - ) public virtual { + function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not token owner or approved" diff --git a/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol b/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol index e57fdcc39d5..fd7729aa781 100644 --- a/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol +++ b/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol @@ -49,12 +49,7 @@ contract ERC1155PresetMinterPauser is Context, AccessControlEnumerable, ERC1155B * * - the caller must have the `MINTER_ROLE`. */ - function mint( - address to, - uint256 id, - uint256 amount, - bytes memory data - ) public virtual { + function mint(address to, uint256 id, uint256 amount, bytes memory data) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have minter role to mint"); _mint(to, id, amount, data); @@ -63,12 +58,7 @@ contract ERC1155PresetMinterPauser is Context, AccessControlEnumerable, ERC1155B /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}. */ - function mintBatch( - address to, - uint256[] memory ids, - uint256[] memory amounts, - bytes memory data - ) public virtual { + function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have minter role to mint"); _mintBatch(to, ids, amounts, data); @@ -105,13 +95,9 @@ contract ERC1155PresetMinterPauser is Context, AccessControlEnumerable, ERC1155B /** * @dev See {IERC165-supportsInterface}. */ - function supportsInterface(bytes4 interfaceId) - public - view - virtual - override(AccessControlEnumerable, ERC1155) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(AccessControlEnumerable, ERC1155) returns (bool) { return super.supportsInterface(interfaceId); } diff --git a/contracts/token/ERC20/ERC20.sol b/contracts/token/ERC20/ERC20.sol index 102bc85048c..dfca5a79b82 100644 --- a/contracts/token/ERC20/ERC20.sol +++ b/contracts/token/ERC20/ERC20.sol @@ -155,11 +155,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ - function transferFrom( - address from, - address to, - uint256 amount - ) public virtual override returns (bool) { + function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); @@ -223,11 +219,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ - function _transfer( - address from, - address to, - uint256 amount - ) internal virtual { + function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); @@ -313,11 +305,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ - function _approve( - address owner, - address spender, - uint256 amount - ) internal virtual { + function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); @@ -333,11 +321,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { * * Might emit an {Approval} event. */ - function _spendAllowance( - address owner, - address spender, - uint256 amount - ) internal virtual { + function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); @@ -361,11 +345,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ - function _beforeTokenTransfer( - address from, - address to, - uint256 amount - ) internal virtual {} + function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes @@ -381,9 +361,5 @@ contract ERC20 is Context, IERC20, IERC20Metadata { * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ - function _afterTokenTransfer( - address from, - address to, - uint256 amount - ) internal virtual {} + function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} } diff --git a/contracts/token/ERC20/IERC20.sol b/contracts/token/ERC20/IERC20.sol index b816bfed086..66c4e4d88fe 100644 --- a/contracts/token/ERC20/IERC20.sol +++ b/contracts/token/ERC20/IERC20.sol @@ -74,9 +74,5 @@ interface IERC20 { * * Emits a {Transfer} event. */ - function transferFrom( - address from, - address to, - uint256 amount - ) external returns (bool); + function transferFrom(address from, address to, uint256 amount) external returns (bool); } diff --git a/contracts/token/ERC20/extensions/ERC20Pausable.sol b/contracts/token/ERC20/extensions/ERC20Pausable.sol index e448e96a640..d0b224f4b9a 100644 --- a/contracts/token/ERC20/extensions/ERC20Pausable.sol +++ b/contracts/token/ERC20/extensions/ERC20Pausable.sol @@ -21,11 +21,7 @@ abstract contract ERC20Pausable is ERC20, Pausable { * * - the contract must not be paused. */ - function _beforeTokenTransfer( - address from, - address to, - uint256 amount - ) internal virtual override { + function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); diff --git a/contracts/token/ERC20/extensions/ERC20Snapshot.sol b/contracts/token/ERC20/extensions/ERC20Snapshot.sol index 0b46fc660bf..ee104b0ec69 100644 --- a/contracts/token/ERC20/extensions/ERC20Snapshot.sol +++ b/contracts/token/ERC20/extensions/ERC20Snapshot.sol @@ -120,11 +120,7 @@ abstract contract ERC20Snapshot is ERC20 { // Update balance and/or total supply snapshots before the values are modified. This is implemented // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations. - function _beforeTokenTransfer( - address from, - address to, - uint256 amount - ) internal virtual override { + function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); if (from == address(0)) { diff --git a/contracts/token/ERC20/extensions/ERC20Votes.sol b/contracts/token/ERC20/extensions/ERC20Votes.sol index 0fd57cecf18..bf1c2fd5d84 100644 --- a/contracts/token/ERC20/extensions/ERC20Votes.sol +++ b/contracts/token/ERC20/extensions/ERC20Votes.sol @@ -197,11 +197,7 @@ abstract contract ERC20Votes is IVotes, ERC20Permit { * * Emits a {IVotes-DelegateVotesChanged} event. */ - function _afterTokenTransfer( - address from, - address to, - uint256 amount - ) internal virtual override { + function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); @@ -222,11 +218,7 @@ abstract contract ERC20Votes is IVotes, ERC20Permit { _moveVotingPower(currentDelegate, delegatee, delegatorBalance); } - function _moveVotingPower( - address src, - address dst, - uint256 amount - ) private { + function _moveVotingPower(address src, address dst, uint256 amount) private { if (src != dst && amount > 0) { if (src != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount); diff --git a/contracts/token/ERC20/extensions/ERC4626.sol b/contracts/token/ERC20/extensions/ERC4626.sol index 3ffcd7bfd5a..9b26aefebed 100644 --- a/contracts/token/ERC20/extensions/ERC4626.sol +++ b/contracts/token/ERC20/extensions/ERC4626.sol @@ -153,11 +153,7 @@ abstract contract ERC4626 is ERC20, IERC4626 { } /** @dev See {IERC4626-withdraw}. */ - function withdraw( - uint256 assets, - address receiver, - address owner - ) public virtual override returns (uint256) { + function withdraw(uint256 assets, address receiver, address owner) public virtual override returns (uint256) { require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max"); uint256 shares = previewWithdraw(assets); @@ -167,11 +163,7 @@ abstract contract ERC4626 is ERC20, IERC4626 { } /** @dev See {IERC4626-redeem}. */ - function redeem( - uint256 shares, - address receiver, - address owner - ) public virtual override returns (uint256) { + function redeem(uint256 shares, address receiver, address owner) public virtual override returns (uint256) { require(shares <= maxRedeem(owner), "ERC4626: redeem more than max"); uint256 assets = previewRedeem(shares); @@ -230,12 +222,7 @@ abstract contract ERC4626 is ERC20, IERC4626 { /** * @dev Deposit/mint common workflow. */ - function _deposit( - address caller, - address receiver, - uint256 assets, - uint256 shares - ) internal virtual { + function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual { // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, // calls the vault, which is assumed not malicious. diff --git a/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol b/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol index 52afef3ab48..e8268145d27 100644 --- a/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol +++ b/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol @@ -24,12 +24,7 @@ contract ERC20PresetFixedSupply is ERC20Burnable { * * See {ERC20-constructor}. */ - constructor( - string memory name, - string memory symbol, - uint256 initialSupply, - address owner - ) ERC20(name, symbol) { + constructor(string memory name, string memory symbol, uint256 initialSupply, address owner) ERC20(name, symbol) { _mint(owner, initialSupply); } } diff --git a/contracts/token/ERC20/utils/SafeERC20.sol b/contracts/token/ERC20/utils/SafeERC20.sol index bfc381f9b4a..028711ddf29 100644 --- a/contracts/token/ERC20/utils/SafeERC20.sol +++ b/contracts/token/ERC20/utils/SafeERC20.sol @@ -19,20 +19,11 @@ import "../../../utils/Address.sol"; library SafeERC20 { using Address for address; - function safeTransfer( - IERC20 token, - address to, - uint256 value - ) internal { + function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } - function safeTransferFrom( - IERC20 token, - address from, - address to, - uint256 value - ) internal { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } @@ -43,11 +34,7 @@ library SafeERC20 { * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ - function safeApprove( - IERC20 token, - address spender, - uint256 value - ) internal { + function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' @@ -58,20 +45,12 @@ library SafeERC20 { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } - function safeIncreaseAllowance( - IERC20 token, - address spender, - uint256 value - ) internal { + function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } - function safeDecreaseAllowance( - IERC20 token, - address spender, - uint256 value - ) internal { + function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); diff --git a/contracts/token/ERC20/utils/TokenTimelock.sol b/contracts/token/ERC20/utils/TokenTimelock.sol index d879a7e7d72..ed855b7bcb4 100644 --- a/contracts/token/ERC20/utils/TokenTimelock.sol +++ b/contracts/token/ERC20/utils/TokenTimelock.sol @@ -29,11 +29,7 @@ contract TokenTimelock { * `beneficiary_` when {release} is invoked after `releaseTime_`. The release time is specified as a Unix timestamp * (in seconds). */ - constructor( - IERC20 token_, - address beneficiary_, - uint256 releaseTime_ - ) { + constructor(IERC20 token_, address beneficiary_, uint256 releaseTime_) { require(releaseTime_ > block.timestamp, "TokenTimelock: release time is before current time"); _token = token_; _beneficiary = beneficiary_; diff --git a/contracts/token/ERC721/ERC721.sol b/contracts/token/ERC721/ERC721.sol index 80fc22de04d..6bf620b4f24 100644 --- a/contracts/token/ERC721/ERC721.sol +++ b/contracts/token/ERC721/ERC721.sol @@ -147,11 +147,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { /** * @dev See {IERC721-transferFrom}. */ - function transferFrom( - address from, - address to, - uint256 tokenId - ) public virtual override { + function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); @@ -161,23 +157,14 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { /** * @dev See {IERC721-safeTransferFrom}. */ - function safeTransferFrom( - address from, - address to, - uint256 tokenId - ) public virtual override { + function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ - function safeTransferFrom( - address from, - address to, - uint256 tokenId, - bytes memory data - ) public virtual override { + function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _safeTransfer(from, to, tokenId, data); } @@ -200,12 +187,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { * * Emits a {Transfer} event. */ - function _safeTransfer( - address from, - address to, - uint256 tokenId, - bytes memory data - ) internal virtual { + function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } @@ -259,11 +241,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ - function _safeMint( - address to, - uint256 tokenId, - bytes memory data - ) internal virtual { + function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), @@ -352,11 +330,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { * * Emits a {Transfer} event. */ - function _transfer( - address from, - address to, - uint256 tokenId - ) internal virtual { + function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); @@ -399,11 +373,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { * * Emits an {ApprovalForAll} event. */ - function _setApprovalForAll( - address owner, - address operator, - bool approved - ) internal virtual { + function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); @@ -467,7 +437,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { function _beforeTokenTransfer( address from, address to, - uint256, /* firstTokenId */ + uint256 /* firstTokenId */, uint256 batchSize ) internal virtual { if (batchSize > 1) { @@ -494,10 +464,5 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ - function _afterTokenTransfer( - address from, - address to, - uint256 firstTokenId, - uint256 batchSize - ) internal virtual {} + function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {} } diff --git a/contracts/token/ERC721/IERC721.sol b/contracts/token/ERC721/IERC721.sol index 22020bab0bf..646530aa568 100644 --- a/contracts/token/ERC721/IERC721.sol +++ b/contracts/token/ERC721/IERC721.sol @@ -51,12 +51,7 @@ interface IERC721 is IERC165 { * * Emits a {Transfer} event. */ - function safeTransferFrom( - address from, - address to, - uint256 tokenId, - bytes calldata data - ) external; + function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients @@ -72,11 +67,7 @@ interface IERC721 is IERC165 { * * Emits a {Transfer} event. */ - function safeTransferFrom( - address from, - address to, - uint256 tokenId - ) external; + function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. @@ -94,11 +85,7 @@ interface IERC721 is IERC165 { * * Emits a {Transfer} event. */ - function transferFrom( - address from, - address to, - uint256 tokenId - ) external; + function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. diff --git a/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol b/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol index 06b377324a0..478e5808dd6 100644 --- a/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol +++ b/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol @@ -51,11 +51,7 @@ contract ERC721PresetMinterPauserAutoId is * Token URIs will be autogenerated based on `baseURI` and their token IDs. * See {ERC721-tokenURI}. */ - constructor( - string memory name, - string memory symbol, - string memory baseTokenURI - ) ERC721(name, symbol) { + constructor(string memory name, string memory symbol, string memory baseTokenURI) ERC721(name, symbol) { _baseTokenURI = baseTokenURI; _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); @@ -128,13 +124,9 @@ contract ERC721PresetMinterPauserAutoId is /** * @dev See {IERC165-supportsInterface}. */ - function supportsInterface(bytes4 interfaceId) - public - view - virtual - override(AccessControlEnumerable, ERC721, ERC721Enumerable) - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(AccessControlEnumerable, ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } } diff --git a/contracts/token/ERC721/utils/ERC721Holder.sol b/contracts/token/ERC721/utils/ERC721Holder.sol index 394926d51ed..cfa533a47b1 100644 --- a/contracts/token/ERC721/utils/ERC721Holder.sol +++ b/contracts/token/ERC721/utils/ERC721Holder.sol @@ -17,12 +17,7 @@ contract ERC721Holder is IERC721Receiver { * * Always returns `IERC721Receiver.onERC721Received.selector`. */ - function onERC721Received( - address, - address, - uint256, - bytes memory - ) public virtual override returns (bytes4) { + function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } } diff --git a/contracts/token/ERC777/ERC777.sol b/contracts/token/ERC777/ERC777.sol index 7c35bf5a8a9..c1503c4dfc3 100644 --- a/contracts/token/ERC777/ERC777.sol +++ b/contracts/token/ERC777/ERC777.sol @@ -57,11 +57,7 @@ contract ERC777 is Context, IERC777, IERC20 { /** * @dev `defaultOperators` may be an empty array. */ - constructor( - string memory name_, - string memory symbol_, - address[] memory defaultOperators_ - ) { + constructor(string memory name_, string memory symbol_, address[] memory defaultOperators_) { _name = name_; _symbol = symbol_; @@ -127,11 +123,7 @@ contract ERC777 is Context, IERC777, IERC20 { * * Also emits a {IERC20-Transfer} event for ERC20 compatibility. */ - function send( - address recipient, - uint256 amount, - bytes memory data - ) public virtual override { + function send(address recipient, uint256 amount, bytes memory data) public virtual override { _send(_msgSender(), recipient, amount, data, "", true); } @@ -272,11 +264,7 @@ contract ERC777 is Context, IERC777, IERC20 { * * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events. */ - function transferFrom( - address holder, - address recipient, - uint256 amount - ) public virtual override returns (bool) { + function transferFrom(address holder, address recipient, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(holder, spender, amount); _send(holder, recipient, amount, "", "", false); @@ -301,12 +289,7 @@ contract ERC777 is Context, IERC777, IERC20 { * - if `account` is a contract, it must implement the {IERC777Recipient} * interface. */ - function _mint( - address account, - uint256 amount, - bytes memory userData, - bytes memory operatorData - ) internal virtual { + function _mint(address account, uint256 amount, bytes memory userData, bytes memory operatorData) internal virtual { _mint(account, amount, userData, operatorData, true); } @@ -387,12 +370,7 @@ contract ERC777 is Context, IERC777, IERC20 { * @param data bytes extra information provided by the token holder * @param operatorData bytes extra information provided by the operator (if any) */ - function _burn( - address from, - uint256 amount, - bytes memory data, - bytes memory operatorData - ) internal virtual { + function _burn(address from, uint256 amount, bytes memory data, bytes memory operatorData) internal virtual { require(from != address(0), "ERC777: burn from the zero address"); address operator = _msgSender(); @@ -439,11 +417,7 @@ contract ERC777 is Context, IERC777, IERC20 { * * Note that accounts cannot have allowance issued by their operators. */ - function _approve( - address holder, - address spender, - uint256 value - ) internal virtual { + function _approve(address holder, address spender, uint256 value) internal virtual { require(holder != address(0), "ERC777: approve from the zero address"); require(spender != address(0), "ERC777: approve to the zero address"); @@ -510,11 +484,7 @@ contract ERC777 is Context, IERC777, IERC20 { * * Might emit an {IERC20-Approval} event. */ - function _spendAllowance( - address owner, - address spender, - uint256 amount - ) internal virtual { + function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC777: insufficient allowance"); @@ -538,10 +508,5 @@ contract ERC777 is Context, IERC777, IERC20 { * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ - function _beforeTokenTransfer( - address operator, - address from, - address to, - uint256 amount - ) internal virtual {} + function _beforeTokenTransfer(address operator, address from, address to, uint256 amount) internal virtual {} } diff --git a/contracts/token/ERC777/IERC777.sol b/contracts/token/ERC777/IERC777.sol index 2af7771b03e..d3bede62610 100644 --- a/contracts/token/ERC777/IERC777.sol +++ b/contracts/token/ERC777/IERC777.sol @@ -83,11 +83,7 @@ interface IERC777 { * - if `recipient` is a contract, it must implement the {IERC777Recipient} * interface. */ - function send( - address recipient, - uint256 amount, - bytes calldata data - ) external; + function send(address recipient, uint256 amount, bytes calldata data) external; /** * @dev Destroys `amount` tokens from the caller's account, reducing the @@ -191,12 +187,7 @@ interface IERC777 { * - `account` must have at least `amount` tokens. * - the caller must be an operator for `account`. */ - function operatorBurn( - address account, - uint256 amount, - bytes calldata data, - bytes calldata operatorData - ) external; + function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external; event Sent( address indexed operator, diff --git a/contracts/token/common/ERC2981.sol b/contracts/token/common/ERC2981.sol index 604dba3046a..84cb6b8deb4 100644 --- a/contracts/token/common/ERC2981.sol +++ b/contracts/token/common/ERC2981.sol @@ -91,11 +91,7 @@ abstract contract ERC2981 is IERC2981, ERC165 { * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ - function _setTokenRoyalty( - uint256 tokenId, - address receiver, - uint96 feeNumerator - ) internal virtual { + function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); diff --git a/contracts/utils/Address.sol b/contracts/utils/Address.sol index e89512342ae..70d03e3d212 100644 --- a/contracts/utils/Address.sol +++ b/contracts/utils/Address.sol @@ -111,11 +111,7 @@ library Address { * * _Available since v3.1._ */ - function functionCallWithValue( - address target, - bytes memory data, - uint256 value - ) internal returns (bytes memory) { + function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } diff --git a/contracts/utils/Checkpoints.sol b/contracts/utils/Checkpoints.sol index 942acb92e0a..0e0a136a0d7 100644 --- a/contracts/utils/Checkpoints.sol +++ b/contracts/utils/Checkpoints.sol @@ -104,15 +104,9 @@ library Checkpoints { * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value * in the most recent checkpoint. */ - function latestCheckpoint(History storage self) - internal - view - returns ( - bool exists, - uint32 _blockNumber, - uint224 _value - ) - { + function latestCheckpoint( + History storage self + ) internal view returns (bool exists, uint32 _blockNumber, uint224 _value) { uint256 pos = self._checkpoints.length; if (pos == 0) { return (false, 0, 0); @@ -133,11 +127,7 @@ library Checkpoints { * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint, * or by updating the last one. */ - function _insert( - Checkpoint[] storage self, - uint32 key, - uint224 value - ) private returns (uint224, uint224) { + function _insert(Checkpoint[] storage self, uint32 key, uint224 value) private returns (uint224, uint224) { uint256 pos = self.length; if (pos > 0) { @@ -230,11 +220,7 @@ library Checkpoints { * * Returns previous value and new value. */ - function push( - Trace224 storage self, - uint32 key, - uint224 value - ) internal returns (uint224, uint224) { + function push(Trace224 storage self, uint32 key, uint224 value) internal returns (uint224, uint224) { return _insert(self._checkpoints, key, value); } @@ -268,15 +254,7 @@ library Checkpoints { * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value * in the most recent checkpoint. */ - function latestCheckpoint(Trace224 storage self) - internal - view - returns ( - bool exists, - uint32 _key, - uint224 _value - ) - { + function latestCheckpoint(Trace224 storage self) internal view returns (bool exists, uint32 _key, uint224 _value) { uint256 pos = self._checkpoints.length; if (pos == 0) { return (false, 0, 0); @@ -297,11 +275,7 @@ library Checkpoints { * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint, * or by updating the last one. */ - function _insert( - Checkpoint224[] storage self, - uint32 key, - uint224 value - ) private returns (uint224, uint224) { + function _insert(Checkpoint224[] storage self, uint32 key, uint224 value) private returns (uint224, uint224) { uint256 pos = self.length; if (pos > 0) { @@ -373,11 +347,10 @@ library Checkpoints { /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ - function _unsafeAccess(Checkpoint224[] storage self, uint256 pos) - private - pure - returns (Checkpoint224 storage result) - { + function _unsafeAccess( + Checkpoint224[] storage self, + uint256 pos + ) private pure returns (Checkpoint224 storage result) { assembly { mstore(0, self.slot) result.slot := add(keccak256(0, 0x20), pos) @@ -398,11 +371,7 @@ library Checkpoints { * * Returns previous value and new value. */ - function push( - Trace160 storage self, - uint96 key, - uint160 value - ) internal returns (uint160, uint160) { + function push(Trace160 storage self, uint96 key, uint160 value) internal returns (uint160, uint160) { return _insert(self._checkpoints, key, value); } @@ -436,15 +405,7 @@ library Checkpoints { * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value * in the most recent checkpoint. */ - function latestCheckpoint(Trace160 storage self) - internal - view - returns ( - bool exists, - uint96 _key, - uint160 _value - ) - { + function latestCheckpoint(Trace160 storage self) internal view returns (bool exists, uint96 _key, uint160 _value) { uint256 pos = self._checkpoints.length; if (pos == 0) { return (false, 0, 0); @@ -465,11 +426,7 @@ library Checkpoints { * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint, * or by updating the last one. */ - function _insert( - Checkpoint160[] storage self, - uint96 key, - uint160 value - ) private returns (uint160, uint160) { + function _insert(Checkpoint160[] storage self, uint96 key, uint160 value) private returns (uint160, uint160) { uint256 pos = self.length; if (pos > 0) { @@ -541,11 +498,10 @@ library Checkpoints { /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ - function _unsafeAccess(Checkpoint160[] storage self, uint256 pos) - private - pure - returns (Checkpoint160 storage result) - { + function _unsafeAccess( + Checkpoint160[] storage self, + uint256 pos + ) private pure returns (Checkpoint160 storage result) { assembly { mstore(0, self.slot) result.slot := add(keccak256(0, 0x20), pos) diff --git a/contracts/utils/Create2.sol b/contracts/utils/Create2.sol index 8df86d66999..2255a4df8b7 100644 --- a/contracts/utils/Create2.sol +++ b/contracts/utils/Create2.sol @@ -27,11 +27,7 @@ library Create2 { * - the factory must have a balance of at least `amount`. * - if `amount` is non-zero, `bytecode` must have a `payable` constructor. */ - function deploy( - uint256 amount, - bytes32 salt, - bytes memory bytecode - ) internal returns (address addr) { + function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) { require(address(this).balance >= amount, "Create2: insufficient balance"); require(bytecode.length != 0, "Create2: bytecode length is zero"); /// @solidity memory-safe-assembly @@ -53,11 +49,7 @@ library Create2 { * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}. */ - function computeAddress( - bytes32 salt, - bytes32 bytecodeHash, - address deployer - ) internal pure returns (address addr) { + function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) // Get free memory pointer diff --git a/contracts/utils/cryptography/ECDSA.sol b/contracts/utils/cryptography/ECDSA.sol index 4b1d66b092d..3f996520efd 100644 --- a/contracts/utils/cryptography/ECDSA.sol +++ b/contracts/utils/cryptography/ECDSA.sol @@ -98,11 +98,7 @@ library ECDSA { * * _Available since v4.3._ */ - function tryRecover( - bytes32 hash, - bytes32 r, - bytes32 vs - ) internal pure returns (address, RecoverError) { + function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); @@ -113,11 +109,7 @@ library ECDSA { * * _Available since v4.2._ */ - function recover( - bytes32 hash, - bytes32 r, - bytes32 vs - ) internal pure returns (address) { + function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; @@ -129,12 +121,7 @@ library ECDSA { * * _Available since v4.3._ */ - function tryRecover( - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s - ) internal pure returns (address, RecoverError) { + function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most @@ -161,12 +148,7 @@ library ECDSA { * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ - function recover( - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s - ) internal pure returns (address) { + function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; diff --git a/contracts/utils/cryptography/MerkleProof.sol b/contracts/utils/cryptography/MerkleProof.sol index 47c60eb0118..0ce87faf283 100644 --- a/contracts/utils/cryptography/MerkleProof.sol +++ b/contracts/utils/cryptography/MerkleProof.sol @@ -24,11 +24,7 @@ library MerkleProof { * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ - function verify( - bytes32[] memory proof, - bytes32 root, - bytes32 leaf - ) internal pure returns (bool) { + function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } @@ -37,11 +33,7 @@ library MerkleProof { * * _Available since v4.7._ */ - function verifyCalldata( - bytes32[] calldata proof, - bytes32 root, - bytes32 leaf - ) internal pure returns (bool) { + function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } diff --git a/contracts/utils/cryptography/SignatureChecker.sol b/contracts/utils/cryptography/SignatureChecker.sol index 77fe98282bf..e06778debd7 100644 --- a/contracts/utils/cryptography/SignatureChecker.sol +++ b/contracts/utils/cryptography/SignatureChecker.sol @@ -21,11 +21,7 @@ library SignatureChecker { * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ - function isValidSignatureNow( - address signer, - bytes32 hash, - bytes memory signature - ) internal view returns (bool) { + function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) { (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature); if (error == ECDSA.RecoverError.NoError && recovered == signer) { return true; diff --git a/contracts/utils/introspection/ERC165Checker.sol b/contracts/utils/introspection/ERC165Checker.sol index 4c5fe2092df..40ffd68f73f 100644 --- a/contracts/utils/introspection/ERC165Checker.sol +++ b/contracts/utils/introspection/ERC165Checker.sol @@ -48,11 +48,10 @@ library ERC165Checker { * * _Available since v3.4._ */ - function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) - internal - view - returns (bool[] memory) - { + function getSupportedInterfaces( + address account, + bytes4[] memory interfaceIds + ) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're supported or not bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length); diff --git a/contracts/utils/introspection/ERC1820Implementer.sol b/contracts/utils/introspection/ERC1820Implementer.sol index 1b5139658bd..ac5a884c02a 100644 --- a/contracts/utils/introspection/ERC1820Implementer.sol +++ b/contracts/utils/introspection/ERC1820Implementer.sol @@ -21,13 +21,10 @@ contract ERC1820Implementer is IERC1820Implementer { /** * @dev See {IERC1820Implementer-canImplementInterfaceForAddress}. */ - function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) - public - view - virtual - override - returns (bytes32) - { + function canImplementInterfaceForAddress( + bytes32 interfaceHash, + address account + ) public view virtual override returns (bytes32) { return _supportedInterfaces[interfaceHash][account] ? _ERC1820_ACCEPT_MAGIC : bytes32(0x00); } diff --git a/contracts/utils/introspection/IERC1820Registry.sol b/contracts/utils/introspection/IERC1820Registry.sol index 42cf46a8ae8..a146bc2a68b 100644 --- a/contracts/utils/introspection/IERC1820Registry.sol +++ b/contracts/utils/introspection/IERC1820Registry.sol @@ -64,11 +64,7 @@ interface IERC1820Registry { * queried for support, unless `implementer` is the caller. See * {IERC1820Implementer-canImplementInterfaceForAddress}. */ - function setInterfaceImplementer( - address account, - bytes32 _interfaceHash, - address implementer - ) external; + function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external; /** * @dev Returns the implementer of `interfaceHash` for `account`. If no such diff --git a/contracts/utils/math/Math.sol b/contracts/utils/math/Math.sol index 0ed5460e05f..f3a83b0ffab 100644 --- a/contracts/utils/math/Math.sol +++ b/contracts/utils/math/Math.sol @@ -52,11 +52,7 @@ library Math { * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ - function mulDiv( - uint256 x, - uint256 y, - uint256 denominator - ) internal pure returns (uint256 result) { + function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 @@ -137,12 +133,7 @@ library Math { /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ - function mulDiv( - uint256 x, - uint256 y, - uint256 denominator, - Rounding rounding - ) internal pure returns (uint256) { + function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; @@ -258,31 +249,31 @@ library Math { function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { - if (value >= 10**64) { - value /= 10**64; + if (value >= 10 ** 64) { + value /= 10 ** 64; result += 64; } - if (value >= 10**32) { - value /= 10**32; + if (value >= 10 ** 32) { + value /= 10 ** 32; result += 32; } - if (value >= 10**16) { - value /= 10**16; + if (value >= 10 ** 16) { + value /= 10 ** 16; result += 16; } - if (value >= 10**8) { - value /= 10**8; + if (value >= 10 ** 8) { + value /= 10 ** 8; result += 8; } - if (value >= 10**4) { - value /= 10**4; + if (value >= 10 ** 4) { + value /= 10 ** 4; result += 4; } - if (value >= 10**2) { - value /= 10**2; + if (value >= 10 ** 2) { + value /= 10 ** 2; result += 2; } - if (value >= 10**1) { + if (value >= 10 ** 1) { result += 1; } } @@ -296,7 +287,7 @@ library Math { function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); - return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); + return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } diff --git a/contracts/utils/math/SafeMath.sol b/contracts/utils/math/SafeMath.sol index 550f0e779b1..2f48fb7360a 100644 --- a/contracts/utils/math/SafeMath.sol +++ b/contracts/utils/math/SafeMath.sol @@ -165,11 +165,7 @@ library SafeMath { * * - Subtraction cannot overflow. */ - function sub( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { + function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; @@ -188,11 +184,7 @@ library SafeMath { * * - The divisor cannot be zero. */ - function div( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { + function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; @@ -214,11 +206,7 @@ library SafeMath { * * - The divisor cannot be zero. */ - function mod( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { + function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; diff --git a/contracts/utils/structs/BitMaps.sol b/contracts/utils/structs/BitMaps.sol index a2ddc47098f..eb67bfab081 100644 --- a/contracts/utils/structs/BitMaps.sol +++ b/contracts/utils/structs/BitMaps.sol @@ -23,11 +23,7 @@ library BitMaps { /** * @dev Sets the bit at `index` to the boolean `value`. */ - function setTo( - BitMap storage bitmap, - uint256 index, - bool value - ) internal { + function setTo(BitMap storage bitmap, uint256 index, bool value) internal { if (value) { set(bitmap, index); } else { diff --git a/contracts/utils/structs/EnumerableMap.sol b/contracts/utils/structs/EnumerableMap.sol index a3fda61d802..d359671f461 100644 --- a/contracts/utils/structs/EnumerableMap.sol +++ b/contracts/utils/structs/EnumerableMap.sol @@ -70,11 +70,7 @@ library EnumerableMap { * Returns true if the key was added to the map, that is if it was not * already present. */ - function set( - Bytes32ToBytes32Map storage map, - bytes32 key, - bytes32 value - ) internal returns (bool) { + function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } @@ -173,11 +169,7 @@ library EnumerableMap { * Returns true if the key was added to the map, that is if it was not * already present. */ - function set( - UintToUintMap storage map, - uint256 key, - uint256 value - ) internal returns (bool) { + function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(value)); } @@ -244,11 +236,7 @@ library EnumerableMap { * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ - function get( - UintToUintMap storage map, - uint256 key, - string memory errorMessage - ) internal view returns (uint256) { + function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key), errorMessage)); } @@ -265,11 +253,7 @@ library EnumerableMap { * Returns true if the key was added to the map, that is if it was not * already present. */ - function set( - UintToAddressMap storage map, - uint256 key, - address value - ) internal returns (bool) { + function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } @@ -357,11 +341,7 @@ library EnumerableMap { * Returns true if the key was added to the map, that is if it was not * already present. */ - function set( - AddressToUintMap storage map, - address key, - uint256 value - ) internal returns (bool) { + function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } @@ -449,11 +429,7 @@ library EnumerableMap { * Returns true if the key was added to the map, that is if it was not * already present. */ - function set( - Bytes32ToUintMap storage map, - bytes32 key, - uint256 value - ) internal returns (bool) { + function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) { return set(map._inner, key, bytes32(value)); } diff --git a/contracts/vendor/amb/IAMB.sol b/contracts/vendor/amb/IAMB.sol index 1a5d7080f8b..73a2bd24bcb 100644 --- a/contracts/vendor/amb/IAMB.sol +++ b/contracts/vendor/amb/IAMB.sol @@ -31,17 +31,9 @@ interface IAMB { function failedMessageSender(bytes32 _messageId) external view returns (address); - function requireToPassMessage( - address _contract, - bytes calldata _data, - uint256 _gas - ) external returns (bytes32); - - function requireToConfirmMessage( - address _contract, - bytes calldata _data, - uint256 _gas - ) external returns (bytes32); + function requireToPassMessage(address _contract, bytes calldata _data, uint256 _gas) external returns (bytes32); + + function requireToConfirmMessage(address _contract, bytes calldata _data, uint256 _gas) external returns (bytes32); function sourceChainId() external view returns (uint256); diff --git a/contracts/vendor/arbitrum/IArbSys.sol b/contracts/vendor/arbitrum/IArbSys.sol index aac5dd53a9e..9b79d5c16a2 100644 --- a/contracts/vendor/arbitrum/IArbSys.sol +++ b/contracts/vendor/arbitrum/IArbSys.sol @@ -92,14 +92,7 @@ interface IArbSys { * @return root root hash of the send history * @return partials hashes of partial subtrees in the send history tree */ - function sendMerkleTreeState() - external - view - returns ( - uint256 size, - bytes32 root, - bytes32[] memory partials - ); + function sendMerkleTreeState() external view returns (uint256 size, bytes32 root, bytes32[] memory partials); /** * @notice creates a send txn from L2 to L1 diff --git a/contracts/vendor/arbitrum/IBridge.sol b/contracts/vendor/arbitrum/IBridge.sol index 7518f5d13cc..e71bedce012 100644 --- a/contracts/vendor/arbitrum/IBridge.sol +++ b/contracts/vendor/arbitrum/IBridge.sol @@ -77,14 +77,7 @@ interface IBridge { uint256 afterDelayedMessagesRead, uint256 prevMessageCount, uint256 newMessageCount - ) - external - returns ( - uint256 seqMessageIndex, - bytes32 beforeAcc, - bytes32 delayedAcc, - bytes32 acc - ); + ) external returns (uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 acc); /** * @dev Allows the sequencer inbox to submit a delayed message of the batchPostingReport type diff --git a/contracts/vendor/arbitrum/IOutbox.sol b/contracts/vendor/arbitrum/IOutbox.sol index 4f809dbf43e..22fa58f405a 100644 --- a/contracts/vendor/arbitrum/IOutbox.sol +++ b/contracts/vendor/arbitrum/IOutbox.sol @@ -113,9 +113,5 @@ interface IOutbox { bytes calldata data ) external pure returns (bytes32); - function calculateMerkleRoot( - bytes32[] memory proof, - uint256 path, - bytes32 item - ) external pure returns (bytes32); + function calculateMerkleRoot(bytes32[] memory proof, uint256 path, bytes32 item) external pure returns (bytes32); } diff --git a/contracts/vendor/optimism/ICrossDomainMessenger.sol b/contracts/vendor/optimism/ICrossDomainMessenger.sol index 9cc797701bf..cc01a48ab9a 100644 --- a/contracts/vendor/optimism/ICrossDomainMessenger.sol +++ b/contracts/vendor/optimism/ICrossDomainMessenger.sol @@ -30,9 +30,5 @@ interface ICrossDomainMessenger { * @param _message Message to send to the target. * @param _gasLimit Gas limit for the provided message. */ - function sendMessage( - address _target, - bytes calldata _message, - uint32 _gasLimit - ) external; + function sendMessage(address _target, bytes calldata _message, uint32 _gasLimit) external; } diff --git a/contracts/vendor/polygon/IFxMessageProcessor.sol b/contracts/vendor/polygon/IFxMessageProcessor.sol index 9f42eb64709..be73e6f53cd 100644 --- a/contracts/vendor/polygon/IFxMessageProcessor.sol +++ b/contracts/vendor/polygon/IFxMessageProcessor.sol @@ -3,9 +3,5 @@ pragma solidity ^0.8.0; interface IFxMessageProcessor { - function processMessageFromRoot( - uint256 stateId, - address rootMessageSender, - bytes calldata data - ) external; + function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external; } diff --git a/package-lock.json b/package-lock.json index 4463d1df4aa..c6a0aa03bf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "merkletreejs": "^0.2.13", "micromatch": "^4.0.2", "prettier": "^2.3.0", - "prettier-plugin-solidity": "^1.0.0-beta.16", + "prettier-plugin-solidity": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", "solhint": "^3.3.6", @@ -1836,9 +1836,9 @@ } }, "node_modules/@solidity-parser/parser": { - "version": "0.14.3", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.3.tgz", - "integrity": "sha512-29g2SZ29HtsqA58pLCtopI1P/cPy5/UAzlcAXO6T/CNJimG6yA8kx4NaseMyJULiC+TEs02Y9/yeHzClqoA0hw==", + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.5.tgz", + "integrity": "sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg==", "dev": true, "dependencies": { "antlr4ts": "^0.5.0-alpha.4" @@ -5893,9 +5893,9 @@ } }, "node_modules/emoji-regex": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.1.0.tgz", - "integrity": "sha512-xAEnNCT3w2Tg6MA7ly6QqYJvEoY1tm9iIjJ3yMKK9JPlWuRHAMoe5iETwQnx3M9TVbFMfsrBgWKR+IsmswwNjg==", + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.2.1.tgz", + "integrity": "sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==", "dev": true }, "node_modules/encodeurl": { @@ -11661,15 +11661,15 @@ } }, "node_modules/prettier-plugin-solidity": { - "version": "1.0.0-beta.24", - "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.24.tgz", - "integrity": "sha512-6JlV5BBTWzmDSq4kZ9PTXc3eLOX7DF5HpbqmmaF+kloyUwOZbJ12hIYsUaZh2fVgZdV2t0vWcvY6qhILhlzgqg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.1.0.tgz", + "integrity": "sha512-5gq0T49ifvXH/6x1STuKyWjTUgi6ICoV65yNtKlg/vZEvocFtSpByJOJICBfqPwNsnv4vhhWIqkLGSUJmWum2w==", "dev": true, "dependencies": { - "@solidity-parser/parser": "^0.14.3", - "emoji-regex": "^10.1.0", + "@solidity-parser/parser": "^0.14.5", + "emoji-regex": "^10.2.1", "escape-string-regexp": "^4.0.0", - "semver": "^7.3.7", + "semver": "^7.3.8", "solidity-comments-extractor": "^0.0.7", "string-width": "^4.2.3" }, @@ -11698,6 +11698,33 @@ "node": ">=8" } }, + "node_modules/prettier-plugin-solidity/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prettier-plugin-solidity/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/prettier-plugin-solidity/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -11730,6 +11757,12 @@ "node": ">=8" } }, + "node_modules/prettier-plugin-solidity/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -17585,9 +17618,9 @@ "dev": true }, "@solidity-parser/parser": { - "version": "0.14.3", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.3.tgz", - "integrity": "sha512-29g2SZ29HtsqA58pLCtopI1P/cPy5/UAzlcAXO6T/CNJimG6yA8kx4NaseMyJULiC+TEs02Y9/yeHzClqoA0hw==", + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.5.tgz", + "integrity": "sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg==", "dev": true, "requires": { "antlr4ts": "^0.5.0-alpha.4" @@ -20902,9 +20935,9 @@ } }, "emoji-regex": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.1.0.tgz", - "integrity": "sha512-xAEnNCT3w2Tg6MA7ly6QqYJvEoY1tm9iIjJ3yMKK9JPlWuRHAMoe5iETwQnx3M9TVbFMfsrBgWKR+IsmswwNjg==", + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.2.1.tgz", + "integrity": "sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==", "dev": true }, "encodeurl": { @@ -25432,15 +25465,15 @@ "dev": true }, "prettier-plugin-solidity": { - "version": "1.0.0-beta.24", - "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.24.tgz", - "integrity": "sha512-6JlV5BBTWzmDSq4kZ9PTXc3eLOX7DF5HpbqmmaF+kloyUwOZbJ12hIYsUaZh2fVgZdV2t0vWcvY6qhILhlzgqg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.1.0.tgz", + "integrity": "sha512-5gq0T49ifvXH/6x1STuKyWjTUgi6ICoV65yNtKlg/vZEvocFtSpByJOJICBfqPwNsnv4vhhWIqkLGSUJmWum2w==", "dev": true, "requires": { - "@solidity-parser/parser": "^0.14.3", - "emoji-regex": "^10.1.0", + "@solidity-parser/parser": "^0.14.5", + "emoji-regex": "^10.2.1", "escape-string-regexp": "^4.0.0", - "semver": "^7.3.7", + "semver": "^7.3.8", "solidity-comments-extractor": "^0.0.7", "string-width": "^4.2.3" }, @@ -25457,6 +25490,24 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -25484,6 +25535,12 @@ "requires": { "ansi-regex": "^5.0.1" } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } }, diff --git a/package.json b/package.json index 7ffdedcee50..4bc8f6e251e 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "merkletreejs": "^0.2.13", "micromatch": "^4.0.2", "prettier": "^2.3.0", - "prettier-plugin-solidity": "^1.0.0-beta.16", + "prettier-plugin-solidity": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", "solhint": "^3.3.6", diff --git a/test/utils/math/Math.t.sol b/test/utils/math/Math.t.sol index c1c6f447d3a..5542baf9d94 100644 --- a/test/utils/math/Math.t.sol +++ b/test/utils/math/Math.t.sol @@ -70,16 +70,16 @@ contract MathTest is Test { assertFalse(rounding == Math.Rounding.Up); assertTrue(_powerOf2Bigger(result + 1, input)); } else { - assertEq(2**result, input); + assertEq(2 ** result, input); } } function _powerOf2Bigger(uint256 value, uint256 ref) private pure returns (bool) { - return value >= 256 || 2**value > ref; // 2**256 overflows uint256 + return value >= 256 || 2 ** value > ref; // 2**256 overflows uint256 } function _powerOf2Smaller(uint256 value, uint256 ref) private pure returns (bool) { - return 2**value < ref; + return 2 ** value < ref; } // LOG10 @@ -97,16 +97,16 @@ contract MathTest is Test { assertFalse(rounding == Math.Rounding.Up); assertTrue(_powerOf10Bigger(result + 1, input)); } else { - assertEq(10**result, input); + assertEq(10 ** result, input); } } function _powerOf10Bigger(uint256 value, uint256 ref) private pure returns (bool) { - return value >= 78 || 10**value > ref; // 10**78 overflows uint256 + return value >= 78 || 10 ** value > ref; // 10**78 overflows uint256 } function _powerOf10Smaller(uint256 value, uint256 ref) private pure returns (bool) { - return 10**value < ref; + return 10 ** value < ref; } // LOG256 @@ -124,24 +124,20 @@ contract MathTest is Test { assertFalse(rounding == Math.Rounding.Up); assertTrue(_powerOf256Bigger(result + 1, input)); } else { - assertEq(256**result, input); + assertEq(256 ** result, input); } } function _powerOf256Bigger(uint256 value, uint256 ref) private pure returns (bool) { - return value >= 32 || 256**value > ref; // 256**32 overflows uint256 + return value >= 32 || 256 ** value > ref; // 256**32 overflows uint256 } function _powerOf256Smaller(uint256 value, uint256 ref) private pure returns (bool) { - return 256**value < ref; + return 256 ** value < ref; } // MULDIV - function testMulDiv( - uint256 x, - uint256 y, - uint256 d - ) public { + function testMulDiv(uint256 x, uint256 y, uint256 d) public { // Full precision for x * y (uint256 xyHi, uint256 xyLo) = _mulHighLow(x, y); @@ -163,11 +159,7 @@ contract MathTest is Test { assertEq(xyLo, qdRemLo); } - function testMulDivDomain( - uint256 x, - uint256 y, - uint256 d - ) public { + function testMulDivDomain(uint256 x, uint256 y, uint256 d) public { (uint256 xyHi, ) = _mulHighLow(x, y); // Violate {testMulDiv} assumption (covers d is 0 and result overflow) @@ -180,11 +172,7 @@ contract MathTest is Test { } // External call - function muldiv( - uint256 x, - uint256 y, - uint256 d - ) external pure returns (uint256) { + function muldiv(uint256 x, uint256 y, uint256 d) external pure returns (uint256) { return Math.mulDiv(x, y, d); } @@ -194,11 +182,7 @@ contract MathTest is Test { return Math.Rounding(r); } - function _mulmod( - uint256 x, - uint256 y, - uint256 z - ) private pure returns (uint256 r) { + function _mulmod(uint256 x, uint256 y, uint256 z) private pure returns (uint256 r) { assembly { r := mulmod(x, y, z) }