blob: e1be574c03ab0586fa54cd9cb7f09554238857d9 (
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
|
// 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"`
BlockReward *math.HexOrDecimal256 `json:"blockReward"`
BlockGasLimit uint64 `json:"blockGasLimit"`
NumChains uint32 `json:"numChains"`
LambdaBA uint64 `json:"lambdaBA"`
LambdaDKG uint64 `json:"lambdaDKG"`
K int `json:"k"`
PhiRatio float32 `json:"phiRatio"`
NotarySetSize uint32 `json:"notarySetSize"`
DKGSetSize uint32 `json:"dkgSetSize"`
RoundInterval uint64 `json:"roundInterval"`
MinBlockInterval uint64 `json:"minBlockInterval"`
}
var enc DexconConfig
enc.GenesisCRSText = d.GenesisCRSText
enc.Owner = d.Owner
enc.BlockReward = (*math.HexOrDecimal256)(d.BlockReward)
enc.BlockGasLimit = d.BlockGasLimit
enc.NumChains = d.NumChains
enc.LambdaBA = d.LambdaBA
enc.LambdaDKG = d.LambdaDKG
enc.K = d.K
enc.PhiRatio = d.PhiRatio
enc.NotarySetSize = d.NotarySetSize
enc.DKGSetSize = d.DKGSetSize
enc.RoundInterval = d.RoundInterval
enc.MinBlockInterval = d.MinBlockInterval
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"`
BlockReward *math.HexOrDecimal256 `json:"blockReward"`
BlockGasLimit *uint64 `json:"blockGasLimit"`
NumChains *uint32 `json:"numChains"`
LambdaBA *uint64 `json:"lambdaBA"`
LambdaDKG *uint64 `json:"lambdaDKG"`
K *int `json:"k"`
PhiRatio *float32 `json:"phiRatio"`
NotarySetSize *uint32 `json:"notarySetSize"`
DKGSetSize *uint32 `json:"dkgSetSize"`
RoundInterval *uint64 `json:"roundInterval"`
MinBlockInterval *uint64 `json:"minBlockInterval"`
}
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.BlockReward != nil {
d.BlockReward = (*big.Int)(dec.BlockReward)
}
if dec.BlockGasLimit != nil {
d.BlockGasLimit = *dec.BlockGasLimit
}
if dec.NumChains != nil {
d.NumChains = *dec.NumChains
}
if dec.LambdaBA != nil {
d.LambdaBA = *dec.LambdaBA
}
if dec.LambdaDKG != nil {
d.LambdaDKG = *dec.LambdaDKG
}
if dec.K != nil {
d.K = *dec.K
}
if dec.PhiRatio != nil {
d.PhiRatio = *dec.PhiRatio
}
if dec.NotarySetSize != nil {
d.NotarySetSize = *dec.NotarySetSize
}
if dec.DKGSetSize != nil {
d.DKGSetSize = *dec.DKGSetSize
}
if dec.RoundInterval != nil {
d.RoundInterval = *dec.RoundInterval
}
if dec.MinBlockInterval != nil {
d.MinBlockInterval = *dec.MinBlockInterval
}
return nil
}
|