Skip to content

Commit

Permalink
Improve encapsulation on ERC165 and update code style guide (OpenZepp…
Browse files Browse the repository at this point in the history
…elin#1379)

* use prefix underscore for internal state variables

* make _supportedInterfaces private
  • Loading branch information
ZumZoom authored and nventuro committed Oct 12, 2018
1 parent 9f82290 commit 03dfb29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CODE_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Any exception or additions specific to our project are documented below.
```
contract TestContract {
uint256 private _privateVar;
uint256 internal _internalVar;
}
```
Expand Down
2 changes: 1 addition & 1 deletion contracts/introspection/ERC165.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contracts/mocks/ERC165/ERC165InterfacesSupported.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,7 +41,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
view
returns (bool)
{
return supportedInterfaces[interfaceId];
return _supportedInterfaces[interfaceId];
}

/**
Expand All @@ -51,7 +51,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
internal
{
require(interfaceId != 0xffffffff);
supportedInterfaces[interfaceId] = true;
_supportedInterfaces[interfaceId] = true;
}
}

Expand Down

0 comments on commit 03dfb29

Please sign in to comment.