From 971a87512d3e630d01e8f5c31f5e2226c5df1435 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 16 Feb 2022 01:38:44 +0100 Subject: [PATCH] feat!: basket name update (#776) * backport new proto * remove prefix and add name to the basket state * udpate tests * basket denom tests * adding more tests and update integration tests --- go.mod | 2 +- go.sum | 4 +- proto/regen/ecocredit/basket/v1/tx.proto | 49 ++-- x/ecocredit/basket/events.pb.go | 15 +- x/ecocredit/basket/msg_create.go | 8 +- x/ecocredit/basket/msg_create_test.go | 41 ++- x/ecocredit/basket/query.pb.go | 40 +-- x/ecocredit/basket/state.pb.go | 162 +++++++----- x/ecocredit/basket/tx.pb.go | 237 +++++++----------- x/ecocredit/basket/types.pb.go | 10 +- x/ecocredit/client/basket/tx.go | 11 - x/ecocredit/go.mod | 2 +- x/ecocredit/go.sum | 4 +- x/ecocredit/server/basket/create.go | 7 +- x/ecocredit/server/basket/create_test.go | 3 +- x/ecocredit/server/basket/put_test.go | 2 + .../server/basket/query_baskets_test.go | 6 +- x/ecocredit/server/basket/take_test.go | 6 +- x/ecocredit/server/testsuite/suite.go | 2 - 19 files changed, 298 insertions(+), 313 deletions(-) diff --git a/go.mod b/go.mod index 51a2604be5..e9d9c98523 100644 --- a/go.mod +++ b/go.mod @@ -111,7 +111,7 @@ require ( github.com/prometheus/procfs v0.6.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect - github.com/regen-network/regen-ledger/api v0.4.0 // indirect + github.com/regen-network/regen-ledger/api v0.5.0 // indirect github.com/regen-network/regen-ledger/orm v1.0.0-beta1 // indirect github.com/rs/cors v1.7.0 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect diff --git a/go.sum b/go.sum index c04b47164f..e728d38a1a 100644 --- a/go.sum +++ b/go.sum @@ -916,8 +916,8 @@ github.com/regen-network/cosmos-sdk v0.44.2-regen-1/go.mod h1:fwQJdw+aECatpTvQTo github.com/regen-network/protobuf v1.3.2-alpha.regen.4 h1:c9jEnU+xm6vqyrQe3M94UFWqiXxRIKKnqBOh2EACmBE= github.com/regen-network/protobuf v1.3.2-alpha.regen.4/go.mod h1:/J8/bR1T/NXyIdQDLUaq15LjNE83nRzkyrLAMcPewig= github.com/regen-network/regen-ledger/api v0.2.0/go.mod h1:kWly2pK0u3fDfyoYYilpEoTEg61pCjV/f5XSY0KzJQY= -github.com/regen-network/regen-ledger/api v0.4.0 h1:klcMljLCHU3MpkRyjrEXL6KKsDGeqFBt2aFUwFdpEH8= -github.com/regen-network/regen-ledger/api v0.4.0/go.mod h1:kWly2pK0u3fDfyoYYilpEoTEg61pCjV/f5XSY0KzJQY= +github.com/regen-network/regen-ledger/api v0.5.0 h1:Kp+16TzHxSeF0pJ1HPcUzhalCKJCkEnfiKj/NoJX6Lw= +github.com/regen-network/regen-ledger/api v0.5.0/go.mod h1:kWly2pK0u3fDfyoYYilpEoTEg61pCjV/f5XSY0KzJQY= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= diff --git a/proto/regen/ecocredit/basket/v1/tx.proto b/proto/regen/ecocredit/basket/v1/tx.proto index 775a3bf46b..195538156d 100644 --- a/proto/regen/ecocredit/basket/v1/tx.proto +++ b/proto/regen/ecocredit/basket/v1/tx.proto @@ -30,23 +30,16 @@ message MsgCreate { // name will be used to together with prefix to create a bank denom for this // basket token. It can be between 3-8 alphanumeric characters, with the - // first character being alphabetic. The bank denom will be - // `eco/` and its display name will be `eco/`. + // first character being alphabetic. + // + // The bank denom will be formed from name, credit type and exponent and be + // of the form `eco..` where prefix + // is derived from exponent. string name = 2; - // prefix is a single alphabetic character that denotes - // the denom prefix and indicates in some way what relationship is between - // the denom and display denom. Standard conventions are that m indicates - // milli (10^3), u indicates micro (10^6), n indicates nano (10^9). - // Typical usage of prefix should correspond with the `exponent` field, - // which is used to convert decimal ecocredit amounts to integral - // basket tokens. - string prefix = 3; - // description is a human-readable description of the basket denom that should // be at most 256 characters. - string description = 4; - + string description = 3; // 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 @@ -55,32 +48,48 @@ message MsgCreate { // 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. - uint32 exponent = 5; + // the credit type at the time the basket is created and be of one of the + // following values 0, 1, 2, 3, 6, 9, 12, 15, 18, 21, or 24 which correspond + // to the exponents which have an official SI prefix. + // + // The exponent will be used to form the prefix part of the the bank denom + // and will be mapped as follows: + // 0 - no prefix + // 1 - d (deci) + // 2 - c (centi) + // 3 - m (milli) + // 6 - u (micro) + // 9 - n (nano) + // 12 - p (pico) + // 15 - f (femto) + // 18 - a (atto) + // 21 - z (zepto) + // 24 - y (yocto) + uint32 exponent = 4; // 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. - bool disable_auto_retire = 6; + bool disable_auto_retire = 5; // credit_type_abbrev is the abbreviation of the credit type this basket is // able to hold. - string credit_type_abbrev = 7; + string credit_type_abbrev = 6; // allowed_classes are the credit classes allowed to be put in the basket - repeated string allowed_classes = 8; + repeated string allowed_classes = 7; // date_criteria is the date criteria for batches admitted to the basket. - DateCriteria date_criteria = 9; + 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 // 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. - repeated cosmos.base.v1beta1.Coin fee = 10 [ + repeated cosmos.base.v1beta1.Coin fee = 9 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; diff --git a/x/ecocredit/basket/events.pb.go b/x/ecocredit/basket/events.pb.go index 78d2e79a32..8d68ee5f11 100644 --- a/x/ecocredit/basket/events.pb.go +++ b/x/ecocredit/basket/events.pb.go @@ -599,10 +599,7 @@ func (m *EventCreate) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthEvents } if (iNdEx + skippy) > l { @@ -782,10 +779,7 @@ func (m *EventPut) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthEvents } if (iNdEx + skippy) > l { @@ -965,10 +959,7 @@ func (m *EventTake) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthEvents } if (iNdEx + skippy) > l { diff --git a/x/ecocredit/basket/msg_create.go b/x/ecocredit/basket/msg_create.go index 7b2435e44b..a5fa1b3001 100644 --- a/x/ecocredit/basket/msg_create.go +++ b/x/ecocredit/basket/msg_create.go @@ -102,18 +102,18 @@ func validateDateCriteria(d *DateCriteria) error { return nil } -// MsgCreateDenom formats denom and display denom: +// BasketDenom formats denom and display denom: // * denom: eco.. // * display denom: eco.. // Returns error if MsgCrete.Exponent is not supported -func MsgCreateDenom(m *MsgCreate) (string, string, error) { +func BasketDenom(name, creditTypeAbbrev string, exponent uint32) (string, string, error) { const basketDenomPrefix = "eco." - denomPrefix, err := ecocredit.ExponentToPrefix(m.Exponent) + denomPrefix, err := ecocredit.ExponentToPrefix(exponent) if err != nil { return "", "", err } - denomTail := m.CreditTypeAbbrev + "." + m.Name + denomTail := creditTypeAbbrev + "." + name displayDenomName := basketDenomPrefix + denomTail // denom := basketDenomPrefix + denomPrefix + denomTail // eco.. return denom, displayDenomName, nil diff --git a/x/ecocredit/basket/msg_create_test.go b/x/ecocredit/basket/msg_create_test.go index 9eaf3e8f2c..9383c82271 100644 --- a/x/ecocredit/basket/msg_create_test.go +++ b/x/ecocredit/basket/msg_create_test.go @@ -78,15 +78,15 @@ func TestMsgCreateValidateBasic(t *testing.T) { MsgCreate{Curator: a, Name: name, Exponent: 3, CreditTypeAbbrev: creditAbbr, DateCriteria: start, AllowedClasses: []string{"class1", ""}}, "allowed_classes[1] must be defined"}, {"fee-1", - MsgCreate{Curator: a, Prefix: "o", Name: name, Exponent: 3, CreditTypeAbbrev: creditAbbr, DateCriteria: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{Denom: "1a"}}}, + MsgCreate{Curator: a, Name: name, Exponent: 3, CreditTypeAbbrev: creditAbbr, DateCriteria: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{Denom: "1a"}}}, "invalid denom"}, - {"fee-2", MsgCreate{Curator: a, Prefix: "o", Name: name, Exponent: 3, CreditTypeAbbrev: creditAbbr, DateCriteria: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{"aa", sdk.NewInt(-1)}}}, + {"fee-2", MsgCreate{Curator: a, Name: name, Exponent: 3, CreditTypeAbbrev: creditAbbr, DateCriteria: start, AllowedClasses: classes, Fee: sdk.Coins{sdk.Coin{"aa", sdk.NewInt(-1)}}}, "invalid denom"}, {"good-1-fees-not-required", - MsgCreate{Curator: a, Prefix: "o", Name: name, Exponent: 0, CreditTypeAbbrev: creditAbbr, DateCriteria: start, AllowedClasses: classes, Description: descr}, ""}, + MsgCreate{Curator: a, Name: name, Exponent: 0, CreditTypeAbbrev: creditAbbr, DateCriteria: start, AllowedClasses: classes, Description: descr}, ""}, {"good-date-criteria-not-required", - MsgCreate{Curator: a, Prefix: "o", Name: name, Exponent: 18, CreditTypeAbbrev: creditAbbr, DateCriteria: nil, AllowedClasses: classes, Fee: sdk.Coins{sdk.NewInt64Coin("regen", 1)}}, ""}, + MsgCreate{Curator: a, Name: name, Exponent: 18, CreditTypeAbbrev: creditAbbr, DateCriteria: nil, AllowedClasses: classes, Fee: sdk.Coins{sdk.NewInt64Coin("regen", 1)}}, ""}, } for _, tc := range tcs { @@ -146,3 +146,36 @@ func TestMsgCreateSignBytes(t *testing.T) { bz := m.GetSignBytes() require.NotEmpty(t, bz) } + +func TestBasketDenom(t *testing.T) { + tcs := []struct { + tname string + abbrev string + exponent uint32 + denom string + displayDenom string + err bool + }{ + {"wrong exponent", + "X", 5, "", "", true}, + {"exponent-0", + "X", 0, "eco.X.foo", "eco.X.foo", false}, + {"exponent-1`", + "X", 1, "eco.dX.foo", "eco.X.foo", false}, + {"exponent-2", + "X", 2, "eco.cX.foo", "eco.X.foo", false}, + {"exponent-6", + "X", 6, "eco.uX.foo", "eco.X.foo", false}, + } + require := require.New(t) + for _, tc := range tcs { + d, displayD, err := BasketDenom("foo", tc.abbrev, tc.exponent) + if tc.err { + require.Error(err, tc.tname) + } else { + require.NoError(err, tc.tname) + require.Equal(tc.denom, d, tc.tname) + require.Equal(tc.displayDenom, displayD, tc.tname) + } + } +} diff --git a/x/ecocredit/basket/query.pb.go b/x/ecocredit/basket/query.pb.go index c88bdb53f5..7a10cb11c4 100644 --- a/x/ecocredit/basket/query.pb.go +++ b/x/ecocredit/basket/query.pb.go @@ -1200,10 +1200,7 @@ func (m *QueryBasketRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -1289,10 +1286,7 @@ func (m *QueryBasketResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -1378,10 +1372,7 @@ func (m *QueryBasketsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -1501,10 +1492,7 @@ func (m *QueryBasketsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -1622,10 +1610,7 @@ func (m *QueryBasketBalancesRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -1745,10 +1730,7 @@ func (m *QueryBasketBalancesResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -1862,10 +1844,7 @@ func (m *QueryBasketBalanceRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -1947,10 +1926,7 @@ func (m *QueryBasketBalanceResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { diff --git a/x/ecocredit/basket/state.pb.go b/x/ecocredit/basket/state.pb.go index 7639347f25..1a92af70a4 100644 --- a/x/ecocredit/basket/state.pb.go +++ b/x/ecocredit/basket/state.pb.go @@ -31,14 +31,18 @@ type Basket struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // basket_denom is the basket bank denom. BasketDenom string `protobuf:"bytes,2,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` + // name is the unique name of the basket specified in MsgCreate. Basket + // names must be unique across all credit types and choices of exponent + // above and beyond the uniqueness constraint on basket_denom. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // disable_auto_retire indicates whether or not the credits will be retired upon withdraw from the basket. - DisableAutoRetire bool `protobuf:"varint,3,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + DisableAutoRetire bool `protobuf:"varint,4,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` // credit_type_abbrev is the abbreviation of the credit type this basket is able to hold. - CreditTypeAbbrev string `protobuf:"bytes,4,opt,name=credit_type_abbrev,json=creditTypeAbbrev,proto3" json:"credit_type_abbrev,omitempty"` + CreditTypeAbbrev string `protobuf:"bytes,5,opt,name=credit_type_abbrev,json=creditTypeAbbrev,proto3" json:"credit_type_abbrev,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"` + DateCriteria *DateCriteria `protobuf:"bytes,6,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"` + Exponent uint32 `protobuf:"varint,7,opt,name=exponent,proto3" json:"exponent,omitempty"` } func (m *Basket) Reset() { *m = Basket{} } @@ -88,6 +92,13 @@ func (m *Basket) GetBasketDenom() string { return "" } +func (m *Basket) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func (m *Basket) GetDisableAutoRetire() bool { if m != nil { return m.DisableAutoRetire @@ -256,41 +267,42 @@ func init() { } var fileDescriptor_c416a19075224f85 = []byte{ - // 534 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xce, 0x26, 0x25, 0x4d, 0x26, 0x4d, 0x15, 0x16, 0x10, 0x6e, 0x10, 0x6e, 0x88, 0x40, 0xe4, - 0x50, 0xd6, 0x4a, 0xb9, 0xa0, 0x70, 0x4a, 0x9a, 0x4b, 0x25, 0x4e, 0xa6, 0x27, 0x2e, 0xd6, 0xda, - 0x1e, 0x12, 0xab, 0xb6, 0xd7, 0x5a, 0x6f, 0x42, 0xfb, 0x12, 0x88, 0x27, 0xe0, 0xce, 0x9b, 0x70, - 0xac, 0xc4, 0x85, 0x23, 0x4a, 0x5e, 0x00, 0xf1, 0x04, 0xc8, 0xbb, 0xf9, 0x69, 0x41, 0xed, 0xf1, - 0x9b, 0xef, 0xfb, 0x76, 0x66, 0xbf, 0x19, 0x78, 0x21, 0x71, 0x82, 0xa9, 0x83, 0x81, 0x08, 0x24, - 0x86, 0x91, 0x72, 0x7c, 0x9e, 0x9f, 0xa3, 0x72, 0xe6, 0x7d, 0x27, 0x57, 0x5c, 0x21, 0xcb, 0xa4, - 0x50, 0x82, 0x1e, 0x68, 0x19, 0xdb, 0xc8, 0x98, 0x91, 0xb1, 0x79, 0xbf, 0xfd, 0x34, 0x10, 0x79, - 0x22, 0x72, 0x47, 0xc8, 0xc4, 0x99, 0xf7, 0x79, 0x9c, 0x4d, 0x79, 0xbf, 0x00, 0xc6, 0xd9, 0x3e, - 0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, 0x86, 0x13, 0x94, 0xce, - 0xc5, 0x7f, 0x87, 0xee, 0x57, 0xf5, 0xe8, 0xaf, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xb0, - 0xa8, 0xa2, 0x8b, 0x03, 0x00, 0x00, + // 549 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0xed, 0xa6, 0x25, 0x4d, 0x27, 0x6d, 0x65, 0x16, 0x10, 0xdb, 0x20, 0xdc, 0x10, 0x09, 0x11, + 0xa1, 0x62, 0x93, 0x72, 0x41, 0xe1, 0x94, 0x34, 0x97, 0x4a, 0x9c, 0x4c, 0x4f, 0x5c, 0xac, 0xb5, + 0x3d, 0x24, 0x56, 0x6d, 0xaf, 0xb5, 0xde, 0x84, 0xf6, 0x27, 0x10, 0x5f, 0xc0, 0xf7, 0xc0, 0xad, + 0x12, 0x17, 0x8e, 0x28, 0xf9, 0x01, 0xc4, 0x17, 0x20, 0xef, 0x3a, 0x49, 0x0b, 0xa2, 0xb7, 0xbc, + 0x79, 0xef, 0x79, 0x66, 0xdf, 0x4c, 0xe0, 0xa9, 0xc4, 0x31, 0x66, 0x2e, 0x86, 0x22, 0x94, 0x18, + 0xc5, 0xca, 0x0d, 0x78, 0x71, 0x8e, 0xca, 0x9d, 0xf5, 0xdc, 0x42, 0x71, 0x85, 0x4e, 0x2e, 0x85, + 0x12, 0xf4, 0x40, 0xcb, 0x9c, 0x95, 0xcc, 0x31, 0x32, 0x67, 0xd6, 0x6b, 0x3d, 0x0e, 0x45, 0x91, + 0x8a, 0xc2, 0x15, 0x32, 0x75, 0x67, 0x3d, 0x9e, 0xe4, 0x13, 0xde, 0x2b, 0x81, 0x71, 0xb6, 0x0e, + 0xc7, 0x42, 0x8c, 0x13, 0x74, 0x35, 0x0a, 0xa6, 0x1f, 0x5c, 0x15, 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0x85, 0x3c, 0xaf, 0x50, 0x82, 0xd1, 0x18, 0xa5, 0x7b, 0xf1, + 0xcf, 0x1f, 0x21, 0xa8, 0xeb, 0xd1, 0x5f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x21, 0x6b, 0x6c, + 0x9b, 0xab, 0x03, 0x00, 0x00, } func (m *Basket) Marshal() (dAtA []byte, err error) { @@ -316,7 +328,7 @@ func (m *Basket) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.Exponent != 0 { i = encodeVarintState(dAtA, i, uint64(m.Exponent)) i-- - dAtA[i] = 0x30 + dAtA[i] = 0x38 } if m.DateCriteria != nil { { @@ -328,14 +340,14 @@ func (m *Basket) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintState(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } if len(m.CreditTypeAbbrev) > 0 { i -= len(m.CreditTypeAbbrev) copy(dAtA[i:], m.CreditTypeAbbrev) i = encodeVarintState(dAtA, i, uint64(len(m.CreditTypeAbbrev))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if m.DisableAutoRetire { i-- @@ -345,7 +357,14 @@ func (m *Basket) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintState(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a } if len(m.BasketDenom) > 0 { i -= len(m.BasketDenom) @@ -475,6 +494,10 @@ func (m *Basket) Size() (n int) { if l > 0 { n += 1 + l + sovState(uint64(l)) } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } if m.DisableAutoRetire { n += 2 } @@ -619,6 +642,38 @@ func (m *Basket) Unmarshal(dAtA []byte) error { m.BasketDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) } @@ -638,7 +693,7 @@ func (m *Basket) Unmarshal(dAtA []byte) error { } } m.DisableAutoRetire = bool(v != 0) - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreditTypeAbbrev", wireType) } @@ -670,7 +725,7 @@ func (m *Basket) Unmarshal(dAtA []byte) error { } m.CreditTypeAbbrev = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DateCriteria", wireType) } @@ -706,7 +761,7 @@ func (m *Basket) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) } @@ -731,10 +786,7 @@ func (m *Basket) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { @@ -835,10 +887,7 @@ func (m *BasketClass) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { @@ -1007,10 +1056,7 @@ func (m *BasketBalance) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { diff --git a/x/ecocredit/basket/tx.pb.go b/x/ecocredit/basket/tx.pb.go index 7084ff8561..b11ea65e30 100644 --- a/x/ecocredit/basket/tx.pb.go +++ b/x/ecocredit/basket/tx.pb.go @@ -37,17 +37,15 @@ type MsgCreate struct { Curator string `protobuf:"bytes,1,opt,name=curator,proto3" json:"curator,omitempty"` // name will be used to together with prefix to create a bank denom for this // basket token. It can be between 3-8 alphanumeric characters, with the - // first character being alphabetic. The bank denom will be - // `eco/` and its display name will be `eco/`. + // first character being alphabetic. + // + // The bank denom will be formed from name, credit type and exponent and be + // of the form `eco..` where prefix + // is derived from exponent. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // prefix is a single alphabetic character that denotes - // the denom prefix and indicates in some way what relationship is between - // the denom and display denom. Standard conventions are that m indicates - // milli (10^3), u indicates micro (10^6), n indicates nano (10^9). - Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"` // description is a human-readable description of the basket denom that should // be at most 256 characters. - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // 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 @@ -55,27 +53,43 @@ type MsgCreate struct { // 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,5,opt,name=exponent,proto3" json:"exponent,omitempty"` + // the credit type at the time the basket is created and be of one of the + // following values 0, 1, 2, 3, 6, 9, 12, 15, 18, 21, or 24 which correspond + // to the exponents which have an official SI prefix. + // + // The exponent will be used to form the prefix part of the the bank denom + // and will be mapped as follows: + // 0 - no prefix + // 1 - d (deci) + // 2 - c (centi) + // 3 - m (milli) + // 6 - u (micro) + // 9 - n (nano) + // 12 - p (pico) + // 15 - f (femto) + // 18 - a (atto) + // 21 - z (zepto) + // 24 - y (yocto) + 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 // 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. - DisableAutoRetire bool `protobuf:"varint,6,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + DisableAutoRetire bool `protobuf:"varint,5,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` // credit_type_abbrev is the abbreviation of the credit type this basket is // able to hold. - CreditTypeAbbrev string `protobuf:"bytes,7,opt,name=credit_type_abbrev,json=creditTypeAbbrev,proto3" json:"credit_type_abbrev,omitempty"` + CreditTypeAbbrev string `protobuf:"bytes,6,opt,name=credit_type_abbrev,json=creditTypeAbbrev,proto3" json:"credit_type_abbrev,omitempty"` // allowed_classes are the credit classes allowed to be put in the basket - AllowedClasses []string `protobuf:"bytes,8,rep,name=allowed_classes,json=allowedClasses,proto3" json:"allowed_classes,omitempty"` + AllowedClasses []string `protobuf:"bytes,7,rep,name=allowed_classes,json=allowedClasses,proto3" json:"allowed_classes,omitempty"` // date_criteria is the date criteria for batches admitted to the basket. - DateCriteria *DateCriteria `protobuf:"bytes,9,opt,name=date_criteria,json=dateCriteria,proto3" json:"date_criteria,omitempty"` + 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. - Fee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,10,rep,name=fee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fee"` + Fee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,9,rep,name=fee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fee"` } func (m *MsgCreate) Reset() { *m = MsgCreate{} } @@ -125,13 +139,6 @@ func (m *MsgCreate) GetName() string { return "" } -func (m *MsgCreate) GetPrefix() string { - if m != nil { - return m.Prefix - } - return "" -} - func (m *MsgCreate) GetDescription() string { if m != nil { return m.Description @@ -485,51 +492,50 @@ func init() { } var fileDescriptor_a60f962a3c61f018 = []byte{ - // 698 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x4e, 0x1b, 0x49, - 0x10, 0xf6, 0x30, 0xe0, 0x9f, 0x36, 0x98, 0xa5, 0x41, 0x68, 0xf0, 0xc1, 0x98, 0x11, 0x2b, 0xbc, - 0x2b, 0x98, 0x59, 0xb3, 0xd2, 0x6a, 0xf7, 0x08, 0xe6, 0x88, 0xb5, 0x68, 0x16, 0xed, 0x21, 0x4a, - 0x34, 0x6a, 0xcf, 0x14, 0x93, 0x91, 0xed, 0x6e, 0xab, 0xbb, 0x6d, 0xcc, 0x3d, 0x0f, 0xc0, 0x73, - 0xe4, 0x96, 0x67, 0xc8, 0x85, 0x23, 0xc7, 0x9c, 0x92, 0x08, 0x5e, 0x24, 0x9a, 0xee, 0xf6, 0xc4, - 0x12, 0x8a, 0x89, 0x38, 0xb9, 0xeb, 0xab, 0xaf, 0x3e, 0x57, 0xd7, 0x57, 0xd3, 0xc8, 0xe5, 0x90, - 0x00, 0xf5, 0x21, 0x62, 0x11, 0x87, 0x38, 0x95, 0x7e, 0x8f, 0x88, 0x3e, 0x48, 0x7f, 0xd2, 0xf6, - 0xe5, 0xd4, 0x1b, 0x71, 0x26, 0x19, 0xde, 0x51, 0x1c, 0x2f, 0xe7, 0x78, 0x9a, 0xe3, 0x4d, 0xda, - 0xf5, 0xad, 0x84, 0x25, 0x4c, 0xb1, 0xfc, 0xec, 0xa4, 0x0b, 0xea, 0xbf, 0x2e, 0x10, 0xbd, 0x19, - 0x81, 0x30, 0xb4, 0x46, 0xc4, 0xc4, 0x90, 0x89, 0x2c, 0x0b, 0xfe, 0xa4, 0xdd, 0x03, 0x49, 0xda, - 0x7e, 0xc4, 0x52, 0xaa, 0xf3, 0xee, 0x47, 0x1b, 0x55, 0xba, 0x22, 0xe9, 0x70, 0x20, 0x12, 0xb0, - 0x83, 0x4a, 0xd1, 0x98, 0x13, 0xc9, 0xb8, 0x63, 0x35, 0xad, 0x56, 0x25, 0x98, 0x85, 0x18, 0xa3, - 0x65, 0x4a, 0x86, 0xe0, 0x2c, 0x29, 0x58, 0x9d, 0xf1, 0x36, 0x2a, 0x8e, 0x38, 0x5c, 0xa5, 0x53, - 0xc7, 0x56, 0xa8, 0x89, 0x70, 0x13, 0x55, 0x63, 0x10, 0x11, 0x4f, 0x47, 0x32, 0x65, 0xd4, 0x59, - 0x56, 0xc9, 0x79, 0x08, 0xd7, 0x51, 0x19, 0xa6, 0x23, 0x46, 0x81, 0x4a, 0x67, 0xa5, 0x69, 0xb5, - 0xd6, 0x82, 0x3c, 0xc6, 0x1e, 0xda, 0x8c, 0x53, 0x41, 0x7a, 0x03, 0x08, 0xc9, 0x58, 0xb2, 0x90, - 0x83, 0x4c, 0x39, 0x38, 0xc5, 0xa6, 0xd5, 0x2a, 0x07, 0x1b, 0x26, 0x75, 0x32, 0x96, 0x2c, 0x50, - 0x09, 0x7c, 0x88, 0xb0, 0x9e, 0x40, 0x98, 0xdd, 0x3b, 0x24, 0xbd, 0x1e, 0x87, 0x89, 0x53, 0x52, - 0x7f, 0xfa, 0x8b, 0xce, 0x5c, 0xde, 0x8c, 0xe0, 0x44, 0xe1, 0xf8, 0x00, 0xad, 0x93, 0xc1, 0x80, - 0x5d, 0x43, 0x1c, 0x46, 0x03, 0x22, 0x04, 0x08, 0xa7, 0xdc, 0xb4, 0x5b, 0x95, 0xa0, 0x66, 0xe0, - 0x8e, 0x46, 0xf1, 0x39, 0x5a, 0x8b, 0x89, 0x84, 0x30, 0xe2, 0xa9, 0x04, 0x9e, 0x12, 0xa7, 0xd2, - 0xb4, 0x5a, 0xd5, 0xe3, 0x03, 0xef, 0x87, 0x46, 0x79, 0x67, 0x44, 0x42, 0xc7, 0xd0, 0x83, 0xd5, - 0x78, 0x2e, 0xc2, 0x6f, 0x90, 0x7d, 0x05, 0xe0, 0xa0, 0xa6, 0xdd, 0xaa, 0x1e, 0xef, 0x78, 0xda, - 0x94, 0xac, 0x14, 0x3c, 0x63, 0x8a, 0xd7, 0x61, 0x29, 0x3d, 0xfd, 0xe3, 0xee, 0xf3, 0x6e, 0xe1, - 0xfd, 0x97, 0xdd, 0x56, 0x92, 0xca, 0xb7, 0xe3, 0x9e, 0x17, 0xb1, 0xa1, 0x6f, 0x1c, 0xd4, 0x3f, - 0x47, 0x22, 0xee, 0x1b, 0x83, 0xb3, 0x02, 0x11, 0x64, 0xba, 0xee, 0x5f, 0x68, 0x23, 0x37, 0x31, - 0x00, 0x31, 0x62, 0x54, 0x00, 0xde, 0x43, 0xab, 0xba, 0xb7, 0x30, 0x06, 0xca, 0x86, 0xc6, 0xd1, - 0xaa, 0xc6, 0xce, 0x32, 0xc8, 0x7d, 0x67, 0xa1, 0x62, 0x57, 0x24, 0x17, 0x63, 0x89, 0xb7, 0xd0, - 0x0a, 0xbb, 0xa6, 0x30, 0x33, 0x5e, 0x07, 0x4f, 0x34, 0x96, 0x9e, 0x68, 0xe0, 0x13, 0x54, 0xd2, - 0x93, 0x10, 0x8e, 0xad, 0xae, 0xb7, 0x68, 0x44, 0xa7, 0xea, 0xd4, 0x51, 0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1, 0xd5, 0xdf, 0x73, 0xdf, 0x97, 0xd2, 0x3b, 0xa2, 0x20, 0xaf, 0x19, 0xef, 0x9b, 0x68, 0x00, - 0x71, 0x02, 0xdc, 0x9f, 0x3e, 0x79, 0x5f, 0x7b, 0x45, 0xf5, 0x6e, 0xfe, 0xf9, 0x2d, 0x00, 0x00, - 0xff, 0xff, 0xd8, 0xd3, 0xe4, 0x13, 0xd5, 0x05, 0x00, 0x00, + // 683 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x8e, 0x71, 0x48, 0xc8, 0x04, 0xc2, 0x65, 0x40, 0x57, 0x26, 0x8b, 0x10, 0x2c, 0xae, 0xc8, + 0xad, 0xc0, 0x6e, 0xa8, 0x54, 0xb5, 0x4b, 0x08, 0x4b, 0xa2, 0x22, 0x17, 0x75, 0x51, 0xb5, 0xb2, + 0x26, 0xf6, 0xa9, 0x6b, 0x25, 0x99, 0x89, 0x66, 0x26, 0x01, 0xf6, 0x7d, 0x00, 0x9e, 0xa3, 0x5d, + 0xf5, 0x2d, 0x58, 0xb2, 0xec, 0xaa, 0xad, 0xe0, 0x45, 0x2a, 0xcf, 0x4c, 0xdc, 0x48, 0xa8, 0xa1, + 0x62, 0xe5, 0x39, 0xdf, 0xf9, 0xce, 0xe7, 0xf3, 0x37, 0x83, 0x5c, 0x0e, 0x09, 0x50, 0x1f, 0x22, + 0x16, 0x71, 0x88, 0x53, 0xe9, 0xf7, 0x88, 0xe8, 0x83, 0xf4, 0x27, 0x6d, 0x5f, 0x5e, 0x78, 0x23, + 0xce, 0x24, 0xc3, 0x9b, 0x8a, 0xe3, 0xe5, 0x1c, 0x4f, 0x73, 0xbc, 0x49, 0xbb, 0xbe, 0x91, 0xb0, + 0x84, 0x29, 0x96, 0x9f, 0x9d, 0x74, 0x40, 0xfd, 0xbf, 0x39, 0xa2, 0x97, 0x23, 0x10, 0x86, 0xd6, + 0x88, 0x98, 0x18, 0x32, 0x91, 0x79, 0xc1, 0x9f, 0xb4, 0x7b, 0x20, 0x49, 0xdb, 0x8f, 0x58, 0x4a, + 0xb5, 0xdf, 0xfd, 0x62, 0xa3, 0x4a, 0x57, 0x24, 0x1d, 0x0e, 0x44, 0x02, 0x76, 0x50, 0x39, 0x1a, + 0x73, 0x22, 0x19, 0x77, 0xac, 0xa6, 0xd5, 0xaa, 0x04, 0x53, 0x13, 0x63, 0x54, 0xa4, 0x64, 0x08, + 0xce, 0x82, 0x82, 0xd5, 0x19, 0x37, 0x51, 0x35, 0x06, 0x11, 0xf1, 0x74, 0x24, 0x53, 0x46, 0x1d, + 0x5b, 0xb9, 0x66, 0x21, 0x5c, 0x47, 0x4b, 0x70, 0x31, 0x62, 0x14, 0xa8, 0x74, 0x8a, 0x4d, 0xab, + 0xb5, 0x12, 0xe4, 0x36, 0xf6, 0xd0, 0x7a, 0x9c, 0x0a, 0xd2, 0x1b, 0x40, 0x48, 0xc6, 0x92, 0x85, + 0x1c, 0x64, 0xca, 0xc1, 0x59, 0x6c, 0x5a, 0xad, 0xa5, 0x60, 0xcd, 0xb8, 0x0e, 0xc7, 0x92, 0x05, + 0xca, 0x81, 0xf7, 0x10, 0xd6, 0x95, 0x86, 0x59, 0x7d, 0x21, 0xe9, 0xf5, 0x38, 0x4c, 0x9c, 0x92, + 0xfa, 0xe9, 0x3f, 0xda, 0x73, 0x76, 0x39, 0x82, 0x43, 0x85, 0xe3, 0x5d, 0xb4, 0x4a, 0x06, 0x03, + 0x76, 0x0e, 0x71, 0x18, 0x0d, 0x88, 0x10, 0x20, 0x9c, 0x72, 0xd3, 0x6e, 0x55, 0x82, 0x9a, 0x81, + 0x3b, 0x1a, 0xc5, 0x27, 0x68, 0x25, 0x26, 0x12, 0xc2, 0x88, 0xa7, 0x12, 0x78, 0x4a, 0x9c, 0xa5, + 0xa6, 0xd5, 0xaa, 0x1e,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b, 0x9a, 0x5d, 0x35, 0x16, 0xf6, 0xd1, + 0xba, 0xde, 0xbe, 0x21, 0x50, 0x19, 0x0e, 0x58, 0x44, 0xd4, 0x42, 0x17, 0x15, 0x09, 0xff, 0x76, + 0x9d, 0x18, 0x0f, 0xde, 0x41, 0x35, 0x8d, 0x86, 0x8c, 0x86, 0x92, 0xf4, 0xa7, 0x6b, 0xbb, 0xac, + 0xd1, 0x57, 0x34, 0xcb, 0xd3, 0x3d, 0x43, 0xab, 0x26, 0xe5, 0xbc, 0xde, 0x99, 0x26, 0x5a, 0x8f, + 0x6b, 0xe2, 0xc1, 0xd5, 0x02, 0xb2, 0xbb, 0x22, 0xc1, 0xef, 0x50, 0xc9, 0xdc, 0xda, 0x9d, 0x39, + 0x1a, 0xf9, 0xba, 0xd4, 0xf7, 0xfe, 0x86, 0x95, 0x27, 0xfa, 0x1a, 0xd9, 0xd9, 0xb6, 0x6c, 0xcf, + 0x0f, 0x3a, 0x1d, 0xcb, 0xfa, 0xff, 0x0f, 0x52, 0x72, 0xd1, 0x37, 0xa8, 0xa8, 0x06, 0xe8, 0xce, + 0x0f, 0xc9, 0x38, 0xf5, 0x27, 0x0f, 0x73, 0xa6, 0xba, 0x47, 0xc1, 0xf5, 0x6d, 0xc3, 0xba, 0xb9, + 0x6d, 0x58, 0x3f, 0x6f, 0x1b, 0xd6, 0xd5, 0x5d, 0xa3, 0x70, 0x73, 0xd7, 0x28, 0x7c, 0xbb, 0x6b, + 0x14, 0xde, 0xbe, 0x98, 0xb9, 0x5f, 0x4a, 0x6f, 0x9f, 0x82, 0x3c, 0x67, 0xbc, 0x6f, 0xac, 0x01, + 0xc4, 0x09, 0x70, 0xff, 0xe2, 0xde, 0x3b, 0xda, 0x2b, 0xa9, 0xf7, 0xf1, 0xd9, 0xaf, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x2d, 0x07, 0xf3, 0xba, 0xbd, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -723,7 +729,7 @@ func (m *MsgCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x4a } } if m.DateCriteria != nil { @@ -736,7 +742,7 @@ func (m *MsgCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 } if len(m.AllowedClasses) > 0 { for iNdEx := len(m.AllowedClasses) - 1; iNdEx >= 0; iNdEx-- { @@ -744,7 +750,7 @@ func (m *MsgCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.AllowedClasses[iNdEx]) i = encodeVarintTx(dAtA, i, uint64(len(m.AllowedClasses[iNdEx]))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a } } if len(m.CreditTypeAbbrev) > 0 { @@ -752,7 +758,7 @@ func (m *MsgCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.CreditTypeAbbrev) i = encodeVarintTx(dAtA, i, uint64(len(m.CreditTypeAbbrev))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if m.DisableAutoRetire { i-- @@ -762,25 +768,18 @@ func (m *MsgCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x30 + dAtA[i] = 0x28 } if m.Exponent != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Exponent)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x20 } if len(m.Description) > 0 { i -= len(m.Description) copy(dAtA[i:], m.Description) i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x22 - } - if len(m.Prefix) > 0 { - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintTx(dAtA, i, uint64(len(m.Prefix))) - i-- dAtA[i] = 0x1a } if len(m.Name) > 0 { @@ -1034,10 +1033,6 @@ func (m *MsgCreate) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Prefix) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.Description) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1263,38 +1258,6 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } @@ -1326,7 +1289,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { } m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) } @@ -1345,7 +1308,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { break } } - case 6: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) } @@ -1365,7 +1328,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { } } m.DisableAutoRetire = bool(v != 0) - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreditTypeAbbrev", wireType) } @@ -1397,7 +1360,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { } m.CreditTypeAbbrev = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AllowedClasses", wireType) } @@ -1429,7 +1392,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { } m.AllowedClasses = append(m.AllowedClasses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DateCriteria", wireType) } @@ -1465,7 +1428,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) } @@ -1505,10 +1468,7 @@ func (m *MsgCreate) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -1590,10 +1550,7 @@ func (m *MsgCreateResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -1741,10 +1698,7 @@ func (m *MsgPut) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -1826,10 +1780,7 @@ func (m *MsgPutResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -2027,10 +1978,7 @@ func (m *MsgTake) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -2114,10 +2062,7 @@ func (m *MsgTakeResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { diff --git a/x/ecocredit/basket/types.pb.go b/x/ecocredit/basket/types.pb.go index e17cc69ac7..c3fa7be7ed 100644 --- a/x/ecocredit/basket/types.pb.go +++ b/x/ecocredit/basket/types.pb.go @@ -483,10 +483,7 @@ func (m *BasketCredit) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -606,10 +603,7 @@ func (m *DateCriteria) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/x/ecocredit/client/basket/tx.go b/x/ecocredit/client/basket/tx.go index b8c2b0c68f..72187e0e42 100644 --- a/x/ecocredit/client/basket/tx.go +++ b/x/ecocredit/client/basket/tx.go @@ -18,7 +18,6 @@ import ( ) const ( - FlagDenomPrefix = "denom-prefix" FlagExponent = "exponent" FlagDisableAutoRetire = "disable-auto-retire" FlagCreditTypeAbbreviation = "credit-type-abbreviation" @@ -39,7 +38,6 @@ Parameters: name: the name used to create a bank denom for this basket token. Flags: - denom_prefix: the prefix to be used in the basket coin's base denom. Must only be one character. exponent: the exponent used for converting credits to basket tokens and for bank denom metadata. The exponent also limits the precision of credit amounts when putting credits into a basket. An exponent of 6 will mean that 10^6 units @@ -73,11 +71,6 @@ Flags: return err } - denomPrefix, err := cmd.Flags().GetString(FlagDenomPrefix) - if err != nil { - return err - } - exponentString, err := cmd.Flags().GetString(FlagExponent) if err != nil { return err @@ -169,7 +162,6 @@ Flags: msg := basket.MsgCreate{ Curator: clientCtx.FromAddress.String(), Name: args[0], - Prefix: denomPrefix, Description: denomDescription, Exponent: uint32(exponent), DisableAutoRetire: disableAutoRetire, @@ -190,7 +182,6 @@ Flags: flags.AddTxFlagsToCmd(cmd) // command flags - cmd.Flags().String(FlagDenomPrefix, "", "the name used to create a bank denom display name") cmd.Flags().String(FlagExponent, "", "the exponent used for converting credits to basket tokens") cmd.Flags().Bool(FlagDisableAutoRetire, false, "dictates whether credits will be auto-retired upon taking") cmd.Flags().String(FlagCreditTypeAbbreviation, "", "filters against credits from this credit type name (e.g. \"carbon\")") @@ -201,11 +192,9 @@ Flags: cmd.Flags().String(FlagDenomDescription, "", "the description to be used in the bank denom metadata.") // required flags - cmd.MarkFlagRequired(FlagDenomPrefix) cmd.MarkFlagRequired(FlagExponent) cmd.MarkFlagRequired(FlagCreditTypeAbbreviation) cmd.MarkFlagRequired(FlagAllowedClasses) - cmd.MarkFlagRequired(FlagDenomPrefix) return cmd } diff --git a/x/ecocredit/go.mod b/x/ecocredit/go.mod index a78f2894ab..d6d915368b 100644 --- a/x/ecocredit/go.mod +++ b/x/ecocredit/go.mod @@ -13,7 +13,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 - github.com/regen-network/regen-ledger/api v0.4.0 + github.com/regen-network/regen-ledger/api v0.5.0 github.com/regen-network/regen-ledger/orm v1.0.0-beta1 github.com/regen-network/regen-ledger/types v1.0.0 github.com/spf13/cobra v1.2.1 diff --git a/x/ecocredit/go.sum b/x/ecocredit/go.sum index bacde1d620..b8eaaeac9c 100644 --- a/x/ecocredit/go.sum +++ b/x/ecocredit/go.sum @@ -911,8 +911,8 @@ github.com/regen-network/cosmos-sdk v0.44.2-regen-1 h1:Sm7rU4rMwLpEpgrQkF/4w/V/y github.com/regen-network/cosmos-sdk v0.44.2-regen-1/go.mod h1:fwQJdw+aECatpTvQTo1tSfHEsxACdZYU80QCZUPnHr4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= -github.com/regen-network/regen-ledger/api v0.4.0 h1:klcMljLCHU3MpkRyjrEXL6KKsDGeqFBt2aFUwFdpEH8= -github.com/regen-network/regen-ledger/api v0.4.0/go.mod h1:kWly2pK0u3fDfyoYYilpEoTEg61pCjV/f5XSY0KzJQY= +github.com/regen-network/regen-ledger/api v0.5.0 h1:Kp+16TzHxSeF0pJ1HPcUzhalCKJCkEnfiKj/NoJX6Lw= +github.com/regen-network/regen-ledger/api v0.5.0/go.mod h1:kWly2pK0u3fDfyoYYilpEoTEg61pCjV/f5XSY0KzJQY= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= diff --git a/x/ecocredit/server/basket/create.go b/x/ecocredit/server/basket/create.go index bc95aafa85..8c18f135ee 100644 --- a/x/ecocredit/server/basket/create.go +++ b/x/ecocredit/server/basket/create.go @@ -32,7 +32,7 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC if err = validateCreditType(ctx, k.ecocreditKeeper, msg.CreditTypeAbbrev, msg.Exponent); err != nil { return nil, err } - denom, displayDenomName, err := basket.MsgCreateDenom(msg) + denom, displayDenom, err := basket.BasketDenom(msg.Name, msg.CreditTypeAbbrev, msg.Exponent) if err != nil { return nil, err } @@ -43,6 +43,7 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC CreditTypeAbbrev: msg.CreditTypeAbbrev, DateCriteria: msg.DateCriteria.ToApi(), Exponent: msg.Exponent, + Name: msg.Name, }) if err != nil { return nil, err @@ -52,7 +53,7 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC } denomUnits := []*banktypes.DenomUnit{{ - Denom: displayDenomName, + Denom: displayDenom, Exponent: msg.Exponent, Aliases: nil, }} @@ -68,7 +69,7 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC DenomUnits: denomUnits, Description: msg.Description, Base: denom, - Display: displayDenomName, + Display: displayDenom, Name: msg.Name, Symbol: msg.Name, }) diff --git a/x/ecocredit/server/basket/create_test.go b/x/ecocredit/server/basket/create_test.go index 8acac2756a..c4fa70ce29 100644 --- a/x/ecocredit/server/basket/create_test.go +++ b/x/ecocredit/server/basket/create_test.go @@ -82,7 +82,7 @@ func TestDuplicateDenom(t *testing.T) { Exponent: 6, Name: "foo", } - denom, _, err := basket.MsgCreateDenom(&mc) + denom, _, err := basket.BasketDenom(mc.Name, mc.CreditTypeAbbrev, mc.Exponent) assert.NilError(t, err) assert.NilError(t, s.stateStore.BasketStore().Insert(s.ctx, &basketv1.Basket{BasketDenom: denom}, @@ -158,7 +158,6 @@ func TestGoodBasket(t *testing.T) { Curator: s.addr.String(), Description: "hi", Name: "foo", - Prefix: "u", CreditTypeAbbrev: "C", Exponent: 6, AllowedClasses: []string{"bar"}, diff --git a/x/ecocredit/server/basket/put_test.go b/x/ecocredit/server/basket/put_test.go index 8f6b51b141..6a46311ded 100644 --- a/x/ecocredit/server/basket/put_test.go +++ b/x/ecocredit/server/basket/put_test.go @@ -84,6 +84,7 @@ func TestPut(t *testing.T) { basketTbl := db.GetTable(&basketv1.Basket{}) err = basketTbl.Insert(ctx, &basketv1.Basket{ BasketDenom: basketDenom, + Name: basketDenom, DisableAutoRetire: true, CreditTypeAbbrev: "C", DateCriteria: &basketv1.DateCriteria{Sum: &basketv1.DateCriteria_MinStartDate{MinStartDate: timestamppb.New(startDate)}}, @@ -95,6 +96,7 @@ func TestPut(t *testing.T) { validStartDateWindow := startDate.Add(-dur) err = basketTbl.Insert(ctx, &basketv1.Basket{ BasketDenom: basketDenom2, + Name: basketDenom2, DisableAutoRetire: true, CreditTypeAbbrev: "C", DateCriteria: &basketv1.DateCriteria{Sum: &basketv1.DateCriteria_StartDateWindow{StartDateWindow: durationpb.New(dur)}}, diff --git a/x/ecocredit/server/basket/query_baskets_test.go b/x/ecocredit/server/basket/query_baskets_test.go index 11c3695e84..059004c8ce 100644 --- a/x/ecocredit/server/basket/query_baskets_test.go +++ b/x/ecocredit/server/basket/query_baskets_test.go @@ -16,13 +16,13 @@ func TestQueryBaskets(t *testing.T) { // add some baskets require.NoError(t, s.stateStore.BasketStore().Insert(s.ctx, &basketv1.Basket{ - BasketDenom: "foo", + BasketDenom: "foo", Name: "foo", })) require.NoError(t, s.stateStore.BasketStore().Insert(s.ctx, &basketv1.Basket{ - BasketDenom: "bar", + BasketDenom: "bar", Name: "bar", })) require.NoError(t, s.stateStore.BasketStore().Insert(s.ctx, &basketv1.Basket{ - BasketDenom: "baz", + BasketDenom: "baz", Name: "baz", })) // query all diff --git a/x/ecocredit/server/basket/take_test.go b/x/ecocredit/server/basket/take_test.go index 2f3394a5c6..ce90d1e2be 100644 --- a/x/ecocredit/server/basket/take_test.go +++ b/x/ecocredit/server/basket/take_test.go @@ -31,8 +31,9 @@ func setupTake(t *testing.T) *takeSuite { var err error s.fooBasketId, err = s.stateStore.BasketStore().InsertReturningID(s.ctx, &basketv1.Basket{ BasketDenom: "foo", + Name: "foo", DisableAutoRetire: false, - CreditTypeAbbrev: "C", + CreditTypeAbbrev: "C", Exponent: 6, }) assert.NilError(t, err) @@ -55,8 +56,9 @@ func setupTake(t *testing.T) *takeSuite { s.barBasketId, err = s.stateStore.BasketStore().InsertReturningID(s.ctx, &basketv1.Basket{ BasketDenom: "bar", + Name: "bar", DisableAutoRetire: true, - CreditTypeAbbrev: "C", + CreditTypeAbbrev: "C", Exponent: 6, }) assert.NilError(t, err) diff --git a/x/ecocredit/server/testsuite/suite.go b/x/ecocredit/server/testsuite/suite.go index a259eb09b4..c3b8c90e08 100644 --- a/x/ecocredit/server/testsuite/suite.go +++ b/x/ecocredit/server/testsuite/suite.go @@ -127,7 +127,6 @@ func (s *IntegrationTestSuite) TestBasketScenario() { Curator: s.signers[0].String(), Name: "BASKET", Exponent: 6, - Prefix: "u", DisableAutoRetire: true, CreditTypeAbbrev: "BAZ", AllowedClasses: []string{classId}, @@ -235,7 +234,6 @@ func (s *IntegrationTestSuite) TestBasketScenario() { resR, err := s.basketServer.Create(s.ctx, &basket.MsgCreate{ Curator: s.signers[0].String(), Name: "RETIRE", - Prefix: "u", Exponent: 6, DisableAutoRetire: false, CreditTypeAbbrev: "BAZ",