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
e2f6160a
Commit
e2f6160a
authored
Nov 23, 2018
by
sanghg
Committed by
vipwzw
Nov 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issues #58
修复make vet 提示错误
parent
40589b8e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
185 additions
and
185 deletions
+185
-185
exec_test.go
plugin/dapp/trade/executor/exec_test.go
+20
-20
kv.go
plugin/dapp/trade/executor/kv.go
+20
-20
trade_test.go
plugin/dapp/trade/executor/trade_test.go
+42
-42
tradedb.go
plugin/dapp/trade/executor/tradedb.go
+98
-98
rpc.go
plugin/dapp/trade/rpc/rpc.go
+5
-5
No files found.
plugin/dapp/trade/executor/exec_test.go
View file @
e2f6160a
...
@@ -88,13 +88,13 @@ func TestTrade_Exec_SellLimit(t *testing.T) {
...
@@ -88,13 +88,13 @@ func TestTrade_Exec_SellLimit(t *testing.T) {
driver
.
SetStateDB
(
stateDB
)
driver
.
SetStateDB
(
stateDB
)
sell
:=
&
pty
.
TradeSellTx
{
sell
:=
&
pty
.
TradeSellTx
{
Symbol
,
TokenSymbol
:
Symbol
,
sellArgs
.
amount
,
AmountPerBoardlot
:
sellArgs
.
amount
,
sellArgs
.
min
,
MinBoardlot
:
sellArgs
.
min
,
sellArgs
.
price
,
PricePerBoardlot
:
sellArgs
.
price
,
sellArgs
.
total
,
TotalBoardlot
:
sellArgs
.
total
,
0
,
Fee
:
0
,
AssetExecToken
,
AssetExec
:
AssetExec
Token
,
}
}
tx
,
_
:=
pty
.
CreateRawTradeSellTx
(
sell
)
tx
,
_
:=
pty
.
CreateRawTradeSellTx
(
sell
)
tx
,
_
=
signTx
(
tx
,
PrivKeyA
)
tx
,
_
=
signTx
(
tx
,
PrivKeyA
)
...
@@ -125,9 +125,9 @@ func TestTrade_Exec_SellLimit(t *testing.T) {
...
@@ -125,9 +125,9 @@ func TestTrade_Exec_SellLimit(t *testing.T) {
assert
.
Equal
(
t
,
string
(
Nodes
[
0
]),
sellOrder
.
Address
)
assert
.
Equal
(
t
,
string
(
Nodes
[
0
]),
sellOrder
.
Address
)
buy
:=
&
pty
.
TradeBuyTx
{
buy
:=
&
pty
.
TradeBuyTx
{
sellOrder
.
SellID
,
SellID
:
sellOrder
.
SellID
,
buyArgs
.
total
,
BoardlotCnt
:
buyArgs
.
total
,
0
,
Fee
:
0
,
}
}
tx
,
_
=
pty
.
CreateRawTradeBuyTx
(
buy
)
tx
,
_
=
pty
.
CreateRawTradeBuyTx
(
buy
)
tx
,
_
=
signTx
(
tx
,
PrivKeyB
)
tx
,
_
=
signTx
(
tx
,
PrivKeyB
)
...
@@ -197,13 +197,13 @@ func TestTrade_Exec_BuyLimit(t *testing.T) {
...
@@ -197,13 +197,13 @@ func TestTrade_Exec_BuyLimit(t *testing.T) {
driver
.
SetStateDB
(
stateDB
)
driver
.
SetStateDB
(
stateDB
)
buy
:=
&
pty
.
TradeBuyLimitTx
{
buy
:=
&
pty
.
TradeBuyLimitTx
{
Symbol
,
TokenSymbol
:
Symbol
,
buyArgs
.
amount
,
AmountPerBoardlot
:
buyArgs
.
amount
,
buyArgs
.
min
,
MinBoardlot
:
buyArgs
.
min
,
buyArgs
.
price
,
PricePerBoardlot
:
buyArgs
.
price
,
buyArgs
.
total
,
TotalBoardlot
:
buyArgs
.
total
,
0
,
Fee
:
0
,
AssetExecPara
,
AssetExec
:
AssetExec
Para
,
}
}
tx
,
_
:=
pty
.
CreateRawTradeBuyLimitTx
(
buy
)
tx
,
_
:=
pty
.
CreateRawTradeBuyLimitTx
(
buy
)
tx
,
_
=
signTx
(
tx
,
PrivKeyB
)
tx
,
_
=
signTx
(
tx
,
PrivKeyB
)
...
@@ -234,9 +234,9 @@ func TestTrade_Exec_BuyLimit(t *testing.T) {
...
@@ -234,9 +234,9 @@ func TestTrade_Exec_BuyLimit(t *testing.T) {
assert
.
Equal
(
t
,
string
(
Nodes
[
1
]),
buyLimitOrder
.
Address
)
assert
.
Equal
(
t
,
string
(
Nodes
[
1
]),
buyLimitOrder
.
Address
)
sell
:=
&
pty
.
TradeSellMarketTx
{
sell
:=
&
pty
.
TradeSellMarketTx
{
buyLimitOrder
.
BuyID
,
BuyID
:
buyLimitOrder
.
BuyID
,
sellArgs
.
total
,
BoardlotCnt
:
sellArgs
.
total
,
0
,
Fee
:
0
,
}
}
tx
,
_
=
pty
.
CreateRawTradeSellMarketTx
(
sell
)
tx
,
_
=
pty
.
CreateRawTradeSellMarketTx
(
sell
)
tx
,
_
=
signTx
(
tx
,
PrivKeyA
)
tx
,
_
=
signTx
(
tx
,
PrivKeyA
)
...
...
plugin/dapp/trade/executor/kv.go
View file @
e2f6160a
...
@@ -158,13 +158,13 @@ func genBuyMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptBuyBase
...
@@ -158,13 +158,13 @@ func genBuyMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptBuyBase
keyID
:=
receipt
.
TxHash
keyID
:=
receipt
.
TxHash
newkey
:=
calcTokenBuyOrderKey
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
,
height
)
newkey
:=
calcTokenBuyOrderKey
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
,
height
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
newkey
=
calcOnesBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesBuyOrderKeyToken
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
newkey
=
calcOnesBuyOrderKeyToken
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
priceBoardlot
,
err
:=
strconv
.
ParseFloat
(
receipt
.
PricePerBoardlot
,
64
)
priceBoardlot
,
err
:=
strconv
.
ParseFloat
(
receipt
.
PricePerBoardlot
,
64
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -180,11 +180,11 @@ func genBuyMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptBuyBase
...
@@ -180,11 +180,11 @@ func genBuyMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptBuyBase
newkey
=
calcTokensBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
status
,
newkey
=
calcTokensBuyOrderKeyStatus
(
receipt
.
TokenSymbol
,
status
,
price
,
receipt
.
Owner
,
keyID
)
price
,
receipt
.
Owner
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
st
,
ty
:=
fromStatus
(
status
)
st
,
ty
:=
fromStatus
(
status
)
newkey
=
calcOnesOrderKey
(
receipt
.
Owner
,
st
,
ty
,
height
,
keyID
)
newkey
=
calcOnesOrderKey
(
receipt
.
Owner
,
st
,
ty
,
height
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
return
kv
return
kv
}
}
...
@@ -195,13 +195,13 @@ func genSellMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptSellBa
...
@@ -195,13 +195,13 @@ func genSellMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptSellBa
keyID
:=
receipt
.
TxHash
keyID
:=
receipt
.
TxHash
newkey
:=
calcTokenSellOrderKey
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
,
height
)
newkey
:=
calcTokenSellOrderKey
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
,
height
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesSellOrderKeyStatus
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
newkey
=
calcOnesSellOrderKeyStatus
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesSellOrderKeyToken
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
newkey
=
calcOnesSellOrderKeyToken
(
receipt
.
TokenSymbol
,
receipt
.
Owner
,
status
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
priceBoardlot
,
err
:=
strconv
.
ParseFloat
(
receipt
.
PricePerBoardlot
,
64
)
priceBoardlot
,
err
:=
strconv
.
ParseFloat
(
receipt
.
PricePerBoardlot
,
64
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -217,11 +217,11 @@ func genSellMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptSellBa
...
@@ -217,11 +217,11 @@ func genSellMarketOrderKeyValue(kv []*types.KeyValue, receipt *pty.ReceiptSellBa
newkey
=
calcTokensSellOrderKeyStatus
(
receipt
.
TokenSymbol
,
status
,
newkey
=
calcTokensSellOrderKeyStatus
(
receipt
.
TokenSymbol
,
status
,
price
,
receipt
.
Owner
,
keyID
)
price
,
receipt
.
Owner
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
st
,
ty
:=
fromStatus
(
status
)
st
,
ty
:=
fromStatus
(
status
)
newkey
=
calcOnesOrderKey
(
receipt
.
Owner
,
st
,
ty
,
height
,
keyID
)
newkey
=
calcOnesOrderKey
(
receipt
.
Owner
,
st
,
ty
,
height
,
keyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
return
kv
return
kv
}
}
...
@@ -235,42 +235,42 @@ func calcPriceOfToken(priceBoardlot, AmountPerBoardlot int64) int64 {
...
@@ -235,42 +235,42 @@ func calcPriceOfToken(priceBoardlot, AmountPerBoardlot int64) int64 {
func
genBuyLimitOrderKeyValue
(
kv
[]
*
types
.
KeyValue
,
buyOrder
*
pty
.
BuyLimitOrder
,
status
int32
,
value
[]
byte
)
[]
*
types
.
KeyValue
{
func
genBuyLimitOrderKeyValue
(
kv
[]
*
types
.
KeyValue
,
buyOrder
*
pty
.
BuyLimitOrder
,
status
int32
,
value
[]
byte
)
[]
*
types
.
KeyValue
{
newkey
:=
calcTokenBuyOrderKey
(
buyOrder
.
TokenSymbol
,
buyOrder
.
Address
,
status
,
buyOrder
.
BuyID
,
buyOrder
.
Height
)
newkey
:=
calcTokenBuyOrderKey
(
buyOrder
.
TokenSymbol
,
buyOrder
.
Address
,
status
,
buyOrder
.
BuyID
,
buyOrder
.
Height
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesBuyOrderKeyStatus
(
buyOrder
.
TokenSymbol
,
buyOrder
.
Address
,
status
,
buyOrder
.
BuyID
)
newkey
=
calcOnesBuyOrderKeyStatus
(
buyOrder
.
TokenSymbol
,
buyOrder
.
Address
,
status
,
buyOrder
.
BuyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesBuyOrderKeyToken
(
buyOrder
.
TokenSymbol
,
buyOrder
.
Address
,
status
,
buyOrder
.
BuyID
)
newkey
=
calcOnesBuyOrderKeyToken
(
buyOrder
.
TokenSymbol
,
buyOrder
.
Address
,
status
,
buyOrder
.
BuyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcTokensBuyOrderKeyStatus
(
buyOrder
.
TokenSymbol
,
status
,
newkey
=
calcTokensBuyOrderKeyStatus
(
buyOrder
.
TokenSymbol
,
status
,
calcPriceOfToken
(
buyOrder
.
PricePerBoardlot
,
buyOrder
.
AmountPerBoardlot
),
buyOrder
.
Address
,
buyOrder
.
BuyID
)
calcPriceOfToken
(
buyOrder
.
PricePerBoardlot
,
buyOrder
.
AmountPerBoardlot
),
buyOrder
.
Address
,
buyOrder
.
BuyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
st
,
ty
:=
fromStatus
(
status
)
st
,
ty
:=
fromStatus
(
status
)
newkey
=
calcOnesOrderKey
(
buyOrder
.
Address
,
st
,
ty
,
buyOrder
.
Height
,
buyOrder
.
BuyID
)
newkey
=
calcOnesOrderKey
(
buyOrder
.
Address
,
st
,
ty
,
buyOrder
.
Height
,
buyOrder
.
BuyID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
return
kv
return
kv
}
}
func
genSellOrderKeyValue
(
kv
[]
*
types
.
KeyValue
,
sellorder
*
pty
.
SellOrder
,
status
int32
,
value
[]
byte
)
[]
*
types
.
KeyValue
{
func
genSellOrderKeyValue
(
kv
[]
*
types
.
KeyValue
,
sellorder
*
pty
.
SellOrder
,
status
int32
,
value
[]
byte
)
[]
*
types
.
KeyValue
{
newkey
:=
calcTokenSellOrderKey
(
sellorder
.
TokenSymbol
,
sellorder
.
Address
,
status
,
sellorder
.
SellID
,
sellorder
.
Height
)
newkey
:=
calcTokenSellOrderKey
(
sellorder
.
TokenSymbol
,
sellorder
.
Address
,
status
,
sellorder
.
SellID
,
sellorder
.
Height
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesSellOrderKeyStatus
(
sellorder
.
TokenSymbol
,
sellorder
.
Address
,
status
,
sellorder
.
SellID
)
newkey
=
calcOnesSellOrderKeyStatus
(
sellorder
.
TokenSymbol
,
sellorder
.
Address
,
status
,
sellorder
.
SellID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcOnesSellOrderKeyToken
(
sellorder
.
TokenSymbol
,
sellorder
.
Address
,
status
,
sellorder
.
SellID
)
newkey
=
calcOnesSellOrderKeyToken
(
sellorder
.
TokenSymbol
,
sellorder
.
Address
,
status
,
sellorder
.
SellID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
newkey
=
calcTokensSellOrderKeyStatus
(
sellorder
.
TokenSymbol
,
status
,
newkey
=
calcTokensSellOrderKeyStatus
(
sellorder
.
TokenSymbol
,
status
,
calcPriceOfToken
(
sellorder
.
PricePerBoardlot
,
sellorder
.
AmountPerBoardlot
),
sellorder
.
Address
,
sellorder
.
SellID
)
calcPriceOfToken
(
sellorder
.
PricePerBoardlot
,
sellorder
.
AmountPerBoardlot
),
sellorder
.
Address
,
sellorder
.
SellID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
st
,
ty
:=
fromStatus
(
status
)
st
,
ty
:=
fromStatus
(
status
)
newkey
=
calcOnesOrderKey
(
sellorder
.
Address
,
st
,
ty
,
sellorder
.
Height
,
sellorder
.
SellID
)
newkey
=
calcOnesOrderKey
(
sellorder
.
Address
,
st
,
ty
,
sellorder
.
Height
,
sellorder
.
SellID
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
newkey
,
value
})
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
newkey
,
Value
:
value
})
return
kv
return
kv
}
}
plugin/dapp/trade/executor/trade_test.go
View file @
e2f6160a
...
@@ -15,54 +15,54 @@ import (
...
@@ -15,54 +15,54 @@ import (
var
(
var
(
sellorderOnsale
=
pty
.
SellOrder
{
sellorderOnsale
=
pty
.
SellOrder
{
"Tokensymbol"
,
TokenSymbol
:
"Tokensymbol"
,
"Address"
,
Address
:
"Address"
,
20
*
1e8
,
// Amountperboardlot int64 `protobuf:"varint,3,opt,name=amountperboardlot" json:"amountperboardlot,omitempty"`
AmountPerBoardlot
:
20
*
1e8
,
// Amountperboardlot int64 `protobuf:"varint,3,opt,name=amountperboardlot" json:"amountperboardlot,omitempty"`
2
,
// Minboardlot int64 `protobuf:"varint,4,opt,name=minboardlot" json:"minboardlot,omitempty"`
MinBoardlot
:
2
,
// Minboardlot int64 `protobuf:"varint,4,opt,name=minboardlot" json:"minboardlot,omitempty"`
1
*
1e8
,
//Priceperboardlot int64 `protobuf:"varint,5,opt,name=priceperboardlot" json:"priceperboardlot,omitempty"`
PricePerBoardlot
:
1
*
1e8
,
//Priceperboardlot int64 `protobuf:"varint,5,opt,name=priceperboardlot" json:"priceperboardlot,omitempty"`
60
,
// Totalboardlot int64 `protobuf:"varint,6,opt,name=totalboardlot" json:"totalboardlot,omitempty"`
TotalBoardlot
:
60
,
// Totalboardlot int64 `protobuf:"varint,6,opt,name=totalboardlot" json:"totalboardlot,omitempty"`
2
,
// Soldboardlot int64 `protobuf:"varint,7,opt,name=soldboardlot" json:"soldboardlot,omitempty"`
SoldBoardlot
:
2
,
// Soldboardlot int64 `protobuf:"varint,7,opt,name=soldboardlot" json:"soldboardlot,omitempty"`
0
,
//Starttime int64 `protobuf:"varint,8,opt,name=starttime" json:"starttime,omitempty"`
Starttime
:
0
,
//Starttime int64 `protobuf:"varint,8,opt,name=starttime" json:"starttime,omitempty"`
0
,
//Stoptime int64 `protobuf:"varint,9,opt,name=stoptime" json:"stoptime,omitempty"`
Stoptime
:
0
,
//Stoptime int64 `protobuf:"varint,9,opt,name=stoptime" json:"stoptime,omitempty"`
false
,
//Crowdfund bool `protobuf:"varint,10,opt,name=crowdfund" json:"crowdfund,omitempty"`
Crowdfund
:
false
,
//Crowdfund bool `protobuf:"varint,10,opt,name=crowdfund" json:"crowdfund,omitempty"`
"IAMSELLID"
,
// Sellid string `protobuf:"bytes,11,opt,name=sellid" json:"sellid,omitempty"`
SellID
:
"IAMSELLID"
,
// Sellid string `protobuf:"bytes,11,opt,name=sellid" json:"sellid,omitempty"`
pty
.
TradeOrderStatusOnSale
,
//Status int32 `protobuf:"varint,12,opt,name=status" json:"status,omitempty"`
Status
:
pty
.
TradeOrderStatusOnSale
,
//Status int32 `protobuf:"varint,12,opt,name=status" json:"status,omitempty"`
100
,
//Height int64 `protobuf:"varint,13,opt,name=height" json:"height,omitempty"`
Height
:
100
,
//Height int64 `protobuf:"varint,13,opt,name=height" json:"height,omitempty"`
"token"
,
AssetExec
:
"token"
,
}
}
sellorderSoldOut
=
pty
.
SellOrder
{
sellorderSoldOut
=
pty
.
SellOrder
{
"Tokensymbol"
,
TokenSymbol
:
"Tokensymbol"
,
"Address"
,
Address
:
"Address"
,
20
*
1e8
,
// Amountperboardlot int64 `protobuf:"varint,3,opt,name=amountperboardlot" json:"amountperboardlot,omitempty"`
AmountPerBoardlot
:
20
*
1e8
,
// Amountperboardlot int64 `protobuf:"varint,3,opt,name=amountperboardlot" json:"amountperboardlot,omitempty"`
2
,
// Minboardlot int64 `protobuf:"varint,4,opt,name=minboardlot" json:"minboardlot,omitempty"`
MinBoardlot
:
2
,
// Minboardlot int64 `protobuf:"varint,4,opt,name=minboardlot" json:"minboardlot,omitempty"`
1
*
1e8
,
//Priceperboardlot int64 `protobuf:"varint,5,opt,name=priceperboardlot" json:"priceperboardlot,omitempty"`
PricePerBoardlot
:
1
*
1e8
,
//Priceperboardlot int64 `protobuf:"varint,5,opt,name=priceperboardlot" json:"priceperboardlot,omitempty"`
60
,
// Totalboardlot int64 `protobuf:"varint,6,opt,name=totalboardlot" json:"totalboardlot,omitempty"`
TotalBoardlot
:
60
,
// Totalboardlot int64 `protobuf:"varint,6,opt,name=totalboardlot" json:"totalboardlot,omitempty"`
2
,
// Soldboardlot int64 `protobuf:"varint,7,opt,name=soldboardlot" json:"soldboardlot,omitempty"`
SoldBoardlot
:
2
,
// Soldboardlot int64 `protobuf:"varint,7,opt,name=soldboardlot" json:"soldboardlot,omitempty"`
0
,
//Starttime int64 `protobuf:"varint,8,opt,name=starttime" json:"starttime,omitempty"`
Starttime
:
0
,
//Starttime int64 `protobuf:"varint,8,opt,name=starttime" json:"starttime,omitempty"`
0
,
//Stoptime int64 `protobuf:"varint,9,opt,name=stoptime" json:"stoptime,omitempty"`
Stoptime
:
0
,
//Stoptime int64 `protobuf:"varint,9,opt,name=stoptime" json:"stoptime,omitempty"`
false
,
//Crowdfund bool `protobuf:"varint,10,opt,name=crowdfund" json:"crowdfund,omitempty"`
Crowdfund
:
false
,
//Crowdfund bool `protobuf:"varint,10,opt,name=crowdfund" json:"crowdfund,omitempty"`
"IAMSELLID"
,
// Sellid string `protobuf:"bytes,11,opt,name=sellid" json:"sellid,omitempty"`
SellID
:
"IAMSELLID"
,
// Sellid string `protobuf:"bytes,11,opt,name=sellid" json:"sellid,omitempty"`
pty
.
TradeOrderStatusSoldOut
,
//Status int32 `protobuf:"varint,12,opt,name=status" json:"status,omitempty"`
Status
:
pty
.
TradeOrderStatusSoldOut
,
//Status int32 `protobuf:"varint,12,opt,name=status" json:"status,omitempty"`
100
,
//Height int64 `protobuf:"varint,13,opt,name=height" json:"height,omitempty"`
Height
:
100
,
//Height int64 `protobuf:"varint,13,opt,name=height" json:"height,omitempty"`
"token"
,
AssetExec
:
"token"
,
}
}
sellorderRevoked
=
pty
.
SellOrder
{
sellorderRevoked
=
pty
.
SellOrder
{
"Tokensymbol"
,
TokenSymbol
:
"Tokensymbol"
,
"Address"
,
Address
:
"Address"
,
20
*
1e8
,
// Amountperboardlot int64 `protobuf:"varint,3,opt,name=amountperboardlot" json:"amountperboardlot,omitempty"`
AmountPerBoardlot
:
20
*
1e8
,
// Amountperboardlot int64 `protobuf:"varint,3,opt,name=amountperboardlot" json:"amountperboardlot,omitempty"`
2
,
// Minboardlot int64 `protobuf:"varint,4,opt,name=minboardlot" json:"minboardlot,omitempty"`
MinBoardlot
:
2
,
// Minboardlot int64 `protobuf:"varint,4,opt,name=minboardlot" json:"minboardlot,omitempty"`
1
*
1e8
,
//Priceperboardlot int64 `protobuf:"varint,5,opt,name=priceperboardlot" json:"priceperboardlot,omitempty"`
PricePerBoardlot
:
1
*
1e8
,
//Priceperboardlot int64 `protobuf:"varint,5,opt,name=priceperboardlot" json:"priceperboardlot,omitempty"`
60
,
// Totalboardlot int64 `protobuf:"varint,6,opt,name=totalboardlot" json:"totalboardlot,omitempty"`
TotalBoardlot
:
60
,
// Totalboardlot int64 `protobuf:"varint,6,opt,name=totalboardlot" json:"totalboardlot,omitempty"`
2
,
// Soldboardlot int64 `protobuf:"varint,7,opt,name=soldboardlot" json:"soldboardlot,omitempty"`
SoldBoardlot
:
2
,
// Soldboardlot int64 `protobuf:"varint,7,opt,name=soldboardlot" json:"soldboardlot,omitempty"`
0
,
//Starttime int64 `protobuf:"varint,8,opt,name=starttime" json:"starttime,omitempty"`
Starttime
:
0
,
//Starttime int64 `protobuf:"varint,8,opt,name=starttime" json:"starttime,omitempty"`
0
,
//Stoptime int64 `protobuf:"varint,9,opt,name=stoptime" json:"stoptime,omitempty"`
Stoptime
:
0
,
//Stoptime int64 `protobuf:"varint,9,opt,name=stoptime" json:"stoptime,omitempty"`
false
,
//Crowdfund bool `protobuf:"varint,10,opt,name=crowdfund" json:"crowdfund,omitempty"`
Crowdfund
:
false
,
//Crowdfund bool `protobuf:"varint,10,opt,name=crowdfund" json:"crowdfund,omitempty"`
"IAMSELLID"
,
// Sellid string `protobuf:"bytes,11,opt,name=sellid" json:"sellid,omitempty"`
SellID
:
"IAMSELLID"
,
// Sellid string `protobuf:"bytes,11,opt,name=sellid" json:"sellid,omitempty"`
pty
.
TradeOrderStatusRevoked
,
//Status int32 `protobuf:"varint,12,opt,name=status" json:"status,omitempty"`
Status
:
pty
.
TradeOrderStatusRevoked
,
//Status int32 `protobuf:"varint,12,opt,name=status" json:"status,omitempty"`
100
,
//Height int64 `protobuf:"varint,13,opt,name=height" json:"height,omitempty"`
Height
:
100
,
//Height int64 `protobuf:"varint,13,opt,name=height" json:"height,omitempty"`
"token"
,
AssetExec
:
"token"
,
}
}
)
)
...
...
plugin/dapp/trade/executor/tradedb.go
View file @
e2f6160a
This diff is collapsed.
Click to expand it.
plugin/dapp/trade/rpc/rpc.go
View file @
e2f6160a
...
@@ -35,7 +35,7 @@ func (cc *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.Tra
...
@@ -35,7 +35,7 @@ func (cc *channelClient) CreateRawTradeBuyTx(ctx context.Context, in *ptypes.Tra
}
}
buy
:=
&
ptypes
.
Trade
{
buy
:=
&
ptypes
.
Trade
{
Ty
:
ptypes
.
TradeBuyMarket
,
Ty
:
ptypes
.
TradeBuyMarket
,
Value
:
&
ptypes
.
Trade_BuyMarket
{
in
},
Value
:
&
ptypes
.
Trade_BuyMarket
{
BuyMarket
:
in
},
}
}
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -52,7 +52,7 @@ func (cc *channelClient) CreateRawTradeRevokeTx(ctx context.Context, in *ptypes.
...
@@ -52,7 +52,7 @@ func (cc *channelClient) CreateRawTradeRevokeTx(ctx context.Context, in *ptypes.
}
}
buy
:=
&
ptypes
.
Trade
{
buy
:=
&
ptypes
.
Trade
{
Ty
:
ptypes
.
TradeRevokeSell
,
Ty
:
ptypes
.
TradeRevokeSell
,
Value
:
&
ptypes
.
Trade_RevokeSell
{
in
},
Value
:
&
ptypes
.
Trade_RevokeSell
{
RevokeSell
:
in
},
}
}
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -69,7 +69,7 @@ func (cc *channelClient) CreateRawTradeBuyLimitTx(ctx context.Context, in *ptype
...
@@ -69,7 +69,7 @@ func (cc *channelClient) CreateRawTradeBuyLimitTx(ctx context.Context, in *ptype
}
}
buy
:=
&
ptypes
.
Trade
{
buy
:=
&
ptypes
.
Trade
{
Ty
:
ptypes
.
TradeBuyLimit
,
Ty
:
ptypes
.
TradeBuyLimit
,
Value
:
&
ptypes
.
Trade_BuyLimit
{
in
},
Value
:
&
ptypes
.
Trade_BuyLimit
{
BuyLimit
:
in
},
}
}
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -86,7 +86,7 @@ func (cc *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *pty
...
@@ -86,7 +86,7 @@ func (cc *channelClient) CreateRawTradeSellMarketTx(ctx context.Context, in *pty
}
}
buy
:=
&
ptypes
.
Trade
{
buy
:=
&
ptypes
.
Trade
{
Ty
:
ptypes
.
TradeSellMarket
,
Ty
:
ptypes
.
TradeSellMarket
,
Value
:
&
ptypes
.
Trade_SellMarket
{
in
},
Value
:
&
ptypes
.
Trade_SellMarket
{
SellMarket
:
in
},
}
}
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -103,7 +103,7 @@ func (cc *channelClient) CreateRawTradeRevokeBuyTx(ctx context.Context, in *ptyp
...
@@ -103,7 +103,7 @@ func (cc *channelClient) CreateRawTradeRevokeBuyTx(ctx context.Context, in *ptyp
}
}
buy
:=
&
ptypes
.
Trade
{
buy
:=
&
ptypes
.
Trade
{
Ty
:
ptypes
.
TradeRevokeBuy
,
Ty
:
ptypes
.
TradeRevokeBuy
,
Value
:
&
ptypes
.
Trade_RevokeBuy
{
in
},
Value
:
&
ptypes
.
Trade_RevokeBuy
{
RevokeBuy
:
in
},
}
}
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
tx
,
err
:=
types
.
CreateFormatTx
(
types
.
ExecName
(
ptypes
.
TradeX
),
types
.
Encode
(
buy
))
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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