-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the initial setting is the reward_drawing_limit_max
- Loading branch information
Showing
6 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
Submodule chain-deps
updated
5 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
jormungandr-lib/src/interfaces/block0_configuration/reward_constraint.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use crate::interfaces::Ratio; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)] | ||
pub struct RewardConstraints { | ||
#[serde(default)] | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub reward_drawing_limit_max: Option<Ratio>, | ||
} | ||
|
||
impl RewardConstraints { | ||
pub fn is_none(&self) -> bool { | ||
self.reward_drawing_limit_max.is_none() | ||
} | ||
|
||
pub fn set_reward_drawing_limit_max(&mut self, limit: Option<Ratio>) { | ||
self.reward_drawing_limit_max = limit | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
use quickcheck::{Arbitrary, Gen}; | ||
|
||
impl Arbitrary for RewardConstraints { | ||
fn arbitrary<G: Gen>(g: &mut G) -> Self { | ||
Self { | ||
reward_drawing_limit_max: Arbitrary::arbitrary(g), | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters