diff --git a/x/liquidstakeibc/keeper/abci.go b/x/liquidstakeibc/keeper/abci.go index 59986e885..acdbfcb95 100644 --- a/x/liquidstakeibc/keeper/abci.go +++ b/x/liquidstakeibc/keeper/abci.go @@ -85,13 +85,21 @@ func (k *Keeper) DoDelegate(ctx sdk.Context, hc *types.HostChain) { } // if everything went well, update the deposit states and set the sequence id - lastEpoch := int64(0) // highest epoch among deposits, used for event emission for _, deposit := range deposits { deposit.IbcSequenceId = sequenceID deposit.State = types.Deposit_DEPOSIT_DELEGATING k.SetDeposit(ctx, deposit) - lastEpoch = deposit.Epoch + // emit the delegation event for every deposit + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeDoDelegationDeposit, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeEpoch, strconv.FormatInt(deposit.Epoch, 10)), + sdk.NewAttribute(types.AttributeDelegatedAmount, sdk.NewCoin(hc.HostDenom, deposit.Amount.Amount).String()), + sdk.NewAttribute(types.AttributeIBCSequenceID, sequenceID), + ), + ) } // emit the delegation event @@ -100,10 +108,8 @@ func (k *Keeper) DoDelegate(ctx sdk.Context, hc *types.HostChain) { sdk.NewEvent( types.EventTypeDoDelegation, sdk.NewAttribute(types.AttributeChainID, hc.ChainId), - sdk.NewAttribute(types.AttributeEpoch, strconv.FormatInt(lastEpoch, 10)), sdk.NewAttribute(types.AttributeTotalDelegatedAmount, sdk.NewCoin(hc.HostDenom, totalDepositDelegation).String()), sdk.NewAttribute(types.AttributeICAMessages, base64.StdEncoding.EncodeToString(encMsgs)), - sdk.NewAttribute(types.AttributeIBCSequenceID, sequenceID), ), ) } diff --git a/x/liquidstakeibc/types/events.go b/x/liquidstakeibc/types/events.go index 9540ec144..f3e19c944 100644 --- a/x/liquidstakeibc/types/events.go +++ b/x/liquidstakeibc/types/events.go @@ -14,6 +14,7 @@ const ( EventTypeValidatorExchangeRateUpdate = "validator_exchange_rate_update" EventTypeValidatorDelegableStateUpdate = "validator_delegable_state_update" EventTypeDoDelegation = "send_delegation" + EventTypeDoDelegationDeposit = "send_individual_delegation" EventTypeClaimedUnbondings = "claimed_unbondings" EventTypeRedeemTokensForShares = "redeem_lsm_tokens_shares" //nolint:gosec EventTypeCValueUpdate = "c_value_update"