Skip to content

Commit

Permalink
new app structure (#81)
Browse files Browse the repository at this point in the history
* update readme with v0.11.0 upgrade details (#69)

* feat: add ica host module (#72)

* refactor app (#73)

* add keepers and keys in seperate directory

* refactor: refactor app (seperate keepers and modules)

* fix issues

* feat: add marketplace module as internal module (#74)

* feat: add marketplace module as internal module

* fix lint issues

* itc patch updates (#78)

* remove max claims check

* add claim count to campaign

* add upgrade handler for itc-patch

* fix: end fully claimed campaigns

* Revert "add upgrade handler for itc-patch"

This reverts commit 2eced93.
  • Loading branch information
harish551 authored Aug 4, 2023
1 parent c3c0a9d commit 5e46ae2
Show file tree
Hide file tree
Showing 74 changed files with 22,666 additions and 1,153 deletions.
722 changes: 107 additions & 615 deletions app/app.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
type KeeperTestHelper struct {
suite.Suite

App *app.App
App *app.OmniFlixApp
Ctx sdk.Context
QueryHelper *baseapp.QueryServiceTestHelper
TestAccs []sdk.AccAddress
Expand Down
41 changes: 21 additions & 20 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// ExportAppStateAndValidators exports the state of the application for a genesis
// file.
func (app *App) ExportAppStateAndValidators(
func (app *OmniFlixApp) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string,
) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
Expand Down Expand Up @@ -51,10 +51,10 @@ func (app *App) ExportAppStateAndValidators(
// NOTE zero height genesis is a temporary feature which will be deprecated
//
// in favour of export at a block height
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
func (app *OmniFlixApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false

// check if there is a allowed address list
// check if there is an allowed address list
if len(jailAllowedAddrs) > 0 {
applyAllowedAddrs = true
}
Expand Down Expand Up @@ -145,27 +145,28 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str

// Iterate through validators by power descending, reset bond heights, and
// update bond intra-tx counters.
store := ctx.KVStore(app.keys[stakingtypes.StoreKey])
store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
counter := int16(0)

for ; iter.Valid(); iter.Next() {
addr := sdk.ValAddress(iter.Key()[1:])
validator, found := app.StakingKeeper.GetValidator(ctx, addr)
if !found {
panic("expected validator, not found")
func() {
defer iter.Close()
for ; iter.Valid(); iter.Next() {
addr := sdk.ValAddress(iter.Key()[1:])
validator, found := app.StakingKeeper.GetValidator(ctx, addr)
if !found {
panic("expected validator, not found")
}

validator.UnbondingHeight = 0
if applyAllowedAddrs && !allowedAddrsMap[addr.String()] {
validator.Jailed = true
}

app.StakingKeeper.SetValidator(ctx, validator)
counter++
}

validator.UnbondingHeight = 0
if applyAllowedAddrs && !allowedAddrsMap[addr.String()] {
validator.Jailed = true
}

app.StakingKeeper.SetValidator(ctx, validator)
counter++
}

iter.Close()
}()

if _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx); err != nil {
panic(err)
Expand Down
15 changes: 15 additions & 0 deletions app/forks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package app

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// BeginBlockForks is intended to be run in a chain upgrade.
func BeginBlockForks(ctx sdk.Context, app *OmniFlixApp) {
for _, fork := range Forks {
if ctx.BlockHeight() == fork.UpgradeHeight {
fork.BeginForkLogic(ctx, &app.AppKeepers)
return
}
}
}
Loading

0 comments on commit 5e46ae2

Please sign in to comment.