-
Notifications
You must be signed in to change notification settings - Fork 0
/
vestingbalancecreateoperation.go
62 lines (49 loc) · 1.54 KB
/
vestingbalancecreateoperation.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
package operations
//go:generate ffjson $GOFILE
import (
"github.com/CybexDex/cybex-go/types"
"github.com/CybexDex/cybex-go/util"
"github.com/juju/errors"
)
func init() {
types.OperationMap[types.OperationTypeVestingBalanceCreate] = func() types.Operation {
op := &VestingBalanceCreateOperation{}
return op
}
}
type VestingBalanceCreateOperation struct {
types.OperationFee
Amount types.AssetAmount `json:"amount"`
Creator types.GrapheneID `json:"creator"`
Owner types.GrapheneID `json:"owner"`
Policy types.VestingPolicy `json:"policy"`
}
func (p VestingBalanceCreateOperation) Type() types.OperationType {
return types.OperationTypeVestingBalanceCreate
}
func (p VestingBalanceCreateOperation) Marshal(enc *util.TypeEncoder) error {
if err := enc.Encode(int8(p.Type())); err != nil {
return errors.Annotate(err, "encode OperationType")
}
if err := enc.Encode(p.Fee); err != nil {
return errors.Annotate(err, "encode fee")
}
if err := enc.Encode(p.Creator); err != nil {
return errors.Annotate(err, "encode Creator")
}
if err := enc.Encode(p.Owner); err != nil {
return errors.Annotate(err, "encode Owner")
}
if err := enc.Encode(p.Amount); err != nil {
return errors.Annotate(err, "encode Amount")
}
if err := enc.Encode(p.Policy); err != nil {
return errors.Annotate(err, "encode Policy")
}
return nil
}
//NewVestingBalanceCreateOperation creates a new VestingBalanceCreateOperation
func NewVestingBalanceCreateOperation() *VestingBalanceCreateOperation {
tx := VestingBalanceCreateOperation{}
return &tx
}