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
3c9a08ca
Commit
3c9a08ca
authored
Dec 10, 2019
by
harrylee
Committed by
vipwzw
Dec 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add just some code
parent
5d8922a2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
exchange.go
plugin/dapp/exchange/executor/exchange.go
+3
-0
exchange_test.go
plugin/dapp/exchange/executor/exchange_test.go
+10
-1
exec.go
plugin/dapp/exchange/executor/exec.go
+1
-2
No files found.
plugin/dapp/exchange/executor/exchange.go
View file @
3c9a08ca
...
...
@@ -76,6 +76,9 @@ func (e *exchange) CheckTx(tx *types.Transaction, index int) error {
return
exchangetypes
.
ErrAssetOp
}
}
if
exchange
.
Ty
==
exchangetypes
.
TyMarketOrderAction
{
return
types
.
ErrActionNotSupport
}
return
nil
}
...
...
plugin/dapp/exchange/executor/exchange_test.go
View file @
3c9a08ca
...
...
@@ -422,7 +422,7 @@ func TestExchange(t *testing.T) {
//订单1的状态应该还是ordered
reply
=
msg
.
(
*
et
.
Order
)
assert
.
Equal
(
t
,
int32
(
et
.
Completed
),
reply
.
Status
)
//根据op查询市场深度
//根据op查询市场深度
,这时候应该查不到
msg
,
err
=
exec
.
Query
(
et
.
FuncNameQueryMarketDepth
,
types
.
Encode
(
&
et
.
QueryMarketDepth
{
LeftAsset
:
&
et
.
Asset
{
Symbol
:
"bty"
,
Execer
:
"coins"
},
RightAsset
:
&
et
.
Asset
{
Execer
:
"paracross"
,
Symbol
:
"coins.bty"
},
Op
:
et
.
OpSell
}))
if
err
!=
nil
{
...
...
@@ -430,6 +430,15 @@ func TestExchange(t *testing.T) {
}
reply1
=
msg
.
(
*
et
.
MarketDepthList
)
t
.
Log
(
reply1
.
List
)
//根据状态和地址查询
msg
,
err
=
exec
.
Query
(
et
.
FuncNameQueryOrderList
,
types
.
Encode
(
&
et
.
QueryOrderList
{
Status
:
et
.
Completed
,
Address
:
string
(
Nodes
[
0
])}))
if
err
!=
nil
{
t
.
Error
(
err
)
}
reply2
=
msg
.
(
*
et
.
OrderList
)
t
.
Log
(
reply2
)
assert
.
Equal
(
t
,
2
,
len
(
reply2
.
List
))
}
func
signTx
(
tx
*
types
.
Transaction
,
hexPrivKey
string
)
(
*
types
.
Transaction
,
error
)
{
...
...
plugin/dapp/exchange/executor/exec.go
View file @
3c9a08ca
package
executor
import
(
"fmt"
"github.com/33cn/chain33/types"
exchangetypes
"github.com/33cn/plugin/plugin/dapp/exchange/types"
)
...
...
@@ -18,7 +17,7 @@ func (e *exchange) Exec_LimitOrder(payload *exchangetypes.LimitOrder, tx *types.
func
(
e
*
exchange
)
Exec_MarketOrder
(
payload
*
exchangetypes
.
MarketOrder
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
//TODO marketOrder
return
nil
,
fmt
.
Errorf
(
"%s"
,
"not support MarketOrder.."
)
return
nil
,
types
.
ErrActionNotSupport
}
func
(
e
*
exchange
)
Exec_RevokeOrder
(
payload
*
exchangetypes
.
RevokeOrder
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
...
...
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