核心内容摘要
WaytoOPC社区官网上线了
权限控制主要类为Ownable和AccessControlAccessControl管理角色«interface»IAccessControl«abstract»AccessControl- _roles: mapping(bytes32 role RoleData)«abstract»Context«abstract»Ownable- address _ownerRoleData bytes32 adminRole hasRole:mapping(address account bool)Ownable包含修改器onlyOwnermodifieronlyOwner(){_checkOwner();_;}function_checkOwner()internal view virtual{if(owner()!_msgSender()){revertOwnableUnauthorizedAccount(_msgSender());}}AccessControl包含修改器onlyRolemodifieronlyRole(bytes32 role){_checkRole(role);_;}function_checkRole(bytes32 role)internal view virtual{_checkRole(role,_msgSender());}function_checkRole(bytes32 role,address account)internal view virtual{if(!hasRole(role,account)){revertAccessControlUnauthorizedAccount(account,role);}}