-
Notifications
You must be signed in to change notification settings - Fork 172
/
migrate.go
39 lines (31 loc) · 988 Bytes
/
migrate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package v2
import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/CosmosContracts/juno/v22/x/tokenfactory/exported"
"github.com/CosmosContracts/juno/v22/x/tokenfactory/types"
)
const ModuleName = "tokenfactory"
var ParamsKey = []byte{0x00}
// Migrate migrates the x/tokenfactory module state from the consensus version 1 to
// version 2. Specifically, it takes the parameters that are currently stored
// and managed by the x/params modules and stores them directly into the x/tokenfactory
// module state.
func Migrate(
_ sdk.Context,
store sdk.KVStore,
_ exported.Subspace,
cdc codec.BinaryCodec,
) error {
// Migrates mainnet params -> the new keeper params storeKey (from x/params)
currParams := types.Params{
DenomCreationFee: nil,
DenomCreationGasConsume: 2_000_000,
}
if err := currParams.Validate(); err != nil {
return err
}
bz := cdc.MustMarshal(&currParams)
store.Set(ParamsKey, bz)
return nil
}