Merge pull request #673 from Shrugs/feat/solium
Solium Integration, Linting Refactorpull/677/head^2
commit
ec2f7ba8d1
@ -1,22 +1,12 @@ |
|||||||
{ |
{ |
||||||
"custom-rules-filename": null, |
"extends": "solium:all", |
||||||
|
"plugins": ["security"], |
||||||
"rules": { |
"rules": { |
||||||
"imports-on-top": true, |
"quotes": ["error", "double"], |
||||||
"variable-declarations": true, |
"indentation": ["error", 2], |
||||||
"array-declarations": true, |
"arg-overflow": ["warning", 3], |
||||||
"operator-whitespace": true, |
"security/enforce-explicit-visibility": ["error"], |
||||||
"lbrace": true, |
"security/no-block-members": ["warning"], |
||||||
"mixedcase": false, |
"security/no-inline-assembly": ["warning"] |
||||||
"camelcase": true, |
|
||||||
"uppercase": true, |
|
||||||
"no-with": true, |
|
||||||
"no-empty-blocks": true, |
|
||||||
"no-unused-vars": true, |
|
||||||
"double-quotes": true, |
|
||||||
"blank-lines": true, |
|
||||||
"indentation": true, |
|
||||||
"whitespace": true, |
|
||||||
"deprecated-suicide": true, |
|
||||||
"pragma-on-top": true |
|
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,69 +1,69 @@ |
|||||||
pragma solidity ^0.4.8; |
pragma solidity ^0.4.8; |
||||||
|
|
||||||
import '../ownership/rbac/RBAC.sol'; |
import "../ownership/rbac/RBAC.sol"; |
||||||
|
|
||||||
|
|
||||||
contract RBACMock is RBAC { |
contract RBACMock is RBAC { |
||||||
|
|
||||||
string constant ROLE_ADVISOR = "advisor"; |
string constant ROLE_ADVISOR = "advisor"; |
||||||
|
|
||||||
modifier onlyAdminOrAdvisor() |
modifier onlyAdminOrAdvisor() |
||||||
{ |
{ |
||||||
require( |
require( |
||||||
hasRole(msg.sender, ROLE_ADMIN) || |
hasRole(msg.sender, ROLE_ADMIN) || |
||||||
hasRole(msg.sender, ROLE_ADVISOR) |
hasRole(msg.sender, ROLE_ADVISOR) |
||||||
); |
); |
||||||
_; |
_; |
||||||
} |
} |
||||||
|
|
||||||
function RBACMock(address[] _advisors) |
function RBACMock(address[] _advisors) |
||||||
public |
public |
||||||
{ |
{ |
||||||
addRole(msg.sender, ROLE_ADVISOR); |
addRole(msg.sender, ROLE_ADVISOR); |
||||||
|
|
||||||
for (uint256 i = 0; i < _advisors.length; i++) { |
for (uint256 i = 0; i < _advisors.length; i++) { |
||||||
addRole(_advisors[i], ROLE_ADVISOR); |
addRole(_advisors[i], ROLE_ADVISOR); |
||||||
} |
|
||||||
} |
} |
||||||
|
} |
||||||
|
|
||||||
function onlyAdminsCanDoThis() |
function onlyAdminsCanDoThis() |
||||||
onlyAdmin |
onlyAdmin |
||||||
view |
view |
||||||
external |
external |
||||||
{ |
{ |
||||||
} |
} |
||||||
|
|
||||||
function onlyAdvisorsCanDoThis() |
function onlyAdvisorsCanDoThis() |
||||||
onlyRole(ROLE_ADVISOR) |
onlyRole(ROLE_ADVISOR) |
||||||
view |
view |
||||||
external |
external |
||||||
{ |
{ |
||||||
} |
} |
||||||
|
|
||||||
function eitherAdminOrAdvisorCanDoThis() |
function eitherAdminOrAdvisorCanDoThis() |
||||||
onlyAdminOrAdvisor |
onlyAdminOrAdvisor |
||||||
view |
view |
||||||
external |
external |
||||||
{ |
{ |
||||||
} |
} |
||||||
|
|
||||||
function nobodyCanDoThis() |
function nobodyCanDoThis() |
||||||
onlyRole("unknown") |
onlyRole("unknown") |
||||||
view |
view |
||||||
external |
external |
||||||
{ |
{ |
||||||
} |
} |
||||||
|
|
||||||
// admins can remove advisor's role |
// admins can remove advisor's role |
||||||
function removeAdvisor(address _addr) |
function removeAdvisor(address _addr) |
||||||
onlyAdmin |
onlyAdmin |
||||||
public |
public |
||||||
{ |
{ |
||||||
// revert if the user isn't an advisor |
// revert if the user isn't an advisor |
||||||
// (perhaps you want to soft-fail here instead?) |
// (perhaps you want to soft-fail here instead?) |
||||||
checkRole(_addr, ROLE_ADVISOR); |
checkRole(_addr, ROLE_ADVISOR); |
||||||
|
|
||||||
// remove the advisor's role |
// remove the advisor's role |
||||||
removeRole(_addr, ROLE_ADVISOR); |
removeRole(_addr, ROLE_ADVISOR); |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,21 +1,22 @@ |
|||||||
pragma solidity ^0.4.18; |
pragma solidity ^0.4.18; |
||||||
|
|
||||||
import './Ownable.sol'; |
import "./Ownable.sol"; |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* @title Contactable token |
* @title Contactable token |
||||||
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their |
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their |
||||||
* contact information. |
* contact information. |
||||||
*/ |
*/ |
||||||
contract Contactable is Ownable{ |
contract Contactable is Ownable { |
||||||
|
|
||||||
string public contactInformation; |
string public contactInformation; |
||||||
|
|
||||||
/** |
/** |
||||||
* @dev Allows the owner to set a string with their contact information. |
* @dev Allows the owner to set a string with their contact information. |
||||||
* @param info The contact information to attach to the contract. |
* @param info The contact information to attach to the contract. |
||||||
*/ |
*/ |
||||||
function setContactInformation(string info) onlyOwner public { |
function setContactInformation(string info) onlyOwner public { |
||||||
contactInformation = info; |
contactInformation = info; |
||||||
} |
} |
||||||
} |
} |
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue