func NewEmptyProphecy() Prophecy {
	return NewProphecy("")
}
NewEmptyProphecy returns a blank prophecy, used with errors
package types
import (
	"encoding/json"
	"github.com/cosmos/cosmos-sdk/x/staking"
	sdk "github.com/cosmos/cosmos-sdk/types"
)
const PendingStatusText = "pending"
const SuccessStatusText = "success"
const FailedStatusText = "failed"
type Prophecy struct {
	ID              string                      `json:"id"`
	Status          Status                      `json:"status"`
	ClaimValidators map[string][]sdk.ValAddress `json:"claim_validators"`  
	ValidatorClaims map[string]string           `json:"validator_claims"`  
}
type DBProphecy struct {
	ID              string `json:"id"`
	Status          Status `json:"status"`
	ClaimValidators []byte `json:"claim_validators"`  
	ValidatorClaims []byte `json:"validator_claims"`  
}
func (prophecy Prophecy) SerializeForDB() (DBProphecy, error) {
	claimValidators, err := json.Marshal(prophecy.ClaimValidators)
	if err != nil {
		return DBProphecy{}, err
	}
	validatorClaims, err := json.Marshal(prophecy.ValidatorClaims)
	if err != nil {
		return DBProphecy{}, err
	}
	return DBProphecy{
		ID:              prophecy.ID,
		Status:          prophecy.Status,
		ClaimValidators: claimValidators,
		ValidatorClaims: validatorClaims,
	}, nil
}
func (dbProphecy DBProphecy) DeserializeFromDB() (Prophecy, error) {
	var claimValidators map[string][]sdk.ValAddress
	err := json.Unmarshal(dbProphecy.ClaimValidators, &claimValidators)
	if err != nil {
		return Prophecy{}, err
	}
	var validatorClaims map[string]string
	err = json.Unmarshal(dbProphecy.ValidatorClaims, &validatorClaims)
	if err != nil {
		return Prophecy{}, err
	}
	return Prophecy{
		ID:              dbProphecy.ID,
		Status:          dbProphecy.Status,
		ClaimValidators: claimValidators,
		ValidatorClaims: validatorClaims,
	}, nil
}
func (prophecy Prophecy) AddClaim(validator sdk.ValAddress, claim string) {
	claimValidators := prophecy.ClaimValidators[claim]
	prophecy.ClaimValidators[claim] = append(claimValidators, validator)
	validatorBech32 := validator.String()
	prophecy.ValidatorClaims[validatorBech32] = claim
}
func (prophecy Prophecy) FindHighestClaim(ctx sdk.Context, stakeKeeper staking.Keeper) (string, int64, int64) {
	validators := stakeKeeper.GetBondedValidatorsByPower(ctx)
	validatorsByAddress := make(map[string]staking.Validator)
	for _, validator := range validators {
		validatorsByAddress[validator.OperatorAddress.String()] = validator
	}
	totalClaimsPower := int64(0)
	highestClaimPower := int64(-1)
	highestClaim := ""
	for claim, validators := range prophecy.ClaimValidators {
		claimPower := int64(0)
		for _, validator := range validators {
			validatorPower := validatorsByAddress[validator.String()].GetTendermintPower()
			claimPower += validatorPower
		}
		totalClaimsPower += claimPower
		if claimPower > highestClaimPower {
			highestClaimPower = claimPower
			highestClaim = claim
		}
	}
	return highestClaim, highestClaimPower, totalClaimsPower
}
func NewProphecy(id string) Prophecy {
	return Prophecy{
		ID:              id,
		Status:          NewStatus(PendingStatusText, ""),
		ClaimValidators: make(map[string][]sdk.ValAddress),
		ValidatorClaims: make(map[string]string),
	}
}