Skip to content

Commit

Permalink
fix(iro): use sdk-utils typed events in IRO (#1353)
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 authored Oct 27, 2024
1 parent 600e3c8 commit 1aba71a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion x/iro/keeper/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions x/iro/keeper/create_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions x/iro/keeper/settle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions x/iro/keeper/trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1aba71a

Please sign in to comment.