pub struct ElectedModerators {
pub join_window: u32,
pub vote_window: u32,
pub challenge_cool_down: Option<u32>,
pub election_delay: Option<u32>,
pub max_added_moderators: u16,
pub moderated_document_types: BTreeMap<DocumentName, BTreeSet<ModerationAbility>>,
pub interim: InterimModerators,
pub owner_protected: bool,
}Expand description
The declaration that a contract’s moderators are an elected team. Every field is fixed at the contract’s creation.
Fields§
§join_window: u32How long, in seconds, applicants may join an election once the first one applied.
At most SystemLimits::max_contract_moderation_election_window_seconds (four weeks),
and on mainnet at least
SystemLimits::min_mainnet_contract_moderation_election_window_seconds (one day);
any other network takes 0. DEFAULT_ELECTION_WINDOW_SECONDS when the declaration
leaves it out.
vote_window: u32How long, in seconds, masternodes vote once the join window closed. The same bounds and default.
challenge_cool_down: Option<u32>Whether the seat can be contested again once a team is seated, and if so how long, in seconds, a seated team is safe from a challenge after a seat change.
Some when the seat is contestable (seatContestable: true on the wire, with the
cool-down as challengeCoolDown), within
SystemLimits::min_contract_moderation_challenge_cool_down_seconds to
SystemLimits::max_contract_moderation_challenge_cool_down_seconds (two weeks to
three years). None when it is not (seatContestable: false, no challengeCoolDown):
the first team seated keeps the seat for good, whatever becomes of its leader. One
field rather than a flag beside a cool-down, so the two can not disagree.
Nothing reads it yet: challenges come after protocol version 14, and until they do a seat is never contested again, whatever this says. The key exists now because the declaration is frozen at the contract’s creation.
election_delay: Option<u32>How long, in seconds after the contract’s creation, before the first charter may be
filed against the contract: the notice the contract gives before its first election
can be called. Unbounded, and None when the declaration leaves it out, in which
case the election may be called at once. A reference declaring
contractRequirements: { "moderation": "electionOpen" } is what reads it.
max_added_moderators: u16How many members the leader of a seated team may add after the election, each one
an identity that asked to join the team’s proposal: the additions a seated charter
holds at a time, the leader taking one back by deleting it. 0 when the declaration
leaves it out, a team then being exactly what was elected; at most
SystemLimits::max_contract_moderation_added_moderators. The moderation charters
contract’s addedModerator documents are what it counts.
moderated_document_types: BTreeMap<DocumentName, BTreeSet<ModerationAbility>>The document types the team moderates, each with the abilities the seated team holds
on it: non-empty, each type a document type of the contract, each ability set
non-empty and backed by the contract (Ban, Suspend and Warn by the list the
contract keeps, DeleteDocuments by the type setting moderatorAbilities.delete,
ChangeDocumentFields by the type listing moderatorAbilities.changeFields). The
lists themselves stay contract-wide: an ability on
a type is what a team may do over the documents of that type. The set also bounds
the interim block. A charter does not price the moderators part of an action: the
type’s actionFees.moderators amount is the most a team may charge, and a charter
charges a share of it.
interim: InterimModeratorsWho moderates until the first team is seated.
owner_protected: boolWhether the contract owner is protected from the team, as the owner and the moderators of the merged kinds are: it can then be neither banned nor suspended, and its documents can not be deleted. Not protected by default. During the interim the owner is protected whenever it moderates, flag or not.
Implementations§
Source§impl ElectedModerators
impl ElectedModerators
Sourcepub fn seat_contestable(&self) -> bool
pub fn seat_contestable(&self) -> bool
Whether the seat can be contested again once a team is seated: the declaration’s
seatContestable. A challenge will be allowed only on a contract that says so.
Sourcepub fn election_is_open(
&self,
contract_created_at: Option<TimestampMillis>,
block_time_ms: TimestampMillis,
) -> bool
pub fn election_is_open( &self, contract_created_at: Option<TimestampMillis>, block_time_ms: TimestampMillis, ) -> bool
Whether the first election may be called at block_time_ms on a contract created at
contract_created_at: the declaration has no election delay, or the delay has passed
since the creation. An elected declaration is made at the contract’s creation and
never changes, so the creation is the declaration’s own time. A contract without a
recorded creation time and with a delay is of unknown age, and its election is not
open.
Sourcepub fn moderates_document_type(&self, document_type_name: &str) -> bool
pub fn moderates_document_type(&self, document_type_name: &str) -> bool
Whether the team moderates the document type
Sourcepub fn allows(
&self,
document_type_name: &str,
ability: ModerationAbility,
) -> bool
pub fn allows( &self, document_type_name: &str, ability: ModerationAbility, ) -> bool
Whether the seated team holds the ability on the document type
Sourcepub fn allows_on_any_type(&self, ability: ModerationAbility) -> bool
pub fn allows_on_any_type(&self, ability: ModerationAbility) -> bool
Whether the seated team holds the ability on some moderated document type. The lists are contract-wide, so this is what lets the team ban, suspend or warn (and lift each): an ability on a type is what the team may do over the documents of that type, and an identity is barred from the whole contract.
Sourcepub fn interim_blocks_document_type(&self, document_type_name: &str) -> bool
pub fn interim_blocks_document_type(&self, document_type_name: &str) -> bool
Whether the interim refuses every document transition of the document type: the interim names nobody and the type is moderated. This is the declaration’s side only: the block ends once a charter is seated on the contract, which only state says, so the document gate reads whether one is before it refuses.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for ElectedModerators
impl<'__de, __Context> BorrowDecode<'__de, __Context> for ElectedModerators
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl<'__de, __Context> BorrowDecodeUntrusted<'__de, __Context> for ElectedModerators
impl<'__de, __Context> BorrowDecodeUntrusted<'__de, __Context> for ElectedModerators
Source§fn borrow_decode_untrusted<__D: BorrowUntrustedDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode_untrusted<__D: BorrowUntrustedDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for ElectedModerators
impl Clone for ElectedModerators
Source§fn clone(&self) -> ElectedModerators
fn clone(&self) -> ElectedModerators
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ElectedModerators
impl Debug for ElectedModerators
Source§impl<__Context> Decode<__Context> for ElectedModerators
impl<__Context> Decode<__Context> for ElectedModerators
Source§impl<__Context> DecodeUntrusted<__Context> for ElectedModerators
impl<__Context> DecodeUntrusted<__Context> for ElectedModerators
Source§fn decode_untrusted<__D: UntrustedDecoder<Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn decode_untrusted<__D: UntrustedDecoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Display for ElectedModerators
impl Display for ElectedModerators
Source§impl Encode for ElectedModerators
impl Encode for ElectedModerators
impl Eq for ElectedModerators
impl JsonSafeFields for ElectedModerators
json-conversion only.Source§impl PartialEq for ElectedModerators
impl PartialEq for ElectedModerators
impl StructuralPartialEq for ElectedModerators
Auto Trait Implementations§
impl Freeze for ElectedModerators
impl RefUnwindSafe for ElectedModerators
impl Send for ElectedModerators
impl Sync for ElectedModerators
impl Unpin for ElectedModerators
impl UnsafeUnpin for ElectedModerators
impl UnwindSafe for ElectedModerators
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> CostsExt for T
impl<T> CostsExt for T
§fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
CostContext object with provided costs.§fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
CostContext object with costs computed using the
value getting wrapped.§impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
fn borrow_decode<D>(decoder: &mut D) -> Result<Self, DecodeError>
§impl<T> DefaultDecode for T
impl<T> DefaultDecode for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
§fn into_on_network(self, network: Network) -> U
fn into_on_network(self, network: Network) -> U
Calls U::from_on_network(self).
§impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
§fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.