sei_cosmwasm/msg.rs
1use crate::sei_types::{Cancellation, DepositInfo, Metadata, Order, SettlementEntry};
2use cosmwasm_std::{Addr, Coin, CosmosMsg, CustomMsg, Uint128};
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6// implement custom query
7impl CustomMsg for SeiMsg {}
8
9// this is a helper to be able to return these as CosmosMsg easier
10impl From<SeiMsg> for CosmosMsg<SeiMsg> {
11 fn from(original: SeiMsg) -> Self {
12 CosmosMsg::Custom(original)
13 }
14}
15
16#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
17#[serde(rename_all = "snake_case")]
18pub enum SeiMsg {
19 PlaceOrders {
20 orders: Vec<Order>,
21 funds: Vec<Coin>,
22 contract_address: Addr,
23 },
24 CancelOrders {
25 cancellations: Vec<Cancellation>,
26 contract_address: Addr,
27 },
28 CreateDenom {
29 subdenom: String,
30 },
31 MintTokens {
32 amount: Coin,
33 },
34 BurnTokens {
35 amount: Coin,
36 },
37 ChangeAdmin {
38 denom: String,
39 new_admin_address: String,
40 },
41 SetMetadata {
42 metadata: Metadata,
43 },
44 /// Calls EVM contract deployed at `to` address with the given `data`.
45 /// Calls EVM contract as if the contract's caller called it directly.
46 /// Please note that the CW contract has to be in
47 /// [allow list](https://github.com/sei-protocol/sei-chain/blob/seiv2/x/evm/types/params.go#L142)
48 /// in order to execute delegate call.
49 /// The EVM (Solidity) contract `msg.sender` in this case will be the callers address.
50 DelegateCallEvm {
51 /// The address of the EVM contract to call
52 to: String,
53 /// Base64 encoded binary data to pass to the contract
54 data: String,
55 },
56 /// Calls EVM contract deployed at `to` address with specified `value` and `data`.
57 /// The from address is the contract address of the contract executing the call.
58 /// The EVM (Solidity) contract `msg.sender` in this case will be the 32-byte long
59 /// [`cosmwasm_std::CanonicalAddr`] of this contract.
60 CallEvm {
61 /// The amount to send along with the transaction. 0 if non-payable function is called.
62 value: Uint128,
63 /// The address of the EVM contract to call
64 to: String,
65 /// Base64 encoded binary data to pass to the contract
66 data: String,
67 },
68}
69
70#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
71#[serde(rename_all = "snake_case")]
72pub enum SudoMsg {
73 Settlement {
74 epoch: i64,
75 entries: Vec<SettlementEntry>,
76 },
77 BulkOrderPlacements {
78 orders: Vec<Order>,
79 deposits: Vec<DepositInfo>,
80 },
81 BulkOrderCancellations {
82 ids: Vec<u64>,
83 },
84}