Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: events #136

Merged
merged 13 commits into from
Nov 22, 2024
Merged

feat: events #136

merged 13 commits into from
Nov 22, 2024

Conversation

kimurayu45z
Copy link
Contributor

@kimurayu45z kimurayu45z commented Nov 12, 2024

close #131

Overview

@Senna46
Copy link
Contributor

Senna46 commented Nov 15, 2024

@kimurayu45z
I changed some proto code and implement to trigget events.
Plz review

@@ -57,5 +57,12 @@ func (k Keeper) BurnAndMint(ctx context.Context, amount math.Int, address sdk.Ac
return err
}

if err := sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventBurnAndMint{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EventConvertでいいかも

@@ -133,6 +142,10 @@ func (k Keeper) RemovePosition(ctx context.Context, id uint64) {
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PositionKey))
store.Delete(GetPositionIDBytes(id))

_ = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventRemovePosition{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DB操作に関するigniteに自動生成された関数はイベントなしでいいわ

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Txに絡めてイベント発火したいってこと?細かく出すならDBで出した方がいいと思うが

@Senna46 Senna46 changed the title [WIP]feat: events feat: events Nov 18, 2024
@@ -45,6 +45,14 @@ func (k Keeper) AppendPosition(ctx context.Context, position types.Position) uin
// Set the ID of the appended value
position.Id = count
k.SetPosition(ctx, position)
_ = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventSetPosition{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppendXXXもIgnite自動生成のdb関数だからイベントなしで

uint64 pool_id = 1;
}

message EventSetPosition {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setは内部処理の単語なのでCreate, Updateという単語を使いたい

@kimurayu45z kimurayu45z merged commit 501e350 into main Nov 22, 2024
1 check passed
@kimurayu45z kimurayu45z deleted the event branch November 22, 2024 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EmitTypedEvent
2 participants