-
Notifications
You must be signed in to change notification settings - Fork 225
/
gen_flatcallresult_json.go
55 lines (49 loc) · 1.42 KB
/
gen_flatcallresult_json.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package native
import (
"encoding/json"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
var _ = (*flatCallResultMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (f flatCallResult) MarshalJSON() ([]byte, error) {
type flatCallResult struct {
Address *common.Address `json:"address,omitempty"`
Code *hexutil.Bytes `json:"code,omitempty"`
GasUsed *hexutil.Uint64 `json:"gasUsed,omitempty"`
Output *hexutil.Bytes `json:"output,omitempty"`
}
var enc flatCallResult
enc.Address = f.Address
enc.Code = (*hexutil.Bytes)(f.Code)
enc.GasUsed = (*hexutil.Uint64)(f.GasUsed)
enc.Output = (*hexutil.Bytes)(f.Output)
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (f *flatCallResult) UnmarshalJSON(input []byte) error {
type flatCallResult struct {
Address *common.Address `json:"address,omitempty"`
Code *hexutil.Bytes `json:"code,omitempty"`
GasUsed *hexutil.Uint64 `json:"gasUsed,omitempty"`
Output *hexutil.Bytes `json:"output,omitempty"`
}
var dec flatCallResult
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.Address != nil {
f.Address = dec.Address
}
if dec.Code != nil {
f.Code = (*[]byte)(dec.Code)
}
if dec.GasUsed != nil {
f.GasUsed = (*uint64)(dec.GasUsed)
}
if dec.Output != nil {
f.Output = (*[]byte)(dec.Output)
}
return nil
}