Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
e2b9a8ab
Commit
e2b9a8ab
authored
Nov 19, 2018
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix golint warnings for trade
parent
eacf28fd
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
139 additions
and
122 deletions
+139
-122
Makefile
plugin/dapp/relay/cmd/Makefile
+1
-2
trade.go
plugin/dapp/trade/commands/trade.go
+17
-17
types.go
plugin/dapp/trade/commands/types.go
+7
-7
kv.go
plugin/dapp/trade/executor/kv.go
+6
-6
trade.go
plugin/dapp/trade/executor/trade.go
+2
-2
util.go
plugin/dapp/trade/executor/util.go
+3
-3
jrpc.go
plugin/dapp/trade/rpc/jrpc.go
+18
-17
rpc.go
plugin/dapp/trade/rpc/rpc.go
+12
-12
types.go
plugin/dapp/trade/rpc/types.go
+6
-6
const.go
plugin/dapp/trade/types/const.go
+6
-5
errors.go
plugin/dapp/trade/types/errors.go
+15
-0
rpctrade.go
plugin/dapp/trade/types/rpctrade.go
+4
-4
trade.go
plugin/dapp/trade/types/trade.go
+33
-32
trade_test.go
plugin/dapp/trade/types/trade_test.go
+3
-3
tx.go
plugin/dapp/trade/types/tx.go
+6
-6
No files found.
plugin/dapp/relay/cmd/Makefile
View file @
e2b9a8ab
all
:
all
:
chmod
+x ./build.sh
chmod
+x ./build.sh
./build.sh
$(OUT)
$(FLAG)
./build.sh
$(OUT)
$(FLAG)
\ No newline at end of file
plugin/dapp/trade/commands/trade.go
View file @
e2b9a8ab
...
@@ -15,7 +15,7 @@ import (
...
@@ -15,7 +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合约相关命令
func
TradeCmd
()
*
cobra
.
Command
{
func
TradeCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"trade"
,
Use
:
"trade"
,
...
@@ -42,7 +42,7 @@ func TradeCmd() *cobra.Command {
...
@@ -42,7 +42,7 @@ func TradeCmd() *cobra.Command {
return
cmd
return
cmd
}
}
// show one's sell order
//
ShowOnesSellOrdersCmd :
show one's sell order
func
ShowOnesSellOrdersCmd
()
*
cobra
.
Command
{
func
ShowOnesSellOrdersCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"sell_order"
,
Use
:
"sell_order"
,
...
@@ -81,7 +81,7 @@ func showOnesSellOrders(cmd *cobra.Command, args []string) {
...
@@ -81,7 +81,7 @@ func showOnesSellOrders(cmd *cobra.Command, args []string) {
ctx
.
Run
()
ctx
.
Run
()
}
}
// show one's sell order with status
//
ShowOnesSellOrdersStatusCmd :
show one's sell order with status
func
ShowOnesSellOrdersStatusCmd
()
*
cobra
.
Command
{
func
ShowOnesSellOrdersStatusCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"status_sell_order"
,
Use
:
"status_sell_order"
,
...
@@ -122,7 +122,7 @@ func showOnesSellOrdersStatus(cmd *cobra.Command, args []string) {
...
@@ -122,7 +122,7 @@ func showOnesSellOrdersStatus(cmd *cobra.Command, args []string) {
ctx
.
Run
()
ctx
.
Run
()
}
}
// show token sell order with status
//
ShowTokenSellOrdersStatusCmd :
show token sell order with status
func
ShowTokenSellOrdersStatusCmd
()
*
cobra
.
Command
{
func
ShowTokenSellOrdersStatusCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"status_token_sell_order"
,
Use
:
"status_token_sell_order"
,
...
@@ -177,9 +177,9 @@ func showTokenSellOrdersStatus(cmd *cobra.Command, args []string) {
...
@@ -177,9 +177,9 @@ func showTokenSellOrdersStatus(cmd *cobra.Command, args []string) {
func
parseSellOrders
(
arg
interface
{})
(
interface
{},
error
)
{
func
parseSellOrders
(
arg
interface
{})
(
interface
{},
error
)
{
res
:=
arg
.
(
*
pty
.
ReplyTradeOrders
)
res
:=
arg
.
(
*
pty
.
ReplyTradeOrders
)
var
result
R
eplySellOrdersResult
var
result
r
eplySellOrdersResult
for
_
,
o
:=
range
res
.
Orders
{
for
_
,
o
:=
range
res
.
Orders
{
order
:=
&
T
radeOrderResult
{
order
:=
&
t
radeOrderResult
{
TokenSymbol
:
o
.
TokenSymbol
,
TokenSymbol
:
o
.
TokenSymbol
,
Owner
:
o
.
Owner
,
Owner
:
o
.
Owner
,
BuyID
:
o
.
BuyID
,
BuyID
:
o
.
BuyID
,
...
@@ -201,7 +201,7 @@ func parseSellOrders(arg interface{}) (interface{}, error) {
...
@@ -201,7 +201,7 @@ func parseSellOrders(arg interface{}) (interface{}, error) {
return
result
,
nil
return
result
,
nil
}
}
// show one's buy order
//
ShowOnesBuyOrderCmd :
show one's buy order
func
ShowOnesBuyOrderCmd
()
*
cobra
.
Command
{
func
ShowOnesBuyOrderCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"buy_order"
,
Use
:
"buy_order"
,
...
@@ -238,7 +238,7 @@ func showOnesBuyOrders(cmd *cobra.Command, args []string) {
...
@@ -238,7 +238,7 @@ func showOnesBuyOrders(cmd *cobra.Command, args []string) {
ctx
.
Run
()
ctx
.
Run
()
}
}
// show one's buy order with status
//
ShowOnesBuyOrdersStatusCmd :
show one's buy order with status
func
ShowOnesBuyOrdersStatusCmd
()
*
cobra
.
Command
{
func
ShowOnesBuyOrdersStatusCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"status_buy_order"
,
Use
:
"status_buy_order"
,
...
@@ -278,7 +278,7 @@ func showOnesBuyOrdersStatus(cmd *cobra.Command, args []string) {
...
@@ -278,7 +278,7 @@ func showOnesBuyOrdersStatus(cmd *cobra.Command, args []string) {
ctx
.
Run
()
ctx
.
Run
()
}
}
// show token buy order with status
//
ShowTokenBuyOrdersStatusCmd :
show token buy order with status
func
ShowTokenBuyOrdersStatusCmd
()
*
cobra
.
Command
{
func
ShowTokenBuyOrdersStatusCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"status_token_buy_order"
,
Use
:
"status_token_buy_order"
,
...
@@ -333,9 +333,9 @@ func showTokenBuyOrdersStatus(cmd *cobra.Command, args []string) {
...
@@ -333,9 +333,9 @@ func showTokenBuyOrdersStatus(cmd *cobra.Command, args []string) {
func
parseBuyOrders
(
arg
interface
{})
(
interface
{},
error
)
{
func
parseBuyOrders
(
arg
interface
{})
(
interface
{},
error
)
{
res
:=
arg
.
(
*
pty
.
ReplyTradeOrders
)
res
:=
arg
.
(
*
pty
.
ReplyTradeOrders
)
var
result
R
eplyBuyOrdersResult
var
result
r
eplyBuyOrdersResult
for
_
,
o
:=
range
res
.
Orders
{
for
_
,
o
:=
range
res
.
Orders
{
order
:=
&
T
radeOrderResult
{
order
:=
&
t
radeOrderResult
{
TokenSymbol
:
o
.
TokenSymbol
,
TokenSymbol
:
o
.
TokenSymbol
,
Owner
:
o
.
Owner
,
Owner
:
o
.
Owner
,
BuyID
:
o
.
BuyID
,
BuyID
:
o
.
BuyID
,
...
@@ -357,7 +357,7 @@ func parseBuyOrders(arg interface{}) (interface{}, error) {
...
@@ -357,7 +357,7 @@ func parseBuyOrders(arg interface{}) (interface{}, error) {
return
result
,
nil
return
result
,
nil
}
}
//
//
ShowOnesOrdersStatusCmd : show one's order with status specified
func
ShowOnesOrdersStatusCmd
()
*
cobra
.
Command
{
func
ShowOnesOrdersStatusCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"status_order"
,
Use
:
"status_order"
,
...
@@ -407,9 +407,9 @@ func showOnesOrdersStatus(cmd *cobra.Command, args []string) {
...
@@ -407,9 +407,9 @@ func showOnesOrdersStatus(cmd *cobra.Command, args []string) {
func
parseTradeOrders
(
arg
interface
{})
(
interface
{},
error
)
{
func
parseTradeOrders
(
arg
interface
{})
(
interface
{},
error
)
{
res
:=
arg
.
(
*
pty
.
ReplyTradeOrders
)
res
:=
arg
.
(
*
pty
.
ReplyTradeOrders
)
var
result
R
eplyTradeOrdersResult
var
result
r
eplyTradeOrdersResult
for
_
,
o
:=
range
res
.
Orders
{
for
_
,
o
:=
range
res
.
Orders
{
order
:=
&
T
radeOrderResult
{
order
:=
&
t
radeOrderResult
{
TokenSymbol
:
o
.
TokenSymbol
,
TokenSymbol
:
o
.
TokenSymbol
,
Owner
:
o
.
Owner
,
Owner
:
o
.
Owner
,
BuyID
:
o
.
BuyID
,
BuyID
:
o
.
BuyID
,
...
@@ -433,7 +433,7 @@ func parseTradeOrders(arg interface{}) (interface{}, error) {
...
@@ -433,7 +433,7 @@ func parseTradeOrders(arg interface{}) (interface{}, error) {
/************* create trade transactions *************/
/************* create trade transactions *************/
// create raw sell token transaction
//
CreateRawTradeSellTxCmd :
create raw sell token transaction
func
CreateRawTradeSellTxCmd
()
*
cobra
.
Command
{
func
CreateRawTradeSellTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"sell"
,
Use
:
"sell"
,
...
@@ -485,7 +485,7 @@ func tokenSell(cmd *cobra.Command, args []string) {
...
@@ -485,7 +485,7 @@ func tokenSell(cmd *cobra.Command, args []string) {
ctx
.
RunWithoutMarshal
()
ctx
.
RunWithoutMarshal
()
}
}
// create raw buy token transaction
//
CreateRawTradeBuyTxCmd :
create raw buy token transaction
func
CreateRawTradeBuyTxCmd
()
*
cobra
.
Command
{
func
CreateRawTradeBuyTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"buy"
,
Use
:
"buy"
,
...
@@ -521,7 +521,7 @@ func tokenBuy(cmd *cobra.Command, args []string) {
...
@@ -521,7 +521,7 @@ func tokenBuy(cmd *cobra.Command, args []string) {
ctx
.
RunWithoutMarshal
()
ctx
.
RunWithoutMarshal
()
}
}
// create raw revoke token transaction
//
CreateRawTradeRevokeTxCmd :
create raw revoke token transaction
func
CreateRawTradeRevokeTxCmd
()
*
cobra
.
Command
{
func
CreateRawTradeRevokeTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"revoke"
,
Use
:
"revoke"
,
...
...
plugin/dapp/trade/commands/types.go
View file @
e2b9a8ab
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
package
commands
package
commands
type
T
radeOrderResult
struct
{
type
t
radeOrderResult
struct
{
TokenSymbol
string
`json:"tokenSymbol"`
TokenSymbol
string
`json:"tokenSymbol"`
Owner
string
`json:"owner"`
Owner
string
`json:"owner"`
AmountPerBoardlot
string
`json:"amountPerBoardlot"`
AmountPerBoardlot
string
`json:"amountPerBoardlot"`
...
@@ -22,14 +22,14 @@ type TradeOrderResult struct {
...
@@ -22,14 +22,14 @@ type TradeOrderResult struct {
IsSellOrder
bool
`json:"isSellOrder"`
IsSellOrder
bool
`json:"isSellOrder"`
}
}
type
R
eplySellOrdersResult
struct
{
type
r
eplySellOrdersResult
struct
{
SellOrders
[]
*
T
radeOrderResult
`json:"sellOrders"`
SellOrders
[]
*
t
radeOrderResult
`json:"sellOrders"`
}
}
type
R
eplyBuyOrdersResult
struct
{
type
r
eplyBuyOrdersResult
struct
{
BuyOrders
[]
*
T
radeOrderResult
`json:"buyOrders"`
BuyOrders
[]
*
t
radeOrderResult
`json:"buyOrders"`
}
}
type
R
eplyTradeOrdersResult
struct
{
type
r
eplyTradeOrdersResult
struct
{
Orders
[]
*
T
radeOrderResult
`json:"orders"`
Orders
[]
*
t
radeOrderResult
`json:"orders"`
}
}
plugin/dapp/trade/executor/kv.go
View file @
e2b9a8ab
...
@@ -155,15 +155,15 @@ func calcOnesOrderPrefixStatus(addr string, status int32) []byte {
...
@@ -155,15 +155,15 @@ func calcOnesOrderPrefixStatus(addr string, status int32) []byte {
func
genBuyMarketOrderKeyValue
(
kv
[]
*
types
.
KeyValue
,
receipt
*
pty
.
ReceiptBuyBase
,
func
genBuyMarketOrderKeyValue
(
kv
[]
*
types
.
KeyValue
,
receipt
*
pty
.
ReceiptBuyBase
,
status
int32
,
height
int64
,
value
[]
byte
)
[]
*
types
.
KeyValue
{
status
int32
,
height
int64
,
value
[]
byte
)
[]
*
types
.
KeyValue
{
keyI
d
:=
receipt
.
TxHash
keyI
D
:=
receipt
.
TxHash
newkey
:=
calcTokenBuyOrderKey
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyI
d
,
height
)
newkey
:=
calcTokenBuyOrderKey
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyI
D
,
height
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
newkey
=
calcOnesBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyI
d
)
newkey
=
calcOnesBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyI
D
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
newkey
=
calcOnesBuyOrderKeyToken
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyI
d
)
newkey
=
calcOnesBuyOrderKeyToken
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyI
D
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
priceBoardlot
,
err
:=
strconv
.
ParseFloat
(
receipt
.
PricePerBoardlot
,
64
)
priceBoardlot
,
err
:=
strconv
.
ParseFloat
(
receipt
.
PricePerBoardlot
,
64
)
...
@@ -179,11 +179,11 @@ func genBuyMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptBuyBase
...
@@ -179,11 +179,11 @@ func genBuyMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptBuyBase
price
:=
calcPriceOfToken
(
priceBoardlotInt64
,
AmountPerBoardlotInt64
)
price
:=
calcPriceOfToken
(
priceBoardlotInt64
,
AmountPerBoardlotInt64
)
newkey
=
calcTokensBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
status
,
newkey
=
calcTokensBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
status
,
price
,
receipt
.
Owner
,
keyI
d
)
price
,
receipt
.
Owner
,
keyI
D
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
st
,
ty
:=
fromStatus
(
status
)
st
,
ty
:=
fromStatus
(
status
)
newkey
=
calcOnesOrderKey
(
receipt
.
Owner
,
st
,
ty
,
height
,
keyI
d
)
newkey
=
calcOnesOrderKey
(
receipt
.
Owner
,
st
,
ty
,
height
,
keyI
D
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
return
kv
return
kv
...
...
plugin/dapp/trade/executor/trade.go
View file @
e2b9a8ab
...
@@ -34,11 +34,11 @@ func init() {
...
@@ -34,11 +34,11 @@ func init() {
ety
:=
types
.
LoadExecutorType
(
driverName
)
ety
:=
types
.
LoadExecutorType
(
driverName
)
ety
.
InitFuncList
(
types
.
ListMethod
(
&
trade
{}))
ety
.
InitFuncList
(
types
.
ListMethod
(
&
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合约名字
func
GetName
()
string
{
func
GetName
()
string
{
return
newTrade
()
.
GetName
()
return
newTrade
()
.
GetName
()
}
}
...
...
plugin/dapp/trade/executor/util.go
View file @
e2b9a8ab
...
@@ -26,7 +26,7 @@ import (
...
@@ -26,7 +26,7 @@ import (
*/
*/
// return exec, symbol
//
GetExecSymbol :
return exec, symbol
func
GetExecSymbol
(
order
*
pt
.
SellOrder
)
(
string
,
string
)
{
func
GetExecSymbol
(
order
*
pt
.
SellOrder
)
(
string
,
string
)
{
if
order
.
AssetExec
==
""
{
if
order
.
AssetExec
==
""
{
return
defaultAssetExec
,
defaultAssetExec
+
"."
+
order
.
TokenSymbol
return
defaultAssetExec
,
defaultAssetExec
+
"."
+
order
.
TokenSymbol
...
@@ -50,7 +50,7 @@ func checkAsset(height int64, exec, symbol string) bool {
...
@@ -50,7 +50,7 @@ func checkAsset(height int64, exec, symbol string) bool {
func
createAccountDB
(
height
int64
,
db
db
.
KV
,
exec
,
symbol
string
)
(
*
account
.
DB
,
error
)
{
func
createAccountDB
(
height
int64
,
db
db
.
KV
,
exec
,
symbol
string
)
(
*
account
.
DB
,
error
)
{
if
types
.
IsDappFork
(
height
,
pt
.
TradeX
,
"ForkTradeAsset"
)
{
if
types
.
IsDappFork
(
height
,
pt
.
TradeX
,
"ForkTradeAsset"
)
{
return
account
.
NewAccountDB
(
exec
,
symbol
,
db
)
return
account
.
NewAccountDB
(
exec
,
symbol
,
db
)
}
else
{
return
account
.
NewAccountDB
(
defaultAssetExec
,
symbol
,
db
)
}
}
return
account
.
NewAccountDB
(
defaultAssetExec
,
symbol
,
db
)
}
}
plugin/dapp/trade/rpc/jrpc.go
View file @
e2b9a8ab
...
@@ -13,7 +13,8 @@ import (
...
@@ -13,7 +13,8 @@ import (
ptypes
"github.com/33cn/plugin/plugin/dapp/trade/types"
ptypes
"github.com/33cn/plugin/plugin/dapp/trade/types"
)
)
func
(
this
*
Jrpc
)
CreateRawTradeSellTx
(
in
*
ptypes
.
TradeSellTx
,
result
*
interface
{})
error
{
//CreateRawTradeSellTx : 创建出售token的未签名交易
func
(
jrpc
*
Jrpc
)
CreateRawTradeSellTx
(
in
*
ptypes
.
TradeSellTx
,
result
*
interface
{})
error
{
if
in
==
nil
{
if
in
==
nil
{
return
types
.
ErrInvalidParam
return
types
.
ErrInvalidParam
}
}
...
@@ -29,15 +30,15 @@ func (this *Jrpc) CreateRawTradeSellTx(in *ptypes.TradeSellTx, result *interface
...
@@ -29,15 +30,15 @@ func (this *Jrpc) CreateRawTradeSellTx(in *ptypes.TradeSellTx, result *interface
AssetExec
:
in
.
AssetExec
,
AssetExec
:
in
.
AssetExec
,
}
}
reply
,
err
:=
this
.
cli
.
CreateRawTradeSellTx
(
context
.
Background
(),
param
)
reply
,
err
:=
jrpc
.
cli
.
CreateRawTradeSellTx
(
context
.
Background
(),
param
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
return
nil
}
}
//CreateRawTradeBuyTx : 创建购买token的未签名交易,向指定卖单发起购买
func
(
this
*
Jrpc
)
CreateRawTradeBuyTx
(
in
*
ptypes
.
TradeBuyTx
,
result
*
interface
{})
error
{
func
(
jrpc
*
Jrpc
)
CreateRawTradeBuyTx
(
in
*
ptypes
.
TradeBuyTx
,
result
*
interface
{})
error
{
if
in
==
nil
{
if
in
==
nil
{
return
types
.
ErrInvalidParam
return
types
.
ErrInvalidParam
}
}
...
@@ -46,15 +47,15 @@ func (this *Jrpc) CreateRawTradeBuyTx(in *ptypes.TradeBuyTx, result *interface{}
...
@@ -46,15 +47,15 @@ func (this *Jrpc) CreateRawTradeBuyTx(in *ptypes.TradeBuyTx, result *interface{}
BoardlotCnt
:
in
.
BoardlotCnt
,
BoardlotCnt
:
in
.
BoardlotCnt
,
}
}
reply
,
err
:=
this
.
cli
.
CreateRawTradeBuyTx
(
context
.
Background
(),
param
)
reply
,
err
:=
jrpc
.
cli
.
CreateRawTradeBuyTx
(
context
.
Background
(),
param
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
return
nil
}
}
//CreateRawTradeRevokeTx : 取消指定卖单
func
(
this
*
Jrpc
)
CreateRawTradeRevokeTx
(
in
*
ptypes
.
TradeRevokeTx
,
result
*
interface
{})
error
{
func
(
jrpc
*
Jrpc
)
CreateRawTradeRevokeTx
(
in
*
ptypes
.
TradeRevokeTx
,
result
*
interface
{})
error
{
if
in
==
nil
{
if
in
==
nil
{
return
types
.
ErrInvalidParam
return
types
.
ErrInvalidParam
}
}
...
@@ -62,15 +63,15 @@ func (this *Jrpc) CreateRawTradeRevokeTx(in *ptypes.TradeRevokeTx, result *inter
...
@@ -62,15 +63,15 @@ func (this *Jrpc) CreateRawTradeRevokeTx(in *ptypes.TradeRevokeTx, result *inter
SellID
:
in
.
SellID
,
SellID
:
in
.
SellID
,
}
}
reply
,
err
:=
this
.
cli
.
CreateRawTradeRevokeTx
(
context
.
Background
(),
param
)
reply
,
err
:=
jrpc
.
cli
.
CreateRawTradeRevokeTx
(
context
.
Background
(),
param
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
return
nil
}
}
//CreateRawTradeBuyLimitTx : 挂买单购买token
func
(
this
*
Jrpc
)
CreateRawTradeBuyLimitTx
(
in
*
ptypes
.
TradeBuyLimitTx
,
result
*
interface
{})
error
{
func
(
jrpc
*
Jrpc
)
CreateRawTradeBuyLimitTx
(
in
*
ptypes
.
TradeBuyLimitTx
,
result
*
interface
{})
error
{
if
in
==
nil
{
if
in
==
nil
{
return
types
.
ErrInvalidParam
return
types
.
ErrInvalidParam
}
}
...
@@ -83,15 +84,15 @@ func (this *Jrpc) CreateRawTradeBuyLimitTx(in *ptypes.TradeBuyLimitTx, result *i
...
@@ -83,15 +84,15 @@ func (this *Jrpc) CreateRawTradeBuyLimitTx(in *ptypes.TradeBuyLimitTx, result *i
AssetExec
:
in
.
AssetExec
,
AssetExec
:
in
.
AssetExec
,
}
}
reply
,
err
:=
this
.
cli
.
CreateRawTradeBuyLimitTx
(
context
.
Background
(),
param
)
reply
,
err
:=
jrpc
.
cli
.
CreateRawTradeBuyLimitTx
(
context
.
Background
(),
param
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
return
nil
}
}
//CreateRawTradeSellMarketTx : 向指定买单出售token
func
(
this
*
Jrpc
)
CreateRawTradeSellMarketTx
(
in
*
ptypes
.
TradeSellMarketTx
,
result
*
interface
{})
error
{
func
(
jrpc
*
Jrpc
)
CreateRawTradeSellMarketTx
(
in
*
ptypes
.
TradeSellMarketTx
,
result
*
interface
{})
error
{
if
in
==
nil
{
if
in
==
nil
{
return
types
.
ErrInvalidParam
return
types
.
ErrInvalidParam
}
}
...
@@ -100,15 +101,15 @@ func (this *Jrpc) CreateRawTradeSellMarketTx(in *ptypes.TradeSellMarketTx, resul
...
@@ -100,15 +101,15 @@ func (this *Jrpc) CreateRawTradeSellMarketTx(in *ptypes.TradeSellMarketTx, resul
BoardlotCnt
:
in
.
BoardlotCnt
,
BoardlotCnt
:
in
.
BoardlotCnt
,
}
}
reply
,
err
:=
this
.
cli
.
CreateRawTradeSellMarketTx
(
context
.
Background
(),
param
)
reply
,
err
:=
jrpc
.
cli
.
CreateRawTradeSellMarketTx
(
context
.
Background
(),
param
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
return
nil
}
}
//CreateRawTradeRevokeBuyTx : 取消指定买单
func
(
this
*
Jrpc
)
CreateRawTradeRevokeBuyTx
(
in
*
ptypes
.
TradeRevokeBuyTx
,
result
*
interface
{})
error
{
func
(
jrpc
*
Jrpc
)
CreateRawTradeRevokeBuyTx
(
in
*
ptypes
.
TradeRevokeBuyTx
,
result
*
interface
{})
error
{
if
in
==
nil
{
if
in
==
nil
{
return
types
.
ErrInvalidParam
return
types
.
ErrInvalidParam
}
}
...
@@ -116,7 +117,7 @@ func (this *Jrpc) CreateRawTradeRevokeBuyTx(in *ptypes.TradeRevokeBuyTx, result
...
@@ -116,7 +117,7 @@ func (this *Jrpc) CreateRawTradeRevokeBuyTx(in *ptypes.TradeRevokeBuyTx, result
BuyID
:
in
.
BuyID
,
BuyID
:
in
.
BuyID
,
}
}
reply
,
err
:=
this
.
cli
.
CreateRawTradeRevokeBuyTx
(
context
.
Background
(),
param
)
reply
,
err
:=
jrpc
.
cli
.
CreateRawTradeRevokeBuyTx
(
context
.
Background
(),
param
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
plugin/dapp/trade/rpc/rpc.go
View file @
e2b9a8ab
...
@@ -10,8 +10,8 @@ import (
...
@@ -10,8 +10,8 @@ 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 :
func
(
this
*
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
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
@@ -26,8 +26,8 @@ func (this *channelClient) CreateRawTradeSellTx(ctx context.Context, in *ptypes.
...
@@ -26,8 +26,8 @@ func (this *channelClient) CreateRawTradeSellTx(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
}
}
//CreateRawTradeBuyTx :
func
(
this
*
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
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
@@ -42,8 +42,8 @@ func (this *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.T
...
@@ -42,8 +42,8 @@ func (this *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.T
data
:=
types
.
Encode
(
tx
)
data
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
}
//CreateRawTradeRevokeTx :
func
(
this
*
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
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
@@ -58,8 +58,8 @@ func (this *channelClient) CreateRawTradeRevokeTx(ctx context.Context, in *ptype
...
@@ -58,8 +58,8 @@ func (this *channelClient) CreateRawTradeRevokeTx(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
}
}
//CreateRawTradeBuyLimitTx :
func
(
this
*
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
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
@@ -74,8 +74,8 @@ func (this *channelClient) CreateRawTradeBuyLimitTx(ctx context.Context, in *pty
...
@@ -74,8 +74,8 @@ func (this *channelClient) CreateRawTradeBuyLimitTx(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
}
}
//CreateRawTradeSellMarketTx :
func
(
this
*
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
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
@@ -90,8 +90,8 @@ func (this *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *p
...
@@ -90,8 +90,8 @@ func (this *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *p
data
:=
types
.
Encode
(
tx
)
data
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
}
//CreateRawTradeRevokeBuyTx :
func
(
this
*
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
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
...
plugin/dapp/trade/rpc/types.go
View file @
e2b9a8ab
...
@@ -13,24 +13,24 @@ import (
...
@@ -13,24 +13,24 @@ import (
type
channelClient
struct
{
type
channelClient
struct
{
rpctypes
.
ChannelClient
rpctypes
.
ChannelClient
}
}
//Jrpc : Jrpc struct definition
type
Jrpc
struct
{
type
Jrpc
struct
{
cli
*
channelClient
cli
*
channelClient
}
}
//Grpc : Grpc struct definition
type
Grpc
struct
{
type
Grpc
struct
{
*
channelClient
*
channelClient
}
}
//Init : do the init operation
func
Init
(
name
string
,
s
rpctypes
.
RPCServer
)
{
func
Init
(
name
string
,
s
rpctypes
.
RPCServer
)
{
cli
:=
&
channelClient
{}
cli
:=
&
channelClient
{}
grpc
:=
&
Grpc
{
channelClient
:
cli
}
grpc
:=
&
Grpc
{
channelClient
:
cli
}
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
func
(
this
*
Jrpc
)
GetLastMemPool
(
in
types
.
ReqNil
,
result
*
interface
{})
error
{
func
(
jrpc
*
Jrpc
)
GetLastMemPool
(
in
types
.
ReqNil
,
result
*
interface
{})
error
{
reply
,
err
:=
this
.
cli
.
GetLastMempool
()
reply
,
err
:=
jrpc
.
cli
.
GetLastMempool
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
plugin/dapp/trade/types/const.go
View file @
e2b9a8ab
...
@@ -27,7 +27,7 @@ const (
...
@@ -27,7 +27,7 @@ const (
// 0->not start, 1->on sale, 2->sold out, 3->revoke, 4->expired
// 0->not start, 1->on sale, 2->sold out, 3->revoke, 4->expired
const
(
const
(
TradeOrderStatusNotStart
=
iota
TradeOrderStatusNotStart
=
iota
//TradeOrderStatusNotStart :
TradeOrderStatusOnSale
TradeOrderStatusOnSale
TradeOrderStatusSoldOut
TradeOrderStatusSoldOut
TradeOrderStatusRevoked
TradeOrderStatusRevoked
...
@@ -36,7 +36,7 @@ const (
...
@@ -36,7 +36,7 @@ const (
TradeOrderStatusBoughtOut
TradeOrderStatusBoughtOut
TradeOrderStatusBuyRevoked
TradeOrderStatusBuyRevoked
)
)
//SellOrderStatus : sell order status map
var
SellOrderStatus
=
map
[
int32
]
string
{
var
SellOrderStatus
=
map
[
int32
]
string
{
TradeOrderStatusNotStart
:
"NotStart"
,
TradeOrderStatusNotStart
:
"NotStart"
,
TradeOrderStatusOnSale
:
"OnSale"
,
TradeOrderStatusOnSale
:
"OnSale"
,
...
@@ -47,7 +47,7 @@ var SellOrderStatus = map[int32]string{
...
@@ -47,7 +47,7 @@ var SellOrderStatus = map[int32]string{
TradeOrderStatusBoughtOut
:
"BoughtOut"
,
TradeOrderStatusBoughtOut
:
"BoughtOut"
,
TradeOrderStatusBuyRevoked
:
"BuyRevoked"
,
TradeOrderStatusBuyRevoked
:
"BuyRevoked"
,
}
}
//SellOrderStatus2Int : SellOrderStatus info to value in int32
var
SellOrderStatus2Int
=
map
[
string
]
int32
{
var
SellOrderStatus2Int
=
map
[
string
]
int32
{
"NotStart"
:
TradeOrderStatusNotStart
,
"NotStart"
:
TradeOrderStatusNotStart
,
"OnSale"
:
TradeOrderStatusOnSale
,
"OnSale"
:
TradeOrderStatusOnSale
,
...
@@ -58,13 +58,13 @@ var SellOrderStatus2Int = map[string]int32{
...
@@ -58,13 +58,13 @@ var SellOrderStatus2Int = map[string]int32{
"BoughtOut"
:
TradeOrderStatusBoughtOut
,
"BoughtOut"
:
TradeOrderStatusBoughtOut
,
"BuyRevoked"
:
TradeOrderStatusBuyRevoked
,
"BuyRevoked"
:
TradeOrderStatusBuyRevoked
,
}
}
//MapSellOrderStatusStr2Int :
var
MapSellOrderStatusStr2Int
=
map
[
string
]
int32
{
var
MapSellOrderStatusStr2Int
=
map
[
string
]
int32
{
"onsale"
:
TradeOrderStatusOnSale
,
"onsale"
:
TradeOrderStatusOnSale
,
"soldout"
:
TradeOrderStatusSoldOut
,
"soldout"
:
TradeOrderStatusSoldOut
,
"revoked"
:
TradeOrderStatusRevoked
,
"revoked"
:
TradeOrderStatusRevoked
,
}
}
//MapBuyOrderStatusStr2Int :
var
MapBuyOrderStatusStr2Int
=
map
[
string
]
int32
{
var
MapBuyOrderStatusStr2Int
=
map
[
string
]
int32
{
"onbuy"
:
TradeOrderStatusOnBuy
,
"onbuy"
:
TradeOrderStatusOnBuy
,
"boughtout"
:
TradeOrderStatusBoughtOut
,
"boughtout"
:
TradeOrderStatusBoughtOut
,
...
@@ -72,5 +72,6 @@ var MapBuyOrderStatusStr2Int = map[string]int32{
...
@@ -72,5 +72,6 @@ var MapBuyOrderStatusStr2Int = map[string]int32{
}
}
const
(
const
(
//InvalidStartTime :
InvalidStartTime
=
0
InvalidStartTime
=
0
)
)
plugin/dapp/trade/types/errors.go
View file @
e2b9a8ab
...
@@ -7,19 +7,34 @@ package types
...
@@ -7,19 +7,34 @@ package types
import
"errors"
import
"errors"
var
(
var
(
//ErrTSellBalanceNotEnough :
ErrTSellBalanceNotEnough
=
errors
.
New
(
"ErrTradeSellBalanceNotEnough"
)
ErrTSellBalanceNotEnough
=
errors
.
New
(
"ErrTradeSellBalanceNotEnough"
)
//ErrTSellOrderNotExist :
ErrTSellOrderNotExist
=
errors
.
New
(
"ErrTradeSellOrderNotExist"
)
ErrTSellOrderNotExist
=
errors
.
New
(
"ErrTradeSellOrderNotExist"
)
//ErrTSellOrderNotStart :
ErrTSellOrderNotStart
=
errors
.
New
(
"ErrTradeSellOrderNotStart"
)
ErrTSellOrderNotStart
=
errors
.
New
(
"ErrTradeSellOrderNotStart"
)
//ErrTSellOrderNotEnough :
ErrTSellOrderNotEnough
=
errors
.
New
(
"ErrTradeSellOrderNotEnough"
)
ErrTSellOrderNotEnough
=
errors
.
New
(
"ErrTradeSellOrderNotEnough"
)
//ErrTSellOrderSoldout :
ErrTSellOrderSoldout
=
errors
.
New
(
"ErrTradeSellOrderSoldout"
)
ErrTSellOrderSoldout
=
errors
.
New
(
"ErrTradeSellOrderSoldout"
)
//ErrTSellOrderRevoked :
ErrTSellOrderRevoked
=
errors
.
New
(
"ErrTradeSellOrderRevoked"
)
ErrTSellOrderRevoked
=
errors
.
New
(
"ErrTradeSellOrderRevoked"
)
//ErrTSellOrderExpired :
ErrTSellOrderExpired
=
errors
.
New
(
"ErrTradeSellOrderExpired"
)
ErrTSellOrderExpired
=
errors
.
New
(
"ErrTradeSellOrderExpired"
)
//ErrTSellOrderRevoke :
ErrTSellOrderRevoke
=
errors
.
New
(
"ErrTradeSellOrderRevokeNotAllowed"
)
ErrTSellOrderRevoke
=
errors
.
New
(
"ErrTradeSellOrderRevokeNotAllowed"
)
//ErrTSellNoSuchOrder :
ErrTSellNoSuchOrder
=
errors
.
New
(
"ErrTradeSellNoSuchOrder"
)
ErrTSellNoSuchOrder
=
errors
.
New
(
"ErrTradeSellNoSuchOrder"
)
//ErrTBuyOrderNotExist :
ErrTBuyOrderNotExist
=
errors
.
New
(
"ErrTradeBuyOrderNotExist"
)
ErrTBuyOrderNotExist
=
errors
.
New
(
"ErrTradeBuyOrderNotExist"
)
//ErrTBuyOrderNotEnough :
ErrTBuyOrderNotEnough
=
errors
.
New
(
"ErrTradeBuyOrderNotEnough"
)
ErrTBuyOrderNotEnough
=
errors
.
New
(
"ErrTradeBuyOrderNotEnough"
)
//ErrTBuyOrderSoldout :
ErrTBuyOrderSoldout
=
errors
.
New
(
"ErrTradeBuyOrderSoldout"
)
ErrTBuyOrderSoldout
=
errors
.
New
(
"ErrTradeBuyOrderSoldout"
)
//ErrTBuyOrderRevoked :
ErrTBuyOrderRevoked
=
errors
.
New
(
"ErrTradeBuyOrderRevoked"
)
ErrTBuyOrderRevoked
=
errors
.
New
(
"ErrTradeBuyOrderRevoked"
)
//ErrTBuyOrderRevoke :
ErrTBuyOrderRevoke
=
errors
.
New
(
"ErrTradeBuyOrderRevokeNotAllowed"
)
ErrTBuyOrderRevoke
=
errors
.
New
(
"ErrTradeBuyOrderRevokeNotAllowed"
)
//ErrTCntLessThanMinBoardlot :
ErrTCntLessThanMinBoardlot
=
errors
.
New
(
"ErrTradeCountLessThanMinBoardlot"
)
ErrTCntLessThanMinBoardlot
=
errors
.
New
(
"ErrTradeCountLessThanMinBoardlot"
)
)
)
plugin/dapp/trade/types/rpctrade.go
View file @
e2b9a8ab
...
@@ -8,8 +8,8 @@ import (
...
@@ -8,8 +8,8 @@ import (
"encoding/json"
"encoding/json"
)
)
// trade order
//
RPCReplyTradeOrder :
trade order
type
R
pc
ReplyTradeOrder
struct
{
type
R
PC
ReplyTradeOrder
struct
{
TokenSymbol
string
`protobuf:"bytes,1,opt,name=tokenSymbol" json:"tokenSymbol"`
TokenSymbol
string
`protobuf:"bytes,1,opt,name=tokenSymbol" json:"tokenSymbol"`
Owner
string
`protobuf:"bytes,2,opt,name=owner" json:"owner"`
Owner
string
`protobuf:"bytes,2,opt,name=owner" json:"owner"`
AmountPerBoardlot
int64
`protobuf:"varint,3,opt,name=amountPerBoardlot" json:"amountPerBoardlot"`
AmountPerBoardlot
int64
`protobuf:"varint,3,opt,name=amountPerBoardlot" json:"amountPerBoardlot"`
...
@@ -27,8 +27,8 @@ type RpcReplyTradeOrder struct {
...
@@ -27,8 +27,8 @@ 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 :
func
(
reply
*
ReplyTradeOrder
)
MarshalJSON
()
([]
byte
,
error
)
{
func
(
reply
*
ReplyTradeOrder
)
MarshalJSON
()
([]
byte
,
error
)
{
r
:=
(
*
R
pc
ReplyTradeOrder
)(
reply
)
r
:=
(
*
R
PC
ReplyTradeOrder
)(
reply
)
return
json
.
Marshal
(
r
)
return
json
.
Marshal
(
r
)
}
}
plugin/dapp/trade/types/trade.go
View file @
e2b9a8ab
...
@@ -13,6 +13,7 @@ import (
...
@@ -13,6 +13,7 @@ import (
)
)
var
(
var
(
//TradeX :
TradeX
=
"trade"
TradeX
=
"trade"
tlog
=
log
.
New
(
"module"
,
TradeX
)
tlog
=
log
.
New
(
"module"
,
TradeX
)
...
@@ -43,13 +44,13 @@ func (t *tradeType) GetTypeMap() map[string]int32 {
...
@@ -43,13 +44,13 @@ func (t *tradeType) GetTypeMap() map[string]int32 {
return
actionName
return
actionName
}
}
func
(
a
t
*
tradeType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
func
(
t
*
tradeType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
return
logInfo
return
logInfo
}
}
func
init
()
{
func
init
()
{
types
.
AllowUserExec
=
append
(
types
.
AllowUserExec
,
[]
byte
(
TradeX
))
types
.
AllowUserExec
=
append
(
types
.
AllowUserExec
,
[]
byte
(
TradeX
))
types
.
RegistorExecutor
(
TradeX
,
N
ewType
())
types
.
RegistorExecutor
(
TradeX
,
n
ewType
())
types
.
RegisterDappFork
(
TradeX
,
"Enable"
,
100899
)
types
.
RegisterDappFork
(
TradeX
,
"Enable"
,
100899
)
types
.
RegisterDappFork
(
TradeX
,
"ForkTradeBuyLimit"
,
301000
)
types
.
RegisterDappFork
(
TradeX
,
"ForkTradeBuyLimit"
,
301000
)
types
.
RegisterDappFork
(
TradeX
,
"ForkTradeAsset"
,
1010000
)
types
.
RegisterDappFork
(
TradeX
,
"ForkTradeAsset"
,
1010000
)
...
@@ -59,17 +60,17 @@ type tradeType struct {
...
@@ -59,17 +60,17 @@ type tradeType struct {
types
.
ExecTypeBase
types
.
ExecTypeBase
}
}
func
N
ewType
()
*
tradeType
{
func
n
ewType
()
*
tradeType
{
c
:=
&
tradeType
{}
c
:=
&
tradeType
{}
c
.
SetChild
(
c
)
c
.
SetChild
(
c
)
return
c
return
c
}
}
func
(
a
t
*
tradeType
)
GetPayload
()
types
.
Message
{
func
(
t
*
tradeType
)
GetPayload
()
types
.
Message
{
return
&
Trade
{}
return
&
Trade
{}
}
}
//ActionName :
func
(
t
rade
tradeType
)
ActionName
(
tx
*
types
.
Transaction
)
string
{
func
(
t
*
tradeType
)
ActionName
(
tx
*
types
.
Transaction
)
string
{
var
action
Trade
var
action
Trade
err
:=
types
.
Decode
(
tx
.
Payload
,
&
action
)
err
:=
types
.
Decode
(
tx
.
Payload
,
&
action
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -91,7 +92,7 @@ func (trade tradeType) ActionName(tx *types.Transaction) string {
...
@@ -91,7 +92,7 @@ func (trade tradeType) ActionName(tx *types.Transaction) string {
return
"unknown"
return
"unknown"
}
}
func
(
t
tradeType
)
Amount
(
tx
*
types
.
Transaction
)
(
int64
,
error
)
{
func
(
t
*
tradeType
)
Amount
(
tx
*
types
.
Transaction
)
(
int64
,
error
)
{
//TODO: 补充和完善token和trade分支的amount的计算, added by hzj
//TODO: 补充和完善token和trade分支的amount的计算, added by hzj
var
trade
Trade
var
trade
Trade
err
:=
types
.
Decode
(
tx
.
GetPayload
(),
&
trade
)
err
:=
types
.
Decode
(
tx
.
GetPayload
(),
&
trade
)
...
@@ -109,7 +110,7 @@ func (t tradeType) Amount(tx *types.Transaction) (int64, error) {
...
@@ -109,7 +110,7 @@ func (t tradeType) Amount(tx *types.Transaction) (int64, error) {
return
0
,
nil
return
0
,
nil
}
}
func
(
t
rade
tradeType
)
CreateTx
(
action
string
,
message
json
.
RawMessage
)
(
*
types
.
Transaction
,
error
)
{
func
(
t
*
tradeType
)
CreateTx
(
action
string
,
message
json
.
RawMessage
)
(
*
types
.
Transaction
,
error
)
{
var
tx
*
types
.
Transaction
var
tx
*
types
.
Transaction
if
action
==
"TradeSellLimit"
{
if
action
==
"TradeSellLimit"
{
var
param
TradeSellTx
var
param
TradeSellTx
...
@@ -165,7 +166,7 @@ func (trade tradeType) CreateTx(action string, message json.RawMessage) (*types.
...
@@ -165,7 +166,7 @@ func (trade tradeType) CreateTx(action string, message json.RawMessage) (*types.
return
tx
,
nil
return
tx
,
nil
}
}
//CreateRawTradeSellTx : 创建卖单交易
func
CreateRawTradeSellTx
(
parm
*
TradeSellTx
)
(
*
types
.
Transaction
,
error
)
{
func
CreateRawTradeSellTx
(
parm
*
TradeSellTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
if
parm
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
...
@@ -187,7 +188,7 @@ func CreateRawTradeSellTx(parm *TradeSellTx) (*types.Transaction, error) {
...
@@ -187,7 +188,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 :创建想指定卖单发起的买单交易
func
CreateRawTradeBuyTx
(
parm
*
TradeBuyTx
)
(
*
types
.
Transaction
,
error
)
{
func
CreateRawTradeBuyTx
(
parm
*
TradeBuyTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
if
parm
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
...
@@ -199,7 +200,7 @@ func CreateRawTradeBuyTx(parm *TradeBuyTx) (*types.Transaction, error) {
...
@@ -199,7 +200,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 :创建取消卖单的交易
func
CreateRawTradeRevokeTx
(
parm
*
TradeRevokeTx
)
(
*
types
.
Transaction
,
error
)
{
func
CreateRawTradeRevokeTx
(
parm
*
TradeRevokeTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
if
parm
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
...
@@ -212,7 +213,7 @@ func CreateRawTradeRevokeTx(parm *TradeRevokeTx) (*types.Transaction, error) {
...
@@ -212,7 +213,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 :创建买单交易
func
CreateRawTradeBuyLimitTx
(
parm
*
TradeBuyLimitTx
)
(
*
types
.
Transaction
,
error
)
{
func
CreateRawTradeBuyLimitTx
(
parm
*
TradeBuyLimitTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
if
parm
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
...
@@ -231,7 +232,7 @@ func CreateRawTradeBuyLimitTx(parm *TradeBuyLimitTx) (*types.Transaction, error)
...
@@ -231,7 +232,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的卖单交易
func
CreateRawTradeSellMarketTx
(
parm
*
TradeSellMarketTx
)
(
*
types
.
Transaction
,
error
)
{
func
CreateRawTradeSellMarketTx
(
parm
*
TradeSellMarketTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
if
parm
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
...
@@ -243,7 +244,7 @@ func CreateRawTradeSellMarketTx(parm *TradeSellMarketTx) (*types.Transaction, er
...
@@ -243,7 +244,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 : 取消发起的买单交易
func
CreateRawTradeRevokeBuyTx
(
parm
*
TradeRevokeBuyTx
)
(
*
types
.
Transaction
,
error
)
{
func
CreateRawTradeRevokeBuyTx
(
parm
*
TradeRevokeBuyTx
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
if
parm
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
...
@@ -257,14 +258,14 @@ func CreateRawTradeRevokeBuyTx(parm *TradeRevokeBuyTx) (*types.Transaction, erro
...
@@ -257,14 +258,14 @@ 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
))
}
}
//
log
//
TradeSellLimitLog :
type
TradeSellLimitLog
struct
{
type
TradeSellLimitLog
struct
{
}
}
//Name : get name string of TradeSellLimitLog
func
(
l
TradeSellLimitLog
)
Name
()
string
{
func
(
l
TradeSellLimitLog
)
Name
()
string
{
return
"LogTradeSell"
return
"LogTradeSell"
}
}
//Decode : decode the log
func
(
l
TradeSellLimitLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
func
(
l
TradeSellLimitLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
var
logTmp
ReceiptTradeSellLimit
var
logTmp
ReceiptTradeSellLimit
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
...
@@ -273,14 +274,14 @@ func (l TradeSellLimitLog) Decode(msg []byte) (interface{}, error) {
...
@@ -273,14 +274,14 @@ func (l TradeSellLimitLog) Decode(msg []byte) (interface{}, error) {
}
}
return
logTmp
,
err
return
logTmp
,
err
}
}
//TradeSellMarketLog :
type
TradeSellMarketLog
struct
{
type
TradeSellMarketLog
struct
{
}
}
//Name :
func
(
l
TradeSellMarketLog
)
Name
()
string
{
func
(
l
TradeSellMarketLog
)
Name
()
string
{
return
"LogTradeSellMarket"
return
"LogTradeSellMarket"
}
}
//Decode :
func
(
l
TradeSellMarketLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
func
(
l
TradeSellMarketLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
var
logTmp
ReceiptSellMarket
var
logTmp
ReceiptSellMarket
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
...
@@ -289,14 +290,14 @@ func (l TradeSellMarketLog) Decode(msg []byte) (interface{}, error) {
...
@@ -289,14 +290,14 @@ func (l TradeSellMarketLog) Decode(msg []byte) (interface{}, error) {
}
}
return
logTmp
,
err
return
logTmp
,
err
}
}
//TradeBuyMarketLog :
type
TradeBuyMarketLog
struct
{
type
TradeBuyMarketLog
struct
{
}
}
//Name :
func
(
l
TradeBuyMarketLog
)
Name
()
string
{
func
(
l
TradeBuyMarketLog
)
Name
()
string
{
return
"LogTradeBuyMarket"
return
"LogTradeBuyMarket"
}
}
//Decode :
func
(
l
TradeBuyMarketLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
func
(
l
TradeBuyMarketLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
var
logTmp
ReceiptTradeBuyMarket
var
logTmp
ReceiptTradeBuyMarket
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
...
@@ -305,14 +306,14 @@ func (l TradeBuyMarketLog) Decode(msg []byte) (interface{}, error) {
...
@@ -305,14 +306,14 @@ func (l TradeBuyMarketLog) Decode(msg []byte) (interface{}, error) {
}
}
return
logTmp
,
err
return
logTmp
,
err
}
}
//TradeBuyLimitLog :
type
TradeBuyLimitLog
struct
{
type
TradeBuyLimitLog
struct
{
}
}
//Name :
func
(
l
TradeBuyLimitLog
)
Name
()
string
{
func
(
l
TradeBuyLimitLog
)
Name
()
string
{
return
"LogTradeBuyLimit"
return
"LogTradeBuyLimit"
}
}
//Decode :
func
(
l
TradeBuyLimitLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
func
(
l
TradeBuyLimitLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
var
logTmp
ReceiptTradeBuyLimit
var
logTmp
ReceiptTradeBuyLimit
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
...
@@ -321,14 +322,14 @@ func (l TradeBuyLimitLog) Decode(msg []byte) (interface{}, error) {
...
@@ -321,14 +322,14 @@ func (l TradeBuyLimitLog) Decode(msg []byte) (interface{}, error) {
}
}
return
logTmp
,
err
return
logTmp
,
err
}
}
//TradeBuyRevokeLog :
type
TradeBuyRevokeLog
struct
{
type
TradeBuyRevokeLog
struct
{
}
}
//Name :
func
(
l
TradeBuyRevokeLog
)
Name
()
string
{
func
(
l
TradeBuyRevokeLog
)
Name
()
string
{
return
"LogTradeBuyRevoke"
return
"LogTradeBuyRevoke"
}
}
//Decode :
func
(
l
TradeBuyRevokeLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
func
(
l
TradeBuyRevokeLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
var
logTmp
ReceiptTradeBuyRevoke
var
logTmp
ReceiptTradeBuyRevoke
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
...
@@ -337,14 +338,14 @@ func (l TradeBuyRevokeLog) Decode(msg []byte) (interface{}, error) {
...
@@ -337,14 +338,14 @@ func (l TradeBuyRevokeLog) Decode(msg []byte) (interface{}, error) {
}
}
return
logTmp
,
err
return
logTmp
,
err
}
}
//TradeSellRevokeLog :
type
TradeSellRevokeLog
struct
{
type
TradeSellRevokeLog
struct
{
}
}
//Name :
func
(
l
TradeSellRevokeLog
)
Name
()
string
{
func
(
l
TradeSellRevokeLog
)
Name
()
string
{
return
"LogTradeSellRevoke"
return
"LogTradeSellRevoke"
}
}
//Decode :
func
(
l
TradeSellRevokeLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
func
(
l
TradeSellRevokeLog
)
Decode
(
msg
[]
byte
)
(
interface
{},
error
)
{
var
logTmp
ReceiptTradeSellRevoke
var
logTmp
ReceiptTradeSellRevoke
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
err
:=
types
.
Decode
(
msg
,
&
logTmp
)
...
...
plugin/dapp/trade/types/trade_test.go
View file @
e2b9a8ab
...
@@ -11,19 +11,19 @@ import (
...
@@ -11,19 +11,19 @@ import (
)
)
func
TestTradeType_GetName
(
t
*
testing
.
T
)
{
func
TestTradeType_GetName
(
t
*
testing
.
T
)
{
tp
:=
N
ewType
()
tp
:=
n
ewType
()
assert
.
Equal
(
t
,
TradeX
,
tp
.
GetName
())
assert
.
Equal
(
t
,
TradeX
,
tp
.
GetName
())
}
}
func
TestTradeType_GetTypeMap
(
t
*
testing
.
T
)
{
func
TestTradeType_GetTypeMap
(
t
*
testing
.
T
)
{
tp
:=
N
ewType
()
tp
:=
n
ewType
()
actoins
:=
tp
.
GetTypeMap
()
actoins
:=
tp
.
GetTypeMap
()
assert
.
NotNil
(
t
,
actoins
)
assert
.
NotNil
(
t
,
actoins
)
assert
.
NotEqual
(
t
,
0
,
len
(
actoins
))
assert
.
NotEqual
(
t
,
0
,
len
(
actoins
))
}
}
func
TestTradeType_GetLogMap
(
t
*
testing
.
T
)
{
func
TestTradeType_GetLogMap
(
t
*
testing
.
T
)
{
tp
:=
N
ewType
()
tp
:=
n
ewType
()
l
:=
tp
.
GetLogMap
()
l
:=
tp
.
GetLogMap
()
assert
.
NotNil
(
t
,
l
)
assert
.
NotNil
(
t
,
l
)
assert
.
NotEqual
(
t
,
0
,
len
(
l
))
assert
.
NotEqual
(
t
,
0
,
len
(
l
))
...
...
plugin/dapp/trade/types/tx.go
View file @
e2b9a8ab
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +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
type
TradeSellTx
struct
{
type
TradeSellTx
struct
{
TokenSymbol
string
`json:"tokenSymbol"`
TokenSymbol
string
`json:"tokenSymbol"`
AmountPerBoardlot
int64
`json:"amountPerBoardlot"`
AmountPerBoardlot
int64
`json:"amountPerBoardlot"`
...
@@ -13,18 +13,18 @@ type TradeSellTx struct {
...
@@ -13,18 +13,18 @@ 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
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 :用于取消卖单的信息
type
TradeRevokeTx
struct
{
type
TradeRevokeTx
struct
{
SellID
string
`json:"sellID,"`
SellID
string
`json:"sellID,"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
}
}
//TradeBuyLimitTx :用于挂买单的信息
type
TradeBuyLimitTx
struct
{
type
TradeBuyLimitTx
struct
{
TokenSymbol
string
`json:"tokenSymbol"`
TokenSymbol
string
`json:"tokenSymbol"`
AmountPerBoardlot
int64
`json:"amountPerBoardlot"`
AmountPerBoardlot
int64
`json:"amountPerBoardlot"`
...
@@ -34,13 +34,13 @@ type TradeBuyLimitTx struct {
...
@@ -34,13 +34,13 @@ type TradeBuyLimitTx struct {
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
AssetExec
string
`json:"assetExec"`
AssetExec
string
`json:"assetExec"`
}
}
//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 :取消指定买单
type
TradeRevokeBuyTx
struct
{
type
TradeRevokeBuyTx
struct
{
BuyID
string
`json:"buyID,"`
BuyID
string
`json:"buyID,"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment