{ "contractName": "RBAC", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "name": "addr", "type": "address" }, { "indexed": false, "name": "roleName", "type": "string" } ], "name": "RoleAdded", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "addr", "type": "address" }, { "indexed": false, "name": "roleName", "type": "string" } ], "name": "RoleRemoved", "type": "event" }, { "constant": true, "inputs": [ { "name": "addr", "type": "address" }, { "name": "roleName", "type": "string" } ], "name": "checkRole", "outputs": [], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "addr", "type": "address" }, { "name": "roleName", "type": "string" } ], "name": "hasRole", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b50610321806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630988ca8c14610051578063217fe6c6146100da575b600080fd5b34801561005d57600080fd5b506100d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061017b565b005b3480156100e657600080fd5b50610161600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101fc565b604051808215151515815260200191505060405180910390f35b6101f8826000836040518082805190602001908083835b6020831015156101b75780518252602082019150602081019050602083039250610192565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902061028390919063ffffffff16565b5050565b600061027b836000846040518082805190602001908083835b60208310151561023a5780518252602082019150602081019050602083039250610215565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902061029c90919063ffffffff16565b905092915050565b61028d828261029c565b151561029857600080fd5b5050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050929150505600a165627a7a72305820dcb30cdb6200f124a4b0d91e3a8f8f8efa36df91917a18805ae38ab15f85ce940029", "deployedBytecode": "0x60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630988ca8c14610051578063217fe6c6146100da575b600080fd5b34801561005d57600080fd5b506100d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061017b565b005b3480156100e657600080fd5b50610161600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101fc565b604051808215151515815260200191505060405180910390f35b6101f8826000836040518082805190602001908083835b6020831015156101b75780518252602082019150602081019050602083039250610192565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902061028390919063ffffffff16565b5050565b600061027b836000846040518082805190602001908083835b60208310151561023a5780518252602082019150602081019050602083039250610215565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902061029c90919063ffffffff16565b905092915050565b61028d828261029c565b151561029857600080fd5b5050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050929150505600a165627a7a72305820dcb30cdb6200f124a4b0d91e3a8f8f8efa36df91917a18805ae38ab15f85ce940029", "sourceMap": "600:2135:26:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;600:2135:26;;;;;;;", "deployedSourceMap": "600:2135:26:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;941:110;;8:9:-1;5:2;;;30:1;27;20:12;5:2;941:110:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1189:132;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1189:132:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;941:110;1019:27;1041:4;1019:5;1025:8;1019:15;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1019:15:26;;;;;;;;;;;;;;;;;;;;;:21;;:27;;;;:::i;:::-;941:110;;:::o;1189:132::-;1270:4;1291:25;1311:4;1291:5;1297:8;1291:15;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1291:15:26;;;;;;;;;;;;;;;;;;;;;:19;;:25;;;;:::i;:::-;1284:32;;1189:132;;;;:::o;663:107:28:-;749:15;753:4;759;749:3;:15::i;:::-;741:24;;;;;;;;663:107;;:::o;848:124::-;929:4;950;:11;;:17;962:4;950:17;;;;;;;;;;;;;;;;;;;;;;;;;943:24;;848:124;;;;:::o", "source": "pragma solidity ^0.4.21;\n\nimport \"./Roles.sol\";\n\n\n/**\n * @title RBAC (Role-Based Access Control)\n * @author Matt Condon (@Shrugs)\n * @dev Stores and provides setters and getters for roles and addresses.\n * @dev Supports unlimited numbers of roles and addresses.\n * @dev See //contracts/mocks/RBACMock.sol for an example of usage.\n * This RBAC method uses strings to key roles. It may be beneficial\n * for you to write your own implementation of this interface using Enums or similar.\n * It's also recommended that you define constants in the contract, like ROLE_ADMIN below,\n * to avoid typos.\n */\ncontract RBAC {\n using Roles for Roles.Role;\n\n mapping (string => Roles.Role) private roles;\n\n event RoleAdded(address addr, string roleName);\n event RoleRemoved(address addr, string roleName);\n\n /**\n * @dev reverts if addr does not have role\n * @param addr address\n * @param roleName the name of the role\n * // reverts\n */\n function checkRole(address addr, string roleName)\n view\n public\n {\n roles[roleName].check(addr);\n }\n\n /**\n * @dev determine if addr has role\n * @param addr address\n * @param roleName the name of the role\n * @return bool\n */\n function hasRole(address addr, string roleName)\n view\n public\n returns (bool)\n {\n return roles[roleName].has(addr);\n }\n\n /**\n * @dev add a role to an address\n * @param addr address\n * @param roleName the name of the role\n */\n function addRole(address addr, string roleName)\n internal\n {\n roles[roleName].add(addr);\n emit RoleAdded(addr, roleName);\n }\n\n /**\n * @dev remove a role from an address\n * @param addr address\n * @param roleName the name of the role\n */\n function removeRole(address addr, string roleName)\n internal\n {\n roles[roleName].remove(addr);\n emit RoleRemoved(addr, roleName);\n }\n\n /**\n * @dev modifier to scope access to a single role (uses msg.sender as addr)\n * @param roleName the name of the role\n * // reverts\n */\n modifier onlyRole(string roleName)\n {\n checkRole(msg.sender, roleName);\n _;\n }\n\n /**\n * @dev modifier to scope access to a set of roles (uses msg.sender as addr)\n * @param roleNames the names of the roles to scope access to\n * // reverts\n *\n * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this\n * see: https://github.com/ethereum/solidity/issues/2467\n */\n // modifier onlyRoles(string[] roleNames) {\n // bool hasAnyRole = false;\n // for (uint8 i = 0; i < roleNames.length; i++) {\n // if (hasRole(msg.sender, roleNames[i])) {\n // hasAnyRole = true;\n // break;\n // }\n // }\n\n // require(hasAnyRole);\n\n // _;\n // }\n}\n", "sourcePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/ownership/rbac/RBAC.sol", "ast": { "absolutePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/ownership/rbac/RBAC.sol", "exportedSymbols": { "RBAC": [ 1687 ] }, "id": 1688, "nodeType": "SourceUnit", "nodes": [ { "id": 1582, "literals": [ "solidity", "^", "0.4", ".21" ], "nodeType": "PragmaDirective", "src": "0:24:26" }, { "absolutePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/ownership/rbac/Roles.sol", "file": "./Roles.sol", "id": 1583, "nodeType": "ImportDirective", "scope": 1688, "sourceUnit": 1825, "src": "26:21:26", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@title RBAC (Role-Based Access Control)\n@author Matt Condon (@Shrugs)\n@dev Stores and provides setters and getters for roles and addresses.\n@dev Supports unlimited numbers of roles and addresses.\n@dev See //contracts/mocks/RBACMock.sol for an example of usage.\nThis RBAC method uses strings to key roles. It may be beneficial\n for you to write your own implementation of this interface using Enums or similar.\nIt's also recommended that you define constants in the contract, like ROLE_ADMIN below,\n to avoid typos.", "fullyImplemented": true, "id": 1687, "linearizedBaseContracts": [ 1687 ], "name": "RBAC", "nodeType": "ContractDefinition", "nodes": [ { "id": 1586, "libraryName": { "contractScope": null, "id": 1584, "name": "Roles", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1824, "src": "624:5:26", "typeDescriptions": { "typeIdentifier": "t_contract$_Roles_$1824", "typeString": "library Roles" } }, "nodeType": "UsingForDirective", "src": "618:27:26", "typeName": { "contractScope": null, "id": 1585, "name": "Roles.Role", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1761, "src": "634:10:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage_ptr", "typeString": "struct Roles.Role" } } }, { "constant": false, "id": 1590, "name": "roles", "nodeType": "VariableDeclaration", "scope": 1687, "src": "649:44:26", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string => struct Roles.Role)" }, "typeName": { "id": 1589, "keyType": { "id": 1587, "name": "string", "nodeType": "ElementaryTypeName", "src": "658:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "nodeType": "Mapping", "src": "649:30:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string => struct Roles.Role)" }, "valueType": { "contractScope": null, "id": 1588, "name": "Roles.Role", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1761, "src": "668:10:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage_ptr", "typeString": "struct Roles.Role" } } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 1596, "name": "RoleAdded", "nodeType": "EventDefinition", "parameters": { "id": 1595, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1592, "indexed": false, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1596, "src": "714:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1591, "name": "address", "nodeType": "ElementaryTypeName", "src": "714:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1594, "indexed": false, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1596, "src": "728:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1593, "name": "string", "nodeType": "ElementaryTypeName", "src": "728:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "713:31:26" }, "src": "698:47:26" }, { "anonymous": false, "documentation": null, "id": 1602, "name": "RoleRemoved", "nodeType": "EventDefinition", "parameters": { "id": 1601, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1598, "indexed": false, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1602, "src": "766:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1597, "name": "address", "nodeType": "ElementaryTypeName", "src": "766:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1600, "indexed": false, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1602, "src": "780:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1599, "name": "string", "nodeType": "ElementaryTypeName", "src": "780:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "765:31:26" }, "src": "748:49:26" }, { "body": { "id": 1616, "nodeType": "Block", "src": "1013:38:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1613, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1604, "src": "1041:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1609, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1019:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1611, "indexExpression": { "argumentTypes": null, "id": 1610, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1606, "src": "1025:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1019:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1612, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "check", "nodeType": "MemberAccess", "referencedDeclaration": 1808, "src": "1019:21:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$__$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address) view" } }, "id": 1614, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1019:27:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1615, "nodeType": "ExpressionStatement", "src": "1019:27:26" } ] }, "documentation": "@dev reverts if addr does not have role\n@param addr address\n@param roleName the name of the role\n// reverts", "id": 1617, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "checkRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1607, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1604, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1617, "src": "960:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1603, "name": "address", "nodeType": "ElementaryTypeName", "src": "960:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1606, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1617, "src": "974:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1605, "name": "string", "nodeType": "ElementaryTypeName", "src": "974:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "959:31:26" }, "payable": false, "returnParameters": { "id": 1608, "nodeType": "ParameterList", "parameters": [], "src": "1013:0:26" }, "scope": 1687, "src": "941:110:26", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 1633, "nodeType": "Block", "src": "1278:43:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1630, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1619, "src": "1311:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1626, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1291:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1628, "indexExpression": { "argumentTypes": null, "id": 1627, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1621, "src": "1297:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1291:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1629, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "has", "nodeType": "MemberAccess", "referencedDeclaration": 1823, "src": "1291:19:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$_t_bool_$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address) view returns (bool)" } }, "id": 1631, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1291:25:26", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 1625, "id": 1632, "nodeType": "Return", "src": "1284:32:26" } ] }, "documentation": "@dev determine if addr has role\n@param addr address\n@param roleName the name of the role\n@return bool", "id": 1634, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "hasRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1622, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1619, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1634, "src": "1206:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1618, "name": "address", "nodeType": "ElementaryTypeName", "src": "1206:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1621, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1634, "src": "1220:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1620, "name": "string", "nodeType": "ElementaryTypeName", "src": "1220:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1205:31:26" }, "payable": false, "returnParameters": { "id": 1625, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1624, "name": "", "nodeType": "VariableDeclaration", "scope": 1634, "src": "1270:4:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 1623, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1270:4:26", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1269:6:26" }, "scope": 1687, "src": "1189:132:26", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 1653, "nodeType": "Block", "src": "1502:72:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1645, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1636, "src": "1528:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1641, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1508:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1643, "indexExpression": { "argumentTypes": null, "id": 1642, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1638, "src": "1514:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1508:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1644, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "add", "nodeType": "MemberAccess", "referencedDeclaration": 1777, "src": "1508:19:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$__$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address)" } }, "id": 1646, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1508:25:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1647, "nodeType": "ExpressionStatement", "src": "1508:25:26" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1649, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1636, "src": "1554:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 1650, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1638, "src": "1560:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 1648, "name": "RoleAdded", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1596, "src": "1544:9:26", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory)" } }, "id": 1651, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1544:25:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1652, "nodeType": "EmitStatement", "src": "1539:30:26" } ] }, "documentation": "@dev add a role to an address\n@param addr address\n@param roleName the name of the role", "id": 1654, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "addRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1639, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1636, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1654, "src": "1456:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1635, "name": "address", "nodeType": "ElementaryTypeName", "src": "1456:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1638, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1654, "src": "1470:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1637, "name": "string", "nodeType": "ElementaryTypeName", "src": "1470:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1455:31:26" }, "payable": false, "returnParameters": { "id": 1640, "nodeType": "ParameterList", "parameters": [], "src": "1502:0:26" }, "scope": 1687, "src": "1439:135:26", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 1673, "nodeType": "Block", "src": "1763:77:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1665, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1656, "src": "1792:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1661, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1769:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1663, "indexExpression": { "argumentTypes": null, "id": 1662, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1658, "src": "1775:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1769:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1664, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "remove", "nodeType": "MemberAccess", "referencedDeclaration": 1793, "src": "1769:22:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$__$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address)" } }, "id": 1666, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1769:28:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1667, "nodeType": "ExpressionStatement", "src": "1769:28:26" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1669, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1656, "src": "1820:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 1670, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1658, "src": "1826:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 1668, "name": "RoleRemoved", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1602, "src": "1808:11:26", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory)" } }, "id": 1671, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1808:27:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1672, "nodeType": "EmitStatement", "src": "1803:32:26" } ] }, "documentation": "@dev remove a role from an address\n@param addr address\n@param roleName the name of the role", "id": 1674, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "removeRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1659, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1656, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1674, "src": "1717:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1655, "name": "address", "nodeType": "ElementaryTypeName", "src": "1717:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1658, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1674, "src": "1731:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1657, "name": "string", "nodeType": "ElementaryTypeName", "src": "1731:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1716:31:26" }, "payable": false, "returnParameters": { "id": 1660, "nodeType": "ParameterList", "parameters": [], "src": "1763:0:26" }, "scope": 1687, "src": "1697:143:26", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 1685, "nodeType": "Block", "src": "2029:49:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1679, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4784, "src": "2045:3:26", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 1680, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2045:10:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 1681, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1676, "src": "2057:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 1678, "name": "checkRole", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1617, "src": "2035:9:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory) view" } }, "id": 1682, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2035:31:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1683, "nodeType": "ExpressionStatement", "src": "2035:31:26" }, { "id": 1684, "nodeType": "PlaceholderStatement", "src": "2072:1:26" } ] }, "documentation": "@dev modifier to scope access to a single role (uses msg.sender as addr)\n@param roleName the name of the role\n// reverts", "id": 1686, "name": "onlyRole", "nodeType": "ModifierDefinition", "parameters": { "id": 1677, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1676, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1686, "src": "2010:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1675, "name": "string", "nodeType": "ElementaryTypeName", "src": "2010:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "2009:17:26" }, "src": "1992:86:26", "visibility": "internal" } ], "scope": 1688, "src": "600:2135:26" } ], "src": "0:2736:26" }, "legacyAST": { "absolutePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/ownership/rbac/RBAC.sol", "exportedSymbols": { "RBAC": [ 1687 ] }, "id": 1688, "nodeType": "SourceUnit", "nodes": [ { "id": 1582, "literals": [ "solidity", "^", "0.4", ".21" ], "nodeType": "PragmaDirective", "src": "0:24:26" }, { "absolutePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/ownership/rbac/Roles.sol", "file": "./Roles.sol", "id": 1583, "nodeType": "ImportDirective", "scope": 1688, "sourceUnit": 1825, "src": "26:21:26", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@title RBAC (Role-Based Access Control)\n@author Matt Condon (@Shrugs)\n@dev Stores and provides setters and getters for roles and addresses.\n@dev Supports unlimited numbers of roles and addresses.\n@dev See //contracts/mocks/RBACMock.sol for an example of usage.\nThis RBAC method uses strings to key roles. It may be beneficial\n for you to write your own implementation of this interface using Enums or similar.\nIt's also recommended that you define constants in the contract, like ROLE_ADMIN below,\n to avoid typos.", "fullyImplemented": true, "id": 1687, "linearizedBaseContracts": [ 1687 ], "name": "RBAC", "nodeType": "ContractDefinition", "nodes": [ { "id": 1586, "libraryName": { "contractScope": null, "id": 1584, "name": "Roles", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1824, "src": "624:5:26", "typeDescriptions": { "typeIdentifier": "t_contract$_Roles_$1824", "typeString": "library Roles" } }, "nodeType": "UsingForDirective", "src": "618:27:26", "typeName": { "contractScope": null, "id": 1585, "name": "Roles.Role", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1761, "src": "634:10:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage_ptr", "typeString": "struct Roles.Role" } } }, { "constant": false, "id": 1590, "name": "roles", "nodeType": "VariableDeclaration", "scope": 1687, "src": "649:44:26", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string => struct Roles.Role)" }, "typeName": { "id": 1589, "keyType": { "id": 1587, "name": "string", "nodeType": "ElementaryTypeName", "src": "658:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "nodeType": "Mapping", "src": "649:30:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string => struct Roles.Role)" }, "valueType": { "contractScope": null, "id": 1588, "name": "Roles.Role", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1761, "src": "668:10:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage_ptr", "typeString": "struct Roles.Role" } } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 1596, "name": "RoleAdded", "nodeType": "EventDefinition", "parameters": { "id": 1595, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1592, "indexed": false, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1596, "src": "714:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1591, "name": "address", "nodeType": "ElementaryTypeName", "src": "714:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1594, "indexed": false, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1596, "src": "728:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1593, "name": "string", "nodeType": "ElementaryTypeName", "src": "728:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "713:31:26" }, "src": "698:47:26" }, { "anonymous": false, "documentation": null, "id": 1602, "name": "RoleRemoved", "nodeType": "EventDefinition", "parameters": { "id": 1601, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1598, "indexed": false, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1602, "src": "766:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1597, "name": "address", "nodeType": "ElementaryTypeName", "src": "766:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1600, "indexed": false, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1602, "src": "780:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1599, "name": "string", "nodeType": "ElementaryTypeName", "src": "780:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "765:31:26" }, "src": "748:49:26" }, { "body": { "id": 1616, "nodeType": "Block", "src": "1013:38:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1613, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1604, "src": "1041:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1609, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1019:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1611, "indexExpression": { "argumentTypes": null, "id": 1610, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1606, "src": "1025:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1019:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1612, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "check", "nodeType": "MemberAccess", "referencedDeclaration": 1808, "src": "1019:21:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$__$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address) view" } }, "id": 1614, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1019:27:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1615, "nodeType": "ExpressionStatement", "src": "1019:27:26" } ] }, "documentation": "@dev reverts if addr does not have role\n@param addr address\n@param roleName the name of the role\n// reverts", "id": 1617, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "checkRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1607, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1604, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1617, "src": "960:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1603, "name": "address", "nodeType": "ElementaryTypeName", "src": "960:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1606, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1617, "src": "974:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1605, "name": "string", "nodeType": "ElementaryTypeName", "src": "974:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "959:31:26" }, "payable": false, "returnParameters": { "id": 1608, "nodeType": "ParameterList", "parameters": [], "src": "1013:0:26" }, "scope": 1687, "src": "941:110:26", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 1633, "nodeType": "Block", "src": "1278:43:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1630, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1619, "src": "1311:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1626, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1291:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1628, "indexExpression": { "argumentTypes": null, "id": 1627, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1621, "src": "1297:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1291:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1629, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "has", "nodeType": "MemberAccess", "referencedDeclaration": 1823, "src": "1291:19:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$_t_bool_$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address) view returns (bool)" } }, "id": 1631, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1291:25:26", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 1625, "id": 1632, "nodeType": "Return", "src": "1284:32:26" } ] }, "documentation": "@dev determine if addr has role\n@param addr address\n@param roleName the name of the role\n@return bool", "id": 1634, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "hasRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1622, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1619, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1634, "src": "1206:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1618, "name": "address", "nodeType": "ElementaryTypeName", "src": "1206:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1621, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1634, "src": "1220:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1620, "name": "string", "nodeType": "ElementaryTypeName", "src": "1220:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1205:31:26" }, "payable": false, "returnParameters": { "id": 1625, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1624, "name": "", "nodeType": "VariableDeclaration", "scope": 1634, "src": "1270:4:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 1623, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1270:4:26", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1269:6:26" }, "scope": 1687, "src": "1189:132:26", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 1653, "nodeType": "Block", "src": "1502:72:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1645, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1636, "src": "1528:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1641, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1508:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1643, "indexExpression": { "argumentTypes": null, "id": 1642, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1638, "src": "1514:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1508:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1644, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "add", "nodeType": "MemberAccess", "referencedDeclaration": 1777, "src": "1508:19:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$__$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address)" } }, "id": 1646, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1508:25:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1647, "nodeType": "ExpressionStatement", "src": "1508:25:26" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1649, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1636, "src": "1554:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 1650, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1638, "src": "1560:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 1648, "name": "RoleAdded", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1596, "src": "1544:9:26", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory)" } }, "id": 1651, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1544:25:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1652, "nodeType": "EmitStatement", "src": "1539:30:26" } ] }, "documentation": "@dev add a role to an address\n@param addr address\n@param roleName the name of the role", "id": 1654, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "addRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1639, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1636, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1654, "src": "1456:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1635, "name": "address", "nodeType": "ElementaryTypeName", "src": "1456:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1638, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1654, "src": "1470:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1637, "name": "string", "nodeType": "ElementaryTypeName", "src": "1470:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1455:31:26" }, "payable": false, "returnParameters": { "id": 1640, "nodeType": "ParameterList", "parameters": [], "src": "1502:0:26" }, "scope": 1687, "src": "1439:135:26", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 1673, "nodeType": "Block", "src": "1763:77:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1665, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1656, "src": "1792:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 1661, "name": "roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1590, "src": "1769:5:26", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_string_memory_$_t_struct$_Role_$1761_storage_$", "typeString": "mapping(string memory => struct Roles.Role storage ref)" } }, "id": 1663, "indexExpression": { "argumentTypes": null, "id": 1662, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1658, "src": "1775:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1769:15:26", "typeDescriptions": { "typeIdentifier": "t_struct$_Role_$1761_storage", "typeString": "struct Roles.Role storage ref" } }, "id": 1664, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "remove", "nodeType": "MemberAccess", "referencedDeclaration": 1793, "src": "1769:22:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_Role_$1761_storage_ptr_$_t_address_$returns$__$bound_to$_t_struct$_Role_$1761_storage_ptr_$", "typeString": "function (struct Roles.Role storage pointer,address)" } }, "id": 1666, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1769:28:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1667, "nodeType": "ExpressionStatement", "src": "1769:28:26" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1669, "name": "addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1656, "src": "1820:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 1670, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1658, "src": "1826:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 1668, "name": "RoleRemoved", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1602, "src": "1808:11:26", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory)" } }, "id": 1671, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1808:27:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1672, "nodeType": "EmitStatement", "src": "1803:32:26" } ] }, "documentation": "@dev remove a role from an address\n@param addr address\n@param roleName the name of the role", "id": 1674, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "removeRole", "nodeType": "FunctionDefinition", "parameters": { "id": 1659, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1656, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1674, "src": "1717:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1655, "name": "address", "nodeType": "ElementaryTypeName", "src": "1717:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1658, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1674, "src": "1731:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1657, "name": "string", "nodeType": "ElementaryTypeName", "src": "1731:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1716:31:26" }, "payable": false, "returnParameters": { "id": 1660, "nodeType": "ParameterList", "parameters": [], "src": "1763:0:26" }, "scope": 1687, "src": "1697:143:26", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 1685, "nodeType": "Block", "src": "2029:49:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1679, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4784, "src": "2045:3:26", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 1680, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2045:10:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 1681, "name": "roleName", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1676, "src": "2057:8:26", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 1678, "name": "checkRole", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1617, "src": "2035:9:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory) view" } }, "id": 1682, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2035:31:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1683, "nodeType": "ExpressionStatement", "src": "2035:31:26" }, { "id": 1684, "nodeType": "PlaceholderStatement", "src": "2072:1:26" } ] }, "documentation": "@dev modifier to scope access to a single role (uses msg.sender as addr)\n@param roleName the name of the role\n// reverts", "id": 1686, "name": "onlyRole", "nodeType": "ModifierDefinition", "parameters": { "id": 1677, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1676, "name": "roleName", "nodeType": "VariableDeclaration", "scope": 1686, "src": "2010:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 1675, "name": "string", "nodeType": "ElementaryTypeName", "src": "2010:6:26", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "2009:17:26" }, "src": "1992:86:26", "visibility": "internal" } ], "scope": 1688, "src": "600:2135:26" } ], "src": "0:2736:26" }, "compiler": { "name": "solc", "version": "0.4.24+commit.e67f0147.Emscripten.clang" }, "networks": {}, "schemaVersion": "2.0.1", "updatedAt": "2018-08-23T14:35:50.631Z" }