blob: 4f7ebc96609074efc788b5f0848e134ef0ac2e41 (
plain) (
blame)
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
56
57
58
59
60
61
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package tests
import (
"encoding/json"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
var _ = (*stLogMarshaling)(nil)
func (s stLog) MarshalJSON() ([]byte, error) {
type stLog struct {
Address common.UnprefixedAddress `json:"address"`
Data hexutil.Bytes `json:"data"`
Topics []common.UnprefixedHash `json:"topics"`
Bloom string `json:"bloom"`
}
var enc stLog
enc.Address = common.UnprefixedAddress(s.Address)
enc.Data = s.Data
if s.Topics != nil {
enc.Topics = make([]common.UnprefixedHash, len(s.Topics))
for k, v := range s.Topics {
enc.Topics[k] = common.UnprefixedHash(v)
}
}
enc.Bloom = s.Bloom
return json.Marshal(&enc)
}
func (s *stLog) UnmarshalJSON(input []byte) error {
type stLog struct {
Address *common.UnprefixedAddress `json:"address"`
Data hexutil.Bytes `json:"data"`
Topics []common.UnprefixedHash `json:"topics"`
Bloom *string `json:"bloom"`
}
var dec stLog
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.Address != nil {
s.Address = common.Address(*dec.Address)
}
if dec.Data != nil {
s.Data = dec.Data
}
if dec.Topics != nil {
s.Topics = make([]common.Hash, len(dec.Topics))
for k, v := range dec.Topics {
s.Topics[k] = common.Hash(v)
}
}
if dec.Bloom != nil {
s.Bloom = *dec.Bloom
}
return nil
}
|