pub fn assert_can_create_proposal(
        &self,
        realm_data: &RealmV2,
        config: &GovernanceConfig,
        voter_weight: u64,
    ) -> Result<(), ProgramError> {
        let min_weight_to_create_proposal =
            if self.governing_token_mint == realm_data.community_mint {
                config.min_community_weight_to_create_proposal
            } else if Some(self.governing_token_mint) == realm_data.config.council_mint {
                config.min_council_weight_to_create_proposal
            } else {
                return Err(GovernanceError::InvalidGoverningTokenMint.into());
            };

        if voter_weight < min_weight_to_create_proposal {
            return Err(GovernanceError::NotEnoughTokensToCreateProposal.into());
        }

        // The number of outstanding proposals is currently restricted to 10
        // If there is a need to change it in the future then it should be added to realm or governance config
        if self.outstanding_proposal_count >= 10 {
            return Err(GovernanceError::TooManyOutstandingProposals.into());
        }

        Ok(())
    }
/// Asserts TokenOwner has enough tokens to be allowed to create proposal and doesn't have any outstanding proposals
Asserts TokenOwner has enough tokens to be allowed to create proposal and doesn't have any outstanding proposals
Asserts TokenOwner has enough tokens to be allowed to create proposal and doesn ' t have any outstanding proposals
pub fn assert_can_create_proposal(
        &self,
        realm_data: &RealmV2,
        config: &GovernanceConfig,
        voter_weight: u64,
    ) -> Result<(), ProgramError> {
        let min_weight_to_create_proposal =
            if self.governing_token_mint == realm_data.community_mint {
                config.min_community_weight_to_create_proposal
            } else if Some(self.governing_token_mint) == realm_data.config.council_mint {
                config.min_council_weight_to_create_proposal
            } else {
                return Err(GovernanceError::InvalidGoverningTokenMint.into());
            };
        if voter_weight < min_weight_to_create_proposal {
            return Err(GovernanceError::NotEnoughTokensToCreateProposal.into());
        }
        // The number of outstanding proposals is currently restricted to 10
        // If there is a need to change it in the future then it should be added to realm or governance config
        if self.outstanding_proposal_count >= 10 {
            return Err(GovernanceError::TooManyOutstandingProposals.into());
        }
        Ok(())
    }
pub fn assert_can_create_proposal ( & self , realm_data : & RealmV2 , config : & GovernanceConfig , voter_weight : u64 , ) -> Result < ( ) , ProgramError > { let min_weight_to_create_proposal = if self . governing_token_mint == realm_data . community_mint { config . min_community_weight_to_create_proposal } else if Some ( self . governing_token_mint ) == realm_data . config . council_mint { config . min_council_weight_to_create_proposal } else { return Err ( GovernanceError :: InvalidGoverningTokenMint . into ( ) ) ; } ; if voter_weight < min_weight_to_create_proposal { return Err ( GovernanceError :: NotEnoughTokensToCreateProposal . into ( ) ) ; } // The number of outstanding proposals is currently restricted to 10 // If there is a need to change it in the future then it should be added to realm or governance config if self . outstanding_proposal_count >= 10 { return Err ( GovernanceError :: TooManyOutstandingProposals . into ( ) ) ; } Ok ( ( ) ) }
Asserts TokenOwner has enough tokens to be allowed to create proposal and doesn't have any outstanding proposals
Asserts TokenOwner has enough tokens to be allowed to create proposal and doesn ' t have any outstanding proposals
&self
realm_data
&RealmV2
config
&GovernanceConfig
voter_weight
u64
&self
realm_data
&RealmV2
config
&GovernanceConfig
voter_weight
u64