Skip to content

Commit

Permalink
feat(x/ecocredit)!: support rolling date windows (#744)
Browse files Browse the repository at this point in the history
* feat(x/ecocredit)!: support rolling date windows

* update types.proto

* Update proto/regen/ecocredit/basket/v1/state.proto

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>

* Update proto/regen/ecocredit/basket/v1/tx.proto

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>

* chore: proto-gen

Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 10, 2022
1 parent 36ee01b commit cb437e4
Show file tree
Hide file tree
Showing 9 changed files with 1,436 additions and 396 deletions.
186 changes: 95 additions & 91 deletions api/regen/ecocredit/basket/v1/state.pulsar.go

Large diffs are not rendered by default.

283 changes: 140 additions & 143 deletions api/regen/ecocredit/basket/v1/tx.pulsar.go

Large diffs are not rendered by default.

752 changes: 722 additions & 30 deletions api/regen/ecocredit/basket/v1/types.pulsar.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions proto/regen/ecocredit/basket/v1/state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package regen.ecocredit.basket.v1;

import "cosmos/orm/v1alpha1/orm.proto";
import "google/protobuf/timestamp.proto";
import "regen/ecocredit/basket/v1/types.proto";

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

Expand All @@ -28,9 +29,8 @@ message Basket {
// credit_type_name is the name of the credit type this basket is able to hold.
string credit_type_name = 4;

// min_start_date is the earliest start date for batches of credits allowed
// into the basket.
google.protobuf.Timestamp min_start_date = 5;
// 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;
Expand Down
6 changes: 2 additions & 4 deletions proto/regen/ecocredit/basket/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package regen.ecocredit.basket.v1;
option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket";

import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "regen/ecocredit/basket/v1/types.proto";
import "cosmos/base/v1beta1/coin.proto";

Expand Down Expand Up @@ -58,9 +57,8 @@ message MsgCreate {
// allowed_classes are the credit classes allowed to be put in the basket
repeated string allowed_classes = 7;

// min_start_date is the earliest start date for batches of credits allowed
// into the basket.
google.protobuf.Timestamp min_start_date = 8;
// date_criteria is the date criteria for batches admitted to the basket.
DateCriteria date_criteria = 8;

// fee is the fee that the curator will pay to create the basket. It must be
// >= the required Params.basket_creation_fee. We include the fee explicitly
Expand Down
20 changes: 20 additions & 0 deletions proto/regen/ecocredit/basket/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ package regen.ecocredit.basket.v1;

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

import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";

// BasketCredit represents the information for a credit batch inside a basket.
message BasketCredit {

Expand All @@ -15,3 +18,20 @@ message BasketCredit {
// credit type for this batch.
string amount = 2;
}

// DateCriteria represents a basket credit batch date criteria.
message DateCriteria {

// sum is the oneof representing the date criteria.
oneof sum {
// min_start_date is the earliest start date for batches of credits allowed
// into the basket.
google.protobuf.Timestamp min_start_date = 1;

// start_date_window is a duration of time measured into the past which sets
// a cutoff for batch start dates when adding new credits to the basket.
// Based on the current block timestamp, credits whose start date is before
// `block_timestamp - batch_date_window` will not be allowed into the basket.
google.protobuf.Duration start_date_window = 2;
}
}
93 changes: 47 additions & 46 deletions x/ecocredit/basket/state.pb.go

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

Loading

0 comments on commit cb437e4

Please sign in to comment.