@@ -8,3 +8,35 @@ trait IAccessControl<TContractState> {
88 fn has_role (self : @ TContractState , role : RoleId , account : ContractAddress ) -> bool ;
99 fn get_role_admin (self : @ TContractState , role : RoleId ) -> RoleId ;
1010}
11+
12+ // An event that is emitted when `account` is granted `role`.
13+ // `sender` is the account that originated the contract call, an admin role
14+ // bearer (except if `_grant_role` is called during initialization from the constructor).
15+ #[derive(Copy , Drop , PartialEq , starknet:: Event )]
16+ struct RoleGranted {
17+ role : RoleId ,
18+ account : ContractAddress ,
19+ sender : ContractAddress ,
20+ }
21+
22+ // An event that is emitted when `account` is revoked `role`.
23+ // `sender` is the account that originated the contract call:
24+ // - If using `revoke_role`, it is the admin role bearer.
25+ // - If using `renounce_role`, it is the role bearer (i.e. `account`).
26+ #[derive(Copy , Drop , PartialEq , starknet:: Event )]
27+ struct RoleRevoked {
28+ role : RoleId ,
29+ account : ContractAddress ,
30+ sender : ContractAddress ,
31+ }
32+
33+ // An event that is emitted when `new_admin_role` is set as `role`'s admin role, replacing
34+ // `previous_admin_role`.
35+ // `DEFAULT_ADMIN_ROLE`(0) is the starting admin for all roles, despite {RoleAdminChanged} not
36+ // being emitted signaling this.
37+ #[derive(Copy , Drop , PartialEq , starknet:: Event )]
38+ struct RoleAdminChanged {
39+ role : RoleId ,
40+ previous_admin_role : RoleId ,
41+ new_admin_role : RoleId ,
42+ }
0 commit comments