Skip to content

Commit

Permalink
feat: add signer and cosmos address to protos
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpioborn committed Jun 3, 2024
1 parent bf42ed0 commit 24ee7ac
Show file tree
Hide file tree
Showing 46 changed files with 1,098 additions and 962 deletions.
7 changes: 4 additions & 3 deletions proto/sgenetwork/sge/bet/bet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.bet;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "sgenetwork/sge/bet/odds_type.proto";

option go_package = "github.com/sge-network/sge/x/bet/types";
Expand Down Expand Up @@ -53,7 +54,7 @@ message Bet {
Result result = 9;

// creator is the bettor address.
string creator = 10;
string creator = 10 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// created_at is the bet placement timestamp.
int64 created_at = 11;
Expand Down Expand Up @@ -132,7 +133,7 @@ message PendingBet {
json_name = "uid"
];
// creator is the bettor address.
string creator = 2;
string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

// SettledBet is the type for a settled bet.
Expand All @@ -144,7 +145,7 @@ message SettledBet {
json_name = "uid"
];
// bettor_address is the bech32 address of the bettor account.
string bettor_address = 2;
string bettor_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

// BetFulfillment: A bet can be fulfilled by multiple users participating as a
Expand Down
3 changes: 2 additions & 1 deletion proto/sgenetwork/sge/bet/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.bet;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "sgenetwork/sge/bet/params.proto";
Expand Down Expand Up @@ -64,7 +65,7 @@ message QueryParamsResponse {
// QueryBetRequest is the request type for a single bet query
// Query/Bet RPC method.
message QueryBetRequest {
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
string uid = 2 [ (gogoproto.jsontag) = "uid", json_name = "uid" ];
}

Expand Down
4 changes: 3 additions & 1 deletion proto/sgenetwork/sge/bet/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ service Msg {

// MsgWager defines a message to place a bet with the given data.
message MsgWager {
option (cosmos.msg.v1.signer) = "creator";

// creator is the bettor address.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// props contains bet properties.
WagerProps props = 2;
}
Expand Down
7 changes: 5 additions & 2 deletions proto/sgenetwork/sge/house/deposit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.house;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/sge-network/sge/x/house/types";

Expand All @@ -15,8 +16,10 @@ message Deposit {
string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ];

// creator is the bech32-encoded address of the depositor.
string depositor_address = 2
[ (gogoproto.moretags) = "yaml:\"depositor_address\"" ];
string depositor_address = 2 [
(gogoproto.moretags) = "yaml:\"depositor_address\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];

// market_uid is the uid of market/order book against which deposit is being
// made.
Expand Down
6 changes: 4 additions & 2 deletions proto/sgenetwork/sge/house/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sgenetwork.sge.house;

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/api/annotations.proto";
import "sgenetwork/sge/house/params.proto";
import "sgenetwork/sge/house/deposit.proto";
Expand Down Expand Up @@ -93,7 +94,7 @@ message QueryDepositsByAccountResponse {
message QueryWithdrawalsByAccountRequest {
// address defines the address of depositor/account for which withdrawals are
// queried.
string address = 1;
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
Expand All @@ -112,7 +113,8 @@ message QueryWithdrawalsByAccountResponse {
// QueryWithdrawalRequest is the request type for the Query/Withdrawal RPC
// method. Query/Withdrawal RPC method.
message QueryWithdrawalRequest {
string depositor_address = 1;
string depositor_address = 1
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
string market_uid = 2;
// participation_index is the index corresponding to the order book
// participation
Expand Down
13 changes: 9 additions & 4 deletions proto/sgenetwork/sge/house/ticket.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package sgenetwork.sge.house;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "sgenetwork/sge/type/kyc.proto";

option go_package = "github.com/sge-network/sge/x/house/types";
Expand All @@ -13,8 +14,10 @@ message DepositTicketPayload {
sgenetwork.sge.type.KycDataPayload kyc_data = 1
[ (gogoproto.nullable) = false ];
// depositor_address is the account who makes a deposit
string depositor_address = 2
[ (gogoproto.moretags) = "yaml:\"depositor_address\"" ];
string depositor_address = 2 [
(gogoproto.moretags) = "yaml:\"depositor_address\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
}

// WithdrawTicketPayload indicates data of the withdrawal ticket.
Expand All @@ -23,6 +26,8 @@ message WithdrawTicketPayload {
sgenetwork.sge.type.KycDataPayload kyc_data = 1
[ (gogoproto.nullable) = false ];
// depositor_address is the account who makes a deposit
string depositor_address = 2
[ (gogoproto.moretags) = "yaml:\"depositor_address\"" ];
string depositor_address = 2 [
(gogoproto.moretags) = "yaml:\"depositor_address\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
}
7 changes: 6 additions & 1 deletion proto/sgenetwork/sge/house/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ service Msg {
message MsgDeposit {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "creator";

// creator is the account who makes a deposit
string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ];
Expand Down Expand Up @@ -72,8 +73,12 @@ message MsgDepositResponse {
message MsgWithdraw {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "creator";

string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ];
string creator = 1 [
(cosmos_proto.scalar) = "cosmos.AddressString",
(gogoproto.moretags) = "yaml:\"creator\""
];
string market_uid = 2 [
(gogoproto.customname) = "MarketUID",
(gogoproto.jsontag) = "market_uid",
Expand Down
11 changes: 9 additions & 2 deletions proto/sgenetwork/sge/house/withdraw.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.house;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/sge-network/sge/x/house/types";

Expand All @@ -12,7 +13,10 @@ message Withdrawal {
option (gogoproto.goproto_stringer) = false;

// creator is the bech32-encoded address of the depositor.
string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ];
string creator = 1 [
(cosmos_proto.scalar) = "cosmos.AddressString",
(gogoproto.moretags) = "yaml:\"creator\""
];

// withdrawal is the withdrawal attempt id.
uint64 id = 2 [
Expand All @@ -23,7 +27,10 @@ message Withdrawal {
];

// address is the bech32-encoded address of the depositor.
string address = 3 [ (gogoproto.moretags) = "yaml:\"address\"" ];
string address = 3 [
(cosmos_proto.scalar) = "cosmos.AddressString",
(gogoproto.moretags) = "yaml:\"address\""
];

// market_uid is the uid of market against which the deposit is
// being made.
Expand Down
3 changes: 2 additions & 1 deletion proto/sgenetwork/sge/market/market.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.market;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "sgenetwork/sge/market/odds.proto";

option go_package = "github.com/sge-network/sge/x/market/types";
Expand Down Expand Up @@ -44,7 +45,7 @@ message Market {
json_name = "resolution_ts"
];
// creator is the address of the creator of market.
string creator = 8;
string creator = 8 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// meta contains human-readable metadata of the market.
string meta = 9;
// book_uid is the unique identifier corresponding to the book
Expand Down
12 changes: 9 additions & 3 deletions proto/sgenetwork/sge/market/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ service Msg {
// MsgAdd is the message type for adding the market into the
// state.
message MsgAdd {
option (cosmos.msg.v1.signer) = "creator";

// creator is the address of the creator account of the market.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// ticket is the jwt ticket data.
string ticket = 2;
}
Expand All @@ -44,8 +46,10 @@ message MsgAddResponse {

// MsgResolve is the message type for resolving a market.
message MsgResolve {
option (cosmos.msg.v1.signer) = "creator";

// creator is the address of the creator account of the market.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// ticket is the jwt ticket data.
string ticket = 2;
}
Expand All @@ -61,8 +65,10 @@ message MsgResolveResponse {
// MsgUpdate is the message type for updating market data.
// in the state
message MsgUpdate {
option (cosmos.msg.v1.signer) = "creator";

// creator is the address of the creator account of the market.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// ticket is the jwt ticket data.
string ticket = 2;
}
Expand Down
13 changes: 9 additions & 4 deletions proto/sgenetwork/sge/orderbook/participation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.orderbook;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/sge-network/sge/x/orderbook/types";

Expand All @@ -22,8 +23,10 @@ message OrderBookParticipation {
];

// participant_address is the bech32-encoded address of the participant.
string participant_address = 3
[ (gogoproto.moretags) = "yaml:\"participant_address\"" ];
string participant_address = 3 [
(cosmos_proto.scalar) = "cosmos.AddressString",
(gogoproto.moretags) = "yaml:\"participant_address\""
];

// liquidity is the total initial liquidity provided.
string liquidity = 4 [
Expand Down Expand Up @@ -153,6 +156,8 @@ message SettledOrderbookParticipation {
];

// participant_address is the bech32-encoded address of the participant.
string participant_address = 3
[ (gogoproto.moretags) = "yaml:\"participant_address\"" ];
string participant_address = 3 [
(cosmos_proto.scalar) = "cosmos.AddressString",
(gogoproto.moretags) = "yaml:\"participant_address\""
];
}
3 changes: 2 additions & 1 deletion proto/sgenetwork/sge/ovm/proposal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.ovm;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "sgenetwork/sge/ovm/ticket.proto";
import "sgenetwork/sge/ovm/vote.proto";

Expand All @@ -13,7 +14,7 @@ message PublicKeysChangeProposal {
// id is the sequential id of the proposal generated by the blockchain.
uint64 id = 1;
// creator is the account address of the proposal creator.
string creator = 2;
string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// modifications contain the ticket payload of the proposal.
PubkeysChangeProposalPayload modifications = 3
[ (gogoproto.nullable) = false ];
Expand Down
8 changes: 6 additions & 2 deletions proto/sgenetwork/sge/ovm/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ service Msg {
// MsgPubkeysChangeProposalRequest is the type of request for modification of
// public keys.
message MsgSubmitPubkeysChangeProposalRequest {
option (cosmos.msg.v1.signer) = "creator";

// creator is the account address of the creator.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// ticket is the jwt ticket data.
string ticket = 2;
}
Expand All @@ -42,8 +44,10 @@ message MsgSubmitPubkeysChangeProposalResponse { bool success = 1; }
// MsgVotePubkeysChangeRequest is the type of request to vote on the
// modification of public keys proposal.
message MsgVotePubkeysChangeRequest {
option (cosmos.msg.v1.signer) = "creator";

// creator is the account address of the creator.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// ticket is the jwt ticket data.
string ticket = 2;
// voter_key_index is the public key index of the voter in the current list
Expand Down
5 changes: 3 additions & 2 deletions proto/sgenetwork/sge/reward/campaign.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ syntax = "proto3";
package sgenetwork.sge.reward;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "sgenetwork/sge/reward/reward.proto";

option go_package = "github.com/sge-network/sge/x/reward/types";

// Campaign is type for defining the campaign properties.
message Campaign {
// creator is the address of campaign creator.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// uid is the unique identifier of a campaign.
string uid = 2 [
Expand All @@ -20,7 +21,7 @@ message Campaign {

// promoter is the address of campaign promoter.
// Funds for the campaign would be deducted from this account.
string promoter = 3;
string promoter = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// start_ts is the start timestamp of a campaign.
uint64 start_ts = 4 [
Expand Down
6 changes: 3 additions & 3 deletions proto/sgenetwork/sge/reward/promoter.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";
package sgenetwork.sge.reward;

import "gogoproto/gogo.proto";

import "cosmos_proto/cosmos.proto";
import "sgenetwork/sge/reward/reward.proto";

option go_package = "github.com/sge-network/sge/x/reward/types";
Expand All @@ -11,7 +11,7 @@ option go_package = "github.com/sge-network/sge/x/reward/types";
// configuration.
message Promoter {
// creator is the address of promoter.
string creator = 1;
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// uid is the unique identifier of a promoter.
string uid = 2 [
Expand Down Expand Up @@ -48,5 +48,5 @@ message PromoterByAddress {
json_name = "promoter_uid"
];
// address is the address of the promoter account.
string address = 2;
string address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}
Loading

0 comments on commit 24ee7ac

Please sign in to comment.