From b2e2d9ab1cd96967a49de514a67dfd628c8b7cf5 Mon Sep 17 00:00:00 2001 From: Matt Condon Date: Mon, 15 Jan 2018 15:33:17 -0500 Subject: [PATCH] fix: solium errors - indentation only --- contracts/mocks/RBACMock.sol | 106 ++++++------ contracts/ownership/Contactable.sol | 16 +- contracts/ownership/rbac/RBAC.sol | 246 ++++++++++++++-------------- contracts/ownership/rbac/Roles.sol | 80 ++++----- contracts/token/BurnableToken.sol | 28 ++-- 5 files changed, 238 insertions(+), 238 deletions(-) diff --git a/contracts/mocks/RBACMock.sol b/contracts/mocks/RBACMock.sol index 02600ba72..f81e5ffc6 100644 --- a/contracts/mocks/RBACMock.sol +++ b/contracts/mocks/RBACMock.sol @@ -5,65 +5,65 @@ import "../ownership/rbac/RBAC.sol"; contract RBACMock is RBAC { - string constant ROLE_ADVISOR = "advisor"; + string constant ROLE_ADVISOR = "advisor"; - modifier onlyAdminOrAdvisor() - { - require( - hasRole(msg.sender, ROLE_ADMIN) || - hasRole(msg.sender, ROLE_ADVISOR) - ); - _; + modifier onlyAdminOrAdvisor() + { + require( + hasRole(msg.sender, ROLE_ADMIN) || + hasRole(msg.sender, ROLE_ADVISOR) + ); + _; + } + + function RBACMock(address[] _advisors) + public + { + addRole(msg.sender, ROLE_ADVISOR); + + for (uint256 i = 0; i < _advisors.length; i++) { + addRole(_advisors[i], ROLE_ADVISOR); } + } - function RBACMock(address[] _advisors) - public - { - addRole(msg.sender, ROLE_ADVISOR); + function onlyAdminsCanDoThis() + onlyAdmin + view + external + { + } - for (uint256 i = 0; i < _advisors.length; i++) { - addRole(_advisors[i], ROLE_ADVISOR); - } - } + function onlyAdvisorsCanDoThis() + onlyRole(ROLE_ADVISOR) + view + external + { + } - function onlyAdminsCanDoThis() - onlyAdmin - view - external - { - } + function eitherAdminOrAdvisorCanDoThis() + onlyAdminOrAdvisor + view + external + { + } - function onlyAdvisorsCanDoThis() - onlyRole(ROLE_ADVISOR) - view - external - { - } + function nobodyCanDoThis() + onlyRole("unknown") + view + external + { + } - function eitherAdminOrAdvisorCanDoThis() - onlyAdminOrAdvisor - view - external - { - } + // admins can remove advisor's role + function removeAdvisor(address _addr) + onlyAdmin + public + { + // revert if the user isn't an advisor + // (perhaps you want to soft-fail here instead?) + checkRole(_addr, ROLE_ADVISOR); - function nobodyCanDoThis() - onlyRole("unknown") - view - external - { - } - - // admins can remove advisor's role - function removeAdvisor(address _addr) - onlyAdmin - public - { - // revert if the user isn't an advisor - // (perhaps you want to soft-fail here instead?) - checkRole(_addr, ROLE_ADVISOR); - - // remove the advisor's role - removeRole(_addr, ROLE_ADVISOR); - } + // remove the advisor's role + removeRole(_addr, ROLE_ADVISOR); + } } diff --git a/contracts/ownership/Contactable.sol b/contracts/ownership/Contactable.sol index 8322f9bf5..293904a14 100644 --- a/contracts/ownership/Contactable.sol +++ b/contracts/ownership/Contactable.sol @@ -9,13 +9,13 @@ import "./Ownable.sol"; */ contract Contactable is Ownable{ - string public contactInformation; + string public contactInformation; - /** - * @dev Allows the owner to set a string with their contact information. - * @param info The contact information to attach to the contract. - */ - function setContactInformation(string info) onlyOwner public { - contactInformation = info; - } + /** + * @dev Allows the owner to set a string with their contact information. + * @param info The contact information to attach to the contract. + */ + function setContactInformation(string info) onlyOwner public { + contactInformation = info; + } } diff --git a/contracts/ownership/rbac/RBAC.sol b/contracts/ownership/rbac/RBAC.sol index 838539720..3a25737b8 100644 --- a/contracts/ownership/rbac/RBAC.sol +++ b/contracts/ownership/rbac/RBAC.sol @@ -15,143 +15,143 @@ import "./Roles.sol"; * to avoid typos. */ contract RBAC { - using Roles for Roles.Role; + using Roles for Roles.Role; - mapping (string => Roles.Role) private roles; + mapping (string => Roles.Role) private roles; - event RoleAdded(address addr, string roleName); - event RoleRemoved(address addr, string roleName); + event RoleAdded(address addr, string roleName); + event RoleRemoved(address addr, string roleName); - /** - * A constant role name for indicating admins. - */ - string public constant ROLE_ADMIN = "admin"; + /** + * A constant role name for indicating admins. + */ + string public constant ROLE_ADMIN = "admin"; - /** - * @dev constructor. Sets msg.sender as admin by default - */ - function RBAC() - public - { - addRole(msg.sender, ROLE_ADMIN); - } + /** + * @dev constructor. Sets msg.sender as admin by default + */ + function RBAC() + public + { + addRole(msg.sender, ROLE_ADMIN); + } - /** - * @dev add a role to an address - * @param addr address - * @param roleName the name of the role - */ - function addRole(address addr, string roleName) - internal - { - roles[roleName].add(addr); - RoleAdded(addr, roleName); - } + /** + * @dev add a role to an address + * @param addr address + * @param roleName the name of the role + */ + function addRole(address addr, string roleName) + internal + { + roles[roleName].add(addr); + RoleAdded(addr, roleName); + } - /** - * @dev remove a role from an address - * @param addr address - * @param roleName the name of the role - */ - function removeRole(address addr, string roleName) - internal - { - roles[roleName].remove(addr); - RoleRemoved(addr, roleName); - } + /** + * @dev remove a role from an address + * @param addr address + * @param roleName the name of the role + */ + function removeRole(address addr, string roleName) + internal + { + roles[roleName].remove(addr); + RoleRemoved(addr, roleName); + } - /** - * @dev reverts if addr does not have role - * @param addr address - * @param roleName the name of the role - * // reverts - */ - function checkRole(address addr, string roleName) - view - public - { - roles[roleName].check(addr); - } + /** + * @dev reverts if addr does not have role + * @param addr address + * @param roleName the name of the role + * // reverts + */ + function checkRole(address addr, string roleName) + view + public + { + roles[roleName].check(addr); + } - /** - * @dev determine if addr has role - * @param addr address - * @param roleName the name of the role - * @return bool - */ - function hasRole(address addr, string roleName) - view - public - returns (bool) - { - return roles[roleName].has(addr); - } + /** + * @dev determine if addr has role + * @param addr address + * @param roleName the name of the role + * @return bool + */ + function hasRole(address addr, string roleName) + view + public + returns (bool) + { + return roles[roleName].has(addr); + } - /** - * @dev add a role to an address - * @param addr address - * @param roleName the name of the role - */ - function adminAddRole(address addr, string roleName) - onlyAdmin - public - { - addRole(addr, roleName); - } + /** + * @dev add a role to an address + * @param addr address + * @param roleName the name of the role + */ + function adminAddRole(address addr, string roleName) + onlyAdmin + public + { + addRole(addr, roleName); + } - /** - * @dev remove a role from an address - * @param addr address - * @param roleName the name of the role - */ - function adminRemoveRole(address addr, string roleName) - onlyAdmin - public - { - removeRole(addr, roleName); - } + /** + * @dev remove a role from an address + * @param addr address + * @param roleName the name of the role + */ + function adminRemoveRole(address addr, string roleName) + onlyAdmin + public + { + removeRole(addr, roleName); + } - /** - * @dev modifier to scope access to a single role (uses msg.sender as addr) - * @param roleName the name of the role - * // reverts - */ - modifier onlyRole(string roleName) - { - checkRole(msg.sender, roleName); - _; - } + /** + * @dev modifier to scope access to a single role (uses msg.sender as addr) + * @param roleName the name of the role + * // reverts + */ + modifier onlyRole(string roleName) + { + checkRole(msg.sender, roleName); + _; + } - /** - * @dev modifier to scope access to admins - * // reverts - */ - modifier onlyAdmin() - { - checkRole(msg.sender, ROLE_ADMIN); - _; - } + /** + * @dev modifier to scope access to admins + * // reverts + */ + modifier onlyAdmin() + { + checkRole(msg.sender, ROLE_ADMIN); + _; + } - /** - * @dev modifier to scope access to a set of roles (uses msg.sender as addr) - * @param roleNames the names of the roles to scope access to - * // reverts - * - * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this - * see: https://github.com/ethereum/solidity/issues/2467 - */ - // modifier onlyRoles(string[] roleNames) { - // bool hasAnyRole = false; - // for (uint8 i = 0; i < roleNames.length; i++) { - // if (hasRole(msg.sender, roleNames[i])) { - // hasAnyRole = true; - // break; - // } - // } + /** + * @dev modifier to scope access to a set of roles (uses msg.sender as addr) + * @param roleNames the names of the roles to scope access to + * // reverts + * + * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this + * see: https://github.com/ethereum/solidity/issues/2467 + */ + // modifier onlyRoles(string[] roleNames) { + // bool hasAnyRole = false; + // for (uint8 i = 0; i < roleNames.length; i++) { + // if (hasRole(msg.sender, roleNames[i])) { + // hasAnyRole = true; + // break; + // } + // } - // require(hasAnyRole); + // require(hasAnyRole); - // _; - // } + // _; + // } } diff --git a/contracts/ownership/rbac/Roles.sol b/contracts/ownership/rbac/Roles.sol index 3ef7e2716..7651f095d 100644 --- a/contracts/ownership/rbac/Roles.sol +++ b/contracts/ownership/rbac/Roles.sol @@ -8,48 +8,48 @@ pragma solidity ^0.4.18; * See RBAC.sol for example usage. */ library Roles { - struct Role { - mapping (address => bool) bearer; - } + struct Role { + mapping (address => bool) bearer; + } - /** - * @dev give an address access to this role - */ - function add(Role storage role, address addr) - internal - { - role.bearer[addr] = true; - } + /** + * @dev give an address access to this role + */ + function add(Role storage role, address addr) + internal + { + role.bearer[addr] = true; + } - /** - * @dev remove an address' access to this role - */ - function remove(Role storage role, address addr) - internal - { - role.bearer[addr] = false; - } + /** + * @dev remove an address' access to this role + */ + function remove(Role storage role, address addr) + internal + { + role.bearer[addr] = false; + } - /** - * @dev check if an address has this role - * // reverts - */ - function check(Role storage role, address addr) - view - internal - { - require(has(role, addr)); - } + /** + * @dev check if an address has this role + * // reverts + */ + function check(Role storage role, address addr) + view + internal + { + require(has(role, addr)); + } - /** - * @dev check if an address has this role - * @return bool - */ - function has(Role storage role, address addr) - view - internal - returns (bool) - { - return role.bearer[addr]; - } + /** + * @dev check if an address has this role + * @return bool + */ + function has(Role storage role, address addr) + view + internal + returns (bool) + { + return role.bearer[addr]; + } } diff --git a/contracts/token/BurnableToken.sol b/contracts/token/BurnableToken.sol index 9abee5925..ea915761a 100644 --- a/contracts/token/BurnableToken.sol +++ b/contracts/token/BurnableToken.sol @@ -8,20 +8,20 @@ import "./BasicToken.sol"; */ contract BurnableToken is BasicToken { - event Burn(address indexed burner, uint256 value); + event Burn(address indexed burner, uint256 value); - /** - * @dev Burns a specific amount of tokens. - * @param _value The amount of token to be burned. - */ - function burn(uint256 _value) public { - require(_value <= balances[msg.sender]); - // no need to require value <= totalSupply, since that would imply the - // sender's balance is greater than the totalSupply, which *should* be an assertion failure + /** + * @dev Burns a specific amount of tokens. + * @param _value The amount of token to be burned. + */ + function burn(uint256 _value) public { + require(_value <= balances[msg.sender]); + // no need to require value <= totalSupply, since that would imply the + // sender's balance is greater than the totalSupply, which *should* be an assertion failure - address burner = msg.sender; - balances[burner] = balances[burner].sub(_value); - totalSupply = totalSupply.sub(_value); - Burn(burner, _value); - } + address burner = msg.sender; + balances[burner] = balances[burner].sub(_value); + totalSupply = totalSupply.sub(_value); + Burn(burner, _value); + } }