-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages.go
93 lines (80 loc) · 3.16 KB
/
messages.go
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package constants
import (
sdkmath "cosmossdk.io/math"
"github.com/jinxprotocol/v4-chain/protocol/app/config"
assettypes "github.com/jinxprotocol/v4-chain/protocol/x/assets/types"
clobtypes "github.com/jinxprotocol/v4-chain/protocol/x/clob/types"
sendingtypes "github.com/jinxprotocol/v4-chain/protocol/x/sending/types"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)
func init() {
// This package does not contain the `app/config` package in its import chain, and therefore needs to call
// SetAddressPrefixes() explicitly in order to set the `jinx` address prefixes.
config.SetAddressPrefixes()
_ = TestTxBuilder.SetMsgs(Msg_PlaceOrder)
Msg_PlaceOrder_TxBtyes, _ = TestEncodingCfg.TxConfig.TxEncoder()(TestTxBuilder.GetTx())
_ = TestTxBuilder.SetMsgs(Msg_CancelOrder)
Msg_CancelOrder_TxBtyes, _ = TestEncodingCfg.TxConfig.TxEncoder()(TestTxBuilder.GetTx())
_ = TestTxBuilder.SetMsgs(Msg_Send)
Msg_Send_TxBytes, _ = TestEncodingCfg.TxConfig.TxEncoder()(TestTxBuilder.GetTx())
_ = TestTxBuilder.SetMsgs(Msg_Send_Invalid_Zero_Amount)
Msg_Send_Invalid_Zero_Amount_TxBytes, _ = TestEncodingCfg.TxConfig.TxEncoder()(TestTxBuilder.GetTx())
_ = TestTxBuilder.SetMsgs(Msg_Send, Msg_Transfer)
Msg_SendAndTransfer_TxBytes, _ = TestEncodingCfg.TxConfig.TxEncoder()(TestTxBuilder.GetTx())
}
var (
Msg_CancelOrder = &clobtypes.MsgCancelOrder{
OrderId: clobtypes.OrderId{
ClientId: 0,
SubaccountId: Alice_Num0,
},
GoodTilOneof: &clobtypes.MsgCancelOrder_GoodTilBlock{GoodTilBlock: 10},
}
Msg_CancelOrder_TxBtyes []byte
Msg_CancelOrder_LongTerm = &clobtypes.MsgCancelOrder{
OrderId: LongTermOrder_Alice_Num0_Id0_Clob0_Buy5_Price10_GTBT15.GetOrderId(),
GoodTilOneof: &clobtypes.MsgCancelOrder_GoodTilBlockTime{GoodTilBlockTime: 20},
}
Msg_CancelOrder_Conditional = &clobtypes.MsgCancelOrder{
OrderId: ConditionalOrder_Alice_Num0_Id0_Clob0_Buy5_Price10_GTBT15_StopLoss20.GetOrderId(),
GoodTilOneof: &clobtypes.MsgCancelOrder_GoodTilBlockTime{GoodTilBlockTime: 20},
}
Msg_PlaceOrder = &clobtypes.MsgPlaceOrder{
Order: Order_Alice_Num0_Id0_Clob0_Buy5_Price10_GTB15,
}
Msg_PlaceOrder_TxBtyes []byte
Msg_PlaceOrder_LongTerm = &clobtypes.MsgPlaceOrder{
Order: LongTermOrder_Alice_Num0_Id0_Clob0_Buy5_Price10_GTBT15,
}
Msg_PlaceOrder_Conditional = &clobtypes.MsgPlaceOrder{
Order: ConditionalOrder_Alice_Num0_Id0_Clob0_Buy5_Price10_GTBT15_StopLoss20,
}
Msg_Transfer = &sendingtypes.MsgCreateTransfer{
Transfer: &sendingtypes.Transfer{
Sender: Carl_Num0,
Recipient: Dave_Num0,
AssetId: assettypes.AssetUsdc.Id,
Amount: 500_000_000, // $500
},
}
Msg_Send = &banktypes.MsgSend{
FromAddress: AliceAccAddress.String(),
ToAddress: BobAccAddress.String(),
Amount: sdk.Coins{sdk.Coin{
Denom: "foo",
Amount: sdkmath.OneInt(),
}},
}
Msg_Send_TxBytes []byte
Msg_Send_Invalid_Zero_Amount = &banktypes.MsgSend{
FromAddress: AliceAccAddress.String(),
ToAddress: BobAccAddress.String(),
Amount: sdk.Coins{sdk.Coin{
Denom: "foo",
Amount: sdkmath.Int{}, // amount cannot be zero.
}},
}
Msg_Send_Invalid_Zero_Amount_TxBytes []byte
Msg_SendAndTransfer_TxBytes []byte
)