Skip to content

Commit

Permalink
refactor(x/mint): remove SetInitialSupplyOffsetDuringMigration keeper…
Browse files Browse the repository at this point in the history
… method (#2418)

* refactor(x/mint): remove SetInitialSupplyOffsetDuringMigration keeper function

* changelog

* resolve merge conflict

(cherry picked from commit 3d7d48c)

# Conflicts:
#	CHANGELOG.md
#	x/mint/keeper/keeper_test.go
  • Loading branch information
p0mvn authored and mergify[bot] committed Aug 19, 2022
1 parent a76095d commit 41f86ce
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ This release contains minor CLI bug fixes.
* [#1671](https://github.com/osmosis-labs/osmosis/pull/1671) Add hourly epochs to `x/epochs` DefaultGenesis.
* [#1665](https://github.com/osmosis-labs/osmosis/pull/1665) Delete app/App interface, instead use simapp.App
* [#1630](https://github.com/osmosis-labs/osmosis/pull/1630) Delete the v043_temp module, now that we're on an updated SDK version.
<<<<<<< HEAD
=======
* [#1667](https://github.com/osmosis-labs/osmosis/pull/1673) Move wasm-bindings code out of app package into its own root level package.
* [#2013](https://github.com/osmosis-labs/osmosis/pull/2013) Make `SetParams`, `SetPool`, `SetTotalLiquidity`, and `SetDenomLiquidity` GAMM APIs private
* [#1857](https://github.com/osmosis-labs/osmosis/pull/1857) x/mint rename GetLastHalvenEpochNum to GetLastReductionEpochNum
* [#2394](https://github.com/osmosis-labs/osmosis/pull/2394) Remove unused interface methods from expected keepers of each module
* [#2390](https://github.com/osmosis-labs/osmosis/pull/2390) x/mint remove unused mintCoins parameter from AfterDistributeMintedCoin
* [#2418](https://github.com/osmosis-labs/osmosis/pull/2418) x/mint remove SetInitialSupplyOffsetDuringMigration from keeper
* [#2417](https://github.com/osmosis-labs/osmosis/pull/2417) x/mint unexport keeper `SetLastReductionEpochNum`, `getLastReductionEpochNum`, `CreateDeveloperVestingModuleAccount`, and `MintCoins`

### Features

* [#2387](https://github.com/osmosis-labs/osmosis/pull/2387) Upgrade to IBC v3.2.0, which allows for sending/receiving IBC tokens with slashes.
* [#2057](https://github.com/osmosis-labs/osmosis/pull/2057) Reduce block times to about three seconds
* [#1312] Stableswap: Createpool logic
* [#1230] Stableswap CFMM equations
* [#1429] solver for multi-asset CFMM
* [#1539] Superfluid: Combine superfluid and staking query on querying delegation by delegator
* [#2223] Tokenfactory: Add SetMetadata functionality
>>>>>>> 3d7d48c8 (refactor(x/mint): remove SetInitialSupplyOffsetDuringMigration keeper method (#2418))
### Bug Fixes

Expand Down
10 changes: 6 additions & 4 deletions app/upgrades/v7/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ func CreateUpgradeHandler(
}
keepers.SuperfluidKeeper.AddNewSuperfluidAsset(ctx, superfluidAsset)

// Set the supply offset from the developer vesting account
if err := keepers.MintKeeper.SetInitialSupplyOffsetDuringMigration(ctx); err != nil {
panic(err)
}
// N.B.: This is left for historic reasons.
// After the v7 upgrade, there was no need for this function anymore so it was removed.
// // Set the supply offset from the developer vesting account
// if err := keepers.MintKeeper.SetInitialSupplyOffsetDuringMigration(ctx); err != nil {
// panic(err)
// }

return newVM, err
}
Expand Down
17 changes: 0 additions & 17 deletions x/mint/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,6 @@ func NewKeeper(
}
}

// SetInitialSupplyOffsetDuringMigration sets the supply offset based on the balance of the
// developer vesting module account. CreateDeveloperVestingModuleAccount must be called
// prior to calling this method. That is, developer vesting module account must exist when
// SetInitialSupplyOffsetDuringMigration is called. Also, SetInitialSupplyOffsetDuringMigration
// should only be called one time during the initial migration to v7. This is done so because
// we would like to ensure that unvested developer tokens are not returned as part of the supply
// queries. The method returns an error if current height in ctx is greater than the v7 upgrade height.
func (k Keeper) SetInitialSupplyOffsetDuringMigration(ctx sdk.Context) error {
if !k.accountKeeper.HasAccount(ctx, k.accountKeeper.GetModuleAddress(types.DeveloperVestingModuleAcctName)) {
return sdkerrors.Wrapf(types.ErrModuleDoesnotExist, "%s vesting module account doesnot exist", types.DeveloperVestingModuleAcctName)
}

moduleAccBalance := k.bankKeeper.GetBalance(ctx, k.accountKeeper.GetModuleAddress(types.DeveloperVestingModuleAcctName), k.GetParams(ctx).MintDenom)
k.bankKeeper.AddSupplyOffset(ctx, moduleAccBalance.Denom, moduleAccBalance.Amount.Neg())
return nil
}

// Logger returns a module-specific logger.
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+types.ModuleName)
Expand Down
3 changes: 3 additions & 0 deletions x/mint/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ func (suite *KeeperTestSuite) TestCreateDeveloperVestingModuleAccount() {
}
}

<<<<<<< HEAD
func (suite *KeeperTestSuite) TestSetInitialSupplyOffsetDuringMigration() {
testcases := map[string]struct {
blockHeight int64
Expand Down Expand Up @@ -360,6 +361,8 @@ func (suite *KeeperTestSuite) TestSetInitialSupplyOffsetDuringMigration() {
}
}

=======
>>>>>>> 3d7d48c8 (refactor(x/mint): remove SetInitialSupplyOffsetDuringMigration keeper method (#2418))
// TestDistributeToModule tests that distribution from mint module to another module helper
// function is working as expected.
func (suite *KeeperTestSuite) TestDistributeToModule() {
Expand Down

0 comments on commit 41f86ce

Please sign in to comment.