Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(x/ecocredit): add query methods for orm params #1423

Merged
merged 16 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1354](https://github.com/regen-network/regen-ledger/pull/1354) Add `UpdateClassFees` msg-based gov proposal
- [#1391](https://github.com/regen-network/regen-ledger/pull/1391) Add `BasketFees` params query
- [#1412](https://github.com/regen-network/regen-ledger/pull/1412) Add `EventRemoveAllowedDenom`
- [#1423](https://github.com/regen-network/regen-ledger/pull/1423) Add `AllowedClassCreators` prams query
- [#1423](https://github.com/regen-network/regen-ledger/pull/1423) Add `CreditClassFees` prams query
- [#1423](https://github.com/regen-network/regen-ledger/pull/1423) Add `CreditClassAllowlistEnabled` prams query
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved


#### Changed

Expand Down
8,716 changes: 6,501 additions & 2,215 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.

3 changes: 1 addition & 2 deletions proto/regen/ecocredit/basket/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ service Query {
rpc BasketFees(QueryBasketFeesRequest) returns (QueryBasketFeesResponse) {
option (google.api.http).get = "/regen/ecocredit/basket/v1/basket-fees";
}

}

// QueryBasketRequest is the Query/Basket request type.
Expand Down Expand Up @@ -201,7 +200,7 @@ message BasketBalanceInfo {

// QueryBasketFeesRequest is the Query/BasketFees request type.
// Since Revision 1
message QueryBasketFeesRequest { }
message QueryBasketFeesRequest {}

// QueryBasketFeesResponse is the Query/BasketFees response type.
// Since Revision 1
Expand Down
110 changes: 110 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 @@ -183,7 +185,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 @@ -196,6 +201,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 @@ -527,11 +557,33 @@ message QueryCreditTypesResponse {
// QueryParamsRequest is the Query/Params request type.
message QueryParamsRequest {}

// AllowedDenom represents the information for an allowed ask/bid denom.
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved
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 coin denoms allowed to use in the ask price of
// sell orders.
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved
//
// Since Revision 1
repeated AllowedDenomInfo allowed_denoms = 2;

}

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

// ClassCreatorInfo is the human-readable class creator information.
message ClassCreatorInfo {
// address is the address that is allowed to create credit classes
string address = 1;
}
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved

// 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;
}
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved

// QueryAllowedClassCreatorsResponse is the Query/AllowedClassCreators response
// type.
//
// Since Revision 1
message QueryAllowedClassCreatorsResponse {
// class_creators is the list of allowed credit class creators.
repeated ClassCreatorInfo class_creators = 1;
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved

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

// 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 is the state/AllowListEnabled type.
AllowListEnabled allowlist_enabled = 1;
}
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved

// 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"
];
}
3 changes: 1 addition & 2 deletions proto/regen/ecocredit/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ service Msg {
// AddClassCreator is a governance method that allows the addition of new
// address to the class creation allowlist.
// Since Revision 1
rpc AddClassCreator(MsgAddClassCreator)
returns (MsgAddClassCreatorResponse);
rpc AddClassCreator(MsgAddClassCreator) returns (MsgAddClassCreatorResponse);

// RemoveClassCreator is a governance method that removes
// address from the creation allowlist.
Expand Down
18 changes: 18 additions & 0 deletions x/ecocredit/basket/default.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package basket

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/regen-network/regen-ledger/x/ecocredit/core"
)

// DefaultBasketFees returns a default basket creation fees.
func DefaultBasketFees() BasketFees {
return BasketFees{
Fees: []*sdk.Coin{
{
Denom: sdk.DefaultBondDenom,
Amount: core.DefaultBasketFee,
},
},
}
}
Loading