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
6949b26c
Commit
6949b26c
authored
Jan 17, 2019
by
linj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix isFinish and status
parent
65ecd8f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
local_order.go
plugin/dapp/trade/executor/local_order.go
+11
-8
No files found.
plugin/dapp/trade/executor/local_order.go
View file @
6949b26c
...
@@ -173,10 +173,6 @@ func NewOrderTable(kvdb db.KV) *table.Table {
...
@@ -173,10 +173,6 @@ func NewOrderTable(kvdb db.KV) *table.Table {
func
(
t
*
trade
)
genSellLimit
(
tx
*
types
.
Transaction
,
sell
*
pty
.
ReceiptSellBase
,
func
(
t
*
trade
)
genSellLimit
(
tx
*
types
.
Transaction
,
sell
*
pty
.
ReceiptSellBase
,
sellorder
*
pty
.
SellOrder
,
txIndex
string
)
*
pty
.
LocalOrder
{
sellorder
*
pty
.
SellOrder
,
txIndex
string
)
*
pty
.
LocalOrder
{
status
:=
sellorder
.
Status
if
status
==
pty
.
TradeOrderStatusRevoked
||
sell
.
SoldBoardlot
>
0
{
status
=
pty
.
TradeOrderStatusSellHalfRevoked
}
order
:=
&
pty
.
LocalOrder
{
order
:=
&
pty
.
LocalOrder
{
AssetSymbol
:
sellorder
.
TokenSymbol
,
AssetSymbol
:
sellorder
.
TokenSymbol
,
Owner
:
sellorder
.
Address
,
Owner
:
sellorder
.
Address
,
...
@@ -186,7 +182,7 @@ func (t *trade) genSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBase,
...
@@ -186,7 +182,7 @@ func (t *trade) genSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBase,
TotalBoardlot
:
sellorder
.
TotalBoardlot
,
TotalBoardlot
:
sellorder
.
TotalBoardlot
,
TradedBoardlot
:
sellorder
.
SoldBoardlot
,
TradedBoardlot
:
sellorder
.
SoldBoardlot
,
BuyID
:
""
,
BuyID
:
""
,
Status
:
status
,
Status
:
s
ellorder
.
S
tatus
,
SellID
:
sell
.
SellID
,
SellID
:
sell
.
SellID
,
TxHash
:
[]
string
{
common
.
ToHex
(
tx
.
Hash
())},
TxHash
:
[]
string
{
common
.
ToHex
(
tx
.
Hash
())},
Height
:
sell
.
Height
,
Height
:
sell
.
Height
,
...
@@ -195,6 +191,7 @@ func (t *trade) genSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBase,
...
@@ -195,6 +191,7 @@ func (t *trade) genSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBase,
IsSellOrder
:
true
,
IsSellOrder
:
true
,
AssetExec
:
sellorder
.
AssetExec
,
AssetExec
:
sellorder
.
AssetExec
,
TxIndex
:
txIndex
,
TxIndex
:
txIndex
,
IsFinished
:
false
,
}
}
return
order
return
order
}
}
...
@@ -218,6 +215,7 @@ func (t *trade) updateSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBase
...
@@ -218,6 +215,7 @@ func (t *trade) updateSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBase
order
.
Status
=
status
order
.
Status
=
status
order
.
TxHash
=
append
(
order
.
TxHash
,
common
.
ToHex
(
tx
.
Hash
()))
order
.
TxHash
=
append
(
order
.
TxHash
,
common
.
ToHex
(
tx
.
Hash
()))
order
.
TradedBoardlot
=
sellorder
.
SoldBoardlot
order
.
TradedBoardlot
=
sellorder
.
SoldBoardlot
order
.
IsFinished
=
(
status
!=
pty
.
TradeOrderStatusOnSale
)
ldb
.
Replace
(
order
)
ldb
.
Replace
(
order
)
...
@@ -241,6 +239,7 @@ func (t *trade) rollBackSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBa
...
@@ -241,6 +239,7 @@ func (t *trade) rollBackSellLimit(tx *types.Transaction, sell *pty.ReceiptSellBa
order
.
Status
=
pty
.
TradeOrderStatusOnSale
order
.
Status
=
pty
.
TradeOrderStatusOnSale
order
.
TxHash
=
order
.
TxHash
[
:
len
(
order
.
TxHash
)
-
1
]
order
.
TxHash
=
order
.
TxHash
[
:
len
(
order
.
TxHash
)
-
1
]
order
.
TradedBoardlot
=
order
.
TradedBoardlot
-
tradedBoardlot
order
.
TradedBoardlot
=
order
.
TradedBoardlot
-
tradedBoardlot
order
.
IsFinished
=
(
order
.
Status
!=
pty
.
TradeOrderStatusOnSale
)
ldb
.
Replace
(
order
)
ldb
.
Replace
(
order
)
...
@@ -285,6 +284,7 @@ func (t *trade) genSellMarket(tx *types.Transaction, sell *pty.ReceiptSellBase,
...
@@ -285,6 +284,7 @@ func (t *trade) genSellMarket(tx *types.Transaction, sell *pty.ReceiptSellBase,
IsSellOrder
:
true
,
IsSellOrder
:
true
,
AssetExec
:
sell
.
AssetExec
,
AssetExec
:
sell
.
AssetExec
,
TxIndex
:
txIndex
,
TxIndex
:
txIndex
,
IsFinished
:
true
,
}
}
return
order
return
order
}
}
...
@@ -309,6 +309,7 @@ func (t *trade) genBuyLimit(tx *types.Transaction, buy *pty.ReceiptBuyBase, txIn
...
@@ -309,6 +309,7 @@ func (t *trade) genBuyLimit(tx *types.Transaction, buy *pty.ReceiptBuyBase, txIn
IsSellOrder
:
true
,
IsSellOrder
:
true
,
AssetExec
:
buy
.
AssetExec
,
AssetExec
:
buy
.
AssetExec
,
TxIndex
:
txIndex
,
TxIndex
:
txIndex
,
IsFinished
:
false
,
}
}
return
order
return
order
}
}
...
@@ -326,12 +327,13 @@ func (t *trade) updateBuyLimit(tx *types.Transaction, buy *pty.ReceiptBuyBase,
...
@@ -326,12 +327,13 @@ func (t *trade) updateBuyLimit(tx *types.Transaction, buy *pty.ReceiptBuyBase,
}
}
status
:=
buyorder
.
Status
status
:=
buyorder
.
Status
if
status
==
pty
.
TradeOrderStatusRevoked
&&
buy
.
BoughtBoardlot
>
0
{
if
status
==
pty
.
TradeOrderStatus
Buy
Revoked
&&
buy
.
BoughtBoardlot
>
0
{
status
=
pty
.
TradeOrderStatus
Sell
HalfRevoked
status
=
pty
.
TradeOrderStatus
Buy
HalfRevoked
}
}
order
.
Status
=
status
order
.
Status
=
status
order
.
TxHash
=
append
(
order
.
TxHash
,
common
.
ToHex
(
tx
.
Hash
()))
order
.
TxHash
=
append
(
order
.
TxHash
,
common
.
ToHex
(
tx
.
Hash
()))
order
.
TradedBoardlot
=
buyorder
.
BoughtBoardlot
order
.
TradedBoardlot
=
buyorder
.
BoughtBoardlot
order
.
IsFinished
=
(
status
!=
pty
.
TradeOrderStatusOnBuy
)
ldb
.
Replace
(
order
)
ldb
.
Replace
(
order
)
...
@@ -348,12 +350,12 @@ func (t *trade) rollbackBuyLimit(tx *types.Transaction, buy *pty.ReceiptBuyBase,
...
@@ -348,12 +350,12 @@ func (t *trade) rollbackBuyLimit(tx *types.Transaction, buy *pty.ReceiptBuyBase,
order
,
ok
:=
xs
[
0
]
.
Data
.
(
*
pty
.
LocalOrder
)
order
,
ok
:=
xs
[
0
]
.
Data
.
(
*
pty
.
LocalOrder
)
if
!
ok
{
if
!
ok
{
return
nil
return
nil
}
}
order
.
Status
=
pty
.
TradeOrderStatusOnBuy
order
.
Status
=
pty
.
TradeOrderStatusOnBuy
order
.
TxHash
=
order
.
TxHash
[
:
len
(
order
.
TxHash
)
-
1
]
order
.
TxHash
=
order
.
TxHash
[
:
len
(
order
.
TxHash
)
-
1
]
order
.
TradedBoardlot
=
order
.
TradedBoardlot
-
traded
order
.
TradedBoardlot
=
order
.
TradedBoardlot
-
traded
order
.
IsFinished
=
false
ldb
.
Replace
(
order
)
ldb
.
Replace
(
order
)
...
@@ -380,6 +382,7 @@ func (t *trade) genBuyMarket(tx *types.Transaction, buy *pty.ReceiptBuyBase, txI
...
@@ -380,6 +382,7 @@ func (t *trade) genBuyMarket(tx *types.Transaction, buy *pty.ReceiptBuyBase, txI
IsSellOrder
:
true
,
IsSellOrder
:
true
,
AssetExec
:
buy
.
AssetExec
,
AssetExec
:
buy
.
AssetExec
,
TxIndex
:
txIndex
,
TxIndex
:
txIndex
,
IsFinished
:
true
,
}
}
return
order
return
order
}
}
...
...
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