Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Commit e234cf5

Browse files
author
Alex Johnson
authored
feat: cosmos proto annotations (#918)
* cosmos proto Int * remaining cosmos scalar annotations * proto format
1 parent b3f8e9e commit e234cf5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1215
-1025
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/gorilla/mux v1.8.0
1111
github.com/grpc-ecosystem/grpc-gateway v1.16.0
1212
github.com/pkg/errors v0.9.1
13+
github.com/regen-network/cosmos-proto v0.3.1
1314
github.com/spf13/cast v1.5.0
1415
github.com/spf13/cobra v1.5.0
1516
github.com/spf13/pflag v1.0.5
@@ -19,6 +20,7 @@ require (
1920
github.com/tendermint/tm-db v0.6.7
2021
google.golang.org/genproto v0.0.0-20220728213248-dd149ef739b9
2122
google.golang.org/grpc v1.48.0
23+
google.golang.org/protobuf v1.28.1
2224
gopkg.in/yaml.v2 v2.4.0
2325
)
2426

@@ -119,7 +121,6 @@ require (
119121
github.com/prometheus/procfs v0.7.3 // indirect
120122
github.com/rakyll/statik v0.1.7 // indirect
121123
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
122-
github.com/regen-network/cosmos-proto v0.3.1 // indirect
123124
github.com/rs/cors v1.8.2 // indirect
124125
github.com/rs/zerolog v1.27.0 // indirect
125126
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
@@ -144,7 +145,6 @@ require (
144145
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
145146
google.golang.org/api v0.84.0 // indirect
146147
google.golang.org/appengine v1.6.7 // indirect
147-
google.golang.org/protobuf v1.28.1 // indirect
148148
gopkg.in/ini.v1 v1.66.6 // indirect
149149
gopkg.in/yaml.v3 v3.0.1 // indirect
150150
nhooyr.io/websocket v1.8.6 // indirect

pkg/types/monitoring.pb.go

Lines changed: 27 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/campaign/events.proto

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package tendermint.spn.campaign;
33

44
import "gogoproto/gogo.proto";
55
import "cosmos/base/v1beta1/coin.proto";
6+
import "cosmos_proto/cosmos.proto";
7+
68
import "campaign/vesting.proto";
79

810
option go_package = "github.com/tendermint/spn/x/campaign/types";
911

1012
message EventCampaignCreated {
1113
uint64 campaignID = 1;
12-
string coordinatorAddress = 2;
14+
string coordinatorAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
1315
uint64 coordinatorID = 3;
1416
}
1517

@@ -20,14 +22,14 @@ message EventCampaignChainAdded {
2022

2123
message EventCampaignInfoUpdated {
2224
uint64 campaignID = 1;
23-
string coordinatorAddress = 2;
25+
string coordinatorAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
2426
string campaignName = 3;
2527
bytes metadata = 4;
2628
}
2729

2830
message EventCampaignSharesUpdated {
2931
uint64 campaignID = 1;
30-
string coordinatorAddress = 2;
32+
string coordinatorAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
3133
repeated cosmos.base.v1beta1.Coin allocatedShares = 3 [
3234
(gogoproto.nullable) = false,
3335
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin",
@@ -37,7 +39,7 @@ message EventCampaignSharesUpdated {
3739

3840
message EventCampaignTotalSupplyUpdated {
3941
uint64 campaignID = 1;
40-
string coordinatorAddress = 2;
42+
string coordinatorAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
4143
repeated cosmos.base.v1beta1.Coin totalSupply = 3 [
4244
(gogoproto.nullable) = false,
4345
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin",
@@ -47,13 +49,13 @@ message EventCampaignTotalSupplyUpdated {
4749

4850
message EventCampaignMainnetInitialized {
4951
uint64 campaignID = 1;
50-
string coordinatorAddress = 2;
52+
string coordinatorAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
5153
uint64 mainnetID = 3;
5254
}
5355

5456
message EventMainnetAccountCreated {
5557
uint64 campaignID = 1;
56-
string address = 2;
58+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
5759
repeated cosmos.base.v1beta1.Coin shares = 3 [
5860
(gogoproto.nullable) = false,
5961
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin",
@@ -63,7 +65,7 @@ message EventMainnetAccountCreated {
6365

6466
message EventMainnetAccountUpdated {
6567
uint64 campaignID = 1;
66-
string address = 2;
68+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
6769
repeated cosmos.base.v1beta1.Coin shares = 3 [
6870
(gogoproto.nullable) = false,
6971
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin",
@@ -73,18 +75,18 @@ message EventMainnetAccountUpdated {
7375

7476
message EventMainnetAccountRemoved {
7577
uint64 campaignID = 1;
76-
string address = 2;
78+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
7779
}
7880

7981
message EventMainnetVestingAccountCreated {
8082
uint64 campaignID = 1;
81-
string address = 2;
83+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
8284
ShareVestingOptions vestingOptions = 3 [(gogoproto.nullable) = false];
8385
}
8486

8587
message EventMainnetVestingAccountUpdated {
8688
uint64 campaignID = 1;
87-
string address = 2;
89+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
8890
ShareVestingOptions vestingOptions = 3 [(gogoproto.nullable) = false];
8991
}
9092

proto/campaign/mainnet_account.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ option go_package = "github.com/tendermint/spn/x/campaign/types";
55

66
import "gogoproto/gogo.proto";
77
import "cosmos/base/v1beta1/coin.proto";
8+
import "cosmos_proto/cosmos.proto";
89

910
message MainnetAccount {
1011
uint64 campaignID = 1;
11-
string address = 2;
12+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
1213
repeated cosmos.base.v1beta1.Coin shares = 3 [
1314
(gogoproto.nullable) = false,
1415
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin",
@@ -18,7 +19,7 @@ message MainnetAccount {
1819

1920
message MainnetAccountBalance {
2021
uint64 campaignID = 1;
21-
string address = 2;
22+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
2223
repeated cosmos.base.v1beta1.Coin coins = 3 [
2324
(gogoproto.nullable) = false,
2425
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin",

proto/campaign/params.proto

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tendermint.spn.campaign;
33

44
import "gogoproto/gogo.proto";
55
import "cosmos/base/v1beta1/coin.proto";
6+
import "cosmos_proto/cosmos.proto";
67

78
option go_package = "github.com/tendermint/spn/x/campaign/types";
89

@@ -20,8 +21,14 @@ message Params {
2021

2122
// TotalSupplyRange defines the range of allowed values for total supply
2223
message TotalSupplyRange {
23-
string minTotalSupply = 1
24-
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
25-
string maxTotalSupply = 2
26-
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
27-
}
24+
string minTotalSupply = 1 [
25+
(gogoproto.nullable) = false,
26+
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
27+
(cosmos_proto.scalar) = "cosmos.Int"
28+
];
29+
string maxTotalSupply = 2 [
30+
(gogoproto.nullable) = false,
31+
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
32+
(cosmos_proto.scalar) = "cosmos.Int"
33+
];
34+
}

proto/campaign/query.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import "google/api/annotations.proto";
55
import "cosmos/base/v1beta1/coin.proto";
66
import "cosmos/base/query/v1beta1/pagination.proto";
77
import "gogoproto/gogo.proto";
8+
import "cosmos_proto/cosmos.proto";
9+
810
import "campaign/campaign_chains.proto";
911
import "campaign/campaign.proto";
1012
import "campaign/vesting.proto";
@@ -114,7 +116,7 @@ message QuerySpecialAllocationsBalanceResponse {
114116

115117
message QueryGetMainnetAccountRequest {
116118
uint64 campaignID = 1;
117-
string address = 2;
119+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
118120
}
119121

120122
message QueryGetMainnetAccountResponse {
@@ -133,7 +135,7 @@ message QueryAllMainnetAccountResponse {
133135

134136
message QueryGetMainnetAccountBalanceRequest {
135137
uint64 campaignID = 1;
136-
string address = 2;
138+
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
137139
}
138140

139141
message QueryGetMainnetAccountBalanceResponse {

proto/claim/claim_record.proto

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ package tendermint.spn.claim;
44
option go_package = "github.com/tendermint/spn/x/claim/types";
55

66
import "gogoproto/gogo.proto";
7+
import "cosmos_proto/cosmos.proto";
78

89
message ClaimRecord {
9-
string address = 1;
10-
string claimable = 2
11-
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
10+
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
11+
string claimable = 2 [
12+
(gogoproto.nullable) = false,
13+
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
14+
(cosmos_proto.scalar) = "cosmos.Int"
15+
];
1216
repeated uint64 completedMissions = 3;
1317
}

proto/claim/mission.proto

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ package tendermint.spn.claim;
44
option go_package = "github.com/tendermint/spn/x/claim/types";
55

66
import "gogoproto/gogo.proto";
7+
import "cosmos_proto/cosmos.proto";
78

89
message Mission {
910
uint64 missionID = 1;
1011
string description = 2;
11-
string weight = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
12+
string weight = 3 [
13+
(gogoproto.nullable) = false,
14+
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
15+
(cosmos_proto.scalar) = "cosmos.Dec"
16+
];
1217
}

proto/claim/query.proto

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ syntax = "proto3";
22

33
package tendermint.spn.claim;
44

5-
import "claim/claim_record.proto";
6-
import "claim/mission.proto";
7-
import "claim/initial_claim.proto";
8-
// this line is used by starport scaffolding # 1
9-
10-
import "claim/params.proto";
115
import "cosmos/base/query/v1beta1/pagination.proto";
126
import "cosmos/base/v1beta1/coin.proto";
137
import "gogoproto/gogo.proto";
148
import "google/api/annotations.proto";
9+
import "cosmos_proto/cosmos.proto";
10+
11+
import "claim/params.proto";
12+
import "claim/claim_record.proto";
13+
import "claim/mission.proto";
14+
import "claim/initial_claim.proto";
15+
// this line is used by starport scaffolding # 1
1516

1617
option go_package = "github.com/tendermint/spn/x/claim/types";
1718

@@ -63,7 +64,7 @@ message QueryParamsResponse {
6364
}
6465

6566
message QueryGetClaimRecordRequest {
66-
string address = 1;
67+
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
6768
}
6869

6970
message QueryGetClaimRecordResponse {

0 commit comments

Comments
 (0)