Skip to content

Commit

Permalink
add events
Browse files Browse the repository at this point in the history
  • Loading branch information
kruspy committed Jan 8, 2024
1 parent f5ed1c5 commit e8cc0c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions x/liquidstakeibc/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,15 @@ func (k *Keeper) UndelegationWorkflow(ctx sdk.Context, epoch int64) {
unbonding.State = liquidstakeibctypes.Unbonding_UNBONDING_FAILED
k.SetUnbonding(ctx, unbonding)

// emit an event for the undelegation confirmation
ctx.EventManager().EmitEvent(
sdk.NewEvent(
liquidstakeibctypes.EventUnsuccessfulUndelegationInitiation,
sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId),
sdk.NewAttribute(liquidstakeibctypes.AttributeEpoch, strconv.FormatInt(epoch, 10)),
),
)

continue
}

Expand All @@ -647,6 +656,15 @@ func (k *Keeper) UndelegationWorkflow(ctx sdk.Context, epoch int64) {
unbonding.State = liquidstakeibctypes.Unbonding_UNBONDING_FAILED
k.SetUnbonding(ctx, unbonding)

// emit an event for the undelegation confirmation
ctx.EventManager().EmitEvent(
sdk.NewEvent(
liquidstakeibctypes.EventUnsuccessfulUndelegationInitiation,
sdk.NewAttribute(liquidstakeibctypes.AttributeChainID, hc.ChainId),
sdk.NewAttribute(liquidstakeibctypes.AttributeEpoch, strconv.FormatInt(epoch, 10)),
),
)

continue
}

Expand Down
1 change: 1 addition & 0 deletions x/liquidstakeibc/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
EventSuccessfulRedelegation = "successful_redelegation"
EventUnsuccessfulDelegation = "unsuccessful_delegation"
EventUnsuccessfulUndelegation = "unsuccessful_undelegation"
EventUnsuccessfulUndelegationInitiation = "unsuccessful_undelegation_initiation"
EventUnsuccessfulUndelegationTransfer = "unsuccessful_undelegation_transfer"
EventUnsuccessfulValidatorUndelegationTransfer = "unsuccessful_validator_undelegation_transfer"
EventUnsuccessfulLSMRedeem = "unsuccessful_lsm_redeem"
Expand Down

0 comments on commit e8cc0c9

Please sign in to comment.