diff --git a/programs/tokenized_vault/src/instructions/direct_deposit.rs b/programs/tokenized_vault/src/instructions/direct_deposit.rs index 0bd1af1..44b8a49 100644 --- a/programs/tokenized_vault/src/instructions/direct_deposit.rs +++ b/programs/tokenized_vault/src/instructions/direct_deposit.rs @@ -87,7 +87,7 @@ pub struct DirectDeposit<'info> { bump, seeds::program = access_control.key() )] - pub kyc_verified: Account<'info, UserRole>, + pub kyc_verified: UncheckedAccount<'info>, #[account(mut)] pub user: Signer<'info>, diff --git a/programs/tokenized_vault/src/utils/vault.rs b/programs/tokenized_vault/src/utils/vault.rs index 3c4d9a2..4021231 100644 --- a/programs/tokenized_vault/src/utils/vault.rs +++ b/programs/tokenized_vault/src/utils/vault.rs @@ -39,8 +39,10 @@ pub fn validate_deposit<'info>( return Err(ErrorCode::ExceedDepositLimit.into()); } - if vault.kyc_verified_only && !kyc_verified.deserialize::()?.has_role { - return Err(ErrorCode::KYCRequired.into()); + if vault.kyc_verified_only { + if kyc_verified.data_is_empty() || !kyc_verified.deserialize::()?.has_role { + return Err(ErrorCode::KYCRequired.into()); + } } if vault.whitelisted_only && !user_data.whitelisted {