Skip to content

Commit

Permalink
multiplayer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsingh33 committed Feb 15, 2024
1 parent a7cd99c commit b31efe0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions x/common/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,25 @@ func (k Keeper) SinglePlayer(ctx sdk.Context, contractAddress string, ResolveSin
logger := k.Logger(ctx)
err := k.SudoContractCall(ctx, contractAddress, ResolveSinglePlayer)
if err != nil {
logger.Error(fmt.Sprintf("Game %s contract call error for single player", gameName))
logger.Error(fmt.Sprintf("Game %s contract call error for single-player", gameName))
} else {
logger.Info(fmt.Sprintf("Game %s contract call for single player success", gameName))
logger.Info(fmt.Sprintf("Game %s contract call for single-player success", gameName))
}
}

func (k Keeper) MultiPlayer(ctx sdk.Context, contractAddress string, SetupMultiPlayer []byte, ResolveMultiPlayer []byte, gameName string) {
logger := k.Logger(ctx)
err := k.SudoContractCall(ctx, contractAddress, SetupMultiPlayer)
if err != nil {
logger.Error(fmt.Sprintf("Game %s contract call error for setup multi player", gameName))
logger.Error(fmt.Sprintf("Game %s contract call error for setup multi-player", gameName))
} else {
logger.Info(fmt.Sprintf("Game %s contract call for setup multi player success", gameName))
logger.Info(fmt.Sprintf("Game %s contract call for setup multi-player success", gameName))
}

err = k.SudoContractCall(ctx, contractAddress, ResolveMultiPlayer)
if err != nil {
logger.Error(fmt.Sprintf("Game %s contract call error for resolve multi player", gameName))
logger.Error(fmt.Sprintf("Game %s contract call error for resolve multi-player", gameName))
} else {
logger.Info(fmt.Sprintf("Game %s contract call for single resolve multi success", gameName))
logger.Info(fmt.Sprintf("Game %s contract call for resolve multi-player success", gameName))
}
}
3 changes: 2 additions & 1 deletion x/common/types/message_register_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func NewMsgRegisterContract(
SecurityAddress: securityAddress,
GameName: gameName,
ContractAddress: contractAddress,
GameType: gameType,
}
}

Expand Down Expand Up @@ -56,7 +57,7 @@ func (msg *MsgRegisterContract) ValidateBasic() error {
}
gameType := []uint64{1, 2, 3}
if !slices.Contains(gameType, msg.GameType) {
return sdkerrors.Wrap(sdkerrors.ErrInvalidType, "invalid game type (%s)")
return sdkerrors.Wrap(sdkerrors.ErrInvalidType, "invalid game type, should be 1,2 or 3")
}

return nil
Expand Down

0 comments on commit b31efe0

Please sign in to comment.