odra_modules/access/
events.rs

1//! Events emitted by the AccessControl module.
2use super::access_control::Role;
3use odra::prelude::*;
4
5/// Emitted when ownership of the contract is transferred.
6#[odra::event]
7pub struct OwnershipTransferred {
8    /// The previous owner.
9    pub previous_owner: Option<Address>,
10    /// The new owner.
11    pub new_owner: Option<Address>
12}
13
14/// Emitted when the ownership transfer is started.
15#[odra::event]
16pub struct OwnershipTransferStarted {
17    /// The previous owner.
18    pub previous_owner: Option<Address>,
19    /// The new owner.
20    pub new_owner: Option<Address>
21}
22
23/// Informs `new_admin_role` is set as `role`'s admin role, replacing `previous_admin_role`.
24///
25/// [`DEFAULT_ADMIN_ROLE`](super::access_control::DEFAULT_ADMIN_ROLE) is the starting admin for all roles,
26/// but `RoleAdminChanged` not being emitted signaling this.
27#[odra::event]
28pub struct RoleAdminChanged {
29    /// The role whose admin role is changed.
30    pub role: Role,
31    /// The previous admin role.
32    pub previous_admin_role: Role,
33    /// The new admin role.
34    pub new_admin_role: Role
35}
36
37/// Informs `address` is granted `role`.
38#[odra::event]
39pub struct RoleGranted {
40    /// The role granted.
41    pub role: Role,
42    /// The address granted the role.
43    pub address: Address,
44    /// The address that granted the role.
45    pub sender: Address
46}
47
48/// Informs `address` is revoked `role`.
49#[odra::event]
50pub struct RoleRevoked {
51    /// The role revoked.
52    pub role: Role,
53    /// The address revoked the role.
54    pub address: Address,
55    /// The address that revoked the role.
56    pub sender: Address
57}