* Updated code style to 4 spaces and 120 max characters per line. * Update contracts/token/ERC721/ERC721Pausable.sol Co-Authored-By: nventuro <nicolas.venturo@gmail.com> * Update contracts/token/ERC721/IERC721.sol Co-Authored-By: nventuro <nicolas.venturo@gmail.com>
41 lines
952 B
Solidity
41 lines
952 B
Solidity
pragma solidity ^0.4.24;
|
|
|
|
/**
|
|
* @title Roles
|
|
* @dev Library for managing addresses assigned to a Role.
|
|
*/
|
|
library Roles {
|
|
struct Role {
|
|
mapping (address => bool) bearer;
|
|
}
|
|
|
|
/**
|
|
* @dev give an account access to this role
|
|
*/
|
|
function add(Role storage role, address account) internal {
|
|
require(account != address(0));
|
|
require(!has(role, account));
|
|
|
|
role.bearer[account] = true;
|
|
}
|
|
|
|
/**
|
|
* @dev remove an account's access to this role
|
|
*/
|
|
function remove(Role storage role, address account) internal {
|
|
require(account != address(0));
|
|
require(has(role, account));
|
|
|
|
role.bearer[account] = false;
|
|
}
|
|
|
|
/**
|
|
* @dev check if an account has this role
|
|
* @return bool
|
|
*/
|
|
function has(Role storage role, address account) internal view returns (bool) {
|
|
require(account != address(0));
|
|
return role.bearer[account];
|
|
}
|
|
}
|