Skip to content

Commit

Permalink
update sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
SeHor05 committed Jan 27, 2025
1 parent d625d70 commit 1179ea0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tvm_vm/src/executor/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,14 @@ fn calc_mbk(t: f64) -> f64 {
pub(super) fn execute_calculate_validator_reward(engine: &mut Engine) -> Status {
engine.load_instruction(Instruction::new("CALCBKREWARD"))?;
fetch_stack(engine, 7)?;
let bkrt = engine.cmd.var(0).as_integer()?.into(0..=u128::MAX)? as f64; //average reputation time of licenses in one stake
let mut repcoef = engine.cmd.var(0).as_integer()?.into(0..=u128::MAX)? as f64; //average reputation coef of licenses in one stake
let bkstake = engine.cmd.var(1).as_integer()?.into(0..=u128::MAX)? as f64; //value of stake
let totalbkstake = engine.cmd.var(2).as_integer()?.into(0..=u128::MAX)? as f64; //sum of stakes at start of epoch
let t = engine.cmd.var(3).as_integer()?.into(0..=u128::MAX)? as f64; //duration of epoch
let mbk = engine.cmd.var(4).as_integer()?.into(0..=u128::MAX)? as f64; //sum of reward token (minted, include slash token)
let nbk = engine.cmd.var(5).as_integer()?.into(0..=u128::MAX)? as f64; //numberOfActiveBlockKeepers
let rbk = engine.cmd.var(6).as_integer()?.into(0..=u128::MAX)? as f64; //last calculated reward_adjustment
let repcoef = if bkrt < MAXRT {
MINRC
+ (MAXRC - MINRC) / (1_f64 - 1_f64 / ARFC)
* (1_f64 - (-1_f64 * ARFC.ln() * bkrt / MAXRT).exp())
} else {
MAXRC
};
repcoef = repcoef / 1e9_f64;
let reward;
if mbk == 0_f64 {
reward = rbk * t * repcoef / nbk;
Expand Down

0 comments on commit 1179ea0

Please sign in to comment.