Skip to content

Commit

Permalink
Fixed matches
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed Aug 21, 2023
1 parent f2a9baa commit ec943c8
Show file tree
Hide file tree
Showing 29 changed files with 2,115 additions and 2,339 deletions.
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo
}
}

app.CardchainKeeper.MatchWorker(ctx)

return app.mm.EndBlock(ctx, req)
}

Expand Down
90 changes: 72 additions & 18 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33050,6 +33050,9 @@ paths:
votingRewardCap:
type: string
format: int64
matchWorkerDelay:
type: string
format: uint64
description: >-
QueryParamsResponse is response type for the Query/Params RPC
method.
Expand Down Expand Up @@ -33521,8 +33524,13 @@ paths:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
playerB:
type: object
properties:
Expand Down Expand Up @@ -33551,8 +33559,13 @@ paths:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
outcome:
type: string
enum:
Expand Down Expand Up @@ -33644,8 +33657,13 @@ paths:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
playerB:
type: object
properties:
Expand Down Expand Up @@ -33674,8 +33692,13 @@ paths:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
outcome:
type: string
enum:
Expand Down Expand Up @@ -68574,8 +68597,13 @@ definitions:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
playerB:
type: object
properties:
Expand Down Expand Up @@ -68604,8 +68632,13 @@ definitions:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
outcome:
type: string
enum:
Expand Down Expand Up @@ -68646,8 +68679,13 @@ definitions:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
DecentralCardGame.cardchain.cardchain.MsgAddArtworkResponse:
type: object
DecentralCardGame.cardchain.cardchain.MsgAddArtworkToCollectionResponse:
Expand Down Expand Up @@ -68909,6 +68947,9 @@ definitions:
votingRewardCap:
type: string
format: int64
matchWorkerDelay:
type: string
format: uint64
description: Params defines the parameters for the module.
DecentralCardGame.cardchain.cardchain.QueryParamsResponse:
type: object
Expand Down Expand Up @@ -68970,6 +69011,9 @@ definitions:
votingRewardCap:
type: string
format: int64
matchWorkerDelay:
type: string
format: uint64
description: QueryParamsResponse is response type for the Query/Params RPC method.
DecentralCardGame.cardchain.cardchain.QueryQCardContentResponse:
type: object
Expand Down Expand Up @@ -69080,8 +69124,13 @@ definitions:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
playerB:
type: object
properties:
Expand Down Expand Up @@ -69110,8 +69159,13 @@ definitions:
votedCards:
type: array
items:
type: string
format: uint64
type: object
properties:
cardId:
type: string
format: uint64
voteType:
type: string
outcome:
type: string
enum:
Expand Down
3 changes: 2 additions & 1 deletion proto/cardchain/cardchain/match.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package DecentralCardGame.cardchain.cardchain;

option go_package = "github.com/DecentralCardGame/Cardchain/x/cardchain/types";
import "cardchain/cardchain/voteing.proto";

message Match {

Expand All @@ -20,7 +21,7 @@ message MatchPlayer {
bool confirmed = 3;
Outcome outcome = 4;
repeated uint64 deck = 5;
repeated uint64 votedCards = 6;
repeated SingleVote votedCards = 6;
}

enum Outcome {
Expand Down
1 change: 1 addition & 0 deletions proto/cardchain/cardchain/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ message Params {
string trialVoteReward = 19 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin"];;
int64 votePoolFraction = 20;
int64 votingRewardCap = 8;
uint64 matchWorkerDelay = 21;
}
3 changes: 1 addition & 2 deletions proto/cardchain/cardchain/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cardchain/cardchain/params.proto";
import "cardchain/cardchain/vote_right.proto";
import "cardchain/cardchain/voting_results.proto";
import "cardchain/cardchain/voteing.proto";
import "cardchain/cardchain/card.proto";
import "cardchain/cardchain/user.proto";
import "cardchain/cardchain/match.proto";
Expand Down
8 changes: 2 additions & 6 deletions proto/cardchain/cardchain/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package DecentralCardGame.cardchain.cardchain;
import "gogoproto/gogo.proto";
import "cardchain/cardchain/council.proto";
import "cardchain/cardchain/match.proto";
import "cardchain/cardchain/voteing.proto";
import "cosmos/base/v1beta1/coin.proto";

// this line is used by starport scaffolding # proto/tx/import
Expand Down Expand Up @@ -337,7 +338,7 @@ message MsgConfirmMatch {
string creator = 1;
uint64 matchId = 2;
Outcome outcome = 3;
repeated uint64 votedCards = 4;
repeated SingleVote votedCards = 4;
}

message MsgConfirmMatchResponse {}
Expand Down Expand Up @@ -396,11 +397,6 @@ message MsgSetUserBiography {

message MsgSetUserBiographyResponse {}

message SingleVote {
uint64 cardId = 1;
string voteType = 2;
}

// this line is used by starport scaffolding # proto/tx/message
message MsgMultiVoteCard {
string creator = 1;
Expand Down
2 changes: 1 addition & 1 deletion proto/cardchain/cardchain/user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";
package DecentralCardGame.cardchain.cardchain;

option go_package = "github.com/DecentralCardGame/Cardchain/x/cardchain/types";
import "cardchain/cardchain/vote_right.proto";
import "cardchain/cardchain/voteing.proto";

message User {

Expand Down
10 changes: 0 additions & 10 deletions proto/cardchain/cardchain/vote_right.proto

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ syntax = "proto3";
package DecentralCardGame.cardchain.cardchain;

option go_package = "github.com/DecentralCardGame/Cardchain/x/cardchain/types";
import "cardchain/cardchain/voting_result.proto";

message VotingResults {

Expand All @@ -14,3 +13,24 @@ message VotingResults {
repeated VotingResult cardResults = 6;
string notes = 7;
}

message VotingResult {

uint64 cardId = 1;
uint64 fairEnoughVotes = 2;
uint64 overpoweredVotes = 3;
uint64 underpoweredVotes = 4;
uint64 inappropriateVotes = 5;
string result = 6;
}

message SingleVote {
uint64 cardId = 1;
string voteType = 2;
}

message VoteRight {

uint64 cardId = 1;
int64 expireBlock = 2;
}
14 changes: 0 additions & 14 deletions proto/cardchain/cardchain/voting_result.proto

This file was deleted.

3 changes: 3 additions & 0 deletions x/cardchain/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
genState.Params.AirDropValue = defaultParams.AirDropValue
genState.Params.AirDropMaxBlockHeight = defaultParams.AirDropMaxBlockHeight
}
if genState.Params.MatchWorkerDelay == 0 {
genState.Params.MatchWorkerDelay = types.DefaultMatchWorkerDelay
}
k.SetParams(ctx, genState.Params)
}

Expand Down
Loading

0 comments on commit ec943c8

Please sign in to comment.