Skip to content

Commit

Permalink
fix kyc verification issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vito-kovalione committed Dec 12, 2024
1 parent d7d1014 commit fdbed8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
6 changes: 4 additions & 2 deletions programs/tokenized_vault/src/utils/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ pub fn validate_deposit<'info>(
return Err(ErrorCode::ExceedDepositLimit.into());
}

if vault.kyc_verified_only && !kyc_verified.deserialize::<UserRole>()?.has_role {
return Err(ErrorCode::KYCRequired.into());
if vault.kyc_verified_only {
if kyc_verified.data_is_empty() || !kyc_verified.deserialize::<UserRole>()?.has_role {
return Err(ErrorCode::KYCRequired.into());
}
}

if vault.whitelisted_only && !user_data.whitelisted {
Expand Down

0 comments on commit fdbed8f

Please sign in to comment.