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

refactor(x/mint): remove unused parameter from AfterDistributeMintedCoin (backport #2390) #2396

Merged
merged 1 commit into from
Aug 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion x/mint/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion x/mint/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
}

Expand Down
8 changes: 5 additions & 3 deletions x/mint/types/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

type MintHooks interface {
AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin)
AfterDistributeMintedCoin(ctx sdk.Context)
}

var _ MintHooks = MultiMintHooks{}
Expand All @@ -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)
}
}
2 changes: 1 addition & 1 deletion x/pool-incentives/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down