// now we just perform action and savefunchandleMsgDeclareCandidacy(ctx sdk.Context, msg MsgDeclareCandidacy, k Keeper) sdk.Result {// check to see if the pubkey or sender has been registered before _, found := k.GetCandidate(ctx, msg.CandidateAddr)if found {returnErrCandidateExistsAddr(k.codespace).Result() }if msg.Bond.Denom != k.GetParams(ctx).BondDenom {returnErrBadBondingDenom(k.codespace).Result() }if ctx.IsCheckTx() {returnsdk.Result{ GasUsed: GasDeclareCandidacy, } } candidate :=NewCandidate(msg.CandidateAddr, msg.PubKey, msg.Description) k.setCandidate(ctx, candidate) tags := sdk.NewTags("action", []byte("declareCandidacy"), "candidate", msg.CandidateAddr.Bytes(), "moniker", []byte(msg.Description.Moniker), "identity", []byte(msg.Description.Identity))// move coins from the msg.Address account to a (self-bond) delegator account// the candidate account and global shares are updated within here delegateTags, err :=delegate(ctx, k, msg.CandidateAddr, msg.Bond, candidate)if err !=nil {return err.Result() } tags = tags.AppendTags(delegateTags)returnsdk.Result{ Tags: tags, }}