refactor: remove gogoproto stringer annotations and MarshalYAML functions (#13850)
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
@@ -35,18 +34,6 @@ func NewCommissionWithTime(rate, maxRate, maxChangeRate sdk.Dec, updatedAt time.
|
||||
}
|
||||
}
|
||||
|
||||
// String implements the Stringer interface for a Commission object.
|
||||
func (c Commission) String() string {
|
||||
out, _ := yaml.Marshal(c)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// String implements the Stringer interface for a CommissionRates object.
|
||||
func (cr CommissionRates) String() string {
|
||||
out, _ := yaml.Marshal(cr)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// Validate performs basic sanity validation checks of initial commission
|
||||
// parameters. If validation fails, an SDK error is returned.
|
||||
func (cr CommissionRates) Validate() error {
|
||||
|
||||
@@ -9,24 +9,11 @@ import (
|
||||
"cosmossdk.io/math"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
// Implements Delegation interface
|
||||
var _ DelegationI = Delegation{}
|
||||
|
||||
// String implements the Stringer interface for a DVPair object.
|
||||
func (dv DVPair) String() string {
|
||||
out, _ := yaml.Marshal(dv)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// String implements the Stringer interface for a DVVTriplet object.
|
||||
func (dvv DVVTriplet) String() string {
|
||||
out, _ := yaml.Marshal(dvv)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// NewDelegation creates a new delegation object
|
||||
//
|
||||
//nolint:interfacer
|
||||
@@ -75,12 +62,6 @@ func (d Delegation) GetValidatorAddr() sdk.ValAddress {
|
||||
}
|
||||
func (d Delegation) GetShares() math.LegacyDec { return d.Shares }
|
||||
|
||||
// String returns a human readable string representation of a Delegation.
|
||||
func (d Delegation) String() string {
|
||||
out, _ := yaml.Marshal(d)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// Delegations is a collection of delegations
|
||||
type Delegations []Delegation
|
||||
|
||||
@@ -103,12 +84,6 @@ func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time,
|
||||
}
|
||||
}
|
||||
|
||||
// String implements the stringer interface for a UnbondingDelegationEntry.
|
||||
func (e UnbondingDelegationEntry) String() string {
|
||||
out, _ := yaml.Marshal(e)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// IsMature - is the current entry mature
|
||||
func (e UnbondingDelegationEntry) IsMature(currentTime time.Time) bool {
|
||||
return !e.CompletionTime.After(currentTime)
|
||||
@@ -246,12 +221,6 @@ func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balanc
|
||||
}
|
||||
}
|
||||
|
||||
// String implements the Stringer interface for a RedelegationEntry object.
|
||||
func (e RedelegationEntry) String() string {
|
||||
out, _ := yaml.Marshal(e)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// IsMature - is the current entry mature
|
||||
func (e RedelegationEntry) IsMature(currentTime time.Time) bool {
|
||||
return !e.CompletionTime.After(currentTime)
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@@ -59,12 +58,6 @@ func DefaultParams() Params {
|
||||
)
|
||||
}
|
||||
|
||||
// String returns a human readable string representation of the parameters.
|
||||
func (p Params) String() string {
|
||||
out, _ := yaml.Marshal(p)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// unmarshal the current staking params value from store key or panic
|
||||
func MustUnmarshalParams(cdc *codec.LegacyAmino, value []byte) Params {
|
||||
params, err := UnmarshalParams(cdc, value)
|
||||
|
||||
+809
-800
File diff suppressed because it is too large
Load Diff
@@ -202,12 +202,6 @@ func NewDescription(moniker, identity, website, securityContact, details string)
|
||||
}
|
||||
}
|
||||
|
||||
// String implements the Stringer interface for a Description object.
|
||||
func (d Description) String() string {
|
||||
out, _ := yaml.Marshal(d)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// UpdateDescription updates the fields of a given description. An error is
|
||||
// returned if the resulting description contains an invalid length.
|
||||
func (d Description) UpdateDescription(d2 Description) (Description, error) {
|
||||
|
||||
Reference in New Issue
Block a user