-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: backport basket proto updates (#772)
* backporting proto * gen proto update * wip * update msg_create * add basket.name checks * add description check * chore: update msgs,tests * fix: cli and test * fix: put tests/impl * use ValidateCreditTypeAbbreviation * add ExponentToPrefix * compute prefix from exponent * update denom format * update prefix * update tests * extract denom creation to separate function * Update x/ecocredit/basket/msg_create.go Co-authored-by: Aaron Craelius <aaron@regen.network> Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com> Co-authored-by: Aaron Craelius <aaron@regen.network>
- Loading branch information
1 parent
df802ea
commit 1cb3728
Showing
20 changed files
with
600 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
syntax = "proto3"; | ||
|
||
package regen.ecocredit.basket.v1; | ||
|
||
import "regen/ecocredit/basket/v1/types.proto"; | ||
|
||
option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket"; | ||
|
||
// EventCreate is an event emitted when a basket is created. | ||
message EventCreate { | ||
|
||
// basket_denom is the basket bank denom. | ||
string basket_denom = 1; | ||
|
||
// curator is the address of the basket curator who is able to change certain | ||
// basket settings. | ||
string curator = 2; | ||
} | ||
|
||
// EventPut is an event emitted when credits are put into a basket in return | ||
// for basket tokens. | ||
message EventPut { | ||
|
||
// owner is the owner of the credits put into the basket. | ||
string owner = 1; | ||
|
||
// basket_denom is the basket bank denom that the credits were added to. | ||
string basket_denom = 2; | ||
|
||
// credits are the credits that were added to the basket. | ||
repeated BasketCredit credits = 3; | ||
|
||
// amount is the integer number of basket tokens converted from credits. | ||
string amount = 4; | ||
} | ||
|
||
// EventTake is an event emitted when credits are taken from a basket starting | ||
// from the oldest credits first. | ||
message EventTake { | ||
|
||
// owner is the owner of the credits taken from the basket. | ||
string owner = 1; | ||
|
||
// basket_denom is the basket bank denom that credits were taken from. | ||
string basket_denom = 2; | ||
|
||
// credits are the credits that were taken from the basket. | ||
repeated BasketCredit credits = 3; | ||
|
||
// amount is the integer number of basket tokens converted to credits. | ||
string amount = 4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
syntax = "proto3"; | ||
|
||
package regen.ecocredit.basket.v1; | ||
|
||
import "google/api/annotations.proto"; | ||
import "regen/ecocredit/basket/v1/state.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
|
||
option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket"; | ||
|
||
// Msg is the regen.ecocredit.basket.v1beta1 Query service. | ||
service Query { | ||
|
||
// Basket queries one basket by denom. | ||
rpc Basket(QueryBasketRequest) returns (QueryBasketResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/basket/v1/baskets/{basket_denom}"; | ||
} | ||
|
||
// Baskets lists all baskets in the ecocredit module. | ||
rpc Baskets(QueryBasketsRequest) returns (QueryBasketsResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/basket/v1/baskets"; | ||
} | ||
|
||
// BasketBalances lists the balance of each credit batch in the basket. | ||
rpc BasketBalances(QueryBasketBalancesRequest) returns (QueryBasketBalancesResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/basket/v1/baskets/{basket_denom}/balances"; | ||
} | ||
|
||
// BasketBalance queries the balance of a specific credit batch in the basket. | ||
rpc BasketBalance(QueryBasketBalanceRequest) returns (QueryBasketBalanceResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/basket/v1/baskets/{basket_denom}/balances/{batch_denom}"; | ||
} | ||
} | ||
|
||
// QueryBasketRequest is the Query/Basket request type. | ||
message QueryBasketRequest { | ||
// basket_denom represents the denom of the basket to query. | ||
string basket_denom = 1; | ||
} | ||
|
||
// QueryBasketResponse is the Query/Basket response type. | ||
message QueryBasketResponse { | ||
// basket is the queried basket. | ||
Basket basket = 1; | ||
} | ||
|
||
// QueryBasketsRequest is the Query/Baskets request type. | ||
message QueryBasketsRequest { | ||
// pagination defines an optional pagination for the request. | ||
cosmos.base.query.v1beta1.PageRequest pagination = 1; | ||
} | ||
|
||
// QueryBasketsResponse is the Query/Baskets response type. | ||
message QueryBasketsResponse { | ||
// baskets are the fetched baskets. | ||
repeated Basket baskets = 1; | ||
|
||
// pagination defines the pagination in the response. | ||
cosmos.base.query.v1beta1.PageResponse pagination = 2; | ||
} | ||
|
||
// QueryBasketBalancesRequest is the Query/BasketBalances request type. | ||
message QueryBasketBalancesRequest { | ||
// basket_denom is the denom of the basket. | ||
string basket_denom = 1; | ||
|
||
// pagination defines an optional pagination for the request. | ||
cosmos.base.query.v1beta1.PageRequest pagination = 2; | ||
} | ||
|
||
// QueryBasketBalancesResponse is the Query/BasketBalances response type. | ||
message QueryBasketBalancesResponse { | ||
// balances is a list of credit balances in the basket. | ||
repeated BasketBalance balances = 1; | ||
|
||
// pagination defines the pagination in the response. | ||
cosmos.base.query.v1beta1.PageResponse pagination = 2; | ||
} | ||
|
||
// QueryBasketBalanceRequest is the Query/BasketBalance request type. | ||
message QueryBasketBalanceRequest { | ||
// basket_denom is the denom of the basket. | ||
string basket_denom = 1; | ||
|
||
// batch_denom is the denom of the credit batch. | ||
string batch_denom = 2; | ||
} | ||
|
||
// QueryBasketBalanceResponse is the Query/BasketBalance response type. | ||
message QueryBasketBalanceResponse { | ||
// balance is the amount of the queried credit batch in the basket. | ||
string balance = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.