Skip to content

Commit ba1a870

Browse files
committed
fix: use underscore for private variables (C4 QA)
1 parent a42bcbc commit ba1a870

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

contracts/governance/Controller.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import "./Pausable.sol";
1414
*/
1515
contract Controller is Governed, Pausable, IController {
1616
/// @dev Track contract ids to contract proxy address
17-
mapping(bytes32 => address) private registry;
17+
mapping(bytes32 => address) private _registry;
1818

1919
/// Emitted when the proxy address for a protocol contract has been set
2020
event SetContractProxy(bytes32 indexed id, address contractAddress);
@@ -59,7 +59,7 @@ contract Controller is Governed, Pausable, IController {
5959
onlyGovernor
6060
{
6161
require(_contractAddress != address(0), "Contract address must be set");
62-
registry[_id] = _contractAddress;
62+
_registry[_id] = _contractAddress;
6363
emit SetContractProxy(_id, _contractAddress);
6464
}
6565

@@ -68,7 +68,7 @@ contract Controller is Governed, Pausable, IController {
6868
* @param _id Contract id (keccak256 hash of contract name)
6969
*/
7070
function unsetContractProxy(bytes32 _id) external override onlyGovernor {
71-
registry[_id] = address(0);
71+
_registry[_id] = address(0);
7272
emit SetContractProxy(_id, address(0));
7373
}
7474

@@ -78,7 +78,7 @@ contract Controller is Governed, Pausable, IController {
7878
* @return Address of the proxy contract for the provided id
7979
*/
8080
function getContractProxy(bytes32 _id) public view override returns (address) {
81-
return registry[_id];
81+
return _registry[_id];
8282
}
8383

8484
/**
@@ -88,7 +88,7 @@ contract Controller is Governed, Pausable, IController {
8888
*/
8989
function updateController(bytes32 _id, address _controller) external override onlyGovernor {
9090
require(_controller != address(0), "Controller must be set");
91-
return IManaged(registry[_id]).setController(_controller);
91+
return IManaged(_registry[_id]).setController(_controller);
9292
}
9393

9494
// -- Pausing --

contracts/governance/Managed.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ contract Managed is IManaged {
2828
/// Controller that contract is registered with
2929
IController public controller;
3030
/// @dev Cache for the addresses of the contracts retrieved from the controller
31-
mapping(bytes32 => address) private addressCache;
31+
mapping(bytes32 => address) private _addressCache;
3232
/// @dev Gap for future storage variables
3333
uint256[10] private __gap;
3434

@@ -195,7 +195,7 @@ contract Managed is IManaged {
195195
* @return Address of the contract
196196
*/
197197
function _resolveContract(bytes32 _nameHash) internal view returns (address) {
198-
address contractAddress = addressCache[_nameHash];
198+
address contractAddress = _addressCache[_nameHash];
199199
if (contractAddress == address(0)) {
200200
contractAddress = controller.getContractProxy(_nameHash);
201201
}
@@ -209,8 +209,8 @@ contract Managed is IManaged {
209209
function _syncContract(string memory _name) internal {
210210
bytes32 nameHash = keccak256(abi.encodePacked(_name));
211211
address contractAddress = controller.getContractProxy(nameHash);
212-
if (addressCache[nameHash] != contractAddress) {
213-
addressCache[nameHash] = contractAddress;
212+
if (_addressCache[nameHash] != contractAddress) {
213+
_addressCache[nameHash] = contractAddress;
214214
emit ContractSynced(nameHash, contractAddress);
215215
}
216216
}

0 commit comments

Comments
 (0)