Skip to content

Commit 1760eff

Browse files
committed
refactor(mint): migrate types accordingly to cosmos-sdk v0.50.6
1 parent 2a98048 commit 1760eff

File tree

6 files changed

+16
-21
lines changed

6 files changed

+16
-21
lines changed

x/mint/module.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import (
55
"encoding/json"
66
"fmt"
77

8-
"cosmossdk.io/core/store"
9-
"cosmossdk.io/depinject"
10-
118
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
129

1310
modulev1 "cosmossdk.io/api/cosmos/mint/module/v1"
1411
"cosmossdk.io/core/appmodule"
12+
"cosmossdk.io/core/store"
13+
"cosmossdk.io/depinject"
1514

1615
"github.com/cosmos/cosmos-sdk/client"
1716
"github.com/cosmos/cosmos-sdk/codec"

x/mint/module_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/axone-protocol/axoned/v8/x/mint/testutil"
1212
"github.com/axone-protocol/axoned/v8/x/mint/types"
13+
1314
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
1415
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
1516
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

x/mint/testutil/app_config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package testutil
22

33
import (
4-
"github.com/cosmos/cosmos-sdk/testutil/configurator"
54
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
65
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring
76
_ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring
@@ -10,6 +9,8 @@ import (
109
_ "github.com/cosmos/cosmos-sdk/x/mint" // import as blank for app wiring
1110
_ "github.com/cosmos/cosmos-sdk/x/params" // import as blank for app wiring
1211
_ "github.com/cosmos/cosmos-sdk/x/staking" // import as blank for app wiring
12+
13+
"github.com/cosmos/cosmos-sdk/testutil/configurator"
1314
)
1415

1516
var AppConfig = configurator.NewAppConfig(

x/mint/types/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ func ValidateGenesis(data GenesisState) error {
2323
return err
2424
}
2525

26-
return data.Minter.Validate()
26+
return ValidateMinter(data.Minter)
2727
}

x/mint/types/keys.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package types
22

3-
// MinterKey is the key to use for the keeper store.
3+
import "cosmossdk.io/collections"
4+
45
var (
5-
MinterKey = []byte{0x00}
6-
ParamsKey = []byte{0x01}
6+
// MinterKey is the key to use for the keeper store.
7+
MinterKey = collections.NewPrefix(0)
8+
ParamsKey = collections.NewPrefix(1)
79
)
810

911
const (
@@ -12,12 +14,4 @@ const (
1214

1315
// StoreKey is the default store key for mint.
1416
StoreKey = ModuleName
15-
16-
// QuerierRoute is the querier route for the minting store.
17-
QuerierRoute = StoreKey
18-
19-
// Query endpoints supported by the minting querier.
20-
QueryParameters = "parameters"
21-
QueryInflation = "inflation"
22-
QueryAnnualProvisions = "annual_provisions"
2317
)

x/mint/types/minter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewMinterWithInflationCoef(
3737
}
3838
minter := NewMinter(inflationRate, inflationRate.MulInt(totalSupply))
3939

40-
return minter, minter.Validate()
40+
return minter, ValidateMinter(minter)
4141
}
4242

4343
// DefaultInitialMinter returns a default initial Minter object for a new chain
@@ -48,11 +48,11 @@ func DefaultInitialMinter() Minter {
4848
)
4949
}
5050

51-
// Validate validates the mint parameters.
52-
func (m Minter) Validate() error {
53-
if m.Inflation.IsNegative() {
51+
// ValidateMinter does a basic validation on minter.
52+
func ValidateMinter(minter Minter) error {
53+
if minter.Inflation.IsNegative() {
5454
return fmt.Errorf("mint parameter Inflation should be positive, is %s",
55-
m.Inflation.String())
55+
minter.Inflation.String())
5656
}
5757
return nil
5858
}

0 commit comments

Comments
 (0)