Skip to content

Commit

Permalink
feat: add inflation events detailed distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasmatt committed Dec 6, 2023
1 parent cf8bea5 commit 4fdff12
Show file tree
Hide file tree
Showing 3 changed files with 470 additions and 0 deletions.
26 changes: 26 additions & 0 deletions proto/nibiru/inflation/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";
package nibiru.inflation.v1;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/NibiruChain/nibiru/x/inflation/types";

// Emitted when inflation is distributed
message InflationDistributionEvent {
cosmos.base.v1beta1.Coin staking_rewards = 1 [
(gogoproto.moretags) = "yaml:\"staking_rewards\"",
(gogoproto.nullable)= false
];

cosmos.base.v1beta1.Coin strategic_reserve = 2 [
(gogoproto.moretags) = "yaml:\"strategic_reserve\"",
(gogoproto.nullable)= false
];

cosmos.base.v1beta1.Coin community_pool = 3 [
(gogoproto.moretags) = "yaml:\"community_pool\"",
(gogoproto.nullable)= false
];

}
8 changes: 8 additions & 0 deletions x/inflation/keeper/inflation.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ func (k Keeper) AllocatePolynomialInflation(
return sdk.Coin{}, sdk.Coin{}, sdk.Coin{}, nil
}

_ = ctx.EventManager().EmitTypedEvents(
&types.InflationDistributionEvent{
StakingRewards: staking,
StrategicReserve: strategic,
CommunityPool: community,
},
)

return staking, strategic, community, nil
}

Expand Down
Loading

0 comments on commit 4fdff12

Please sign in to comment.