/
exec.go
65 lines (57 loc) · 1.98 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package executor
import (
"encoding/hex"
"github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
)
//Exec_Commit consensus commit tx exec process
func (m *Mix) Exec_Config(payload *mixTy.MixConfigAction, tx *types.Transaction, index int) (*types.Receipt, error) {
a := newAction(m, tx)
receipt, err := a.Config(payload)
if err != nil {
mlog.Error("mix config failed", "error", err, "hash", hex.EncodeToString(tx.Hash()))
return nil, err
}
return receipt, nil
}
//Exec_Deposit ...
func (m *Mix) Exec_Deposit(payload *mixTy.MixDepositAction, tx *types.Transaction, index int) (*types.Receipt, error) {
a := newAction(m, tx)
receipt, err := a.Deposit(payload)
if err != nil {
mlog.Error("mix deposit failed", "error", err, "hash", hex.EncodeToString(tx.Hash()))
return nil, err
}
return receipt, nil
}
//Exec_Withdraw ...
func (m *Mix) Exec_Withdraw(payload *mixTy.MixWithdrawAction, tx *types.Transaction, index int) (*types.Receipt, error) {
a := newAction(m, tx)
receipt, err := a.Withdraw(payload)
if err != nil {
mlog.Error("mix withdraw failed", "error", err, "hash", hex.EncodeToString(tx.Hash()))
return nil, err
}
return receipt, nil
}
func (m *Mix) Exec_Transfer(payload *mixTy.MixTransferAction, tx *types.Transaction, index int) (*types.Receipt, error) {
a := newAction(m, tx)
receipt, err := a.Transfer(payload)
if err != nil {
mlog.Error("mix config failed", "error", err, "hash", hex.EncodeToString(tx.Hash()))
return nil, err
}
return receipt, nil
}
func (m *Mix) Exec_Authorize(payload *mixTy.MixAuthorizeAction, tx *types.Transaction, index int) (*types.Receipt, error) {
a := newAction(m, tx)
receipt, err := a.Authorize(payload)
if err != nil {
mlog.Error("mix config failed", "error", err, "hash", hex.EncodeToString(tx.Hash()))
return nil, err
}
return receipt, nil
}