aboutsummaryrefslogtreecommitdiffstats
path: root/params/gen_dexcon_config.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-01-13 16:21:17 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:21 +0800
commit56680e215e7e27ab8896d782876ee64881cae6ff (patch)
tree40daa411b7f1ee239b702ccc7987b6130892d7e6 /params/gen_dexcon_config.go
parentf82a81c6fa36c8ee6ba6a55e0662930c8f0d2658 (diff)
downloadgo-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.gz
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.bz2
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.lz
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.xz
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.tar.zst
go-tangerine-56680e215e7e27ab8896d782876ee64881cae6ff.zip
consensus: implement DEXON cryptoeconomics v4.0 (#145)
Diffstat (limited to 'params/gen_dexcon_config.go')
-rw-r--r--params/gen_dexcon_config.go82
1 files changed, 47 insertions, 35 deletions
diff --git a/params/gen_dexcon_config.go b/params/gen_dexcon_config.go
index 4ec55c0c9..29ebf2eaf 100644
--- a/params/gen_dexcon_config.go
+++ b/params/gen_dexcon_config.go
@@ -15,29 +15,33 @@ 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"`
- BlockReward *math.HexOrDecimal256 `json:"blockReward"`
- BlockGasLimit uint64 `json:"blockGasLimit"`
- NumChains uint32 `json:"numChains"`
- LambdaBA uint64 `json:"lambdaBA"`
- LambdaDKG uint64 `json:"lambdaDKG"`
- K uint32 `json:"k"`
- PhiRatio float32 `json:"phiRatio"`
- NotarySetSize uint32 `json:"notarySetSize"`
- DKGSetSize uint32 `json:"dkgSetSize"`
- RoundInterval uint64 `json:"roundInterval"`
- MinBlockInterval uint64 `json:"minBlockInterval"`
- FineValues []*math.HexOrDecimal256 `json:"fineValues"`
+ 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"`
+ BlockGasLimit uint64 `json:"blockGasLimit"`
+ NumChains uint32 `json:"numChains"`
+ LambdaBA uint64 `json:"lambdaBA"`
+ LambdaDKG uint64 `json:"lambdaDKG"`
+ K uint32 `json:"k"`
+ PhiRatio float32 `json:"phiRatio"`
+ NotarySetSize uint32 `json:"notarySetSize"`
+ DKGSetSize uint32 `json:"dkgSetSize"`
+ RoundInterval uint64 `json:"roundInterval"`
+ 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.BlockReward = (*math.HexOrDecimal256)(d.BlockReward)
+ enc.MiningVelocity = d.MiningVelocity
+ enc.NextHalvingSupply = (*math.HexOrDecimal256)(d.NextHalvingSupply)
+ enc.LastHalvedAmount = (*math.HexOrDecimal256)(d.LastHalvedAmount)
enc.BlockGasLimit = d.BlockGasLimit
enc.NumChains = d.NumChains
enc.LambdaBA = d.LambdaBA
@@ -60,22 +64,24 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) {
// 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"`
- BlockReward *math.HexOrDecimal256 `json:"blockReward"`
- BlockGasLimit *uint64 `json:"blockGasLimit"`
- NumChains *uint32 `json:"numChains"`
- LambdaBA *uint64 `json:"lambdaBA"`
- LambdaDKG *uint64 `json:"lambdaDKG"`
- K *uint32 `json:"k"`
- PhiRatio *float32 `json:"phiRatio"`
- NotarySetSize *uint32 `json:"notarySetSize"`
- DKGSetSize *uint32 `json:"dkgSetSize"`
- RoundInterval *uint64 `json:"roundInterval"`
- MinBlockInterval *uint64 `json:"minBlockInterval"`
- FineValues []*math.HexOrDecimal256 `json:"fineValues"`
+ 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"`
+ BlockGasLimit *uint64 `json:"blockGasLimit"`
+ NumChains *uint32 `json:"numChains"`
+ LambdaBA *uint64 `json:"lambdaBA"`
+ LambdaDKG *uint64 `json:"lambdaDKG"`
+ K *uint32 `json:"k"`
+ PhiRatio *float32 `json:"phiRatio"`
+ NotarySetSize *uint32 `json:"notarySetSize"`
+ DKGSetSize *uint32 `json:"dkgSetSize"`
+ RoundInterval *uint64 `json:"roundInterval"`
+ MinBlockInterval *uint64 `json:"minBlockInterval"`
+ FineValues []*math.HexOrDecimal256 `json:"fineValues"`
}
var dec DexconConfig
if err := json.Unmarshal(input, &dec); err != nil {
@@ -93,8 +99,14 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error {
if dec.LockupPeriod != nil {
d.LockupPeriod = *dec.LockupPeriod
}
- if dec.BlockReward != nil {
- d.BlockReward = (*big.Int)(dec.BlockReward)
+ 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.BlockGasLimit != nil {
d.BlockGasLimit = *dec.BlockGasLimit