Skip to content

Commit

Permalink
Merge branch 'release/v7.1' into feature/tx-ante
Browse files Browse the repository at this point in the history
  • Loading branch information
faneaatiku authored Aug 19, 2024
2 parents 540778e + f6ea5b9 commit 8c2e38e
Show file tree
Hide file tree
Showing 81 changed files with 10,640 additions and 777 deletions.
70 changes: 27 additions & 43 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

import (
"github.com/bze-alphateam/bze/app/openapi"
v700 "github.com/bze-alphateam/bze/app/upgrades/v700"
v710 "github.com/bze-alphateam/bze/app/upgrades/v710"
"github.com/bze-alphateam/bze/x/epochs"
epochskeeper "github.com/bze-alphateam/bze/x/epochs/keeper"
epochstypes "github.com/bze-alphateam/bze/x/epochs/types"
Expand Down Expand Up @@ -32,7 +32,6 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
Expand Down Expand Up @@ -189,20 +188,21 @@ var (

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
scavengemoduletypes.ModuleName: nil,
cointrunkmoduletypes.ModuleName: nil,
burnermoduletypes.ModuleName: {authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
tradebintypes.ModuleName: nil,
epochstypes.ModuleName: nil,
rewardstypes.ModuleName: {authtypes.Burner},
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
scavengemoduletypes.ModuleName: nil,
cointrunkmoduletypes.ModuleName: nil,
burnermoduletypes.ModuleName: {authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
tradebintypes.ModuleName: nil,
epochstypes.ModuleName: nil,
rewardstypes.ModuleName: {authtypes.Burner},
burnermoduletypes.RaffleModuleName: {authtypes.Burner},
// this line is used by starport scaffolding # stargate/app/maccPerms
}

Expand Down Expand Up @@ -424,6 +424,12 @@ func New(
app.BankKeeper,
)

app.EpochsKeeper = *epochskeeper.NewKeeper(
appCodec,
keys[epochstypes.StoreKey],
keys[epochstypes.MemStoreKey],
)

app.CointrunkKeeper = *cointrunkmodulekeeper.NewKeeper(
appCodec,
keys[cointrunkmoduletypes.StoreKey],
Expand All @@ -442,6 +448,7 @@ func New(
app.GetSubspace(burnermoduletypes.ModuleName),
app.BankKeeper,
app.AccountKeeper,
app.EpochsKeeper,
)

app.TokenFactoryKeeper = *tokenfactorykeeper.NewKeeper(
Expand All @@ -463,12 +470,6 @@ func New(
app.DistrKeeper,
)

app.EpochsKeeper = *epochskeeper.NewKeeper(
appCodec,
keys[epochstypes.StoreKey],
keys[epochstypes.MemStoreKey],
)

app.RewardsKeeper = *rewardskeeper.NewKeeper(
appCodec,
keys[rewardstypes.StoreKey],
Expand All @@ -492,6 +493,7 @@ func New(
app.RewardsKeeper.GetUnlockPendingUnlockParticipantsHook(),
app.RewardsKeeper.GetRemoveExpiredPendingTradingRewardsHook(),
app.RewardsKeeper.GetTradingRewardsDistributionHook(),
app.BurnerKeeper.GetBurnerRaffleCleanupHook(),
},
)

Expand Down Expand Up @@ -708,27 +710,9 @@ func New(

func (app *App) setupUpgradeHandlers(cfg module.Configurator) {
app.UpgradeKeeper.SetUpgradeHandler(
v700.UpgradeName,
v700.CreateUpgradeHandler(cfg, app.mm),
v710.UpgradeName,
v710.CreateUpgradeHandler(cfg, app.mm),
)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}

if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
return
}

if upgradeInfo.Name == v700.UpgradeName {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{tokenfactorytypes.StoreKey, tradebintypes.StoreKey, epochstypes.StoreKey, rewardstypes.StoreKey},
}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}

// Name returns the name of the App
Expand Down Expand Up @@ -842,7 +826,7 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// register app's OpenAPI routes.
if apiConfig.Swagger {
if apiConfig.Swagger || true {
apiSvr.Router.Handle("/static/openapi.yml", http.FileServer(http.FS(docs.Docs)))
apiSvr.Router.HandleFunc("/", openapi.Handler(Name, "/static/openapi.yml"))
}
Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/v710/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v710

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

const UpgradeName = "v7.1.0"

func CreateUpgradeHandler(
cfg module.Configurator,
mm *module.Manager,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, cfg, vm)
}
}
Loading

0 comments on commit 8c2e38e

Please sign in to comment.