pub enum SlashMsg {
AddSlasher {
addr: String,
},
RemoveSlasher {
addr: String,
},
Slash {
addr: String,
portion: Decimal,
},
}
Expand description
A common (sort of) interface for adding/removing slashers and slashing.
This type exists so that contracts have an easy way of serializing these messages
and using something like encode_raw_msg
.
§Examples
use tg4::Tg4Contract;
use tg_utils::SlashMsg;
use cosmwasm_std::{to_binary, Addr, Response};
let tg_contract = Tg4Contract::new(Addr::unchecked("some_contract"));
let slash_msg = to_binary(&SlashMsg::AddSlasher {
addr: "some_other_contract".to_string(),
}).unwrap();
let res = Response::new()
.add_submessage(tg_contract.encode_raw_msg(slash_msg).unwrap());
Variants§
AddSlasher
Adds slasher for contract if there are enough slasher_preauths
left
RemoveSlasher
Removes slasher for contract
Slash
Slash engagement points from address
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SlashMsg
impl<'de> Deserialize<'de> for SlashMsg
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for SlashMsg
impl JsonSchema for SlashMsg
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moreimpl Eq for SlashMsg
impl StructuralPartialEq for SlashMsg
Auto Trait Implementations§
impl Freeze for SlashMsg
impl RefUnwindSafe for SlashMsg
impl Send for SlashMsg
impl Sync for SlashMsg
impl Unpin for SlashMsg
impl UnwindSafe for SlashMsg
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
Mutably borrows from an owned value. Read more