mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 13:07:17 +00:00
0be3044b7e
* rename * rename "make grpc" * rename "abi bindings templates" * rename "abi bindings templates"
87 lines
3.2 KiB
Go
87 lines
3.2 KiB
Go
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
package t8ntool
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"math/big"
|
|
|
|
"github.com/ledgerwatch/erigon/common"
|
|
"github.com/ledgerwatch/erigon/common/math"
|
|
)
|
|
|
|
var _ = (*stEnvMarshaling)(nil)
|
|
|
|
// MarshalJSON marshals as JSON.
|
|
func (s stEnv) MarshalJSON() ([]byte, error) {
|
|
type stEnv struct {
|
|
Coinbase common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
|
|
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
|
|
GasLimit math.HexOrDecimal64 `json:"currentGasLimit" gencodec:"required"`
|
|
Number math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
|
|
Timestamp math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"`
|
|
BlockHashes map[math.HexOrDecimal64]common.Hash `json:"blockHashes,omitempty"`
|
|
Ommers []ommer `json:"ommers,omitempty"`
|
|
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee,omitempty"`
|
|
}
|
|
var enc stEnv
|
|
enc.Coinbase = common.UnprefixedAddress(s.Coinbase)
|
|
enc.Difficulty = (*math.HexOrDecimal256)(s.Difficulty)
|
|
enc.GasLimit = math.HexOrDecimal64(s.GasLimit)
|
|
enc.Number = math.HexOrDecimal64(s.Number)
|
|
enc.Timestamp = math.HexOrDecimal64(s.Timestamp)
|
|
enc.BlockHashes = s.BlockHashes
|
|
enc.Ommers = s.Ommers
|
|
enc.BaseFee = (*math.HexOrDecimal256)(s.BaseFee)
|
|
return json.Marshal(&enc)
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
|
func (s *stEnv) UnmarshalJSON(input []byte) error {
|
|
type stEnv struct {
|
|
Coinbase *common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
|
|
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
|
|
GasLimit *math.HexOrDecimal64 `json:"currentGasLimit" gencodec:"required"`
|
|
Number *math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
|
|
Timestamp *math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"`
|
|
BlockHashes map[math.HexOrDecimal64]common.Hash `json:"blockHashes,omitempty"`
|
|
Ommers []ommer `json:"ommers,omitempty"`
|
|
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee,omitempty"`
|
|
}
|
|
var dec stEnv
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
return err
|
|
}
|
|
if dec.Coinbase == nil {
|
|
return errors.New("missing required field 'currentCoinbase' for stEnv")
|
|
}
|
|
s.Coinbase = common.Address(*dec.Coinbase)
|
|
if dec.Difficulty == nil {
|
|
return errors.New("missing required field 'currentDifficulty' for stEnv")
|
|
}
|
|
s.Difficulty = (*big.Int)(dec.Difficulty)
|
|
if dec.GasLimit == nil {
|
|
return errors.New("missing required field 'currentGasLimit' for stEnv")
|
|
}
|
|
s.GasLimit = uint64(*dec.GasLimit)
|
|
if dec.Number == nil {
|
|
return errors.New("missing required field 'currentNumber' for stEnv")
|
|
}
|
|
s.Number = uint64(*dec.Number)
|
|
if dec.Timestamp == nil {
|
|
return errors.New("missing required field 'currentTimestamp' for stEnv")
|
|
}
|
|
s.Timestamp = uint64(*dec.Timestamp)
|
|
if dec.BlockHashes != nil {
|
|
s.BlockHashes = dec.BlockHashes
|
|
}
|
|
if dec.Ommers != nil {
|
|
s.Ommers = dec.Ommers
|
|
}
|
|
if dec.BaseFee != nil {
|
|
s.BaseFee = (*big.Int)(dec.BaseFee)
|
|
}
|
|
return nil
|
|
}
|