pub fn assert_is_valid_spl_token_account(account_info: &AccountInfo) -> Result<(), ProgramError> {
    if account_info.data_is_empty() {
        return Err(GovernanceError::SplTokenAccountNotInitialized.into());
    }

    if account_info.owner != &spl_token::id() {
        return Err(GovernanceError::SplTokenAccountWithInvalidOwner.into());
    }

    if account_info.data_len() != Account::LEN {
        return Err(GovernanceError::SplTokenInvalidTokenAccountData.into());
    }

    Ok(())
}
/// Asserts the given account_info represents a valid SPL Token account which is initialized and belongs to spl_token program
Asserts the given account_info represents a valid SPL Token account which is initialized and belongs to spl_token program
Asserts the given account_info represents a valid SPL Token account which is initialized and belongs to spl_token program
pub fn assert_is_valid_spl_token_account(account_info: &AccountInfo) -> Result<(), ProgramError> {
    if account_info.data_is_empty() {
        return Err(GovernanceError::SplTokenAccountNotInitialized.into());
    }
    if account_info.owner != &spl_token::id() {
        return Err(GovernanceError::SplTokenAccountWithInvalidOwner.into());
    }
    if account_info.data_len() != Account::LEN {
        return Err(GovernanceError::SplTokenInvalidTokenAccountData.into());
    }
    Ok(())
}
pub fn assert_is_valid_spl_token_account ( account_info : & AccountInfo ) -> Result < ( ) , ProgramError > { if account_info . data_is_empty ( ) { return Err ( GovernanceError :: SplTokenAccountNotInitialized . into ( ) ) ; } if account_info . owner != & spl_token :: id ( ) { return Err ( GovernanceError :: SplTokenAccountWithInvalidOwner . into ( ) ) ; } if account_info . data_len ( ) != Account :: LEN { return Err ( GovernanceError :: SplTokenInvalidTokenAccountData . into ( ) ) ; } Ok ( ( ) ) }
Asserts the given account_info represents a valid SPL Token account which is initialized and belongs to spl_token program
Asserts the given account_info represents a valid SPL Token account which is initialized and belongs to spl_token program
account_info
&AccountInfo
account_info
&AccountInfo