Skip to content

Commit

Permalink
test: Updated tests to conform with changes made in d5cffe9
Browse files Browse the repository at this point in the history
  • Loading branch information
KirilMihaylov committed Mar 31, 2023
1 parent 669078b commit 03faa72
Showing 1 changed file with 44 additions and 11 deletions.
55 changes: 44 additions & 11 deletions contracts/dispatcher/src/state/reward_scale/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,50 @@ mod tests {
.unwrap();

assert_eq!(res.get_apr(0), Percent::from_permille(6));
assert_eq!(res.get_apr(1000), Percent::from_permille(6));
assert_eq!(res.get_apr(29999), Percent::from_permille(6));
assert_eq!(res.get_apr(30000), Percent::from_permille(10));
assert_eq!(res.get_apr(30001), Percent::from_permille(10));
assert_eq!(res.get_apr(100051), Percent::from_permille(12));
assert_eq!(res.get_apr(149999), Percent::from_permille(12));
assert_eq!(res.get_apr(150000), Percent::from_permille(15));
assert_eq!(res.get_apr(200300), Percent::from_permille(15));
assert_eq!(res.get_apr(300000), Percent::from_permille(20));
assert_eq!(res.get_apr(300200), Percent::from_permille(20));
assert_eq!(res.get_apr(1300200), Percent::from_permille(20));
assert_eq!(
res.get_apr(TotalValueLocked::SCALE_FACTOR),
Percent::from_permille(6)
);
assert_eq!(
res.get_apr(30 * TotalValueLocked::SCALE_FACTOR - 1),
Percent::from_permille(6)
);
assert_eq!(
res.get_apr(30 * TotalValueLocked::SCALE_FACTOR),
Percent::from_permille(10)
);
assert_eq!(
res.get_apr(30 * TotalValueLocked::SCALE_FACTOR + 1),
Percent::from_permille(10)
);
assert_eq!(
res.get_apr(100 * TotalValueLocked::SCALE_FACTOR + 1),
Percent::from_permille(12)
);
assert_eq!(
res.get_apr(150 * TotalValueLocked::SCALE_FACTOR - 1),
Percent::from_permille(12)
);
assert_eq!(
res.get_apr(150 * TotalValueLocked::SCALE_FACTOR),
Percent::from_permille(15)
);
assert_eq!(
res.get_apr(200 * TotalValueLocked::SCALE_FACTOR),
Percent::from_permille(15)
);
assert_eq!(
res.get_apr(300 * TotalValueLocked::SCALE_FACTOR),
Percent::from_permille(20)
);
assert_eq!(
res.get_apr(300 * TotalValueLocked::SCALE_FACTOR + 1),
Percent::from_permille(20)
);
assert_eq!(
res.get_apr(1300 * TotalValueLocked::SCALE_FACTOR + 1),
Percent::from_permille(20)
);
assert_eq!(res.get_apr(Amount::MAX), Percent::from_permille(20));
assert_eq!(res.get_apr(Amount::MIN), Percent::from_permille(6));
}
Expand Down

0 comments on commit 03faa72

Please sign in to comment.