pub(crate) fn distribute(&mut self, total_seeds: &Balance, silent: bool) {
        if let Some(dis) = self.try_distribute(total_seeds) {
            if self.last_distribution.rr != dis.rr {
                self.last_distribution = dis.clone();
                if total_seeds == &0 {
                    // if total_seeds == &0, reward goes to beneficiary,
                    self.amount_of_claimed += self.last_distribution.unclaimed;
                    self.amount_of_beneficiary += self.last_distribution.unclaimed;
                    self.last_distribution.unclaimed = 0;
                }   
                if !silent {
                    env::log(
                        format!(
                            "{} RPS increased to {} and RR update to #{}",
                            self.farm_id, U256::from_little_endian(&dis.rps), dis.rr,
                        )
                        .as_bytes(),
                    );
                }
                
            }
            if self.last_distribution.undistributed == 0 {
                self.status = SimpleFarmStatus::Ended;
            }
        } 
    }
/// Distribute reward generated from previous distribution to now,
/// only works for farm in Running state and has reward deposited in,
/// Note 1, if undistribute equals 0, the farm goes to Ended state;
/// Note 2, if total_seed is 0, reward is claimed directly by beneficiary
Distribute reward generated from previous distribution to now,
only works for farm in Running state and has reward deposited in,
Note 1, if undistribute equals 0, the farm goes to Ended state;
Note 2, if total_seed is 0, reward is claimed directly by beneficiary
Distribute reward generated from previous distribution to now only works for farm in Running state and has reward deposited in Note 1 if undistribute equals 0 the farm goes to Ended state ; Note 2 if total_seed is 0 reward is claimed directly by beneficiary
pub(crate) fn distribute(&mut self, total_seeds: &Balance, silent: bool) {
        if let Some(dis) = self.try_distribute(total_seeds) {
            if self.last_distribution.rr != dis.rr {
                self.last_distribution = dis.clone();
                if total_seeds == &0 {
                    // if total_seeds == &0, reward goes to beneficiary,
                    self.amount_of_claimed += self.last_distribution.unclaimed;
                    self.amount_of_beneficiary += self.last_distribution.unclaimed;
                    self.last_distribution.unclaimed = 0;
                }   
                if !silent {
                    env::log(
                        format!(
                            "{} RPS increased to {} and RR update to #{}",
                            self.farm_id, U256::from_little_endian(&dis.rps), dis.rr,
                        )
                        .as_bytes(),
                    );
                }
            }
            if self.last_distribution.undistributed == 0 {
                self.status = SimpleFarmStatus::Ended;
            }
        } 
    }
pub ( crate ) fn distribute ( & mut self , total_seeds : & Balance , silent : bool ) { if let Some ( dis ) = self . try_distribute ( total_seeds ) { if self . last_distribution . rr != dis . rr { self . last_distribution = dis . clone ( ) ; if total_seeds == & 0 { // if total_seeds == &0, reward goes to beneficiary, self . amount_of_claimed += self . last_distribution . unclaimed ; self . amount_of_beneficiary += self . last_distribution . unclaimed ; self . last_distribution . unclaimed = 0 ; } if ! silent { env :: log ( format ! ( " " self farm_id U256 from_little_endian ( dis rps ) dis rr ) . as_bytes ( ) , ) ; } } if self . last_distribution . undistributed == 0 { self . status = SimpleFarmStatus :: Ended ; } } }
Distribute reward generated from previous distribution to now,
only works for farm in Running state and has reward deposited in,
Note 1, if undistribute equals 0, the farm goes to Ended state;
Note 2, if total_seed is 0, reward is claimed directly by beneficiary
Distribute reward generated from previous distribution to now only works for farm in Running state and has reward deposited in Note 1 if undistribute equals 0 the farm goes to Ended state ; Note 2 if total_seed is 0 reward is claimed directly by beneficiary
&mut self
total_seeds
&Balance
silent
bool
&mut self
total_seeds
&Balance
silent
bool