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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#![allow(missing_docs)]
use crate::contracts::market::entry::{ExecuteMsg, QueryMsg};
use crate::prelude::*;
use cosmwasm_std::{Addr, Binary, Event};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ClientToBridgeWrapper {
    pub msg_id: u64,
    pub user: Addr,
    pub msg: ClientToBridgeMsg,
}

#[allow(clippy::large_enum_variant)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ClientToBridgeMsg {
    QueryMarket {
        query_msg: QueryMsg,
    },
    ExecMarket {
        exec_msg: ExecuteMsg,
        funds: Option<NumberGtZero>,
    },
    RefreshPrice,
    Crank,
    MintCollateral {
        amount: NumberGtZero,
    },
    MintAndDepositLp {
        amount: NumberGtZero,
    },

    TimeJumpSeconds {
        seconds: i64,
    },
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BridgeToClientWrapper {
    pub msg_id: u64,
    pub elapsed: f64,
    pub msg: BridgeToClientMsg,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum BridgeToClientMsg {
    MarketQueryResult { result: Binary },
    MarketExecSuccess { events: Vec<Event> },
    MarketExecFailure(ExecError),
    TimeJumpResult {},
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ExecError {
    PerpError(PerpError),
    Unknown(String),
}