| 
									
										
										
										
											2017-03-27 11:52:39 +02:00
										 |  |  | // Code generated by github.com/fjl/gencodec. DO NOT EDIT. | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | package core | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"encoding/json" | 
					
						
							|  |  |  | 	"errors" | 
					
						
							|  |  |  | 	"math/big" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/ethereum/go-ethereum/common" | 
					
						
							|  |  |  | 	"github.com/ethereum/go-ethereum/common/hexutil" | 
					
						
							|  |  |  | 	"github.com/ethereum/go-ethereum/common/math" | 
					
						
							|  |  |  | 	"github.com/ethereum/go-ethereum/params" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-13 13:47:27 +02:00
										 |  |  | var _ = (*genesisSpecMarshaling)(nil) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 14:37:56 +02:00
										 |  |  | // MarshalJSON marshals as JSON. | 
					
						
							| 
									
										
										
										
											2017-03-27 11:52:39 +02:00
										 |  |  | func (g Genesis) MarshalJSON() ([]byte, error) { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 	type Genesis struct { | 
					
						
							|  |  |  | 		Config     *params.ChainConfig                         `json:"config"` | 
					
						
							|  |  |  | 		Nonce      math.HexOrDecimal64                         `json:"nonce"` | 
					
						
							|  |  |  | 		Timestamp  math.HexOrDecimal64                         `json:"timestamp"` | 
					
						
							|  |  |  | 		ExtraData  hexutil.Bytes                               `json:"extraData"` | 
					
						
							|  |  |  | 		GasLimit   math.HexOrDecimal64                         `json:"gasLimit"   gencodec:"required"` | 
					
						
							|  |  |  | 		Difficulty *math.HexOrDecimal256                       `json:"difficulty" gencodec:"required"` | 
					
						
							|  |  |  | 		Mixhash    common.Hash                                 `json:"mixHash"` | 
					
						
							|  |  |  | 		Coinbase   common.Address                              `json:"coinbase"` | 
					
						
							|  |  |  | 		Alloc      map[common.UnprefixedAddress]GenesisAccount `json:"alloc"      gencodec:"required"` | 
					
						
							| 
									
										
										
										
											2017-07-17 10:33:13 +02:00
										 |  |  | 		Number     math.HexOrDecimal64                         `json:"number"` | 
					
						
							| 
									
										
										
										
											2017-07-11 13:49:14 +02:00
										 |  |  | 		GasUsed    math.HexOrDecimal64                         `json:"gasUsed"` | 
					
						
							|  |  |  | 		ParentHash common.Hash                                 `json:"parentHash"` | 
					
						
							| 
									
										
										
										
											2021-06-14 14:04:44 +02:00
										 |  |  | 		BaseFee    *math.HexOrDecimal256                       `json:"baseFeePerGas"` | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 	var enc Genesis | 
					
						
							| 
									
										
										
										
											2017-03-27 11:52:39 +02:00
										 |  |  | 	enc.Config = g.Config | 
					
						
							|  |  |  | 	enc.Nonce = math.HexOrDecimal64(g.Nonce) | 
					
						
							|  |  |  | 	enc.Timestamp = math.HexOrDecimal64(g.Timestamp) | 
					
						
							|  |  |  | 	enc.ExtraData = g.ExtraData | 
					
						
							|  |  |  | 	enc.GasLimit = math.HexOrDecimal64(g.GasLimit) | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	enc.Difficulty = (*math.HexOrDecimal256)(g.Difficulty) | 
					
						
							| 
									
										
										
										
											2017-03-27 11:52:39 +02:00
										 |  |  | 	enc.Mixhash = g.Mixhash | 
					
						
							|  |  |  | 	enc.Coinbase = g.Coinbase | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	if g.Alloc != nil { | 
					
						
							|  |  |  | 		enc.Alloc = make(map[common.UnprefixedAddress]GenesisAccount, len(g.Alloc)) | 
					
						
							|  |  |  | 		for k, v := range g.Alloc { | 
					
						
							|  |  |  | 			enc.Alloc[common.UnprefixedAddress(k)] = v | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-07-17 10:33:13 +02:00
										 |  |  | 	enc.Number = math.HexOrDecimal64(g.Number) | 
					
						
							| 
									
										
										
										
											2017-07-11 13:49:14 +02:00
										 |  |  | 	enc.GasUsed = math.HexOrDecimal64(g.GasUsed) | 
					
						
							|  |  |  | 	enc.ParentHash = g.ParentHash | 
					
						
							| 
									
										
										
										
											2021-06-08 11:07:27 +02:00
										 |  |  | 	enc.BaseFee = (*math.HexOrDecimal256)(g.BaseFee) | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	return json.Marshal(&enc) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-07 14:37:56 +02:00
										 |  |  | // UnmarshalJSON unmarshals from JSON. | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | func (g *Genesis) UnmarshalJSON(input []byte) error { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 	type Genesis struct { | 
					
						
							|  |  |  | 		Config     *params.ChainConfig                         `json:"config"` | 
					
						
							|  |  |  | 		Nonce      *math.HexOrDecimal64                        `json:"nonce"` | 
					
						
							|  |  |  | 		Timestamp  *math.HexOrDecimal64                        `json:"timestamp"` | 
					
						
							| 
									
										
										
										
											2018-01-08 14:13:22 +01:00
										 |  |  | 		ExtraData  *hexutil.Bytes                              `json:"extraData"` | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 		GasLimit   *math.HexOrDecimal64                        `json:"gasLimit"   gencodec:"required"` | 
					
						
							|  |  |  | 		Difficulty *math.HexOrDecimal256                       `json:"difficulty" gencodec:"required"` | 
					
						
							|  |  |  | 		Mixhash    *common.Hash                                `json:"mixHash"` | 
					
						
							|  |  |  | 		Coinbase   *common.Address                             `json:"coinbase"` | 
					
						
							|  |  |  | 		Alloc      map[common.UnprefixedAddress]GenesisAccount `json:"alloc"      gencodec:"required"` | 
					
						
							| 
									
										
										
										
											2017-07-17 10:33:13 +02:00
										 |  |  | 		Number     *math.HexOrDecimal64                        `json:"number"` | 
					
						
							| 
									
										
										
										
											2017-07-11 13:49:14 +02:00
										 |  |  | 		GasUsed    *math.HexOrDecimal64                        `json:"gasUsed"` | 
					
						
							|  |  |  | 		ParentHash *common.Hash                                `json:"parentHash"` | 
					
						
							| 
									
										
										
										
											2021-06-14 14:04:44 +02:00
										 |  |  | 		BaseFee    *math.HexOrDecimal256                       `json:"baseFeePerGas"` | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 	var dec Genesis | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	if err := json.Unmarshal(input, &dec); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-27 11:52:39 +02:00
										 |  |  | 	if dec.Config != nil { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 		g.Config = dec.Config | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if dec.Nonce != nil { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 		g.Nonce = uint64(*dec.Nonce) | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if dec.Timestamp != nil { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 		g.Timestamp = uint64(*dec.Timestamp) | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if dec.ExtraData != nil { | 
					
						
							| 
									
										
										
										
											2018-01-08 14:13:22 +01:00
										 |  |  | 		g.ExtraData = *dec.ExtraData | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if dec.GasLimit == nil { | 
					
						
							|  |  |  | 		return errors.New("missing required field 'gasLimit' for Genesis") | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 	g.GasLimit = uint64(*dec.GasLimit) | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	if dec.Difficulty == nil { | 
					
						
							|  |  |  | 		return errors.New("missing required field 'difficulty' for Genesis") | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 	g.Difficulty = (*big.Int)(dec.Difficulty) | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	if dec.Mixhash != nil { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 		g.Mixhash = *dec.Mixhash | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if dec.Coinbase != nil { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 		g.Coinbase = *dec.Coinbase | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if dec.Alloc == nil { | 
					
						
							|  |  |  | 		return errors.New("missing required field 'alloc' for Genesis") | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 	g.Alloc = make(GenesisAlloc, len(dec.Alloc)) | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	for k, v := range dec.Alloc { | 
					
						
							| 
									
										
										
										
											2017-04-06 10:38:21 +02:00
										 |  |  | 		g.Alloc[common.Address(k)] = v | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-07-11 13:49:14 +02:00
										 |  |  | 	if dec.Number != nil { | 
					
						
							| 
									
										
										
										
											2017-07-17 10:33:13 +02:00
										 |  |  | 		g.Number = uint64(*dec.Number) | 
					
						
							| 
									
										
										
										
											2017-07-11 13:49:14 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if dec.GasUsed != nil { | 
					
						
							|  |  |  | 		g.GasUsed = uint64(*dec.GasUsed) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	if dec.ParentHash != nil { | 
					
						
							|  |  |  | 		g.ParentHash = *dec.ParentHash | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-06-07 14:37:56 +02:00
										 |  |  | 	if dec.BaseFee != nil { | 
					
						
							| 
									
										
										
										
											2021-06-08 11:07:27 +02:00
										 |  |  | 		g.BaseFee = (*big.Int)(dec.BaseFee) | 
					
						
							| 
									
										
										
										
											2021-06-07 14:37:56 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-02 14:03:33 +01:00
										 |  |  | 	return nil | 
					
						
							|  |  |  | } |