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

* use prefix underscore for internal state variables

* make _supportedInterfaces private

(cherry picked from commit 03dfb2965c)
This commit is contained in:
Mikhail Melnik
2018-10-13 01:13:36 +03:00
committed by Leo Arias
parent 10a5864fdf
commit 2c40ffa011
3 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,7 @@ contract ERC165 is IERC165 {
/**
* @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

View File

@ -21,7 +21,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
/**
* @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
@ -41,7 +41,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
view
returns (bool)
{
return supportedInterfaces[interfaceId];
return _supportedInterfaces[interfaceId];
}
/**
@ -51,7 +51,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
internal
{
require(interfaceId != 0xffffffff);
supportedInterfaces[interfaceId] = true;
_supportedInterfaces[interfaceId] = true;
}
}