blob: dbceb1676404e8cc359d76b79dd99bc3319df9ed (
plain) (
blame)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package params
import (
"encoding/json"
"math/big"
"github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/common/math"
)
var _ = (*dexconConfigSpecMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (d DexconConfig) MarshalJSON() ([]byte, error) {
type DexconConfig struct {
GenesisCRSText string `json:"genesisCRSText"`
Owner common.Address `json:"owner"`
MinStake *math.HexOrDecimal256 `json:"minStake"`
LockupPeriod uint64 `json:"lockupPeriod"`
MiningVelocity float32 `json:"miningVelocity"`
NextHalvingSupply *math.HexOrDecimal256 `json:"nextHalvingSupply"`
LastHalvedAmount *math.HexOrDecimal256 `json:"lastHalvedAmount"`
MinGasPrice *math.HexOrDecimal256 `json:"minGasPrice"`
BlockGasLimit uint64 `json:"blockGasLimit"`
LambdaBA uint64 `json:"lambdaBA"`
LambdaDKG uint64 `json:"lambdaDKG"`
NotaryParamAlpha float32 `json:"notaryParamAlpha"`
NotaryParamBeta float32 `json:"notaryParamBeta"`
RoundLength uint64 `json:"roundLength"`
MinBlockInterval uint64 `json:"minBlockInterval"`
FineValues []*math.HexOrDecimal256 `json:"fineValues"`
}
var enc DexconConfig
enc.GenesisCRSText = d.GenesisCRSText
enc.Owner = d.Owner
enc.MinStake = (*math.HexOrDecimal256)(d.MinStake)
enc.LockupPeriod = d.LockupPeriod
enc.MiningVelocity = d.MiningVelocity
enc.NextHalvingSupply = (*math.HexOrDecimal256)(d.NextHalvingSupply)
enc.LastHalvedAmount = (*math.HexOrDecimal256)(d.LastHalvedAmount)
enc.MinGasPrice = (*math.HexOrDecimal256)(d.MinGasPrice)
enc.BlockGasLimit = d.BlockGasLimit
enc.LambdaBA = d.LambdaBA
enc.LambdaDKG = d.LambdaDKG
enc.NotaryParamAlpha = d.NotaryParamAlpha
enc.NotaryParamBeta = d.NotaryParamBeta
enc.RoundLength = d.RoundLength
enc.MinBlockInterval = d.MinBlockInterval
if d.FineValues != nil {
enc.FineValues = make([]*math.HexOrDecimal256, len(d.FineValues))
for k, v := range d.FineValues {
enc.FineValues[k] = (*math.HexOrDecimal256)(v)
}
}
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (d *DexconConfig) UnmarshalJSON(input []byte) error {
type DexconConfig struct {
GenesisCRSText *string `json:"genesisCRSText"`
Owner *common.Address `json:"owner"`
MinStake *math.HexOrDecimal256 `json:"minStake"`
LockupPeriod *uint64 `json:"lockupPeriod"`
MiningVelocity *float32 `json:"miningVelocity"`
NextHalvingSupply *math.HexOrDecimal256 `json:"nextHalvingSupply"`
LastHalvedAmount *math.HexOrDecimal256 `json:"lastHalvedAmount"`
MinGasPrice *math.HexOrDecimal256 `json:"minGasPrice"`
BlockGasLimit *uint64 `json:"blockGasLimit"`
LambdaBA *uint64 `json:"lambdaBA"`
LambdaDKG *uint64 `json:"lambdaDKG"`
NotaryParamAlpha *float32 `json:"notaryParamAlpha"`
NotaryParamBeta *float32 `json:"notaryParamBeta"`
RoundLength *uint64 `json:"roundLength"`
MinBlockInterval *uint64 `json:"minBlockInterval"`
FineValues []*math.HexOrDecimal256 `json:"fineValues"`
}
var dec DexconConfig
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.GenesisCRSText != nil {
d.GenesisCRSText = *dec.GenesisCRSText
}
if dec.Owner != nil {
d.Owner = *dec.Owner
}
if dec.MinStake != nil {
d.MinStake = (*big.Int)(dec.MinStake)
}
if dec.LockupPeriod != nil {
d.LockupPeriod = *dec.LockupPeriod
}
if dec.MiningVelocity != nil {
d.MiningVelocity = *dec.MiningVelocity
}
if dec.NextHalvingSupply != nil {
d.NextHalvingSupply = (*big.Int)(dec.NextHalvingSupply)
}
if dec.LastHalvedAmount != nil {
d.LastHalvedAmount = (*big.Int)(dec.LastHalvedAmount)
}
if dec.MinGasPrice != nil {
d.MinGasPrice = (*big.Int)(dec.MinGasPrice)
}
if dec.BlockGasLimit != nil {
d.BlockGasLimit = *dec.BlockGasLimit
}
if dec.LambdaBA != nil {
d.LambdaBA = *dec.LambdaBA
}
if dec.LambdaDKG != nil {
d.LambdaDKG = *dec.LambdaDKG
}
if dec.NotaryParamAlpha != nil {
d.NotaryParamAlpha = *dec.NotaryParamAlpha
}
if dec.NotaryParamBeta != nil {
d.NotaryParamBeta = *dec.NotaryParamBeta
}
if dec.RoundLength != nil {
d.RoundLength = *dec.RoundLength
}
if dec.MinBlockInterval != nil {
d.MinBlockInterval = *dec.MinBlockInterval
}
if dec.FineValues != nil {
d.FineValues = make([]*big.Int, len(dec.FineValues))
for k, v := range dec.FineValues {
d.FineValues[k] = (*big.Int)(v)
}
}
return nil
}
|