From eded6b63431cc626e316789d4bab9e98191e0d1e Mon Sep 17 00:00:00 2001 From: Marc Puig Date: Fri, 20 Oct 2023 14:42:53 +0200 Subject: [PATCH] feat: Monitoring Events (#667) * msg_server events * active flag event * validator update events * delegation events * claim events * lsm untokenize events * epoch events * icq events * IBC transfer events * ICA events * IBC transfer ack events * ica events * burn event * linting * changelog * changelog * add individual event delegations --- CHANGELOG.md | 12 +- x/liquidstakeibc/keeper/abci.go | 49 +++++++ x/liquidstakeibc/keeper/hooks.go | 160 +++++++++++++++++++++-- x/liquidstakeibc/keeper/host_chain.go | 50 ++++++++ x/liquidstakeibc/keeper/ibc.go | 163 ++++++++++++++++++++++++ x/liquidstakeibc/keeper/ica_handlers.go | 62 +++++++++ x/liquidstakeibc/keeper/icq.go | 15 ++- x/liquidstakeibc/keeper/keeper.go | 18 ++- x/liquidstakeibc/keeper/msg_server.go | 47 +++++-- x/liquidstakeibc/spec/README.md | 53 +++++--- x/liquidstakeibc/types/events.go | 124 +++++++++++++----- 11 files changed, 680 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d865b56..3b90310c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,17 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog ## [Unreleased] -- [#668](https://github.com/persistenceOne/pstake-native/pull/668) Update ICA timeout + +### Features + +- [#667](https://github.com/persistenceOne/pstake-native/pull/667) Monitoring Events. + +### Improvements + +- [#668](https://github.com/persistenceOne/pstake-native/pull/668) Update ICA timeout. + +### Bug Fixes + - [#665](https://github.com/persistenceOne/pstake-native/pull/665) LSM deposit timeout fix. ## [v2.4.0] - 2023-09-13 diff --git a/x/liquidstakeibc/keeper/abci.go b/x/liquidstakeibc/keeper/abci.go index 6297cc09e..acdbfcb95 100644 --- a/x/liquidstakeibc/keeper/abci.go +++ b/x/liquidstakeibc/keeper/abci.go @@ -1,7 +1,10 @@ package keeper import ( + "encoding/base64" + "encoding/json" "fmt" + "strconv" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -86,7 +89,29 @@ func (k *Keeper) DoDelegate(ctx sdk.Context, hc *types.HostChain) { deposit.IbcSequenceId = sequenceID deposit.State = types.Deposit_DEPOSIT_DELEGATING k.SetDeposit(ctx, deposit) + + // 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 + encMsgs, _ := json.Marshal(&messages) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeDoDelegation, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeTotalDelegatedAmount, sdk.NewCoin(hc.HostDenom, totalDepositDelegation).String()), + sdk.NewAttribute(types.AttributeICAMessages, base64.StdEncoding.EncodeToString(encMsgs)), + ), + ) } func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain) { @@ -114,12 +139,15 @@ func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain) { } var claimableCoins sdk.Coins + var eventAmount sdk.Coin // used for claim events switch unbonding.State { case types.Unbonding_UNBONDING_CLAIMABLE: claimableCoins = sdk.NewCoins(sdk.NewCoin(hc.IBCDenom(), userUnbonding.UnbondAmount.Amount)) + eventAmount = sdk.NewCoin(hc.HostDenom, userUnbonding.UnbondAmount.Amount) unbonding.UnbondAmount = unbonding.UnbondAmount.Sub(userUnbonding.UnbondAmount) case types.Unbonding_UNBONDING_FAILED: claimableCoins = sdk.NewCoins(sdk.NewCoin(hc.MintDenom(), userUnbonding.StkAmount.Amount)) + eventAmount = sdk.NewCoin(hc.MintDenom(), userUnbonding.StkAmount.Amount) unbonding.BurnAmount = unbonding.BurnAmount.Sub(userUnbonding.StkAmount) } @@ -148,6 +176,16 @@ func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain) { } k.DeleteUserUnbonding(ctx, userUnbonding) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeClaimedUnbondings, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeEpoch, strconv.FormatInt(epochNumber, 10)), + sdk.NewAttribute(types.AttributeClaimAmount, eventAmount.String()), + sdk.NewAttribute(types.AttributeClaimAddress, userUnbonding.Address), + ), + ) } } } @@ -306,4 +344,15 @@ func (k *Keeper) DoRedeemLSMTokens(ctx sdk.Context, hc *types.HostChain) { "sequence-id", sequenceID, ) + + // emit the untokenize event + encMsgs, _ := json.Marshal(&messages) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeRedeemTokensForShares, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeICAMessages, base64.StdEncoding.EncodeToString(encMsgs)), + sdk.NewAttribute(types.AttributeIBCSequenceID, sequenceID), + ), + ) } diff --git a/x/liquidstakeibc/keeper/hooks.go b/x/liquidstakeibc/keeper/hooks.go index 85f9ec445..eed175d53 100644 --- a/x/liquidstakeibc/keeper/hooks.go +++ b/x/liquidstakeibc/keeper/hooks.go @@ -1,10 +1,14 @@ package keeper import ( + "encoding/base64" + "encoding/json" "fmt" + "strconv" "time" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -178,6 +182,16 @@ func (k *Keeper) OnRecvIBCTransferPacket( unbonding.IbcSequenceId = "" unbonding.State = liquidstakeibctypes.Unbonding_UNBONDING_CLAIMABLE k.SetUnbonding(ctx, unbonding) + + // emit event for the received transfer + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventTypeUnbondingMaturedReceived, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeEpoch, strconv.FormatInt(unbonding.EpochNumber, 10)), + sdk.NewAttribute(liquidstakeibctypes.AttributeUnbondingMaturedAmount, sdk.NewCoin(hc.HostDenom, unbonding.UnbondAmount.Amount).String()), + ), + ) } } @@ -220,6 +234,14 @@ func (k *Keeper) OnRecvIBCTransferPacket( deposit.Amount.Amount = deposit.Amount.Amount.Add(transferAmount) k.SetDeposit(ctx, deposit) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventTypeValidatorUnbondingMaturedReceived, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeValidatorUnbondingMaturedAmount, sdk.NewCoin(hc.HostDenom, transferAmount).String()), + ), + ) } // the transfer is part of the autocompounding process @@ -283,6 +305,16 @@ func (k *Keeper) OnRecvIBCTransferPacket( // update the deposit deposit.Amount.Amount = deposit.Amount.Amount.Add(transferAmount.Sub(feeAmount.TruncateInt())) k.SetDeposit(ctx, deposit) + + // emit autocompound received event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventAutocompoundRewardsReceived, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeAutocompoundTransfer, sdk.NewCoin(hc.HostDenom, transferAmount).String()), + sdk.NewAttribute(liquidstakeibctypes.AttributePstakeAutocompoundFee, sdk.NewCoin(hc.HostDenom, feeAmount.TruncateInt()).String()), + ), + ) } return nil @@ -353,11 +385,36 @@ func (k *Keeper) OnAcknowledgementIBCTransferPacket( "channel", packet.SourceChannel, ) + + // emit events for the deposits received + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventStakingDepositTransferReceived, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeIBCSequenceID, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)), + ), + ) } // mark tokenized LSM token delegations as received and add the IBC sequence lsmDeposits := k.GetLSMDepositsFromIbcSequenceID(ctx, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)) k.UpdateLSMDepositsStateAndSequence(ctx, lsmDeposits, liquidstakeibctypes.LSMDeposit_DEPOSIT_RECEIVED, "") + + // emit events for the lsm deposits received + for _, lsmDeposit := range lsmDeposits { + hc, found := k.GetHostChain(ctx, lsmDeposit.ChainId) + if !found { + return fmt.Errorf("host chain with id %s is not registered", lsmDeposit.ChainId) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventLSMDepositTransferReceived, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeIBCSequenceID, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)), + ), + ) + } } return nil @@ -381,16 +438,44 @@ func (k *Keeper) OnTimeoutIBCTransferPacket( // just take action when the transfer has been, send from the deposit module account if data.GetSender() == authtypes.NewModuleAddress(liquidstakeibctypes.DepositModuleAccount).String() { // revert the state of the deposits that timed out - k.RevertDepositsState( - ctx, - k.GetDepositsWithSequenceID(ctx, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)), - ) + deposits := k.GetDepositsWithSequenceID(ctx, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)) + k.RevertDepositsState(ctx, deposits) + + // emit events for the deposits that timed out + for _, deposit := range deposits { + hc, found := k.GetHostChain(ctx, deposit.ChainId) + if !found { + return fmt.Errorf("host chain with id %s is not registered", deposit.ChainId) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventStakingDepositTransferTimeout, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeIBCSequenceID, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)), + ), + ) + } // revert the state of the LSM deposits that timed out - k.RevertLSMDepositsState( - ctx, - k.GetLSMDepositsFromIbcSequenceID(ctx, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)), - ) + lsmDeposits := k.GetLSMDepositsFromIbcSequenceID(ctx, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)) + k.RevertLSMDepositsState(ctx, lsmDeposits) + + // emit events for the lsm deposits that timed out + for _, lsmDeposit := range lsmDeposits { + hc, found := k.GetHostChain(ctx, lsmDeposit.ChainId) + if !found { + return fmt.Errorf("host chain with id %s is not registered", lsmDeposit.ChainId) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventLSMDepositTransferTimeout, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeIBCSequenceID, k.GetTransactionSequenceID(packet.SourceChannel, packet.Sequence)), + ), + ) + } } k.Logger(ctx).Info( @@ -474,6 +559,16 @@ func (k *Keeper) DepositWorkflow(ctx sdk.Context, epoch int64) { deposit.State = liquidstakeibctypes.Deposit_DEPOSIT_SENT deposit.IbcSequenceId = k.GetTransactionSequenceID(hc.ChannelId, msgTransferResponse.Sequence) k.SetDeposit(ctx, deposit) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventTypeDelegationWorkflow, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeEpoch, strconv.FormatInt(deposit.Epoch, 10)), + sdk.NewAttribute(liquidstakeibctypes.AttributeTotalEpochDepositAmount, sdk.NewCoin(hc.HostDenom, deposit.Amount.Amount).String()), + sdk.NewAttribute(liquidstakeibctypes.AttributeIBCSequenceID, deposit.IbcSequenceId), + ), + ) } } @@ -545,6 +640,20 @@ func (k *Keeper) UndelegationWorkflow(ctx sdk.Context, epoch int64) { unbonding.IbcSequenceId = sequenceID unbonding.State = liquidstakeibctypes.Unbonding_UNBONDING_INITIATED k.SetUnbonding(ctx, unbonding) + + // emit the unbonding event + encMsgs, _ := json.Marshal(&messages) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventTypeUndelegationWorkflow, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeEpoch, strconv.FormatInt(epoch, 10)), + sdk.NewAttribute(liquidstakeibctypes.AttributeTotalEpochUnbondingAmount, sdk.NewCoin(hc.HostDenom, unbonding.UnbondAmount.Amount).String()), + sdk.NewAttribute(liquidstakeibctypes.AttributeTotalEpochBurnAmount, sdk.NewCoin(hc.HostDenom, unbonding.BurnAmount.Amount).String()), + sdk.NewAttribute(liquidstakeibctypes.AttributeICAMessages, base64.StdEncoding.EncodeToString(encMsgs)), + sdk.NewAttribute(liquidstakeibctypes.AttributeIBCSequenceID, sequenceID), + ), + ) } } @@ -619,6 +728,18 @@ func (k *Keeper) ValidatorUndelegationWorkflow(ctx sdk.Context, epoch int64) { "epoch", epoch, ) + + // emit the validator unbonding event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventTypeValidatorUndelegationWorkflow, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeEpoch, strconv.FormatInt(epoch, 10)), + sdk.NewAttribute(liquidstakeibctypes.AttributeValidatorAddress, validatorUnbonding.ValidatorAddress), + sdk.NewAttribute(liquidstakeibctypes.AttributeValidatorUnbondingAmount, sdk.NewCoin(hc.HostDenom, validatorUnbonding.Amount.Amount).String()), + sdk.NewAttribute(liquidstakeibctypes.AttributeIBCSequenceID, sequenceID), + ), + ) } } } @@ -661,6 +782,17 @@ func (k *Keeper) RewardsWorkflow(ctx sdk.Context, epoch int64) { ) continue } + + // emit the rewards event + encMsgs, _ := json.Marshal(&messages) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventTypeRewardsWorkflow, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeEpoch, strconv.FormatInt(epoch, 10)), + sdk.NewAttribute(liquidstakeibctypes.AttributeICAMessages, base64.StdEncoding.EncodeToString(encMsgs)), + ), + ) } if hc.RewardsAccount != nil && @@ -685,6 +817,7 @@ func (k *Keeper) LSMWorkflow(ctx sdk.Context) { } // attempt to transfer all available LSM deposits + totalLSMDepositsSharesAmount := math.LegacyZeroDec() for _, deposit := range k.GetTransferableLSMDeposits(ctx, hc.ChainId) { clientState, err := k.GetClientState(ctx, hc.ConnectionId) if err != nil { @@ -732,6 +865,17 @@ func (k *Keeper) LSMWorkflow(ctx sdk.Context) { liquidstakeibctypes.LSMDeposit_DEPOSIT_SENT, k.GetTransactionSequenceID(hc.ChannelId, msgTransferResponse.Sequence), ) + + totalLSMDepositsSharesAmount = totalLSMDepositsSharesAmount.Add(deposit.Shares) } + + // emit the validator unbonding event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + liquidstakeibctypes.EventTypeLSMWorkflow, + sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId), + sdk.NewAttribute(liquidstakeibctypes.AttributeLSMDepositsSharesAmount, totalLSMDepositsSharesAmount.String()), + ), + ) } } diff --git a/x/liquidstakeibc/keeper/host_chain.go b/x/liquidstakeibc/keeper/host_chain.go index 70d0ec329..c942d70ad 100644 --- a/x/liquidstakeibc/keeper/host_chain.go +++ b/x/liquidstakeibc/keeper/host_chain.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "strconv" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -62,6 +63,17 @@ func (k *Keeper) ProcessHostChainValidatorUpdates( val.UnbondingEpoch = 0 } + // emit the status update event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeValidatorStatusUpdate, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeValidatorAddress, val.OperatorAddress), + sdk.NewAttribute(types.AttributeKeyValidatorOldStatus, val.Status), + sdk.NewAttribute(types.AttributeKeyValidatorNewStatus, validator.Status.String()), + ), + ) + val.Status = validator.Status.String() k.SetHostChainValidator(ctx, hc, val) } @@ -84,6 +96,17 @@ func (k *Keeper) ProcessHostChainValidatorUpdates( } } + // emit the exchange rate event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeValidatorExchangeRateUpdate, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeValidatorAddress, val.OperatorAddress), + sdk.NewAttribute(types.AttributeKeyValidatorOldExchangeRate, val.ExchangeRate.String()), + sdk.NewAttribute(types.AttributeKeyValidatorNewExchangeRate, exchangeRate.String()), + ), + ) + val.ExchangeRate = exchangeRate k.SetHostChainValidator(ctx, hc, val) } @@ -108,6 +131,9 @@ func (k *Keeper) ProcessHostChainValidatorUpdates( validatorHasEnoughBond = validator.LiquidShares.LT(validator.ValidatorBondShares.Mul(hc.Params.LsmBondFactor)) } + // save the old delegable flag for event purposes + oldDelegableFlag := val.Delegable + // update the validator if its delegable status has changed val.Delegable = validatorHasRoomForDelegations && validatorHasEnoughBond k.SetHostChainValidator(ctx, hc, val) @@ -122,6 +148,18 @@ func (k *Keeper) ProcessHostChainValidatorUpdates( // if the validator is not delegable, no messages will be generated for it, so there is nothing else to do if !val.Delegable { + // emit the delegable status event + if oldDelegableFlag != val.Delegable { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeValidatorDelegableStateUpdate, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeValidatorAddress, val.OperatorAddress), + sdk.NewAttribute(types.AttributeKeyValidatorDelegable, strconv.FormatBool(val.Delegable)), + ), + ) + } + return nil } @@ -173,6 +211,18 @@ func (k *Keeper) ProcessHostChainValidatorUpdates( // recalculate the delegable state of the validator with the new flag val.Delegable = validatorHasRoomForDelegations && validatorHasEnoughBond && validatorHasEnoughRoom k.SetHostChainValidator(ctx, hc, val) + + // emit the delegable status event + if oldDelegableFlag != val.Delegable { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeValidatorDelegableStateUpdate, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeValidatorAddress, val.OperatorAddress), + sdk.NewAttribute(types.AttributeKeyValidatorDelegable, strconv.FormatBool(val.Delegable)), + ), + ) + } } return nil diff --git a/x/liquidstakeibc/keeper/ibc.go b/x/liquidstakeibc/keeper/ibc.go index 472ad0747..fb77cbe8a 100644 --- a/x/liquidstakeibc/keeper/ibc.go +++ b/x/liquidstakeibc/keeper/ibc.go @@ -106,6 +106,16 @@ func (k *Keeper) OnChanOpenAck( address, ) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventICAChannelCreated, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeICAChannelID, channelID), + sdk.NewAttribute(types.AttributeICAPortOwner, portOwner), + sdk.NewAttribute(types.AttributeICAAddress, address), + ), + ) + return nil } @@ -216,11 +226,83 @@ func (k *Keeper) handleUnsuccessfulAck( case sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}): // revert all the deposits for that sequence back to the previous state k.RevertDepositsState(ctx, k.GetDepositsWithSequenceID(ctx, k.GetTransactionSequenceID(channel, sequence))) + + // parse the delegate message to emit the delegate error event + parsedMsg, ok := msg.(*stakingtypes.MsgDelegate) + if !ok { + k.Logger(ctx).Error( + "Could not parse MsgDelegate while handling unsuccessful ack.", + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // get the host chain using the delegator address + hc, found := k.GetHostChainFromDelegatorAddress(ctx, parsedMsg.DelegatorAddress) + if !found { + k.Logger(ctx).Error( + "Could not find host chain for ICA delegator address.", + "delegator-address", + parsedMsg.DelegatorAddress, + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // emit an event for the delegation confirmation + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventUnsuccessfulDelegation, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeDelegatorAddress, parsedMsg.DelegatorAddress), + sdk.NewAttribute(types.AttributeValidatorAddress, parsedMsg.ValidatorAddress), + sdk.NewAttribute(types.AttributeDelegatedAmount, sdk.NewCoin(hc.HostDenom, parsedMsg.Amount.Amount).String()), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) case sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}): // mark all the unbondings for the previous epoch as failed k.FailAllUnbondingsForSequenceID(ctx, k.GetTransactionSequenceID(channel, sequence)) // delete all validator unbondings so they can be picked up again k.DeleteValidatorUnbondingsForSequenceID(ctx, k.GetTransactionSequenceID(channel, sequence)) + + // parse the undelegate message to emit the undelegate error event + parsedMsg, ok := msg.(*stakingtypes.MsgUndelegate) + if !ok { + k.Logger(ctx).Error( + "Could not parse MsgUndelegate while handling unsuccessful ack.", + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // get the host chain using the delegator address + hc, found := k.GetHostChainFromDelegatorAddress(ctx, parsedMsg.DelegatorAddress) + if !found { + k.Logger(ctx).Error( + "Could not find host chain for ICA delegator address.", + "delegator-address", + parsedMsg.DelegatorAddress, + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // emit an event for the undelegation confirmation + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventUnsuccessfulUndelegation, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeDelegatorAddress, parsedMsg.DelegatorAddress), + sdk.NewAttribute(types.AttributeValidatorAddress, parsedMsg.ValidatorAddress), + sdk.NewAttribute(types.AttributeUndelegatedAmount, sdk.NewCoin(hc.HostDenom, parsedMsg.Amount.Amount).String()), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) case sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}): unbondings := k.FilterUnbondings( ctx, @@ -244,6 +326,52 @@ func (k *Keeper) handleUnsuccessfulAck( validatorUnbonding.IbcSequenceId = "" k.SetValidatorUnbonding(ctx, validatorUnbonding) } + + // parse the transfer message to emit the transfer error event + parsedMsg, ok := msg.(*ibctransfertypes.MsgTransfer) + if !ok { + k.Logger(ctx).Error( + "Could not parse MsgTransfer while handling unsuccessful ack.", + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // get the host chain using the delegator address + hc, found := k.GetHostChainFromDelegatorAddress(ctx, parsedMsg.Sender) + if !found { + k.Logger(ctx).Error( + "Could not find host chain for ICA delegator address.", + "delegator-address", + parsedMsg.Sender, + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // if the response is for an unbonding transfer, emit the unbonding transfer error event + if len(unbondings) > 0 { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventUnsuccessfulUndelegationTransfer, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) + } + + // if the response is from a validator unbonding transfer, emit the validator unbonding transfer error event + if len(validatorUnbondings) > 0 { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventUnsuccessfulValidatorUndelegationTransfer, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) + } case sdk.MsgTypeURL(&stakingtypes.MsgRedeemTokensForShares{}): deposits := k.FilterLSMDeposits( ctx, @@ -254,6 +382,41 @@ func (k *Keeper) handleUnsuccessfulAck( // revert the state of the deposit, so it will be retried k.RevertLSMDepositsState(ctx, deposits) + + // parse the transfer message to emit the redeem error event + parsedMsg, ok := msg.(*stakingtypes.MsgRedeemTokensForShares) + if !ok { + k.Logger(ctx).Error( + "Could not parse MsgRedeemTokensForShares while handling unsuccessful ack.", + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // get the host chain using the delegator address + hc, found := k.GetHostChainFromDelegatorAddress(ctx, parsedMsg.DelegatorAddress) + if !found { + k.Logger(ctx).Error( + "Could not find host chain for ICA delegator address.", + "delegator-address", + parsedMsg.DelegatorAddress, + "sequence-id", + k.GetTransactionSequenceID(channel, sequence), + ) + continue + } + + // emit an event for the redeem error + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventUnsuccessfulLSMRedeem, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeDelegatorAddress, parsedMsg.DelegatorAddress), + sdk.NewAttribute(types.AttributeRedeemedAmount, sdk.NewCoin(hc.HostDenom, parsedMsg.Amount.Amount).String()), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) } } diff --git a/x/liquidstakeibc/keeper/ica_handlers.go b/x/liquidstakeibc/keeper/ica_handlers.go index 449465dd8..884e5fa30 100644 --- a/x/liquidstakeibc/keeper/ica_handlers.go +++ b/x/liquidstakeibc/keeper/ica_handlers.go @@ -57,6 +57,18 @@ func (k *Keeper) HandleDelegateResponse(ctx sdk.Context, msg sdk.Msg, channel st k.SetHostChain(ctx, hc) + // emit an event for the delegation confirmation + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventSuccessfulDelegation, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeDelegatorAddress, parsedMsg.DelegatorAddress), + sdk.NewAttribute(types.AttributeValidatorAddress, parsedMsg.ValidatorAddress), + sdk.NewAttribute(types.AttributeDelegatedAmount, sdk.NewCoin(hc.HostDenom, parsedMsg.Amount.Amount).String()), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) + k.Logger(ctx).Info( "Received delegation acknowledgement", "delegator", @@ -133,6 +145,15 @@ func (k *Keeper) HandleUndelegateResponse( unbonding.State = types.Unbonding_UNBONDING_MATURING k.SetUnbonding(ctx, unbonding) + // emit an event for the burned coins + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventBurn, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeTotalEpochBurnAmount, sdk.NewCoin(hc.MintDenom(), unbonding.BurnAmount.Amount).String()), + ), + ) + k.Logger(ctx).Info( "Received unbonding acknowledgement", "delegator", @@ -169,6 +190,18 @@ func (k *Keeper) HandleUndelegateResponse( ) } + // emit an event for the undelegation confirmation + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventSuccessfulUndelegation, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeDelegatorAddress, parsedMsg.DelegatorAddress), + sdk.NewAttribute(types.AttributeValidatorAddress, parsedMsg.ValidatorAddress), + sdk.NewAttribute(types.AttributeUndelegatedAmount, sdk.NewCoin(hc.HostDenom, parsedMsg.Amount.Amount).String()), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) + return nil } @@ -214,6 +247,15 @@ func (k *Keeper) HandleMsgTransfer( unbonding.IbcSequenceId = k.GetTransactionSequenceID(hc.ChannelId, resp.Sequence) k.SetUnbonding(ctx, unbonding) } + + // emit the transfer ack event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventSuccessfulUndelegationTransfer, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(hc.ChannelId, resp.Sequence)), + ), + ) } if parsedMsg.Sender == hc.DelegationAccount.Address && @@ -229,6 +271,15 @@ func (k *Keeper) HandleMsgTransfer( for _, validatorUnbonding := range validatorUnbondings { k.DeleteValidatorUnbonding(ctx, validatorUnbonding) } + + // emit the transfer ack event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventSuccessfulValidatorUndelegationTransfer, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(hc.ChannelId, resp.Sequence)), + ), + ) } return nil @@ -292,6 +343,17 @@ func (k *Keeper) HandleMsgRedeemTokensForShares( k.SetHostChain(ctx, hc) + // emit an event for the redeem confirmation + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventSuccessfulLSMRedeem, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeDelegatorAddress, parsedMsg.DelegatorAddress), + sdk.NewAttribute(types.AttributeRedeemedAmount, sdk.NewCoin(hc.HostDenom, parsedMsg.Amount.Amount).String()), + sdk.NewAttribute(types.AttributeIBCSequenceID, k.GetTransactionSequenceID(channel, sequence)), + ), + ) + k.Logger(ctx).Info( "Received lsm token redeem acknowledgement", "delegator", diff --git a/x/liquidstakeibc/keeper/icq.go b/x/liquidstakeibc/keeper/icq.go index 4aec2d360..1e49d8bf6 100644 --- a/x/liquidstakeibc/keeper/icq.go +++ b/x/liquidstakeibc/keeper/icq.go @@ -105,14 +105,16 @@ func DelegationCallback(k Keeper, ctx sdk.Context, data []byte, query icqtypes.Q validator.DelegatedAmount = delegatedAmount.TruncateInt() k.SetHostChainValidator(ctx, hc, validator) - ctx.EventManager().EmitEvents(sdk.Events{ + ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeSlashing, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), sdk.NewAttribute(types.AttributeValidatorAddress, validator.OperatorAddress), sdk.NewAttribute(types.AttributeExistingDelegation, validator.DelegatedAmount.String()), sdk.NewAttribute(types.AttributeUpdatedDelegation, delegatedAmount.String()), sdk.NewAttribute(types.AttributeSlashedAmount, slashedAmount.String()), - )}) + ), + ) } return nil @@ -171,6 +173,15 @@ func RewardsAccountBalanceCallback(k Keeper, ctx sdk.Context, data []byte, query if err != nil { return fmt.Errorf("could not send ICA rewards transfer: %w", err) } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeRewardsTransfer, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeRewardsTransferAmount, sdk.NewCoin(hc.HostDenom, autocompoundRewards.Amount).String()), + sdk.NewAttribute(types.AttributeRewardsBalanceAmount, sdk.NewCoin(hc.HostDenom, hc.RewardsAccount.Balance.Amount.Sub(autocompoundRewards.Amount)).String()), + ), + ) } k.SetHostChain(ctx, hc) diff --git a/x/liquidstakeibc/keeper/keeper.go b/x/liquidstakeibc/keeper/keeper.go index d24a76f5d..99b59d14f 100644 --- a/x/liquidstakeibc/keeper/keeper.go +++ b/x/liquidstakeibc/keeper/keeper.go @@ -303,6 +303,21 @@ func (k *Keeper) UpdateCValues(ctx sdk.Context) { hc.CValue = cValue k.SetHostChain(ctx, hc) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeCValueUpdate, + sdk.NewAttribute(types.AttributeChainID, hc.ChainId), + sdk.NewAttribute(types.AttributeModuleMintedAmount, sdk.NewCoin(hc.MintDenom(), mintedAmount).String()), + sdk.NewAttribute(types.AttributeModuleLSMTokenizedAmount, sdk.NewCoin(hc.HostDenom, tokenizedStakedAmount).String()), + sdk.NewAttribute(types.AttributeModuleStakedAmount, sdk.NewCoin(hc.HostDenom, stakedAmount).String()), + sdk.NewAttribute(types.AttributeModuleAmountOnPersistence, sdk.NewCoin(hc.HostDenom, amountOnPersistence).String()), + sdk.NewAttribute(types.AttributeModuleAmountOnHostChain, sdk.NewCoin(hc.HostDenom, amountOnHostChain).String()), + sdk.NewAttribute(types.AttributeModuleUnbondingAmount, sdk.NewCoin(hc.HostDenom, totalUnbondingAmount).String()), + sdk.NewAttribute(types.AttributeOldCValue, hc.LastCValue.String()), + sdk.NewAttribute(types.AttributeNewCValue, hc.CValue.String()), + ), + ) + defer func() { cValueFloat, _ := hc.CValue.Float64() telemetry.ModuleSetGauge(types.ModuleName, float32(cValueFloat), hc.ChainId, "c_value") @@ -322,7 +337,8 @@ func (k *Keeper) UpdateCValues(ctx sdk.Context) { sdk.NewEvent( types.EventTypeChainDisabled, sdk.NewAttribute(types.AttributeChainID, hc.ChainId), - sdk.NewAttribute(types.AttributeCValue, hc.CValue.String()), + sdk.NewAttribute(types.AttributeOldCValue, hc.LastCValue.String()), + sdk.NewAttribute(types.AttributeNewCValue, hc.CValue.String()), ), ) } diff --git a/x/liquidstakeibc/keeper/msg_server.go b/x/liquidstakeibc/keeper/msg_server.go index d7629bef3..75f44256c 100644 --- a/x/liquidstakeibc/keeper/msg_server.go +++ b/x/liquidstakeibc/keeper/msg_server.go @@ -402,10 +402,14 @@ func (k msgServer) LiquidStake( ctx.EventManager().EmitEvents(sdktypes.Events{ sdktypes.NewEvent( types.EventTypeLiquidStake, + sdktypes.NewAttribute(types.AttributeChainID, hostChain.ChainId), sdktypes.NewAttribute(types.AttributeDelegatorAddress, delegatorAddress.String()), - sdktypes.NewAttribute(types.AttributeAmount, depositAmount.String()), - sdktypes.NewAttribute(types.AttributeAmountReceived, mintToken.Sub(protocolFee).String()), - sdktypes.NewAttribute(types.AttributePstakeDepositFee, protocolFee.String()), + sdktypes.NewAttribute(types.AttributeInputAmount, + sdktypes.NewCoin(hostChain.HostDenom, msg.Amount.Amount).String()), + sdktypes.NewAttribute(types.AttributeOutputAmount, + sdktypes.NewCoin(hostChain.MintDenom(), mintToken.Sub(protocolFee).Amount).String()), + sdktypes.NewAttribute(types.AttributePstakeDepositFee, + sdktypes.NewCoin(hostChain.MintDenom(), protocolFee.Amount).String()), ), sdktypes.NewEvent( sdktypes.EventTypeMessage, @@ -532,10 +536,14 @@ func (k msgServer) LiquidStakeLSM( ctx.EventManager().EmitEvents(sdktypes.Events{ sdktypes.NewEvent( types.EventTypeLiquidStakeLSM, + sdktypes.NewAttribute(types.AttributeChainID, hc.ChainId), sdktypes.NewAttribute(types.AttributeDelegatorAddress, delegator.String()), - sdktypes.NewAttribute(types.AttributeAmount, depositAmount.String()), - sdktypes.NewAttribute(types.AttributeAmountReceived, mintToken.Sub(protocolFee).String()), - sdktypes.NewAttribute(types.AttributePstakeDepositFee, protocolFee.String()), + sdktypes.NewAttribute(types.AttributeInputAmount, + sdktypes.NewCoin(hc.HostDenom, delegation.Amount).String()), + sdktypes.NewAttribute(types.AttributeOutputAmount, + sdktypes.NewCoin(hc.MintDenom(), mintToken.Sub(protocolFee).Amount).String()), + sdktypes.NewAttribute(types.AttributePstakeDepositFee, + sdktypes.NewCoin(hc.MintDenom(), protocolFee.Amount).String()), ), sdktypes.NewEvent( sdktypes.EventTypeMessage, @@ -649,11 +657,15 @@ func (k msgServer) LiquidUnstake( ctx.EventManager().EmitEvents(sdktypes.Events{ sdktypes.NewEvent( types.EventTypeLiquidUnstake, + sdktypes.NewAttribute(types.AttributeChainID, hc.ChainId), sdktypes.NewAttribute(types.AttributeDelegatorAddress, msg.GetDelegatorAddress()), - sdktypes.NewAttribute(types.AttributeAmountReceived, msg.Amount.String()), - sdktypes.NewAttribute(types.AttributePstakeUnstakeFee, feeAmount.String()), - sdktypes.NewAttribute(types.AttributeUnstakeAmount, unbondAmount.String()), - sdktypes.NewAttribute(types.AttributeUnstakeEpoch, strconv.FormatInt(unbondingEpoch, 10)), + sdktypes.NewAttribute(types.AttributeInputAmount, + sdktypes.NewCoin(hc.MintDenom(), msg.Amount.Amount).String()), + sdktypes.NewAttribute(types.AttributeOutputAmount, + sdktypes.NewCoin(hc.HostDenom, unbondAmount.Amount).String()), + sdktypes.NewAttribute(types.AttributePstakeUnstakeFee, + sdktypes.NewCoin(hc.MintDenom(), feeAmount).String()), + sdktypes.NewAttribute(types.AttributeEpoch, strconv.FormatInt(unbondingEpoch, 10)), ), sdktypes.NewEvent( sdktypes.EventTypeMessage, @@ -811,10 +823,19 @@ func (k msgServer) Redeem( ctx.EventManager().EmitEvents(sdktypes.Events{ sdktypes.NewEvent( types.EventTypeRedeem, + sdktypes.NewAttribute(types.AttributeChainID, hc.ChainId), sdktypes.NewAttribute(types.AttributeDelegatorAddress, redeemAddress.String()), - sdktypes.NewAttribute(types.AttributeAmount, msg.Amount.String()), - sdktypes.NewAttribute(types.AttributeAmountReceived, redeemToken.String()), - sdktypes.NewAttribute(types.AttributePstakeRedeemFee, fee.String()), + sdktypes.NewAttribute(types.AttributeInputAmount, + sdktypes.NewCoin(hc.MintDenom(), msg.Amount.Amount).String()), + sdktypes.NewAttribute(types.AttributeOutputAmount, + sdktypes.NewCoin(hc.HostDenom, redeemToken.Amount).String()), + sdktypes.NewAttribute(types.AttributePstakeRedeemFee, + sdktypes.NewCoin(hc.MintDenom(), fee.Amount).String()), + ), + sdktypes.NewEvent( + types.EventBurn, + sdktypes.NewAttribute(types.AttributeChainID, hc.ChainId), + sdktypes.NewAttribute(types.AttributeTotalEpochBurnAmount, sdktypes.NewCoin(hc.MintDenom(), stkAmount.Amount).String()), ), sdktypes.NewEvent( sdktypes.EventTypeMessage, diff --git a/x/liquidstakeibc/spec/README.md b/x/liquidstakeibc/spec/README.md index 526ac44ff..b6ac295d5 100644 --- a/x/liquidstakeibc/spec/README.md +++ b/x/liquidstakeibc/spec/README.md @@ -557,33 +557,48 @@ List of the events emitted by the module. |:-------------|:-------------------|:--------------------| | message | module | liquidstakeibc | | message | sender | {delegator_address} | +| liquid-stake | chain-id | {chain_id} | | liquid-stake | address | {delegator_address} | -| liquid-stake | amount | {staked_amount} | -| liquid-stake | received | {amount_received} | +| liquid-stake | input-amount | {staked_amount} | +| liquid-stake | output-amount | {amount_received} | | liquid-stake | pstake-deposit-fee | {deposit_fee} | +### LiquidStakeLSM + +| Type | Attribute Key | Attribute Value | +|:-----------------|:-------------------|:--------------------| +| message | module | liquidstakeibc | +| message | sender | {delegator_address} | +| liquid-stake-lsm | chain-id | {chain_id} | +| liquid-stake-lsm | address | {delegator_address} | +| liquid-stake-lsm | input-amount | {staked_amount} | +| liquid-stake-lsm | output-amount | {amount_received} | +| liquid-stake-lsm | pstake-deposit-fee | {deposit_fee} | + ### LiquidUnstake -| Type | Attribute Key | Attribute Value | -|:----------------|:--------------------|:---------------------| -| message | module | liquidstakeibc | -| message | sender | {delegator_address} | -| liquid-unstake | address | {delegator_address} | -| liquid-unstake | pstake-unstake-fee | {unstake_fee} | -| liquid-unstake | received | {amount_received} | -| liquid-unstake | undelegation-amount | {undelegated_amount} | -| liquid-unstake | undelegation-epoch | {undelegation_epoch} | +| Type | Attribute Key | Attribute Value | +|:---------------|:-------------------|:---------------------| +| message | module | liquidstakeibc | +| message | sender | {delegator_address} | +| liquid-unstake | chain-id | {chain_id} | +| liquid-unstake | address | {delegator_address} | +| liquid-unstake | input-amount | {amount_received} | +| liquid-unstake | output-amount | {undelegated_amount} | +| liquid-unstake | pstake-unstake-fee | {unstake_fee} | +| liquid-unstake | undelegation-epoch | {undelegation_epoch} | ### Redeem -| Type | Attribute Key | Attribute Value | -|:----------------|:-------------------|:--------------------| -| message | module | liquidstakeibc | -| message | sender | {delegator_address} | -| liquid-unstake | address | {delegator_address} | -| liquid-unstake | amount | {redeem_amount} | -| liquid-unstake | received | {amount_received} | -| liquid-unstake | pstake-redeem-fee | {redeem_fee} | +| Type | Attribute Key | Attribute Value | +|:--------|:------------------|:--------------------| +| message | module | liquidstakeibc | +| message | sender | {delegator_address} | +| redeem | chain-id | {chain_id} | +| redeem | address | {delegator_address} | +| redeem | input-amount | {redeem_amount} | +| redeem | output-amount | {amount_received} | +| redeem | pstake-redeem-fee | {redeem_fee} | ### UpdateParams diff --git a/x/liquidstakeibc/types/events.go b/x/liquidstakeibc/types/events.go index 0fc3d6cad..f3e19c944 100644 --- a/x/liquidstakeibc/types/events.go +++ b/x/liquidstakeibc/types/events.go @@ -1,34 +1,100 @@ package types const ( - EventTypeLiquidStake = "liquid-stake" - EventTypeLiquidStakeLSM = "liquid-stake-lsm" - EventTypeLiquidUnstake = "liquid-unstake" - EventTypeRedeem = "redeem" - EventTypePacket = "ics27_packet" - EventTypeTimeout = "timeout" - EventTypeSlashing = "slashing" - EventTypeUpdateParams = "update_params" - EventTypeChainDisabled = "chain_disabled" + EventTypeLiquidStake = "liquid_stake" + EventTypeLiquidStakeLSM = "liquid_stake_lsm" + EventTypeLiquidUnstake = "liquid_unstake" + EventTypeRedeem = "redeem" + EventTypePacket = "ics27_packet" + EventTypeTimeout = "timeout" + EventTypeSlashing = "validator_slash" + EventTypeUpdateParams = "update_params" + EventTypeChainDisabled = "chain_disabled" + EventTypeValidatorStatusUpdate = "validator_status_update" + 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" + EventTypeDelegationWorkflow = "delegation_workflow" + EventTypeUndelegationWorkflow = "undelegation_workflow" + EventTypeValidatorUndelegationWorkflow = "validator_undelegation_workflow" + EventTypeRewardsWorkflow = "rewards_workflow" + EventTypeLSMWorkflow = "lsm_workflow" + EventTypeRewardsTransfer = "rewards_transfer" + EventTypeUnbondingMaturedReceived = "unbonding_matured" + EventTypeValidatorUnbondingMaturedReceived = "validator_unbonding_matured" + EventAutocompoundRewardsReceived = "autocompound_rewards_received" + EventStakingDepositTransferReceived = "staking_deposit_received" + EventStakingDepositTransferTimeout = "staking_deposit_timeout" + EventLSMDepositTransferReceived = "lsm_deposit_received" + EventLSMDepositTransferTimeout = "lsm_deposit_timeout" + EventICAChannelCreated = "ica_channel_created" + EventSuccessfulDelegation = "successful_delegation" + EventSuccessfulUndelegation = "successful_undelegation" + EventBurn = "stk-burn" + EventSuccessfulUndelegationTransfer = "successful_undelegation_transfer" + EventSuccessfulValidatorUndelegationTransfer = "successful_validator_undelegation_transfer" + EventSuccessfulLSMRedeem = "successful_lsm_redeem" + EventUnsuccessfulDelegation = "unsuccessful_delegation" + EventUnsuccessfulUndelegation = "unsuccessful_undelegation" + EventUnsuccessfulUndelegationTransfer = "unsuccessful_undelegation_transfer" + EventUnsuccessfulValidatorUndelegationTransfer = "unsuccessful_validator_undelegation_transfer" + EventUnsuccessfulLSMRedeem = "unsuccessful_lsm_redeem" - AttributeAmount = "amount" - AttributeAmountReceived = "received" - AttributeDelegatorAddress = "address" - AttributePstakeDepositFee = "pstake-deposit-fee" - AttributePstakeUnstakeFee = "pstake-unstake-fee" - AttributePstakeRedeemFee = "pstake-redeem-fee" - AttributeChainID = "chain-id" - AttributeCValue = "c-value" - AttributeUnstakeAmount = "undelegation-amount" - AttributeUnstakeEpoch = "undelegation-epoch" - AttributeValidatorAddress = "validator-address" - AttributeExistingDelegation = "existing-delegation" - AttributeUpdatedDelegation = "updated-delegation" - AttributeSlashedAmount = "slashed-amount" - AttributeKeyAuthority = "authority" - AttributeKeyUpdatedParams = "updated_params" - AttributeKeyAck = "acknowledgement" - AttributeKeyAckSuccess = "success" - AttributeKeyAckError = "error" - AttributeValueCategory = ModuleName + AttributeInputAmount = "input_amount" + AttributeOutputAmount = "output_amount" + AttributeDelegatorAddress = "address" + AttributePstakeDepositFee = "pstake_deposit_fee" + AttributePstakeUnstakeFee = "pstake_unstake_fee" + AttributePstakeRedeemFee = "pstake_redeem_fee" + AttributePstakeAutocompoundFee = "autocompound_fee" + AttributeChainID = "chain_id" + AttributeNewCValue = "new_c_value" + AttributeOldCValue = "old_c_value" + AttributeEpoch = "epoch_number" + AttributeValidatorAddress = "validator_address" + AttributeExistingDelegation = "existing_delegation" + AttributeUpdatedDelegation = "updated_delegation" + AttributeSlashedAmount = "slashed_amount" + AttributeKeyAuthority = "authority" + AttributeKeyUpdatedParams = "updated_params" + AttributeKeyAck = "acknowledgement" + AttributeKeyAckSuccess = "success" + AttributeKeyAckError = "error" + AttributeKeyValidatorNewStatus = "validator_new_status" + AttributeKeyValidatorOldStatus = "validator_old_status" + AttributeKeyValidatorNewExchangeRate = "validator_new_exchange_rate" + AttributeKeyValidatorOldExchangeRate = "validator_old_exchange_rate" + AttributeKeyValidatorDelegable = "validator_delegable" + AttributeTotalDelegatedAmount = "total_delegated_amount" + AttributeIBCSequenceID = "ibc_sequence_id" + AttributeICAMessages = "ica_messages" + AttributeClaimAmount = "claimed_amount" + AttributeClaimAddress = "claim_address" + AttributeModuleMintedAmount = "minted_amount" + AttributeModuleLSMTokenizedAmount = "lsm_tokenized_amount" //nolint:gosec + AttributeModuleStakedAmount = "staked_amount" + AttributeModuleAmountOnPersistence = "amount_on_persistence" + AttributeModuleAmountOnHostChain = "amount_on_host_chain" + AttributeModuleUnbondingAmount = "unbonding_amount" + AttributeTotalEpochDepositAmount = "deposit_amount" + AttributeTotalEpochUnbondingAmount = "unbonding_amount" + AttributeTotalEpochBurnAmount = "burn_amount" + AttributeValidatorUnbondingAmount = "validator_unbonding_amount" + AttributeLSMDepositsSharesAmount = "lsm_deposits_shares_amount" + AttributeRewardsTransferAmount = "rewards_transfer_amount" + AttributeRewardsBalanceAmount = "rewards_balance_amount" + AttributeUnbondingMaturedAmount = "unbonding_matured_amount" + AttributeValidatorUnbondingMaturedAmount = "validator_unbonding_matured_amount" + AttributeAutocompoundTransfer = "autocompound_transfer_amount" + AttributeICAPortOwner = "ica_port_owner" + AttributeICAChannelID = "ica_channel_id" + AttributeICAAddress = "ica_address" + AttributeDelegatedAmount = "delegated_amount" + AttributeUndelegatedAmount = "undelegated_amount" + AttributeRedeemedAmount = "redeemed_amount" + AttributeValueCategory = ModuleName )