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 json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &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 more