Skip to content

Commit decef1a

Browse files
MrWad3rRexagon
authored andcommitted
Add authority params to config
1 parent 6a95c33 commit decef1a

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/models/config/mod.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,24 @@ impl BlockchainConfigParams {
507507
ok!(self.get::<ConfigParam43>()).ok_or(Error::CellUnderflow)
508508
}
509509

510-
/// Updates a global id.
510+
/// Updates size limits.
511511
pub fn set_size_limits(&mut self, size_limits: &SizeLimitsConfig) -> Result<bool, Error> {
512512
self.set_raw(ConfigParam43::ID, ok!(CellBuilder::build_from(size_limits)))
513513
}
514514

515+
/// Returns authority params.
516+
pub fn get_authority_params(&self) -> Result<AuthorityParams, Error> {
517+
ok!(self.get::<ConfigParam100>()).ok_or(Error::CellUnderflow)
518+
}
519+
520+
/// Updates authority params.
521+
pub fn set_authority_params(&mut self, params: AuthorityParams) -> Result<bool, Error> {
522+
self.set_raw(
523+
ConfigParam100::ID,
524+
ok!(CellBuilder::build_from(params)),
525+
)
526+
}
527+
515528
/// Returns `true` if the config contains a param for the specified id.
516529
pub fn contains<'a, T: KnownConfigParam<'a>>(&'a self) -> Result<bool, Error> {
517530
self.0.contains_key(T::ID)
@@ -1132,6 +1145,13 @@ define_config_params! {
11321145
/// Contains a [`MintOnceConfig`].
11331146
#[serde(transparent)]
11341147
50 => ConfigParam50(MintOnceConfig),
1148+
1149+
/// Authority params
1150+
///
1151+
/// Contains dictionary with special addresses (in masterchain) which can mark other accounts
1152+
/// and system marks currency IDs.
1153+
#[serde(transparent)]
1154+
100 => ConfigParam100(AuthorityParams),
11351155
}
11361156

11371157
#[cfg(feature = "serde")]

src/models/config/params.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ pub struct MintOnceConfig {
7373
pub delta: CurrencyCollection,
7474
}
7575

76+
/// System currencies to mark accounts
77+
#[derive(Debug, Clone, Eq, PartialEq, Store, Load)]
78+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
79+
pub struct AuthorityParams {
80+
/// System authority addresses
81+
pub authority_addresses: Dict<HashBytes, ()>,
82+
/// Black mark currency id
83+
pub black_mark_id: u32,
84+
/// White mark currency id.
85+
pub white_mark_id: u32,
86+
}
87+
7688
/// Config voting setup params.
7789
#[derive(Debug, Clone, Eq, PartialEq, Store, Load)]
7890
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]

0 commit comments

Comments
 (0)