-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* migration fixes * reducing upgrade height
- Loading branch information
Showing
6 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package migrations | ||
|
||
import ( | ||
"github.com/elys-network/elys/x/accountedpool/keeper" | ||
) | ||
|
||
type Migrator struct { | ||
keeper keeper.Keeper | ||
} | ||
|
||
func NewMigrator(keeper keeper.Keeper) Migrator { | ||
return Migrator{keeper: keeper} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package migrations | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
func (m Migrator) V2Migration(ctx sdk.Context) error { | ||
allAccountedPool := m.keeper.GetAllAccountedPool(ctx) | ||
for _, accountedPool := range allAccountedPool { | ||
m.keeper.RemoveAccountedPool(ctx, accountedPool.PoolId) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package migrations | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
func (m Migrator) V16Migration(ctx sdk.Context) error { | ||
allPools := m.keeper.GetAllPools(ctx) | ||
|
||
for _, pool := range allPools { | ||
hooks := m.keeper.GetHooks() | ||
|
||
if hooks != nil { | ||
ammPool, err := m.keeper.GetAmmPool(ctx, pool.AmmPoolId) | ||
if err != nil { | ||
return err | ||
} | ||
err = hooks.AfterEnablingPool(ctx, ammPool) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters