Skip to main content

require_token_owner_eq

Function require_token_owner_eq 

Source
pub fn require_token_owner_eq(
    token_account: &AccountView,
    expected_owner: &Address,
) -> ProgramResult
Expand description

Verify an SPL Token account’s owner field matches a pubkey supplied directly (i.e. not wrapped in an AccountView).

This is the sibling of require_token_authority, differing only in its argument shape: it takes &Address rather than &AccountView for the expected authority. The declarative #[account(token::authority = X)] attribute lowers to this form because the user’s expression might resolve to a constant address, a cached field, or another account’s key. all of which are &Address by the time the check runs, none of them necessarily wrapped in an AccountView.