Struct spl_governance::state::token_owner_record::TokenOwnerRecord [−][src]
#[repr(C)]pub struct TokenOwnerRecord { pub account_type: GovernanceAccountType, pub realm: Pubkey, pub governing_token_mint: Pubkey, pub governing_token_owner: Pubkey, pub governing_token_deposit_amount: u64, pub unrelinquished_votes_count: u32, pub total_votes_count: u32, pub reserved: [u8; 8], pub governance_delegate: Option<Pubkey>, }
Expand description
Governance Token Owner Record Account PDA seeds: [‘governance’, realm, token_mint, token_owner ]
Fields
account_type: GovernanceAccountType
Governance account type
realm: Pubkey
The Realm the TokenOwnerRecord belongs to
governing_token_mint: Pubkey
Governing Token Mint the TokenOwnerRecord holds deposit for
governing_token_owner: Pubkey
The owner (either single or multisig) of the deposited governing SPL Tokens This is who can authorize a withdrawal of the tokens
governing_token_deposit_amount: u64
The amount of governing tokens deposited into the Realm This amount is the voter weight used when voting on proposals
unrelinquished_votes_count: u32
The number of votes cast by TokenOwner but not relinquished yet Every time a vote is cast this number is increased and it’s always decreased when relinquishing a vote regardless of the vote state
total_votes_count: u32
The total number of votes cast by the TokenOwner If TokenOwner withdraws vote while voting is still in progress total_votes_count is decreased and the vote doesn’t count towards the total
reserved: [u8; 8]
Reserved space for future versions
governance_delegate: Option<Pubkey>
A single account that is allowed to operate governance with the deposited governing tokens It can be delegated to by the governing_token_owner or current governance_delegate
Implementations
pub fn assert_token_owner_or_delegate_is_signer(
&self,
governance_authority_info: &AccountInfo<'_>
) -> Result<(), ProgramError>
pub fn assert_token_owner_or_delegate_is_signer(
&self,
governance_authority_info: &AccountInfo<'_>
) -> Result<(), ProgramError>
Checks whether the provided Governance Authority signed transaction
Trait Implementations
Returns max account size or None if max size is not known and actual instance size should be used
Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more
Deserialize this instance from a slice of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more
impl BorshSchema for TokenOwnerRecord where
GovernanceAccountType: BorshSchema,
Pubkey: BorshSchema,
Pubkey: BorshSchema,
Pubkey: BorshSchema,
u64: BorshSchema,
u32: BorshSchema,
u32: BorshSchema,
[u8; 8]: BorshSchema,
Option<Pubkey>: BorshSchema,
impl BorshSchema for TokenOwnerRecord where
GovernanceAccountType: BorshSchema,
Pubkey: BorshSchema,
Pubkey: BorshSchema,
Pubkey: BorshSchema,
u64: BorshSchema,
u32: BorshSchema,
u32: BorshSchema,
[u8; 8]: BorshSchema,
Option<Pubkey>: BorshSchema,
Get the name of the type without brackets.
Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type. Read more
fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
Helper method to add a single type definition to the map.
Serialize this instance into a vector of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more
Is initialized
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for TokenOwnerRecord
impl Send for TokenOwnerRecord
impl Sync for TokenOwnerRecord
impl Unpin for TokenOwnerRecord
impl UnwindSafe for TokenOwnerRecord
Blanket Implementations
pub default fn example() -> T
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V