/
operation_value.go
70 lines (58 loc) · 1.37 KB
/
operation_value.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
package digest
import (
"time"
"github.com/spikeekips/mitum/base"
"github.com/spikeekips/mitum/base/operation"
"github.com/spikeekips/mitum/util/hint"
)
var (
OperationValueType = hint.Type("mitum-currency-operation-value")
OperationValueHint = hint.NewHint(OperationValueType, "v0.0.1")
)
type OperationValue struct {
op operation.Operation
height base.Height
confirmedAt time.Time
inState bool
reason operation.ReasonError
index uint64
}
func NewOperationValue(
op operation.Operation,
height base.Height,
confirmedAt time.Time,
inState bool,
reason operation.ReasonError,
index uint64,
) OperationValue {
return OperationValue{
op: op,
height: height,
confirmedAt: confirmedAt,
inState: inState,
reason: reason,
index: index,
}
}
func (OperationValue) Hint() hint.Hint {
return OperationValueHint
}
func (va OperationValue) Operation() operation.Operation {
return va.op
}
func (va OperationValue) Height() base.Height {
return va.height
}
func (va OperationValue) ConfirmedAt() time.Time {
return va.confirmedAt
}
func (va OperationValue) InState() bool {
return va.inState
}
func (va OperationValue) Reason() operation.ReasonError {
return va.reason
}
// Index indicates the index number of Operation in OperationTree of block.
func (va OperationValue) Index() uint64 {
return va.index
}