func (v Validator) String() string {
	out, _ := yaml.Marshal(v)
	return string(out)
}
String implements the Stringer interface for a Validator object.
package types
import (
	"bytes"
	"fmt"
	"sort"
	"strings"
	"time"
	"github.com/KuChainNetwork/kuchain/chain/types"
	"github.com/KuChainNetwork/kuchain/x/staking/exported"
	stakingexport "github.com/KuChainNetwork/kuchain/x/staking/exported"
	"github.com/cosmos/cosmos-sdk/codec"
	sdk "github.com/cosmos/cosmos-sdk/types"
	sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
	abci "github.com/tendermint/tendermint/abci/types"
	"github.com/tendermint/tendermint/crypto"
	tmtypes "github.com/tendermint/tendermint/types"
	yaml "gopkg.in/yaml.v2"
)
const (
	MaxMonikerLength         = 70
	MaxIdentityLength        = 3000
	MaxWebsiteLength         = 140
	MaxSecurityContactLength = 140
	MaxDetailsLength         = 280
)
var _ exported.ValidatorI = Validator{}
type Validator struct {
	OperatorAccount   AccountID                `json:"operator_account" yaml:"operator_account"`
	ConsensusPubkey   string                   `json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"`
	Jailed            bool                     `json:"jailed,omitempty" yaml:"jailed"`
	Status            stakingexport.BondStatus `json:"status,omitempty" yaml:"status"`
	Tokens            sdk.Int                  `json:"tokens" yaml:"tokens"`
	DelegatorShares   Dec                      `json:"delegator_shares" yaml:"delegator_shares"`
	Description       Description              `json:"description" yaml:"description"`
	UnbondingHeight   int64                    `json:"unbonding_height,omitempty" yaml:"unbonding_height"`
	UnbondingTime     time.Time                `json:"unbonding_time" yaml:"unbonding_time"`
	Commission        Commission               `json:"commission" yaml:"commission"`
	MinSelfDelegation sdk.Int                  `json:"min_self_delegation" yaml:"min_self_delegation"`
}
func NewValidator(operator types.AccountID, pubKey crypto.PubKey, description Description) Validator {
	var pkStr string
	if pubKey != nil {
		pkStr = sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pubKey)
	}
	return Validator{
		OperatorAccount:   operator,
		ConsensusPubkey:   pkStr,
		Jailed:            false,
		Status:            stakingexport.Unbonded,
		Tokens:            sdk.ZeroInt(),
		DelegatorShares:   sdk.ZeroDec(),
		Description:       description,
		UnbondingHeight:   int64(0),
		UnbondingTime:     time.Unix(0, 0).UTC(),
		Commission:        NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
		MinSelfDelegation: sdk.OneInt(),
	}
}