func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr AccountID, option types.VoteOption) error {
	proposal, ok := keeper.GetProposal(ctx, proposalID)
	if !ok {
		return sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID)
	}
	if proposal.Status != types.StatusVotingPeriod {
		return sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID)
	}
	if !types.ValidVoteOption(option) {
		return sdkerrors.Wrap(types.ErrInvalidVote, option.String())
	}
	validatorVoter := keeper.sk.Validator(ctx, voterAddr)
	if validatorVoter == nil {
		return sdkerrors.Wrap(types.ErrInvalidVoter, voterAddr.String())
	}
	vote := types.NewVote(proposalID, voterAddr, option)
	keeper.SetVote(ctx, vote)
	ctx.EventManager().EmitEvent(
		sdk.NewEvent(
			types.EventTypeProposalVote,
			sdk.NewAttribute(types.AttributeKeyOption, option.String()),
			sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)),
		),
	)
	passed, _ := keeper.EmergencyPass(ctx, proposalID)
	if passed {
		keeper.RemoveFromActiveProposalQueue(ctx, proposalID, proposal.VotingEndTime)
		proposal.VotingEndTime = ctx.BlockHeader().Time
		keeper.SetProposal(ctx, proposal)
		keeper.InsertActiveProposalQueue(ctx, proposalID, proposal.VotingEndTime)
	}
	return nil
}
AddVote adds a vote on a specific proposal
package keeper
import (
	"fmt"
	"github.com/KuChainNetwork/kuchain/x/gov/types"
	sdk "github.com/cosmos/cosmos-sdk/types"
	sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)