pub fn assert_can_create_governance(
        &self,
        realm_data: &RealmV2,
        voter_weight: u64,
    ) -> Result<(), ProgramError> {
        let min_weight_to_create_governance =
            if self.governing_token_mint == realm_data.community_mint {
                realm_data.config.min_community_weight_to_create_governance
            } else if Some(self.governing_token_mint) == realm_data.config.council_mint {
                // For council tokens it's enough to be in possession of any number of tokens
                1
            } else {
                return Err(GovernanceError::InvalidGoverningTokenMint.into());
            };

        if voter_weight < min_weight_to_create_governance {
            return Err(GovernanceError::NotEnoughTokensToCreateGovernance.into());
        }

        Ok(())
    }
/// Asserts TokenOwner has enough tokens to be allowed to create governance
Asserts TokenOwner has enough tokens to be allowed to create governance
Asserts TokenOwner has enough tokens to be allowed to create governance
pub fn assert_can_create_governance(
        &self,
        realm_data: &RealmV2,
        voter_weight: u64,
    ) -> Result<(), ProgramError> {
        let min_weight_to_create_governance =
            if self.governing_token_mint == realm_data.community_mint {
                realm_data.config.min_community_weight_to_create_governance
            } else if Some(self.governing_token_mint) == realm_data.config.council_mint {
                // For council tokens it's enough to be in possession of any number of tokens
                1
            } else {
                return Err(GovernanceError::InvalidGoverningTokenMint.into());
            };
        if voter_weight < min_weight_to_create_governance {
            return Err(GovernanceError::NotEnoughTokensToCreateGovernance.into());
        }
        Ok(())
    }
pub fn assert_can_create_governance ( & self , realm_data : & RealmV2 , voter_weight : u64 , ) -> Result < ( ) , ProgramError > { let min_weight_to_create_governance = if self . governing_token_mint == realm_data . community_mint { realm_data . config . min_community_weight_to_create_governance } else if Some ( self . governing_token_mint ) == realm_data . config . council_mint { // For council tokens it's enough to be in possession of any number of tokens 1 } else { return Err ( GovernanceError :: InvalidGoverningTokenMint . into ( ) ) ; } ; if voter_weight < min_weight_to_create_governance { return Err ( GovernanceError :: NotEnoughTokensToCreateGovernance . into ( ) ) ; } Ok ( ( ) ) }
Asserts TokenOwner has enough tokens to be allowed to create governance
Asserts TokenOwner has enough tokens to be allowed to create governance
&self
realm_data
&RealmV2
voter_weight
u64
&self
realm_data
&RealmV2
voter_weight
u64