-
Notifications
You must be signed in to change notification settings - Fork 68
/
model.go
49 lines (38 loc) 路 844 Bytes
/
model.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
package app
import "math/big"
type Model struct {
TotalSlashed *big.Int
CoinsCount uint32
MaxGas uint64
markDirty func()
}
func (model *Model) getMaxGas() uint64 {
return model.MaxGas
}
func (model *Model) setMaxGas(maxGas uint64) {
if model.MaxGas != maxGas {
model.markDirty()
}
model.MaxGas = maxGas
}
func (model *Model) getTotalSlashed() *big.Int {
if model.TotalSlashed == nil {
return big.NewInt(0)
}
return model.TotalSlashed
}
func (model *Model) setTotalSlashed(totalSlashed *big.Int) {
if model.TotalSlashed.Cmp(totalSlashed) != 0 {
model.markDirty()
}
model.TotalSlashed = totalSlashed
}
func (model *Model) getCoinsCount() uint32 {
return model.CoinsCount
}
func (model *Model) setCoinsCount(count uint32) {
if model.CoinsCount != count {
model.markDirty()
}
model.CoinsCount = count
}