diff --git a/go.mod b/go.mod index 56292ae8ba..2c37c540fd 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.14 github.com/tendermint/tm-db v0.6.6 - golang.org/x/crypto v0.0.0-20220209155544-dad33157f4bf // indirect - google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068 // indirect + golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 // indirect + google.golang.org/genproto v0.0.0-20220210181026-6fee9acbd336 // indirect ) require ( diff --git a/go.sum b/go.sum index a68e11ced7..fa255673cc 100644 --- a/go.sum +++ b/go.sum @@ -1152,8 +1152,8 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220209155544-dad33157f4bf h1:gdgmgieTI2lLaGI2N+xEiaCMUgo2XFmAS0rlF8HZoso= -golang.org/x/crypto v0.0.0-20220209155544-dad33157f4bf/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 h1:XdAboW3BNMv9ocSCOk/u1MFioZGzCNkiJZ19v9Oe3Ig= +golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1564,8 +1564,8 @@ google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068 h1:pwzFiZfBTH/GjBWz1BcDwMBaHBo8mZvpLa7eBKJpFAk= -google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220210181026-6fee9acbd336 h1:RK2ysGpQApbI6U7xn+ROT2rrm08lE/t8AcGqG8XI1CY= +google.golang.org/genproto v0.0.0-20220210181026-6fee9acbd336/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/proto/regen/ecocredit/basket/v1/tx.proto b/proto/regen/ecocredit/basket/v1/tx.proto index 0bb479b168..15ebca68b4 100644 --- a/proto/regen/ecocredit/basket/v1/tx.proto +++ b/proto/regen/ecocredit/basket/v1/tx.proto @@ -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"; @@ -39,8 +38,8 @@ message MsgCreate { // exponent is the exponent that will be used for converting credits to basket // tokens and for bank denom metadata. It also limits the precision of // credit amounts when putting credits into a basket. An exponent of 6 will - // mean that 10^6 units of a basket token will be issued for 1.0 credits and that - // this should be displayed as one unit in user interfaces. It also means + // mean that 10^6 units of a basket token will be issued for 1.0 credits and + // that this should be displayed as one unit in user interfaces. It also means // that the maximum precision of credit amounts is 6 decimal places so that // the need to round is eliminated. The exponent must be >= the precision of // the credit type at the time the basket is created. @@ -59,9 +58,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. Required. - 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 diff --git a/proto/regen/ecocredit/basket/v1/types.proto b/proto/regen/ecocredit/basket/v1/types.proto index b2d5143c41..b61647b85f 100644 --- a/proto/regen/ecocredit/basket/v1/types.proto +++ b/proto/regen/ecocredit/basket/v1/types.proto @@ -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 { @@ -15,3 +18,21 @@ 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; + } +} diff --git a/x/basket/spec/protobuf.md b/x/basket/spec/protobuf.md index d0204ae4bc..3d67a8d288 100644 --- a/x/basket/spec/protobuf.md +++ b/x/basket/spec/protobuf.md @@ -6,6 +6,7 @@ - [regen/ecocredit/basket/v1/types.proto](#regen/ecocredit/basket/v1/types.proto) - [BasketCredit](#regen.ecocredit.basket.v1.BasketCredit) + - [DateCriteria](#regen.ecocredit.basket.v1.DateCriteria) - [regen/ecocredit/basket/v1/tx.proto](#regen/ecocredit/basket/v1/tx.proto) - [MsgCreate](#regen.ecocredit.basket.v1.MsgCreate) @@ -43,6 +44,22 @@ BasketCredit represents the information for a credit batch inside a basket. + + + +### DateCriteria +DateCriteria represents a basket credit batch date criteria. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| min_start_date | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | min_start_date is the earliest start date for batches of credits allowed into the basket. | +| start_date_window | [google.protobuf.Duration](#google.protobuf.Duration) | | 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. | + + + + + @@ -71,11 +88,11 @@ MsgCreateBasket is the Msg/CreateBasket request type. | curator | [string](#string) | | curator is the address of the basket curator who is able to change certain basket settings. | | name | [string](#string) | | name will be used to create a bank denom for this basket token. | | display_name | [string](#string) | | display_name will be used to create a bank Metadata display name for this basket token. | -| exponent | [uint32](#uint32) | | exponent is the exponent that will be used for converting credits to basket tokens and for bank denom metadata. An exponent of 6 will mean that 10^6 units of a basket token will be issued for 1.0 credits and that this should be displayed as one unit in user interfaces. The exponent must be >= the precision of the credit type to minimize the need for rounding (rounding may still be needed if the precision changes to be great than the exponent). | +| exponent | [uint32](#uint32) | | exponent is the exponent that will be used for converting credits to basket tokens and for bank denom metadata. It also limits the precision of credit amounts when putting credits into a basket. An exponent of 6 will mean that 10^6 units of a basket token will be issued for 1.0 credits and that this should be displayed as one unit in user interfaces. It also means that the maximum precision of credit amounts is 6 decimal places so that the need to round is eliminated. The exponent must be >= the precision of the credit type at the time the basket is created. | | disable_auto_retire | [bool](#bool) | | disable_auto_retire allows auto-retirement to be disabled. The credits will be auto-retired if disable_auto_retire is false unless the credits were previously put into the basket by the address picking them from the basket, in which case they will remain tradable. | | credit_type_name | [string](#string) | | credit_type_name filters against credits from this credit type name. | | allowed_classes | [string](#string) | repeated | allowed_classes are the credit classes allowed to be put in the basket | -| min_start_date | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | min_start_date is the earliest start date for batches of credits allowed into the basket. | +| date_criteria | [DateCriteria](#regen.ecocredit.basket.v1.DateCriteria) | | date_criteria is the date criteria for batches admitted to the basket. | | fee | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | 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 here so that the curator explicitly acknowledges paying this fee and is not surprised to learn that the paid a big fee and didn't know beforehand. | diff --git a/x/ecocredit/basket/msg_create.go b/x/ecocredit/basket/msg_create.go index 5705acd154..2580a0f207 100644 --- a/x/ecocredit/basket/msg_create.go +++ b/x/ecocredit/basket/msg_create.go @@ -16,7 +16,9 @@ const nameMaxLen = 32 const displayNameMinLen = 3 const displayNameMaxLen = 32 const exponentMax = 32 -const creditTNameMaxLen = 32 +const creditNameMaxLen = 32 + +var errBadReq = sdkerrors.ErrInvalidRequest // ValidateBasic does a stateless sanity check on the provided data. func (m MsgCreate) ValidateBasic() error { @@ -26,34 +28,32 @@ func (m MsgCreate) ValidateBasic() error { // TODO: add proper validation once we will have proper requirements. // https://github.com/regen-network/regen-ledger/issues/732 if m.Name == "" || len(m.Name) > nameMaxLen { - return sdkerrors.ErrInvalidRequest.Wrap("name must not be empty and must not be longer than 32 characters long") + return errBadReq.Wrapf("name must not be empty and must not be longer than %d characters long", nameMaxLen) } if len(m.DisplayName) < displayNameMinLen || len(m.DisplayName) > displayNameMaxLen { - return sdkerrors.ErrInvalidRequest.Wrapf("display_name must be between %d and %d characters long", displayNameMinLen, displayNameMaxLen) + return errBadReq.Wrapf("display_name must be between %d and %d characters long", displayNameMinLen, displayNameMaxLen) } if m.Exponent > exponentMax { - return sdkerrors.ErrInvalidRequest.Wrapf("exponent must not be bigger than %d", exponentMax) + return errBadReq.Wrapf("exponent must not be bigger than %d", exponentMax) } if m.CreditTypeName == "" { - return sdkerrors.ErrInvalidRequest.Wrap("credit_type_name must be defined") + return errBadReq.Wrap("credit_type_name must be defined") } - if len(m.CreditTypeName) > creditTNameMaxLen { - return sdkerrors.ErrInvalidRequest.Wrapf("credit_type_name must not be longer than %d", creditTNameMaxLen) + if len(m.CreditTypeName) > creditNameMaxLen { + return errBadReq.Wrapf("credit_type_name must not be longer than %d", creditNameMaxLen) + } + if err := validateDateCriteria(m.DateCriteria); err != nil { + return err } - if len(m.AllowedClasses) == 0 { - return sdkerrors.ErrInvalidRequest.Wrap("allowed_classes is required") + return errBadReq.Wrap("allowed_classes is required") } for i := range m.AllowedClasses { if m.AllowedClasses[i] == "" { - return sdkerrors.ErrInvalidRequest.Wrapf("allowed_classes[%d] must be defined", i) + return errBadReq.Wrapf("allowed_classes[%d] must be defined", i) } } - if err := m.Fee.Validate(); err != nil { - return err - } - - return nil + return m.Fee.Validate() } // Validate additional validation with access to the state data. @@ -78,3 +78,21 @@ func (m MsgCreate) Route() string { return sdk.MsgTypeURL(&m) } // Type Implements LegacyMsg. func (m MsgCreate) Type() string { return sdk.MsgTypeURL(&m) } + +func validateDateCriteria(d *DateCriteria) error { + if d == nil { + return nil + } + if x := d.GetMinStartDate(); x != nil { + if x.Seconds < -2208992400 { // batch older than 1900-01-01 is an obvious error + return errBadReq.Wrap("date_criteria.min_start_date must be after 1900-01-01") + } + } else if x := d.GetStartDateWindow(); x != nil { + if x.Seconds < 24*3600 { + return errBadReq.Wrap("date_criteria.start_date_window must be at least 1 day") + } + } else { + return errBadReq.Wrapf("unsupported date_criteria value %t", d) + } + return nil +} diff --git a/x/ecocredit/basket/msg_create_test.go b/x/ecocredit/basket/msg_create_test.go index 6ce5b202ca..002125484b 100644 --- a/x/ecocredit/basket/msg_create_test.go +++ b/x/ecocredit/basket/msg_create_test.go @@ -1,8 +1,8 @@ package basket import ( - "fmt" "testing" + "time" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -26,45 +26,104 @@ func TestMsgCreateValidateBasic(t *testing.T) { name := randstr.String(nameMaxLen) dName := randstr.String((displayNameMaxLen + displayNameMinLen) / 2) creditName := randstr.String(10) - start := gogotypes.TimestampNow() + start := &DateCriteria{&DateCriteria_MinStartDate{gogotypes.TimestampNow()}} + classes := []string{"eco_class1"} tcs := []struct { + id string msg MsgCreate err string }{ - {MsgCreate{Curator: "wrong"}, "malformed curator address"}, - {MsgCreate{Curator: a, Name: ""}, "name must not be empty"}, - {MsgCreate{Curator: a, Name: randstr.String(nameMaxLen + 1)}, "name must not be empty and must not be longer than"}, - {MsgCreate{Curator: a, Name: name, DisplayName: ""}, "display_name must be between"}, - {MsgCreate{Curator: a, Name: name, DisplayName: randstr.String(displayNameMaxLen + 1)}, "display_name must be between"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax + 1}, "exponent must not be bigger than"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax}, + {"curator-1", + MsgCreate{Curator: "wrong"}, + "malformed curator address"}, + {"name-1", + MsgCreate{Curator: a, Name: ""}, "name must not be empty"}, + {"name-2", + MsgCreate{Curator: a, Name: randstr.String(nameMaxLen + 1)}, + "name must not be empty and must not be longer than"}, + {"name-3", + MsgCreate{Curator: a, Name: name, DisplayName: ""}, + "display_name must be between"}, + {"name-4", + MsgCreate{Curator: a, Name: name, DisplayName: randstr.String(displayNameMaxLen + 1)}, + "display_name must be between"}, + {"exponent-1", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax + 1}, + "exponent must not be bigger than"}, + {"credity_type-1", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax}, "credit_type_name must be defined"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: randstr.String(creditTNameMaxLen + 1)}, + {"credity_type-2", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: randstr.String(creditNameMaxLen + 1)}, "credit_type_name must not be longer"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, MinStartDate: start}, + {"date_criteria-1", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, DateCriteria: &DateCriteria{}}, + "unsupported date_criteria value"}, + {"allowed_classes-1", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, DateCriteria: start}, "allowed_classes is required"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, MinStartDate: start, AllowedClasses: []string{"class1", ""}}, + {"allowed_classes-2", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, DateCriteria: start, AllowedClasses: []string{"class1", ""}}, "allowed_classes[1] must be defined"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, MinStartDate: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{Denom: "1a"}}}, + {"fee-1", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, DateCriteria: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{Denom: "1a"}}}, "invalid denom"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, MinStartDate: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{"aa", sdk.NewInt(-1)}}}, + {"fee-2", MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: exponentMax, CreditTypeName: creditName, DateCriteria: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{"aa", sdk.NewInt(-1)}}}, "invalid denom"}, - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: 0, CreditTypeName: creditName, MinStartDate: start, AllowedClasses: classes}, ""}, - // nil min_start_time is also OK - {MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: 0, CreditTypeName: creditName, MinStartDate: nil, AllowedClasses: classes}, ""}, + {"good-1-fees-not-required", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: 0, CreditTypeName: creditName, DateCriteria: start, AllowedClasses: classes}, ""}, + {"good-date-criteria-not-required", + MsgCreate{Curator: a, Name: name, DisplayName: dName, Exponent: 6, CreditTypeName: creditName, DateCriteria: nil, AllowedClasses: classes, Fee: sdk.Coins{sdk.NewInt64Coin("regen", 1)}}, ""}, } - for i, tc := range tcs { - t.Run(fmt.Sprint("test-", i), func(t *testing.T) { + for _, tc := range tcs { + t.Run(tc.id, func(t *testing.T) { err := tc.msg.ValidateBasic() errorMatches(t, err, tc.err) }) } } +func TestMsgCreateValidateDateCriteria(t *testing.T) { + tcs := []struct { + id string + d DateCriteria + err string + }{ + {"nil-min_start_date", + DateCriteria{&DateCriteria_MinStartDate{nil}}, + "unsupported date_criteria value"}, + {"bad-min_start_date", + DateCriteria{&DateCriteria_MinStartDate{ + &gogotypes.Timestamp{Seconds: time.Date(1400, 1, 1, 0, 0, 0, 0, time.UTC).Unix()}}}, + "date_criteria.min_start_date must be after"}, + {"nil-start_date_window", + DateCriteria{&DateCriteria_StartDateWindow{}}, + "unsupported date_criteria value"}, + {"nil-start_date_window", + DateCriteria{&DateCriteria_StartDateWindow{ + &gogotypes.Duration{Seconds: 3600}}}, + "date_criteria.start_date_window must be at least"}, + + {"good-min_start_date", + DateCriteria{&DateCriteria_MinStartDate{gogotypes.TimestampNow()}}, + ""}, + {"good-start_date_window", + DateCriteria{&DateCriteria_StartDateWindow{ + &gogotypes.Duration{Seconds: 3600 * 24 * 2}}}, + ""}, + } + for _, tc := range tcs { + t.Run(tc.id, func(t *testing.T) { + err := validateDateCriteria(&tc.d) + errorMatches(t, err, tc.err) + }) + } +} + func TestMsgCreateGetSigners(t *testing.T) { _, _, addr1 := testdata.KeyTestPubAddr() m := MsgCreate{Curator: addr1.String(), Name: "name", Exponent: 2} diff --git a/x/ecocredit/basket/msg_put.go b/x/ecocredit/basket/msg_put.go index acbfdbda39..10118d8e8e 100644 --- a/x/ecocredit/basket/msg_put.go +++ b/x/ecocredit/basket/msg_put.go @@ -10,14 +10,18 @@ import ( var _ legacytx.LegacyMsg = &MsgPut{} +// Route implements LegacyMsg. func (m MsgPut) Route() string { return sdk.MsgTypeURL(&m) } +// Type implements LegacyMsg. func (m MsgPut) Type() string { return sdk.MsgTypeURL(&m) } +// GetSignBytes implements LegacyMsg. func (m MsgPut) GetSignBytes() []byte { return sdk.MustSortJSON(ecocredit.ModuleCdc.MustMarshalJSON(&m)) } +// ValidateBasic does a stateless sanity check on the provided data. func (m MsgPut) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Owner); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf(err.Error()) @@ -41,6 +45,7 @@ func (m MsgPut) ValidateBasic() error { return nil } +// GetSigners returns the expected signers for MsgCreate. func (m MsgPut) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Owner) return []sdk.AccAddress{addr} diff --git a/x/ecocredit/basket/msg_take.go b/x/ecocredit/basket/msg_take.go index 39b2e7ec23..b67f5c038c 100644 --- a/x/ecocredit/basket/msg_take.go +++ b/x/ecocredit/basket/msg_take.go @@ -12,13 +12,13 @@ var ( _ legacytx.LegacyMsg = &MsgTake{} ) -// Route Implements LegacyMsg. +// Route implements LegacyMsg. func (m MsgTake) Route() string { return sdk.MsgTypeURL(&m) } -// Type Implements LegacyMsg. +// Type implements LegacyMsg. func (m MsgTake) Type() string { return sdk.MsgTypeURL(&m) } -// GetSignBytes Implements LegacyMsg. +// GetSignBytes implements LegacyMsg. func (m MsgTake) GetSignBytes() []byte { return sdk.MustSortJSON(ecocredit.ModuleCdc.MustMarshalJSON(&m)) } diff --git a/x/ecocredit/basket/state.pb.go b/x/ecocredit/basket/state.pb.go index 57df890eca..ae585a4f59 100644 --- a/x/ecocredit/basket/state.pb.go +++ b/x/ecocredit/basket/state.pb.go @@ -35,9 +35,8 @@ type Basket struct { DisableAutoRetire bool `protobuf:"varint,3,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` // credit_type_name is the name of the credit type this basket is able to hold. CreditTypeName string `protobuf:"bytes,4,opt,name=credit_type_name,json=creditTypeName,proto3" json:"credit_type_name,omitempty"` - // min_start_date is the earliest start date for batches of credits allowed - // into the basket. - MinStartDate *types.Timestamp `protobuf:"bytes,5,opt,name=min_start_date,json=minStartDate,proto3" json:"min_start_date,omitempty"` + // date_criteria is the date criteria for batches admitted to the basket. + DateCriteria *DateCriteria `protobuf:"bytes,5,opt,name=date_criteria,json=dateCriteria,proto3" json:"date_criteria,omitempty"` // exponent is the exponent for converting credits to/from basket tokens. Exponent uint32 `protobuf:"varint,6,opt,name=exponent,proto3" json:"exponent,omitempty"` } @@ -103,9 +102,9 @@ func (m *Basket) GetCreditTypeName() string { return "" } -func (m *Basket) GetMinStartDate() *types.Timestamp { +func (m *Basket) GetDateCriteria() *DateCriteria { if m != nil { - return m.MinStartDate + return m.DateCriteria } return nil } @@ -257,39 +256,41 @@ func init() { } var fileDescriptor_c416a19075224f85 = []byte{ - // 512 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x41, 0x6f, 0xd3, 0x4c, - 0x10, 0xcd, 0x26, 0xf9, 0xd2, 0x64, 0xd2, 0x46, 0xf9, 0x96, 0x22, 0xb6, 0x41, 0xb8, 0x21, 0x02, - 0xc9, 0x07, 0xb0, 0x15, 0x38, 0x80, 0x72, 0x82, 0x90, 0x4b, 0x2f, 0x1c, 0x4c, 0x4f, 0x5c, 0xac, - 0xb5, 0x3d, 0x24, 0x56, 0xbd, 0x5e, 0xcb, 0xde, 0x84, 0xf6, 0x4f, 0x20, 0xae, 0x5c, 0xf8, 0x3d, - 0x1c, 0x2b, 0x71, 0xe1, 0x88, 0x12, 0x89, 0x1f, 0xc0, 0x2f, 0x40, 0xde, 0x4d, 0xdc, 0x56, 0x95, - 0xe0, 0xf8, 0x66, 0xde, 0xcc, 0xdb, 0xf7, 0xc6, 0x86, 0xc7, 0x39, 0xce, 0x31, 0x75, 0x31, 0x94, - 0x61, 0x8e, 0x51, 0xac, 0xdc, 0x80, 0x17, 0x67, 0xa8, 0xdc, 0xd5, 0xd8, 0x2d, 0x14, 0x57, 0xe8, - 0x64, 0xb9, 0x54, 0x92, 0x1e, 0x69, 0x9a, 0x53, 0xd1, 0x1c, 0x43, 0x73, 0x56, 0xe3, 0xc1, 0x83, - 0x50, 0x16, 0x42, 0x16, 0xae, 0xcc, 0x85, 0xbb, 0x1a, 0xf3, 0x24, 0x5b, 0xf0, 0x71, 0x09, 0xcc, - 0xe4, 0xe0, 0x78, 0x2e, 0xe5, 0x3c, 0x41, 0x57, 0xa3, 0x60, 0xf9, 0xc1, 0x55, 0xb1, 0xc0, 0x42, - 0x71, 0x91, 0x19, 0xc2, 0xe8, 0x4b, 0x1d, 0x5a, 0x53, 0xbd, 0x8d, 0xf6, 0xa0, 0x1e, 0x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 0xd4, 0x9e, 0xc6, 0x27, 0xd1, 0xc4, 0xd2, 0x62, 0x0c, 0x0e, 0x81, 0x56, - 0xf3, 0x4f, 0xae, 0xc8, 0xa3, 0x5f, 0x04, 0x0e, 0x8c, 0xce, 0x94, 0x27, 0x3c, 0x0d, 0xf1, 0xef, - 0x4a, 0xc7, 0xd0, 0x0d, 0xb8, 0x0a, 0x17, 0x37, 0xae, 0x02, 0xba, 0x64, 0x8e, 0xc2, 0x60, 0x2f, - 0x30, 0x8b, 0xf4, 0x21, 0x3a, 0xde, 0x0e, 0xd2, 0x19, 0xf4, 0xcd, 0xe8, 0xb5, 0x58, 0x9b, 0xff, - 0x8c, 0xb5, 0xa7, 0x67, 0xaa, 0x60, 0x27, 0x2f, 0xb4, 0x9f, 0x31, 0xdc, 0x83, 0xbb, 0x57, 0x7e, - 0xae, 0x3d, 0x89, 0x1e, 0xde, 0x96, 0xe9, 0x13, 0xd6, 0x98, 0x7a, 0xdf, 0xd6, 0x16, 0xb9, 0x5c, - 0x5b, 0xe4, 0xe7, 0xda, 0x22, 0x9f, 0x37, 0x56, 0xed, 0x72, 0x63, 0xd5, 0x7e, 0x6c, 0xac, 0xda, - 0xfb, 0x97, 0xf3, 0x58, 0x2d, 0x96, 0x81, 0x13, 0x4a, 0xe1, 0xea, 0x6f, 0xfd, 0x69, 0x8a, 0xea, - 0xa3, 0xcc, 0xcf, 0xb6, 0x28, 0xc1, 0x68, 0x8e, 0xb9, 0x7b, 0x7e, 0xeb, 0x4f, 0x09, 0x5a, 0xfa, - 0xc1, 0xcf, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x78, 0x82, 0x7a, 0x4a, 0x03, 0x00, 0x00, + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xce, 0x26, 0xfd, 0xa5, 0xc9, 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74, 0x08, 0xad, 0x80, 0xab, 0x70, 0x76, 0xe3, 0x42, 0xa0, 0x43, 0xe6, 0x40, + 0x16, 0xec, 0x06, 0xa6, 0x90, 0x3e, 0x4a, 0xd3, 0xdb, 0x40, 0x3a, 0x81, 0xae, 0x91, 0x16, 0x8a, + 0x4b, 0xe5, 0x97, 0x76, 0xe9, 0x53, 0xb4, 0x8e, 0x7a, 0xcc, 0xfc, 0x16, 0xdb, 0xfc, 0x16, 0x3b, + 0xdd, 0xfc, 0x96, 0xd7, 0xd1, 0x9a, 0xf7, 0xa5, 0xa4, 0xb4, 0x7b, 0xf4, 0x4a, 0xef, 0x33, 0x84, + 0x07, 0x70, 0xff, 0x6a, 0x9f, 0x6b, 0x23, 0xd1, 0xfd, 0xdb, 0x6d, 0xba, 0xc4, 0xaa, 0x8d, 0xbd, + 0xef, 0x4b, 0x9b, 0x5c, 0x2e, 0x6d, 0xf2, 0x6b, 0x69, 0x93, 0x2f, 0x2b, 0xbb, 0x72, 0xb9, 0xb2, + 0x2b, 0x3f, 0x57, 0x76, 0xe5, 0xc3, 0xeb, 0x69, 0xac, 0x66, 0xf3, 0x80, 0x85, 0x22, 0x75, 0xf5, + 0xb1, 0x5f, 0x64, 0xa8, 0x3e, 0x09, 0x79, 0xb6, 0x46, 0x09, 0x46, 0x53, 0x94, 0xee, 0xf9, 0xad, + 0xd7, 0x0e, 0xea, 0x7a, 0xe0, 0x97, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x02, 0xd5, 0xcc, 0x76, + 0x7d, 0x03, 0x00, 0x00, } func (m *Basket) Marshal() (dAtA []byte, err error) { @@ -317,9 +318,9 @@ func (m *Basket) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x30 } - if m.MinStartDate != nil { + if m.DateCriteria != nil { { - size, err := m.MinStartDate.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DateCriteria.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -481,8 +482,8 @@ func (m *Basket) Size() (n int) { if l > 0 { n += 1 + l + sovState(uint64(l)) } - if m.MinStartDate != nil { - l = m.MinStartDate.Size() + if m.DateCriteria != nil { + l = m.DateCriteria.Size() n += 1 + l + sovState(uint64(l)) } if m.Exponent != 0 { @@ -671,7 +672,7 @@ func (m *Basket) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStartDate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DateCriteria", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -698,10 +699,10 @@ func (m *Basket) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MinStartDate == nil { - m.MinStartDate = &types.Timestamp{} + if m.DateCriteria == nil { + m.DateCriteria = &DateCriteria{} } - if err := m.MinStartDate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.DateCriteria.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ecocredit/basket/tx.pb.go b/x/ecocredit/basket/tx.pb.go index e7761519a4..23fb95fc15 100644 --- a/x/ecocredit/basket/tx.pb.go +++ b/x/ecocredit/basket/tx.pb.go @@ -7,11 +7,10 @@ import ( context "context" fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types1 "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - types "github.com/gogo/protobuf/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -42,12 +41,13 @@ type MsgCreate struct { // basket token. DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // exponent is the exponent that will be used for converting credits to basket - // tokens and for bank denom metadata. An exponent of 6 will mean that 10^6 - // units of a basket token will be issued for 1.0 credits and that - // this should be displayed as one unit in user interfaces. The exponent - // must be >= the precision of the credit type to minimize the need for - // rounding (rounding may still be needed if the precision changes to be great - // than the exponent). + // tokens and for bank denom metadata. It also limits the precision of + // credit amounts when putting credits into a basket. An exponent of 6 will + // mean that 10^6 units of a basket token will be issued for 1.0 credits and + // that this should be displayed as one unit in user interfaces. It also means + // that the maximum precision of credit amounts is 6 decimal places so that + // the need to round is eliminated. The exponent must be >= the precision of + // the credit type at the time the basket is created. Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` // disable_auto_retire allows auto-retirement to be disabled. // The credits will be auto-retired if disable_auto_retire is @@ -59,11 +59,10 @@ type MsgCreate struct { CreditTypeName string `protobuf:"bytes,6,opt,name=credit_type_name,json=creditTypeName,proto3" json:"credit_type_name,omitempty"` // allowed_classes are the credit classes allowed to be put in the basket AllowedClasses []string `protobuf:"bytes,7,rep,name=allowed_classes,json=allowedClasses,proto3" json:"allowed_classes,omitempty"` - // min_start_date is the earliest start date for batches of credits allowed - // into the basket. - MinStartDate *types.Timestamp `protobuf:"bytes,8,opt,name=min_start_date,json=minStartDate,proto3" json:"min_start_date,omitempty"` - // 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 + // date_criteria is the date criteria for batches admitted to the basket. + DateCriteria *DateCriteria `protobuf:"bytes,8,opt,name=date_criteria,json=dateCriteria,proto3" json:"date_criteria,omitempty"` + // 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 // here so that the curator explicitly acknowledges paying this fee and // is not surprised to learn that the paid a big fee and didn't know // beforehand. @@ -152,9 +151,9 @@ func (m *MsgCreate) GetAllowedClasses() []string { return nil } -func (m *MsgCreate) GetMinStartDate() *types.Timestamp { +func (m *MsgCreate) GetDateCriteria() *DateCriteria { if m != nil { - return m.MinStartDate + return m.DateCriteria } return nil } @@ -329,7 +328,7 @@ func (m *MsgPutResponse) GetAmountReceived() string { type MsgTake struct { // owner is the owner of the basket tokens. Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - // basket_denom is the basket bank denom to take credits from. + // basket_denom is the basket denom to take credits from. BasketDenom string `protobuf:"bytes,2,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` // amount is the integer number of basket tokens to convert into credits. Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` @@ -470,52 +469,50 @@ func init() { } var fileDescriptor_a60f962a3c61f018 = []byte{ - // 710 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x4f, 0xdb, 0x48, - 0x14, 0x8f, 0x31, 0x24, 0x64, 0xc2, 0x86, 0xc5, 0xa0, 0x95, 0xc9, 0x21, 0x04, 0x8b, 0x15, 0xd9, - 0xd5, 0x62, 0x6f, 0x58, 0x69, 0xd5, 0xde, 0x0a, 0xe1, 0xd8, 0xb4, 0xc8, 0x44, 0x3d, 0x54, 0xad, - 0xac, 0x89, 0xfd, 0x70, 0xad, 0xd8, 0x33, 0x91, 0x67, 0x1c, 0xe0, 0xde, 0x0f, 0xc0, 0x07, 0xe8, - 0x27, 0xe8, 0xad, 0xdf, 0x82, 0x23, 0xc7, 0x9e, 0xda, 0x0a, 0xbe, 0x48, 0x35, 0x7f, 0xe2, 0x22, - 0xa1, 0x86, 0x8a, 0x93, 0xe7, 0xfd, 0xde, 0xef, 0xbd, 0x79, 0xef, 0xf7, 0xde, 0x18, 0x39, 0x39, - 0xc4, 0x40, 0x3c, 0x08, 0x69, 0x98, 0x43, 0x94, 0x70, 0x6f, 0x84, 0xd9, 0x18, 0xb8, 0x37, 0xed, - 0x79, 0xfc, 0xdc, 0x9d, 0xe4, 0x94, 0x53, 0x6b, 0x53, 0x72, 0xdc, 0x92, 0xe3, 0x2a, 0x8e, 0x3b, - 0xed, 0xb5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x98, 0x62, 0xc6, 0x80, 0xd9, 0xb5, 0x8e, 0x29, - 0x88, 0x1a, 0xee, 0x2b, 0xd4, 0x7a, 0x86, 0x9a, 0x59, 0x42, 0x02, 0xc6, 0x71, 0xce, 0x83, 0x08, - 0x73, 0xb0, 0x97, 0x3b, 0x46, 0xb7, 0xb1, 0xdf, 0x72, 0x95, 0xfc, 0xee, 0x4c, 0x7e, 0x77, 0x38, - 0x93, 0xdf, 0x5f, 0xc9, 0x12, 0x72, 0x22, 0x02, 0x8e, 0x84, 0x62, 0x6f, 0x91, 0x79, 0x0a, 0x60, - 0xd7, 0x3b, 0x66, 0xb7, 0xb1, 0xbf, 0xe9, 0x2a, 0xb5, 0xc5, 0x74, 0xc1, 0xd5, 0x6a, 0xbb, 0x7d, - 0x9a, 0x90, 0xc3, 0x7f, 0xaf, 0xbe, 0x6c, 0x55, 0x3e, 0x7e, 0xdd, 0xea, 0xc6, 0x09, 0x7f, 0x57, - 0x8c, 0xdc, 0x90, 0x66, 0x9e, 0x1e, 0x8d, 0xfa, 0xec, 0xb1, 0x68, 0xac, 0x27, 0x27, 0x02, 0x98, - 0x2f, 0xf2, 0x3a, 0xff, 0xa3, 0xb5, 0x72, 0x3a, 0x3e, 0xb0, 0x09, 0x25, 0x4c, 0xea, 0xae, 0x86, - 0x1d, 0x44, 0x40, 0x68, 0xa6, 0x47, 0xd5, 0x50, 0xd8, 0x91, 0x80, 0x9c, 0xf7, 0x06, 0xaa, 0x0e, - 0x58, 0x7c, 0x5c, 0x70, 0x6b, 0x03, 0x2d, 0xd1, 0x33, 0x02, 0xb3, 0x89, 0x2a, 0xe3, 0x5e, 0x8e, - 0x85, 0x7b, 0x39, 0xac, 0x03, 0x54, 0x53, 0xba, 0x32, 0xdb, 0x94, 0xed, 0xed, 0xba, 0x3f, 0xdd, - 0x62, 0xf7, 0x50, 0x9e, 0xfa, 0x12, 0xf6, 0x67, 0x71, 0xce, 0x53, 0xd4, 0x54, 0x55, 0x94, 0xb5, - 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, 0x34, 0x1f, 0x6b, 0x2b, 0x85, 0x28, 0x86, 0xdc, 0x3b, 0xbf, - 0xf7, 0xe3, 0x1c, 0x55, 0xe5, 0x5b, 0xff, 0xef, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0xcf, - 0xd0, 0x67, 0xcf, 0x05, 0x00, 0x00, + // 679 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x4e, 0xdb, 0x4c, + 0x10, 0x8e, 0x31, 0x24, 0x64, 0x03, 0xe1, 0x67, 0x41, 0xbf, 0x4c, 0x0e, 0x21, 0x58, 0xfc, 0xc2, + 0x7f, 0x55, 0xec, 0x86, 0x4a, 0x55, 0x7b, 0x84, 0x70, 0x24, 0x2d, 0x72, 0x51, 0x0f, 0x55, 0x2b, + 0x6b, 0x63, 0x4f, 0x5d, 0x2b, 0xce, 0x6e, 0xe4, 0x5d, 0x07, 0xb8, 0xf7, 0x01, 0x78, 0x8c, 0xaa, + 0xb7, 0xbe, 0x05, 0x47, 0x8e, 0x3d, 0xb5, 0x15, 0xbc, 0x48, 0xe5, 0xdd, 0x8d, 0x8b, 0x84, 0x1a, + 0x2a, 0x4e, 0xde, 0xf9, 0xe6, 0x9b, 0xd9, 0x99, 0xf9, 0xc6, 0x8b, 0xec, 0x0c, 0x62, 0xa0, 0x1e, + 0x84, 0x2c, 0xcc, 0x20, 0x4a, 0x84, 0x37, 0x20, 0x7c, 0x08, 0xc2, 0x9b, 0x74, 0x3d, 0x71, 0xe6, + 0x8e, 0x33, 0x26, 0x18, 0xde, 0x90, 0x1c, 0xb7, 0xe4, 0xb8, 0x8a, 0xe3, 0x4e, 0xba, 0xad, 0xf5, + 0x98, 0xc5, 0x4c, 0xb2, 0xbc, 0xe2, 0xa4, 0x02, 0x5a, 0xff, 0xcd, 0x48, 0x7a, 0x3e, 0x06, 0xae, + 0x69, 0xed, 0x90, 0xf1, 0x11, 0xe3, 0x85, 0x17, 0xbc, 0x49, 0x77, 0x00, 0x82, 0x74, 0xbd, 0x90, + 0x25, 0x54, 0xf9, 0xed, 0xcf, 0x26, 0xaa, 0xf7, 0x79, 0xdc, 0xcb, 0x80, 0x08, 0xc0, 0x16, 0xaa, + 0x85, 0x79, 0x46, 0x04, 0xcb, 0x2c, 0xa3, 0x63, 0x38, 0x75, 0x7f, 0x6a, 0x62, 0x8c, 0xe6, 0x29, + 0x19, 0x81, 0x35, 0x27, 0x61, 0x79, 0xc6, 0x5b, 0x68, 0x29, 0x4a, 0xf8, 0x38, 0x25, 0xe7, 0x81, + 0xf4, 0x99, 0xd2, 0xd7, 0xd0, 0xd8, 0xcb, 0x82, 0xd2, 0x42, 0x8b, 0x70, 0x36, 0x66, 0x14, 0xa8, + 0xb0, 0xe6, 0x3b, 0x86, 0xb3, 0xec, 0x97, 0x36, 0x76, 0xd1, 0x5a, 0x94, 0x70, 0x32, 0x48, 0x21, + 0x20, 0xb9, 0x60, 0x41, 0x06, 0x22, 0xc9, 0xc0, 0x5a, 0xe8, 0x18, 0xce, 0xa2, 0xbf, 0xaa, 0x5d, + 0xfb, 0xb9, 0x60, 0xbe, 0x74, 0x60, 0x07, 0xfd, 0xa3, 0x5a, 0x0d, 0x8a, 0x06, 0xd5, 0x95, 0x55, + 0x79, 0x65, 0x53, 0xe1, 0x27, 0xe7, 0x63, 0x90, 0xb7, 0xee, 0xa0, 0x15, 0x92, 0xa6, 0xec, 0x14, + 0xa2, 0x20, 0x4c, 0x09, 0xe7, 0xc0, 0xad, 0x5a, 0xc7, 0x2c, 0x88, 0x1a, 0xee, 0x29, 0x14, 0x1f, + 0xa1, 0xe5, 0x88, 0x08, 0x08, 0xc2, 0x2c, 0x11, 0x90, 0x25, 0xc4, 0x5a, 0xec, 0x18, 0x4e, 0x63, + 0x6f, 0xc7, 0xfd, 0xa3, 0x1a, 0xee, 0x21, 0x11, 0xd0, 0xd3, 0x74, 0x7f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, + 0x29, 0x0b, 0x89, 0x48, 0x18, 0x95, 0xdb, 0x5a, 0xf7, 0xf1, 0x6f, 0xd7, 0x91, 0xf6, 0xe0, 0x6d, + 0xd4, 0x54, 0x68, 0xc0, 0x68, 0x20, 0xc8, 0x70, 0xba, 0xb2, 0x4b, 0x0a, 0x7d, 0x45, 0x8b, 0x3a, + 0xed, 0x13, 0xb4, 0xa2, 0x4b, 0x2e, 0xfb, 0xbd, 0x35, 0x44, 0xe3, 0x61, 0x43, 0xdc, 0xbb, 0x98, + 0x43, 0x66, 0x9f, 0xc7, 0xf8, 0x1d, 0xaa, 0xea, 0x5f, 0x76, 0x7b, 0x46, 0x8e, 0x72, 0x5d, 0x5a, + 0x8f, 0xff, 0x86, 0x55, 0x16, 0xfa, 0x1a, 0x99, 0xc5, 0xb6, 0x6c, 0xcd, 0x0e, 0x3a, 0xce, 0x45, + 0xeb, 0xff, 0x7b, 0x29, 0x65, 0xd2, 0x37, 0x68, 0x5e, 0x0a, 0x68, 0xcf, 0x0e, 0x29, 0x38, 0xad, + 0x47, 0xf7, 0x73, 0xa6, 0x79, 0x0f, 0xfc, 0xcb, 0xeb, 0xb6, 0x71, 0x75, 0xdd, 0x36, 0x7e, 0x5e, + 0xb7, 0x8d, 0x8b, 0x9b, 0x76, 0xe5, 0xea, 0xa6, 0x5d, 0xf9, 0x76, 0xd3, 0xae, 0xbc, 0x7d, 0x7e, + 0xeb, 0xff, 0x92, 0xf9, 0x76, 0x29, 0x88, 0x53, 0x96, 0x0d, 0xb5, 0x95, 0x42, 0x14, 0x43, 0xe6, + 0x9d, 0xdd, 0x79, 0x44, 0x07, 0x55, 0xf9, 0x38, 0x3e, 0xfd, 0x15, 0x00, 0x00, 0xff, 0xff, 0x90, + 0x01, 0x8a, 0x8e, 0xba, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -712,9 +709,9 @@ func (m *MsgCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x4a } } - if m.MinStartDate != nil { + if m.DateCriteria != nil { { - size, err := m.MinStartDate.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DateCriteria.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1033,8 +1030,8 @@ func (m *MsgCreate) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } - if m.MinStartDate != nil { - l = m.MinStartDate.Size() + if m.DateCriteria != nil { + l = m.DateCriteria.Size() n += 1 + l + sovTx(uint64(l)) } if len(m.Fee) > 0 { @@ -1374,7 +1371,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStartDate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DateCriteria", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1401,10 +1398,10 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MinStartDate == nil { - m.MinStartDate = &types.Timestamp{} + if m.DateCriteria == nil { + m.DateCriteria = &DateCriteria{} } - if err := m.MinStartDate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.DateCriteria.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1437,7 +1434,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Fee = append(m.Fee, types1.Coin{}) + m.Fee = append(m.Fee, types.Coin{}) if err := m.Fee[len(m.Fee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/ecocredit/basket/types.pb.go b/x/ecocredit/basket/types.pb.go index c32674ae43..e17cc69ac7 100644 --- a/x/ecocredit/basket/types.pb.go +++ b/x/ecocredit/basket/types.pb.go @@ -6,6 +6,7 @@ package basket import ( fmt "fmt" proto "github.com/gogo/protobuf/proto" + types "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" @@ -79,8 +80,97 @@ func (m *BasketCredit) GetAmount() string { return "" } +// DateCriteria represents a basket credit batch date criteria. +type DateCriteria struct { + // sum is the oneof representing the date criteria. + // + // Types that are valid to be assigned to Sum: + // *DateCriteria_MinStartDate + // *DateCriteria_StartDateWindow + Sum isDateCriteria_Sum `protobuf_oneof:"sum"` +} + +func (m *DateCriteria) Reset() { *m = DateCriteria{} } +func (m *DateCriteria) String() string { return proto.CompactTextString(m) } +func (*DateCriteria) ProtoMessage() {} +func (*DateCriteria) Descriptor() ([]byte, []int) { + return fileDescriptor_e6c256e957c69c4d, []int{1} +} +func (m *DateCriteria) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DateCriteria) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DateCriteria.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DateCriteria) XXX_Merge(src proto.Message) { + xxx_messageInfo_DateCriteria.Merge(m, src) +} +func (m *DateCriteria) XXX_Size() int { + return m.Size() +} +func (m *DateCriteria) XXX_DiscardUnknown() { + xxx_messageInfo_DateCriteria.DiscardUnknown(m) +} + +var xxx_messageInfo_DateCriteria proto.InternalMessageInfo + +type isDateCriteria_Sum interface { + isDateCriteria_Sum() + MarshalTo([]byte) (int, error) + Size() int +} + +type DateCriteria_MinStartDate struct { + MinStartDate *types.Timestamp `protobuf:"bytes,1,opt,name=min_start_date,json=minStartDate,proto3,oneof" json:"min_start_date,omitempty"` +} +type DateCriteria_StartDateWindow struct { + StartDateWindow *types.Duration `protobuf:"bytes,2,opt,name=start_date_window,json=startDateWindow,proto3,oneof" json:"start_date_window,omitempty"` +} + +func (*DateCriteria_MinStartDate) isDateCriteria_Sum() {} +func (*DateCriteria_StartDateWindow) isDateCriteria_Sum() {} + +func (m *DateCriteria) GetSum() isDateCriteria_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *DateCriteria) GetMinStartDate() *types.Timestamp { + if x, ok := m.GetSum().(*DateCriteria_MinStartDate); ok { + return x.MinStartDate + } + return nil +} + +func (m *DateCriteria) GetStartDateWindow() *types.Duration { + if x, ok := m.GetSum().(*DateCriteria_StartDateWindow); ok { + return x.StartDateWindow + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*DateCriteria) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*DateCriteria_MinStartDate)(nil), + (*DateCriteria_StartDateWindow)(nil), + } +} + func init() { proto.RegisterType((*BasketCredit)(nil), "regen.ecocredit.basket.v1.BasketCredit") + proto.RegisterType((*DateCriteria)(nil), "regen.ecocredit.basket.v1.DateCriteria") } func init() { @@ -88,20 +178,28 @@ func init() { } var fileDescriptor_e6c256e957c69c4d = []byte{ - // 197 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2d, 0x4a, 0x4d, 0x4f, - 0xcd, 0xd3, 0x4f, 0x4d, 0xce, 0x4f, 0x2e, 0x4a, 0x4d, 0xc9, 0x2c, 0xd1, 0x4f, 0x4a, 0x2c, 0xce, - 0x4e, 0x2d, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x92, 0x04, 0x2b, 0xd3, 0x83, 0x2b, 0xd3, 0x83, 0x28, 0xd3, 0x2b, 0x33, 0x54, 0x72, - 0xe7, 0xe2, 0x71, 0x02, 0x73, 0x9c, 0xc1, 0x32, 0x42, 0xf2, 0x5c, 0xdc, 0x49, 0x89, 0x25, 0xc9, - 0x19, 0xf1, 0x29, 0xa9, 0x79, 0xf9, 0xb9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x5c, 0x60, - 0x21, 0x17, 0x90, 0x88, 0x90, 0x18, 0x17, 0x5b, 0x62, 0x6e, 0x7e, 0x69, 0x5e, 0x89, 0x04, 0x13, - 0x58, 0x0e, 0xca, 0x73, 0x0a, 0x3a, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, - 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, - 0x8b, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xb0, 0x43, 0x74, 0xf3, - 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xa1, 0xbc, 0x9c, 0xd4, 0x94, 0xf4, 0xd4, 0x22, 0xfd, 0x0a, - 0x0c, 0x6f, 0x24, 0xb1, 0x81, 0x9d, 0x6f, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x71, 0xfc, - 0x2f, 0xe7, 0x00, 0x00, 0x00, + // 327 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x41, 0x4f, 0xc2, 0x30, + 0x18, 0x86, 0x37, 0x8d, 0x24, 0x16, 0xa2, 0x71, 0x07, 0x03, 0x1c, 0x8a, 0x21, 0x31, 0xf1, 0x62, + 0x1b, 0xf0, 0xe2, 0x79, 0x90, 0xc0, 0x79, 0x9a, 0x98, 0x78, 0x59, 0xba, 0xed, 0x73, 0x34, 0xd0, + 0x96, 0x74, 0xdf, 0x40, 0xff, 0x85, 0xbf, 0xc1, 0x5f, 0xe3, 0x91, 0xa3, 0x47, 0x03, 0x7f, 0xc4, + 0xd0, 0x81, 0x26, 0x72, 0xfc, 0xbe, 0xf7, 0x7d, 0x9f, 0xbe, 0x6d, 0xc9, 0xb5, 0x85, 0x1c, 0x34, + 0x87, 0xd4, 0xa4, 0x16, 0x32, 0x89, 0x3c, 0x11, 0xc5, 0x14, 0x90, 0x2f, 0x7a, 0x1c, 0xdf, 0xe6, + 0x50, 0xb0, 0xb9, 0x35, 0x68, 0x82, 0x96, 0xb3, 0xb1, 0x5f, 0x1b, 0xab, 0x6c, 0x6c, 0xd1, 0x6b, + 0x77, 0x72, 0x63, 0xf2, 0x19, 0x70, 0x67, 0x4c, 0xca, 0x17, 0x8e, 0x52, 0x41, 0x81, 0x42, 0xcd, + 0xab, 0x6c, 0x9b, 0xfe, 0x37, 0x64, 0xa5, 0x15, 0x28, 0x8d, 0xae, 0xf4, 0xee, 0x88, 0x34, 0x42, + 0x47, 0x1b, 0x38, 0x74, 0xd0, 0x21, 0xf5, 0x44, 0x60, 0x3a, 0x89, 0x33, 0xd0, 0x46, 0x35, 0xfd, + 0x2b, 0xff, 0xe6, 0x34, 0x22, 0x6e, 0x35, 0xdc, 0x6e, 0x82, 0x4b, 0x52, 0x13, 0xca, 0x94, 0x1a, + 0x9b, 0x47, 0x4e, 0xdb, 0x4d, 0xdd, 0x0f, 0x9f, 0x34, 0x86, 0x02, 0x61, 0x60, 0x25, 0x82, 0x95, + 0x22, 0x08, 0xc9, 0x99, 0x92, 0x3a, 0x2e, 0x50, 0x58, 0x8c, 0x33, 0x81, 0xe0, 0x60, 0xf5, 0x7e, + 0x9b, 0x55, 0x95, 0xd8, 0xbe, 0x12, 0x7b, 0xdc, 0x77, 0x1e, 0x7b, 0x51, 0x43, 0x49, 0xfd, 0xb0, + 0x8d, 0x6c, 0x59, 0xc1, 0x88, 0x5c, 0xfc, 0xe5, 0xe3, 0xa5, 0xd4, 0x99, 0x59, 0xba, 0x73, 0xeb, + 0xfd, 0xd6, 0x01, 0x66, 0xb8, 0xbb, 0xd9, 0xd8, 0x8b, 0xce, 0x8b, 0x3d, 0xe2, 0xc9, 0x65, 0xc2, + 0x13, 0x72, 0x5c, 0x94, 0x2a, 0x8c, 0x3e, 0xd7, 0xd4, 0x5f, 0xad, 0xa9, 0xff, 0xbd, 0xa6, 0xfe, + 0xfb, 0x86, 0x7a, 0xab, 0x0d, 0xf5, 0xbe, 0x36, 0xd4, 0x7b, 0xbe, 0xcf, 0x25, 0x4e, 0xca, 0x84, + 0xa5, 0x46, 0x71, 0xf7, 0xdc, 0xb7, 0x1a, 0x70, 0x69, 0xec, 0x74, 0x37, 0xcd, 0x20, 0xcb, 0xc1, + 0xf2, 0xd7, 0x83, 0xcf, 0x4a, 0x6a, 0xae, 0xc0, 0xdd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe4, + 0x16, 0xb2, 0x08, 0xcd, 0x01, 0x00, 0x00, } func (m *BasketCredit) Marshal() (dAtA []byte, err error) { @@ -141,6 +239,80 @@ func (m *BasketCredit) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DateCriteria) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DateCriteria) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DateCriteria) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *DateCriteria_MinStartDate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DateCriteria_MinStartDate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MinStartDate != nil { + { + size, err := m.MinStartDate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *DateCriteria_StartDateWindow) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DateCriteria_StartDateWindow) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.StartDateWindow != nil { + { + size, err := m.StartDateWindow.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -169,6 +341,43 @@ func (m *BasketCredit) Size() (n int) { return n } +func (m *DateCriteria) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *DateCriteria_MinStartDate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MinStartDate != nil { + l = m.MinStartDate.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *DateCriteria_StartDateWindow) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StartDateWindow != nil { + l = m.StartDateWindow.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -292,6 +501,129 @@ func (m *BasketCredit) Unmarshal(dAtA []byte) error { } return nil } +func (m *DateCriteria) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DateCriteria: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DateCriteria: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStartDate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.Timestamp{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &DateCriteria_MinStartDate{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartDateWindow", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.Duration{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &DateCriteria_StartDateWindow{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ecocredit/go.mod b/x/ecocredit/go.mod index 5592e4413b..8fc07285fd 100644 --- a/x/ecocredit/go.mod +++ b/x/ecocredit/go.mod @@ -19,6 +19,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.13 github.com/tendermint/tm-db v0.6.6 + github.com/thanhpk/randstr v1.0.4 google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 @@ -114,7 +115,6 @@ require ( github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/thanhpk/randstr v1.0.4 // indirect github.com/zondax/hid v0.9.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect