Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Feb 7, 2024
1 parent ea41f12 commit c3c15cd
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 55 deletions.
7 changes: 5 additions & 2 deletions proto/regen/ecocredit/v1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ message EventWithdrawProjectClass {

// class_id is the unique identifier of the class that was withdrawn from.
string class_id = 2;

// old_status is the old status of the project class relationship before withdrawal.
ProjectEnrollmentStatus old_status = 3;
}

// EventEvaluateProjectClass is emitted when a project class relationship is
Expand All @@ -301,10 +304,10 @@ message EventEvaluateProjectClass {
string class_id = 3;

// old_status is the old status of the project class relationship.
ProjectClassStatus old_status = 4;
ProjectEnrollmentStatus old_status = 4;

// new_status is the new status of the project class relationship.
ProjectClassStatus new_status = 5;
ProjectEnrollmentStatus new_status = 5;

// new_class_metadata is any new class metadata.
string new_class_metadata = 6;
Expand Down
36 changes: 19 additions & 17 deletions proto/regen/ecocredit/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,21 @@ service Query {
option (google.api.http).get = "/regen/ecocredit/v1/allowed-bridge-chains";
}

// ProjectClass queries information about a project credit class relationship.
// ProjectEnrollment queries information about a project's enrollment in a
// credit class.
//
// Since Revision 3
rpc ProjectClass(QueryProjectClassRequest) returns (QueryProjectClassResponse) {
rpc ProjectEnrollment(QueryProjectEnrollmentRequest) returns (QueryProjectEnrollmentResponse) {
option (google.api.http) = {
get : "/regen/ecocredit/v1/project/{project_id}/class/{project_id}"
get : "/regen/ecocredit/v1/project/{project_id}/enrollment/{class_id}"
};
}

// ProjectClasses queries all credit classes associated with a project.
rpc ProjectClasses(QueryProjectClassesRequest) returns (QueryProjectClassesResponse) {
// ProjectEnrollments queries all credit class enrollments associated with a
// project.
rpc ProjectEnrollments(QueryProjectEnrollmentsRequest) returns (QueryProjectEnrollmentsResponse) {
option (google.api.http) = {
get : "/regen/ecocredit/v1/project/{project_id}/class"
get : "/regen/ecocredit/v1/project/{project_id}/enrollment"
};
}
}
Expand Down Expand Up @@ -843,10 +845,10 @@ message QueryAllowedBridgeChainsResponse {
repeated string allowed_bridge_chains = 1;
}

// QueryProjectClassRequest is the Query/ProjectClass request type.
// QueryProjectEnrollmentRequest is the Query/ProjectEnrollment request type.
//
// Since Revision 3
message QueryProjectClassRequest {
message QueryProjectEnrollmentRequest {

// project_id is the unique identifier of the project to query.
string project_id = 1;
Expand All @@ -855,33 +857,33 @@ message QueryProjectClassRequest {
string class_id = 2;
}

// QueryProjectClassResponse is the Query/ProjectClass response type.
// QueryProjectEnrollmentResponse is the Query/ProjectEnrollment response type.
//
// Since Revision 3
message QueryProjectClassResponse {
message QueryProjectEnrollmentResponse {

// project_class is the fetched project class relationship.
ProjectClass project_class = 1;
ProjectEnrollment project_class = 1;
}

// QueryProjectClassesRequest is the Query/ProjectClasses request type.
// QueryProjectEnrollmentsRequest is the Query/ProjectEnrollments request type.
//
// Since Revision 3
message QueryProjectClassesRequest {
message QueryProjectEnrollmentsRequest {
// project_id is the unique identifier of the project to query.
string project_id = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryProjectClassesResponse is the Query/ProjectClasses response type.
// QueryProjectEnrollmentsResponse is the Query/ProjectEnrollments response type.
//
// Since Revision 3
message QueryProjectClassesResponse {
message QueryProjectEnrollmentsResponse {

// classes are the fetched credit classes.
repeated ClassInfo classes = 1;
// enrollments are the fetched project credit class enrollments.
repeated ProjectEnrollment enrollments = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
Expand Down
34 changes: 19 additions & 15 deletions proto/regen/ecocredit/v1/state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ message AllowedBridgeChain {
string chain_name = 1;
}

// ProjectClass stores the data a project - credit class relation.
message ProjectClass {
// ProjectEnrollment stores the data a project's enrollment in a credit class.
message ProjectEnrollment {
option (cosmos.orm.v1.table) = {
id : 17
primary_key : {fields : "project_key,class_key"}
Expand All @@ -404,8 +404,8 @@ message ProjectClass {
// for efficient lookups.
uint64 class_key = 3;

// status is the status of the relation.
ProjectClassStatus status = 4;
// status is the status of the enrollment.
ProjectEnrollmentStatus status = 4;

// project_metadata is any arbitrary metadata set by the project
// admin. This should primarily be used to store metadata regarding the project's
Expand All @@ -420,24 +420,28 @@ message ProjectClass {

// Application represents the evaluation status that a credit class issuer
// assigns to a credit class application.
enum ProjectClassStatus {
// PROJECT_CLASS_STATUS_UNSPECIFIED indicates that a credit class application
enum ProjectEnrollmentStatus {
// PROJECT_ENROLLMENT_STATUS_UNSPECIFIED indicates that a credit class application
// has been submitted but not evaluated.
PROJECT_CLASS_STATUS_UNSPECIFIED = 0;
PROJECT_ENROLLMENT_STATUS_UNSPECIFIED = 0;

// PROJECT_CLASS_STATUS_ACCEPTED indicates that the project has been
// PROJECT_ENROLLMENT_STATUS_ACCEPTED indicates that the project has been
// accepted into the credit class.
PROJECT_CLASS_STATUS_ACCEPTED = 1;
PROJECT_ENROLLMENT_STATUS_ACCEPTED = 1;

// PROJECT_CLASS_STATUS_CHANGES_REQUESTED indicates that an application to
// PROJECT_ENROLLMENT_STATUS_CHANGES_REQUESTED indicates that an application to
// a credit class has been reviewed and that changes to the application have
// been requested. It can also be used to indicate that a project within a credit
// class has had its status reassessed and that changes to the project are
// requested in order to continue in the credit class.
PROJECT_CLASS_STATUS_CHANGES_REQUESTED = 2;
PROJECT_ENROLLMENT_STATUS_CHANGES_REQUESTED = 2;

// PROJECT_CLASS_STATUS_REJECTED indicates that the application has been
// rejected and that the project will not be accepted into the credit class
// or that a project previously accepted has been removed from the credit class.
PROJECT_CLASS_STATUS_REJECTED = 3;
// PROJECT_ENROLLMENT_STATUS_REJECTED indicates that the application has been
// rejected and that the project will not be accepted into the credit class.
PROJECT_ENROLLMENT_STATUS_REJECTED = 3;

// PROJECT_ENROLLMENT_STATUS_TERMINATED indicates that the project has been
// terminated from the credit class. This status is used when a project was
// in the credit class but has been removed or completed.
PROJECT_ENROLLMENT_STATUS_TERMINATED = 4;
}
42 changes: 21 additions & 21 deletions proto/regen/ecocredit/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ service Msg {
rpc CreateUnregisteredProject(MsgCreateUnregisteredProject)
returns (MsgCreateUnregisteredProjectResponse);

// UpdateProjectClass creates a new project credit class application, updates
// UpdateProjectEnrollment creates a new project credit class application, updates
// an existing one or updates an existing relationship when changes are requested.
// A project may be enrolled in at most one credit class per credit type
// but can be enrolled in multiple credit classes across different credit
Expand All @@ -46,15 +46,15 @@ service Msg {
// to "changes requested".
//
// Since Revision 3
rpc UpdateProjectClass(MsgUpdateProjectClass)
returns (MsgUpdateProjectClassResponse);
rpc UpdateProjectEnrollment(MsgUpdateProjectEnrollment)
returns (MsgUpdateProjectEnrollmentResponse);

// WithdrawProjectClass withdraws a project from a credit class application
// WithdrawProjectEnrollment withdraws a project from a credit class application
// or enrollment unilaterally on the part of a project admin.
//
// Since Revision 3
rpc WithdrawProjectClass(MsgWithdrawProjectClass)
returns (MsgWithdrawProjectClassResponse);
rpc WithdrawProjectEnrollment(MsgWithdrawProjectEnrollment)
returns (MsgWithdrawProjectEnrollmentResponse);

// EvaluateProjectClass allows a credit class issuer to evaluate a project
// application or existing relationship, either approving, requesting changes to, or
Expand All @@ -67,8 +67,8 @@ service Msg {
// application the CreateProject method should be used instead.
//
// Since Revision 3
rpc EvaluateProjectClass(MsgEvaluateProjectClass)
returns (MsgEvaluateProjectClassResponse);
rpc EvaluateProjectEnrollment(MsgEvaluateProjectEnrollment)
returns (MsgEvaluateProjectEnrollmentResponse);

// CreateBatch creates a new batch of credits under the given project with a
// start and end date representing the monitoring period, a list of credits to
Expand Down Expand Up @@ -347,8 +347,8 @@ message MsgCreateUnregisteredProjectResponse {
string project_id = 1;
}

// MsgUpdateProjectClass is the Msg/UpdateProjectClass request type.
message MsgUpdateProjectClass {
// MsgUpdateProjectEnrollment is the Msg/UpdateProjectEnrollment request type.
message MsgUpdateProjectEnrollment {
option (cosmos.msg.v1.signer) = "project_admin";

// project_admin is the address of the account that is the admin of the
Expand All @@ -369,11 +369,11 @@ message MsgUpdateProjectClass {
string metadata = 4;
}

// MsgUpdateProjectClassResponse is the Msg/UpdateProjectClass response type.
message MsgUpdateProjectClassResponse {}
// MsgUpdateProjectEnrollmentResponse is the Msg/UpdateProjectEnrollment response type.
message MsgUpdateProjectEnrollmentResponse {}

// MsgWithdrawProjectClass is the Msg/WithdrawProjectClass request type.
message MsgWithdrawProjectClass {
// MsgWithdrawProjectEnrollment is the Msg/WithdrawProjectEnrollment request type.
message MsgWithdrawProjectEnrollment {
option (cosmos.msg.v1.signer) = "project_admin";

// project_admin is the address of the account that is the admin of the
Expand All @@ -389,11 +389,11 @@ message MsgWithdrawProjectClass {
string metadata = 3;
}

// MsgWithdrawProjectClassResponse is the Msg/WithdrawProjectClass response type.
message MsgWithdrawProjectClassResponse {}
// MsgWithdrawProjectEnrollmentResponse is the Msg/WithdrawProjectEnrollment response type.
message MsgWithdrawProjectEnrollmentResponse {}

// MsgEvaluateProjectClass is the Msg/EvaluateProjectClass request type.
message MsgEvaluateProjectClass {
// MsgEvaluateProjectEnrollment is the Msg/EvaluateProjectEnrollment request type.
message MsgEvaluateProjectEnrollment {
option (cosmos.msg.v1.signer) = "issuer";

// issuer is the address of the account that is the issuer of the credit class
Expand All @@ -404,16 +404,16 @@ message MsgEvaluateProjectClass {
uint64 application_id = 2;

// evaluation is the evaluation of the application.
ProjectClassStatus evaluation = 3;
ProjectEnrollmentStatus evaluation = 3;

// metadata is any optiopnal arbitrary string with a maximum length of 256 characters
// that includes or references the reason for the approving, requesting changes
// to, or rejecting the application.
string metadata = 4;
}

// MsgEvaluateProjectClassResponse is the Msg/EvaluateProjectClass response type.
message MsgEvaluateProjectClassResponse {}
// MsgEvaluateProjectEnrollmentResponse is the Msg/EvaluateProjectEnrollment response type.
message MsgEvaluateProjectEnrollmentResponse {}

// MsgCreateBatch is the Msg/CreateBatch request type.
message MsgCreateBatch {
Expand Down

0 comments on commit c3c15cd

Please sign in to comment.