github.com/amazechain/amc@v0.1.3/internal/tracers/native/gen_flatcallaction_json.go (about)

     1  // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
     2  
     3  package native
     4  
     5  import (
     6  	"encoding/json"
     7  	"math/big"
     8  
     9  	"github.com/amazechain/amc/common/hexutil"
    10  	"github.com/amazechain/amc/common/types"
    11  )
    12  
    13  var _ = (*flatCallActionMarshaling)(nil)
    14  
    15  // MarshalJSON marshals as JSON.
    16  func (f flatCallAction) MarshalJSON() ([]byte, error) {
    17  	type flatCallAction struct {
    18  		Author         *types.Address  `json:"author,omitempty"`
    19  		RewardType     string          `json:"rewardType,omitempty"`
    20  		SelfDestructed *types.Address  `json:"address,omitempty"`
    21  		Balance        *hexutil.Big    `json:"balance,omitempty"`
    22  		CallType       string          `json:"callType,omitempty"`
    23  		CreationMethod string          `json:"creationMethod,omitempty"`
    24  		From           *types.Address  `json:"from,omitempty"`
    25  		Gas            *hexutil.Uint64 `json:"gas,omitempty"`
    26  		Init           *hexutil.Bytes  `json:"init,omitempty"`
    27  		Input          *hexutil.Bytes  `json:"input,omitempty"`
    28  		RefundAddress  *types.Address  `json:"refundAddress,omitempty"`
    29  		To             *types.Address  `json:"to,omitempty"`
    30  		Value          *hexutil.Big    `json:"value,omitempty"`
    31  	}
    32  	var enc flatCallAction
    33  	enc.Author = f.Author
    34  	enc.RewardType = f.RewardType
    35  	enc.SelfDestructed = f.SelfDestructed
    36  	enc.Balance = (*hexutil.Big)(f.Balance)
    37  	enc.CallType = f.CallType
    38  	enc.CreationMethod = f.CreationMethod
    39  	enc.From = f.From
    40  	enc.Gas = (*hexutil.Uint64)(f.Gas)
    41  	enc.Init = (*hexutil.Bytes)(f.Init)
    42  	enc.Input = (*hexutil.Bytes)(f.Input)
    43  	enc.RefundAddress = f.RefundAddress
    44  	enc.To = f.To
    45  	enc.Value = (*hexutil.Big)(f.Value)
    46  	return json.Marshal(&enc)
    47  }
    48  
    49  // UnmarshalJSON unmarshals from JSON.
    50  func (f *flatCallAction) UnmarshalJSON(input []byte) error {
    51  	type flatCallAction struct {
    52  		Author         *types.Address  `json:"author,omitempty"`
    53  		RewardType     *string         `json:"rewardType,omitempty"`
    54  		SelfDestructed *types.Address  `json:"address,omitempty"`
    55  		Balance        *hexutil.Big    `json:"balance,omitempty"`
    56  		CallType       *string         `json:"callType,omitempty"`
    57  		CreationMethod *string         `json:"creationMethod,omitempty"`
    58  		From           *types.Address  `json:"from,omitempty"`
    59  		Gas            *hexutil.Uint64 `json:"gas,omitempty"`
    60  		Init           *hexutil.Bytes  `json:"init,omitempty"`
    61  		Input          *hexutil.Bytes  `json:"input,omitempty"`
    62  		RefundAddress  *types.Address  `json:"refundAddress,omitempty"`
    63  		To             *types.Address  `json:"to,omitempty"`
    64  		Value          *hexutil.Big    `json:"value,omitempty"`
    65  	}
    66  	var dec flatCallAction
    67  	if err := json.Unmarshal(input, &dec); err != nil {
    68  		return err
    69  	}
    70  	if dec.Author != nil {
    71  		f.Author = dec.Author
    72  	}
    73  	if dec.RewardType != nil {
    74  		f.RewardType = *dec.RewardType
    75  	}
    76  	if dec.SelfDestructed != nil {
    77  		f.SelfDestructed = dec.SelfDestructed
    78  	}
    79  	if dec.Balance != nil {
    80  		f.Balance = (*big.Int)(dec.Balance)
    81  	}
    82  	if dec.CallType != nil {
    83  		f.CallType = *dec.CallType
    84  	}
    85  	if dec.CreationMethod != nil {
    86  		f.CreationMethod = *dec.CreationMethod
    87  	}
    88  	if dec.From != nil {
    89  		f.From = dec.From
    90  	}
    91  	if dec.Gas != nil {
    92  		f.Gas = (*uint64)(dec.Gas)
    93  	}
    94  	if dec.Init != nil {
    95  		f.Init = (*[]byte)(dec.Init)
    96  	}
    97  	if dec.Input != nil {
    98  		f.Input = (*[]byte)(dec.Input)
    99  	}
   100  	if dec.RefundAddress != nil {
   101  		f.RefundAddress = dec.RefundAddress
   102  	}
   103  	if dec.To != nil {
   104  		f.To = dec.To
   105  	}
   106  	if dec.Value != nil {
   107  		f.Value = (*big.Int)(dec.Value)
   108  	}
   109  	return nil
   110  }