Commit 6ff6fe25 authored by hezhengjun's avatar hezhengjun

Merge branch 'fix_golint_warnings_for_trade' of github.com:zhengjunhe/plugin…

Merge branch 'fix_golint_warnings_for_trade' of github.com:zhengjunhe/plugin into fix_golint_warnings_for_trade
parents d648583d 9dbe6796
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
pty "github.com/33cn/plugin/plugin/dapp/trade/types" pty "github.com/33cn/plugin/plugin/dapp/trade/types"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// TradeCmd : cmd related to trade,安装trade合约相关命令 // TradeCmd : cmd related to trade,安装trade合约相关命令
func TradeCmd() *cobra.Command { func TradeCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
......
...@@ -34,10 +34,12 @@ func init() { ...@@ -34,10 +34,12 @@ func init() {
ety := types.LoadExecutorType(driverName) ety := types.LoadExecutorType(driverName)
ety.InitFuncList(types.ListMethod(&trade{})) ety.InitFuncList(types.ListMethod(&trade{}))
} }
// Init : 注册当前trade合约 // Init : 注册当前trade合约
func Init(name string, sub []byte) { func Init(name string, sub []byte) {
drivers.Register(GetName(), newTrade, types.GetDappFork(driverName, "Enable")) drivers.Register(GetName(), newTrade, types.GetDappFork(driverName, "Enable"))
} }
// GetName : 获取trade合约名字 // GetName : 获取trade合约名字
func GetName() string { func GetName() string {
return newTrade().GetName() return newTrade().GetName()
......
...@@ -37,6 +37,7 @@ func (jrpc *Jrpc) CreateRawTradeSellTx(in *ptypes.TradeSellTx, result *interface ...@@ -37,6 +37,7 @@ func (jrpc *Jrpc) CreateRawTradeSellTx(in *ptypes.TradeSellTx, result *interface
*result = hex.EncodeToString(reply.Data) *result = hex.EncodeToString(reply.Data)
return nil return nil
} }
//CreateRawTradeBuyTx : 创建购买token的未签名交易,向指定卖单发起购买 //CreateRawTradeBuyTx : 创建购买token的未签名交易,向指定卖单发起购买
func (jrpc *Jrpc) CreateRawTradeBuyTx(in *ptypes.TradeBuyTx, result *interface{}) error { func (jrpc *Jrpc) CreateRawTradeBuyTx(in *ptypes.TradeBuyTx, result *interface{}) error {
if in == nil { if in == nil {
...@@ -54,6 +55,7 @@ func (jrpc *Jrpc) CreateRawTradeBuyTx(in *ptypes.TradeBuyTx, result *interface{} ...@@ -54,6 +55,7 @@ func (jrpc *Jrpc) CreateRawTradeBuyTx(in *ptypes.TradeBuyTx, result *interface{}
*result = hex.EncodeToString(reply.Data) *result = hex.EncodeToString(reply.Data)
return nil return nil
} }
//CreateRawTradeRevokeTx : 取消指定卖单 //CreateRawTradeRevokeTx : 取消指定卖单
func (jrpc *Jrpc) CreateRawTradeRevokeTx(in *ptypes.TradeRevokeTx, result *interface{}) error { func (jrpc *Jrpc) CreateRawTradeRevokeTx(in *ptypes.TradeRevokeTx, result *interface{}) error {
if in == nil { if in == nil {
...@@ -70,6 +72,7 @@ func (jrpc *Jrpc) CreateRawTradeRevokeTx(in *ptypes.TradeRevokeTx, result *inter ...@@ -70,6 +72,7 @@ func (jrpc *Jrpc) CreateRawTradeRevokeTx(in *ptypes.TradeRevokeTx, result *inter
*result = hex.EncodeToString(reply.Data) *result = hex.EncodeToString(reply.Data)
return nil return nil
} }
//CreateRawTradeBuyLimitTx : 挂买单购买token //CreateRawTradeBuyLimitTx : 挂买单购买token
func (jrpc *Jrpc) CreateRawTradeBuyLimitTx(in *ptypes.TradeBuyLimitTx, result *interface{}) error { func (jrpc *Jrpc) CreateRawTradeBuyLimitTx(in *ptypes.TradeBuyLimitTx, result *interface{}) error {
if in == nil { if in == nil {
...@@ -91,6 +94,7 @@ func (jrpc *Jrpc) CreateRawTradeBuyLimitTx(in *ptypes.TradeBuyLimitTx, result *i ...@@ -91,6 +94,7 @@ func (jrpc *Jrpc) CreateRawTradeBuyLimitTx(in *ptypes.TradeBuyLimitTx, result *i
*result = hex.EncodeToString(reply.Data) *result = hex.EncodeToString(reply.Data)
return nil return nil
} }
//CreateRawTradeSellMarketTx : 向指定买单出售token //CreateRawTradeSellMarketTx : 向指定买单出售token
func (jrpc *Jrpc) CreateRawTradeSellMarketTx(in *ptypes.TradeSellMarketTx, result *interface{}) error { func (jrpc *Jrpc) CreateRawTradeSellMarketTx(in *ptypes.TradeSellMarketTx, result *interface{}) error {
if in == nil { if in == nil {
...@@ -108,6 +112,7 @@ func (jrpc *Jrpc) CreateRawTradeSellMarketTx(in *ptypes.TradeSellMarketTx, resul ...@@ -108,6 +112,7 @@ func (jrpc *Jrpc) CreateRawTradeSellMarketTx(in *ptypes.TradeSellMarketTx, resul
*result = hex.EncodeToString(reply.Data) *result = hex.EncodeToString(reply.Data)
return nil return nil
} }
//CreateRawTradeRevokeBuyTx : 取消指定买单 //CreateRawTradeRevokeBuyTx : 取消指定买单
func (jrpc *Jrpc) CreateRawTradeRevokeBuyTx(in *ptypes.TradeRevokeBuyTx, result *interface{}) error { func (jrpc *Jrpc) CreateRawTradeRevokeBuyTx(in *ptypes.TradeRevokeBuyTx, result *interface{}) error {
if in == nil { if in == nil {
......
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
ptypes "github.com/33cn/plugin/plugin/dapp/trade/types" ptypes "github.com/33cn/plugin/plugin/dapp/trade/types"
) )
//CreateRawTradeSellTx : //CreateRawTradeSellTx :
func (cc *channelClient) CreateRawTradeSellTx(ctx context.Context, in *ptypes.TradeForSell) (*types.UnsignTx, error) { func (cc *channelClient) CreateRawTradeSellTx(ctx context.Context, in *ptypes.TradeForSell) (*types.UnsignTx, error) {
if in == nil { if in == nil {
...@@ -26,6 +27,7 @@ func (cc *channelClient) CreateRawTradeSellTx(ctx context.Context, in *ptypes.Tr ...@@ -26,6 +27,7 @@ func (cc *channelClient) CreateRawTradeSellTx(ctx context.Context, in *ptypes.Tr
data := types.Encode(tx) data := types.Encode(tx)
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//CreateRawTradeBuyTx : //CreateRawTradeBuyTx :
func (cc *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.TradeForBuy) (*types.UnsignTx, error) { func (cc *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.TradeForBuy) (*types.UnsignTx, error) {
if in == nil { if in == nil {
...@@ -42,6 +44,7 @@ func (cc *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.Tra ...@@ -42,6 +44,7 @@ func (cc *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.Tra
data := types.Encode(tx) data := types.Encode(tx)
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//CreateRawTradeRevokeTx : //CreateRawTradeRevokeTx :
func (cc *channelClient) CreateRawTradeRevokeTx(ctx context.Context, in *ptypes.TradeForRevokeSell) (*types.UnsignTx, error) { func (cc *channelClient) CreateRawTradeRevokeTx(ctx context.Context, in *ptypes.TradeForRevokeSell) (*types.UnsignTx, error) {
if in == nil { if in == nil {
...@@ -58,6 +61,7 @@ func (cc *channelClient) CreateRawTradeRevokeTx(ctx context.Context, in *ptypes. ...@@ -58,6 +61,7 @@ func (cc *channelClient) CreateRawTradeRevokeTx(ctx context.Context, in *ptypes.
data := types.Encode(tx) data := types.Encode(tx)
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//CreateRawTradeBuyLimitTx : //CreateRawTradeBuyLimitTx :
func (cc *channelClient) CreateRawTradeBuyLimitTx(ctx context.Context, in *ptypes.TradeForBuyLimit) (*types.UnsignTx, error) { func (cc *channelClient) CreateRawTradeBuyLimitTx(ctx context.Context, in *ptypes.TradeForBuyLimit) (*types.UnsignTx, error) {
if in == nil { if in == nil {
...@@ -74,6 +78,7 @@ func (cc *channelClient) CreateRawTradeBuyLimitTx(ctx context.Context, in *ptype ...@@ -74,6 +78,7 @@ func (cc *channelClient) CreateRawTradeBuyLimitTx(ctx context.Context, in *ptype
data := types.Encode(tx) data := types.Encode(tx)
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//CreateRawTradeSellMarketTx : //CreateRawTradeSellMarketTx :
func (cc *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *ptypes.TradeForSellMarket) (*types.UnsignTx, error) { func (cc *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *ptypes.TradeForSellMarket) (*types.UnsignTx, error) {
if in == nil { if in == nil {
...@@ -90,6 +95,7 @@ func (cc *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *pty ...@@ -90,6 +95,7 @@ func (cc *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *pty
data := types.Encode(tx) data := types.Encode(tx)
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//CreateRawTradeRevokeBuyTx : //CreateRawTradeRevokeBuyTx :
func (cc *channelClient) CreateRawTradeRevokeBuyTx(ctx context.Context, in *ptypes.TradeForRevokeBuy) (*types.UnsignTx, error) { func (cc *channelClient) CreateRawTradeRevokeBuyTx(ctx context.Context, in *ptypes.TradeForRevokeBuy) (*types.UnsignTx, error) {
if in == nil { if in == nil {
......
...@@ -13,14 +13,17 @@ import ( ...@@ -13,14 +13,17 @@ import (
type channelClient struct { type channelClient struct {
rpctypes.ChannelClient rpctypes.ChannelClient
} }
//Jrpc : Jrpc struct definition //Jrpc : Jrpc struct definition
type Jrpc struct { type Jrpc struct {
cli *channelClient cli *channelClient
} }
//Grpc : Grpc struct definition //Grpc : Grpc struct definition
type Grpc struct { type Grpc struct {
*channelClient *channelClient
} }
//Init : do the init operation //Init : do the init operation
func Init(name string, s rpctypes.RPCServer) { func Init(name string, s rpctypes.RPCServer) {
cli := &channelClient{} cli := &channelClient{}
...@@ -28,6 +31,7 @@ func Init(name string, s rpctypes.RPCServer) { ...@@ -28,6 +31,7 @@ func Init(name string, s rpctypes.RPCServer) {
cli.Init(name, s, &Jrpc{cli: cli}, grpc) cli.Init(name, s, &Jrpc{cli: cli}, grpc)
ptypes.RegisterTradeServer(s.GRPC(), grpc) ptypes.RegisterTradeServer(s.GRPC(), grpc)
} }
//GetLastMemPool : get the last memory pool //GetLastMemPool : get the last memory pool
func (jrpc *Jrpc) GetLastMemPool(in types.ReqNil, result *interface{}) error { func (jrpc *Jrpc) GetLastMemPool(in types.ReqNil, result *interface{}) error {
reply, err := jrpc.cli.GetLastMempool() reply, err := jrpc.cli.GetLastMempool()
......
...@@ -36,6 +36,7 @@ const ( ...@@ -36,6 +36,7 @@ const (
TradeOrderStatusBoughtOut TradeOrderStatusBoughtOut
TradeOrderStatusBuyRevoked TradeOrderStatusBuyRevoked
) )
//SellOrderStatus : sell order status map //SellOrderStatus : sell order status map
var SellOrderStatus = map[int32]string{ var SellOrderStatus = map[int32]string{
TradeOrderStatusNotStart: "NotStart", TradeOrderStatusNotStart: "NotStart",
...@@ -47,6 +48,7 @@ var SellOrderStatus = map[int32]string{ ...@@ -47,6 +48,7 @@ var SellOrderStatus = map[int32]string{
TradeOrderStatusBoughtOut: "BoughtOut", TradeOrderStatusBoughtOut: "BoughtOut",
TradeOrderStatusBuyRevoked: "BuyRevoked", TradeOrderStatusBuyRevoked: "BuyRevoked",
} }
//SellOrderStatus2Int : SellOrderStatus info to value in int32 //SellOrderStatus2Int : SellOrderStatus info to value in int32
var SellOrderStatus2Int = map[string]int32{ var SellOrderStatus2Int = map[string]int32{
"NotStart": TradeOrderStatusNotStart, "NotStart": TradeOrderStatusNotStart,
...@@ -58,12 +60,14 @@ var SellOrderStatus2Int = map[string]int32{ ...@@ -58,12 +60,14 @@ var SellOrderStatus2Int = map[string]int32{
"BoughtOut": TradeOrderStatusBoughtOut, "BoughtOut": TradeOrderStatusBoughtOut,
"BuyRevoked": TradeOrderStatusBuyRevoked, "BuyRevoked": TradeOrderStatusBuyRevoked,
} }
//MapSellOrderStatusStr2Int : //MapSellOrderStatusStr2Int :
var MapSellOrderStatusStr2Int = map[string]int32{ var MapSellOrderStatusStr2Int = map[string]int32{
"onsale": TradeOrderStatusOnSale, "onsale": TradeOrderStatusOnSale,
"soldout": TradeOrderStatusSoldOut, "soldout": TradeOrderStatusSoldOut,
"revoked": TradeOrderStatusRevoked, "revoked": TradeOrderStatusRevoked,
} }
//MapBuyOrderStatusStr2Int : //MapBuyOrderStatusStr2Int :
var MapBuyOrderStatusStr2Int = map[string]int32{ var MapBuyOrderStatusStr2Int = map[string]int32{
"onbuy": TradeOrderStatusOnBuy, "onbuy": TradeOrderStatusOnBuy,
......
...@@ -27,6 +27,7 @@ type RPCReplyTradeOrder struct { ...@@ -27,6 +27,7 @@ type RPCReplyTradeOrder struct {
IsSellOrder bool `protobuf:"varint,15,opt,name=isSellOrder" json:"isSellOrder"` IsSellOrder bool `protobuf:"varint,15,opt,name=isSellOrder" json:"isSellOrder"`
AssetExec string `protobuf:"bytes,16,opt,name=assetExec" json:"assetExec"` AssetExec string `protobuf:"bytes,16,opt,name=assetExec" json:"assetExec"`
} }
//MarshalJSON : //MarshalJSON :
func (reply *ReplyTradeOrder) MarshalJSON() ([]byte, error) { func (reply *ReplyTradeOrder) MarshalJSON() ([]byte, error) {
r := (*RPCReplyTradeOrder)(reply) r := (*RPCReplyTradeOrder)(reply)
......
...@@ -69,6 +69,7 @@ func newType() *tradeType { ...@@ -69,6 +69,7 @@ func newType() *tradeType {
func (t *tradeType) GetPayload() types.Message { func (t *tradeType) GetPayload() types.Message {
return &Trade{} return &Trade{}
} }
//ActionName : //ActionName :
func (t *tradeType) ActionName(tx *types.Transaction) string { func (t *tradeType) ActionName(tx *types.Transaction) string {
var action Trade var action Trade
...@@ -166,6 +167,7 @@ func (t *tradeType) CreateTx(action string, message json.RawMessage) (*types.Tra ...@@ -166,6 +167,7 @@ func (t *tradeType) CreateTx(action string, message json.RawMessage) (*types.Tra
return tx, nil return tx, nil
} }
//CreateRawTradeSellTx : 创建卖单交易 //CreateRawTradeSellTx : 创建卖单交易
func CreateRawTradeSellTx(parm *TradeSellTx) (*types.Transaction, error) { func CreateRawTradeSellTx(parm *TradeSellTx) (*types.Transaction, error) {
if parm == nil { if parm == nil {
...@@ -188,6 +190,7 @@ func CreateRawTradeSellTx(parm *TradeSellTx) (*types.Transaction, error) { ...@@ -188,6 +190,7 @@ func CreateRawTradeSellTx(parm *TradeSellTx) (*types.Transaction, error) {
} }
return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(sell)) return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(sell))
} }
//CreateRawTradeBuyTx :创建想指定卖单发起的买单交易 //CreateRawTradeBuyTx :创建想指定卖单发起的买单交易
func CreateRawTradeBuyTx(parm *TradeBuyTx) (*types.Transaction, error) { func CreateRawTradeBuyTx(parm *TradeBuyTx) (*types.Transaction, error) {
if parm == nil { if parm == nil {
...@@ -200,6 +203,7 @@ func CreateRawTradeBuyTx(parm *TradeBuyTx) (*types.Transaction, error) { ...@@ -200,6 +203,7 @@ func CreateRawTradeBuyTx(parm *TradeBuyTx) (*types.Transaction, error) {
} }
return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buy)) return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buy))
} }
//CreateRawTradeRevokeTx :创建取消卖单的交易 //CreateRawTradeRevokeTx :创建取消卖单的交易
func CreateRawTradeRevokeTx(parm *TradeRevokeTx) (*types.Transaction, error) { func CreateRawTradeRevokeTx(parm *TradeRevokeTx) (*types.Transaction, error) {
if parm == nil { if parm == nil {
...@@ -213,6 +217,7 @@ func CreateRawTradeRevokeTx(parm *TradeRevokeTx) (*types.Transaction, error) { ...@@ -213,6 +217,7 @@ func CreateRawTradeRevokeTx(parm *TradeRevokeTx) (*types.Transaction, error) {
} }
return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buy)) return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buy))
} }
//CreateRawTradeBuyLimitTx :创建买单交易 //CreateRawTradeBuyLimitTx :创建买单交易
func CreateRawTradeBuyLimitTx(parm *TradeBuyLimitTx) (*types.Transaction, error) { func CreateRawTradeBuyLimitTx(parm *TradeBuyLimitTx) (*types.Transaction, error) {
if parm == nil { if parm == nil {
...@@ -232,6 +237,7 @@ func CreateRawTradeBuyLimitTx(parm *TradeBuyLimitTx) (*types.Transaction, error) ...@@ -232,6 +237,7 @@ func CreateRawTradeBuyLimitTx(parm *TradeBuyLimitTx) (*types.Transaction, error)
} }
return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buyLimit)) return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buyLimit))
} }
//CreateRawTradeSellMarketTx : 创建向指定买单出售token的卖单交易 //CreateRawTradeSellMarketTx : 创建向指定买单出售token的卖单交易
func CreateRawTradeSellMarketTx(parm *TradeSellMarketTx) (*types.Transaction, error) { func CreateRawTradeSellMarketTx(parm *TradeSellMarketTx) (*types.Transaction, error) {
if parm == nil { if parm == nil {
...@@ -244,6 +250,7 @@ func CreateRawTradeSellMarketTx(parm *TradeSellMarketTx) (*types.Transaction, er ...@@ -244,6 +250,7 @@ func CreateRawTradeSellMarketTx(parm *TradeSellMarketTx) (*types.Transaction, er
} }
return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(sellMarket)) return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(sellMarket))
} }
//CreateRawTradeRevokeBuyTx : 取消发起的买单交易 //CreateRawTradeRevokeBuyTx : 取消发起的买单交易
func CreateRawTradeRevokeBuyTx(parm *TradeRevokeBuyTx) (*types.Transaction, error) { func CreateRawTradeRevokeBuyTx(parm *TradeRevokeBuyTx) (*types.Transaction, error) {
if parm == nil { if parm == nil {
...@@ -257,3 +264,117 @@ func CreateRawTradeRevokeBuyTx(parm *TradeRevokeBuyTx) (*types.Transaction, erro ...@@ -257,3 +264,117 @@ func CreateRawTradeRevokeBuyTx(parm *TradeRevokeBuyTx) (*types.Transaction, erro
} }
return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buy)) return types.CreateFormatTx(types.ExecName(TradeX), types.Encode(buy))
} }
// TradeSellLimitLog :
type TradeSellLimitLog struct {
}
//Name : get name string of TradeSellLimitLog
func (l TradeSellLimitLog) Name() string {
return "LogTradeSell"
}
//Decode : decode the log
func (l TradeSellLimitLog) Decode(msg []byte) (interface{}, error) {
var logTmp ReceiptTradeSellLimit
err := types.Decode(msg, &logTmp)
if err != nil {
return nil, err
}
return logTmp, err
}
//TradeSellMarketLog :
type TradeSellMarketLog struct {
}
//Name :
func (l TradeSellMarketLog) Name() string {
return "LogTradeSellMarket"
}
//Decode :
func (l TradeSellMarketLog) Decode(msg []byte) (interface{}, error) {
var logTmp ReceiptSellMarket
err := types.Decode(msg, &logTmp)
if err != nil {
return nil, err
}
return logTmp, err
}
//TradeBuyMarketLog :
type TradeBuyMarketLog struct {
}
//Name :
func (l TradeBuyMarketLog) Name() string {
return "LogTradeBuyMarket"
}
//Decode :
func (l TradeBuyMarketLog) Decode(msg []byte) (interface{}, error) {
var logTmp ReceiptTradeBuyMarket
err := types.Decode(msg, &logTmp)
if err != nil {
return nil, err
}
return logTmp, err
}
//TradeBuyLimitLog :
type TradeBuyLimitLog struct {
}
//Name :
func (l TradeBuyLimitLog) Name() string {
return "LogTradeBuyLimit"
}
//Decode :
func (l TradeBuyLimitLog) Decode(msg []byte) (interface{}, error) {
var logTmp ReceiptTradeBuyLimit
err := types.Decode(msg, &logTmp)
if err != nil {
return nil, err
}
return logTmp, err
}
//TradeBuyRevokeLog :
type TradeBuyRevokeLog struct {
}
//Name :
func (l TradeBuyRevokeLog) Name() string {
return "LogTradeBuyRevoke"
}
//Decode :
func (l TradeBuyRevokeLog) Decode(msg []byte) (interface{}, error) {
var logTmp ReceiptTradeBuyRevoke
err := types.Decode(msg, &logTmp)
if err != nil {
return nil, err
}
return logTmp, err
}
//TradeSellRevokeLog :
type TradeSellRevokeLog struct {
}
//Name :
func (l TradeSellRevokeLog) Name() string {
return "LogTradeSellRevoke"
}
//Decode :
func (l TradeSellRevokeLog) Decode(msg []byte) (interface{}, error) {
var logTmp ReceiptTradeSellRevoke
err := types.Decode(msg, &logTmp)
if err != nil {
return nil, err
}
return logTmp, err
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package types package types
//TradeSellTx : info for sell order //TradeSellTx : info for sell order
type TradeSellTx struct { type TradeSellTx struct {
TokenSymbol string `json:"tokenSymbol"` TokenSymbol string `json:"tokenSymbol"`
...@@ -13,17 +14,20 @@ type TradeSellTx struct { ...@@ -13,17 +14,20 @@ type TradeSellTx struct {
Fee int64 `json:"fee"` Fee int64 `json:"fee"`
AssetExec string `json:"assetExec"` AssetExec string `json:"assetExec"`
} }
//TradeBuyTx :info for buy order to speficied order //TradeBuyTx :info for buy order to speficied order
type TradeBuyTx struct { type TradeBuyTx struct {
SellID string `json:"sellID"` SellID string `json:"sellID"`
BoardlotCnt int64 `json:"boardlotCnt"` BoardlotCnt int64 `json:"boardlotCnt"`
Fee int64 `json:"fee"` Fee int64 `json:"fee"`
} }
//TradeRevokeTx :用于取消卖单的信息 //TradeRevokeTx :用于取消卖单的信息
type TradeRevokeTx struct { type TradeRevokeTx struct {
SellID string `json:"sellID,"` SellID string `json:"sellID,"`
Fee int64 `json:"fee"` Fee int64 `json:"fee"`
} }
//TradeBuyLimitTx :用于挂买单的信息 //TradeBuyLimitTx :用于挂买单的信息
type TradeBuyLimitTx struct { type TradeBuyLimitTx struct {
TokenSymbol string `json:"tokenSymbol"` TokenSymbol string `json:"tokenSymbol"`
...@@ -34,12 +38,14 @@ type TradeBuyLimitTx struct { ...@@ -34,12 +38,14 @@ type TradeBuyLimitTx struct {
Fee int64 `json:"fee"` Fee int64 `json:"fee"`
AssetExec string `json:"assetExec"` AssetExec string `json:"assetExec"`
} }
//TradeSellMarketTx :用于向指定买单出售token的信息 //TradeSellMarketTx :用于向指定买单出售token的信息
type TradeSellMarketTx struct { type TradeSellMarketTx struct {
BuyID string `json:"buyID"` BuyID string `json:"buyID"`
BoardlotCnt int64 `json:"boardlotCnt"` BoardlotCnt int64 `json:"boardlotCnt"`
Fee int64 `json:"fee"` Fee int64 `json:"fee"`
} }
//TradeRevokeBuyTx :取消指定买单 //TradeRevokeBuyTx :取消指定买单
type TradeRevokeBuyTx struct { type TradeRevokeBuyTx struct {
BuyID string `json:"buyID,"` BuyID string `json:"buyID,"`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment