-
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.
chore: reinstate ecocredit v1alpha1 (#694)
Co-authored-by: Aaron Craelius <aaron@regen.network>
- Loading branch information
1 parent
b7cd49a
commit 3ff0a1c
Showing
7 changed files
with
741 additions
and
3 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,105 @@ | ||
syntax = "proto3"; | ||
|
||
package regen.ecocredit.v1alpha1; | ||
|
||
option go_package = "github.com/regen-network/regen-ledger/x/ecocredit"; | ||
|
||
// EventCreateClass is an event emitted when a credit class is created. | ||
message EventCreateClass { | ||
|
||
// class_id is the unique ID of credit class. | ||
string class_id = 1; | ||
|
||
// admin is the admin of the credit class. | ||
string admin = 2; | ||
} | ||
|
||
// EventCreateBatch is an event emitted when a credit batch is created. | ||
message EventCreateBatch { | ||
|
||
// class_id is the unique ID of credit class. | ||
string class_id = 1; | ||
|
||
// batch_denom is the unique ID of credit batch. | ||
string batch_denom = 2; | ||
|
||
// issuer is the account address of the issuer of the credit batch. | ||
string issuer = 3; | ||
|
||
// total_amount is the total number of credits in the credit batch. | ||
string total_amount = 4; | ||
|
||
// start_date is the beginning of the period during which this credit batch | ||
// was quantified and verified. | ||
string start_date = 5; | ||
|
||
// end_date is the end of the period during which this credit batch was | ||
// quantified and verified. | ||
string end_date = 6; | ||
|
||
// project_location is the location of the project backing the credits in this | ||
// batch. Full documentation can be found in MsgCreateBatch.project_location. | ||
string project_location = 7; | ||
} | ||
|
||
// EventReceive is an event emitted when credits are received either upon | ||
// creation of a new batch or upon transfer. Each batch_denom created or | ||
// transferred will result in a separate EventReceive for easy indexing. | ||
message EventReceive { | ||
// sender is the sender of the credits in the case that this event is the | ||
// result of a transfer. It will not be set when credits are received at | ||
// initial issuance. | ||
string sender = 1; | ||
|
||
// recipient is the recipient of the credits | ||
string recipient = 2; | ||
|
||
// batch_denom is the unique ID of credit batch. | ||
string batch_denom = 3; | ||
|
||
// tradable_amount is the decimal number of tradable credits received. | ||
string tradable_amount = 4; | ||
|
||
// retired_amount is the decimal number of retired credits received. | ||
string retired_amount = 5; | ||
} | ||
|
||
// EventRetire is an event emitted when credits are retired. When credits are | ||
// retired from multiple batches in the same transaction, a separate event is | ||
// emitted for each batch_denom. This allows for easier indexing. | ||
message EventRetire { | ||
|
||
// retirer is the account which has done the "retiring". This will be the | ||
// account receiving credits in the case that credits were retired upon | ||
// issuance using Msg/CreateBatch or retired upon transfer using Msg/Send. | ||
string retirer = 1; | ||
|
||
// batch_denom is the unique ID of credit batch. | ||
string batch_denom = 2; | ||
|
||
// amount is the decimal number of credits that have been retired. | ||
string amount = 3; | ||
|
||
// location is the location of the beneficiary or buyer of the retired | ||
// credits. It is a string of the form | ||
// <country-code>[-<sub-national-code>[ <postal-code>]], with the first two | ||
// fields conforming to ISO 3166-2, and postal-code being up to 64 | ||
// alphanumeric characters. | ||
string location = 4; | ||
} | ||
|
||
// EventCancel is an event emitted when credits are cancelled. When credits are | ||
// cancelled from multiple batches in the same transaction, a separate event is | ||
// emitted for each batch_denom. This allows for easier indexing. | ||
message EventCancel { | ||
|
||
// canceller is the account which has cancelled the credits, which should be | ||
// the holder of the credits. | ||
string canceller = 1; | ||
|
||
// batch_denom is the unique ID of credit batch. | ||
string batch_denom = 2; | ||
|
||
// amount is the decimal number of credits that have been cancelled. | ||
string amount = 3; | ||
} |
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,57 @@ | ||
syntax = "proto3"; | ||
package regen.ecocredit.v1alpha1; | ||
|
||
import "regen/ecocredit/v1alpha1/types.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/regen-network/regen-ledger/x/ecocredit"; | ||
|
||
// GenesisState defines ecocredit module's genesis state. | ||
message GenesisState { | ||
// Params contains the updateable global parameters for use with the x/params | ||
// module | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
|
||
// class_info is the list of credit class info. | ||
repeated ClassInfo class_info = 2; | ||
|
||
// batch_info is the list of credit batch info. | ||
repeated BatchInfo batch_info = 3; | ||
|
||
// sequences is the list of credit type sequence. | ||
repeated CreditTypeSeq sequences = 4; | ||
|
||
// balances is the list of credit batch tradable/retired units. | ||
repeated Balance balances = 5; | ||
|
||
// supplies is the list of credit batch tradable/retired supply. | ||
repeated Supply supplies = 6; | ||
} | ||
|
||
// Balance represents tradable or retired units of a credit batch with an | ||
// account address, batch_denom, and balance. | ||
message Balance { | ||
// address is the account address of the account holding credits. | ||
string address = 1; | ||
|
||
// batch_denom is the unique ID of the credit batch. | ||
string batch_denom = 2; | ||
|
||
// tradable_balance is the tradable balance of the credit batch. | ||
string tradable_balance = 3; | ||
|
||
// retired_balance is the retired balance of the credit batch. | ||
string retired_balance = 4; | ||
} | ||
|
||
// Supply represents a tradable or retired supply of a credit batch. | ||
message Supply { | ||
// batch_denom is the unique ID of the credit batch. | ||
string batch_denom = 1; | ||
|
||
// tradable_supply is the tradable supply of the credit batch. | ||
string tradable_supply = 2; | ||
|
||
// retired_supply is the retired supply of the credit batch. | ||
string retired_supply = 3; | ||
} |
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,179 @@ | ||
syntax = "proto3"; | ||
|
||
package regen.ecocredit.v1alpha1; | ||
import "google/api/annotations.proto"; | ||
import "regen/ecocredit/v1alpha1/types.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
|
||
option go_package = "github.com/regen-network/regen-ledger/x/ecocredit"; | ||
|
||
// Msg is the regen.ecocredit.v1alpha1 Query service. | ||
service Query { | ||
// Classes queries for all credit classes with pagination. | ||
rpc Classes(QueryClassesRequest) returns (QueryClassesResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/classes"; | ||
} | ||
|
||
// ClassInfo queries for information on a credit class. | ||
rpc ClassInfo(QueryClassInfoRequest) returns (QueryClassInfoResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/classes/{class_id}"; | ||
} | ||
|
||
// Batches queries for all batches in the given credit class with pagination. | ||
rpc Batches(QueryBatchesRequest) returns (QueryBatchesResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/classes/{class_id}/batches"; | ||
} | ||
|
||
// BatchInfo queries for information on a credit batch. | ||
rpc BatchInfo(QueryBatchInfoRequest) returns (QueryBatchInfoResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/batches/{batch_denom}"; | ||
} | ||
|
||
// Balance queries the balance (both tradable and retired) of a given credit | ||
// batch for a given account. | ||
rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/batches/{batch_denom}/balance/{account}"; | ||
} | ||
|
||
// Supply queries the tradable and retired supply of a credit batch. | ||
rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/batches/{batch_denom}/supply"; | ||
} | ||
|
||
// CreditTypes returns the list of allowed types that credit classes can have. | ||
// See Types/CreditType for more details. | ||
rpc CreditTypes(QueryCreditTypesRequest) returns (QueryCreditTypesResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/credit-types"; | ||
} | ||
|
||
// Params queries the ecocredit module parameters. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = | ||
"/regen/ecocredit/v1alpha1/params"; | ||
} | ||
} | ||
|
||
// QueryParamsRequest is the Query/Params request type. | ||
message QueryParamsRequest {} | ||
|
||
// QueryParamsResponse is the Query/Params response type. | ||
message QueryParamsResponse { | ||
// params defines the parameters of the ecocredit module. | ||
Params params = 1; | ||
} | ||
|
||
// QueryClassesRequest is the Query/Classes request type. | ||
message QueryClassesRequest { | ||
// pagination defines an optional pagination for the request. | ||
cosmos.base.query.v1beta1.PageRequest pagination = 1; | ||
} | ||
|
||
// QueryClassesResponse is the Query/Classes response type. | ||
message QueryClassesResponse { | ||
// classes are the fetched credit classes. | ||
repeated ClassInfo classes = 1; | ||
|
||
// pagination defines the pagination in the response. | ||
cosmos.base.query.v1beta1.PageResponse pagination = 2; | ||
} | ||
|
||
// QueryClassInfoRequest is the Query/ClassInfo request type. | ||
message QueryClassInfoRequest { | ||
|
||
// class_id is the unique ID of credit class to query. | ||
string class_id = 1; | ||
} | ||
|
||
// QueryClassInfoResponse is the Query/ClassInfo request type. | ||
message QueryClassInfoResponse { | ||
|
||
// info is the ClassInfo for the credit class. | ||
ClassInfo info = 1; | ||
} | ||
|
||
// QueryBatchesRequest is the Query/Batches request type. | ||
message QueryBatchesRequest { | ||
// class_id is the unique ID of the credit class to query. | ||
string class_id = 1; | ||
|
||
// pagination defines an optional pagination for the request. | ||
cosmos.base.query.v1beta1.PageRequest pagination = 2; | ||
} | ||
|
||
// QueryBatchesResponse is the Query/Batches response type. | ||
message QueryBatchesResponse { | ||
// batches are the fetched credit batches within the class. | ||
repeated BatchInfo batches = 1; | ||
|
||
// pagination defines the pagination in the response. | ||
cosmos.base.query.v1beta1.PageResponse pagination = 2; | ||
} | ||
|
||
// QueryBatchInfoRequest is the Query/BatchInfo request type. | ||
message QueryBatchInfoRequest { | ||
|
||
// batch_denom is the unique ID of credit batch to query. | ||
string batch_denom = 1; | ||
} | ||
|
||
// QueryBatchInfoResponse is the Query/BatchInfo response type. | ||
message QueryBatchInfoResponse { | ||
|
||
// info is the BatchInfo for the credit batch. | ||
BatchInfo info = 1; | ||
} | ||
|
||
// QueryBalanceRequest is the Query/Balance request type. | ||
message QueryBalanceRequest { | ||
|
||
// account is the address of the account whose balance is being queried. | ||
string account = 1; | ||
|
||
// batch_denom is the unique ID of credit batch balance to query. | ||
string batch_denom = 2; | ||
} | ||
|
||
// QueryBalanceResponse is the Query/Balance response type. | ||
message QueryBalanceResponse { | ||
|
||
// tradable_amount is the decimal number of tradable credits. | ||
string tradable_amount = 1; | ||
|
||
// retired_amount is the decimal number of retired credits. | ||
string retired_amount = 2; | ||
} | ||
|
||
// QuerySupplyRequest is the Query/Supply request type. | ||
message QuerySupplyRequest { | ||
|
||
// batch_denom is the unique ID of credit batch to query. | ||
string batch_denom = 1; | ||
} | ||
|
||
// QuerySupplyResponse is the Query/Supply response type. | ||
message QuerySupplyResponse { | ||
|
||
// tradable_supply is the decimal number of tradable credits in the batch | ||
// supply. | ||
string tradable_supply = 1; | ||
|
||
// retired_supply is the decimal number of retired credits in the batch | ||
// supply. | ||
string retired_supply = 2; | ||
} | ||
|
||
// QueryCreditTypesRequest is the Query/Credit_Types request type | ||
message QueryCreditTypesRequest {} | ||
|
||
// QueryCreditTypesRequest is the Query/Credit_Types response type | ||
message QueryCreditTypesResponse { | ||
// list of credit types | ||
repeated CreditType credit_types = 1; | ||
} |
Oops, something went wrong.