-
Notifications
You must be signed in to change notification settings - Fork 6
/
gen_equality_reward.go
45 lines (39 loc) · 1.1 KB
/
gen_equality_reward.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
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package params
import (
"encoding/json"
"errors"
"math/big"
"github.com/SecretBlockChain/go-secret/common/math"
)
var _ = (*equalityRewardMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (e EqualityReward) MarshalJSON() ([]byte, error) {
type EqualityReward struct {
Number uint64 `json:"number"`
Reward *math.HexOrDecimal256 `json:"reward" gencodec:"required"`
}
var enc EqualityReward
enc.Number = e.Number
enc.Reward = (*math.HexOrDecimal256)(e.Reward)
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (e *EqualityReward) UnmarshalJSON(input []byte) error {
type EqualityReward struct {
Number *uint64 `json:"number"`
Reward *math.HexOrDecimal256 `json:"reward" gencodec:"required"`
}
var dec EqualityReward
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.Number != nil {
e.Number = *dec.Number
}
if dec.Reward == nil {
return errors.New("missing required field 'reward' for EqualityReward")
}
e.Reward = (*big.Int)(dec.Reward)
return nil
}