1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
use codec::{Decode, Encode}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_runtime::DispatchError; pub trait Verifiable { fn verify(&self) -> Result<(), DispatchError>; } #[derive(Clone, Eq, PartialEq, Default, Encode, Decode, Hash)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct DefaultParameters { pub can_be_nominated: bool, pub option_expired: u128, pub option_p: u128, } impl Verifiable for DefaultParameters { fn verify(&self) -> Result<(), DispatchError> { Ok(()) } } #[cfg(feature = "std")] impl std::fmt::Display for DefaultParameters { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } impl sp_std::fmt::Debug for DefaultParameters { #[cfg(feature = "std")] fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "{:?}", self) } #[cfg(not(feature = "std"))] fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) } }