From bd4174096d19c5658c3ff8ad94a1d189241f7690 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 19:06:19 -0700 Subject: [PATCH] refactor(x/mint): remove unused parameter from AfterDistributeMintedCoin (backport #2390) (#2396) Co-authored-by: Roman --- CHANGELOG.md | 1 + x/mint/keeper/keeper.go | 2 +- x/mint/keeper/keeper_test.go | 2 +- x/mint/types/hooks.go | 8 +++++--- x/pool-incentives/keeper/hooks.go | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c02b1b1b13..c0a1bd94c45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #### Golang API breaks * [#1893](https://github.com/osmosis-labs/osmosis/pull/1893) Change `EpochsKeeper.SetEpochInfo` to `AddEpochInfo`, which has more safety checks with it. (Makes it suitable to be called within upgrades) +* [#2396](https://github.com/osmosis-labs/osmosis/pull/2396) x/mint remove unused mintCoins parameter from AfterDistributeMintedCoin #### Bug Fixes * [2291](https://github.com/osmosis-labs/osmosis/pull/2291) Remove liquidity event that was emitted twice per message. diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index 00f3c96124c..d7ac03165b4 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -229,7 +229,7 @@ func (k Keeper) DistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) error } // call an hook after the minting and distribution of new coins - k.hooks.AfterDistributeMintedCoin(ctx, mintedCoin) + k.hooks.AfterDistributeMintedCoin(ctx) return err } diff --git a/x/mint/keeper/keeper_test.go b/x/mint/keeper/keeper_test.go index eba60140176..2cf119d4343 100644 --- a/x/mint/keeper/keeper_test.go +++ b/x/mint/keeper/keeper_test.go @@ -29,7 +29,7 @@ type mintHooksMock struct { hookCallCount int } -func (hm *mintHooksMock) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { +func (hm *mintHooksMock) AfterDistributeMintedCoin(ctx sdk.Context) { hm.hookCallCount++ } diff --git a/x/mint/types/hooks.go b/x/mint/types/hooks.go index ff2b3c3d4d1..43af238a53c 100644 --- a/x/mint/types/hooks.go +++ b/x/mint/types/hooks.go @@ -5,7 +5,7 @@ import ( ) type MintHooks interface { - AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) + AfterDistributeMintedCoin(ctx sdk.Context) } var _ MintHooks = MultiMintHooks{} @@ -17,8 +17,10 @@ func NewMultiMintHooks(hooks ...MintHooks) MultiMintHooks { return hooks } -func (h MultiMintHooks) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { +// AfterDistributeMintedCoin is a hook that runs after minter mints and distributes coins +// at the beginning of each epoch. +func (h MultiMintHooks) AfterDistributeMintedCoin(ctx sdk.Context) { for i := range h { - h[i].AfterDistributeMintedCoin(ctx, mintedCoin) + h[i].AfterDistributeMintedCoin(ctx) } } diff --git a/x/pool-incentives/keeper/hooks.go b/x/pool-incentives/keeper/hooks.go index a2a858d217c..70d84b5945c 100644 --- a/x/pool-incentives/keeper/hooks.go +++ b/x/pool-incentives/keeper/hooks.go @@ -36,7 +36,7 @@ func (h Hooks) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, } // Distribute coins after minter module allocate assets to pool-incentives module. -func (h Hooks) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { +func (h Hooks) AfterDistributeMintedCoin(ctx sdk.Context) { // @Sunny, @Tony, @Dev, what comments should we keep after modifying own BeginBlocker to hooks? // WARNING: The order of how modules interact with the default distribution module matters if the distribution module is used in a similar way to: