pub fn assert_can_cast_vote(
        &self,
        config: &GovernanceConfig,
        current_unix_timestamp: UnixTimestamp,
    ) -> Result<(), ProgramError> {
        self.assert_is_voting_state()
            .map_err(|_| GovernanceError::InvalidStateCannotVote)?;

        // Check if we are still within the configured max_voting_time period
        if self
            .voting_at
            .unwrap()
            .checked_add(config.max_voting_time as i64)
            .unwrap()
            < current_unix_timestamp
        {
            return Err(GovernanceError::ProposalVotingTimeExpired.into());
        }

        Ok(())
    }
/// Checks if Proposal can be voted on
Checks if Proposal can be voted on
Checks if Proposal can be voted on
pub fn assert_can_cast_vote(
        &self,
        config: &GovernanceConfig,
        current_unix_timestamp: UnixTimestamp,
    ) -> Result<(), ProgramError> {
        self.assert_is_voting_state()
            .map_err(|_| GovernanceError::InvalidStateCannotVote)?;
        // Check if we are still within the configured max_voting_time period
        if self
            .voting_at
            .unwrap()
            .checked_add(config.max_voting_time as i64)
            .unwrap()
            < current_unix_timestamp
        {
            return Err(GovernanceError::ProposalVotingTimeExpired.into());
        }
        Ok(())
    }
pub fn assert_can_cast_vote ( & self , config : & GovernanceConfig , current_unix_timestamp : UnixTimestamp , ) -> Result < ( ) , ProgramError > { self . assert_is_voting_state ( ) . map_err ( | _ | GovernanceError :: InvalidStateCannotVote ) ? ; // Check if we are still within the configured max_voting_time period if self . voting_at . unwrap ( ) . checked_add ( config . max_voting_time as i64 ) . unwrap ( ) < current_unix_timestamp { return Err ( GovernanceError :: ProposalVotingTimeExpired . into ( ) ) ; } Ok ( ( ) ) }
Checks if Proposal can be voted on
Checks if Proposal can be voted on
&self
config
&GovernanceConfig
current_unix_timestamp
UnixTimestamp
&self
config
&GovernanceConfig
current_unix_timestamp
UnixTimestamp