// Code generated by github.com/fjl/gencodec. DO NOT EDIT.

package gethclient

import (
	"encoding/json"

	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/common/hexutil"
)

var _ = (*callLogMarshaling)(nil)

// MarshalJSON marshals as JSON.
func (c CallLog) MarshalJSON() ([]byte, error) {
	type CallLog struct {
		Address  common.Address `json:"address"`
		Topics   []common.Hash  `json:"topics"`
		Data     hexutil.Bytes  `json:"data"`
		Index    hexutil.Uint   `json:"index"`
		Position hexutil.Uint   `json:"position"`
	}
	var enc CallLog
	enc.Address = c.Address
	enc.Topics = c.Topics
	enc.Data = c.Data
	enc.Index = hexutil.Uint(c.Index)
	enc.Position = hexutil.Uint(c.Position)
	return json.Marshal(&enc)
}

// UnmarshalJSON unmarshals from JSON.
func (c *CallLog) UnmarshalJSON(input []byte) error {
	type CallLog struct {
		Address  *common.Address `json:"address"`
		Topics   []common.Hash   `json:"topics"`
		Data     *hexutil.Bytes  `json:"data"`
		Index    *hexutil.Uint   `json:"index"`
		Position *hexutil.Uint   `json:"position"`
	}
	var dec CallLog
	if err := json.Unmarshal(input, &dec); err != nil {
		return err
	}
	if dec.Address != nil {
		c.Address = *dec.Address
	}
	if dec.Topics != nil {
		c.Topics = dec.Topics
	}
	if dec.Data != nil {
		c.Data = *dec.Data
	}
	if dec.Index != nil {
		c.Index = uint(*dec.Index)
	}
	if dec.Position != nil {
		c.Position = uint(*dec.Position)
	}
	return nil
}
