-
Notifications
You must be signed in to change notification settings - Fork 1
/
exec.go
47 lines (39 loc) · 1.57 KB
/
exec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package executor
import (
"github.com/assetcloud/chain/types"
exchangetypes "github.com/assetcloud/plugin/plugin/dapp/exchange/types"
)
/*
* 实现交易的链上执行接口
* 关键数据上链(statedb)并生成交易回执(log)
*/
// 限价交易
func (e *exchange) Exec_LimitOrder(payload *exchangetypes.LimitOrder, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(e, tx, index)
return action.LimitOrder(payload, "")
}
//市价交易
func (e *exchange) Exec_MarketOrder(payload *exchangetypes.MarketOrder, tx *types.Transaction, index int) (*types.Receipt, error) {
//TODO marketOrder
return nil, types.ErrActionNotSupport
}
// 撤单
func (e *exchange) Exec_RevokeOrder(payload *exchangetypes.RevokeOrder, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(e, tx, index)
return action.RevokeOrder(payload)
}
// 绑定委托交易地址
func (e *exchange) Exec_ExchangeBind(payload *exchangetypes.ExchangeBind, tx *types.Transaction, index int) (*types.Receipt, error) {
actiondb := NewAction(e, tx, index)
return actiondb.ExchangeBind(payload)
}
// 委托交易
func (e *exchange) Exec_EntrustOrder(payload *exchangetypes.EntrustOrder, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(e, tx, index)
return action.EntrustOrder(payload)
}
// 委托撤单
func (e *exchange) Exec_EntrustRevokeOrder(payload *exchangetypes.EntrustRevokeOrder, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(e, tx, index)
return action.EntrustRevokeOrder(payload)
}