2017-06-07 10:09:08 -05:00
|
|
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
|
|
|
|
package vm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"math/big"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
|
|
"github.com/ethereum/go-ethereum/common/math"
|
|
|
|
)
|
|
|
|
|
2018-01-08 06:15:57 -06:00
|
|
|
var _ = (*structLogMarshaling)(nil)
|
|
|
|
|
2018-10-23 09:28:18 -05:00
|
|
|
// MarshalJSON marshals as JSON.
|
2017-06-07 10:09:08 -05:00
|
|
|
func (s StructLog) MarshalJSON() ([]byte, error) {
|
|
|
|
type StructLog struct {
|
2018-10-23 09:28:18 -05:00
|
|
|
Pc uint64 `json:"pc"`
|
|
|
|
Op OpCode `json:"op"`
|
|
|
|
Gas math.HexOrDecimal64 `json:"gas"`
|
|
|
|
GasCost math.HexOrDecimal64 `json:"gasCost"`
|
|
|
|
Memory hexutil.Bytes `json:"memory"`
|
|
|
|
MemorySize int `json:"memSize"`
|
|
|
|
Stack []*math.HexOrDecimal256 `json:"stack"`
|
2020-06-02 05:30:16 -05:00
|
|
|
ReturnStack []math.HexOrDecimal64 `json:"returnStack"`
|
2018-10-23 09:28:18 -05:00
|
|
|
Storage map[common.Hash]common.Hash `json:"-"`
|
|
|
|
Depth int `json:"depth"`
|
|
|
|
RefundCounter uint64 `json:"refund"`
|
|
|
|
Err error `json:"-"`
|
|
|
|
OpName string `json:"opName"`
|
|
|
|
ErrorString string `json:"error"`
|
2017-06-07 10:09:08 -05:00
|
|
|
}
|
|
|
|
var enc StructLog
|
|
|
|
enc.Pc = s.Pc
|
|
|
|
enc.Op = s.Op
|
|
|
|
enc.Gas = math.HexOrDecimal64(s.Gas)
|
|
|
|
enc.GasCost = math.HexOrDecimal64(s.GasCost)
|
|
|
|
enc.Memory = s.Memory
|
2017-06-21 07:52:31 -05:00
|
|
|
enc.MemorySize = s.MemorySize
|
2017-06-07 10:09:08 -05:00
|
|
|
if s.Stack != nil {
|
|
|
|
enc.Stack = make([]*math.HexOrDecimal256, len(s.Stack))
|
|
|
|
for k, v := range s.Stack {
|
|
|
|
enc.Stack[k] = (*math.HexOrDecimal256)(v)
|
|
|
|
}
|
|
|
|
}
|
2020-06-02 05:30:16 -05:00
|
|
|
if s.ReturnStack != nil {
|
|
|
|
enc.ReturnStack = make([]math.HexOrDecimal64, len(s.ReturnStack))
|
|
|
|
for k, v := range s.ReturnStack {
|
|
|
|
enc.ReturnStack[k] = math.HexOrDecimal64(v)
|
|
|
|
}
|
|
|
|
}
|
2017-06-07 10:09:08 -05:00
|
|
|
enc.Storage = s.Storage
|
|
|
|
enc.Depth = s.Depth
|
2018-10-23 09:28:18 -05:00
|
|
|
enc.RefundCounter = s.RefundCounter
|
2017-06-07 10:09:08 -05:00
|
|
|
enc.Err = s.Err
|
|
|
|
enc.OpName = s.OpName()
|
2018-01-08 06:15:57 -06:00
|
|
|
enc.ErrorString = s.ErrorString()
|
2017-06-07 10:09:08 -05:00
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
2018-10-23 09:28:18 -05:00
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
2017-06-07 10:09:08 -05:00
|
|
|
func (s *StructLog) UnmarshalJSON(input []byte) error {
|
|
|
|
type StructLog struct {
|
2018-10-23 09:28:18 -05:00
|
|
|
Pc *uint64 `json:"pc"`
|
|
|
|
Op *OpCode `json:"op"`
|
|
|
|
Gas *math.HexOrDecimal64 `json:"gas"`
|
|
|
|
GasCost *math.HexOrDecimal64 `json:"gasCost"`
|
|
|
|
Memory *hexutil.Bytes `json:"memory"`
|
|
|
|
MemorySize *int `json:"memSize"`
|
|
|
|
Stack []*math.HexOrDecimal256 `json:"stack"`
|
2020-06-02 05:30:16 -05:00
|
|
|
ReturnStack []math.HexOrDecimal64 `json:"returnStack"`
|
2018-10-23 09:28:18 -05:00
|
|
|
Storage map[common.Hash]common.Hash `json:"-"`
|
|
|
|
Depth *int `json:"depth"`
|
|
|
|
RefundCounter *uint64 `json:"refund"`
|
|
|
|
Err error `json:"-"`
|
2017-06-07 10:09:08 -05:00
|
|
|
}
|
|
|
|
var dec StructLog
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.Pc != nil {
|
|
|
|
s.Pc = *dec.Pc
|
|
|
|
}
|
|
|
|
if dec.Op != nil {
|
|
|
|
s.Op = *dec.Op
|
|
|
|
}
|
|
|
|
if dec.Gas != nil {
|
|
|
|
s.Gas = uint64(*dec.Gas)
|
|
|
|
}
|
|
|
|
if dec.GasCost != nil {
|
|
|
|
s.GasCost = uint64(*dec.GasCost)
|
|
|
|
}
|
|
|
|
if dec.Memory != nil {
|
2018-01-08 07:13:22 -06:00
|
|
|
s.Memory = *dec.Memory
|
2017-06-07 10:09:08 -05:00
|
|
|
}
|
2017-06-21 07:52:31 -05:00
|
|
|
if dec.MemorySize != nil {
|
|
|
|
s.MemorySize = *dec.MemorySize
|
|
|
|
}
|
2017-06-07 10:09:08 -05:00
|
|
|
if dec.Stack != nil {
|
|
|
|
s.Stack = make([]*big.Int, len(dec.Stack))
|
|
|
|
for k, v := range dec.Stack {
|
|
|
|
s.Stack[k] = (*big.Int)(v)
|
|
|
|
}
|
|
|
|
}
|
2020-06-02 05:30:16 -05:00
|
|
|
if dec.ReturnStack != nil {
|
|
|
|
s.ReturnStack = make([]uint64, len(dec.ReturnStack))
|
|
|
|
for k, v := range dec.ReturnStack {
|
|
|
|
s.ReturnStack[k] = uint64(v)
|
|
|
|
}
|
|
|
|
}
|
2017-06-07 10:09:08 -05:00
|
|
|
if dec.Storage != nil {
|
|
|
|
s.Storage = dec.Storage
|
|
|
|
}
|
|
|
|
if dec.Depth != nil {
|
|
|
|
s.Depth = *dec.Depth
|
|
|
|
}
|
2018-10-23 09:28:18 -05:00
|
|
|
if dec.RefundCounter != nil {
|
|
|
|
s.RefundCounter = *dec.RefundCounter
|
|
|
|
}
|
2017-06-07 10:09:08 -05:00
|
|
|
if dec.Err != nil {
|
2018-01-08 06:15:57 -06:00
|
|
|
s.Err = dec.Err
|
2017-06-07 10:09:08 -05:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|