github.com/ethereum/go-ethereum@v1.16.1/eth/tracers/live/gen_supplyinfoissuance.go (about)

     1  // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
     2  
     3  package live
     4  
     5  import (
     6  	"encoding/json"
     7  	"math/big"
     8  
     9  	"github.com/ethereum/go-ethereum/common/hexutil"
    10  )
    11  
    12  var _ = (*supplyInfoIssuanceMarshaling)(nil)
    13  
    14  // MarshalJSON marshals as JSON.
    15  func (s supplyInfoIssuance) MarshalJSON() ([]byte, error) {
    16  	type supplyInfoIssuance struct {
    17  		GenesisAlloc *hexutil.Big `json:"genesisAlloc,omitempty"`
    18  		Reward       *hexutil.Big `json:"reward,omitempty"`
    19  		Withdrawals  *hexutil.Big `json:"withdrawals,omitempty"`
    20  	}
    21  	var enc supplyInfoIssuance
    22  	enc.GenesisAlloc = (*hexutil.Big)(s.GenesisAlloc)
    23  	enc.Reward = (*hexutil.Big)(s.Reward)
    24  	enc.Withdrawals = (*hexutil.Big)(s.Withdrawals)
    25  	return json.Marshal(&enc)
    26  }
    27  
    28  // UnmarshalJSON unmarshals from JSON.
    29  func (s *supplyInfoIssuance) UnmarshalJSON(input []byte) error {
    30  	type supplyInfoIssuance struct {
    31  		GenesisAlloc *hexutil.Big `json:"genesisAlloc,omitempty"`
    32  		Reward       *hexutil.Big `json:"reward,omitempty"`
    33  		Withdrawals  *hexutil.Big `json:"withdrawals,omitempty"`
    34  	}
    35  	var dec supplyInfoIssuance
    36  	if err := json.Unmarshal(input, &dec); err != nil {
    37  		return err
    38  	}
    39  	if dec.GenesisAlloc != nil {
    40  		s.GenesisAlloc = (*big.Int)(dec.GenesisAlloc)
    41  	}
    42  	if dec.Reward != nil {
    43  		s.Reward = (*big.Int)(dec.Reward)
    44  	}
    45  	if dec.Withdrawals != nil {
    46  		s.Withdrawals = (*big.Int)(dec.Withdrawals)
    47  	}
    48  	return nil
    49  }