Unverified Commit 0f55c185 by soham Committed by GitHub

Fix/solc 0.7.4 warnings #2391 (#2396)

* Fix unnamed return variable warning

This commit fixes warnings thrown by the solc 0.7.4 compiler:
"Warning: Unnamed return variable can remain unassigned. Add an explicit
return with value to all non-reverting code paths or name the variable."

* Fix function state mutability warning

This commit fixes warnings thrown by the solc 0.7.4 compiler:
"Warning: Function state mutability can be restricted to pure"

* Fix shadows an existing declaration warning

This commit fixes warnings thrown by the solc 0.7.4 compiler:
"Warning: This declaration shadows an existing declaration."

1. Arguments by default are not underscored.
2. If the name isn't available due to shadowing, use prefix underscore.
3. If prefix underscore isn't available due to shadowing, use suffix underscore.
parent 7650210a
...@@ -86,6 +86,8 @@ contract GSNRecipientERC20Fee is GSNRecipient { ...@@ -86,6 +86,8 @@ contract GSNRecipientERC20Fee is GSNRecipient {
// The maximum token charge is pre-charged from the user // The maximum token charge is pre-charged from the user
_token.safeTransferFrom(from, address(this), maxPossibleCharge); _token.safeTransferFrom(from, address(this), maxPossibleCharge);
return 0;
} }
/** /**
......
...@@ -59,7 +59,7 @@ interface IERC1820Registry { ...@@ -59,7 +59,7 @@ interface IERC1820Registry {
* queried for support, unless `implementer` is the caller. See * queried for support, unless `implementer` is the caller. See
* {IERC1820Implementer-canImplementInterfaceForAddress}. * {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 * @dev Returns the implementer of `interfaceHash` for `account`. If no such
...@@ -70,7 +70,7 @@ interface IERC1820Registry { ...@@ -70,7 +70,7 @@ interface IERC1820Registry {
* *
* `account` being the zero address is an alias for the caller's address. * `account` being the zero address is an alias for the caller's address.
*/ */
function getInterfaceImplementer(address account, bytes32 interfaceHash) external view returns (address); function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);
/** /**
* @dev Returns the interface hash for an `interfaceName`, as defined in the * @dev Returns the interface hash for an `interfaceName`, as defined in the
......
...@@ -13,7 +13,7 @@ contract GSNRecipientMock is ContextMock, GSNRecipient { ...@@ -13,7 +13,7 @@ contract GSNRecipientMock is ContextMock, GSNRecipient {
function acceptRelayedCall(address, address, bytes calldata, uint256, uint256, uint256, uint256, bytes calldata, uint256) function acceptRelayedCall(address, address, bytes calldata, uint256, uint256, uint256, uint256, bytes calldata, uint256)
external external
view pure
override override
returns (uint256, bytes memory) returns (uint256, bytes memory)
{ {
......
...@@ -39,13 +39,13 @@ contract PaymentSplitter is Context { ...@@ -39,13 +39,13 @@ contract PaymentSplitter is Context {
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
* duplicates in `payees`. * duplicates in `payees`.
*/ */
constructor (address[] memory payees, uint256[] memory shares) payable { constructor (address[] memory payees, uint256[] memory shares_) payable {
// solhint-disable-next-line max-line-length // solhint-disable-next-line max-line-length
require(payees.length == shares.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees"); require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < payees.length; i++) { for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares[i]); _addPayee(payees[i], shares_[i]);
} }
} }
......
...@@ -25,11 +25,11 @@ contract RefundEscrow is ConditionalEscrow { ...@@ -25,11 +25,11 @@ contract RefundEscrow is ConditionalEscrow {
/** /**
* @dev Constructor. * @dev Constructor.
* @param beneficiary The beneficiary of the deposits. * @param beneficiary_ The beneficiary of the deposits.
*/ */
constructor (address payable beneficiary) { constructor (address payable beneficiary_) {
require(beneficiary != address(0), "RefundEscrow: beneficiary is the zero address"); require(beneficiary_ != address(0), "RefundEscrow: beneficiary is the zero address");
_beneficiary = beneficiary; _beneficiary = beneficiary_;
_state = State.Active; _state = State.Active;
} }
......
...@@ -30,9 +30,9 @@ contract TransparentUpgradeableProxy is UpgradeableProxy { ...@@ -30,9 +30,9 @@ contract TransparentUpgradeableProxy is UpgradeableProxy {
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}. * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/ */
constructor(address _logic, address _admin, bytes memory _data) payable UpgradeableProxy(_logic, _data) { constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(_admin); _setAdmin(admin_);
} }
/** /**
...@@ -67,8 +67,8 @@ contract TransparentUpgradeableProxy is UpgradeableProxy { ...@@ -67,8 +67,8 @@ contract TransparentUpgradeableProxy is UpgradeableProxy {
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/ */
function admin() external ifAdmin returns (address) { function admin() external ifAdmin returns (address admin_) {
return _admin(); admin_ = _admin();
} }
/** /**
...@@ -80,8 +80,8 @@ contract TransparentUpgradeableProxy is UpgradeableProxy { ...@@ -80,8 +80,8 @@ contract TransparentUpgradeableProxy is UpgradeableProxy {
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/ */
function implementation() external ifAdmin returns (address) { function implementation() external ifAdmin returns (address implementation_) {
return _implementation(); implementation_ = _implementation();
} }
/** /**
......
...@@ -52,8 +52,8 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { ...@@ -52,8 +52,8 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
/** /**
* @dev See {_setURI}. * @dev See {_setURI}.
*/ */
constructor (string memory uri) { constructor (string memory uri_) {
_setURI(uri); _setURI(uri_);
// register the supported interfaces to conform to ERC1155 via ERC165 // register the supported interfaces to conform to ERC1155 via ERC165
_registerInterface(_INTERFACE_ID_ERC1155); _registerInterface(_INTERFACE_ID_ERC1155);
......
...@@ -54,9 +54,9 @@ contract ERC20 is Context, IERC20 { ...@@ -54,9 +54,9 @@ contract ERC20 is Context, IERC20 {
* All three of these values are immutable: they can only be set once during * All three of these values are immutable: they can only be set once during
* construction. * construction.
*/ */
constructor (string memory name, string memory symbol) { constructor (string memory name_, string memory symbol_) {
_name = name; _name = name_;
_symbol = symbol; _symbol = symbol_;
_decimals = 18; _decimals = 18;
} }
......
...@@ -16,9 +16,9 @@ abstract contract ERC20Capped is ERC20 { ...@@ -16,9 +16,9 @@ abstract contract ERC20Capped is ERC20 {
* @dev Sets the value of the `cap`. This value is immutable, it can only be * @dev Sets the value of the `cap`. This value is immutable, it can only be
* set once during construction. * set once during construction.
*/ */
constructor (uint256 cap) { constructor (uint256 cap_) {
require(cap > 0, "ERC20Capped: cap is 0"); require(cap_ > 0, "ERC20Capped: cap is 0");
_cap = cap; _cap = cap_;
} }
/** /**
......
...@@ -23,12 +23,12 @@ contract TokenTimelock { ...@@ -23,12 +23,12 @@ contract TokenTimelock {
// timestamp when token release is enabled // timestamp when token release is enabled
uint256 private _releaseTime; uint256 private _releaseTime;
constructor (IERC20 token, address beneficiary, uint256 releaseTime) { constructor (IERC20 token_, address beneficiary_, uint256 releaseTime_) {
// solhint-disable-next-line not-rely-on-time // solhint-disable-next-line not-rely-on-time
require(releaseTime > block.timestamp, "TokenTimelock: release time is before current time"); require(releaseTime_ > block.timestamp, "TokenTimelock: release time is before current time");
_token = token; _token = token_;
_beneficiary = beneficiary; _beneficiary = beneficiary_;
_releaseTime = releaseTime; _releaseTime = releaseTime_;
} }
/** /**
......
...@@ -90,9 +90,9 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable ...@@ -90,9 +90,9 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
/** /**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/ */
constructor (string memory name, string memory symbol) { constructor (string memory name_, string memory symbol_) {
_name = name; _name = name_;
_symbol = symbol; _symbol = symbol_;
// register the supported interfaces to conform to ERC721 via ERC165 // register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721);
......
...@@ -67,14 +67,14 @@ contract ERC777 is Context, IERC777, IERC20 { ...@@ -67,14 +67,14 @@ contract ERC777 is Context, IERC777, IERC20 {
* @dev `defaultOperators` may be an empty array. * @dev `defaultOperators` may be an empty array.
*/ */
constructor( constructor(
string memory name, string memory name_,
string memory symbol, string memory symbol_,
address[] memory defaultOperators address[] memory defaultOperators_
) { ) {
_name = name; _name = name_;
_symbol = symbol; _symbol = symbol_;
_defaultOperatorsArray = defaultOperators; _defaultOperatorsArray = defaultOperators_;
for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) { for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) {
_defaultOperators[_defaultOperatorsArray[i]] = true; _defaultOperators[_defaultOperatorsArray[i]] = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment