miracle_api/state/config.rs
1use solana_program::pubkey::Pubkey;
2use steel::*;
3
4use super::MiracleAccount;
5
6/// Config is a singleton account which manages program global variables.
7#[repr(C)]
8#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
9pub struct Config {
10 /// The timestamp of the last reset.
11 pub last_reset_at: i64,
12
13 /// Risk threshold for a rewareds claim request
14 pub claim_rewards_threshold: u64,
15
16 /// The oracle authority with permission to update daily snapshots.
17 /// The oracle provides payment data and merkle roots for reward distribution.
18 pub oracle_authority: Pubkey,
19
20 /// Community health targets for sustainable reward distribution.
21 /// These targets determine what constitutes "healthy" vs "struggling" communities.
22 pub community_targets: CommunityTargets,
23
24 /// Activity limits configuration to prevent gaming and ensure fair distribution.
25 /// These limits cap the maximum effective activity count per epoch per participant.
26 pub activity_limits: ActivityLimits,
27
28 /// Social marketing rewards configuration for community building and organic growth.
29 /// This pool provides rewards for social media engagement while maintaining payment-first philosophy.
30 pub social_marketing: SocialMarketingConfig,
31}
32
33/// Community health targets for sustainable reward distribution.
34/// These targets determine what constitutes "healthy" vs "struggling" communities.
35#[repr(C)]
36#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
37pub struct CommunityTargets {
38 /// Target weekly active users for sustainable rewards (default: 10,000).
39 pub target_weekly_users: u32,
40
41 /// Target weekly activity count for sustainable rewards (default: 50,000).
42 pub target_weekly_activity: u32,
43
44 /// Target weekly retention rate for sustainable rewards (default: 7,000 = 70%).
45 pub target_retention_rate: u16,
46
47 /// Padding to ensure proper alignment (6 bytes to reach 16-byte boundary).
48 pub _padding: [u8; 6],
49}
50
51/// Activity limits configuration to prevent payment splitting for more activities.
52/// This prevents gaming by capping the maximum effective activity count per epoch.
53#[repr(C)]
54#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
55pub struct ActivityLimits {
56 /// Maximum customer activity count per epoch (prevents payment splitting).
57 /// If a customer's activity count exceeds this limit, it will be capped.
58 pub max_customer_activity_per_epoch: u32,
59
60 /// Maximum merchant activity count per epoch (prevents payment splitting).
61 /// If a merchant's activity count exceeds this limit, it will be capped.
62 pub max_merchant_activity_per_epoch: u32,
63
64 /// Whether activity capping is enabled (1=enabled, 0=disabled).
65 /// When disabled, no activity limits are applied.
66 pub activity_cap_enabled: u8,
67
68 /// Whether claim capping is enabled (1=enabled, 0=disabled).
69 /// When disabled, no claim count limits per epoch are applied, used for devnet(test)
70 /// When enabled, only 1 claim is allowd per epoch, used for mainnet(production)
71 pub claim_cap_enabled: u8,
72
73 /// Padding to ensure proper alignment (6 bytes to reach 16-byte boundary).
74 pub _padding: [u8; 6],
75}
76
77/// Social marketing rewards configuration for community building and organic growth.
78/// This pool provides rewards for social media engagement while maintaining payment-first philosophy.
79#[repr(C)]
80#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
81pub struct SocialMarketingConfig {
82 /// Remaining social marketing rewards pool (initial: 9M MIRACLE).
83 /// This pool is separate from payment rewards and dedicated to social marketing.
84 pub rewards_pool: u64,
85
86 /// Maximum social claims per user per day (default: 1).
87 /// This prevents spam posting and ensures quality engagement.
88 pub daily_limit_per_user: u32,
89
90 /// Base reward for each verified social media post (default: 10 MIRACLE).
91 /// This is the minimum reward for any valid social media engagement.
92 pub base_reward_per_post: u32,
93
94 /// Oracle authority with permission to verify social media posts.
95 /// This authority signs verification data for social media claims.
96 pub oracle_authority: Pubkey,
97 // Padding to ensure proper alignment (0 bytes - exact size).
98 // pub _padding: [u8; 0],
99}
100
101account!(MiracleAccount, Config);