aboutsummaryrefslogtreecommitdiffstats
path: root/params/gen_dexcon_config.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@cobinhood.com>2018-10-18 21:22:45 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:50 +0800
commit98d400f5e003b5b8589f73ac7c196f11708f09eb (patch)
tree30f8a13727563fdc529b9fd5fbb25df552b5a076 /params/gen_dexcon_config.go
parent4d5e408a6634a08fcab122735c25d30d3170d932 (diff)
downloaddexon-98d400f5e003b5b8589f73ac7c196f11708f09eb.tar
dexon-98d400f5e003b5b8589f73ac7c196f11708f09eb.tar.gz
dexon-98d400f5e003b5b8589f73ac7c196f11708f09eb.tar.bz2
dexon-98d400f5e003b5b8589f73ac7c196f11708f09eb.tar.lz
dexon-98d400f5e003b5b8589f73ac7c196f11708f09eb.tar.xz
dexon-98d400f5e003b5b8589f73ac7c196f11708f09eb.tar.zst
dexon-98d400f5e003b5b8589f73ac7c196f11708f09eb.zip
params: load blockReward from genesis JSON file
Diffstat (limited to 'params/gen_dexcon_config.go')
-rw-r--r--params/gen_dexcon_config.go103
1 files changed, 103 insertions, 0 deletions
diff --git a/params/gen_dexcon_config.go b/params/gen_dexcon_config.go
new file mode 100644
index 000000000..bd169584f
--- /dev/null
+++ b/params/gen_dexcon_config.go
@@ -0,0 +1,103 @@
+// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
+
+package params
+
+import (
+ "encoding/json"
+ "math/big"
+
+ "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"`
+ 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"`
+ MaxBlockInterval uint64 `json:"maxBlockInterval"`
+ BlockReward *math.HexOrDecimal256 `json:"blockReward"`
+ }
+ var enc DexconConfig
+ enc.GenesisCRSText = d.GenesisCRSText
+ 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
+ enc.MaxBlockInterval = d.MaxBlockInterval
+ enc.BlockReward = (*math.HexOrDecimal256)(d.BlockReward)
+ return json.Marshal(&enc)
+}
+
+// UnmarshalJSON unmarshals from JSON.
+func (d *DexconConfig) UnmarshalJSON(input []byte) error {
+ type DexconConfig struct {
+ GenesisCRSText *string `json:"genesisCRSText"`
+ 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"`
+ MaxBlockInterval *uint64 `json:"maxBlockInterval"`
+ BlockReward *math.HexOrDecimal256 `json:"blockReward"`
+ }
+ var dec DexconConfig
+ if err := json.Unmarshal(input, &dec); err != nil {
+ return err
+ }
+ if dec.GenesisCRSText != nil {
+ d.GenesisCRSText = *dec.GenesisCRSText
+ }
+ 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
+ }
+ if dec.MaxBlockInterval != nil {
+ d.MaxBlockInterval = *dec.MaxBlockInterval
+ }
+ if dec.BlockReward != nil {
+ d.BlockReward = (*big.Int)(dec.BlockReward)
+ }
+ return nil
+}