-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade token factory to 0.47sdk
- Loading branch information
Showing
19 changed files
with
653 additions
and
104 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 exported | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" | ||
) | ||
|
||
// GenesisBalance defines a genesis balance interface that allows for account | ||
// address and balance retrieval. | ||
type GenesisBalance interface { | ||
GetAddress() sdk.AccAddress | ||
GetCoins() sdk.Coins | ||
} | ||
|
||
type ( | ||
ParamSet = paramtypes.ParamSet | ||
|
||
// Subspace defines an interface that implements the legacy x/params Subspace | ||
// type. | ||
// | ||
// NOTE: This is used solely for migration of x/params managed parameters. | ||
Subspace interface { | ||
GetParamSetIfExists(ctx sdk.Context, ps ParamSet) | ||
SetParamSet(ctx sdk.Context, ps ParamSet) | ||
} | ||
) |
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
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
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
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,32 @@ | ||
package v3 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/terra-money/core/v2/x/tokenfactory/exported" | ||
"github.com/terra-money/core/v2/x/tokenfactory/types" | ||
) | ||
|
||
// MigrateStore migrates the x/tokenfactory module state from the consensus version 2 to | ||
// version 3. Specifically, it takes the parameters that are currently stored | ||
// and managed by the x/params module and stores them directly into the x/tokenfactory | ||
// module state. | ||
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error { | ||
store := ctx.KVStore(storeKey) | ||
var currParams types.Params | ||
legacySubspace.GetParamSetIfExists(ctx, &currParams) | ||
|
||
if err := currParams.Validate(); err != nil { | ||
return err | ||
} | ||
|
||
bz, err := cdc.Marshal(&currParams) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
store.Set(types.ParamsKey, bz) | ||
|
||
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
Oops, something went wrong.