pub fn stake_to_near(&self, stake: YoctoStake) -> YoctoNear {
        if self.total_staked_near_balance.value() == 0
            // when deposit and staked with staking pool, there is a small amount remaining as unstaked
            // however, STAKE token value should never be less than 1:1 in terms of NEAR
            || self.total_staked_near_balance.value() < self.total_stake_supply.value()
        {
            return stake.value().into();
        }

        let stake = U256::from(stake);
        let total_stake_supply = U256::from(self.total_stake_supply);
        let total_staked_near_balance = U256::from(self.total_staked_near_balance);

        let near_value = stake * total_staked_near_balance / total_stake_supply;
        if (stake * total_staked_near_balance) % total_stake_supply == U256::from(0) {
            near_value.as_u128().into()
        } else {
            // round up
            (near_value.as_u128() + 1).into()
        }
    }
/// converts STAKE to NEAR rounded up
/// - we round up because we never want to short change the payout
/// - this also helps to compensate for rounding down when we convert NEAR -> STAKE
converts STAKE to NEAR rounded up
we round up because we never want to short change the payout
this also helps to compensate for rounding down when we convert NEAR -> STAKE
converts STAKE to NEAR rounded up we round up because we never want to short change the payout this also helps to compensate for rounding down when we convert NEAR - > STAKE
pub fn stake_to_near(&self, stake: YoctoStake) -> YoctoNear {
        if self.total_staked_near_balance.value() == 0
            // when deposit and staked with staking pool, there is a small amount remaining as unstaked
            // however, STAKE token value should never be less than 1:1 in terms of NEAR
            || self.total_staked_near_balance.value() < self.total_stake_supply.value()
        {
            return stake.value().into();
        }
        let stake = U256::from(stake);
        let total_stake_supply = U256::from(self.total_stake_supply);
        let total_staked_near_balance = U256::from(self.total_staked_near_balance);
        let near_value = stake * total_staked_near_balance / total_stake_supply;
        if (stake * total_staked_near_balance) % total_stake_supply == U256::from(0) {
            near_value.as_u128().into()
        } else {
            // round up
            (near_value.as_u128() + 1).into()
        }
    }
pub fn stake_to_near ( & self , stake : YoctoStake ) -> YoctoNear { if self . total_staked_near_balance . value ( ) == 0 // when deposit and staked with staking pool, there is a small amount remaining as unstaked // however, STAKE token value should never be less than 1:1 in terms of NEAR || self . total_staked_near_balance . value ( ) < self . total_stake_supply . value ( ) { return stake . value ( ) . into ( ) ; } let stake = U256 :: from ( stake ) ; let total_stake_supply = U256 :: from ( self . total_stake_supply ) ; let total_staked_near_balance = U256 :: from ( self . total_staked_near_balance ) ; let near_value = stake * total_staked_near_balance / total_stake_supply ; if ( stake * total_staked_near_balance ) % total_stake_supply == U256 :: from ( 0 ) { near_value . as_u128 ( ) . into ( ) } else { // round up ( near_value . as_u128 ( ) + 1 ) . into ( ) } }
converts STAKE to NEAR rounded up
 we round up because we never want to short change the payout
 this also helps to compensate for rounding down when we convert NEAR -> STAKE
converts STAKE to NEAR rounded up we round up because we never want to short change the payout this also helps to compensate for rounding down when we convert NEAR - > STAKE
&self
stake
YoctoStake