github.com/theQRL/go-zond@v0.2.1/zond/tracers/native/gen_flatcallaction_json.go (about) 1 // Code generated by github.com/fjl/gencodec. DO NOT EDIT. 2 3 package native 4 5 import ( 6 "encoding/json" 7 "math/big" 8 9 "github.com/theQRL/go-zond/common" 10 "github.com/theQRL/go-zond/common/hexutil" 11 ) 12 13 var _ = (*flatCallActionMarshaling)(nil) 14 15 // MarshalJSON marshals as JSON. 16 func (f flatCallAction) MarshalJSON() ([]byte, error) { 17 type flatCallAction struct { 18 Author *common.Address `json:"author,omitempty"` 19 RewardType string `json:"rewardType,omitempty"` 20 Balance *hexutil.Big `json:"balance,omitempty"` 21 CallType string `json:"callType,omitempty"` 22 CreationMethod string `json:"creationMethod,omitempty"` 23 From *common.Address `json:"from,omitempty"` 24 Gas *hexutil.Uint64 `json:"gas,omitempty"` 25 Init *hexutil.Bytes `json:"init,omitempty"` 26 Input *hexutil.Bytes `json:"input,omitempty"` 27 RefundAddress *common.Address `json:"refundAddress,omitempty"` 28 To *common.Address `json:"to,omitempty"` 29 Value *hexutil.Big `json:"value,omitempty"` 30 } 31 var enc flatCallAction 32 enc.Author = f.Author 33 enc.RewardType = f.RewardType 34 enc.Balance = (*hexutil.Big)(f.Balance) 35 enc.CallType = f.CallType 36 enc.CreationMethod = f.CreationMethod 37 enc.From = f.From 38 enc.Gas = (*hexutil.Uint64)(f.Gas) 39 enc.Init = (*hexutil.Bytes)(f.Init) 40 enc.Input = (*hexutil.Bytes)(f.Input) 41 enc.RefundAddress = f.RefundAddress 42 enc.To = f.To 43 enc.Value = (*hexutil.Big)(f.Value) 44 return json.Marshal(&enc) 45 } 46 47 // UnmarshalJSON unmarshals from JSON. 48 func (f *flatCallAction) UnmarshalJSON(input []byte) error { 49 type flatCallAction struct { 50 Author *common.Address `json:"author,omitempty"` 51 RewardType *string `json:"rewardType,omitempty"` 52 Balance *hexutil.Big `json:"balance,omitempty"` 53 CallType *string `json:"callType,omitempty"` 54 CreationMethod *string `json:"creationMethod,omitempty"` 55 From *common.Address `json:"from,omitempty"` 56 Gas *hexutil.Uint64 `json:"gas,omitempty"` 57 Init *hexutil.Bytes `json:"init,omitempty"` 58 Input *hexutil.Bytes `json:"input,omitempty"` 59 RefundAddress *common.Address `json:"refundAddress,omitempty"` 60 To *common.Address `json:"to,omitempty"` 61 Value *hexutil.Big `json:"value,omitempty"` 62 } 63 var dec flatCallAction 64 if err := json.Unmarshal(input, &dec); err != nil { 65 return err 66 } 67 if dec.Author != nil { 68 f.Author = dec.Author 69 } 70 if dec.RewardType != nil { 71 f.RewardType = *dec.RewardType 72 } 73 if dec.Balance != nil { 74 f.Balance = (*big.Int)(dec.Balance) 75 } 76 if dec.CallType != nil { 77 f.CallType = *dec.CallType 78 } 79 if dec.CreationMethod != nil { 80 f.CreationMethod = *dec.CreationMethod 81 } 82 if dec.From != nil { 83 f.From = dec.From 84 } 85 if dec.Gas != nil { 86 f.Gas = (*uint64)(dec.Gas) 87 } 88 if dec.Init != nil { 89 f.Init = (*[]byte)(dec.Init) 90 } 91 if dec.Input != nil { 92 f.Input = (*[]byte)(dec.Input) 93 } 94 if dec.RefundAddress != nil { 95 f.RefundAddress = dec.RefundAddress 96 } 97 if dec.To != nil { 98 f.To = dec.To 99 } 100 if dec.Value != nil { 101 f.Value = (*big.Int)(dec.Value) 102 } 103 return nil 104 }