github.com/amazechain/amc@v0.1.3/internal/tracers/native/gen_callframe_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  	"github.com/amazechain/amc/internal/vm"
    12  )
    13  
    14  var _ = (*callFrameMarshaling)(nil)
    15  
    16  // MarshalJSON marshals as JSON.
    17  func (c callFrame) MarshalJSON() ([]byte, error) {
    18  	type callFrame0 struct {
    19  		Type         vm.OpCode      `json:"-"`
    20  		From         types.Address  `json:"from"`
    21  		Gas          hexutil.Uint64 `json:"gas"`
    22  		GasUsed      hexutil.Uint64 `json:"gasUsed"`
    23  		To           *types.Address `json:"to,omitempty" rlp:"optional"`
    24  		Input        hexutil.Bytes  `json:"input" rlp:"optional"`
    25  		Output       hexutil.Bytes  `json:"output,omitempty" rlp:"optional"`
    26  		Error        string         `json:"error,omitempty" rlp:"optional"`
    27  		RevertReason string         `json:"revertReason,omitempty"`
    28  		Calls        []callFrame    `json:"calls,omitempty" rlp:"optional"`
    29  		Logs         []callLog      `json:"logs,omitempty" rlp:"optional"`
    30  		Value        *hexutil.Big   `json:"value,omitempty" rlp:"optional"`
    31  		TypeString   string         `json:"type"`
    32  	}
    33  	var enc callFrame0
    34  	enc.Type = c.Type
    35  	enc.From = c.From
    36  	enc.Gas = hexutil.Uint64(c.Gas)
    37  	enc.GasUsed = hexutil.Uint64(c.GasUsed)
    38  	enc.To = c.To
    39  	enc.Input = c.Input
    40  	enc.Output = c.Output
    41  	enc.Error = c.Error
    42  	enc.RevertReason = c.RevertReason
    43  	enc.Calls = c.Calls
    44  	enc.Logs = c.Logs
    45  	enc.Value = (*hexutil.Big)(c.Value)
    46  	enc.TypeString = c.TypeString()
    47  	return json.Marshal(&enc)
    48  }
    49  
    50  // UnmarshalJSON unmarshals from JSON.
    51  func (c *callFrame) UnmarshalJSON(input []byte) error {
    52  	type callFrame0 struct {
    53  		Type         *vm.OpCode      `json:"-"`
    54  		From         *types.Address  `json:"from"`
    55  		Gas          *hexutil.Uint64 `json:"gas"`
    56  		GasUsed      *hexutil.Uint64 `json:"gasUsed"`
    57  		To           *types.Address  `json:"to,omitempty" rlp:"optional"`
    58  		Input        *hexutil.Bytes  `json:"input" rlp:"optional"`
    59  		Output       *hexutil.Bytes  `json:"output,omitempty" rlp:"optional"`
    60  		Error        *string         `json:"error,omitempty" rlp:"optional"`
    61  		RevertReason *string         `json:"revertReason,omitempty"`
    62  		Calls        []callFrame     `json:"calls,omitempty" rlp:"optional"`
    63  		Logs         []callLog       `json:"logs,omitempty" rlp:"optional"`
    64  		Value        *hexutil.Big    `json:"value,omitempty" rlp:"optional"`
    65  	}
    66  	var dec callFrame0
    67  	if err := json.Unmarshal(input, &dec); err != nil {
    68  		return err
    69  	}
    70  	if dec.Type != nil {
    71  		c.Type = *dec.Type
    72  	}
    73  	if dec.From != nil {
    74  		c.From = *dec.From
    75  	}
    76  	if dec.Gas != nil {
    77  		c.Gas = uint64(*dec.Gas)
    78  	}
    79  	if dec.GasUsed != nil {
    80  		c.GasUsed = uint64(*dec.GasUsed)
    81  	}
    82  	if dec.To != nil {
    83  		c.To = dec.To
    84  	}
    85  	if dec.Input != nil {
    86  		c.Input = *dec.Input
    87  	}
    88  	if dec.Output != nil {
    89  		c.Output = *dec.Output
    90  	}
    91  	if dec.Error != nil {
    92  		c.Error = *dec.Error
    93  	}
    94  	if dec.RevertReason != nil {
    95  		c.RevertReason = *dec.RevertReason
    96  	}
    97  	if dec.Calls != nil {
    98  		c.Calls = dec.Calls
    99  	}
   100  	if dec.Logs != nil {
   101  		c.Logs = dec.Logs
   102  	}
   103  	if dec.Value != nil {
   104  		c.Value = (*big.Int)(dec.Value)
   105  	}
   106  	return nil
   107  }