Commit 03dfb296 by Mikhail Melnik Committed by Nicolás Venturo

Improve encapsulation on ERC165 and update code style guide (#1379)

* use prefix underscore for internal state variables

* make _supportedInterfaces private
parent 9f822906
...@@ -23,6 +23,7 @@ Any exception or additions specific to our project are documented below. ...@@ -23,6 +23,7 @@ Any exception or additions specific to our project are documented below.
``` ```
contract TestContract { contract TestContract {
uint256 private _privateVar; uint256 private _privateVar;
uint256 internal _internalVar;
} }
``` ```
......
...@@ -18,7 +18,7 @@ contract ERC165 is IERC165 { ...@@ -18,7 +18,7 @@ contract ERC165 is IERC165 {
/** /**
* @dev a mapping of interface id to whether or not it's supported * @dev a mapping of interface id to whether or not it's supported
*/ */
mapping(bytes4 => bool) internal _supportedInterfaces; mapping(bytes4 => bool) private _supportedInterfaces;
/** /**
* @dev A contract implementing SupportsInterfaceWithLookup * @dev A contract implementing SupportsInterfaceWithLookup
......
...@@ -21,7 +21,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 { ...@@ -21,7 +21,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
/** /**
* @dev a mapping of interface id to whether or not it's supported * @dev a mapping of interface id to whether or not it's supported
*/ */
mapping(bytes4 => bool) internal supportedInterfaces; mapping(bytes4 => bool) private _supportedInterfaces;
/** /**
* @dev A contract implementing SupportsInterfaceWithLookup * @dev A contract implementing SupportsInterfaceWithLookup
...@@ -41,7 +41,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 { ...@@ -41,7 +41,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
view view
returns (bool) returns (bool)
{ {
return supportedInterfaces[interfaceId]; return _supportedInterfaces[interfaceId];
} }
/** /**
...@@ -51,7 +51,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 { ...@@ -51,7 +51,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
internal internal
{ {
require(interfaceId != 0xffffffff); require(interfaceId != 0xffffffff);
supportedInterfaces[interfaceId] = true; _supportedInterfaces[interfaceId] = 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