-
Notifications
You must be signed in to change notification settings - Fork 19
/
governance_cancel_transfer.go
96 lines (78 loc) · 2.18 KB
/
governance_cancel_transfer.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package types
import (
"fmt"
"code.vegaprotocol.io/vega/libs/stringer"
vegapb "code.vegaprotocol.io/vega/protos/vega"
)
type ProposalTermsCancelTransfer struct {
CancelTransfer *CancelTransfer
}
func (a ProposalTermsCancelTransfer) String() string {
return fmt.Sprintf(
"cancelTransfer(%s)",
stringer.ReflectPointerToString(a.CancelTransfer),
)
}
func (a ProposalTermsCancelTransfer) IntoProto() *vegapb.ProposalTerms_CancelTransfer {
return &vegapb.ProposalTerms_CancelTransfer{
CancelTransfer: a.CancelTransfer.IntoProto(),
}
}
func (a ProposalTermsCancelTransfer) isPTerm() {}
func (a ProposalTermsCancelTransfer) oneOfProto() interface{} {
return a.IntoProto()
}
func (a ProposalTermsCancelTransfer) GetTermType() ProposalTermsType {
return ProposalTermsTypeCancelTransfer
}
func (a ProposalTermsCancelTransfer) DeepClone() proposalTerm {
if a.CancelTransfer == nil {
return &ProposalTermsCancelTransfer{}
}
return &ProposalTermsCancelTransfer{
CancelTransfer: a.CancelTransfer.DeepClone(),
}
}
func NewCancelGovernanceTransferFromProto(p *vegapb.ProposalTerms_CancelTransfer) (*ProposalTermsCancelTransfer, error) {
var cancelTransfer *CancelTransfer
if p.CancelTransfer != nil {
cancelTransfer = &CancelTransfer{}
if p.CancelTransfer.Changes != nil {
cancelTransfer.Changes = &CancelTransferConfiguration{
TransferID: p.CancelTransfer.Changes.TransferId,
}
}
}
return &ProposalTermsCancelTransfer{
CancelTransfer: cancelTransfer,
}, nil
}
type CancelTransfer struct {
Changes *CancelTransferConfiguration
}
func (c CancelTransfer) IntoProto() *vegapb.CancelTransfer {
return &vegapb.CancelTransfer{
Changes: &vegapb.CancelTransferConfiguration{
TransferId: c.Changes.TransferID,
},
}
}
func (c CancelTransfer) String() string {
return fmt.Sprintf(
"changes(%s)",
stringer.ReflectPointerToString(c.Changes),
)
}
func (c CancelTransfer) DeepClone() *CancelTransfer {
return &CancelTransfer{
Changes: &CancelTransferConfiguration{
TransferID: c.Changes.TransferID,
},
}
}
type CancelTransferConfiguration struct {
TransferID string
}
func (c CancelTransferConfiguration) String() string {
return fmt.Sprintf("transferID(%s)", c.TransferID)
}