UNPKG

@ethsub/sol

Version:
985 lines (984 loc) 353 kB
{ "contractName": "AccessControl", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } ], "name": "RoleRevoked", "type": "event" }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "hasRole", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" } ], "name": "getRoleMemberCount", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "uint256", "name": "index", "type": "uint256" } ], "name": "getRoleMember", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "getRoleMemberIndex", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" } ], "name": "getRoleAdmin", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" } ], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getRoleMemberIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Contract module that allows children to implement role-based access control mechanisms. Roles are referred to by their `bytes32` identifier. These should be exposed in the external API and be unique. The best way to achieve this is by using `public constant` hash digests: ``` bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\"); ``` Roles can be used to represent a set of permissions. To restrict access to a function call, use {hasRole}: ``` function foo() public { require(hasRole(MY_ROLE, msg.sender)); ... } ``` Roles can be granted and revoked dynamically via the {grantRole} and {revokeRole} functions. Each role has an associated admin role, and only accounts that have a role's admin role can call {grantRole} and {revokeRole}. By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means that only accounts with this role will be able to grant or revoke other roles. More complex role relationships can be created by using {_setRoleAdmin}. WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to grant and revoke this role. Extra precautions should be taken to secure accounts that have been granted it.\",\"events\":{\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"getRoleMemberIndex(bytes32,address)\":{\"details\":\"Returns the index of the account that have `role`.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/utils/AccessControl.sol\":\"AccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/GSN/Context.sol\":{\"keccak256\":\"0x9486045e189facd2e868ece35249872598ef03f1087fb6fa4d1161842daa2287\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://77c3a04ef8453788b14b1ebbc24dd3f0a18ceb2615cd156aac949a611e552af8\",\"dweb:/ipfs/QmcmqWGguRM3iLuF57tcyrN3F6EA63kzeNkDfQuteBnurr\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x28911e614500ae7c607a432a709d35da25f3bc5ddc8bd12b278b66358070c0ea\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://256c8c8af5eb072bc473226ab2b2187149b8fc04f5f4a4820db22527f5ce8e3c\",\"dweb:/ipfs/QmRvi5BhnL7Rxf85KrJhwM6RRhukm4tzoctRdgQEheNyiN\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ded47ec7c96750f9bd04bbbc84f659992d4ba901cb7b532a52cd468272cf378f\",\"dweb:/ipfs/QmfBrGtQP7rZEqEg6Wz6jh2N2Kukpj1z5v3CGWmAqrzm96\"]},\"@openzeppelin/contracts/utils/EnumerableSet.sol\":{\"keccak256\":\"0x1562cd9922fbf739edfb979f506809e2743789cbde3177515542161c3d04b164\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4580d57781513d98870d9738c7d39094336e0a70cdb90d68dad549c6ced466ec\",\"dweb:/ipfs/Qmf9YZzzRFuvMnav9dgmeRUpdYMMECiZX8w25sHWVbA18V\"]},\"project:/contracts/utils/AccessControl.sol\":{\"keccak256\":\"0x0188570bd646df63dd236b997edf12d2e5a566d9fd54b9405c67c6d7eeca353e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://eaa8a02b8fda3d9a50019cb96fec11cfb80b90250e37e91e0ec6cd945efa9810\",\"dweb:/ipfs/QmZ2nuod9fjYvsCjRr4Bhk6FTES4zsofxsQSDFS24JFaGq\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.6.12;\n\n// This is adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/access/AccessControl.sol\n// The only difference is added getRoleMemberIndex(bytes32 role, address account) function.\n\nimport \"@openzeppelin/contracts/utils/EnumerableSet.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\nimport \"@openzeppelin/contracts/GSN/Context.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context {\n using EnumerableSet for EnumerableSet.AddressSet;\n using Address for address;\n\n struct RoleData {\n EnumerableSet.AddressSet members;\n bytes32 adminRole;\n }\n\n mapping (bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view returns (bool) {\n return _roles[role].members.contains(account);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view returns (uint256) {\n return _roles[role].members.length();\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view returns (address) {\n return _roles[role].members.at(index);\n }\n\n /**\n * @dev Returns the index of the account that have `role`.\n */\n function getRoleMemberIndex(bytes32 role, address account) public view returns (uint256) {\n return _roles[role].members._inner._indexes[bytes32(uint256(account))];\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual {\n require(hasRole(_roles[role].adminRole, _msgSender()), \"AccessControl: sender must be an admin to grant\");\n\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual {\n require(hasRole(_roles[role].adminRole, _msgSender()), \"AccessControl: sender must be an admin to revoke\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n _roles[role].adminRole = adminRole;\n }\n\n function _grantRole(bytes32 role, address account) private {\n if (_roles[role].members.add(account)) {\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n function _revokeRole(bytes32 role, address account) private {\n if (_roles[role].members.remove(account)) {\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n", "sourcePath": "/home/sigo/w/deer/ethsub/packages/sol/contracts/utils/AccessControl.sol", "ast": { "absolutePath": "project:/contracts/utils/AccessControl.sol", "exportedSymbols": { "AccessControl": [ 10149 ] }, "id": 10150, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 9860, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "33:23:53" }, { "absolutePath": "@openzeppelin/contracts/utils/EnumerableSet.sol", "file": "@openzeppelin/contracts/utils/EnumerableSet.sol", "id": 9861, "nodeType": "ImportDirective", "scope": 10150, "sourceUnit": 5944, "src": "277:57:53", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/utils/Address.sol", "file": "@openzeppelin/contracts/utils/Address.sol", "id": 9862, "nodeType": "ImportDirective", "scope": 10150, "sourceUnit": 4819, "src": "335:51:53", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/GSN/Context.sol", "file": "@openzeppelin/contracts/GSN/Context.sol", "id": 9863, "nodeType": "ImportDirective", "scope": 10150, "sourceUnit": 3, "src": "387:49:53", "symbolAliases": [], "unitAlias": "" }, { "abstract": true, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 9865, "name": "Context", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "1750:7:53", "typeDescriptions": { "typeIdentifier": "t_contract$_Context_$4841", "typeString": "contract Context" } }, "id": 9866, "nodeType": "InheritanceSpecifier", "src": "1750:7:53" } ], "contractDependencies": [ 4841 ], "contractKind": "contract", "documentation": { "id": 9864, "nodeType": "StructuredDocumentation", "src": "438:1276:53", "text": " @dev Contract module that allows children to implement role-based access\n control mechanisms.\n Roles are referred to by their `bytes32` identifier. These should be exposed\n in the external API and be unique. The best way to achieve this is by\n using `public constant` hash digests:\n ```\n bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n ```\n Roles can be used to represent a set of permissions. To restrict access to a\n function call, use {hasRole}:\n ```\n function foo() public {\n require(hasRole(MY_ROLE, msg.sender));\n ...\n }\n ```\n Roles can be granted and revoked dynamically via the {grantRole} and\n {revokeRole} functions. Each role has an associated admin role, and only\n accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n that only accounts with this role will be able to grant or revoke other\n roles. More complex role relationships can be created by using\n {_setRoleAdmin}.\n WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n grant and revoke this role. Extra precautions should be taken to secure\n accounts that have been granted it." }, "fullyImplemented": true, "id": 10149, "linearizedBaseContracts": [ 10149, 4841 ], "name": "AccessControl", "nodeType": "ContractDefinition", "nodes": [ { "id": 9869, "libraryName": { "contractScope": null, "id": 9867, "name": "EnumerableSet", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5943, "src": "1770:13:53", "typeDescriptions": { "typeIdentifier": "t_contract$_EnumerableSet_$5943", "typeString": "library EnumerableSet" } }, "nodeType": "UsingForDirective", "src": "1764:49:53", "typeName": { "contractScope": null, "id": 9868, "name": "EnumerableSet.AddressSet", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5727, "src": "1788:24:53", "typeDescriptions": { "typeIdentifier": "t_struct$_AddressSet_$5727_storage_ptr", "typeString": "struct EnumerableSet.AddressSet" } } }, { "id": 9872, "libraryName": { "contractScope": null, "id": 9870, "name": "Address", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4818, "src": "1824:7:53", "typeDescriptions": { "typeIdentifier": "t_contract$_Address_$4818", "typeString": "library Address" } }, "nodeType": "UsingForDirective", "src": "1818:26:53", "typeName": { "id": 9871, "name": "address", "nodeType": "ElementaryTypeName", "src": "1836:7:53", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } }, { "canonicalName": "AccessControl.RoleData", "id": 9877, "members": [ { "constant": false, "id": 9874, "mutability": "mutable", "name": "members", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9877, "src": "1876:32:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_AddressSet_$5727_storage_ptr", "typeString": "struct EnumerableSet.AddressSet" }, "typeName": { "contractScope": null, "id": 9873, "name": "EnumerableSet.AddressSet", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5727, "src": "1876:24:53", "typeDescriptions": { "typeIdentifier": "t_struct$_AddressSet_$5727_storage_ptr", "typeString": "struct EnumerableSet.AddressSet" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9876, "mutability": "mutable", "name": "adminRole", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9877, "src": "1918:17:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 9875, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1918:7:53", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "name": "RoleData", "nodeType": "StructDefinition", "scope": 10149, "src": "1850:92:53", "visibility": "public" }, { "constant": false, "id": 9881, "mutability": "mutable", "name": "_roles", "nodeType": "VariableDeclaration", "overrides": null, "scope": 10149, "src": "1948:44:53", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_RoleData_$9877_storage_$", "typeString": "mapping(bytes32 => struct AccessControl.RoleData)" }, "typeName": { "id": 9880, "keyType": { "id": 9878, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1957:7:53", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "1948:29:53", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_RoleData_$9877_storage_$", "typeString": "mapping(bytes32 => struct AccessControl.RoleData)" }, "valueType": { "contractScope": null, "id": 9879, "name": "RoleData", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 9877, "src": "1968:8:53", "typeDescriptions": { "typeIdentifier": "t_struct$_RoleData_$9877_storage_ptr", "typeString": "struct AccessControl.RoleData" } } }, "value": null, "visibility": "private" }, { "constant": true, "functionSelector": "a217fddf", "id": 9884, "mutability": "constant", "name": "DEFAULT_ADMIN_ROLE", "nodeType": "VariableDeclaration", "overrides": null, "scope": 10149, "src": "1999:49:53", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 9882, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1999:7:53", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": { "argumentTypes": null, "hexValue": "30783030", "id": 9883, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2044:4:53", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0x00" }, "visibility": "public" }, { "anonymous": false, "documentation": { "id": 9885, "nodeType": "StructuredDocumentation", "src": "2055:198:53", "text": " @dev Emitted when `account` is granted `role`.\n `sender` is the account that originated the contract call, an admin role\n bearer except when using {_setupRole}." }, "id": 9893, "name": "RoleGranted", "nodeType": "EventDefinition", "parameters": { "id": 9892, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9887, "indexed": true, "mutability": "mutable", "name": "role", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9893, "src": "2276:20:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 9886, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "2276:7:53", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9889, "indexed": true, "mutability": "mutable", "name": "account", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9893, "src": "2298:23:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9888, "name": "address", "nodeType": "ElementaryTypeName", "src": "2298:7:53", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9891, "indexed": true, "mutability": "mutable", "name": "sender", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9893, "src": "2323:22:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9890, "name": "address", "nodeType": "ElementaryTypeName", "src": "2323:7:53", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2275:71:53" }, "src": "2258:89:53" }, { "anonymous": false, "documentation": { "id": 9894, "nodeType": "StructuredDocumentation", "src": "2353:275:53", "text": " @dev Emitted when `account` is revoked `role`.\n `sender` is the account that originated the contract call:\n - if using `revokeRole`, it is the admin role bearer\n - if using `renounceRole`, it is the role bearer (i.e. `account`)" }, "id": 9902, "name": "RoleRevoked", "nodeType": "EventDefinition", "parameters": { "id": 9901, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9896, "indexed": true, "mutability": "mutable", "name": "role", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9902, "src": "2651:20:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 9895, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "2651:7:53", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9898, "indexed": true, "mutability": "mutable", "name": "account", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9902, "src": "2673:23:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9897, "name": "address", "nodeType": "ElementaryTypeName", "src": "2673:7:53", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9900, "indexed": true, "mutability": "mutable", "name": "sender", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9902, "src": "2698:22:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9899, "name": "address", "nodeType": "ElementaryTypeName", "src": "2698:7:53", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2650:71:53" }, "src": "2633:89:53" }, { "body": { "id": 9920, "nodeType": "Block", "src": "2884:62:53", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 9917, "name": "account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9907, "src": "2931:7:53", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 9912, "name": "_roles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9881, "src": "2901:6:53", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_RoleData_$9877_storage_$", "typeString": "mapping(bytes32 => struct AccessControl.RoleData storage ref)" } }, "id": 9914, "indexExpression": { "argumentTypes": null, "id": 9913, "name": "role", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9905, "src": "2908:4:53", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2901:12:53", "typeDescriptions": { "typeIdentifier": "t_struct$_RoleData_$9877_storage", "typeString": "struct AccessControl.RoleData storage ref" } }, "id": 9915, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "members", "nodeType": "MemberAccess", "referencedDeclaration": 9874, "src": "2901:20:53", "typeDescriptions": { "typeIdentifier": "t_struct$_AddressSet_$5727_storage", "typeString": "struct EnumerableSet.AddressSet storage ref" } }, "id": 9916, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "contains", "nodeType": "MemberAccess", "referencedDeclaration": 5805, "src": "2901:29:53", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_struct$_AddressSet_$5727_storage_ptr_$_t_address_$returns$_t_bool_$bound_to$_t_struct$_AddressSet_$5727_storage_ptr_$", "typeString": "function (struct EnumerableSet.AddressSet storage pointer,address) view returns (bool)" } }, "id": 9918, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2901:38:53", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 9911, "id": 9919, "nodeType": "Return", "src": "2894:45:53" } ] }, "documentation": { "id": 9903, "nodeType": "StructuredDocumentation", "src": "2728:76:53", "text": " @dev Returns `true` if `account` has been granted `role`." }, "functionSelector": "91d14854", "id": 9921, "implemented": true, "kind": "function", "modifiers": [], "name": "hasRole", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 9908, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9905, "mutability": "mutable", "name": "role", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9921, "src": "2826:12:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 9904, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "2826:7:53", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9907, "mutability": "mutable", "name": "account", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9921, "src": "2840:15:53", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9906, "name": "address", "nodeType": "ElementaryTypeName", "src": "2840:7:53", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2825:31:53" }, "returnParameters": { "id": 9911, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9910, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration",