go-ethereum/eth/tracers/native/gen_callframe_enter.go
2024-03-13 01:11:12 +00:00

72 lines
1.7 KiB
Go

// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package native
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"
"github.com/ethereum/go-ethereum/core/vm"
)
var _ = (*callFrameEnterMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (c CallFrameEnter) MarshalJSON() ([]byte, error) {
type CallFrameEnter struct {
Op vm.OpCode `json:"op"`
From common.Address `json:"from"`
To common.Address `json:"to"`
Input hexutil.Bytes `json:"input"`
Gas math.HexOrDecimal64 `json:"gas"`
Value *hexutil.Big `json:"value"`
OpName string `json:"opName,omitempty"`
}
var enc CallFrameEnter
enc.Op = c.Op
enc.From = c.From
enc.To = c.To
enc.Input = c.Input
enc.Gas = math.HexOrDecimal64(c.Gas)
enc.Value = (*hexutil.Big)(c.Value)
enc.OpName = c.OpName()
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (c *CallFrameEnter) UnmarshalJSON(input []byte) error {
type CallFrameEnter struct {
Op *vm.OpCode `json:"op"`
From *common.Address `json:"from"`
To *common.Address `json:"to"`
Input *hexutil.Bytes `json:"input"`
Gas *math.HexOrDecimal64 `json:"gas"`
Value *hexutil.Big `json:"value"`
}
var dec CallFrameEnter
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.Op != nil {
c.Op = *dec.Op
}
if dec.From != nil {
c.From = *dec.From
}
if dec.To != nil {
c.To = *dec.To
}
if dec.Input != nil {
c.Input = *dec.Input
}
if dec.Gas != nil {
c.Gas = uint64(*dec.Gas)
}
if dec.Value != nil {
c.Value = (*big.Int)(dec.Value)
}
return nil
}