Skip to content

Commit

Permalink
feat: Add Supply Offsets to bank module (#119)
Browse files Browse the repository at this point in the history
* add query supplies with offsets

* add functions to interface

* add tests for query

* add supplywithoutoffset queries
  • Loading branch information
sunnya97 authored and czarcas7ic committed Oct 4, 2023
1 parent b09c1c5 commit 6040003
Show file tree
Hide file tree
Showing 31 changed files with 4,299 additions and 731 deletions.
2,944 changes: 2,543 additions & 401 deletions api/cosmos/bank/v1beta1/query.pulsar.go

Large diffs are not rendered by default.

100 changes: 89 additions & 11 deletions api/cosmos/bank/v1beta1/query_grpc.pb.go

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

4 changes: 2 additions & 2 deletions proto/cosmos/auth/v1beta1/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ message BaseAccount {
option (gogoproto.equal) = false;
option (cosmos_proto.implements_interface) = "cosmos.auth.v1beta1.AccountI";

string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (amino.field_name) = "public_key"];
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (amino.field_name) = "public_key"];
uint64 account_number = 3;
uint64 sequence = 4;
}
Expand Down
48 changes: 47 additions & 1 deletion proto/cosmos/bank/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ service Query {
option (google.api.http).get = "/cosmos/bank/v1beta1/supply/by_denom";
}

// TotalSupplyWithoutOffset queries the total supply of all coins.
rpc TotalSupplyWithoutOffset(QueryTotalSupplyWithoutOffsetRequest) returns (QueryTotalSupplyWithoutOffsetResponse) {
option (google.api.http).get = "/cosmos/bank/v1beta1/supply_without_offset";
}

// SupplyOf queries the supply of a single coin.
rpc SupplyOfWithoutOffset(QuerySupplyOfWithoutOffsetRequest) returns (QuerySupplyOfWithoutOffsetResponse) {
option (google.api.http).get = "/cosmos/bank/v1beta1/supply_without_offset/{denom}";
}

// Params queries the parameters of x/bank module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (cosmos.query.v1.module_query_safe) = true;
Expand Down Expand Up @@ -214,7 +224,6 @@ message QuerySpendableBalanceByDenomResponse {
cosmos.base.v1beta1.Coin balance = 1;
}


// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
// method.
message QueryTotalSupplyRequest {
Expand Down Expand Up @@ -255,6 +264,43 @@ message QuerySupplyOfResponse {
cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

// QueryTotalSupplyWithoutOffsetRequest is the request type for the Query/TotalSupplyWithoutOffset RPC
// method.
message QueryTotalSupplyWithoutOffsetRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// pagination defines an optional pagination for the request.
//
// Since: cosmos-sdk 0.43
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryTotalSupplyWithoutOffsetResponse is the response type for the Query/TotalSupplyWithoutOffset RPC
// method
message QueryTotalSupplyWithoutOffsetResponse {
// supply is the supply of the coins
repeated cosmos.base.v1beta1.Coin supply = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];

// pagination defines the pagination in the response.
//
// Since: cosmos-sdk 0.43
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QuerySupplyOfWithoutOffsetRequest is the request type for the Query/SupplyOfWithoutOffset RPC method.
message QuerySupplyOfWithoutOffsetRequest {
// denom is the coin denom to query balances for.
string denom = 1;
}

// QuerySupplyOfWithoutOffsetResponse is the response type for the Query/SupplyOfWithoutOffset RPC method.
message QuerySupplyOfWithoutOffsetResponse {
// amount is the supply of the coin.
cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false];
}

// QueryParamsRequest defines the request type for querying x/bank parameters.
message QueryParamsRequest {}

Expand Down
3 changes: 1 addition & 2 deletions proto/cosmos/base/store/v1beta1/commit_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/store/types";
message CommitInfo {
int64 version = 1;
repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false];
google.protobuf.Timestamp timestamp = 3
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}

// StoreInfo defines store-specific commit information. It contains a reference
Expand Down
22 changes: 11 additions & 11 deletions proto/cosmos/base/store/v1beta1/listening.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ message StoreKVPair {
// BlockMetadata contains all the abci event data of a block
// the file streamer dump them into files together with the state changes.
message BlockMetadata {
// DeliverTx encapulate deliver tx request and response.
message DeliverTx {
tendermint.abci.RequestDeliverTx request = 1;
tendermint.abci.ResponseDeliverTx response = 2;
}
tendermint.abci.RequestBeginBlock request_begin_block = 1;
tendermint.abci.ResponseBeginBlock response_begin_block = 2;
repeated DeliverTx deliver_txs = 3;
tendermint.abci.RequestEndBlock request_end_block = 4;
tendermint.abci.ResponseEndBlock response_end_block = 5;
tendermint.abci.ResponseCommit response_commit = 6;
// DeliverTx encapulate deliver tx request and response.
message DeliverTx {
tendermint.abci.RequestDeliverTx request = 1;
tendermint.abci.ResponseDeliverTx response = 2;
}
tendermint.abci.RequestBeginBlock request_begin_block = 1;
tendermint.abci.ResponseBeginBlock response_begin_block = 2;
repeated DeliverTx deliver_txs = 3;
tendermint.abci.RequestEndBlock request_end_block = 4;
tendermint.abci.ResponseEndBlock response_end_block = 5;
tendermint.abci.ResponseCommit response_commit = 6;
}
4 changes: 2 additions & 2 deletions proto/cosmos/distribution/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ message MsgCommunityPoolSpend {
option (amino.name) = "cosmos-sdk/distr/MsgCommunityPoolSpend";

// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string recipient = 2;
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string recipient = 2;
repeated cosmos.base.v1beta1.Coin amount = 3 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
Expand Down
8 changes: 4 additions & 4 deletions proto/cosmos/evidence/v1beta1/evidence.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ message Equivocation {
option (gogoproto.equal) = false;

// height is the equivocation height.
int64 height = 1;
int64 height = 1;

// time is the equivocation time.
google.protobuf.Timestamp time = 2
google.protobuf.Timestamp time = 2
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true];

// power is the equivocation validator power.
int64 power = 3;
int64 power = 3;

// consensus_address is the equivocation validator consensus address.
string consensus_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand Down
4 changes: 2 additions & 2 deletions proto/cosmos/evidence/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ message MsgSubmitEvidence {
option (gogoproto.goproto_getters) = false;

// submitter is the signer account address of evidence.
string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// evidence defines the evidence of misbehavior.
google.protobuf.Any evidence = 2 [(cosmos_proto.accepts_interface) = "cosmos.evidence.v1beta1.Evidence"];
}
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/gov/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ message Module {
go_import: "github.com/cosmos/cosmos-sdk/x/gov"
};

// max_metadata_len defines the maximum proposal metadata length.
// max_metadata_len defines the maximum proposal metadata length.
// Defaults to 255 if not explicitly set.
uint64 max_metadata_len = 1;

Expand Down
Loading

0 comments on commit 6040003

Please sign in to comment.