From 106be12909f8b0d76df47d1d7d137d9f368d32e4 Mon Sep 17 00:00:00 2001 From: zemse Date: Wed, 28 Oct 2020 09:37:24 +0530 Subject: [PATCH] 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. --- contracts/introspection/IERC1820Registry.sol | 4 ++-- contracts/payment/PaymentSplitter.sol | 6 +++--- contracts/payment/escrow/RefundEscrow.sol | 8 ++++---- contracts/proxy/TransparentUpgradeableProxy.sol | 4 ++-- contracts/token/ERC1155/ERC1155.sol | 4 ++-- contracts/token/ERC20/ERC20.sol | 6 +++--- contracts/token/ERC20/ERC20Capped.sol | 6 +++--- contracts/token/ERC20/TokenTimelock.sol | 10 +++++----- contracts/token/ERC721/ERC721.sol | 6 +++--- contracts/token/ERC777/ERC777.sol | 12 ++++++------ 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/contracts/introspection/IERC1820Registry.sol b/contracts/introspection/IERC1820Registry.sol index cd9bd5b4e0e..cc163f6e330 100644 --- a/contracts/introspection/IERC1820Registry.sol +++ b/contracts/introspection/IERC1820Registry.sol @@ -59,7 +59,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 @@ -70,7 +70,7 @@ interface IERC1820Registry { * * `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 diff --git a/contracts/payment/PaymentSplitter.sol b/contracts/payment/PaymentSplitter.sol index e23df3530b6..fb05cb9a6e5 100644 --- a/contracts/payment/PaymentSplitter.sol +++ b/contracts/payment/PaymentSplitter.sol @@ -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 * 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 - 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"); for (uint256 i = 0; i < payees.length; i++) { - _addPayee(payees[i], shares[i]); + _addPayee(payees[i], shares_[i]); } } diff --git a/contracts/payment/escrow/RefundEscrow.sol b/contracts/payment/escrow/RefundEscrow.sol index 07108423135..a0bd53be042 100644 --- a/contracts/payment/escrow/RefundEscrow.sol +++ b/contracts/payment/escrow/RefundEscrow.sol @@ -25,11 +25,11 @@ contract RefundEscrow is ConditionalEscrow { /** * @dev Constructor. - * @param beneficiary The beneficiary of the deposits. + * @param beneficiary_ The beneficiary of the deposits. */ - constructor (address payable beneficiary) { - require(beneficiary != address(0), "RefundEscrow: beneficiary is the zero address"); - _beneficiary = beneficiary; + constructor (address payable beneficiary_) { + require(beneficiary_ != address(0), "RefundEscrow: beneficiary is the zero address"); + _beneficiary = beneficiary_; _state = State.Active; } diff --git a/contracts/proxy/TransparentUpgradeableProxy.sol b/contracts/proxy/TransparentUpgradeableProxy.sol index eb0387dee03..247571b05cb 100644 --- a/contracts/proxy/TransparentUpgradeableProxy.sol +++ b/contracts/proxy/TransparentUpgradeableProxy.sol @@ -30,9 +30,9 @@ contract TransparentUpgradeableProxy is UpgradeableProxy { * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * 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)); - _setAdmin(_admin); + _setAdmin(admin_); } /** diff --git a/contracts/token/ERC1155/ERC1155.sol b/contracts/token/ERC1155/ERC1155.sol index b17d7939c30..1ecc394a6b0 100644 --- a/contracts/token/ERC1155/ERC1155.sol +++ b/contracts/token/ERC1155/ERC1155.sol @@ -52,8 +52,8 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { /** * @dev See {_setURI}. */ - constructor (string memory uri) { - _setURI(uri); + constructor (string memory uri_) { + _setURI(uri_); // register the supported interfaces to conform to ERC1155 via ERC165 _registerInterface(_INTERFACE_ID_ERC1155); diff --git a/contracts/token/ERC20/ERC20.sol b/contracts/token/ERC20/ERC20.sol index 3b9ad938819..35b897137fe 100644 --- a/contracts/token/ERC20/ERC20.sol +++ b/contracts/token/ERC20/ERC20.sol @@ -54,9 +54,9 @@ contract ERC20 is Context, IERC20 { * All three of these values are immutable: they can only be set once during * construction. */ - constructor (string memory name, string memory symbol) { - _name = name; - _symbol = symbol; + constructor (string memory name_, string memory symbol_) { + _name = name_; + _symbol = symbol_; _decimals = 18; } diff --git a/contracts/token/ERC20/ERC20Capped.sol b/contracts/token/ERC20/ERC20Capped.sol index 0dae5ae7423..dc7797025cd 100644 --- a/contracts/token/ERC20/ERC20Capped.sol +++ b/contracts/token/ERC20/ERC20Capped.sol @@ -16,9 +16,9 @@ abstract contract ERC20Capped is ERC20 { * @dev Sets the value of the `cap`. This value is immutable, it can only be * set once during construction. */ - constructor (uint256 cap) { - require(cap > 0, "ERC20Capped: cap is 0"); - _cap = cap; + constructor (uint256 cap_) { + require(cap_ > 0, "ERC20Capped: cap is 0"); + _cap = cap_; } /** diff --git a/contracts/token/ERC20/TokenTimelock.sol b/contracts/token/ERC20/TokenTimelock.sol index cecaff579d8..42d29e0ce1a 100644 --- a/contracts/token/ERC20/TokenTimelock.sol +++ b/contracts/token/ERC20/TokenTimelock.sol @@ -23,12 +23,12 @@ contract TokenTimelock { // timestamp when token release is enabled 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 - require(releaseTime > block.timestamp, "TokenTimelock: release time is before current time"); - _token = token; - _beneficiary = beneficiary; - _releaseTime = releaseTime; + require(releaseTime_ > block.timestamp, "TokenTimelock: release time is before current time"); + _token = token_; + _beneficiary = beneficiary_; + _releaseTime = releaseTime_; } /** diff --git a/contracts/token/ERC721/ERC721.sol b/contracts/token/ERC721/ERC721.sol index ada2baf24d4..cd84ac71550 100644 --- a/contracts/token/ERC721/ERC721.sol +++ b/contracts/token/ERC721/ERC721.sol @@ -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. */ - constructor (string memory name, string memory symbol) { - _name = name; - _symbol = symbol; + constructor (string memory name_, string memory symbol_) { + _name = name_; + _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); diff --git a/contracts/token/ERC777/ERC777.sol b/contracts/token/ERC777/ERC777.sol index a781c2e97e0..38d271ed42d 100644 --- a/contracts/token/ERC777/ERC777.sol +++ b/contracts/token/ERC777/ERC777.sol @@ -67,14 +67,14 @@ contract ERC777 is Context, IERC777, IERC20 { * @dev `defaultOperators` may be an empty array. */ constructor( - string memory name, - string memory symbol, - address[] memory defaultOperators + string memory name_, + string memory symbol_, + address[] memory defaultOperators_ ) { - _name = name; - _symbol = symbol; + _name = name_; + _symbol = symbol_; - _defaultOperatorsArray = defaultOperators; + _defaultOperatorsArray = defaultOperators_; for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) { _defaultOperators[_defaultOperatorsArray[i]] = true; }