-
Notifications
You must be signed in to change notification settings - Fork 0
/
vestingbalancewithdrawoperation.go
57 lines (45 loc) · 1.46 KB
/
vestingbalancewithdrawoperation.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
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.OperationTypeVestingBalanceWithdraw] = func() types.Operation {
op := &VestingBalanceWithdrawOperation{}
return op
}
}
type VestingBalanceWithdrawOperation struct {
types.OperationFee
Amount types.AssetAmount `json:"amount"`
Owner types.GrapheneID `json:"owner"`
VestingBalance types.GrapheneID `json:"vesting_balance"`
}
func (p VestingBalanceWithdrawOperation) Type() types.OperationType {
return types.OperationTypeVestingBalanceWithdraw
}
func (p VestingBalanceWithdrawOperation) 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.VestingBalance); err != nil {
return errors.Annotate(err, "encode VestingBalance")
}
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")
}
return nil
}
//NewVestingBalanceWithdrawOperation creates a new VestingBalanceWithdrawOperation
func NewVestingBalanceWithdrawOperation() *VestingBalanceWithdrawOperation {
tx := VestingBalanceWithdrawOperation{}
return &tx
}