|
|
@@ -13,20 +13,22 @@ import (
|
|
|
|
|
|
var _ = (*structLogMarshaling)(nil)
|
|
|
|
|
|
+// MarshalJSON marshals as JSON.
|
|
|
func (s StructLog) MarshalJSON() ([]byte, error) {
|
|
|
type StructLog struct {
|
|
|
- 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"`
|
|
|
- Storage map[common.Hash]common.Hash `json:"-"`
|
|
|
- Depth int `json:"depth"`
|
|
|
- Err error `json:"-"`
|
|
|
- OpName string `json:"opName"`
|
|
|
- ErrorString string `json:"error"`
|
|
|
+ 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"`
|
|
|
+ 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"`
|
|
|
}
|
|
|
var enc StructLog
|
|
|
enc.Pc = s.Pc
|
|
|
@@ -43,24 +45,27 @@ func (s StructLog) MarshalJSON() ([]byte, error) {
|
|
|
}
|
|
|
enc.Storage = s.Storage
|
|
|
enc.Depth = s.Depth
|
|
|
+ enc.RefundCounter = s.RefundCounter
|
|
|
enc.Err = s.Err
|
|
|
enc.OpName = s.OpName()
|
|
|
enc.ErrorString = s.ErrorString()
|
|
|
return json.Marshal(&enc)
|
|
|
}
|
|
|
|
|
|
+// UnmarshalJSON unmarshals from JSON.
|
|
|
func (s *StructLog) UnmarshalJSON(input []byte) error {
|
|
|
type StructLog struct {
|
|
|
- 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"`
|
|
|
- Storage map[common.Hash]common.Hash `json:"-"`
|
|
|
- Depth *int `json:"depth"`
|
|
|
- Err error `json:"-"`
|
|
|
+ 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"`
|
|
|
+ Storage map[common.Hash]common.Hash `json:"-"`
|
|
|
+ Depth *int `json:"depth"`
|
|
|
+ RefundCounter *uint64 `json:"refund"`
|
|
|
+ Err error `json:"-"`
|
|
|
}
|
|
|
var dec StructLog
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
@@ -96,6 +101,9 @@ func (s *StructLog) UnmarshalJSON(input []byte) error {
|
|
|
if dec.Depth != nil {
|
|
|
s.Depth = *dec.Depth
|
|
|
}
|
|
|
+ if dec.RefundCounter != nil {
|
|
|
+ s.RefundCounter = *dec.RefundCounter
|
|
|
+ }
|
|
|
if dec.Err != nil {
|
|
|
s.Err = dec.Err
|
|
|
}
|