pub struct YesNoVotePoll {
pub purpose: YesNoVotePollPurpose,
pub supermajority_numerator: u8,
pub supermajority_denominator: u8,
pub minimum_voting_power: YesNoMinimumVotingPower,
}Expand description
A poll the masternodes answer with yes, no or abstain.
The poll passes when the yes voting power is strictly more than
supermajority_numerator / supermajority_denominator of the yes plus no voting power, the
abstaining power left out of both sides, and the yes plus no voting power is at least
minimum_voting_power. Otherwise it fails. The minimum is a fixed voting power or a share of
the masternode list’s total voting power when the poll closes, banned masternodes left out.
The whole rule is carried by the poll so every feature sets its own. Two thirds with a floor
of 400 is numerator 2, denominator 3 and an absolute minimum of 400.
Only the purpose is the poll’s identity: Self::unique_id version 0 is the double SHA-256
of the domain tag dash platform yes/no vote poll id followed by the serialized purpose. A
vote names the poll by that id alone; the rule is written to the poll’s stored info when it
opens and cannot change after that. The prefunded balance that pays for the votes has the
same id.
Fields§
§purpose: YesNoVotePollPurposeWhat the poll decides. The poll’s id is derived from it alone.
supermajority_numerator: u8The numerator of the share of yes plus no voting power that yes must exceed.
supermajority_denominator: u8The denominator of the share of yes plus no voting power that yes must exceed.
minimum_voting_power: YesNoMinimumVotingPowerThe least yes plus no voting power for the poll to pass.
Implementations§
Source§impl YesNoVotePoll
impl YesNoVotePoll
Sourcepub fn validate_parameters(
&self,
platform_version: &PlatformVersion,
) -> Result<(), ProtocolError>
pub fn validate_parameters( &self, platform_version: &PlatformVersion, ) -> Result<(), ProtocolError>
Refuses parameters no poll can be opened with, by the rules the platform version selects
(dpp.voting_versions.yes_no_vote_poll_parameters).
§Parameters
platform_version: the platform version, whose system limits bound the parameters.
§Returns
Ok(()) for parameters a poll can run with, or the error refusing them.
Sourcepub fn required_voting_power(
&self,
total_voting_power: VotingPower,
platform_version: &PlatformVersion,
) -> Result<VotingPower, ProtocolError>
pub fn required_voting_power( &self, total_voting_power: VotingPower, platform_version: &PlatformVersion, ) -> Result<VotingPower, ProtocolError>
The least yes plus no voting power the poll needs, given the total voting power of the
masternode list in the block that closes it, by the rule the platform version selects
(dpp.voting_versions.yes_no_vote_poll_decision).
§Parameters
total_voting_power: the masternode list’s total voting power in the closing block.platform_version: the platform version.
§Returns
The required voting power.
Sourcepub fn passes(
&self,
yes_voting_power: VotingPower,
no_voting_power: VotingPower,
total_voting_power: VotingPower,
platform_version: &PlatformVersion,
) -> Result<bool, ProtocolError>
pub fn passes( &self, yes_voting_power: VotingPower, no_voting_power: VotingPower, total_voting_power: VotingPower, platform_version: &PlatformVersion, ) -> Result<bool, ProtocolError>
Whether the poll passes with these final tallies, given the total voting power of the
masternode list in the block that closes it, by the rule the platform version selects
(dpp.voting_versions.yes_no_vote_poll_decision). Abstaining power plays no part.
§Parameters
yes_voting_power: the yes voting power cast.no_voting_power: the no voting power cast.total_voting_power: the masternode list’s total voting power in the closing block.platform_version: the platform version.
§Returns
Whether the poll passes.
Sourcepub fn unique_id(
&self,
platform_version: &PlatformVersion,
) -> Result<Identifier, ProtocolError>
pub fn unique_id( &self, platform_version: &PlatformVersion, ) -> Result<Identifier, ProtocolError>
Sourcepub fn specialized_balance_id(
&self,
platform_version: &PlatformVersion,
) -> Result<Identifier, ProtocolError>
pub fn specialized_balance_id( &self, platform_version: &PlatformVersion, ) -> Result<Identifier, ProtocolError>
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for YesNoVotePoll
impl<'__de, __Context> BorrowDecode<'__de, __Context> for YesNoVotePoll
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 YesNoVotePoll
impl<'__de, __Context> BorrowDecodeUntrusted<'__de, __Context> for YesNoVotePoll
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 YesNoVotePoll
impl Clone for YesNoVotePoll
Source§fn clone(&self) -> YesNoVotePoll
fn clone(&self) -> YesNoVotePoll
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 YesNoVotePoll
impl Debug for YesNoVotePoll
Source§impl<__Context> Decode<__Context> for YesNoVotePoll
impl<__Context> Decode<__Context> for YesNoVotePoll
Source§impl<__Context> DecodeUntrusted<__Context> for YesNoVotePoll
impl<__Context> DecodeUntrusted<__Context> for YesNoVotePoll
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<'de> Deserialize<'de> for YesNoVotePoll
impl<'de> Deserialize<'de> for YesNoVotePoll
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for YesNoVotePoll
impl Display for YesNoVotePoll
Source§impl Encode for YesNoVotePoll
impl Encode for YesNoVotePoll
impl Eq for YesNoVotePoll
Source§impl From<YesNoVotePoll> for VotePoll
impl From<YesNoVotePoll> for VotePoll
Source§fn from(value: YesNoVotePoll) -> Self
fn from(value: YesNoVotePoll) -> Self
Source§impl JsonConvertible for YesNoVotePoll
impl JsonConvertible for YesNoVotePoll
impl JsonSafeFields for YesNoVotePoll
Source§impl PartialEq for YesNoVotePoll
impl PartialEq for YesNoVotePoll
Source§impl PlatformDeserializableTrusted for YesNoVotePoll
impl PlatformDeserializableTrusted for YesNoVotePoll
Source§fn deserialize_from_bytes_trusted_with_bytes_len(
bytes: &[u8],
) -> Result<(Self, usize), ProtocolError>
fn deserialize_from_bytes_trusted_with_bytes_len( bytes: &[u8], ) -> Result<(Self, usize), ProtocolError>
Source§fn deserialize_from_bytes_trusted_no_limit_with_bytes_len(
bytes: &[u8],
) -> Result<(Self, usize), ProtocolError>
fn deserialize_from_bytes_trusted_no_limit_with_bytes_len( bytes: &[u8], ) -> Result<(Self, usize), ProtocolError>
Self::deserialize_from_bytes_trusted_with_bytes_len without the
byte budget.Source§fn deserialize_from_bytes_trusted(data: &[u8]) -> Result<Self, ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_trusted(data: &[u8]) -> Result<Self, ProtocolError>where
Self: Sized,
Self::deserialize_from_bytes_trusted_exact
refuses them.fn deserialize_from_bytes_trusted_no_limit(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
Source§fn deserialize_from_bytes_trusted_exact(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_trusted_exact(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
Self::deserialize_from_bytes_trusted that also refuses bytes left
over after the value.Source§impl PlatformDeserializableUntrusted for YesNoVotePoll
impl PlatformDeserializableUntrusted for YesNoVotePoll
Source§fn deserialize_from_bytes_untrusted_with_bytes_len(
bytes: &[u8],
) -> Result<(Self, usize), ProtocolError>
fn deserialize_from_bytes_untrusted_with_bytes_len( bytes: &[u8], ) -> Result<(Self, usize), ProtocolError>
Source§fn deserialize_from_bytes_untrusted_no_limit_with_bytes_len(
bytes: &[u8],
) -> Result<(Self, usize), ProtocolError>
fn deserialize_from_bytes_untrusted_no_limit_with_bytes_len( bytes: &[u8], ) -> Result<(Self, usize), ProtocolError>
Self::deserialize_from_bytes_untrusted_with_bytes_len without the
byte budget.Source§fn deserialize_from_bytes_untrusted(data: &[u8]) -> Result<Self, ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_untrusted(data: &[u8]) -> Result<Self, ProtocolError>where
Self: Sized,
Self::deserialize_from_bytes_untrusted_exact
refuses them.fn deserialize_from_bytes_untrusted_no_limit(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
Source§fn deserialize_from_bytes_untrusted_exact(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_untrusted_exact(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
Self::deserialize_from_bytes_untrusted that also refuses bytes left
over after the value. Read moreSource§impl PlatformSerializable for YesNoVotePoll
impl PlatformSerializable for YesNoVotePoll
Source§impl PlatformVersionEncode for YesNoVotePoll
impl PlatformVersionEncode for YesNoVotePoll
Source§fn platform_encode<__E: Encoder>(
&self,
encoder: &mut __E,
platform_version: &PlatformVersion,
) -> Result<(), EncodeError>
fn platform_encode<__E: Encoder>( &self, encoder: &mut __E, platform_version: &PlatformVersion, ) -> Result<(), EncodeError>
Source§impl<'__de> PlatformVersionedBorrowDecode<'__de> for YesNoVotePoll
impl<'__de> PlatformVersionedBorrowDecode<'__de> for YesNoVotePoll
Source§fn platform_versioned_borrow_decode<__D: BorrowDecoder<'__de, Context = BincodeContext>>(
decoder: &mut __D,
platform_version: &PlatformVersion,
) -> Result<Self, DecodeError>
fn platform_versioned_borrow_decode<__D: BorrowDecoder<'__de, Context = BincodeContext>>( decoder: &mut __D, platform_version: &PlatformVersion, ) -> Result<Self, DecodeError>
Source§impl PlatformVersionedDecode for YesNoVotePoll
impl PlatformVersionedDecode for YesNoVotePoll
Source§fn platform_versioned_decode<__D: Decoder<Context = BincodeContext>>(
decoder: &mut __D,
platform_version: &PlatformVersion,
) -> Result<Self, DecodeError>
fn platform_versioned_decode<__D: Decoder<Context = BincodeContext>>( decoder: &mut __D, platform_version: &PlatformVersion, ) -> Result<Self, DecodeError>
Source§impl Serialize for YesNoVotePoll
impl Serialize for YesNoVotePoll
impl StructuralPartialEq for YesNoVotePoll
Source§impl ValueConvertible for YesNoVotePoll
impl ValueConvertible for YesNoVotePoll
fn to_object(&self) -> Result<Value, ProtocolError>where
Self: Sized,
fn into_object(self) -> Result<Value, ProtocolError>where
Self: Sized,
fn from_object(value: Value) -> Result<Self, ProtocolError>where
Self: Sized,
fn from_object_ref(value: &Value) -> Result<Self, ProtocolError>where
Self: Sized,
Auto Trait Implementations§
impl Freeze for YesNoVotePoll
impl RefUnwindSafe for YesNoVotePoll
impl Send for YesNoVotePoll
impl Sync for YesNoVotePoll
impl Unpin for YesNoVotePoll
impl UnsafeUnpin for YesNoVotePoll
impl UnwindSafe for YesNoVotePoll
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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.