#[repr(C)]pub struct MetricsUpdatedEvent {
pub timestamp: i64,
pub weekly_active_users: u32,
pub weekly_activity_count: u32,
pub weekly_retention_rate: u16,
pub community_score: u16,
pub user_weight: u16,
pub activity_weight: u16,
pub retention_weight: u16,
pub customer_reward_share: u16,
pub merchant_reward_share: u16,
pub _padding: [u8; 2],
}
Expand description
Event emitted when community metrics are updated by the oracle.
This event is logged on-chain whenever the oracle updates community health metrics. It provides transparency and allows off-chain systems to track community health changes over time.
§Usage
- Track community health trends
- Monitor oracle activity
- Analyze reward decay patterns
- Build community health dashboards
- Monitor dynamic weight changes
- Track community age progression
§Memory Layout
Matches Enhanced Metrics struct layout for consistency (40 bytes total).
Fields§
§timestamp: i64
Event timestamp (Unix timestamp). When the metrics were updated.
weekly_active_users: u32
Weekly active users count. Raw user count data as provided by the oracle.
weekly_activity_count: u32
Weekly activity count (number of transactions, not amounts). Used to calculate activity score component of community health.
weekly_retention_rate: u16
Weekly retention rate in basis points (0-10000, 0-100%). Percentage of users who return week-over-week.
community_score: u16
Calculated community score (0-10000 basis points). Final computed community health percentage.
user_weight: u16
User weight in basis points (0-10000) for weighted geometric mean. Determines importance of user count in community score calculation.
activity_weight: u16
Activity weight in basis points (0-10000) for weighted geometric mean. Determines importance of transaction count in community score calculation.
retention_weight: u16
Retention weight in basis points (0-10000) for weighted geometric mean. Determines importance of retention rate in community score calculation.
Customer reward share in basis points (0-10000, 0-100%). Percentage of daily rewards allocated to customers.
Merchant reward share in basis points (0-10000, 0-100%). Percentage of daily rewards allocated to merchants.
_padding: [u8; 2]
Padding to ensure proper alignment (2 bytes to maintain 40-byte struct size)
Implementations§
Source§impl MetricsUpdatedEvent
impl MetricsUpdatedEvent
pub fn from_bytes(data: &[u8]) -> &Self
Trait Implementations§
Source§impl Clone for MetricsUpdatedEvent
impl Clone for MetricsUpdatedEvent
Source§fn clone(&self) -> MetricsUpdatedEvent
fn clone(&self) -> MetricsUpdatedEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MetricsUpdatedEvent
impl Debug for MetricsUpdatedEvent
Source§impl Loggable for MetricsUpdatedEvent
impl Loggable for MetricsUpdatedEvent
Source§impl PartialEq for MetricsUpdatedEvent
impl PartialEq for MetricsUpdatedEvent
impl Copy for MetricsUpdatedEvent
impl Pod for MetricsUpdatedEvent
impl StructuralPartialEq for MetricsUpdatedEvent
Auto Trait Implementations§
impl Freeze for MetricsUpdatedEvent
impl RefUnwindSafe for MetricsUpdatedEvent
impl Send for MetricsUpdatedEvent
impl Sync for MetricsUpdatedEvent
impl Unpin for MetricsUpdatedEvent
impl UnwindSafe for MetricsUpdatedEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more