@kollateral/kollateral-contracts
Version:
1,193 lines (1,192 loc) • 90.9 kB
JSON
{
"contractName": "Roles",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for managing addresses assigned to a Role.\",\"methods\":{},\"title\":\"Roles\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/access/Roles.sol\":\"Roles\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Roles.sol\":{\"keccak256\":\"0xb002c378d7b82a101bd659c341518953ca0919d342c0a400196982c0e7e7bcdb\",\"urls\":[\"bzz-raw://00a788c4631466c220b385bdd100c571d24b2deccd657615cfbcef6cadf669a4\",\"dweb:/ipfs/QmTEwDbjJNxmMNCDMqtuou3dyM8Wtp8Q9NFvn7SAVM7Jf3\"]}},\"version\":1}",
"bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820ca93773b5cb1cfc18c9b85c0a618eee51284272c09b916d2a2c48814643fd7e864736f6c63430005100032",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820ca93773b5cb1cfc18c9b85c0a618eee51284272c09b916d2a2c48814643fd7e864736f6c63430005100032",
"sourceMap": "108:873:14:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24",
"deployedSourceMap": "108:873:14:-;;;;;;;;",
"source": "pragma solidity ^0.5.0;\n\n/**\n * @title Roles\n * @dev Library for managing addresses assigned to a Role.\n */\nlibrary Roles {\n struct Role {\n mapping (address => bool) bearer;\n }\n\n /**\n * @dev Give an account access to this role.\n */\n function add(Role storage role, address account) internal {\n require(!has(role, account), \"Roles: account already has role\");\n role.bearer[account] = true;\n }\n\n /**\n * @dev Remove an account's access to this role.\n */\n function remove(Role storage role, address account) internal {\n require(has(role, account), \"Roles: account does not have role\");\n role.bearer[account] = false;\n }\n\n /**\n * @dev Check if an account has this role.\n * @return bool\n */\n function has(Role storage role, address account) internal view returns (bool) {\n require(account != address(0), \"Roles: account is the zero address\");\n return role.bearer[account];\n }\n}\n",
"sourcePath": "@openzeppelin/contracts/access/Roles.sol",
"ast": {
"absolutePath": "@openzeppelin/contracts/access/Roles.sol",
"exportedSymbols": {
"Roles": [
2521
]
},
"id": 2522,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 2442,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:14"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title Roles\n@dev Library for managing addresses assigned to a Role.",
"fullyImplemented": true,
"id": 2521,
"linearizedBaseContracts": [
2521
],
"name": "Roles",
"nodeType": "ContractDefinition",
"nodes": [
{
"canonicalName": "Roles.Role",
"id": 2447,
"members": [
{
"constant": false,
"id": 2446,
"name": "bearer",
"nodeType": "VariableDeclaration",
"scope": 2447,
"src": "150:32:14",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"typeName": {
"id": 2445,
"keyType": {
"id": 2443,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "159:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "150:25:14",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"valueType": {
"id": 2444,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "170:4:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
},
"value": null,
"visibility": "internal"
}
],
"name": "Role",
"nodeType": "StructDefinition",
"scope": 2521,
"src": "128:61:14",
"visibility": "public"
},
{
"body": {
"id": 2471,
"nodeType": "Block",
"src": "318:117:14",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 2459,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "!",
"prefix": true,
"src": "336:19:14",
"subExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 2456,
"name": "role",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2449,
"src": "341:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role storage pointer"
}
},
{
"argumentTypes": null,
"id": 2457,
"name": "account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2451,
"src": "347:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role storage pointer"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 2455,
"name": "has",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2520,
"src": "337:3:14",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_struct$_Role_$2447_storage_ptr_$_t_address_$returns$_t_bool_$",
"typeString": "function (struct Roles.Role storage pointer,address) view returns (bool)"
}
},
"id": 2458,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "337:18:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "526f6c65733a206163636f756e7420616c72656164792068617320726f6c65",
"id": 2460,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "357:33:14",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_0f76c3a3e97a37fcdff532c2741c10933ebf2b769d5475388e30ae4f7155f13a",
"typeString": "literal_string \"Roles: account already has role\""
},
"value": "Roles: account already has role"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_0f76c3a3e97a37fcdff532c2741c10933ebf2b769d5475388e30ae4f7155f13a",
"typeString": "literal_string \"Roles: account already has role\""
}
],
"id": 2454,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
3599,
3600
],
"referencedDeclaration": 3600,
"src": "328:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 2461,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "328:63:14",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 2462,
"nodeType": "ExpressionStatement",
"src": "328:63:14"
},
{
"expression": {
"argumentTypes": null,
"id": 2469,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 2463,
"name": "role",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2449,
"src": "401:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role storage pointer"
}
},
"id": 2466,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "bearer",
"nodeType": "MemberAccess",
"referencedDeclaration": 2446,
"src": "401:11:14",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
}
},
"id": 2467,
"indexExpression": {
"argumentTypes": null,
"id": 2465,
"name": "account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2451,
"src": "413:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "401:20:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 2468,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "424:4:14",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "401:27:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 2470,
"nodeType": "ExpressionStatement",
"src": "401:27:14"
}
]
},
"documentation": "@dev Give an account access to this role.",
"id": 2472,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "add",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 2452,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 2449,
"name": "role",
"nodeType": "VariableDeclaration",
"scope": 2472,
"src": "273:17:14",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role"
},
"typeName": {
"contractScope": null,
"id": 2448,
"name": "Role",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 2447,
"src": "273:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 2451,
"name": "account",
"nodeType": "VariableDeclaration",
"scope": 2472,
"src": "292:15:14",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2450,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "292:7:14",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "272:36:14"
},
"returnParameters": {
"id": 2453,
"nodeType": "ParameterList",
"parameters": [],
"src": "318:0:14"
},
"scope": 2521,
"src": "260:175:14",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 2495,
"nodeType": "Block",
"src": "571:119:14",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 2481,
"name": "role",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2474,
"src": "593:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role storage pointer"
}
},
{
"argumentTypes": null,
"id": 2482,
"name": "account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2476,
"src": "599:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role storage pointer"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 2480,
"name": "has",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2520,
"src": "589:3:14",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_struct$_Role_$2447_storage_ptr_$_t_address_$returns$_t_bool_$",
"typeString": "function (struct Roles.Role storage pointer,address) view returns (bool)"
}
},
"id": 2483,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "589:18:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65",
"id": 2484,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "609:35:14",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_7bd893145ac435f339bb7c288622d270324b7033b011f693aca172f5cbc3c257",
"typeString": "literal_string \"Roles: account does not have role\""
},
"value": "Roles: account does not have role"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_7bd893145ac435f339bb7c288622d270324b7033b011f693aca172f5cbc3c257",
"typeString": "literal_string \"Roles: account does not have role\""
}
],
"id": 2479,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
3599,
3600
],
"referencedDeclaration": 3600,
"src": "581:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 2485,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "581:64:14",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 2486,
"nodeType": "ExpressionStatement",
"src": "581:64:14"
},
{
"expression": {
"argumentTypes": null,
"id": 2493,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 2487,
"name": "role",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2474,
"src": "655:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role storage pointer"
}
},
"id": 2490,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "bearer",
"nodeType": "MemberAccess",
"referencedDeclaration": 2446,
"src": "655:11:14",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
}
},
"id": 2491,
"indexExpression": {
"argumentTypes": null,
"id": 2489,
"name": "account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2476,
"src": "667:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "655:20:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 2492,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "678:5:14",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"src": "655:28:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 2494,
"nodeType": "ExpressionStatement",
"src": "655:28:14"
}
]
},
"documentation": "@dev Remove an account's access to this role.",
"id": 2496,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "remove",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 2477,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 2474,
"name": "role",
"nodeType": "VariableDeclaration",
"scope": 2496,
"src": "526:17:14",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role"
},
"typeName": {
"contractScope": null,
"id": 2473,
"name": "Role",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 2447,
"src": "526:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 2476,
"name": "account",
"nodeType": "VariableDeclaration",
"scope": 2496,
"src": "545:15:14",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2475,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "545:7:14",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "525:36:14"
},
"returnParameters": {
"id": 2478,
"nodeType": "ParameterList",
"parameters": [],
"src": "571:0:14"
},
"scope": 2521,
"src": "510:180:14",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 2519,
"nodeType": "Block",
"src": "857:122:14",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 2510,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 2506,
"name": "account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2500,
"src": "875:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 2508,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "894:1:14",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 2507,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "886:7:14",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 2509,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "886:10:14",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "875:21:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373",
"id": 2511,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "898:36:14",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9d214fa89563f4e6456a3929327e54500ea1cde2c0ba9fb2035ec106190d682f",
"typeString": "literal_string \"Roles: account is the zero address\""
},
"value": "Roles: account is the zero address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_9d214fa89563f4e6456a3929327e54500ea1cde2c0ba9fb2035ec106190d682f",
"typeString": "literal_string \"Roles: account is the zero address\""
}
],
"id": 2505,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
3599,
3600
],
"referencedDeclaration": 3600,
"src": "867:7:14",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 2512,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "867:68:14",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 2513,
"nodeType": "ExpressionStatement",
"src": "867:68:14"
},
{
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 2514,
"name": "role",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2498,
"src": "952:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role storage pointer"
}
},
"id": 2515,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "bearer",
"nodeType": "MemberAccess",
"referencedDeclaration": 2446,
"src": "952:11:14",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
}
},
"id": 2517,
"indexExpression": {
"argumentTypes": null,
"id": 2516,
"name": "account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2500,
"src": "964:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "952:20:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 2504,
"id": 2518,
"nodeType": "Return",
"src": "945:27:14"
}
]
},
"documentation": "@dev Check if an account has this role.\n@return bool",
"id": 2520,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "has",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 2501,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 2498,
"name": "role",
"nodeType": "VariableDeclaration",
"scope": 2520,
"src": "792:17:14",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role"
},
"typeName": {
"contractScope": null,
"id": 2497,
"name": "Role",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 2447,
"src": "792:4:14",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Role_$2447_storage_ptr",
"typeString": "struct Roles.Role"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 2500,
"name": "account",
"nodeType": "VariableDeclaration",
"scope": 2520,
"src": "811:15:14",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2499,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "811:7:14",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "791:36:14"
},
"returnParameters": {
"id": 2504,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 2503,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 2520,
"src": "851:4:14",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 2502,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "851:4:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "850:6:14"
},
"scope": 2521,
"src": "779:200:14",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 2522,
"src": "108:873:14"
}
],
"src": "0:982:14"
},
"legacyAST": {
"absolutePath": "@openzeppelin/contracts/access/Roles.sol",
"exportedSymbols": {
"Roles": [
2521
]
},
"id": 2522,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 2442,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:14"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title Roles\n@dev Library for managing addresses assigned to a Role.",
"fullyImplemented": true,
"id": 2521,
"linearizedBaseContracts": [
2521
],
"name": "Roles",
"nodeType": "ContractDefinition",
"nodes": [
{
"canonicalName": "Roles.Role",
"id": 2447,
"members": [
{
"constant": false,
"id": 2446,
"name": "bearer",
"nodeType": "VariableDeclaration",
"scope": 2447,
"src": "150:32:14",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"typeName": {
"id": 2445,
"keyType": {
"id": 2443,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "159:7:14",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "150:25:14",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"valueType": {
"id": 2444,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "170:4:14",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
},
"value": null,
"visibility": "internal"
}
],
"name": "Role",
"nodeType": "StructDefinition",
"scope": 2521,
"src": "128:61:14",
"visibility": "public"
},
{
"body": {
"id": 2471,
"nodeType": "Block",
"src": "318:117:14",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 2459,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,