pub(crate) fn claim_user_reward(
        &mut self, 
        user_rps: &RPS,
        user_seeds: &Balance, 
        total_seeds: &Balance, 
        silent: bool,
    ) -> (RPS, Balance) {

        self.distribute(total_seeds, silent);
        // if user_seeds == &0 {
        //     return (self.last_distribution.rps, 0);
        // }

        let claimed = (
            U256::from(*user_seeds) 
            * (U256::from_little_endian(&self.last_distribution.rps) - U256::from_little_endian(user_rps))
            / U256::from(DENOM)
        ).as_u128();

        if claimed > 0 {
            assert!(
                self.last_distribution.unclaimed >= claimed, 
                "{} unclaimed:{}, cur_claim:{}", 
                ERR500, self.last_distribution.unclaimed, claimed
            );
            self.last_distribution.unclaimed -= claimed;
            self.amount_of_claimed += claimed;
        }

        (self.last_distribution.rps, claimed)
    }
/// Claim user's unclaimed reward in this farm,
/// return the new user RPS (reward per seed),  
/// and amount of reward 
Claim user's unclaimed reward in this farm,
return the new user RPS (reward per seed),
and amount of reward
Claim user ' s unclaimed reward in this farm return the new user RPS ( reward per seed ) and amount of reward
pub(crate) fn claim_user_reward(
        &mut self, 
        user_rps: &RPS,
        user_seeds: &Balance, 
        total_seeds: &Balance, 
        silent: bool,
    ) -> (RPS, Balance) {
        self.distribute(total_seeds, silent);
        // if user_seeds == &0 {
        //     return (self.last_distribution.rps, 0);
        // }
        let claimed = (
            U256::from(*user_seeds) 
            * (U256::from_little_endian(&self.last_distribution.rps) - U256::from_little_endian(user_rps))
            / U256::from(DENOM)
        ).as_u128();
        if claimed > 0 {
            assert!(
                self.last_distribution.unclaimed >= claimed, 
                "{} unclaimed:{}, cur_claim:{}", 
                ERR500, self.last_distribution.unclaimed, claimed
            );
            self.last_distribution.unclaimed -= claimed;
            self.amount_of_claimed += claimed;
        }
        (self.last_distribution.rps, claimed)
    }
pub ( crate ) fn claim_user_reward ( & mut self , user_rps : & RPS , user_seeds : & Balance , total_seeds : & Balance , silent : bool , ) -> ( RPS , Balance ) { self . distribute ( total_seeds , silent ) ; // if user_seeds == &0 { //     return (self.last_distribution.rps, 0); // } let claimed = ( U256 :: from ( * user_seeds ) * ( U256 :: from_little_endian ( & self . last_distribution . rps ) - U256 :: from_little_endian ( user_rps ) ) / U256 :: from ( DENOM ) ) . as_u128 ( ) ; if claimed > 0 { assert ! ( self last_distribution unclaimed claimed " " ERR500 self last_distribution unclaimed claimed ) ; self . last_distribution . unclaimed -= claimed ; self . amount_of_claimed += claimed ; } ( self . last_distribution . rps , claimed ) }
Claim user's unclaimed reward in this farm,
return the new user RPS (reward per seed),
and amount of reward
Claim user ' s unclaimed reward in this farm return the new user RPS ( reward per seed ) and amount of reward
&mut self
user_rps
&RPS
user_seeds
&Balance
total_seeds
&Balance
silent
bool
&mut self
user_rps
&RPS
user_seeds
&Balance
total_seeds
&Balance
silent
bool