diff --git a/programs/tokenized_vault/src/events.rs b/programs/tokenized_vault/src/events.rs index 7ade34b..d8d6f6a 100644 --- a/programs/tokenized_vault/src/events.rs +++ b/programs/tokenized_vault/src/events.rs @@ -95,4 +95,10 @@ pub struct StrategyReportedEvent { pub protocol_fees: u64, pub total_fees: u64, pub timestamp: i64, +} + +#[event] +pub struct WhitelistUpdatedEvent { + pub user: Pubkey, + pub whitelisted: bool, } \ No newline at end of file diff --git a/programs/tokenized_vault/src/instructions/revoke_whitelisting.rs b/programs/tokenized_vault/src/instructions/revoke_whitelisting.rs index 88733df..a8472b1 100644 --- a/programs/tokenized_vault/src/instructions/revoke_whitelisting.rs +++ b/programs/tokenized_vault/src/instructions/revoke_whitelisting.rs @@ -7,6 +7,7 @@ use access_control::{ use crate::constants::USER_DATA_SEED; use crate::state::{Vault, UserData}; +use crate::events::WhitelistUpdatedEvent; #[derive(Accounts)] #[instruction(user: Pubkey)] @@ -46,5 +47,11 @@ pub struct RevokeWhitelisting<'info> { pub fn handle_revoke_whitelisting(ctx: Context, _user: Pubkey) -> Result<()> { ctx.accounts.user_data.whitelisted = false; + + emit!(WhitelistUpdatedEvent { + user: _user, + whitelisted: false, + }); + Ok(()) } diff --git a/programs/tokenized_vault/src/instructions/whitelist.rs b/programs/tokenized_vault/src/instructions/whitelist.rs index 139f589..630cf14 100644 --- a/programs/tokenized_vault/src/instructions/whitelist.rs +++ b/programs/tokenized_vault/src/instructions/whitelist.rs @@ -7,6 +7,7 @@ use access_control::{ use crate::constants::USER_DATA_SEED; use crate::state::{UserData, Vault}; +use crate::events::WhitelistUpdatedEvent; #[derive(Accounts)] #[instruction(user: Pubkey)] @@ -49,5 +50,11 @@ pub struct Whitelist<'info> { pub fn handle_whitelist(ctx: Context, _user: Pubkey) -> Result<()> { ctx.accounts.user_data.whitelisted = true; + + emit!(WhitelistUpdatedEvent { + user: _user, + whitelisted: true, + }); + Ok(()) }