Skip to content

Commit

Permalink
contracts: fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo committed Apr 29, 2019
1 parent d13da00 commit 341c6c8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion contracts/kill_switch/base/IssuesRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract IssuesRegistry is AragonApp {
return issuesSeverity[entry];
}

function setSeverityFor(address entry, Severity severity) authP(SET_ENTRY_SEVERITY_ROLE, arr(entry, msg.sender)) public {
function setSeverityFor(address entry, Severity severity) public authP(SET_ENTRY_SEVERITY_ROLE, arr(entry, msg.sender)) {
issuesSeverity[entry] = severity;
emit SeveritySet(entry, severity, msg.sender);
}
Expand Down
26 changes: 18 additions & 8 deletions contracts/kill_switch/base/KillSwitch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ contract KillSwitch {
event IssuesRegistrySet(address issuesRegistry, address sender);
event ContractActionSet(address contractAddress, ContractAction action);

function setContractAction(address _contract, ContractAction _action) external;

function getContractAction(address _contract) public view returns (ContractAction) {
return contractActions[_contract];
}

function setContractAction(address _contract, ContractAction _action) external;

function isSeverityIgnored(address _contract, IssuesRegistry.Severity _severity) public view returns (bool);

function isContractIgnored(address _contract) public view returns (bool) {
Expand All @@ -32,20 +32,30 @@ contract KillSwitch {

function shouldDenyCallingContract(address _base, address _instance, address _sender, bytes _data, uint256 _value) public returns (bool) {
// if the call should not be evaluated, then allow given call
if (!_shouldEvaluateCall(_base, _instance, _sender, _data, _value)) return false;
if (!_shouldEvaluateCall(_base, _instance, _sender, _data, _value)) {
return false;
}

// if the call should be denied, then deny given call
if (isContractDenied(_base)) return true;
if (isContractDenied(_base)) {
return true;
}

// if the contract issues are ignored, then allow given call
if (isContractIgnored(_base)) return false;
if (isContractIgnored(_base)) {
return false;
}

// if the issues registry has not been set, then allow given call
if (issuesRegistry == address(0)) return false;
if (issuesRegistry == address(0)) {
return false;
}

// if the contract severity found is ignored, then allow given call
IssuesRegistry.Severity _severityFound = issuesRegistry.getSeverityFor(_base);
if (isSeverityIgnored(_base, _severityFound)) return false;
if (isSeverityIgnored(_base, _severityFound)) {
return false;
}

// if none of the conditions above were met, then deny given call
return true;
Expand All @@ -58,7 +68,7 @@ contract KillSwitch {
* block information, among many other options.
* @return Always true by default.
*/
function _shouldEvaluateCall(address /*_base*/, address /*_instance*/, address /*_sender*/, bytes /*_data*/, uint256 /*_value*/) internal returns (bool) {
function _shouldEvaluateCall(address, address, address, bytes, uint256) internal returns (bool) {
return true;
}

Expand Down
4 changes: 3 additions & 1 deletion contracts/kill_switch/kernel/KernelBinaryKillSwitch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import "../base/BinaryKillSwitch.sol";


contract KernelBinaryKillSwitch is KernelKillSwitch, BinaryKillSwitch {
constructor(bool _shouldPetrify) Kernel(_shouldPetrify) public {}
constructor(bool _shouldPetrify) Kernel(_shouldPetrify) public {
// solium-disable-previous-line no-empty-blocks
}

function setContractAction(address _contract, ContractAction _action)
external
Expand Down
2 changes: 1 addition & 1 deletion contracts/kill_switch/kernel/KernelKillSwitch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ contract KernelKillSwitch is Kernel, KillSwitch {
/* not correspond to the application call in this context. */
/**************************************************************************************************/

return super._shouldEvaluateCall(_base, _instance ,_sender, _data, _value);
return super._shouldEvaluateCall(_base, _instance, _sender, _data, _value);
}
}
4 changes: 3 additions & 1 deletion contracts/kill_switch/kernel/KernelSeveritiesKillSwitch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import "../base/SeveritiesKillSwitch.sol";


contract KernelSeveritiesKillSwitch is KernelKillSwitch, SeveritiesKillSwitch {
constructor(bool _shouldPetrify) Kernel(_shouldPetrify) public {}
constructor(bool _shouldPetrify) Kernel(_shouldPetrify) public {
// solium-disable-previous-line no-empty-blocks
}

function setContractAction(address _contract, ContractAction _action)
external
Expand Down

0 comments on commit 341c6c8

Please sign in to comment.