-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
pretty_params.go
34 lines (29 loc) · 1.05 KB
/
pretty_params.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
package common
import (
"encoding/json"
"fmt"
)
// Convenience struct for CLI output
type PrettyParams struct {
CommunityTax json.RawMessage `json:"community_tax"`
BaseProposerReward json.RawMessage `json:"base_proposer_reward"`
BonusProposerReward json.RawMessage `json:"bonus_proposer_reward"`
WithdrawAddrEnabled json.RawMessage `json:"withdraw_addr_enabled"`
}
// Construct a new PrettyParams
func NewPrettyParams(communityTax json.RawMessage, baseProposerReward json.RawMessage, bonusProposerReward json.RawMessage, withdrawAddrEnabled json.RawMessage) PrettyParams {
return PrettyParams{
CommunityTax: communityTax,
BaseProposerReward: baseProposerReward,
BonusProposerReward: bonusProposerReward,
WithdrawAddrEnabled: withdrawAddrEnabled,
}
}
func (pp PrettyParams) String() string {
return fmt.Sprintf(`Distribution Params:
Community Tax: %s
Base Proposer Reward: %s
Bonus Proposer Reward: %s
Withdraw Addr Enabled: %s`, pp.CommunityTax,
pp.BaseProposerReward, pp.BonusProposerReward, pp.WithdrawAddrEnabled)
}