From 1aba71afbee9ffa672c63c4051669352f6ad21b7 Mon Sep 17 00:00:00 2001 From: zale144 Date: Sun, 27 Oct 2024 10:25:52 +0100 Subject: [PATCH] fix(iro): use sdk-utils typed events in IRO (#1353) --- x/iro/keeper/claim.go | 3 ++- x/iro/keeper/create_plan.go | 4 ++-- x/iro/keeper/settle.go | 5 +++-- x/iro/keeper/trade.go | 8 +++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/x/iro/keeper/claim.go b/x/iro/keeper/claim.go index 6560e03c6..19bd2ee4a 100644 --- a/x/iro/keeper/claim.go +++ b/x/iro/keeper/claim.go @@ -4,6 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/sdk-utils/utils/uevent" "github.com/dymensionxyz/dymension/v3/x/iro/types" ) @@ -59,7 +60,7 @@ func (k Keeper) Claim(ctx sdk.Context, planId string, claimer sdk.AccAddress) er k.SetPlan(ctx, plan) // Emit event - err = ctx.EventManager().EmitTypedEvent(&types.EventClaim{ + err = uevent.EmitTypedEvent(ctx, &types.EventClaim{ Claimer: claimer.String(), PlanId: planId, RollappId: plan.RollappId, diff --git a/x/iro/keeper/create_plan.go b/x/iro/keeper/create_plan.go index ef3e41298..091fbda1e 100644 --- a/x/iro/keeper/create_plan.go +++ b/x/iro/keeper/create_plan.go @@ -12,8 +12,8 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/dymensionxyz/gerr-cosmos/gerrc" + "github.com/dymensionxyz/sdk-utils/utils/uevent" appparams "github.com/dymensionxyz/dymension/v3/app/params" "github.com/dymensionxyz/dymension/v3/x/iro/types" @@ -138,7 +138,7 @@ func (k Keeper) CreatePlan(ctx sdk.Context, allocatedAmount math.Int, start, pre k.SetPlan(ctx, plan) // Emit event - err = ctx.EventManager().EmitTypedEvent(&types.EventNewIROPlan{ + err = uevent.EmitTypedEvent(ctx, &types.EventNewIROPlan{ Creator: rollapp.Owner, PlanId: fmt.Sprintf("%d", plan.Id), RollappId: rollapp.RollappId, diff --git a/x/iro/keeper/settle.go b/x/iro/keeper/settle.go index d16fd8813..995986016 100644 --- a/x/iro/keeper/settle.go +++ b/x/iro/keeper/settle.go @@ -8,7 +8,8 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dymensionxyz/gerr-cosmos/gerrc" - balancer "github.com/osmosis-labs/osmosis/v15/x/gamm/pool-models/balancer" + "github.com/dymensionxyz/sdk-utils/utils/uevent" + "github.com/osmosis-labs/osmosis/v15/x/gamm/pool-models/balancer" gammtypes "github.com/osmosis-labs/osmosis/v15/x/gamm/types" appparams "github.com/dymensionxyz/dymension/v3/app/params" @@ -64,7 +65,7 @@ func (k Keeper) Settle(ctx sdk.Context, rollappId, rollappIBCDenom string) error } // Emit event - err = ctx.EventManager().EmitTypedEvent(&types.EventSettle{ + err = uevent.EmitTypedEvent(ctx, &types.EventSettle{ PlanId: fmt.Sprintf("%d", plan.Id), RollappId: rollappId, IBCDenom: rollappIBCDenom, diff --git a/x/iro/keeper/trade.go b/x/iro/keeper/trade.go index 03be14053..f56bef5d8 100644 --- a/x/iro/keeper/trade.go +++ b/x/iro/keeper/trade.go @@ -10,6 +10,8 @@ import ( txfeestypes "github.com/osmosis-labs/osmosis/v15/x/txfees/types" + "github.com/dymensionxyz/sdk-utils/utils/uevent" + appparams "github.com/dymensionxyz/dymension/v3/app/params" "github.com/dymensionxyz/dymension/v3/x/iro/types" ) @@ -107,7 +109,7 @@ func (k Keeper) Buy(ctx sdk.Context, planId string, buyer sdk.AccAddress, amount k.SetPlan(ctx, *plan) // Emit event - err = ctx.EventManager().EmitTypedEvent(&types.EventBuy{ + err = uevent.EmitTypedEvent(ctx, &types.EventBuy{ Buyer: buyer.String(), PlanId: planId, RollappId: plan.RollappId, @@ -176,7 +178,7 @@ func (k Keeper) BuyExactSpend(ctx sdk.Context, planId string, buyer sdk.AccAddre k.SetPlan(ctx, *plan) // Emit event - err = ctx.EventManager().EmitTypedEvent(&types.EventBuy{ + err = uevent.EmitTypedEvent(ctx, &types.EventBuy{ Buyer: buyer.String(), PlanId: planId, RollappId: plan.RollappId, @@ -235,7 +237,7 @@ func (k Keeper) Sell(ctx sdk.Context, planId string, seller sdk.AccAddress, amou k.SetPlan(ctx, *plan) // Emit event - err = ctx.EventManager().EmitTypedEvent(&types.EventSell{ + err = uevent.EmitTypedEvent(ctx, &types.EventSell{ Seller: seller.String(), PlanId: planId, RollappId: plan.RollappId,