示例#1
0
 def test_calculate_unstake_lock_period(self):
     lmin = IISS_DAY_BLOCK * 5
     lmax = IISS_DAY_BLOCK * 20
     rpoint = 7000
     for x in range(0, 100):
         ret = IISSEngine._calculate_unstake_lock_period(lmin, lmax, rpoint, x, 100)
         diff = abs(ret - EXPECTED_LOCK_PERIOD_PRE_STAKE_PERCENT[x])
         assert diff <= 1
def unlock_period(total_stake, total_supply):
    p = Engine._calculate_unstake_lock_period(
        default_icon_config[ConfigKey.IISS_META_DATA][
            ConfigKey.UN_STAKE_LOCK_MIN],
        default_icon_config[ConfigKey.IISS_META_DATA][
            ConfigKey.UN_STAKE_LOCK_MAX],
        default_icon_config[ConfigKey.IISS_META_DATA][ConfigKey.REWARD_POINT],
        total_stake,
        total_supply,
    )

    return p