Skip to content

Commit

Permalink
fixed nil SystemInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
olimdzhon committed Jul 26, 2024
1 parent 23d9125 commit 5581d75
Show file tree
Hide file tree
Showing 19 changed files with 94 additions and 113 deletions.
52 changes: 26 additions & 26 deletions api/checkers/checkers/genesis.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions api/checkers/checkers/module/module.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions api/checkers/checkers/params.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions api/checkers/checkers/query.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/checkers/checkers/query_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions api/checkers/checkers/stored_game.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions api/checkers/checkers/system_info.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions api/checkers/checkers/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/checkers/checkers/tx_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions x/checkers/module/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import (
// InitGenesis initializes the module's state from a provided genesis state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
// Set if defined
if genState.SystemInfo != nil {
k.SetSystemInfo(ctx, *genState.SystemInfo)
}
k.SetSystemInfo(ctx, genState.SystemInfo)

// Set all the storedGame
for _, elem := range genState.StoredGameList {
k.SetStoredGame(ctx, elem)
Expand All @@ -31,7 +30,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
// Get all systemInfo
systemInfo, found := k.GetSystemInfo(ctx)
if found {
genesis.SystemInfo = &systemInfo
genesis.SystemInfo = systemInfo
}
genesis.StoredGameList = k.GetAllStoredGame(ctx)
// this line is used by starport scaffolding # genesis/module/export
Expand Down
2 changes: 1 addition & 1 deletion x/checkers/module/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestGenesis(t *testing.T) {
genesisState := types.GenesisState{
Params: types.DefaultParams(),

SystemInfo: &types.SystemInfo{
SystemInfo: types.SystemInfo{
NextId: 67,
},
StoredGameList: []types.StoredGame{
Expand Down
4 changes: 3 additions & 1 deletion x/checkers/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const DefaultIndex uint64 = 1
// DefaultGenesis returns the default genesis state
func DefaultGenesis() *GenesisState {
return &GenesisState{
SystemInfo: nil,
SystemInfo: SystemInfo{
NextId: uint64(DefaultIndex),
},
StoredGameList: []StoredGame{},
// this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(),
Expand Down
61 changes: 27 additions & 34 deletions x/checkers/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/checkers/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestGenesisState_Validate(t *testing.T) {
desc: "valid genesis state",
genState: &types.GenesisState{

SystemInfo: &types.SystemInfo{
SystemInfo: types.SystemInfo{
NextId: 100,
},
StoredGameList: []types.StoredGame{
Expand Down
Loading

0 comments on commit 5581d75

Please sign in to comment.