Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Prettier Solidity #3898

Merged
merged 5 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"files": "*.sol",
"options": {
"singleQuote": false,
"printWidth": 120,
"explicitTypes": "always"
"printWidth": 120
}
}
]
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* Reformatted codebase with latest version of Prettier Solidity. ([#3898](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3898))
ernestognw marked this conversation as resolved.
Show resolved Hide resolved
* `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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 1 addition & 5 deletions contracts/finance/VestingWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 9 additions & 18 deletions contracts/governance/Governor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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)) {
Expand Down Expand Up @@ -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");
}
Expand All @@ -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;
}

Expand Down
20 changes: 3 additions & 17 deletions contracts/governance/TimelockController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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;
}

Expand Down
17 changes: 10 additions & 7 deletions contracts/governance/compatibility/GovernorCompatibilityBravo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 3 additions & 10 deletions contracts/governance/extensions/GovernorCountingSimple.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 1 addition & 5 deletions contracts/governance/extensions/GovernorSettings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 1 addition & 8 deletions contracts/governance/utils/IVotes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 2 additions & 10 deletions contracts/governance/utils/Votes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down
25 changes: 4 additions & 21 deletions contracts/interfaces/IERC1363.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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);
}
6 changes: 1 addition & 5 deletions contracts/interfaces/IERC1363Spender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
8 changes: 4 additions & 4 deletions contracts/interfaces/IERC2981.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
12 changes: 2 additions & 10 deletions contracts/interfaces/IERC4626.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Loading