2022-09-26 18:35:44 +02:00
|
|
|
// 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"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = (*accountMarshaling)(nil)
|
|
|
|
|
|
|
|
// MarshalJSON marshals as JSON.
|
|
|
|
func (a account) MarshalJSON() ([]byte, error) {
|
|
|
|
type account struct {
|
2022-10-06 08:05:43 +08:00
|
|
|
Balance *hexutil.Big `json:"balance,omitempty"`
|
|
|
|
Code hexutil.Bytes `json:"code,omitempty"`
|
2022-10-21 17:55:15 +02:00
|
|
|
Nonce uint64 `json:"nonce,omitempty"`
|
2022-10-06 08:05:43 +08:00
|
|
|
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
|
2022-09-26 18:35:44 +02:00
|
|
|
}
|
|
|
|
var enc account
|
|
|
|
enc.Balance = (*hexutil.Big)(a.Balance)
|
|
|
|
enc.Code = a.Code
|
2022-10-21 17:55:15 +02:00
|
|
|
enc.Nonce = a.Nonce
|
2022-09-26 18:35:44 +02:00
|
|
|
enc.Storage = a.Storage
|
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
|
|
|
func (a *account) UnmarshalJSON(input []byte) error {
|
|
|
|
type account struct {
|
2022-10-21 17:55:15 +02:00
|
|
|
Balance *hexutil.Big `json:"balance,omitempty"`
|
|
|
|
Code *hexutil.Bytes `json:"code,omitempty"`
|
|
|
|
Nonce *uint64 `json:"nonce,omitempty"`
|
|
|
|
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
|
2022-09-26 18:35:44 +02:00
|
|
|
}
|
|
|
|
var dec account
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.Balance != nil {
|
|
|
|
a.Balance = (*big.Int)(dec.Balance)
|
|
|
|
}
|
|
|
|
if dec.Code != nil {
|
|
|
|
a.Code = *dec.Code
|
|
|
|
}
|
2022-10-21 17:55:15 +02:00
|
|
|
if dec.Nonce != nil {
|
|
|
|
a.Nonce = *dec.Nonce
|
|
|
|
}
|
2022-09-26 18:35:44 +02:00
|
|
|
if dec.Storage != nil {
|
|
|
|
a.Storage = dec.Storage
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|