Skip to content

Commit

Permalink
refactor(ecocredit): Update basket queries and curator address in sta…
Browse files Browse the repository at this point in the history
…te (#1056)

* refactor: update basket query responses

* chore: cleanup

* chore: review changes

* chore: cleanup

* chore: review changes

* chore: fix proto lint error

* post-merge fix

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
  • Loading branch information
aleem1314 and ryanchristo committed May 4, 2022
1 parent 4bece1c commit 9f915eb
Show file tree
Hide file tree
Showing 13 changed files with 3,192 additions and 295 deletions.
2,223 changes: 2,056 additions & 167 deletions api/regen/ecocredit/basket/v1/query.pulsar.go

Large diffs are not rendered by default.

36 changes: 19 additions & 17 deletions api/regen/ecocredit/basket/v1/state.pulsar.go

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

64 changes: 59 additions & 5 deletions proto/regen/ecocredit/basket/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package regen.ecocredit.basket.v1;
import "google/api/annotations.proto";
import "regen/ecocredit/basket/v1/state.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "regen/ecocredit/basket/v1/types.proto";

option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket";

Expand Down Expand Up @@ -46,10 +47,15 @@ message QueryBasketRequest {
// QueryBasketResponse is the Query/Basket response type.
message QueryBasketResponse {
// basket is the queried basket.
Basket basket = 1;

// Deprecated: This field is still populated and will be removed in the
// next version. Use basket_info instead.
Basket basket = 1 [ deprecated = true ];

// classes are the credit classes that can be deposited in the basket.
repeated string classes = 2;

// basket_info is the queried basket.
BasketInfo basket_info = 3;
}

// QueryBasketsRequest is the Query/Baskets request type.
Expand All @@ -61,10 +67,15 @@ message QueryBasketsRequest {
// QueryBasketsResponse is the Query/Baskets response type.
message QueryBasketsResponse {
// baskets are the fetched baskets.
repeated Basket baskets = 1;
// Deprecated: This field is still populated and will be removed in the
// next version. Use baskets_info instead.
repeated Basket baskets = 1 [deprecated=true];

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

// baskets_info are the fetched baskets.
repeated BasketInfo baskets_info = 3;
}

// QueryBasketBalancesRequest is the Query/BasketBalances request type.
Expand All @@ -79,10 +90,15 @@ message QueryBasketBalancesRequest {
// QueryBasketBalancesResponse is the Query/BasketBalances response type.
message QueryBasketBalancesResponse {
// balances is a list of credit balances in the basket.
repeated BasketBalance balances = 1;
// Deprecated: This field is still populated and will be removed in the
// next version. Use balances_info instead.
repeated BasketBalance balances = 1 [deprecated=true];

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

// balances_info is a list of credit balances in the basket.
repeated BasketBalanceInfo balances_info = 3;
}

// QueryBasketBalanceRequest is the Query/BasketBalance request type.
Expand All @@ -98,4 +114,42 @@ message QueryBasketBalanceRequest {
message QueryBasketBalanceResponse {
// balance is the amount of the queried credit batch in the basket.
string balance = 1;
}
}

// BasketInfo is the human-readable basket information.
message BasketInfo {
// basket_denom is the basket bank denom.
string basket_denom = 1;

// name is the unique name of the basket specified in MsgCreate. Basket
// names must be unique across all credit types and choices of exponent
// above and beyond the uniqueness constraint on basket_denom.
string name = 2;

// disable_auto_retire indicates whether or not the credits will be retired
// upon withdraw from the basket.
bool disable_auto_retire = 3;

// credit_type_abbrev is the abbreviation of the credit type this basket is
// able to hold.
string credit_type_abbrev = 4;

// date_criteria is the date criteria for batches admitted to the basket.
DateCriteria date_criteria = 5;

// exponent is the exponent for converting credits to/from basket tokens.
uint32 exponent = 6;

// curator is the address of the basket curator who is able to change certain
// basket settings.
string curator = 7;
}

// BasketBalanceInfo is the human-readable basket balance information.
message BasketBalanceInfo {
// batch_denom is the denom of the credit batch
string batch_denom = 1;

// balance is the amount of ecocredits held in the basket
string balance = 2;
}
2 changes: 1 addition & 1 deletion proto/regen/ecocredit/basket/v1/state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ message Basket {
// basket settings.
//
// Since Revision 1
string curator = 8;
bytes curator = 8;
}

// BasketClass describes a credit class that can be deposited in a basket.
Expand Down
Loading

0 comments on commit 9f915eb

Please sign in to comment.