Skip to content

Commit

Permalink
feat(x/ecocredit): add query methods for orm params (#1423)
Browse files Browse the repository at this point in the history
* feat: add proto messages

* feat: add cli tests

* cleanup

* Update x/ecocredit/client/query.go

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>

* Update proto/regen/ecocredit/v1/query.proto

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>

* Update proto/regen/ecocredit/v1/query.proto

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>

* Update x/ecocredit/server/core/query_credit_class_fees_test.go

Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>

* Update x/ecocredit/server/core/query_credit_class_fees_test.go

Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>

* Update x/ecocredit/client/query.go

Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>

* chore: review changes

* chore: fix lint errors

* Update x/ecocredit/server/core/query_params.go

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 30, 2022
1 parent a83f474 commit ac52762
Show file tree
Hide file tree
Showing 29 changed files with 8,834 additions and 2,544 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1412](https://github.com/regen-network/regen-ledger/pull/1412) Add `EventRemoveAllowedDenom`
- [#1416](https://github.com/regen-network/regen-ledger/pull/1416) Add `QueryAllBalances` query
- [#1417](https://github.com/regen-network/regen-ledger/pull/1417) Add ecocredit params state migration
- [#1423](https://github.com/regen-network/regen-ledger/pull/1423) Add `AllowedClassCreators` params query
- [#1423](https://github.com/regen-network/regen-ledger/pull/1423) Add `CreditClassFees` params query
- [#1423](https://github.com/regen-network/regen-ledger/pull/1423) Add `CreditClassAllowlistEnabled` params query


#### Changed

Expand Down
8,300 changes: 6,034 additions & 2,266 deletions api/regen/ecocredit/v1/query.pulsar.go

Large diffs are not rendered by default.

133 changes: 133 additions & 0 deletions api/regen/ecocredit/v1/query_grpc.pb.go

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

105 changes: 105 additions & 0 deletions proto/regen/ecocredit/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ syntax = "proto3";
package regen.ecocredit.v1;

import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "regen/ecocredit/v1/state.proto";
Expand Down Expand Up @@ -193,7 +195,10 @@ service Query {
}

// Params queries the ecocredit module parameters.
// Deprecated (Since Revision 1): This rpc will be removed in the next
// version.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option deprecated = true;
option (google.api.http).get = "/regen/ecocredit/v1/params";
}

Expand All @@ -206,6 +211,31 @@ service Query {
]
};
}

// AllowedClassCreators queries allowed credit class creators list.
//
// Since Revision 1
rpc AllowedClassCreators(QueryAllowedClassCreatorsRequest)
returns (QueryAllowedClassCreatorsResponse) {
option (google.api.http).get = "/regen/ecocredit/v1/allowed-class-creators";
}

// CreditClassFees queries the class creation fee.
//
// Since Revision 1
rpc CreditClassFees(QueryCreditClassFeesRequest)
returns (QueryCreditClassFeesResponse) {
option (google.api.http).get = "/regen/ecocredit/v1/credit-class-fees";
}

// CreditClassAllowlistEnabled queries the credit class creator allowlist flag.
//
// Since Revision 1
rpc CreditClassAllowlistEnabled(QueryCreditClassAllowlistEnabledRequest)
returns (QueryCreditClassAllowlistEnabledResponse) {
option (google.api.http).get =
"/regen/ecocredit/v1/credit-class-allowlist-enabled";
}
}

// QueryClassesRequest is the Query/Classes request type.
Expand Down Expand Up @@ -559,11 +589,33 @@ message QueryCreditTypesResponse {
// QueryParamsRequest is the Query/Params request type.
message QueryParamsRequest {}

// AllowedDenom represents the information for an allowed ask denom.
message AllowedDenomInfo {
// denom is the bank denom to allow (ex. ibc/GLKHDSG423SGS)
string bank_denom = 1;

// display_denom is the denom to display to the user and is informational.
// Because the denom is likely an IBC denom, this should be chosen by
// governance to represent the consensus trusted name of the denom.
string display_denom = 2;

// exponent is the exponent that relates the denom to the display_denom and is
// informational
uint32 exponent = 3;
}

// QueryParamsResponse is the Query/Params response type.
message QueryParamsResponse {

// params defines the parameters of the ecocredit module.
Params params = 1;

// allowed_denoms is a list of bank denoms allowed to be used in the ask price of
// sell orders.
//
// Since Revision 1
repeated AllowedDenomInfo allowed_denoms = 2;

}

// QueryCreditTypeRequest is the Query/CreditType request type
Expand Down Expand Up @@ -676,3 +728,56 @@ message BatchBalanceInfo {
// cancelled, updated with a reduced quantity, or processed.
string escrowed_amount = 5;
}

// QueryAllowedClassCreatorsRequest is the Query/AllowedClassCreators request
// type.
//
// Since Revision 1
message QueryAllowedClassCreatorsRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryAllowedClassCreatorsResponse is the Query/AllowedClassCreators response
// type.
//
// Since Revision 1
message QueryAllowedClassCreatorsResponse {
// class_creators is the list of allowed credit class creators.
repeated string class_creators = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryCreditClassFeesRequest is the Query/CreditClassFees request type.
//
// Since Revision 1
message QueryCreditClassFeesRequest {}

// QueryCreditClassFeesResponse is the Query/CreditClassFees response type.
//
// Since Revision 1
message QueryCreditClassFeesResponse {
// fees is the ClassFees message type
repeated cosmos.base.v1beta1.Coin fees = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}

// QueryCreditClassAllowlistEnabledRequest is the
// Query/CreditClassAllowlistEnabled request type.
//
// Since Revision 1
message QueryCreditClassAllowlistEnabledRequest {}

// QueryCreditClassAllowlistEnabledResponse is the
// Query/CreditClassAllowlistEnabled response type.
//
// Since Revision 1
message QueryCreditClassAllowlistEnabledResponse {
// allowlist_enabled determines whether or not the allowlist for creating
// credit classes is enabled.
bool allowlist_enabled = 1;
}
Loading

0 comments on commit ac52762

Please sign in to comment.